]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | dnl |
355e94dc | 2 | dnl "$Id: cups-compiler.m4 6698 2007-07-20 14:15:44Z mike $" |
ef416fc2 | 3 | dnl |
4 | dnl Compiler stuff for the Common UNIX Printing System (CUPS). | |
5 | dnl | |
bc44d920 | 6 | dnl Copyright 2007 by Apple Inc. |
f7deaa1a | 7 | dnl Copyright 1997-2007 by Easy Software Products, all rights reserved. |
ef416fc2 | 8 | dnl |
9 | dnl These coded instructions, statements, and computer programs are the | |
bc44d920 | 10 | dnl property of Apple Inc. and are protected by Federal copyright |
11 | dnl law. Distribution and use rights are outlined in the file "LICENSE.txt" | |
12 | dnl which should have been included with this file. If this file is | |
13 | dnl file is missing or damaged, see the license at "http://www.cups.org/". | |
ef416fc2 | 14 | dnl |
15 | ||
16 | dnl Clear the debugging and non-shared library options unless the user asks | |
17 | dnl for them... | |
18 | OPTIM="" | |
19 | AC_SUBST(OPTIM) | |
20 | ||
fa73b229 | 21 | AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ]) |
ef416fc2 | 22 | AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no], |
23 | [if test x$enable_debug = xyes; then | |
24 | OPTIM="-g" | |
25 | fi]) | |
26 | ||
ed486911 | 27 | dnl Setup general architecture flags... |
28 | AC_ARG_WITH(archflags, [ --with-archflags="flags" | |
29 | set default architecture flags ]) | |
30 | ||
31 | if test -z "$with_archflags"; then | |
32 | ARCHFLAGS="" | |
09a101d6 | 33 | LDARCHFLAGS="" |
ed486911 | 34 | else |
35 | ARCHFLAGS="$with_archflags" | |
09a101d6 | 36 | if test "$uname" = Darwin; then |
37 | # Only link 32-bit programs - 64-bit is for the shared | |
38 | # libraries... | |
39 | LDARCHFLAGS="`echo $ARCHFLAGS | sed -e '1,$s/-arch x86_64//' -e '1,$s/-arch ppc64//'`" | |
40 | else | |
41 | LDARCHFLAGS="$ARCHFLAGS" | |
42 | fi | |
ed486911 | 43 | fi |
44 | ||
45 | AC_SUBST(ARCHFLAGS) | |
09a101d6 | 46 | AC_SUBST(LDARCHFLAGS) |
ed486911 | 47 | |
e1d6a774 | 48 | dnl Setup support for separate 32/64-bit library generation... |
ed486911 | 49 | AC_ARG_WITH(arch32flags, [ --with-arch32flags="flags" |
50 | specifies 32-bit architecture flags]) | |
e1d6a774 | 51 | ARCH32FLAGS="" |
e1d6a774 | 52 | AC_SUBST(ARCH32FLAGS) |
e1d6a774 | 53 | |
ed486911 | 54 | AC_ARG_WITH(arch64flags, [ --with-arch64flags="flags" |
55 | specifies 64-bit architecture flags]) | |
e1d6a774 | 56 | ARCH64FLAGS="" |
e1d6a774 | 57 | AC_SUBST(ARCH64FLAGS) |
e1d6a774 | 58 | |
f7deaa1a | 59 | dnl Position-Independent Executable support on Linux... |
a74454a7 | 60 | AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no]) |
ef416fc2 | 61 | |
f7deaa1a | 62 | dnl Read-only data/program support on Linux... |
63 | AC_ARG_ENABLE(relro, [ --enable-relro use GCC relro option, default=no]) | |
64 | ||
ef416fc2 | 65 | dnl Update compiler options... |
66 | CXXLIBS="" | |
67 | AC_SUBST(CXXLIBS) | |
68 | ||
a74454a7 | 69 | PIEFLAGS="" |
70 | AC_SUBST(PIEFLAGS) | |
71 | ||
f7deaa1a | 72 | RELROFLAGS="" |
73 | AC_SUBST(RELROFLAGS) | |
74 | ||
355e94dc | 75 | LIBCUPSORDER="libcups.order" |
cc0d019f | 76 | AC_ARG_WITH(libcupsorder, [ --with-libcupsorder libcups secorder file, default=libcups.order], |
355e94dc MS |
77 | if test -f "$withval"; then |
78 | LIBCUPSORDER="$withval" | |
79 | fi) | |
cc0d019f MS |
80 | AC_SUBST(LIBCUPSORDER) |
81 | ||
355e94dc MS |
82 | LIBCUPSIMAGEORDER="libcupsimage.order" |
83 | AC_ARG_WITH(libcupsimageorder, [ --with-libcupsimagesorder | |
84 | libcupsimage secorder file, default=libcupsimage.order], | |
85 | if test -f "$withval"; then | |
86 | LIBCUPSIMAGEORDER="$withval" | |
87 | fi) | |
cc0d019f MS |
88 | AC_SUBST(LIBCUPSIMAGEORDER) |
89 | ||
ef416fc2 | 90 | if test -n "$GCC"; then |
2abf387c | 91 | # Add GCC-specific compiler options... |
ef416fc2 | 92 | if test -z "$OPTIM"; then |
93 | if test "x$with_optim" = x; then | |
94 | # Default to optimize-for-size and debug | |
95 | OPTIM="-Os -g" | |
96 | else | |
97 | OPTIM="$with_optim $OPTIM" | |
98 | fi | |
99 | fi | |
100 | ||
101 | if test $PICFLAG = 1 -a $uname != AIX; then | |
102 | OPTIM="-fPIC $OPTIM" | |
103 | fi | |
104 | ||
105 | case $uname in | |
ef416fc2 | 106 | Linux*) |
fa73b229 | 107 | if test x$enable_pie = xyes; then |
a74454a7 | 108 | PIEFLAGS="-pie -fPIE" |
109 | fi | |
f7deaa1a | 110 | |
111 | if test x$enable_relro = xyes; then | |
112 | RELROFLAGS="-Wl,-z,relro" | |
113 | fi | |
a74454a7 | 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 | |
b86bc4cf | 131 | HP-UX*) |
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="-milp32" | |
136 | else | |
137 | ARCH32FLAGS="$with_arch32flags" | |
138 | fi | |
139 | ||
140 | if test -z "$with_archflags"; then | |
141 | if test -z "$with_arch64flags"; then | |
142 | ARCHFLAGS="-mlp64" | |
143 | else | |
144 | ARCHFLAGS="$with_arch64flags" | |
145 | fi | |
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="-mlp64" | |
153 | else | |
154 | ARCH64FLAGS="$with_arch64flags" | |
155 | fi | |
156 | ||
157 | if test -z "$with_archflags"; then | |
158 | if test -z "$with_arch32flags"; then | |
159 | ARCHFLAGS="-milp32" | |
160 | else | |
161 | ARCHFLAGS="$with_arch32flags" | |
162 | fi | |
163 | fi | |
164 | fi | |
165 | ;; | |
166 | ||
e1d6a774 | 167 | IRIX) |
168 | if test "x$enable_32bit" = xyes; then | |
169 | # Build 32-bit libraries, 64-bit base... | |
170 | if test -z "$with_arch32flags"; then | |
171 | ARCH32FLAGS="-n32 -mips3" | |
172 | else | |
173 | ARCH32FLAGS="$with_arch32flags" | |
174 | fi | |
e1d6a774 | 175 | |
176 | if test -z "$with_archflags"; then | |
177 | if test -z "$with_arch64flags"; then | |
178 | ARCHFLAGS="-64 -mips4" | |
179 | else | |
180 | ARCHFLAGS="$with_arch64flags" | |
181 | fi | |
e1d6a774 | 182 | fi |
183 | fi | |
184 | ||
185 | if test "x$enable_64bit" = xyes; then | |
186 | # Build 64-bit libraries, 32-bit base... | |
187 | if test -z "$with_arch64flags"; then | |
188 | ARCH64FLAGS="-64 -mips4" | |
189 | else | |
190 | ARCH64FLAGS="$with_arch64flags" | |
191 | fi | |
e1d6a774 | 192 | |
193 | if test -z "$with_archflags"; then | |
194 | if test -z "$with_arch32flags"; then | |
195 | ARCHFLAGS="-n32 -mips3" | |
196 | else | |
197 | ARCHFLAGS="$with_arch32flags" | |
198 | fi | |
e1d6a774 | 199 | fi |
200 | fi | |
201 | ;; | |
202 | ||
203 | Linux*) | |
204 | if test "x$enable_32bit" = xyes; then | |
205 | # Build 32-bit libraries, 64-bit base... | |
206 | if test -z "$with_arch32flags"; then | |
207 | ARCH32FLAGS="-m32" | |
208 | else | |
209 | ARCH32FLAGS="$with_arch32flags" | |
210 | fi | |
e1d6a774 | 211 | |
212 | if test -z "$with_archflags"; then | |
213 | if test -z "$with_arch64flags"; then | |
214 | ARCHFLAGS="-m64" | |
215 | else | |
216 | ARCHFLAGS="$with_arch64flags" | |
217 | fi | |
e1d6a774 | 218 | fi |
219 | fi | |
220 | ||
221 | if test "x$enable_64bit" = xyes; then | |
222 | # Build 64-bit libraries, 32-bit base... | |
223 | if test -z "$with_arch64flags"; then | |
224 | ARCH64FLAGS="-m64" | |
225 | else | |
226 | ARCH64FLAGS="$with_arch64flags" | |
227 | fi | |
e1d6a774 | 228 | |
229 | if test -z "$with_archflags"; then | |
230 | if test -z "$with_arch32flags"; then | |
231 | ARCHFLAGS="-m32" | |
232 | else | |
233 | ARCHFLAGS="$with_arch32flags" | |
234 | fi | |
e1d6a774 | 235 | fi |
236 | fi | |
237 | ;; | |
238 | ||
239 | SunOS*) | |
240 | if test "x$enable_32bit" = xyes; then | |
241 | # Build 32-bit libraries, 64-bit base... | |
242 | if test -z "$with_arch32flags"; then | |
243 | ARCH32FLAGS="-m32" | |
244 | else | |
245 | ARCH32FLAGS="$with_arch32flags" | |
246 | fi | |
e1d6a774 | 247 | |
248 | if test -z "$with_archflags"; then | |
249 | if test -z "$with_arch64flags"; then | |
250 | ARCHFLAGS="-m64" | |
251 | else | |
252 | ARCHFLAGS="$with_arch64flags" | |
253 | fi | |
e1d6a774 | 254 | fi |
255 | fi | |
256 | ||
257 | if test "x$enable_64bit" = xyes; then | |
258 | # Build 64-bit libraries, 32-bit base... | |
259 | if test -z "$with_arch64flags"; then | |
260 | ARCH64FLAGS="-m64" | |
261 | else | |
262 | ARCH64FLAGS="$with_arch64flags" | |
263 | fi | |
e1d6a774 | 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 |
2abf387c | 276 | # Add vendor-specific compiler options... |
ef416fc2 | 277 | case $uname in |
278 | AIX*) | |
279 | if test -z "$OPTIM"; then | |
280 | if test "x$with_optim" = x; then | |
281 | OPTIM="-O2 -qmaxmem=6000" | |
282 | else | |
283 | OPTIM="$with_optim $OPTIM" | |
284 | fi | |
285 | fi | |
286 | ;; | |
287 | HP-UX*) | |
288 | if test -z "$OPTIM"; then | |
289 | if test "x$with_optim" = x; then | |
290 | OPTIM="+O2" | |
291 | else | |
292 | OPTIM="$with_optim $OPTIM" | |
293 | fi | |
294 | fi | |
295 | ||
296 | CFLAGS="-Ae $CFLAGS" | |
e1d6a774 | 297 | # Warning 336 is "empty translation unit" |
298 | # Warning 829 is passing constant string as char * | |
299 | CXXFLAGS="+W336,829 $CXXFLAGS" | |
ef416fc2 | 300 | |
ef416fc2 | 301 | if test $PICFLAG = 1; then |
302 | OPTIM="+z $OPTIM" | |
303 | fi | |
304 | ;; | |
305 | IRIX) | |
306 | if test -z "$OPTIM"; then | |
307 | if test "x$with_optim" = x; then | |
308 | OPTIM="-O2" | |
309 | else | |
310 | OPTIM="$with_optim $OPTIM" | |
311 | fi | |
312 | fi | |
313 | ||
e1d6a774 | 314 | if test "x$with_optim" = x; then |
315 | OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM" | |
ef416fc2 | 316 | fi |
317 | ||
e1d6a774 | 318 | if test "x$enable_32bit" = xyes; then |
319 | # Build 32-bit libraries, 64-bit base... | |
320 | if test -z "$with_arch32flags"; then | |
321 | ARCH32FLAGS="-n32 -mips3" | |
322 | else | |
323 | ARCH32FLAGS="$with_arch32flags" | |
324 | fi | |
e1d6a774 | 325 | |
326 | if test -z "$with_archflags"; then | |
327 | if test -z "$with_arch64flags"; then | |
328 | ARCHFLAGS="-64 -mips4" | |
329 | else | |
330 | ARCHFLAGS="$with_arch64flags" | |
331 | fi | |
e1d6a774 | 332 | fi |
333 | fi | |
334 | ||
335 | if test "x$enable_64bit" = xyes; then | |
336 | # Build 64-bit libraries, 32-bit base... | |
337 | if test -z "$with_arch64flags"; then | |
338 | ARCH64FLAGS="-64 -mips4" | |
339 | else | |
340 | ARCH64FLAGS="$with_arch64flags" | |
341 | fi | |
e1d6a774 | 342 | |
343 | if test -z "$with_archflags"; then | |
344 | if test -z "$with_arch32flags"; then | |
345 | ARCHFLAGS="-n32 -mips3" | |
346 | else | |
347 | ARCHFLAGS="$with_arch32flags" | |
348 | fi | |
ef416fc2 | 349 | fi |
350 | fi | |
351 | ;; | |
2abf387c | 352 | OSF*) |
353 | # Tru64 UNIX aka Digital UNIX aka OSF/1 | |
354 | if test -z "$OPTIM"; then | |
355 | if test "x$with_optim" = x; then | |
356 | OPTIM="-O" | |
357 | else | |
358 | OPTIM="$with_optim" | |
359 | fi | |
360 | fi | |
361 | ;; | |
ef416fc2 | 362 | SunOS*) |
363 | # Solaris | |
364 | if test -z "$OPTIM"; then | |
365 | if test "x$with_optim" = x; then | |
ed486911 | 366 | OPTIM="-xO2" |
ef416fc2 | 367 | else |
368 | OPTIM="$with_optim $OPTIM" | |
369 | fi | |
370 | fi | |
371 | ||
ef416fc2 | 372 | if test $PICFLAG = 1; then |
373 | OPTIM="-KPIC $OPTIM" | |
374 | fi | |
e1d6a774 | 375 | |
376 | if test "x$enable_32bit" = xyes; then | |
377 | # Compiling on a Solaris system, build 64-bit | |
378 | # binaries with separate 32-bit libraries... | |
379 | ARCH32FLAGS="-xarch=generic" | |
e1d6a774 | 380 | |
381 | if test "x$with_optim" = x; then | |
382 | # Suppress all of Sun's questionable | |
383 | # warning messages, and default to | |
384 | # 64-bit compiles of everything else... | |
385 | OPTIM="-w $OPTIM" | |
f301802f | 386 | fi |
387 | ||
388 | if test -z "$with_archflags"; then | |
389 | if test -z "$with_arch64flags"; then | |
390 | ARCHFLAGS="-xarch=generic64" | |
391 | else | |
392 | ARCHFLAGS="$with_arch64flags" | |
393 | fi | |
e1d6a774 | 394 | fi |
395 | else | |
396 | if test "x$enable_64bit" = xyes; then | |
397 | # Build 64-bit libraries... | |
398 | ARCH64FLAGS="-xarch=generic64" | |
f301802f | 399 | fi |
400 | ||
401 | if test "x$with_optim" = x; then | |
402 | # Suppress all of Sun's questionable | |
403 | # warning messages, and default to | |
404 | # 32-bit compiles of everything else... | |
405 | OPTIM="-w $OPTIM" | |
406 | fi | |
e1d6a774 | 407 | |
f301802f | 408 | if test -z "$with_archflags"; then |
409 | if test -z "$with_arch32flags"; then | |
410 | ARCHFLAGS="-xarch=generic" | |
411 | else | |
412 | ARCHFLAGS="$with_arch32flags" | |
e1d6a774 | 413 | fi |
e1d6a774 | 414 | fi |
415 | fi | |
ef416fc2 | 416 | ;; |
417 | UNIX_SVR*) | |
418 | # UnixWare | |
419 | if test -z "$OPTIM"; then | |
420 | if test "x$with_optim" = x; then | |
421 | OPTIM="-O" | |
422 | else | |
423 | OPTIM="$with_optim $OPTIM" | |
424 | fi | |
425 | fi | |
426 | ||
427 | if test $PICFLAG = 1; then | |
428 | OPTIM="-KPIC $OPTIM" | |
429 | fi | |
430 | ;; | |
431 | *) | |
432 | # Running some other operating system; inform the user they | |
433 | # should contribute the necessary options to | |
434 | # cups-support@cups.org... | |
435 | echo "Building CUPS with default compiler optimizations; contact" | |
436 | echo "cups-bugs@cups.org with uname and compiler options needed" | |
437 | echo "for your platform, or set the CFLAGS and CXXFLAGS" | |
438 | echo "environment variable before running configure." | |
439 | ;; | |
440 | esac | |
441 | fi | |
442 | ||
2abf387c | 443 | # Add general compiler options per platform... |
444 | case $uname in | |
445 | HP-UX*) | |
446 | # HP-UX 10.20 (at least) needs this definition to get the | |
447 | # h_errno global... | |
448 | OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED" | |
449 | ||
450 | # HP-UX 11.00 (at least) needs this definition to get the | |
451 | # u_short type used by the IP headers... | |
452 | OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE" | |
b94498cf | 453 | |
454 | # HP-UX 11.23 (at least) needs this definition to get the | |
455 | # IPv6 header to work... | |
456 | OPTIM="$OPTIM -D_HPUX_SOURCE" | |
2abf387c | 457 | ;; |
458 | ||
459 | OSF*) | |
460 | # Tru64 UNIX aka Digital UNIX aka OSF/1 need to be told | |
461 | # to be POSIX-compliant... | |
462 | OPTIM="$OPTIM -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_OSF_SOURCE" | |
463 | ;; | |
464 | esac | |
ef416fc2 | 465 | |
466 | dnl | |
355e94dc | 467 | dnl End of "$Id: cups-compiler.m4 6698 2007-07-20 14:15:44Z mike $". |
ef416fc2 | 468 | dnl |