2 dnl "$Id: cups-compiler.m4 6447 2007-04-10 18:02:00Z mike $"
4 dnl Compiler stuff for the Common UNIX Printing System (CUPS).
6 dnl Copyright 1997-2007 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...
60 AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no])
62 dnl Read-only data/program support on Linux...
63 AC_ARG_ENABLE(relro, [ --enable-relro use GCC relro option, default=no])
65 dnl Update compiler options...
75 if test -n "$GCC"; then
76 # Add GCC-specific compiler options...
77 if test -z "$OPTIM"; then
78 if test "x$with_optim" = x; then
79 # Default to optimize-for-size and debug
82 OPTIM="$with_optim $OPTIM"
86 if test $PICFLAG = 1 -a $uname != AIX; then
92 if test x$enable_pie = xyes; then
96 if test x$enable_relro = xyes; then
97 RELROFLAGS="-Wl,-z,relro"
102 if test x$enable_pie = xyes; then
103 echo "Sorry, --enable-pie is not supported on this OS!"
108 if test "x$with_optim" = x; then
109 # Add useful warning options for tracking down problems...
110 OPTIM="-Wall -Wno-format-y2k $OPTIM"
111 # Additional warning options for alpha testing...
112 OPTIM="-Wshadow -Wunused $OPTIM"
117 if test "x$enable_32bit" = xyes; then
118 # Build 32-bit libraries, 64-bit base...
119 if test -z "$with_arch32flags"; then
120 ARCH32FLAGS="-milp32"
122 ARCH32FLAGS="$with_arch32flags"
125 if test -z "$with_archflags"; then
126 if test -z "$with_arch64flags"; then
129 ARCHFLAGS="$with_arch64flags"
134 if test "x$enable_64bit" = xyes; then
135 # Build 64-bit libraries, 32-bit base...
136 if test -z "$with_arch64flags"; then
139 ARCH64FLAGS="$with_arch64flags"
142 if test -z "$with_archflags"; then
143 if test -z "$with_arch32flags"; then
146 ARCHFLAGS="$with_arch32flags"
153 if test "x$enable_32bit" = xyes; then
154 # Build 32-bit libraries, 64-bit base...
155 if test -z "$with_arch32flags"; then
156 ARCH32FLAGS="-n32 -mips3"
158 ARCH32FLAGS="$with_arch32flags"
161 if test -z "$with_archflags"; then
162 if test -z "$with_arch64flags"; then
163 ARCHFLAGS="-64 -mips4"
165 ARCHFLAGS="$with_arch64flags"
170 if test "x$enable_64bit" = xyes; then
171 # Build 64-bit libraries, 32-bit base...
172 if test -z "$with_arch64flags"; then
173 ARCH64FLAGS="-64 -mips4"
175 ARCH64FLAGS="$with_arch64flags"
178 if test -z "$with_archflags"; then
179 if test -z "$with_arch32flags"; then
180 ARCHFLAGS="-n32 -mips3"
182 ARCHFLAGS="$with_arch32flags"
189 if test "x$enable_32bit" = xyes; then
190 # Build 32-bit libraries, 64-bit base...
191 if test -z "$with_arch32flags"; then
194 ARCH32FLAGS="$with_arch32flags"
197 if test -z "$with_archflags"; then
198 if test -z "$with_arch64flags"; then
201 ARCHFLAGS="$with_arch64flags"
206 if test "x$enable_64bit" = xyes; then
207 # Build 64-bit libraries, 32-bit base...
208 if test -z "$with_arch64flags"; then
211 ARCH64FLAGS="$with_arch64flags"
214 if test -z "$with_archflags"; then
215 if test -z "$with_arch32flags"; then
218 ARCHFLAGS="$with_arch32flags"
225 if test "x$enable_32bit" = xyes; then
226 # Build 32-bit libraries, 64-bit base...
227 if test -z "$with_arch32flags"; then
230 ARCH32FLAGS="$with_arch32flags"
233 if test -z "$with_archflags"; then
234 if test -z "$with_arch64flags"; then
237 ARCHFLAGS="$with_arch64flags"
242 if test "x$enable_64bit" = xyes; then
243 # Build 64-bit libraries, 32-bit base...
244 if test -z "$with_arch64flags"; then
247 ARCH64FLAGS="$with_arch64flags"
250 if test -z "$with_archflags"; then
251 if test -z "$with_arch32flags"; then
254 ARCHFLAGS="$with_arch32flags"
261 # Add vendor-specific compiler options...
264 if test -z "$OPTIM"; then
265 if test "x$with_optim" = x; then
266 OPTIM="-O2 -qmaxmem=6000"
268 OPTIM="$with_optim $OPTIM"
273 if test -z "$OPTIM"; then
274 if test "x$with_optim" = x; then
277 OPTIM="$with_optim $OPTIM"
282 # Warning 336 is "empty translation unit"
283 # Warning 829 is passing constant string as char *
284 CXXFLAGS="+W336,829 $CXXFLAGS"
286 if test $PICFLAG = 1; then
291 if test -z "$OPTIM"; then
292 if test "x$with_optim" = x; then
295 OPTIM="$with_optim $OPTIM"
299 if test "x$with_optim" = x; then
300 OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM"
303 if test "x$enable_32bit" = xyes; then
304 # Build 32-bit libraries, 64-bit base...
305 if test -z "$with_arch32flags"; then
306 ARCH32FLAGS="-n32 -mips3"
308 ARCH32FLAGS="$with_arch32flags"
311 if test -z "$with_archflags"; then
312 if test -z "$with_arch64flags"; then
313 ARCHFLAGS="-64 -mips4"
315 ARCHFLAGS="$with_arch64flags"
320 if test "x$enable_64bit" = xyes; then
321 # Build 64-bit libraries, 32-bit base...
322 if test -z "$with_arch64flags"; then
323 ARCH64FLAGS="-64 -mips4"
325 ARCH64FLAGS="$with_arch64flags"
328 if test -z "$with_archflags"; then
329 if test -z "$with_arch32flags"; then
330 ARCHFLAGS="-n32 -mips3"
332 ARCHFLAGS="$with_arch32flags"
338 # Tru64 UNIX aka Digital UNIX aka OSF/1
339 if test -z "$OPTIM"; then
340 if test "x$with_optim" = x; then
349 if test -z "$OPTIM"; then
350 if test "x$with_optim" = x; then
353 OPTIM="$with_optim $OPTIM"
357 if test $PICFLAG = 1; then
361 if test "x$enable_32bit" = xyes; then
362 # Compiling on a Solaris system, build 64-bit
363 # binaries with separate 32-bit libraries...
364 ARCH32FLAGS="-xarch=generic"
366 if test "x$with_optim" = x; then
367 # Suppress all of Sun's questionable
368 # warning messages, and default to
369 # 64-bit compiles of everything else...
373 if test -z "$with_archflags"; then
374 if test -z "$with_arch64flags"; then
375 ARCHFLAGS="-xarch=generic64"
377 ARCHFLAGS="$with_arch64flags"
381 if test "x$enable_64bit" = xyes; then
382 # Build 64-bit libraries...
383 ARCH64FLAGS="-xarch=generic64"
386 if test "x$with_optim" = x; then
387 # Suppress all of Sun's questionable
388 # warning messages, and default to
389 # 32-bit compiles of everything else...
393 if test -z "$with_archflags"; then
394 if test -z "$with_arch32flags"; then
395 ARCHFLAGS="-xarch=generic"
397 ARCHFLAGS="$with_arch32flags"
404 if test -z "$OPTIM"; then
405 if test "x$with_optim" = x; then
408 OPTIM="$with_optim $OPTIM"
412 if test $PICFLAG = 1; then
417 # Running some other operating system; inform the user they
418 # should contribute the necessary options to
419 # cups-support@cups.org...
420 echo "Building CUPS with default compiler optimizations; contact"
421 echo "cups-bugs@cups.org with uname and compiler options needed"
422 echo "for your platform, or set the CFLAGS and CXXFLAGS"
423 echo "environment variable before running configure."
428 # Add general compiler options per platform...
431 # HP-UX 10.20 (at least) needs this definition to get the
433 OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
435 # HP-UX 11.00 (at least) needs this definition to get the
436 # u_short type used by the IP headers...
437 OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
439 # HP-UX 11.23 (at least) needs this definition to get the
440 # IPv6 header to work...
441 OPTIM="$OPTIM -D_HPUX_SOURCE"
445 # Tru64 UNIX aka Digital UNIX aka OSF/1 need to be told
446 # to be POSIX-compliant...
447 OPTIM="$OPTIM -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_OSF_SOURCE"
452 dnl End of "$Id: cups-compiler.m4 6447 2007-04-10 18:02:00Z mike $".