]> git.ipfire.org Git - thirdparty/cups.git/blob - config-scripts/cups-compiler.m4
Load cups into easysw/current.
[thirdparty/cups.git] / config-scripts / cups-compiler.m4
1 dnl
2 dnl "$Id: cups-compiler.m4 6049 2006-10-20 15:07:21Z mike $"
3 dnl
4 dnl Compiler stuff for the Common UNIX Printing System (CUPS).
5 dnl
6 dnl Copyright 1997-2006 by Easy Software Products, all rights reserved.
7 dnl
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
13 dnl at:
14 dnl
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
19 dnl
20 dnl Voice: (301) 373-9600
21 dnl EMail: cups-info@cups.org
22 dnl WWW: http://www.cups.org
23 dnl
24
25 dnl Clear the debugging and non-shared library options unless the user asks
26 dnl for them...
27 OPTIM=""
28 AC_SUBST(OPTIM)
29
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
33 OPTIM="-g"
34 fi])
35
36 dnl Setup general architecture flags...
37 AC_ARG_WITH(archflags, [ --with-archflags="flags"
38 set default architecture flags ])
39
40 if test -z "$with_archflags"; then
41 ARCHFLAGS=""
42 else
43 ARCHFLAGS="$with_archflags"
44 fi
45
46 AC_SUBST(ARCHFLAGS)
47
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])
52
53 ARCH32FLAGS=""
54 INSTALL32=""
55 LIB32CUPS=""
56 LIB32CUPSIMAGE=""
57 LIB32DIR=""
58 UNINSTALL32=""
59
60 AC_SUBST(ARCH32FLAGS)
61 AC_SUBST(INSTALL32)
62 AC_SUBST(LIB32CUPS)
63 AC_SUBST(LIB32CUPSIMAGE)
64 AC_SUBST(LIB32DIR)
65 AC_SUBST(UNINSTALL32)
66
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])
70
71 ARCH64FLAGS=""
72 INSTALL64=""
73 LIB64CUPS=""
74 LIB64CUPSIMAGE=""
75 LIB64DIR=""
76 UNINSTALL64=""
77
78 AC_SUBST(ARCH64FLAGS)
79 AC_SUBST(INSTALL64)
80 AC_SUBST(LIB64CUPS)
81 AC_SUBST(LIB64CUPSIMAGE)
82 AC_SUBST(LIB64DIR)
83 AC_SUBST(UNINSTALL64)
84
85 dnl Position-Independent Executable support on Linux and *BSD...
86 AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no])
87
88 dnl Update compiler options...
89 CXXLIBS=""
90 AC_SUBST(CXXLIBS)
91
92 PIEFLAGS=""
93 AC_SUBST(PIEFLAGS)
94
95 if test -n "$GCC"; then
96 # Add GCC-specific compiler options...
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
111 Linux*)
112 if test x$enable_pie = xyes; then
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!"
120 fi
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
130
131 case "$uname" in
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"
141 LIB32CUPS="32bit/libcups.so.2"
142 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
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
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"
163 LIB64CUPS="64bit/libcups.so.2"
164 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
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
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"
187 LIB32CUPS="32bit/libcups.so.2"
188 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
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
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"
212 LIB64CUPS="64bit/libcups.so.2"
213 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
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
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"
239 LIB32CUPS="32bit/libcups.so.2"
240 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
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
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"
261 LIB64CUPS="64bit/libcups.so.2"
262 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
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
272 fi
273 fi
274 ;;
275 esac
276 else
277 # Add vendor-specific compiler options...
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"
298 # Warning 336 is "empty translation unit"
299 # Warning 829 is passing constant string as char *
300 CXXFLAGS="+W336,829 $CXXFLAGS"
301
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
315 if test "x$with_optim" = x; then
316 OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM"
317 fi
318
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"
327 LIB32CUPS="32bit/libcups.so.2"
328 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
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
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"
349 LIB64CUPS="64bit/libcups.so.2"
350 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
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
360 fi
361 fi
362 ;;
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 ;;
373 SunOS*)
374 # Solaris
375 if test -z "$OPTIM"; then
376 if test "x$with_optim" = x; then
377 OPTIM="-xO2"
378 else
379 OPTIM="$with_optim $OPTIM"
380 fi
381 fi
382
383 if test $PICFLAG = 1; then
384 OPTIM="-KPIC $OPTIM"
385 fi
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"
392 LIB32CUPS="32bit/libcups.so.2"
393 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
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"
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
410 fi
411 else
412 if test "x$enable_64bit" = xyes; then
413 # Build 64-bit libraries...
414 ARCH64FLAGS="-xarch=generic64"
415 INSTALL64="install64bit"
416 LIB64CUPS="64bit/libcups.so.2"
417 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
418 LIB64DIR="$exec_prefix/lib/64"
419 UNINSTALL64="uninstall64bit"
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
428
429 if test -z "$with_archflags"; then
430 if test -z "$with_arch32flags"; then
431 ARCHFLAGS="-xarch=generic"
432 else
433 ARCHFLAGS="$with_arch32flags"
434 fi
435 fi
436 fi
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
462 fi
463
464 # Add general compiler options per platform...
465 case $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 ;;
481 esac
482
483 dnl
484 dnl End of "$Id: cups-compiler.m4 6049 2006-10-20 15:07:21Z mike $".
485 dnl