]>
Commit | Line | Data |
---|---|---|
1 | dnl | |
2 | dnl "$Id: cups-compiler.m4 5288 2006-03-14 02:38:07Z 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 | ARCHFLAGS="" | |
28 | OPTIM="" | |
29 | AC_SUBST(ARCHFLAGS) | |
30 | AC_SUBST(OPTIM) | |
31 | ||
32 | AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ]) | |
33 | AC_ARG_WITH(archflags, [ --with-arch="flags" set default architecture flags ]) | |
34 | ||
35 | AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no], | |
36 | [if test x$enable_debug = xyes; then | |
37 | OPTIM="-g" | |
38 | fi]) | |
39 | ||
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]) | |
43 | ||
44 | ARCH32FLAGS="" | |
45 | INSTALL32="" | |
46 | LIB32CUPS="" | |
47 | LIB32CUPSIMAGE="" | |
48 | LIB32DIR="" | |
49 | UNINSTALL32="" | |
50 | ||
51 | AC_SUBST(ARCH32FLAGS) | |
52 | AC_SUBST(INSTALL32) | |
53 | AC_SUBST(LIB32CUPS) | |
54 | AC_SUBST(LIB32CUPSIMAGE) | |
55 | AC_SUBST(LIB32DIR) | |
56 | AC_SUBST(UNINSTALL32) | |
57 | ||
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]) | |
60 | ||
61 | ARCH64FLAGS="" | |
62 | INSTALL64="" | |
63 | LIB64CUPS="" | |
64 | LIB64CUPSIMAGE="" | |
65 | LIB64DIR="" | |
66 | UNINSTALL64="" | |
67 | ||
68 | AC_SUBST(ARCH64FLAGS) | |
69 | AC_SUBST(INSTALL64) | |
70 | AC_SUBST(LIB64CUPS) | |
71 | AC_SUBST(LIB64CUPSIMAGE) | |
72 | AC_SUBST(LIB64DIR) | |
73 | AC_SUBST(UNINSTALL64) | |
74 | ||
75 | dnl Position-Independent Executable support on Linux and *BSD... | |
76 | AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fpie option, default=no]) | |
77 | ||
78 | dnl Update compiler options... | |
79 | CXXLIBS="" | |
80 | AC_SUBST(CXXLIBS) | |
81 | ||
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 | |
86 | OPTIM="-Os -g" | |
87 | else | |
88 | OPTIM="$with_optim $OPTIM" | |
89 | fi | |
90 | fi | |
91 | ||
92 | if test $PICFLAG = 1 -a $uname != AIX; then | |
93 | OPTIM="-fPIC $OPTIM" | |
94 | fi | |
95 | ||
96 | case $uname in | |
97 | Linux*) | |
98 | if test x$enable_pie = xyes; then | |
99 | OPTIM="$OPTIM -fpie" | |
100 | LDFLAGS="$LDFLAGS -pie" | |
101 | fi | |
102 | ;; | |
103 | esac | |
104 | ||
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" | |
110 | fi | |
111 | ||
112 | case "$uname" in | |
113 | Darwin*) | |
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" | |
118 | fi | |
119 | else | |
120 | ARCHFLAGS="$with_archflags" | |
121 | fi | |
122 | ;; | |
123 | ||
124 | IRIX) | |
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" | |
129 | else | |
130 | ARCH32FLAGS="$with_arch32flags" | |
131 | fi | |
132 | INSTALL32="install32bit" | |
133 | LIB32CUPS="libcups.32.so.2" | |
134 | LIB32CUPSIMAGE="libcupsimage.32.so.2" | |
135 | LIB32DIR="$prefix/lib32" | |
136 | UNINSTALL32="uninstall32bit" | |
137 | ||
138 | if test -z "$with_archflags"; then | |
139 | if test -z "$with_arch64flags"; then | |
140 | ARCHFLAGS="-64 -mips4" | |
141 | else | |
142 | ARCHFLAGS="$with_arch64flags" | |
143 | fi | |
144 | else | |
145 | ARCHFLAGS="$with_archflags" | |
146 | fi | |
147 | fi | |
148 | ||
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" | |
153 | else | |
154 | ARCH64FLAGS="$with_arch64flags" | |
155 | fi | |
156 | INSTALL64="install64bit" | |
157 | LIB64CUPS="libcups.64.so.2" | |
158 | LIB64CUPSIMAGE="libcupsimage.64.so.2" | |
159 | LIB64DIR="$prefix/lib64" | |
160 | UNINSTALL64="uninstall64bit" | |
161 | ||
162 | if test -z "$with_archflags"; then | |
163 | if test -z "$with_arch32flags"; then | |
164 | ARCHFLAGS="-n32 -mips3" | |
165 | else | |
166 | ARCHFLAGS="$with_arch32flags" | |
167 | fi | |
168 | else | |
169 | ARCHFLAGS="$with_archflags" | |
170 | fi | |
171 | fi | |
172 | ;; | |
173 | ||
174 | Linux*) | |
175 | if test "x$enable_32bit" = xyes; then | |
176 | # Build 32-bit libraries, 64-bit base... | |
177 | if test -z "$with_arch32flags"; then | |
178 | ARCH32FLAGS="-m32" | |
179 | else | |
180 | ARCH32FLAGS="$with_arch32flags" | |
181 | fi | |
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" | |
188 | fi | |
189 | UNINSTALL32="uninstall32bit" | |
190 | ||
191 | if test -z "$with_archflags"; then | |
192 | if test -z "$with_arch64flags"; then | |
193 | ARCHFLAGS="-m64" | |
194 | else | |
195 | ARCHFLAGS="$with_arch64flags" | |
196 | fi | |
197 | else | |
198 | ARCHFLAGS="$with_archflags" | |
199 | fi | |
200 | fi | |
201 | ||
202 | if test "x$enable_64bit" = xyes; then | |
203 | # Build 64-bit libraries, 32-bit base... | |
204 | if test -z "$with_arch64flags"; then | |
205 | ARCH64FLAGS="-m64" | |
206 | else | |
207 | ARCH64FLAGS="$with_arch64flags" | |
208 | fi | |
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" | |
215 | fi | |
216 | UNINSTALL64="uninstall64bit" | |
217 | ||
218 | if test -z "$with_archflags"; then | |
219 | if test -z "$with_arch32flags"; then | |
220 | ARCHFLAGS="-m32" | |
221 | else | |
222 | ARCHFLAGS="$with_arch32flags" | |
223 | fi | |
224 | else | |
225 | ARCHFLAGS="$with_archflags" | |
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="libcups.32.so.2" | |
240 | LIB32CUPSIMAGE="libcupsimage.32.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 | else | |
251 | ARCHFLAGS="$with_archflags" | |
252 | fi | |
253 | fi | |
254 | ||
255 | if test "x$enable_64bit" = xyes; then | |
256 | # Build 64-bit libraries, 32-bit base... | |
257 | if test -z "$with_arch64flags"; then | |
258 | ARCH64FLAGS="-m64" | |
259 | else | |
260 | ARCH64FLAGS="$with_arch64flags" | |
261 | fi | |
262 | INSTALL64="install64bit" | |
263 | LIB64CUPS="libcups.64.so.2" | |
264 | LIB64CUPSIMAGE="libcupsimage.64.so.2" | |
265 | LIB64DIR="$exec_prefix/lib/64" | |
266 | UNINSTALL64="uninstall64bit" | |
267 | ||
268 | if test -z "$with_archflags"; then | |
269 | if test -z "$with_arch32flags"; then | |
270 | ARCHFLAGS="-m32" | |
271 | else | |
272 | ARCHFLAGS="$with_arch32flags" | |
273 | fi | |
274 | else | |
275 | ARCHFLAGS="$with_archflags" | |
276 | fi | |
277 | fi | |
278 | ;; | |
279 | esac | |
280 | else | |
281 | case $uname in | |
282 | AIX*) | |
283 | if test -z "$OPTIM"; then | |
284 | if test "x$with_optim" = x; then | |
285 | OPTIM="-O2 -qmaxmem=6000" | |
286 | else | |
287 | OPTIM="$with_optim $OPTIM" | |
288 | fi | |
289 | fi | |
290 | ;; | |
291 | HP-UX*) | |
292 | if test -z "$OPTIM"; then | |
293 | if test "x$with_optim" = x; then | |
294 | OPTIM="+O2" | |
295 | else | |
296 | OPTIM="$with_optim $OPTIM" | |
297 | fi | |
298 | fi | |
299 | ||
300 | CFLAGS="-Ae $CFLAGS" | |
301 | # Warning 336 is "empty translation unit" | |
302 | # Warning 829 is passing constant string as char * | |
303 | CXXFLAGS="+W336,829 $CXXFLAGS" | |
304 | ||
305 | if test "x$with_optim" = x; then | |
306 | OPTIM="+DAportable $OPTIM" | |
307 | fi | |
308 | ||
309 | if test $PICFLAG = 1; then | |
310 | OPTIM="+z $OPTIM" | |
311 | fi | |
312 | ;; | |
313 | IRIX) | |
314 | if test -z "$OPTIM"; then | |
315 | if test "x$with_optim" = x; then | |
316 | OPTIM="-O2" | |
317 | else | |
318 | OPTIM="$with_optim $OPTIM" | |
319 | fi | |
320 | fi | |
321 | ||
322 | if test "x$with_optim" = x; then | |
323 | OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM" | |
324 | fi | |
325 | ||
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" | |
330 | else | |
331 | ARCH32FLAGS="$with_arch32flags" | |
332 | fi | |
333 | INSTALL32="install32bit" | |
334 | LIB32CUPS="libcups.32.so.2" | |
335 | LIB32CUPSIMAGE="libcupsimage.32.so.2" | |
336 | LIB32DIR="$prefix/lib32" | |
337 | UNINSTALL32="uninstall32bit" | |
338 | ||
339 | if test -z "$with_archflags"; then | |
340 | if test -z "$with_arch64flags"; then | |
341 | ARCHFLAGS="-64 -mips4" | |
342 | else | |
343 | ARCHFLAGS="$with_arch64flags" | |
344 | fi | |
345 | else | |
346 | ARCHFLAGS="$with_archflags" | |
347 | fi | |
348 | fi | |
349 | ||
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" | |
354 | else | |
355 | ARCH64FLAGS="$with_arch64flags" | |
356 | fi | |
357 | INSTALL64="install64bit" | |
358 | LIB64CUPS="libcups.64.so.2" | |
359 | LIB64CUPSIMAGE="libcupsimage.64.so.2" | |
360 | LIB64DIR="$prefix/lib64" | |
361 | UNINSTALL64="uninstall64bit" | |
362 | ||
363 | if test -z "$with_archflags"; then | |
364 | if test -z "$with_arch32flags"; then | |
365 | ARCHFLAGS="-n32 -mips3" | |
366 | else | |
367 | ARCHFLAGS="$with_arch32flags" | |
368 | fi | |
369 | else | |
370 | ARCHFLAGS="$with_archflags" | |
371 | fi | |
372 | fi | |
373 | ;; | |
374 | SunOS*) | |
375 | # Solaris | |
376 | if test -z "$OPTIM"; then | |
377 | if test "x$with_optim" = x; then | |
378 | OPTIM="-xO4" | |
379 | else | |
380 | OPTIM="$with_optim $OPTIM" | |
381 | fi | |
382 | fi | |
383 | ||
384 | if test $PICFLAG = 1; then | |
385 | OPTIM="-KPIC $OPTIM" | |
386 | fi | |
387 | ||
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" | |
397 | ||
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... | |
402 | OPTIM="-w $OPTIM" | |
403 | CFLAGS="-xarch=generic64 $CFLAGS" | |
404 | fi | |
405 | else | |
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" | |
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 | CFLAGS="-xarch=generic $CFLAGS" | |
421 | fi | |
422 | else | |
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... | |
427 | OPTIM="-w $OPTIM" | |
428 | CFLAGS="-xarch=generic $CFLAGS" | |
429 | fi | |
430 | fi | |
431 | fi | |
432 | ;; | |
433 | UNIX_SVR*) | |
434 | # UnixWare | |
435 | if test -z "$OPTIM"; then | |
436 | if test "x$with_optim" = x; then | |
437 | OPTIM="-O" | |
438 | else | |
439 | OPTIM="$with_optim $OPTIM" | |
440 | fi | |
441 | fi | |
442 | ||
443 | if test $PICFLAG = 1; then | |
444 | OPTIM="-KPIC $OPTIM" | |
445 | fi | |
446 | ;; | |
447 | *) | |
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." | |
455 | ;; | |
456 | esac | |
457 | fi | |
458 | ||
459 | if test $uname = HP-UX; then | |
460 | # HP-UX 10.20 (at least) needs this definition to get the | |
461 | # h_errno global... | |
462 | OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED" | |
463 | ||
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" | |
467 | fi | |
468 | ||
469 | dnl | |
470 | dnl End of "$Id: cups-compiler.m4 5288 2006-03-14 02:38:07Z mike $". | |
471 | dnl |