2 dnl "$Id: cups-compiler.m4 5705 2006-06-30 01:07:29Z 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 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 $PICFLAG = 1; then
305 if test -z "$OPTIM"; then
306 if test "x$with_optim" = x; then
309 OPTIM="$with_optim $OPTIM"
313 if test "x$with_optim" = x; then
314 OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM"
317 if test "x$enable_32bit" = xyes; then
318 # Build 32-bit libraries, 64-bit base...
319 if test -z "$with_arch32flags"; then
320 ARCH32FLAGS="-n32 -mips3"
322 ARCH32FLAGS="$with_arch32flags"
324 INSTALL32="install32bit"
325 LIB32CUPS="32bit/libcups.so.2"
326 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
327 LIB32DIR="$prefix/lib32"
328 UNINSTALL32="uninstall32bit"
330 if test -z "$with_archflags"; then
331 if test -z "$with_arch64flags"; then
332 ARCHFLAGS="-64 -mips4"
334 ARCHFLAGS="$with_arch64flags"
339 if test "x$enable_64bit" = xyes; then
340 # Build 64-bit libraries, 32-bit base...
341 if test -z "$with_arch64flags"; then
342 ARCH64FLAGS="-64 -mips4"
344 ARCH64FLAGS="$with_arch64flags"
346 INSTALL64="install64bit"
347 LIB64CUPS="64bit/libcups.so.2"
348 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
349 LIB64DIR="$prefix/lib64"
350 UNINSTALL64="uninstall64bit"
352 if test -z "$with_archflags"; then
353 if test -z "$with_arch32flags"; then
354 ARCHFLAGS="-n32 -mips3"
356 ARCHFLAGS="$with_arch32flags"
363 if test -z "$OPTIM"; then
364 if test "x$with_optim" = x; then
367 OPTIM="$with_optim $OPTIM"
371 if test $PICFLAG = 1; then
375 if test "x$enable_32bit" = xyes; then
376 # Compiling on a Solaris system, build 64-bit
377 # binaries with separate 32-bit libraries...
378 ARCH32FLAGS="-xarch=generic"
379 INSTALL32="install32bit"
380 LIB32CUPS="32bit/libcups.so.2"
381 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
382 LIB32DIR="$exec_prefix/lib/32"
383 UNINSTALL32="uninstall32bit"
385 if test "x$with_optim" = x; then
386 # Suppress all of Sun's questionable
387 # warning messages, and default to
388 # 64-bit compiles of everything else...
392 if test -z "$with_archflags"; then
393 if test -z "$with_arch64flags"; then
394 ARCHFLAGS="-xarch=generic64"
396 ARCHFLAGS="$with_arch64flags"
400 if test "x$enable_64bit" = xyes; then
401 # Build 64-bit libraries...
402 ARCH64FLAGS="-xarch=generic64"
403 INSTALL64="install64bit"
404 LIB64CUPS="64bit/libcups.so.2"
405 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
406 LIB64DIR="$exec_prefix/lib/64"
407 UNINSTALL64="uninstall64bit"
410 if test "x$with_optim" = x; then
411 # Suppress all of Sun's questionable
412 # warning messages, and default to
413 # 32-bit compiles of everything else...
417 if test -z "$with_archflags"; then
418 if test -z "$with_arch32flags"; then
419 ARCHFLAGS="-xarch=generic"
421 ARCHFLAGS="$with_arch32flags"
428 if test -z "$OPTIM"; then
429 if test "x$with_optim" = x; then
432 OPTIM="$with_optim $OPTIM"
436 if test $PICFLAG = 1; then
441 # Running some other operating system; inform the user they
442 # should contribute the necessary options to
443 # cups-support@cups.org...
444 echo "Building CUPS with default compiler optimizations; contact"
445 echo "cups-bugs@cups.org with uname and compiler options needed"
446 echo "for your platform, or set the CFLAGS and CXXFLAGS"
447 echo "environment variable before running configure."
452 if test $uname = HP-UX; then
453 # HP-UX 10.20 (at least) needs this definition to get the
455 OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
457 # HP-UX 11.00 (at least) needs this definition to get the
458 # u_short type used by the IP headers...
459 OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
463 dnl End of "$Id: cups-compiler.m4 5705 2006-06-30 01:07:29Z mike $".