2 dnl "$Id: cups-compiler.m4 5288 2006-03-14 02:38:07Z 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...
82 if test -n "$GCC"; then
83 if test -z "$OPTIM"; then
84 if test "x$with_optim" = x; then
85 # Default to optimize-for-size and debug
88 OPTIM="$with_optim $OPTIM"
92 if test $PICFLAG = 1 -a $uname != AIX; then
98 if test x$enable_pie = xyes; then
100 LDFLAGS="$LDFLAGS -pie"
105 if test "x$with_optim" = x; then
106 # Add useful warning options for tracking down problems...
107 OPTIM="-Wall -Wno-format-y2k $OPTIM"
108 # Additional warning options for alpha testing...
109 OPTIM="-Wshadow -Wunused $OPTIM"
114 if test -z "$with_archflags"; then
115 if test "x`uname -m`" = xi386; then
116 # Build universal binaries for OSX on Intel...
117 ARCHFLAGS="-arch i386 -arch ppc"
120 ARCHFLAGS="$with_archflags"
125 if test "x$enable_32bit" = xyes; then
126 # Build 32-bit libraries, 64-bit base...
127 if test -z "$with_arch32flags"; then
128 ARCH32FLAGS="-n32 -mips3"
130 ARCH32FLAGS="$with_arch32flags"
132 INSTALL32="install32bit"
133 LIB32CUPS="libcups.32.so.2"
134 LIB32CUPSIMAGE="libcupsimage.32.so.2"
135 LIB32DIR="$prefix/lib32"
136 UNINSTALL32="uninstall32bit"
138 if test -z "$with_archflags"; then
139 if test -z "$with_arch64flags"; then
140 ARCHFLAGS="-64 -mips4"
142 ARCHFLAGS="$with_arch64flags"
145 ARCHFLAGS="$with_archflags"
149 if test "x$enable_64bit" = xyes; then
150 # Build 64-bit libraries, 32-bit base...
151 if test -z "$with_arch64flags"; then
152 ARCH64FLAGS="-64 -mips4"
154 ARCH64FLAGS="$with_arch64flags"
156 INSTALL64="install64bit"
157 LIB64CUPS="libcups.64.so.2"
158 LIB64CUPSIMAGE="libcupsimage.64.so.2"
159 LIB64DIR="$prefix/lib64"
160 UNINSTALL64="uninstall64bit"
162 if test -z "$with_archflags"; then
163 if test -z "$with_arch32flags"; then
164 ARCHFLAGS="-n32 -mips3"
166 ARCHFLAGS="$with_arch32flags"
169 ARCHFLAGS="$with_archflags"
175 if test "x$enable_32bit" = xyes; then
176 # Build 32-bit libraries, 64-bit base...
177 if test -z "$with_arch32flags"; then
180 ARCH32FLAGS="$with_arch32flags"
182 INSTALL32="install32bit"
183 LIB32CUPS="libcups.32.so.2"
184 LIB32CUPSIMAGE="libcupsimage.32.so.2"
185 LIB32DIR="$exec_prefix/lib"
186 if test -d /usr/lib32; then
187 LIB32DIR="${LIB32DIR}32"
189 UNINSTALL32="uninstall32bit"
191 if test -z "$with_archflags"; then
192 if test -z "$with_arch64flags"; then
195 ARCHFLAGS="$with_arch64flags"
198 ARCHFLAGS="$with_archflags"
202 if test "x$enable_64bit" = xyes; then
203 # Build 64-bit libraries, 32-bit base...
204 if test -z "$with_arch64flags"; then
207 ARCH64FLAGS="$with_arch64flags"
209 INSTALL64="install64bit"
210 LIB64CUPS="libcups.64.so.2"
211 LIB64CUPSIMAGE="libcupsimage.64.so.2"
212 LIB64DIR="$exec_prefix/lib"
213 if test -d /usr/lib64; then
214 LIB64DIR="${LIB64DIR}64"
216 UNINSTALL64="uninstall64bit"
218 if test -z "$with_archflags"; then
219 if test -z "$with_arch32flags"; then
222 ARCHFLAGS="$with_arch32flags"
225 ARCHFLAGS="$with_archflags"
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="libcups.32.so.2"
240 LIB32CUPSIMAGE="libcupsimage.32.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"
251 ARCHFLAGS="$with_archflags"
255 if test "x$enable_64bit" = xyes; then
256 # Build 64-bit libraries, 32-bit base...
257 if test -z "$with_arch64flags"; then
260 ARCH64FLAGS="$with_arch64flags"
262 INSTALL64="install64bit"
263 LIB64CUPS="libcups.64.so.2"
264 LIB64CUPSIMAGE="libcupsimage.64.so.2"
265 LIB64DIR="$exec_prefix/lib/64"
266 UNINSTALL64="uninstall64bit"
268 if test -z "$with_archflags"; then
269 if test -z "$with_arch32flags"; then
272 ARCHFLAGS="$with_arch32flags"
275 ARCHFLAGS="$with_archflags"
283 if test -z "$OPTIM"; then
284 if test "x$with_optim" = x; then
285 OPTIM="-O2 -qmaxmem=6000"
287 OPTIM="$with_optim $OPTIM"
292 if test -z "$OPTIM"; then
293 if test "x$with_optim" = x; then
296 OPTIM="$with_optim $OPTIM"
301 # Warning 336 is "empty translation unit"
302 # Warning 829 is passing constant string as char *
303 CXXFLAGS="+W336,829 $CXXFLAGS"
305 if test "x$with_optim" = x; then
306 OPTIM="+DAportable $OPTIM"
309 if test $PICFLAG = 1; then
314 if test -z "$OPTIM"; then
315 if test "x$with_optim" = x; then
318 OPTIM="$with_optim $OPTIM"
322 if test "x$with_optim" = x; then
323 OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM"
326 if test "x$enable_32bit" = xyes; then
327 # Build 32-bit libraries, 64-bit base...
328 if test -z "$with_arch32flags"; then
329 ARCH32FLAGS="-n32 -mips3"
331 ARCH32FLAGS="$with_arch32flags"
333 INSTALL32="install32bit"
334 LIB32CUPS="libcups.32.so.2"
335 LIB32CUPSIMAGE="libcupsimage.32.so.2"
336 LIB32DIR="$prefix/lib32"
337 UNINSTALL32="uninstall32bit"
339 if test -z "$with_archflags"; then
340 if test -z "$with_arch64flags"; then
341 ARCHFLAGS="-64 -mips4"
343 ARCHFLAGS="$with_arch64flags"
346 ARCHFLAGS="$with_archflags"
350 if test "x$enable_64bit" = xyes; then
351 # Build 64-bit libraries, 32-bit base...
352 if test -z "$with_arch64flags"; then
353 ARCH64FLAGS="-64 -mips4"
355 ARCH64FLAGS="$with_arch64flags"
357 INSTALL64="install64bit"
358 LIB64CUPS="libcups.64.so.2"
359 LIB64CUPSIMAGE="libcupsimage.64.so.2"
360 LIB64DIR="$prefix/lib64"
361 UNINSTALL64="uninstall64bit"
363 if test -z "$with_archflags"; then
364 if test -z "$with_arch32flags"; then
365 ARCHFLAGS="-n32 -mips3"
367 ARCHFLAGS="$with_arch32flags"
370 ARCHFLAGS="$with_archflags"
376 if test -z "$OPTIM"; then
377 if test "x$with_optim" = x; then
380 OPTIM="$with_optim $OPTIM"
384 if test $PICFLAG = 1; then
388 if test "x$enable_32bit" = xyes; then
389 # Compiling on a Solaris system, build 64-bit
390 # binaries with separate 32-bit libraries...
391 ARCH32FLAGS="-xarch=generic"
392 INSTALL32="install32bit"
393 LIB32CUPS="libcups.32.so.2"
394 LIB32CUPSIMAGE="libcupsimage.32.so.2"
395 LIB32DIR="$exec_prefix/lib/32"
396 UNINSTALL32="uninstall32bit"
398 if test "x$with_optim" = x; then
399 # Suppress all of Sun's questionable
400 # warning messages, and default to
401 # 64-bit compiles of everything else...
403 CFLAGS="-xarch=generic64 $CFLAGS"
406 if test "x$enable_64bit" = xyes; then
407 # Build 64-bit libraries...
408 ARCH64FLAGS="-xarch=generic64"
409 INSTALL64="install64bit"
410 LIB64CUPS="libcups.64.so.2"
411 LIB64CUPSIMAGE="libcupsimage.64.so.2"
412 LIB64DIR="$exec_prefix/lib/64"
413 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...
420 CFLAGS="-xarch=generic $CFLAGS"
423 if test "x$with_optim" = x; then
424 # Suppress all of Sun's questionable
425 # warning messages, and default to
426 # 32-bit compiles of everything else...
428 CFLAGS="-xarch=generic $CFLAGS"
435 if test -z "$OPTIM"; then
436 if test "x$with_optim" = x; then
439 OPTIM="$with_optim $OPTIM"
443 if test $PICFLAG = 1; then
448 # Running some other operating system; inform the user they
449 # should contribute the necessary options to
450 # cups-support@cups.org...
451 echo "Building CUPS with default compiler optimizations; contact"
452 echo "cups-bugs@cups.org with uname and compiler options needed"
453 echo "for your platform, or set the CFLAGS and CXXFLAGS"
454 echo "environment variable before running configure."
459 if test $uname = HP-UX; then
460 # HP-UX 10.20 (at least) needs this definition to get the
462 OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
464 # HP-UX 11.00 (at least) needs this definition to get the
465 # u_short type used by the IP headers...
466 OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
470 dnl End of "$Id: cups-compiler.m4 5288 2006-03-14 02:38:07Z mike $".