]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-compiler.m4
Remove svn:keywords since they cause svn_load_dirs.pl to complain about every file.
[thirdparty/cups.git] / config-scripts / cups-compiler.m4
CommitLineData
ef416fc2 1dnl
c07d5b2d 2dnl "$Id: cups-compiler.m4 181 2006-06-22 20:01:18Z jlovell $"
ef416fc2 3dnl
4dnl Compiler stuff for the Common UNIX Printing System (CUPS).
5dnl
6dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
7dnl
8dnl These coded instructions, statements, and computer programs are the
9dnl property of Easy Software Products and are protected by Federal
10dnl copyright law. Distribution and use rights are outlined in the file
11dnl "LICENSE.txt" which should have been included with this file. If this
12dnl file is missing or damaged please contact Easy Software Products
13dnl at:
14dnl
15dnl Attn: CUPS Licensing Information
16dnl Easy Software Products
17dnl 44141 Airport View Drive, Suite 204
18dnl Hollywood, Maryland 20636 USA
19dnl
20dnl Voice: (301) 373-9600
21dnl EMail: cups-info@cups.org
22dnl WWW: http://www.cups.org
23dnl
24
25dnl Clear the debugging and non-shared library options unless the user asks
26dnl for them...
27OPTIM=""
28AC_SUBST(OPTIM)
29
fa73b229 30AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ])
ef416fc2 31AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no],
32 [if test x$enable_debug = xyes; then
33 OPTIM="-g"
34 fi])
35
ed486911 36dnl Setup general architecture flags...
37AC_ARG_WITH(archflags, [ --with-archflags="flags"
38 set default architecture flags ])
39
40if test -z "$with_archflags"; then
41 ARCHFLAGS=""
42else
43 ARCHFLAGS="$with_archflags"
44fi
45
46AC_SUBST(ARCHFLAGS)
47
e1d6a774 48dnl Setup support for separate 32/64-bit library generation...
49AC_ARG_ENABLE(32bit, [ --enable-32bit generate 32-bit libraries on 32/64-bit systems, default=no])
ed486911 50AC_ARG_WITH(arch32flags, [ --with-arch32flags="flags"
51 specifies 32-bit architecture flags])
e1d6a774 52
53ARCH32FLAGS=""
54INSTALL32=""
55LIB32CUPS=""
56LIB32CUPSIMAGE=""
57LIB32DIR=""
58UNINSTALL32=""
59
60AC_SUBST(ARCH32FLAGS)
61AC_SUBST(INSTALL32)
62AC_SUBST(LIB32CUPS)
63AC_SUBST(LIB32CUPSIMAGE)
64AC_SUBST(LIB32DIR)
65AC_SUBST(UNINSTALL32)
66
67AC_ARG_ENABLE(64bit, [ --enable-64bit generate 64-bit libraries on 32/64-bit systems, default=no])
ed486911 68AC_ARG_WITH(arch64flags, [ --with-arch64flags="flags"
69 specifies 64-bit architecture flags])
e1d6a774 70
71ARCH64FLAGS=""
72INSTALL64=""
73LIB64CUPS=""
74LIB64CUPSIMAGE=""
75LIB64DIR=""
76UNINSTALL64=""
77
78AC_SUBST(ARCH64FLAGS)
79AC_SUBST(INSTALL64)
80AC_SUBST(LIB64CUPS)
81AC_SUBST(LIB64CUPSIMAGE)
82AC_SUBST(LIB64DIR)
83AC_SUBST(UNINSTALL64)
84
85dnl Position-Independent Executable support on Linux and *BSD...
a74454a7 86AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no])
ef416fc2 87
88dnl Update compiler options...
89CXXLIBS=""
90AC_SUBST(CXXLIBS)
91
a74454a7 92PIEFLAGS=""
93AC_SUBST(PIEFLAGS)
94
ef416fc2 95if test -n "$GCC"; then
96 if test -z "$OPTIM"; then
97 if test "x$with_optim" = x; then
98 # Default to optimize-for-size and debug
99 OPTIM="-Os -g"
100 else
101 OPTIM="$with_optim $OPTIM"
102 fi
103 fi
104
105 if test $PICFLAG = 1 -a $uname != AIX; then
106 OPTIM="-fPIC $OPTIM"
107 fi
108
109 case $uname in
ef416fc2 110 Linux*)
fa73b229 111 if test x$enable_pie = xyes; then
a74454a7 112 PIEFLAGS="-pie -fPIE"
113 fi
114 ;;
115
116 *)
117 if test x$enable_pie = xyes; then
118 echo "Sorry, --enable-pie is not supported on this OS!"
fa73b229 119 fi
ef416fc2 120 ;;
121 esac
122
123 if test "x$with_optim" = x; then
124 # Add useful warning options for tracking down problems...
125 OPTIM="-Wall -Wno-format-y2k $OPTIM"
126 # Additional warning options for alpha testing...
127 OPTIM="-Wshadow -Wunused $OPTIM"
128 fi
e1d6a774 129
130 case "$uname" in
e1d6a774 131 IRIX)
132 if test "x$enable_32bit" = xyes; then
133 # Build 32-bit libraries, 64-bit base...
134 if test -z "$with_arch32flags"; then
135 ARCH32FLAGS="-n32 -mips3"
136 else
137 ARCH32FLAGS="$with_arch32flags"
138 fi
139 INSTALL32="install32bit"
f301802f 140 LIB32CUPS="32bit/libcups.so.2"
141 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
e1d6a774 142 LIB32DIR="$prefix/lib32"
143 UNINSTALL32="uninstall32bit"
144
145 if test -z "$with_archflags"; then
146 if test -z "$with_arch64flags"; then
147 ARCHFLAGS="-64 -mips4"
148 else
149 ARCHFLAGS="$with_arch64flags"
150 fi
e1d6a774 151 fi
152 fi
153
154 if test "x$enable_64bit" = xyes; then
155 # Build 64-bit libraries, 32-bit base...
156 if test -z "$with_arch64flags"; then
157 ARCH64FLAGS="-64 -mips4"
158 else
159 ARCH64FLAGS="$with_arch64flags"
160 fi
161 INSTALL64="install64bit"
f301802f 162 LIB64CUPS="64bit/libcups.so.2"
163 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
e1d6a774 164 LIB64DIR="$prefix/lib64"
165 UNINSTALL64="uninstall64bit"
166
167 if test -z "$with_archflags"; then
168 if test -z "$with_arch32flags"; then
169 ARCHFLAGS="-n32 -mips3"
170 else
171 ARCHFLAGS="$with_arch32flags"
172 fi
e1d6a774 173 fi
174 fi
175 ;;
176
177 Linux*)
178 if test "x$enable_32bit" = xyes; then
179 # Build 32-bit libraries, 64-bit base...
180 if test -z "$with_arch32flags"; then
181 ARCH32FLAGS="-m32"
182 else
183 ARCH32FLAGS="$with_arch32flags"
184 fi
185 INSTALL32="install32bit"
f301802f 186 LIB32CUPS="32bit/libcups.so.2"
187 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
e1d6a774 188 LIB32DIR="$exec_prefix/lib"
189 if test -d /usr/lib32; then
190 LIB32DIR="${LIB32DIR}32"
191 fi
192 UNINSTALL32="uninstall32bit"
193
194 if test -z "$with_archflags"; then
195 if test -z "$with_arch64flags"; then
196 ARCHFLAGS="-m64"
197 else
198 ARCHFLAGS="$with_arch64flags"
199 fi
e1d6a774 200 fi
201 fi
202
203 if test "x$enable_64bit" = xyes; then
204 # Build 64-bit libraries, 32-bit base...
205 if test -z "$with_arch64flags"; then
206 ARCH64FLAGS="-m64"
207 else
208 ARCH64FLAGS="$with_arch64flags"
209 fi
210 INSTALL64="install64bit"
f301802f 211 LIB64CUPS="64bit/libcups.so.2"
212 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
e1d6a774 213 LIB64DIR="$exec_prefix/lib"
214 if test -d /usr/lib64; then
215 LIB64DIR="${LIB64DIR}64"
216 fi
217 UNINSTALL64="uninstall64bit"
218
219 if test -z "$with_archflags"; then
220 if test -z "$with_arch32flags"; then
221 ARCHFLAGS="-m32"
222 else
223 ARCHFLAGS="$with_arch32flags"
224 fi
e1d6a774 225 fi
226 fi
227 ;;
228
229 SunOS*)
230 if test "x$enable_32bit" = xyes; then
231 # Build 32-bit libraries, 64-bit base...
232 if test -z "$with_arch32flags"; then
233 ARCH32FLAGS="-m32"
234 else
235 ARCH32FLAGS="$with_arch32flags"
236 fi
237 INSTALL32="install32bit"
f301802f 238 LIB32CUPS="32bit/libcups.so.2"
239 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
e1d6a774 240 LIB32DIR="$exec_prefix/lib/32"
241 UNINSTALL32="uninstall32bit"
242
243 if test -z "$with_archflags"; then
244 if test -z "$with_arch64flags"; then
245 ARCHFLAGS="-m64"
246 else
247 ARCHFLAGS="$with_arch64flags"
248 fi
e1d6a774 249 fi
250 fi
251
252 if test "x$enable_64bit" = xyes; then
253 # Build 64-bit libraries, 32-bit base...
254 if test -z "$with_arch64flags"; then
255 ARCH64FLAGS="-m64"
256 else
257 ARCH64FLAGS="$with_arch64flags"
258 fi
259 INSTALL64="install64bit"
f301802f 260 LIB64CUPS="64bit/libcups.so.2"
261 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
e1d6a774 262 LIB64DIR="$exec_prefix/lib/64"
263 UNINSTALL64="uninstall64bit"
264
265 if test -z "$with_archflags"; then
266 if test -z "$with_arch32flags"; then
267 ARCHFLAGS="-m32"
268 else
269 ARCHFLAGS="$with_arch32flags"
270 fi
e1d6a774 271 fi
272 fi
273 ;;
274 esac
ef416fc2 275else
276 case $uname in
277 AIX*)
278 if test -z "$OPTIM"; then
279 if test "x$with_optim" = x; then
280 OPTIM="-O2 -qmaxmem=6000"
281 else
282 OPTIM="$with_optim $OPTIM"
283 fi
284 fi
285 ;;
286 HP-UX*)
287 if test -z "$OPTIM"; then
288 if test "x$with_optim" = x; then
289 OPTIM="+O2"
290 else
291 OPTIM="$with_optim $OPTIM"
292 fi
293 fi
294
295 CFLAGS="-Ae $CFLAGS"
e1d6a774 296 # Warning 336 is "empty translation unit"
297 # Warning 829 is passing constant string as char *
298 CXXFLAGS="+W336,829 $CXXFLAGS"
ef416fc2 299
f301802f 300 if test -z "$with_archflags"; then
301 # Build portable binaries for all HP systems...
302 ARCHFLAGS="+DAportable"
ef416fc2 303 fi
304
305 if test $PICFLAG = 1; then
306 OPTIM="+z $OPTIM"
307 fi
308 ;;
309 IRIX)
310 if test -z "$OPTIM"; then
311 if test "x$with_optim" = x; then
312 OPTIM="-O2"
313 else
314 OPTIM="$with_optim $OPTIM"
315 fi
316 fi
317
e1d6a774 318 if test "x$with_optim" = x; then
319 OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM"
ef416fc2 320 fi
321
e1d6a774 322 if test "x$enable_32bit" = xyes; then
323 # Build 32-bit libraries, 64-bit base...
324 if test -z "$with_arch32flags"; then
325 ARCH32FLAGS="-n32 -mips3"
326 else
327 ARCH32FLAGS="$with_arch32flags"
328 fi
329 INSTALL32="install32bit"
f301802f 330 LIB32CUPS="32bit/libcups.so.2"
331 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
e1d6a774 332 LIB32DIR="$prefix/lib32"
333 UNINSTALL32="uninstall32bit"
334
335 if test -z "$with_archflags"; then
336 if test -z "$with_arch64flags"; then
337 ARCHFLAGS="-64 -mips4"
338 else
339 ARCHFLAGS="$with_arch64flags"
340 fi
e1d6a774 341 fi
342 fi
343
344 if test "x$enable_64bit" = xyes; then
345 # Build 64-bit libraries, 32-bit base...
346 if test -z "$with_arch64flags"; then
347 ARCH64FLAGS="-64 -mips4"
348 else
349 ARCH64FLAGS="$with_arch64flags"
350 fi
351 INSTALL64="install64bit"
f301802f 352 LIB64CUPS="64bit/libcups.so.2"
353 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
e1d6a774 354 LIB64DIR="$prefix/lib64"
355 UNINSTALL64="uninstall64bit"
356
357 if test -z "$with_archflags"; then
358 if test -z "$with_arch32flags"; then
359 ARCHFLAGS="-n32 -mips3"
360 else
361 ARCHFLAGS="$with_arch32flags"
362 fi
ef416fc2 363 fi
364 fi
365 ;;
366 SunOS*)
367 # Solaris
368 if test -z "$OPTIM"; then
369 if test "x$with_optim" = x; then
ed486911 370 OPTIM="-xO2"
ef416fc2 371 else
372 OPTIM="$with_optim $OPTIM"
373 fi
374 fi
375
ef416fc2 376 if test $PICFLAG = 1; then
377 OPTIM="-KPIC $OPTIM"
378 fi
e1d6a774 379
380 if test "x$enable_32bit" = xyes; then
381 # Compiling on a Solaris system, build 64-bit
382 # binaries with separate 32-bit libraries...
383 ARCH32FLAGS="-xarch=generic"
384 INSTALL32="install32bit"
f301802f 385 LIB32CUPS="32bit/libcups.so.2"
386 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
e1d6a774 387 LIB32DIR="$exec_prefix/lib/32"
388 UNINSTALL32="uninstall32bit"
389
390 if test "x$with_optim" = x; then
391 # Suppress all of Sun's questionable
392 # warning messages, and default to
393 # 64-bit compiles of everything else...
394 OPTIM="-w $OPTIM"
f301802f 395 fi
396
397 if test -z "$with_archflags"; then
398 if test -z "$with_arch64flags"; then
399 ARCHFLAGS="-xarch=generic64"
400 else
401 ARCHFLAGS="$with_arch64flags"
402 fi
e1d6a774 403 fi
404 else
405 if test "x$enable_64bit" = xyes; then
406 # Build 64-bit libraries...
407 ARCH64FLAGS="-xarch=generic64"
408 INSTALL64="install64bit"
f301802f 409 LIB64CUPS="64bit/libcups.so.2"
410 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
e1d6a774 411 LIB64DIR="$exec_prefix/lib/64"
412 UNINSTALL64="uninstall64bit"
f301802f 413 fi
414
415 if test "x$with_optim" = x; then
416 # Suppress all of Sun's questionable
417 # warning messages, and default to
418 # 32-bit compiles of everything else...
419 OPTIM="-w $OPTIM"
420 fi
e1d6a774 421
f301802f 422 if test -z "$with_archflags"; then
423 if test -z "$with_arch32flags"; then
424 ARCHFLAGS="-xarch=generic"
425 else
426 ARCHFLAGS="$with_arch32flags"
e1d6a774 427 fi
e1d6a774 428 fi
429 fi
ef416fc2 430 ;;
431 UNIX_SVR*)
432 # UnixWare
433 if test -z "$OPTIM"; then
434 if test "x$with_optim" = x; then
435 OPTIM="-O"
436 else
437 OPTIM="$with_optim $OPTIM"
438 fi
439 fi
440
441 if test $PICFLAG = 1; then
442 OPTIM="-KPIC $OPTIM"
443 fi
444 ;;
445 *)
446 # Running some other operating system; inform the user they
447 # should contribute the necessary options to
448 # cups-support@cups.org...
449 echo "Building CUPS with default compiler optimizations; contact"
450 echo "cups-bugs@cups.org with uname and compiler options needed"
451 echo "for your platform, or set the CFLAGS and CXXFLAGS"
452 echo "environment variable before running configure."
453 ;;
454 esac
455fi
456
457if test $uname = HP-UX; then
458 # HP-UX 10.20 (at least) needs this definition to get the
459 # h_errno global...
460 OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
461
462 # HP-UX 11.00 (at least) needs this definition to get the
463 # u_short type used by the IP headers...
464 OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
465fi
466
467dnl
c07d5b2d 468dnl End of "$Id: cups-compiler.m4 181 2006-06-22 20:01:18Z jlovell $".
ef416fc2 469dnl