]> 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 5643 2006-06-07 20:58:29Z 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 if test -z "$OPTIM"; then
97 if test "x$with_optim" = x; then
98 # Default to optimize-for-size and debug
99 OPTIM="-Os -g"
100 else
101 OPTIM="$with_optim $OPTIM"
102 fi
103 fi
104
105 if test $PICFLAG = 1 -a $uname != AIX; then
106 OPTIM="-fPIC $OPTIM"
107 fi
108
109 case $uname in
110 Linux*)
111 if test x$enable_pie = xyes; then
112 PIEFLAGS="-pie -fPIE"
113 fi
114 ;;
115
116 *)
117 if test x$enable_pie = xyes; then
118 echo "Sorry, --enable-pie is not supported on this OS!"
119 fi
120 ;;
121 esac
122
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"
128 fi
129
130 case "$uname" in
131 IRIX)
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"
136 else
137 ARCH32FLAGS="$with_arch32flags"
138 fi
139 INSTALL32="install32bit"
140 LIB32CUPS="32bit/libcups.so.2"
141 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
142 LIB32DIR="$prefix/lib32"
143 UNINSTALL32="uninstall32bit"
144
145 if test -z "$with_archflags"; then
146 if test -z "$with_arch64flags"; then
147 ARCHFLAGS="-64 -mips4"
148 else
149 ARCHFLAGS="$with_arch64flags"
150 fi
151 fi
152 fi
153
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"
158 else
159 ARCH64FLAGS="$with_arch64flags"
160 fi
161 INSTALL64="install64bit"
162 LIB64CUPS="64bit/libcups.so.2"
163 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
164 LIB64DIR="$prefix/lib64"
165 UNINSTALL64="uninstall64bit"
166
167 if test -z "$with_archflags"; then
168 if test -z "$with_arch32flags"; then
169 ARCHFLAGS="-n32 -mips3"
170 else
171 ARCHFLAGS="$with_arch32flags"
172 fi
173 fi
174 fi
175 ;;
176
177 Linux*)
178 if test "x$enable_32bit" = xyes; then
179 # Build 32-bit libraries, 64-bit base...
180 if test -z "$with_arch32flags"; then
181 ARCH32FLAGS="-m32"
182 else
183 ARCH32FLAGS="$with_arch32flags"
184 fi
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"
191 fi
192 UNINSTALL32="uninstall32bit"
193
194 if test -z "$with_archflags"; then
195 if test -z "$with_arch64flags"; then
196 ARCHFLAGS="-m64"
197 else
198 ARCHFLAGS="$with_arch64flags"
199 fi
200 fi
201 fi
202
203 if test "x$enable_64bit" = xyes; then
204 # Build 64-bit libraries, 32-bit base...
205 if test -z "$with_arch64flags"; then
206 ARCH64FLAGS="-m64"
207 else
208 ARCH64FLAGS="$with_arch64flags"
209 fi
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"
216 fi
217 UNINSTALL64="uninstall64bit"
218
219 if test -z "$with_archflags"; then
220 if test -z "$with_arch32flags"; then
221 ARCHFLAGS="-m32"
222 else
223 ARCHFLAGS="$with_arch32flags"
224 fi
225 fi
226 fi
227 ;;
228
229 SunOS*)
230 if test "x$enable_32bit" = xyes; then
231 # Build 32-bit libraries, 64-bit base...
232 if test -z "$with_arch32flags"; then
233 ARCH32FLAGS="-m32"
234 else
235 ARCH32FLAGS="$with_arch32flags"
236 fi
237 INSTALL32="install32bit"
238 LIB32CUPS="32bit/libcups.so.2"
239 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
240 LIB32DIR="$exec_prefix/lib/32"
241 UNINSTALL32="uninstall32bit"
242
243 if test -z "$with_archflags"; then
244 if test -z "$with_arch64flags"; then
245 ARCHFLAGS="-m64"
246 else
247 ARCHFLAGS="$with_arch64flags"
248 fi
249 fi
250 fi
251
252 if test "x$enable_64bit" = xyes; then
253 # Build 64-bit libraries, 32-bit base...
254 if test -z "$with_arch64flags"; then
255 ARCH64FLAGS="-m64"
256 else
257 ARCH64FLAGS="$with_arch64flags"
258 fi
259 INSTALL64="install64bit"
260 LIB64CUPS="64bit/libcups.so.2"
261 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
262 LIB64DIR="$exec_prefix/lib/64"
263 UNINSTALL64="uninstall64bit"
264
265 if test -z "$with_archflags"; then
266 if test -z "$with_arch32flags"; then
267 ARCHFLAGS="-m32"
268 else
269 ARCHFLAGS="$with_arch32flags"
270 fi
271 fi
272 fi
273 ;;
274 esac
275 else
276 case $uname in
277 AIX*)
278 if test -z "$OPTIM"; then
279 if test "x$with_optim" = x; then
280 OPTIM="-O2 -qmaxmem=6000"
281 else
282 OPTIM="$with_optim $OPTIM"
283 fi
284 fi
285 ;;
286 HP-UX*)
287 if test -z "$OPTIM"; then
288 if test "x$with_optim" = x; then
289 OPTIM="+O2"
290 else
291 OPTIM="$with_optim $OPTIM"
292 fi
293 fi
294
295 CFLAGS="-Ae $CFLAGS"
296 # Warning 336 is "empty translation unit"
297 # Warning 829 is passing constant string as char *
298 CXXFLAGS="+W336,829 $CXXFLAGS"
299
300 if test -z "$with_archflags"; then
301 # Build portable binaries for all HP systems...
302 ARCHFLAGS="+DAportable"
303 fi
304
305 if test $PICFLAG = 1; then
306 OPTIM="+z $OPTIM"
307 fi
308 ;;
309 IRIX)
310 if test -z "$OPTIM"; then
311 if test "x$with_optim" = x; then
312 OPTIM="-O2"
313 else
314 OPTIM="$with_optim $OPTIM"
315 fi
316 fi
317
318 if test "x$with_optim" = x; then
319 OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM"
320 fi
321
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"
326 else
327 ARCH32FLAGS="$with_arch32flags"
328 fi
329 INSTALL32="install32bit"
330 LIB32CUPS="32bit/libcups.so.2"
331 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
332 LIB32DIR="$prefix/lib32"
333 UNINSTALL32="uninstall32bit"
334
335 if test -z "$with_archflags"; then
336 if test -z "$with_arch64flags"; then
337 ARCHFLAGS="-64 -mips4"
338 else
339 ARCHFLAGS="$with_arch64flags"
340 fi
341 fi
342 fi
343
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"
348 else
349 ARCH64FLAGS="$with_arch64flags"
350 fi
351 INSTALL64="install64bit"
352 LIB64CUPS="64bit/libcups.so.2"
353 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
354 LIB64DIR="$prefix/lib64"
355 UNINSTALL64="uninstall64bit"
356
357 if test -z "$with_archflags"; then
358 if test -z "$with_arch32flags"; then
359 ARCHFLAGS="-n32 -mips3"
360 else
361 ARCHFLAGS="$with_arch32flags"
362 fi
363 fi
364 fi
365 ;;
366 SunOS*)
367 # Solaris
368 if test -z "$OPTIM"; then
369 if test "x$with_optim" = x; then
370 OPTIM="-xO2"
371 else
372 OPTIM="$with_optim $OPTIM"
373 fi
374 fi
375
376 if test $PICFLAG = 1; then
377 OPTIM="-KPIC $OPTIM"
378 fi
379
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"
389
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...
394 OPTIM="-w $OPTIM"
395 fi
396
397 if test -z "$with_archflags"; then
398 if test -z "$with_arch64flags"; then
399 ARCHFLAGS="-xarch=generic64"
400 else
401 ARCHFLAGS="$with_arch64flags"
402 fi
403 fi
404 else
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"
413 fi
414
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...
419 OPTIM="-w $OPTIM"
420 fi
421
422 if test -z "$with_archflags"; then
423 if test -z "$with_arch32flags"; then
424 ARCHFLAGS="-xarch=generic"
425 else
426 ARCHFLAGS="$with_arch32flags"
427 fi
428 fi
429 fi
430 ;;
431 UNIX_SVR*)
432 # UnixWare
433 if test -z "$OPTIM"; then
434 if test "x$with_optim" = x; then
435 OPTIM="-O"
436 else
437 OPTIM="$with_optim $OPTIM"
438 fi
439 fi
440
441 if test $PICFLAG = 1; then
442 OPTIM="-KPIC $OPTIM"
443 fi
444 ;;
445 *)
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."
453 ;;
454 esac
455 fi
456
457 if test $uname = HP-UX; then
458 # HP-UX 10.20 (at least) needs this definition to get the
459 # h_errno global...
460 OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
461
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"
465 fi
466
467 dnl
468 dnl End of "$Id: cups-compiler.m4 5643 2006-06-07 20:58:29Z mike $".
469 dnl