]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-compiler.m4
Load cups into easysw/current.
[thirdparty/cups.git] / config-scripts / cups-compiler.m4
CommitLineData
ef416fc2 1dnl
2abf387c 2dnl "$Id: cups-compiler.m4 6049 2006-10-20 15:07:21Z mike $"
ef416fc2 3dnl
4dnl Compiler stuff for the Common UNIX Printing System (CUPS).
5dnl
6dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
7dnl
8dnl These coded instructions, statements, and computer programs are the
9dnl property of Easy Software Products and are protected by Federal
10dnl copyright law. Distribution and use rights are outlined in the file
11dnl "LICENSE.txt" which should have been included with this file. If this
12dnl file is missing or damaged please contact Easy Software Products
13dnl at:
14dnl
15dnl Attn: CUPS Licensing Information
16dnl Easy Software Products
17dnl 44141 Airport View Drive, Suite 204
18dnl Hollywood, Maryland 20636 USA
19dnl
20dnl Voice: (301) 373-9600
21dnl EMail: cups-info@cups.org
22dnl WWW: http://www.cups.org
23dnl
24
25dnl Clear the debugging and non-shared library options unless the user asks
26dnl for them...
27OPTIM=""
28AC_SUBST(OPTIM)
29
fa73b229 30AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ])
ef416fc2 31AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no],
32 [if test x$enable_debug = xyes; then
33 OPTIM="-g"
34 fi])
35
ed486911 36dnl Setup general architecture flags...
37AC_ARG_WITH(archflags, [ --with-archflags="flags"
38 set default architecture flags ])
39
40if test -z "$with_archflags"; then
41 ARCHFLAGS=""
42else
43 ARCHFLAGS="$with_archflags"
44fi
45
46AC_SUBST(ARCHFLAGS)
47
e1d6a774 48dnl Setup support for separate 32/64-bit library generation...
49AC_ARG_ENABLE(32bit, [ --enable-32bit generate 32-bit libraries on 32/64-bit systems, default=no])
ed486911 50AC_ARG_WITH(arch32flags, [ --with-arch32flags="flags"
51 specifies 32-bit architecture flags])
e1d6a774 52
53ARCH32FLAGS=""
54INSTALL32=""
55LIB32CUPS=""
56LIB32CUPSIMAGE=""
57LIB32DIR=""
58UNINSTALL32=""
59
60AC_SUBST(ARCH32FLAGS)
61AC_SUBST(INSTALL32)
62AC_SUBST(LIB32CUPS)
63AC_SUBST(LIB32CUPSIMAGE)
64AC_SUBST(LIB32DIR)
65AC_SUBST(UNINSTALL32)
66
67AC_ARG_ENABLE(64bit, [ --enable-64bit generate 64-bit libraries on 32/64-bit systems, default=no])
ed486911 68AC_ARG_WITH(arch64flags, [ --with-arch64flags="flags"
69 specifies 64-bit architecture flags])
e1d6a774 70
71ARCH64FLAGS=""
72INSTALL64=""
73LIB64CUPS=""
74LIB64CUPSIMAGE=""
75LIB64DIR=""
76UNINSTALL64=""
77
78AC_SUBST(ARCH64FLAGS)
79AC_SUBST(INSTALL64)
80AC_SUBST(LIB64CUPS)
81AC_SUBST(LIB64CUPSIMAGE)
82AC_SUBST(LIB64DIR)
83AC_SUBST(UNINSTALL64)
84
85dnl Position-Independent Executable support on Linux and *BSD...
a74454a7 86AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no])
ef416fc2 87
88dnl Update compiler options...
89CXXLIBS=""
90AC_SUBST(CXXLIBS)
91
a74454a7 92PIEFLAGS=""
93AC_SUBST(PIEFLAGS)
94
ef416fc2 95if test -n "$GCC"; then
2abf387c 96 # Add GCC-specific compiler options...
ef416fc2 97 if test -z "$OPTIM"; then
98 if test "x$with_optim" = x; then
99 # Default to optimize-for-size and debug
100 OPTIM="-Os -g"
101 else
102 OPTIM="$with_optim $OPTIM"
103 fi
104 fi
105
106 if test $PICFLAG = 1 -a $uname != AIX; then
107 OPTIM="-fPIC $OPTIM"
108 fi
109
110 case $uname in
ef416fc2 111 Linux*)
fa73b229 112 if test x$enable_pie = xyes; then
a74454a7 113 PIEFLAGS="-pie -fPIE"
114 fi
115 ;;
116
117 *)
118 if test x$enable_pie = xyes; then
119 echo "Sorry, --enable-pie is not supported on this OS!"
fa73b229 120 fi
ef416fc2 121 ;;
122 esac
123
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"
129 fi
e1d6a774 130
131 case "$uname" in
e1d6a774 132 IRIX)
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"
137 else
138 ARCH32FLAGS="$with_arch32flags"
139 fi
140 INSTALL32="install32bit"
f301802f 141 LIB32CUPS="32bit/libcups.so.2"
142 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
e1d6a774 143 LIB32DIR="$prefix/lib32"
144 UNINSTALL32="uninstall32bit"
145
146 if test -z "$with_archflags"; then
147 if test -z "$with_arch64flags"; then
148 ARCHFLAGS="-64 -mips4"
149 else
150 ARCHFLAGS="$with_arch64flags"
151 fi
e1d6a774 152 fi
153 fi
154
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"
159 else
160 ARCH64FLAGS="$with_arch64flags"
161 fi
162 INSTALL64="install64bit"
f301802f 163 LIB64CUPS="64bit/libcups.so.2"
164 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
e1d6a774 165 LIB64DIR="$prefix/lib64"
166 UNINSTALL64="uninstall64bit"
167
168 if test -z "$with_archflags"; then
169 if test -z "$with_arch32flags"; then
170 ARCHFLAGS="-n32 -mips3"
171 else
172 ARCHFLAGS="$with_arch32flags"
173 fi
e1d6a774 174 fi
175 fi
176 ;;
177
178 Linux*)
179 if test "x$enable_32bit" = xyes; then
180 # Build 32-bit libraries, 64-bit base...
181 if test -z "$with_arch32flags"; then
182 ARCH32FLAGS="-m32"
183 else
184 ARCH32FLAGS="$with_arch32flags"
185 fi
186 INSTALL32="install32bit"
f301802f 187 LIB32CUPS="32bit/libcups.so.2"
188 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
e1d6a774 189 LIB32DIR="$exec_prefix/lib"
190 if test -d /usr/lib32; then
191 LIB32DIR="${LIB32DIR}32"
192 fi
193 UNINSTALL32="uninstall32bit"
194
195 if test -z "$with_archflags"; then
196 if test -z "$with_arch64flags"; then
197 ARCHFLAGS="-m64"
198 else
199 ARCHFLAGS="$with_arch64flags"
200 fi
e1d6a774 201 fi
202 fi
203
204 if test "x$enable_64bit" = xyes; then
205 # Build 64-bit libraries, 32-bit base...
206 if test -z "$with_arch64flags"; then
207 ARCH64FLAGS="-m64"
208 else
209 ARCH64FLAGS="$with_arch64flags"
210 fi
211 INSTALL64="install64bit"
f301802f 212 LIB64CUPS="64bit/libcups.so.2"
213 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
e1d6a774 214 LIB64DIR="$exec_prefix/lib"
215 if test -d /usr/lib64; then
216 LIB64DIR="${LIB64DIR}64"
217 fi
218 UNINSTALL64="uninstall64bit"
219
220 if test -z "$with_archflags"; then
221 if test -z "$with_arch32flags"; then
222 ARCHFLAGS="-m32"
223 else
224 ARCHFLAGS="$with_arch32flags"
225 fi
e1d6a774 226 fi
227 fi
228 ;;
229
230 SunOS*)
231 if test "x$enable_32bit" = xyes; then
232 # Build 32-bit libraries, 64-bit base...
233 if test -z "$with_arch32flags"; then
234 ARCH32FLAGS="-m32"
235 else
236 ARCH32FLAGS="$with_arch32flags"
237 fi
238 INSTALL32="install32bit"
f301802f 239 LIB32CUPS="32bit/libcups.so.2"
240 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
e1d6a774 241 LIB32DIR="$exec_prefix/lib/32"
242 UNINSTALL32="uninstall32bit"
243
244 if test -z "$with_archflags"; then
245 if test -z "$with_arch64flags"; then
246 ARCHFLAGS="-m64"
247 else
248 ARCHFLAGS="$with_arch64flags"
249 fi
e1d6a774 250 fi
251 fi
252
253 if test "x$enable_64bit" = xyes; then
254 # Build 64-bit libraries, 32-bit base...
255 if test -z "$with_arch64flags"; then
256 ARCH64FLAGS="-m64"
257 else
258 ARCH64FLAGS="$with_arch64flags"
259 fi
260 INSTALL64="install64bit"
f301802f 261 LIB64CUPS="64bit/libcups.so.2"
262 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
e1d6a774 263 LIB64DIR="$exec_prefix/lib/64"
264 UNINSTALL64="uninstall64bit"
265
266 if test -z "$with_archflags"; then
267 if test -z "$with_arch32flags"; then
268 ARCHFLAGS="-m32"
269 else
270 ARCHFLAGS="$with_arch32flags"
271 fi
e1d6a774 272 fi
273 fi
274 ;;
275 esac
ef416fc2 276else
2abf387c 277 # Add vendor-specific compiler options...
ef416fc2 278 case $uname in
279 AIX*)
280 if test -z "$OPTIM"; then
281 if test "x$with_optim" = x; then
282 OPTIM="-O2 -qmaxmem=6000"
283 else
284 OPTIM="$with_optim $OPTIM"
285 fi
286 fi
287 ;;
288 HP-UX*)
289 if test -z "$OPTIM"; then
290 if test "x$with_optim" = x; then
291 OPTIM="+O2"
292 else
293 OPTIM="$with_optim $OPTIM"
294 fi
295 fi
296
297 CFLAGS="-Ae $CFLAGS"
e1d6a774 298 # Warning 336 is "empty translation unit"
299 # Warning 829 is passing constant string as char *
300 CXXFLAGS="+W336,829 $CXXFLAGS"
ef416fc2 301
ef416fc2 302 if test $PICFLAG = 1; then
303 OPTIM="+z $OPTIM"
304 fi
305 ;;
306 IRIX)
307 if test -z "$OPTIM"; then
308 if test "x$with_optim" = x; then
309 OPTIM="-O2"
310 else
311 OPTIM="$with_optim $OPTIM"
312 fi
313 fi
314
e1d6a774 315 if test "x$with_optim" = x; then
316 OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM"
ef416fc2 317 fi
318
e1d6a774 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"
323 else
324 ARCH32FLAGS="$with_arch32flags"
325 fi
326 INSTALL32="install32bit"
f301802f 327 LIB32CUPS="32bit/libcups.so.2"
328 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
e1d6a774 329 LIB32DIR="$prefix/lib32"
330 UNINSTALL32="uninstall32bit"
331
332 if test -z "$with_archflags"; then
333 if test -z "$with_arch64flags"; then
334 ARCHFLAGS="-64 -mips4"
335 else
336 ARCHFLAGS="$with_arch64flags"
337 fi
e1d6a774 338 fi
339 fi
340
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"
345 else
346 ARCH64FLAGS="$with_arch64flags"
347 fi
348 INSTALL64="install64bit"
f301802f 349 LIB64CUPS="64bit/libcups.so.2"
350 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
e1d6a774 351 LIB64DIR="$prefix/lib64"
352 UNINSTALL64="uninstall64bit"
353
354 if test -z "$with_archflags"; then
355 if test -z "$with_arch32flags"; then
356 ARCHFLAGS="-n32 -mips3"
357 else
358 ARCHFLAGS="$with_arch32flags"
359 fi
ef416fc2 360 fi
361 fi
362 ;;
2abf387c 363 OSF*)
364 # Tru64 UNIX aka Digital UNIX aka OSF/1
365 if test -z "$OPTIM"; then
366 if test "x$with_optim" = x; then
367 OPTIM="-O"
368 else
369 OPTIM="$with_optim"
370 fi
371 fi
372 ;;
ef416fc2 373 SunOS*)
374 # Solaris
375 if test -z "$OPTIM"; then
376 if test "x$with_optim" = x; then
ed486911 377 OPTIM="-xO2"
ef416fc2 378 else
379 OPTIM="$with_optim $OPTIM"
380 fi
381 fi
382
ef416fc2 383 if test $PICFLAG = 1; then
384 OPTIM="-KPIC $OPTIM"
385 fi
e1d6a774 386
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"
f301802f 392 LIB32CUPS="32bit/libcups.so.2"
393 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
e1d6a774 394 LIB32DIR="$exec_prefix/lib/32"
395 UNINSTALL32="uninstall32bit"
396
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...
401 OPTIM="-w $OPTIM"
f301802f 402 fi
403
404 if test -z "$with_archflags"; then
405 if test -z "$with_arch64flags"; then
406 ARCHFLAGS="-xarch=generic64"
407 else
408 ARCHFLAGS="$with_arch64flags"
409 fi
e1d6a774 410 fi
411 else
412 if test "x$enable_64bit" = xyes; then
413 # Build 64-bit libraries...
414 ARCH64FLAGS="-xarch=generic64"
415 INSTALL64="install64bit"
f301802f 416 LIB64CUPS="64bit/libcups.so.2"
417 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
e1d6a774 418 LIB64DIR="$exec_prefix/lib/64"
419 UNINSTALL64="uninstall64bit"
f301802f 420 fi
421
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...
426 OPTIM="-w $OPTIM"
427 fi
e1d6a774 428
f301802f 429 if test -z "$with_archflags"; then
430 if test -z "$with_arch32flags"; then
431 ARCHFLAGS="-xarch=generic"
432 else
433 ARCHFLAGS="$with_arch32flags"
e1d6a774 434 fi
e1d6a774 435 fi
436 fi
ef416fc2 437 ;;
438 UNIX_SVR*)
439 # UnixWare
440 if test -z "$OPTIM"; then
441 if test "x$with_optim" = x; then
442 OPTIM="-O"
443 else
444 OPTIM="$with_optim $OPTIM"
445 fi
446 fi
447
448 if test $PICFLAG = 1; then
449 OPTIM="-KPIC $OPTIM"
450 fi
451 ;;
452 *)
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."
460 ;;
461 esac
462fi
463
2abf387c 464# Add general compiler options per platform...
465case $uname in
466 HP-UX*)
467 # HP-UX 10.20 (at least) needs this definition to get the
468 # h_errno global...
469 OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
470
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"
474 ;;
475
476 OSF*)
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"
480 ;;
481esac
ef416fc2 482
483dnl
2abf387c 484dnl End of "$Id: cups-compiler.m4 6049 2006-10-20 15:07:21Z mike $".
ef416fc2 485dnl