2 dnl "$Id: cups-compiler.m4 6049 2006-10-20 15:07:21Z 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_ENABLE(32bit, [ --enable-32bit generate 32-bit libraries on 32/64-bit systems, default=no])
50 AC_ARG_WITH(arch32flags, [ --with-arch32flags="flags"
51 specifies 32-bit architecture flags])
63 AC_SUBST(LIB32CUPSIMAGE)
67 AC_ARG_ENABLE(64bit, [ --enable-64bit generate 64-bit libraries on 32/64-bit systems, default=no])
68 AC_ARG_WITH(arch64flags, [ --with-arch64flags="flags"
69 specifies 64-bit architecture flags])
81 AC_SUBST(LIB64CUPSIMAGE)
85 dnl Position-Independent Executable support on Linux and *BSD...
86 AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no])
88 dnl Update compiler options...
95 if test -n "$GCC"; then
96 # Add GCC-specific compiler options...
97 if test -z "$OPTIM"; then
98 if test "x$with_optim" = x; then
99 # Default to optimize-for-size and debug
102 OPTIM="$with_optim $OPTIM"
106 if test $PICFLAG = 1 -a $uname != AIX; then
112 if test x$enable_pie = xyes; then
113 PIEFLAGS="-pie -fPIE"
118 if test x$enable_pie = xyes; then
119 echo "Sorry, --enable-pie is not supported on this OS!"
124 if test "x$with_optim" = x; then
125 # Add useful warning options for tracking down problems...
126 OPTIM="-Wall -Wno-format-y2k $OPTIM"
127 # Additional warning options for alpha testing...
128 OPTIM="-Wshadow -Wunused $OPTIM"
133 if test "x$enable_32bit" = xyes; then
134 # Build 32-bit libraries, 64-bit base...
135 if test -z "$with_arch32flags"; then
136 ARCH32FLAGS="-n32 -mips3"
138 ARCH32FLAGS="$with_arch32flags"
140 INSTALL32="install32bit"
141 LIB32CUPS="32bit/libcups.so.2"
142 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
143 LIB32DIR="$prefix/lib32"
144 UNINSTALL32="uninstall32bit"
146 if test -z "$with_archflags"; then
147 if test -z "$with_arch64flags"; then
148 ARCHFLAGS="-64 -mips4"
150 ARCHFLAGS="$with_arch64flags"
155 if test "x$enable_64bit" = xyes; then
156 # Build 64-bit libraries, 32-bit base...
157 if test -z "$with_arch64flags"; then
158 ARCH64FLAGS="-64 -mips4"
160 ARCH64FLAGS="$with_arch64flags"
162 INSTALL64="install64bit"
163 LIB64CUPS="64bit/libcups.so.2"
164 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
165 LIB64DIR="$prefix/lib64"
166 UNINSTALL64="uninstall64bit"
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"
186 INSTALL32="install32bit"
187 LIB32CUPS="32bit/libcups.so.2"
188 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
189 LIB32DIR="$exec_prefix/lib"
190 if test -d /usr/lib32; then
191 LIB32DIR="${LIB32DIR}32"
193 UNINSTALL32="uninstall32bit"
195 if test -z "$with_archflags"; then
196 if test -z "$with_arch64flags"; then
199 ARCHFLAGS="$with_arch64flags"
204 if test "x$enable_64bit" = xyes; then
205 # Build 64-bit libraries, 32-bit base...
206 if test -z "$with_arch64flags"; then
209 ARCH64FLAGS="$with_arch64flags"
211 INSTALL64="install64bit"
212 LIB64CUPS="64bit/libcups.so.2"
213 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
214 LIB64DIR="$exec_prefix/lib"
215 if test -d /usr/lib64; then
216 LIB64DIR="${LIB64DIR}64"
218 UNINSTALL64="uninstall64bit"
220 if test -z "$with_archflags"; then
221 if test -z "$with_arch32flags"; then
224 ARCHFLAGS="$with_arch32flags"
231 if test "x$enable_32bit" = xyes; then
232 # Build 32-bit libraries, 64-bit base...
233 if test -z "$with_arch32flags"; then
236 ARCH32FLAGS="$with_arch32flags"
238 INSTALL32="install32bit"
239 LIB32CUPS="32bit/libcups.so.2"
240 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
241 LIB32DIR="$exec_prefix/lib/32"
242 UNINSTALL32="uninstall32bit"
244 if test -z "$with_archflags"; then
245 if test -z "$with_arch64flags"; then
248 ARCHFLAGS="$with_arch64flags"
253 if test "x$enable_64bit" = xyes; then
254 # Build 64-bit libraries, 32-bit base...
255 if test -z "$with_arch64flags"; then
258 ARCH64FLAGS="$with_arch64flags"
260 INSTALL64="install64bit"
261 LIB64CUPS="64bit/libcups.so.2"
262 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
263 LIB64DIR="$exec_prefix/lib/64"
264 UNINSTALL64="uninstall64bit"
266 if test -z "$with_archflags"; then
267 if test -z "$with_arch32flags"; then
270 ARCHFLAGS="$with_arch32flags"
277 # Add vendor-specific compiler options...
280 if test -z "$OPTIM"; then
281 if test "x$with_optim" = x; then
282 OPTIM="-O2 -qmaxmem=6000"
284 OPTIM="$with_optim $OPTIM"
289 if test -z "$OPTIM"; then
290 if test "x$with_optim" = x; then
293 OPTIM="$with_optim $OPTIM"
298 # Warning 336 is "empty translation unit"
299 # Warning 829 is passing constant string as char *
300 CXXFLAGS="+W336,829 $CXXFLAGS"
302 if test $PICFLAG = 1; then
307 if test -z "$OPTIM"; then
308 if test "x$with_optim" = x; then
311 OPTIM="$with_optim $OPTIM"
315 if test "x$with_optim" = x; then
316 OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM"
319 if test "x$enable_32bit" = xyes; then
320 # Build 32-bit libraries, 64-bit base...
321 if test -z "$with_arch32flags"; then
322 ARCH32FLAGS="-n32 -mips3"
324 ARCH32FLAGS="$with_arch32flags"
326 INSTALL32="install32bit"
327 LIB32CUPS="32bit/libcups.so.2"
328 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
329 LIB32DIR="$prefix/lib32"
330 UNINSTALL32="uninstall32bit"
332 if test -z "$with_archflags"; then
333 if test -z "$with_arch64flags"; then
334 ARCHFLAGS="-64 -mips4"
336 ARCHFLAGS="$with_arch64flags"
341 if test "x$enable_64bit" = xyes; then
342 # Build 64-bit libraries, 32-bit base...
343 if test -z "$with_arch64flags"; then
344 ARCH64FLAGS="-64 -mips4"
346 ARCH64FLAGS="$with_arch64flags"
348 INSTALL64="install64bit"
349 LIB64CUPS="64bit/libcups.so.2"
350 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
351 LIB64DIR="$prefix/lib64"
352 UNINSTALL64="uninstall64bit"
354 if test -z "$with_archflags"; then
355 if test -z "$with_arch32flags"; then
356 ARCHFLAGS="-n32 -mips3"
358 ARCHFLAGS="$with_arch32flags"
364 # Tru64 UNIX aka Digital UNIX aka OSF/1
365 if test -z "$OPTIM"; then
366 if test "x$with_optim" = x; then
375 if test -z "$OPTIM"; then
376 if test "x$with_optim" = x; then
379 OPTIM="$with_optim $OPTIM"
383 if test $PICFLAG = 1; then
387 if test "x$enable_32bit" = xyes; then
388 # Compiling on a Solaris system, build 64-bit
389 # binaries with separate 32-bit libraries...
390 ARCH32FLAGS="-xarch=generic"
391 INSTALL32="install32bit"
392 LIB32CUPS="32bit/libcups.so.2"
393 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
394 LIB32DIR="$exec_prefix/lib/32"
395 UNINSTALL32="uninstall32bit"
397 if test "x$with_optim" = x; then
398 # Suppress all of Sun's questionable
399 # warning messages, and default to
400 # 64-bit compiles of everything else...
404 if test -z "$with_archflags"; then
405 if test -z "$with_arch64flags"; then
406 ARCHFLAGS="-xarch=generic64"
408 ARCHFLAGS="$with_arch64flags"
412 if test "x$enable_64bit" = xyes; then
413 # Build 64-bit libraries...
414 ARCH64FLAGS="-xarch=generic64"
415 INSTALL64="install64bit"
416 LIB64CUPS="64bit/libcups.so.2"
417 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
418 LIB64DIR="$exec_prefix/lib/64"
419 UNINSTALL64="uninstall64bit"
422 if test "x$with_optim" = x; then
423 # Suppress all of Sun's questionable
424 # warning messages, and default to
425 # 32-bit compiles of everything else...
429 if test -z "$with_archflags"; then
430 if test -z "$with_arch32flags"; then
431 ARCHFLAGS="-xarch=generic"
433 ARCHFLAGS="$with_arch32flags"
440 if test -z "$OPTIM"; then
441 if test "x$with_optim" = x; then
444 OPTIM="$with_optim $OPTIM"
448 if test $PICFLAG = 1; then
453 # Running some other operating system; inform the user they
454 # should contribute the necessary options to
455 # cups-support@cups.org...
456 echo "Building CUPS with default compiler optimizations; contact"
457 echo "cups-bugs@cups.org with uname and compiler options needed"
458 echo "for your platform, or set the CFLAGS and CXXFLAGS"
459 echo "environment variable before running configure."
464 # Add general compiler options per platform...
467 # HP-UX 10.20 (at least) needs this definition to get the
469 OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
471 # HP-UX 11.00 (at least) needs this definition to get the
472 # u_short type used by the IP headers...
473 OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
477 # Tru64 UNIX aka Digital UNIX aka OSF/1 need to be told
478 # to be POSIX-compliant...
479 OPTIM="$OPTIM -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_OSF_SOURCE"
484 dnl End of "$Id: cups-compiler.m4 6049 2006-10-20 15:07:21Z mike $".