]> 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
f301802f 2dnl "$Id: cups-compiler.m4 5565 2006-05-22 01:08:19Z 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...
e1d6a774 27ARCHFLAGS=""
ef416fc2 28OPTIM=""
e1d6a774 29AC_SUBST(ARCHFLAGS)
ef416fc2 30AC_SUBST(OPTIM)
31
fa73b229 32AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ])
e1d6a774 33AC_ARG_WITH(archflags, [ --with-arch="flags" set default architecture flags ])
fa73b229 34
ef416fc2 35AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no],
36 [if test x$enable_debug = xyes; then
37 OPTIM="-g"
38 fi])
39
e1d6a774 40dnl Setup support for separate 32/64-bit library generation...
41AC_ARG_ENABLE(32bit, [ --enable-32bit generate 32-bit libraries on 32/64-bit systems, default=no])
42AC_ARG_WITH(arch32flags, [ --with-arch32="flags" specifies 32-bit architecture flags])
43
44ARCH32FLAGS=""
45INSTALL32=""
46LIB32CUPS=""
47LIB32CUPSIMAGE=""
48LIB32DIR=""
49UNINSTALL32=""
50
51AC_SUBST(ARCH32FLAGS)
52AC_SUBST(INSTALL32)
53AC_SUBST(LIB32CUPS)
54AC_SUBST(LIB32CUPSIMAGE)
55AC_SUBST(LIB32DIR)
56AC_SUBST(UNINSTALL32)
57
58AC_ARG_ENABLE(64bit, [ --enable-64bit generate 64-bit libraries on 32/64-bit systems, default=no])
59AC_ARG_WITH(arch64flags, [ --with-arch64="flags" specifies 64-bit architecture flags])
60
61ARCH64FLAGS=""
62INSTALL64=""
63LIB64CUPS=""
64LIB64CUPSIMAGE=""
65LIB64DIR=""
66UNINSTALL64=""
67
68AC_SUBST(ARCH64FLAGS)
69AC_SUBST(INSTALL64)
70AC_SUBST(LIB64CUPS)
71AC_SUBST(LIB64CUPSIMAGE)
72AC_SUBST(LIB64DIR)
73AC_SUBST(UNINSTALL64)
74
75dnl Position-Independent Executable support on Linux and *BSD...
a74454a7 76AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no])
ef416fc2 77
78dnl Update compiler options...
79CXXLIBS=""
80AC_SUBST(CXXLIBS)
81
a74454a7 82PIEFLAGS=""
83AC_SUBST(PIEFLAGS)
84
ef416fc2 85if test -n "$GCC"; then
86 if test -z "$OPTIM"; then
87 if test "x$with_optim" = x; then
88 # Default to optimize-for-size and debug
89 OPTIM="-Os -g"
90 else
91 OPTIM="$with_optim $OPTIM"
92 fi
93 fi
94
95 if test $PICFLAG = 1 -a $uname != AIX; then
96 OPTIM="-fPIC $OPTIM"
97 fi
98
99 case $uname in
ef416fc2 100 Linux*)
fa73b229 101 if test x$enable_pie = xyes; then
a74454a7 102 PIEFLAGS="-pie -fPIE"
103 fi
104 ;;
105
106 *)
107 if test x$enable_pie = xyes; then
108 echo "Sorry, --enable-pie is not supported on this OS!"
fa73b229 109 fi
ef416fc2 110 ;;
111 esac
112
113 if test "x$with_optim" = x; then
114 # Add useful warning options for tracking down problems...
115 OPTIM="-Wall -Wno-format-y2k $OPTIM"
116 # Additional warning options for alpha testing...
117 OPTIM="-Wshadow -Wunused $OPTIM"
118 fi
e1d6a774 119
120 case "$uname" in
121 Darwin*)
122 if test -z "$with_archflags"; then
123 if test "x`uname -m`" = xi386; then
124 # Build universal binaries for OSX on Intel...
125 ARCHFLAGS="-arch i386 -arch ppc"
126 fi
127 else
128 ARCHFLAGS="$with_archflags"
129 fi
130 ;;
131
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
152 else
153 ARCHFLAGS="$with_archflags"
154 fi
155 fi
156
157 if test "x$enable_64bit" = xyes; then
158 # Build 64-bit libraries, 32-bit base...
159 if test -z "$with_arch64flags"; then
160 ARCH64FLAGS="-64 -mips4"
161 else
162 ARCH64FLAGS="$with_arch64flags"
163 fi
164 INSTALL64="install64bit"
f301802f 165 LIB64CUPS="64bit/libcups.so.2"
166 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
e1d6a774 167 LIB64DIR="$prefix/lib64"
168 UNINSTALL64="uninstall64bit"
169
170 if test -z "$with_archflags"; then
171 if test -z "$with_arch32flags"; then
172 ARCHFLAGS="-n32 -mips3"
173 else
174 ARCHFLAGS="$with_arch32flags"
175 fi
176 else
177 ARCHFLAGS="$with_archflags"
178 fi
179 fi
180 ;;
181
182 Linux*)
183 if test "x$enable_32bit" = xyes; then
184 # Build 32-bit libraries, 64-bit base...
185 if test -z "$with_arch32flags"; then
186 ARCH32FLAGS="-m32"
187 else
188 ARCH32FLAGS="$with_arch32flags"
189 fi
190 INSTALL32="install32bit"
f301802f 191 LIB32CUPS="32bit/libcups.so.2"
192 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
e1d6a774 193 LIB32DIR="$exec_prefix/lib"
194 if test -d /usr/lib32; then
195 LIB32DIR="${LIB32DIR}32"
196 fi
197 UNINSTALL32="uninstall32bit"
198
199 if test -z "$with_archflags"; then
200 if test -z "$with_arch64flags"; then
201 ARCHFLAGS="-m64"
202 else
203 ARCHFLAGS="$with_arch64flags"
204 fi
205 else
206 ARCHFLAGS="$with_archflags"
207 fi
208 fi
209
210 if test "x$enable_64bit" = xyes; then
211 # Build 64-bit libraries, 32-bit base...
212 if test -z "$with_arch64flags"; then
213 ARCH64FLAGS="-m64"
214 else
215 ARCH64FLAGS="$with_arch64flags"
216 fi
217 INSTALL64="install64bit"
f301802f 218 LIB64CUPS="64bit/libcups.so.2"
219 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
e1d6a774 220 LIB64DIR="$exec_prefix/lib"
221 if test -d /usr/lib64; then
222 LIB64DIR="${LIB64DIR}64"
223 fi
224 UNINSTALL64="uninstall64bit"
225
226 if test -z "$with_archflags"; then
227 if test -z "$with_arch32flags"; then
228 ARCHFLAGS="-m32"
229 else
230 ARCHFLAGS="$with_arch32flags"
231 fi
232 else
233 ARCHFLAGS="$with_archflags"
234 fi
235 fi
236 ;;
237
238 SunOS*)
239 if test "x$enable_32bit" = xyes; then
240 # Build 32-bit libraries, 64-bit base...
241 if test -z "$with_arch32flags"; then
242 ARCH32FLAGS="-m32"
243 else
244 ARCH32FLAGS="$with_arch32flags"
245 fi
246 INSTALL32="install32bit"
f301802f 247 LIB32CUPS="32bit/libcups.so.2"
248 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
e1d6a774 249 LIB32DIR="$exec_prefix/lib/32"
250 UNINSTALL32="uninstall32bit"
251
252 if test -z "$with_archflags"; then
253 if test -z "$with_arch64flags"; then
254 ARCHFLAGS="-m64"
255 else
256 ARCHFLAGS="$with_arch64flags"
257 fi
258 else
259 ARCHFLAGS="$with_archflags"
260 fi
261 fi
262
263 if test "x$enable_64bit" = xyes; then
264 # Build 64-bit libraries, 32-bit base...
265 if test -z "$with_arch64flags"; then
266 ARCH64FLAGS="-m64"
267 else
268 ARCH64FLAGS="$with_arch64flags"
269 fi
270 INSTALL64="install64bit"
f301802f 271 LIB64CUPS="64bit/libcups.so.2"
272 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
e1d6a774 273 LIB64DIR="$exec_prefix/lib/64"
274 UNINSTALL64="uninstall64bit"
275
276 if test -z "$with_archflags"; then
277 if test -z "$with_arch32flags"; then
278 ARCHFLAGS="-m32"
279 else
280 ARCHFLAGS="$with_arch32flags"
281 fi
282 else
283 ARCHFLAGS="$with_archflags"
284 fi
285 fi
286 ;;
287 esac
ef416fc2 288else
289 case $uname in
290 AIX*)
291 if test -z "$OPTIM"; then
292 if test "x$with_optim" = x; then
293 OPTIM="-O2 -qmaxmem=6000"
294 else
295 OPTIM="$with_optim $OPTIM"
296 fi
297 fi
298 ;;
299 HP-UX*)
300 if test -z "$OPTIM"; then
301 if test "x$with_optim" = x; then
302 OPTIM="+O2"
303 else
304 OPTIM="$with_optim $OPTIM"
305 fi
306 fi
307
308 CFLAGS="-Ae $CFLAGS"
e1d6a774 309 # Warning 336 is "empty translation unit"
310 # Warning 829 is passing constant string as char *
311 CXXFLAGS="+W336,829 $CXXFLAGS"
ef416fc2 312
f301802f 313 if test -z "$with_archflags"; then
314 # Build portable binaries for all HP systems...
315 ARCHFLAGS="+DAportable"
316 else
317 ARCHFLAGS="$with_archflags"
ef416fc2 318 fi
319
320 if test $PICFLAG = 1; then
321 OPTIM="+z $OPTIM"
322 fi
323 ;;
324 IRIX)
325 if test -z "$OPTIM"; then
326 if test "x$with_optim" = x; then
327 OPTIM="-O2"
328 else
329 OPTIM="$with_optim $OPTIM"
330 fi
331 fi
332
e1d6a774 333 if test "x$with_optim" = x; then
334 OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM"
ef416fc2 335 fi
336
e1d6a774 337 if test "x$enable_32bit" = xyes; then
338 # Build 32-bit libraries, 64-bit base...
339 if test -z "$with_arch32flags"; then
340 ARCH32FLAGS="-n32 -mips3"
341 else
342 ARCH32FLAGS="$with_arch32flags"
343 fi
344 INSTALL32="install32bit"
f301802f 345 LIB32CUPS="32bit/libcups.so.2"
346 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
e1d6a774 347 LIB32DIR="$prefix/lib32"
348 UNINSTALL32="uninstall32bit"
349
350 if test -z "$with_archflags"; then
351 if test -z "$with_arch64flags"; then
352 ARCHFLAGS="-64 -mips4"
353 else
354 ARCHFLAGS="$with_arch64flags"
355 fi
356 else
357 ARCHFLAGS="$with_archflags"
358 fi
359 fi
360
361 if test "x$enable_64bit" = xyes; then
362 # Build 64-bit libraries, 32-bit base...
363 if test -z "$with_arch64flags"; then
364 ARCH64FLAGS="-64 -mips4"
365 else
366 ARCH64FLAGS="$with_arch64flags"
367 fi
368 INSTALL64="install64bit"
f301802f 369 LIB64CUPS="64bit/libcups.so.2"
370 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
e1d6a774 371 LIB64DIR="$prefix/lib64"
372 UNINSTALL64="uninstall64bit"
373
374 if test -z "$with_archflags"; then
375 if test -z "$with_arch32flags"; then
376 ARCHFLAGS="-n32 -mips3"
377 else
378 ARCHFLAGS="$with_arch32flags"
379 fi
380 else
381 ARCHFLAGS="$with_archflags"
ef416fc2 382 fi
383 fi
384 ;;
385 SunOS*)
386 # Solaris
387 if test -z "$OPTIM"; then
388 if test "x$with_optim" = x; then
389 OPTIM="-xO4"
390 else
391 OPTIM="$with_optim $OPTIM"
392 fi
393 fi
394
ef416fc2 395 if test $PICFLAG = 1; then
396 OPTIM="-KPIC $OPTIM"
397 fi
e1d6a774 398
399 if test "x$enable_32bit" = xyes; then
400 # Compiling on a Solaris system, build 64-bit
401 # binaries with separate 32-bit libraries...
402 ARCH32FLAGS="-xarch=generic"
403 INSTALL32="install32bit"
f301802f 404 LIB32CUPS="32bit/libcups.so.2"
405 LIB32CUPSIMAGE="32bit/libcupsimage.so.2"
e1d6a774 406 LIB32DIR="$exec_prefix/lib/32"
407 UNINSTALL32="uninstall32bit"
408
409 if test "x$with_optim" = x; then
410 # Suppress all of Sun's questionable
411 # warning messages, and default to
412 # 64-bit compiles of everything else...
413 OPTIM="-w $OPTIM"
f301802f 414 fi
415
416 if test -z "$with_archflags"; then
417 if test -z "$with_arch64flags"; then
418 ARCHFLAGS="-xarch=generic64"
419 else
420 ARCHFLAGS="$with_arch64flags"
421 fi
422 else
423 ARCHFLAGS="$with_archflags"
e1d6a774 424 fi
425 else
426 if test "x$enable_64bit" = xyes; then
427 # Build 64-bit libraries...
428 ARCH64FLAGS="-xarch=generic64"
429 INSTALL64="install64bit"
f301802f 430 LIB64CUPS="64bit/libcups.so.2"
431 LIB64CUPSIMAGE="64bit/libcupsimage.so.2"
e1d6a774 432 LIB64DIR="$exec_prefix/lib/64"
433 UNINSTALL64="uninstall64bit"
f301802f 434 fi
435
436 if test "x$with_optim" = x; then
437 # Suppress all of Sun's questionable
438 # warning messages, and default to
439 # 32-bit compiles of everything else...
440 OPTIM="-w $OPTIM"
441 fi
e1d6a774 442
f301802f 443 if test -z "$with_archflags"; then
444 if test -z "$with_arch32flags"; then
445 ARCHFLAGS="-xarch=generic"
446 else
447 ARCHFLAGS="$with_arch32flags"
e1d6a774 448 fi
449 else
f301802f 450 ARCHFLAGS="$with_archflags"
e1d6a774 451 fi
452 fi
ef416fc2 453 ;;
454 UNIX_SVR*)
455 # UnixWare
456 if test -z "$OPTIM"; then
457 if test "x$with_optim" = x; then
458 OPTIM="-O"
459 else
460 OPTIM="$with_optim $OPTIM"
461 fi
462 fi
463
464 if test $PICFLAG = 1; then
465 OPTIM="-KPIC $OPTIM"
466 fi
467 ;;
468 *)
469 # Running some other operating system; inform the user they
470 # should contribute the necessary options to
471 # cups-support@cups.org...
472 echo "Building CUPS with default compiler optimizations; contact"
473 echo "cups-bugs@cups.org with uname and compiler options needed"
474 echo "for your platform, or set the CFLAGS and CXXFLAGS"
475 echo "environment variable before running configure."
476 ;;
477 esac
478fi
479
480if test $uname = HP-UX; then
481 # HP-UX 10.20 (at least) needs this definition to get the
482 # h_errno global...
483 OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
484
485 # HP-UX 11.00 (at least) needs this definition to get the
486 # u_short type used by the IP headers...
487 OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
488fi
489
490dnl
f301802f 491dnl End of "$Id: cups-compiler.m4 5565 2006-05-22 01:08:19Z mike $".
ef416fc2 492dnl