2 dnl "$Id: cups-compiler.m4 181 2006-06-22 20:01:18Z jlovell $"
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 if test -z "$OPTIM"; then
97 if test "x$with_optim" = x; then
98 # Default to optimize-for-size and debug
101 OPTIM="$with_optim $OPTIM"
105 if test $PICFLAG = 1 -a $uname != AIX; then
111 if test x$enable_pie = xyes; then
112 PIEFLAGS="-pie -fPIE"
117 if test x$enable_pie = xyes; then
118 echo "Sorry, --enable-pie is not supported on this OS!"
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"
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"
137 ARCH32FLAGS="$with_arch32flags"
139 INSTALL32="install32bit"
140 LIB32CUPS="32bit/libcups.so.2"
141 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
142 LIB32DIR="$prefix/lib32"
143 UNINSTALL32="uninstall32bit"
145 if test -z "$with_archflags"; then
146 if test -z "$with_arch64flags"; then
147 ARCHFLAGS="-64 -mips4"
149 ARCHFLAGS="$with_arch64flags"
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"
159 ARCH64FLAGS="$with_arch64flags"
161 INSTALL64="install64bit"
162 LIB64CUPS="64bit/libcups.so.2"
163 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
164 LIB64DIR="$prefix/lib64"
165 UNINSTALL64="uninstall64bit"
167 if test -z "$with_archflags"; then
168 if test -z "$with_arch32flags"; then
169 ARCHFLAGS="-n32 -mips3"
171 ARCHFLAGS="$with_arch32flags"
178 if test "x$enable_32bit" = xyes; then
179 # Build 32-bit libraries, 64-bit base...
180 if test -z "$with_arch32flags"; then
183 ARCH32FLAGS="$with_arch32flags"
185 INSTALL32="install32bit"
186 LIB32CUPS="32bit/libcups.so.2"
187 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
188 LIB32DIR="$exec_prefix/lib"
189 if test -d /usr/lib32; then
190 LIB32DIR="${LIB32DIR}32"
192 UNINSTALL32="uninstall32bit"
194 if test -z "$with_archflags"; then
195 if test -z "$with_arch64flags"; then
198 ARCHFLAGS="$with_arch64flags"
203 if test "x$enable_64bit" = xyes; then
204 # Build 64-bit libraries, 32-bit base...
205 if test -z "$with_arch64flags"; then
208 ARCH64FLAGS="$with_arch64flags"
210 INSTALL64="install64bit"
211 LIB64CUPS="64bit/libcups.so.2"
212 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
213 LIB64DIR="$exec_prefix/lib"
214 if test -d /usr/lib64; then
215 LIB64DIR="${LIB64DIR}64"
217 UNINSTALL64="uninstall64bit"
219 if test -z "$with_archflags"; then
220 if test -z "$with_arch32flags"; then
223 ARCHFLAGS="$with_arch32flags"
230 if test "x$enable_32bit" = xyes; then
231 # Build 32-bit libraries, 64-bit base...
232 if test -z "$with_arch32flags"; then
235 ARCH32FLAGS="$with_arch32flags"
237 INSTALL32="install32bit"
238 LIB32CUPS="32bit/libcups.so.2"
239 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
240 LIB32DIR="$exec_prefix/lib/32"
241 UNINSTALL32="uninstall32bit"
243 if test -z "$with_archflags"; then
244 if test -z "$with_arch64flags"; then
247 ARCHFLAGS="$with_arch64flags"
252 if test "x$enable_64bit" = xyes; then
253 # Build 64-bit libraries, 32-bit base...
254 if test -z "$with_arch64flags"; then
257 ARCH64FLAGS="$with_arch64flags"
259 INSTALL64="install64bit"
260 LIB64CUPS="64bit/libcups.so.2"
261 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
262 LIB64DIR="$exec_prefix/lib/64"
263 UNINSTALL64="uninstall64bit"
265 if test -z "$with_archflags"; then
266 if test -z "$with_arch32flags"; then
269 ARCHFLAGS="$with_arch32flags"
278 if test -z "$OPTIM"; then
279 if test "x$with_optim" = x; then
280 OPTIM="-O2 -qmaxmem=6000"
282 OPTIM="$with_optim $OPTIM"
287 if test -z "$OPTIM"; then
288 if test "x$with_optim" = x; then
291 OPTIM="$with_optim $OPTIM"
296 # Warning 336 is "empty translation unit"
297 # Warning 829 is passing constant string as char *
298 CXXFLAGS="+W336,829 $CXXFLAGS"
300 if test -z "$with_archflags"; then
301 # Build portable binaries for all HP systems...
302 ARCHFLAGS="+DAportable"
305 if test $PICFLAG = 1; then
310 if test -z "$OPTIM"; then
311 if test "x$with_optim" = x; then
314 OPTIM="$with_optim $OPTIM"
318 if test "x$with_optim" = x; then
319 OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM"
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"
327 ARCH32FLAGS="$with_arch32flags"
329 INSTALL32="install32bit"
330 LIB32CUPS="32bit/libcups.so.2"
331 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
332 LIB32DIR="$prefix/lib32"
333 UNINSTALL32="uninstall32bit"
335 if test -z "$with_archflags"; then
336 if test -z "$with_arch64flags"; then
337 ARCHFLAGS="-64 -mips4"
339 ARCHFLAGS="$with_arch64flags"
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"
349 ARCH64FLAGS="$with_arch64flags"
351 INSTALL64="install64bit"
352 LIB64CUPS="64bit/libcups.so.2"
353 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
354 LIB64DIR="$prefix/lib64"
355 UNINSTALL64="uninstall64bit"
357 if test -z "$with_archflags"; then
358 if test -z "$with_arch32flags"; then
359 ARCHFLAGS="-n32 -mips3"
361 ARCHFLAGS="$with_arch32flags"
368 if test -z "$OPTIM"; then
369 if test "x$with_optim" = x; then
372 OPTIM="$with_optim $OPTIM"
376 if test $PICFLAG = 1; then
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"
385 LIB32CUPS="32bit/libcups.so.2"
386 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
387 LIB32DIR="$exec_prefix/lib/32"
388 UNINSTALL32="uninstall32bit"
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...
397 if test -z "$with_archflags"; then
398 if test -z "$with_arch64flags"; then
399 ARCHFLAGS="-xarch=generic64"
401 ARCHFLAGS="$with_arch64flags"
405 if test "x$enable_64bit" = xyes; then
406 # Build 64-bit libraries...
407 ARCH64FLAGS="-xarch=generic64"
408 INSTALL64="install64bit"
409 LIB64CUPS="64bit/libcups.so.2"
410 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
411 LIB64DIR="$exec_prefix/lib/64"
412 UNINSTALL64="uninstall64bit"
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...
422 if test -z "$with_archflags"; then
423 if test -z "$with_arch32flags"; then
424 ARCHFLAGS="-xarch=generic"
426 ARCHFLAGS="$with_arch32flags"
433 if test -z "$OPTIM"; then
434 if test "x$with_optim" = x; then
437 OPTIM="$with_optim $OPTIM"
441 if test $PICFLAG = 1; then
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."
457 if test $uname = HP-UX; then
458 # HP-UX 10.20 (at least) needs this definition to get the
460 OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
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"
468 dnl End of "$Id: cups-compiler.m4 181 2006-06-22 20:01:18Z jlovell $".