2 dnl "$Id: cups-compiler.m4 5566 2006-05-22 01:10:11Z 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
32 AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ])
33 AC_ARG_WITH(archflags, [ --with-arch="flags" set default architecture flags ])
35 AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no],
36 [if test x$enable_debug = xyes; then
40 dnl Setup support for separate 32/64-bit library generation...
41 AC_ARG_ENABLE(32bit, [ --enable-32bit generate 32-bit libraries on 32/64-bit systems, default=no])
42 AC_ARG_WITH(arch32flags, [ --with-arch32="flags" specifies 32-bit architecture flags])
54 AC_SUBST(LIB32CUPSIMAGE)
58 AC_ARG_ENABLE(64bit, [ --enable-64bit generate 64-bit libraries on 32/64-bit systems, default=no])
59 AC_ARG_WITH(arch64flags, [ --with-arch64="flags" specifies 64-bit architecture flags])
71 AC_SUBST(LIB64CUPSIMAGE)
75 dnl Position-Independent Executable support on Linux and *BSD...
76 AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no])
78 dnl Update compiler options...
85 if test -n "$GCC"; then
86 if test -z "$OPTIM"; then
87 if test "x$with_optim" = x; then
88 # Default to optimize-for-size and debug
91 OPTIM="$with_optim $OPTIM"
95 if test $PICFLAG = 1 -a $uname != AIX; then
101 if test x$enable_pie = xyes; then
102 PIEFLAGS="-pie -fPIE"
107 if test x$enable_pie = xyes; then
108 echo "Sorry, --enable-pie is not supported on this OS!"
113 if test "x$with_optim" = x; then
114 # Add useful warning options for tracking down problems...
115 OPTIM="-Wall -Wno-format-y2k $OPTIM"
116 # Additional warning options for alpha testing...
117 OPTIM="-Wshadow -Wunused $OPTIM"
122 if test -z "$with_archflags"; then
123 if test "x`uname -m`" = xi386; then
124 # Build universal binaries for OSX on Intel...
125 ARCHFLAGS="-arch i386 -arch ppc"
128 ARCHFLAGS="$with_archflags"
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"
153 ARCHFLAGS="$with_archflags"
157 if test "x$enable_64bit" = xyes; then
158 # Build 64-bit libraries, 32-bit base...
159 if test -z "$with_arch64flags"; then
160 ARCH64FLAGS="-64 -mips4"
162 ARCH64FLAGS="$with_arch64flags"
164 INSTALL64="install64bit"
165 LIB64CUPS="64bit/libcups.so.2"
166 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
167 LIB64DIR="$prefix/lib64"
168 UNINSTALL64="uninstall64bit"
170 if test -z "$with_archflags"; then
171 if test -z "$with_arch32flags"; then
172 ARCHFLAGS="-n32 -mips3"
174 ARCHFLAGS="$with_arch32flags"
177 ARCHFLAGS="$with_archflags"
183 if test "x$enable_32bit" = xyes; then
184 # Build 32-bit libraries, 64-bit base...
185 if test -z "$with_arch32flags"; then
188 ARCH32FLAGS="$with_arch32flags"
190 INSTALL32="install32bit"
191 LIB32CUPS="32bit/libcups.so.2"
192 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
193 LIB32DIR="$exec_prefix/lib"
194 if test -d /usr/lib32; then
195 LIB32DIR="${LIB32DIR}32"
197 UNINSTALL32="uninstall32bit"
199 if test -z "$with_archflags"; then
200 if test -z "$with_arch64flags"; then
203 ARCHFLAGS="$with_arch64flags"
206 ARCHFLAGS="$with_archflags"
210 if test "x$enable_64bit" = xyes; then
211 # Build 64-bit libraries, 32-bit base...
212 if test -z "$with_arch64flags"; then
215 ARCH64FLAGS="$with_arch64flags"
217 INSTALL64="install64bit"
218 LIB64CUPS="64bit/libcups.so.2"
219 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
220 LIB64DIR="$exec_prefix/lib"
221 if test -d /usr/lib64; then
222 LIB64DIR="${LIB64DIR}64"
224 UNINSTALL64="uninstall64bit"
226 if test -z "$with_archflags"; then
227 if test -z "$with_arch32flags"; then
230 ARCHFLAGS="$with_arch32flags"
233 ARCHFLAGS="$with_archflags"
239 if test "x$enable_32bit" = xyes; then
240 # Build 32-bit libraries, 64-bit base...
241 if test -z "$with_arch32flags"; then
244 ARCH32FLAGS="$with_arch32flags"
246 INSTALL32="install32bit"
247 LIB32CUPS="32bit/libcups.so.2"
248 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
249 LIB32DIR="$exec_prefix/lib/32"
250 UNINSTALL32="uninstall32bit"
252 if test -z "$with_archflags"; then
253 if test -z "$with_arch64flags"; then
256 ARCHFLAGS="$with_arch64flags"
259 ARCHFLAGS="$with_archflags"
263 if test "x$enable_64bit" = xyes; then
264 # Build 64-bit libraries, 32-bit base...
265 if test -z "$with_arch64flags"; then
268 ARCH64FLAGS="$with_arch64flags"
270 INSTALL64="install64bit"
271 LIB64CUPS="64bit/libcups.so.2"
272 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
273 LIB64DIR="$exec_prefix/lib/64"
274 UNINSTALL64="uninstall64bit"
276 if test -z "$with_archflags"; then
277 if test -z "$with_arch32flags"; then
280 ARCHFLAGS="$with_arch32flags"
283 ARCHFLAGS="$with_archflags"
291 if test -z "$OPTIM"; then
292 if test "x$with_optim" = x; then
293 OPTIM="-O2 -qmaxmem=6000"
295 OPTIM="$with_optim $OPTIM"
300 if test -z "$OPTIM"; then
301 if test "x$with_optim" = x; then
304 OPTIM="$with_optim $OPTIM"
309 # Warning 336 is "empty translation unit"
310 # Warning 829 is passing constant string as char *
311 CXXFLAGS="+W336,829 $CXXFLAGS"
313 if test -z "$with_archflags"; then
314 # Build portable binaries for all HP systems...
315 ARCHFLAGS="+DAportable"
317 ARCHFLAGS="$with_archflags"
320 if test $PICFLAG = 1; then
325 if test -z "$OPTIM"; then
326 if test "x$with_optim" = x; then
329 OPTIM="$with_optim $OPTIM"
333 if test "x$with_optim" = x; then
334 OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM"
337 if test "x$enable_32bit" = xyes; then
338 # Build 32-bit libraries, 64-bit base...
339 if test -z "$with_arch32flags"; then
340 ARCH32FLAGS="-n32 -mips3"
342 ARCH32FLAGS="$with_arch32flags"
344 INSTALL32="install32bit"
345 LIB32CUPS="32bit/libcups.so.2"
346 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
347 LIB32DIR="$prefix/lib32"
348 UNINSTALL32="uninstall32bit"
350 if test -z "$with_archflags"; then
351 if test -z "$with_arch64flags"; then
352 ARCHFLAGS="-64 -mips4"
354 ARCHFLAGS="$with_arch64flags"
357 ARCHFLAGS="$with_archflags"
361 if test "x$enable_64bit" = xyes; then
362 # Build 64-bit libraries, 32-bit base...
363 if test -z "$with_arch64flags"; then
364 ARCH64FLAGS="-64 -mips4"
366 ARCH64FLAGS="$with_arch64flags"
368 INSTALL64="install64bit"
369 LIB64CUPS="64bit/libcups.so.2"
370 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
371 LIB64DIR="$prefix/lib64"
372 UNINSTALL64="uninstall64bit"
374 if test -z "$with_archflags"; then
375 if test -z "$with_arch32flags"; then
376 ARCHFLAGS="-n32 -mips3"
378 ARCHFLAGS="$with_arch32flags"
381 ARCHFLAGS="$with_archflags"
387 if test -z "$OPTIM"; then
388 if test "x$with_optim" = x; then
391 OPTIM="$with_optim $OPTIM"
395 if test $PICFLAG = 1; then
399 if test "x$enable_32bit" = xyes; then
400 # Compiling on a Solaris system, build 64-bit
401 # binaries with separate 32-bit libraries...
402 ARCH32FLAGS="-xarch=generic"
403 INSTALL32="install32bit"
404 LIB32CUPS="32bit/libcups.so.2"
405 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
406 LIB32DIR="$exec_prefix/lib/32"
407 UNINSTALL32="uninstall32bit"
409 if test "x$with_optim" = x; then
410 # Suppress all of Sun's questionable
411 # warning messages, and default to
412 # 64-bit compiles of everything else...
416 if test -z "$with_archflags"; then
417 if test -z "$with_arch64flags"; then
418 ARCHFLAGS="-xarch=generic64"
420 ARCHFLAGS="$with_arch64flags"
423 ARCHFLAGS="$with_archflags"
426 if test "x$enable_64bit" = xyes; then
427 # Build 64-bit libraries...
428 ARCH64FLAGS="-xarch=generic64"
429 INSTALL64="install64bit"
430 LIB64CUPS="64bit/libcups.so.2"
431 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
432 LIB64DIR="$exec_prefix/lib/64"
433 UNINSTALL64="uninstall64bit"
436 if test "x$with_optim" = x; then
437 # Suppress all of Sun's questionable
438 # warning messages, and default to
439 # 32-bit compiles of everything else...
443 if test -z "$with_archflags"; then
444 if test -z "$with_arch32flags"; then
445 ARCHFLAGS="-xarch=generic"
447 ARCHFLAGS="$with_arch32flags"
450 ARCHFLAGS="$with_archflags"
456 if test -z "$OPTIM"; then
457 if test "x$with_optim" = x; then
460 OPTIM="$with_optim $OPTIM"
464 if test $PICFLAG = 1; then
469 # Running some other operating system; inform the user they
470 # should contribute the necessary options to
471 # cups-support@cups.org...
472 echo "Building CUPS with default compiler optimizations; contact"
473 echo "cups-bugs@cups.org with uname and compiler options needed"
474 echo "for your platform, or set the CFLAGS and CXXFLAGS"
475 echo "environment variable before running configure."
480 if test $uname = HP-UX; then
481 # HP-UX 10.20 (at least) needs this definition to get the
483 OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
485 # HP-UX 11.00 (at least) needs this definition to get the
486 # u_short type used by the IP headers...
487 OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
491 dnl End of "$Id: cups-compiler.m4 5566 2006-05-22 01:10:11Z mike $".