]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | dnl |
8ca02f3c | 2 | dnl "$Id: cups-compiler.m4 5705 2006-06-30 01:07:29Z mike $" |
ef416fc2 | 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 | ||
fa73b229 | 30 | AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ]) |
ef416fc2 | 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 | ||
ed486911 | 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 | ||
e1d6a774 | 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]) | |
ed486911 | 50 | AC_ARG_WITH(arch32flags, [ --with-arch32flags="flags" |
51 | specifies 32-bit architecture flags]) | |
e1d6a774 | 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]) | |
ed486911 | 68 | AC_ARG_WITH(arch64flags, [ --with-arch64flags="flags" |
69 | specifies 64-bit architecture flags]) | |
e1d6a774 | 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... | |
a74454a7 | 86 | AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no]) |
ef416fc2 | 87 | |
88 | dnl Update compiler options... | |
89 | CXXLIBS="" | |
90 | AC_SUBST(CXXLIBS) | |
91 | ||
a74454a7 | 92 | PIEFLAGS="" |
93 | AC_SUBST(PIEFLAGS) | |
94 | ||
ef416fc2 | 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 | |
ef416fc2 | 110 | Linux*) |
fa73b229 | 111 | if test x$enable_pie = xyes; then |
a74454a7 | 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!" | |
fa73b229 | 119 | fi |
ef416fc2 | 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 | |
e1d6a774 | 129 | |
130 | case "$uname" in | |
e1d6a774 | 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" | |
f301802f | 140 | LIB32CUPS="32bit/libcups.so.2" |
141 | LIB32CUPSIMAGE="32bit/libcupsimage.so.2" | |
e1d6a774 | 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 | |
e1d6a774 | 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" | |
f301802f | 162 | LIB64CUPS="64bit/libcups.so.2" |
163 | LIB64CUPSIMAGE="64bit/libcupsimage.so.2" | |
e1d6a774 | 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 | |
e1d6a774 | 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" | |
f301802f | 186 | LIB32CUPS="32bit/libcups.so.2" |
187 | LIB32CUPSIMAGE="32bit/libcupsimage.so.2" | |
e1d6a774 | 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 | |
e1d6a774 | 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" | |
f301802f | 211 | LIB64CUPS="64bit/libcups.so.2" |
212 | LIB64CUPSIMAGE="64bit/libcupsimage.so.2" | |
e1d6a774 | 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 | |
e1d6a774 | 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" | |
f301802f | 238 | LIB32CUPS="32bit/libcups.so.2" |
239 | LIB32CUPSIMAGE="32bit/libcupsimage.so.2" | |
e1d6a774 | 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 | |
e1d6a774 | 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" | |
f301802f | 260 | LIB64CUPS="64bit/libcups.so.2" |
261 | LIB64CUPSIMAGE="64bit/libcupsimage.so.2" | |
e1d6a774 | 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 | |
e1d6a774 | 271 | fi |
272 | fi | |
273 | ;; | |
274 | esac | |
ef416fc2 | 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" | |
e1d6a774 | 296 | # Warning 336 is "empty translation unit" |
297 | # Warning 829 is passing constant string as char * | |
298 | CXXFLAGS="+W336,829 $CXXFLAGS" | |
ef416fc2 | 299 | |
ef416fc2 | 300 | if test $PICFLAG = 1; then |
301 | OPTIM="+z $OPTIM" | |
302 | fi | |
303 | ;; | |
304 | IRIX) | |
305 | if test -z "$OPTIM"; then | |
306 | if test "x$with_optim" = x; then | |
307 | OPTIM="-O2" | |
308 | else | |
309 | OPTIM="$with_optim $OPTIM" | |
310 | fi | |
311 | fi | |
312 | ||
e1d6a774 | 313 | if test "x$with_optim" = x; then |
314 | OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM" | |
ef416fc2 | 315 | fi |
316 | ||
e1d6a774 | 317 | if test "x$enable_32bit" = xyes; then |
318 | # Build 32-bit libraries, 64-bit base... | |
319 | if test -z "$with_arch32flags"; then | |
320 | ARCH32FLAGS="-n32 -mips3" | |
321 | else | |
322 | ARCH32FLAGS="$with_arch32flags" | |
323 | fi | |
324 | INSTALL32="install32bit" | |
f301802f | 325 | LIB32CUPS="32bit/libcups.so.2" |
326 | LIB32CUPSIMAGE="32bit/libcupsimage.so.2" | |
e1d6a774 | 327 | LIB32DIR="$prefix/lib32" |
328 | UNINSTALL32="uninstall32bit" | |
329 | ||
330 | if test -z "$with_archflags"; then | |
331 | if test -z "$with_arch64flags"; then | |
332 | ARCHFLAGS="-64 -mips4" | |
333 | else | |
334 | ARCHFLAGS="$with_arch64flags" | |
335 | fi | |
e1d6a774 | 336 | fi |
337 | fi | |
338 | ||
339 | if test "x$enable_64bit" = xyes; then | |
340 | # Build 64-bit libraries, 32-bit base... | |
341 | if test -z "$with_arch64flags"; then | |
342 | ARCH64FLAGS="-64 -mips4" | |
343 | else | |
344 | ARCH64FLAGS="$with_arch64flags" | |
345 | fi | |
346 | INSTALL64="install64bit" | |
f301802f | 347 | LIB64CUPS="64bit/libcups.so.2" |
348 | LIB64CUPSIMAGE="64bit/libcupsimage.so.2" | |
e1d6a774 | 349 | LIB64DIR="$prefix/lib64" |
350 | UNINSTALL64="uninstall64bit" | |
351 | ||
352 | if test -z "$with_archflags"; then | |
353 | if test -z "$with_arch32flags"; then | |
354 | ARCHFLAGS="-n32 -mips3" | |
355 | else | |
356 | ARCHFLAGS="$with_arch32flags" | |
357 | fi | |
ef416fc2 | 358 | fi |
359 | fi | |
360 | ;; | |
361 | SunOS*) | |
362 | # Solaris | |
363 | if test -z "$OPTIM"; then | |
364 | if test "x$with_optim" = x; then | |
ed486911 | 365 | OPTIM="-xO2" |
ef416fc2 | 366 | else |
367 | OPTIM="$with_optim $OPTIM" | |
368 | fi | |
369 | fi | |
370 | ||
ef416fc2 | 371 | if test $PICFLAG = 1; then |
372 | OPTIM="-KPIC $OPTIM" | |
373 | fi | |
e1d6a774 | 374 | |
375 | if test "x$enable_32bit" = xyes; then | |
376 | # Compiling on a Solaris system, build 64-bit | |
377 | # binaries with separate 32-bit libraries... | |
378 | ARCH32FLAGS="-xarch=generic" | |
379 | INSTALL32="install32bit" | |
f301802f | 380 | LIB32CUPS="32bit/libcups.so.2" |
381 | LIB32CUPSIMAGE="32bit/libcupsimage.so.2" | |
e1d6a774 | 382 | LIB32DIR="$exec_prefix/lib/32" |
383 | UNINSTALL32="uninstall32bit" | |
384 | ||
385 | if test "x$with_optim" = x; then | |
386 | # Suppress all of Sun's questionable | |
387 | # warning messages, and default to | |
388 | # 64-bit compiles of everything else... | |
389 | OPTIM="-w $OPTIM" | |
f301802f | 390 | fi |
391 | ||
392 | if test -z "$with_archflags"; then | |
393 | if test -z "$with_arch64flags"; then | |
394 | ARCHFLAGS="-xarch=generic64" | |
395 | else | |
396 | ARCHFLAGS="$with_arch64flags" | |
397 | fi | |
e1d6a774 | 398 | fi |
399 | else | |
400 | if test "x$enable_64bit" = xyes; then | |
401 | # Build 64-bit libraries... | |
402 | ARCH64FLAGS="-xarch=generic64" | |
403 | INSTALL64="install64bit" | |
f301802f | 404 | LIB64CUPS="64bit/libcups.so.2" |
405 | LIB64CUPSIMAGE="64bit/libcupsimage.so.2" | |
e1d6a774 | 406 | LIB64DIR="$exec_prefix/lib/64" |
407 | UNINSTALL64="uninstall64bit" | |
f301802f | 408 | fi |
409 | ||
410 | if test "x$with_optim" = x; then | |
411 | # Suppress all of Sun's questionable | |
412 | # warning messages, and default to | |
413 | # 32-bit compiles of everything else... | |
414 | OPTIM="-w $OPTIM" | |
415 | fi | |
e1d6a774 | 416 | |
f301802f | 417 | if test -z "$with_archflags"; then |
418 | if test -z "$with_arch32flags"; then | |
419 | ARCHFLAGS="-xarch=generic" | |
420 | else | |
421 | ARCHFLAGS="$with_arch32flags" | |
e1d6a774 | 422 | fi |
e1d6a774 | 423 | fi |
424 | fi | |
ef416fc2 | 425 | ;; |
426 | UNIX_SVR*) | |
427 | # UnixWare | |
428 | if test -z "$OPTIM"; then | |
429 | if test "x$with_optim" = x; then | |
430 | OPTIM="-O" | |
431 | else | |
432 | OPTIM="$with_optim $OPTIM" | |
433 | fi | |
434 | fi | |
435 | ||
436 | if test $PICFLAG = 1; then | |
437 | OPTIM="-KPIC $OPTIM" | |
438 | fi | |
439 | ;; | |
440 | *) | |
441 | # Running some other operating system; inform the user they | |
442 | # should contribute the necessary options to | |
443 | # cups-support@cups.org... | |
444 | echo "Building CUPS with default compiler optimizations; contact" | |
445 | echo "cups-bugs@cups.org with uname and compiler options needed" | |
446 | echo "for your platform, or set the CFLAGS and CXXFLAGS" | |
447 | echo "environment variable before running configure." | |
448 | ;; | |
449 | esac | |
450 | fi | |
451 | ||
452 | if test $uname = HP-UX; then | |
453 | # HP-UX 10.20 (at least) needs this definition to get the | |
454 | # h_errno global... | |
455 | OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED" | |
456 | ||
457 | # HP-UX 11.00 (at least) needs this definition to get the | |
458 | # u_short type used by the IP headers... | |
459 | OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE" | |
460 | fi | |
461 | ||
462 | dnl | |
8ca02f3c | 463 | dnl End of "$Id: cups-compiler.m4 5705 2006-06-30 01:07:29Z mike $". |
ef416fc2 | 464 | dnl |