2 dnl "$Id: cups-compiler.m4 6145 2006-12-06 20:10:16Z mike $"
4 dnl Compiler stuff for the Common UNIX Printing System (CUPS).
6 dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
8 dnl These coded instructions, statements, and computer programs are the
9 dnl property of Easy Software Products and are protected by Federal
10 dnl copyright law. Distribution and use rights are outlined in the file
11 dnl "LICENSE.txt" which should have been included with this file. If this
12 dnl file is missing or damaged please contact Easy Software Products
15 dnl Attn: CUPS Licensing Information
16 dnl Easy Software Products
17 dnl 44141 Airport View Drive, Suite 204
18 dnl Hollywood, Maryland 20636 USA
20 dnl Voice: (301) 373-9600
21 dnl EMail: cups-info@cups.org
22 dnl WWW: http://www.cups.org
25 dnl Clear the debugging and non-shared library options unless the user asks
30 AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ])
31 AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no],
32 [if test x$enable_debug = xyes; then
36 dnl Setup general architecture flags...
37 AC_ARG_WITH(archflags, [ --with-archflags="flags"
38 set default architecture flags ])
40 if test -z "$with_archflags"; then
43 ARCHFLAGS="$with_archflags"
48 dnl Setup support for separate 32/64-bit library generation...
49 AC_ARG_WITH(arch32flags, [ --with-arch32flags="flags"
50 specifies 32-bit architecture flags])
54 AC_ARG_WITH(arch64flags, [ --with-arch64flags="flags"
55 specifies 64-bit architecture flags])
59 dnl Position-Independent Executable support on Linux and *BSD...
60 AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no])
62 dnl Update compiler options...
69 if test -n "$GCC"; then
70 # Add GCC-specific compiler options...
71 if test -z "$OPTIM"; then
72 if test "x$with_optim" = x; then
73 # Default to optimize-for-size and debug
76 OPTIM="$with_optim $OPTIM"
80 if test $PICFLAG = 1 -a $uname != AIX; then
86 if test x$enable_pie = xyes; then
92 if test x$enable_pie = xyes; then
93 echo "Sorry, --enable-pie is not supported on this OS!"
98 if test "x$with_optim" = x; then
99 # Add useful warning options for tracking down problems...
100 OPTIM="-Wall -Wno-format-y2k $OPTIM"
101 # Additional warning options for alpha testing...
102 OPTIM="-Wshadow -Wunused $OPTIM"
107 if test "x$enable_32bit" = xyes; then
108 # Build 32-bit libraries, 64-bit base...
109 if test -z "$with_arch32flags"; then
110 ARCH32FLAGS="-milp32"
112 ARCH32FLAGS="$with_arch32flags"
115 if test -z "$with_archflags"; then
116 if test -z "$with_arch64flags"; then
119 ARCHFLAGS="$with_arch64flags"
124 if test "x$enable_64bit" = xyes; then
125 # Build 64-bit libraries, 32-bit base...
126 if test -z "$with_arch64flags"; then
129 ARCH64FLAGS="$with_arch64flags"
132 if test -z "$with_archflags"; then
133 if test -z "$with_arch32flags"; then
136 ARCHFLAGS="$with_arch32flags"
143 if test "x$enable_32bit" = xyes; then
144 # Build 32-bit libraries, 64-bit base...
145 if test -z "$with_arch32flags"; then
146 ARCH32FLAGS="-n32 -mips3"
148 ARCH32FLAGS="$with_arch32flags"
151 if test -z "$with_archflags"; then
152 if test -z "$with_arch64flags"; then
153 ARCHFLAGS="-64 -mips4"
155 ARCHFLAGS="$with_arch64flags"
160 if test "x$enable_64bit" = xyes; then
161 # Build 64-bit libraries, 32-bit base...
162 if test -z "$with_arch64flags"; then
163 ARCH64FLAGS="-64 -mips4"
165 ARCH64FLAGS="$with_arch64flags"
168 if test -z "$with_archflags"; then
169 if test -z "$with_arch32flags"; then
170 ARCHFLAGS="-n32 -mips3"
172 ARCHFLAGS="$with_arch32flags"
179 if test "x$enable_32bit" = xyes; then
180 # Build 32-bit libraries, 64-bit base...
181 if test -z "$with_arch32flags"; then
184 ARCH32FLAGS="$with_arch32flags"
187 if test -z "$with_archflags"; then
188 if test -z "$with_arch64flags"; then
191 ARCHFLAGS="$with_arch64flags"
196 if test "x$enable_64bit" = xyes; then
197 # Build 64-bit libraries, 32-bit base...
198 if test -z "$with_arch64flags"; then
201 ARCH64FLAGS="$with_arch64flags"
204 if test -z "$with_archflags"; then
205 if test -z "$with_arch32flags"; then
208 ARCHFLAGS="$with_arch32flags"
215 if test "x$enable_32bit" = xyes; then
216 # Build 32-bit libraries, 64-bit base...
217 if test -z "$with_arch32flags"; then
220 ARCH32FLAGS="$with_arch32flags"
223 if test -z "$with_archflags"; then
224 if test -z "$with_arch64flags"; then
227 ARCHFLAGS="$with_arch64flags"
232 if test "x$enable_64bit" = xyes; then
233 # Build 64-bit libraries, 32-bit base...
234 if test -z "$with_arch64flags"; then
237 ARCH64FLAGS="$with_arch64flags"
240 if test -z "$with_archflags"; then
241 if test -z "$with_arch32flags"; then
244 ARCHFLAGS="$with_arch32flags"
251 # Add vendor-specific compiler options...
254 if test -z "$OPTIM"; then
255 if test "x$with_optim" = x; then
256 OPTIM="-O2 -qmaxmem=6000"
258 OPTIM="$with_optim $OPTIM"
263 if test -z "$OPTIM"; then
264 if test "x$with_optim" = x; then
267 OPTIM="$with_optim $OPTIM"
272 # Warning 336 is "empty translation unit"
273 # Warning 829 is passing constant string as char *
274 CXXFLAGS="+W336,829 $CXXFLAGS"
276 if test $PICFLAG = 1; then
281 if test -z "$OPTIM"; then
282 if test "x$with_optim" = x; then
285 OPTIM="$with_optim $OPTIM"
289 if test "x$with_optim" = x; then
290 OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM"
293 if test "x$enable_32bit" = xyes; then
294 # Build 32-bit libraries, 64-bit base...
295 if test -z "$with_arch32flags"; then
296 ARCH32FLAGS="-n32 -mips3"
298 ARCH32FLAGS="$with_arch32flags"
301 if test -z "$with_archflags"; then
302 if test -z "$with_arch64flags"; then
303 ARCHFLAGS="-64 -mips4"
305 ARCHFLAGS="$with_arch64flags"
310 if test "x$enable_64bit" = xyes; then
311 # Build 64-bit libraries, 32-bit base...
312 if test -z "$with_arch64flags"; then
313 ARCH64FLAGS="-64 -mips4"
315 ARCH64FLAGS="$with_arch64flags"
318 if test -z "$with_archflags"; then
319 if test -z "$with_arch32flags"; then
320 ARCHFLAGS="-n32 -mips3"
322 ARCHFLAGS="$with_arch32flags"
328 # Tru64 UNIX aka Digital UNIX aka OSF/1
329 if test -z "$OPTIM"; then
330 if test "x$with_optim" = x; then
339 if test -z "$OPTIM"; then
340 if test "x$with_optim" = x; then
343 OPTIM="$with_optim $OPTIM"
347 if test $PICFLAG = 1; then
351 if test "x$enable_32bit" = xyes; then
352 # Compiling on a Solaris system, build 64-bit
353 # binaries with separate 32-bit libraries...
354 ARCH32FLAGS="-xarch=generic"
356 if test "x$with_optim" = x; then
357 # Suppress all of Sun's questionable
358 # warning messages, and default to
359 # 64-bit compiles of everything else...
363 if test -z "$with_archflags"; then
364 if test -z "$with_arch64flags"; then
365 ARCHFLAGS="-xarch=generic64"
367 ARCHFLAGS="$with_arch64flags"
371 if test "x$enable_64bit" = xyes; then
372 # Build 64-bit libraries...
373 ARCH64FLAGS="-xarch=generic64"
376 if test "x$with_optim" = x; then
377 # Suppress all of Sun's questionable
378 # warning messages, and default to
379 # 32-bit compiles of everything else...
383 if test -z "$with_archflags"; then
384 if test -z "$with_arch32flags"; then
385 ARCHFLAGS="-xarch=generic"
387 ARCHFLAGS="$with_arch32flags"
394 if test -z "$OPTIM"; then
395 if test "x$with_optim" = x; then
398 OPTIM="$with_optim $OPTIM"
402 if test $PICFLAG = 1; then
407 # Running some other operating system; inform the user they
408 # should contribute the necessary options to
409 # cups-support@cups.org...
410 echo "Building CUPS with default compiler optimizations; contact"
411 echo "cups-bugs@cups.org with uname and compiler options needed"
412 echo "for your platform, or set the CFLAGS and CXXFLAGS"
413 echo "environment variable before running configure."
418 # Add general compiler options per platform...
421 # HP-UX 10.20 (at least) needs this definition to get the
423 OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
425 # HP-UX 11.00 (at least) needs this definition to get the
426 # u_short type used by the IP headers...
427 OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
431 # Tru64 UNIX aka Digital UNIX aka OSF/1 need to be told
432 # to be POSIX-compliant...
433 OPTIM="$OPTIM -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_OSF_SOURCE"
438 dnl End of "$Id: cups-compiler.m4 6145 2006-12-06 20:10:16Z mike $".