]> 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 6145 2006-12-06 20:10:16Z 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_WITH(arch32flags, [ --with-arch32flags="flags"
50 specifies 32-bit architecture flags])
51 ARCH32FLAGS=""
52 AC_SUBST(ARCH32FLAGS)
53
54 AC_ARG_WITH(arch64flags, [ --with-arch64flags="flags"
55 specifies 64-bit architecture flags])
56 ARCH64FLAGS=""
57 AC_SUBST(ARCH64FLAGS)
58
59 dnl Position-Independent Executable support on Linux and *BSD...
60 AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no])
61
62 dnl Update compiler options...
63 CXXLIBS=""
64 AC_SUBST(CXXLIBS)
65
66 PIEFLAGS=""
67 AC_SUBST(PIEFLAGS)
68
69 if test -n "$GCC"; then
70 # Add GCC-specific compiler options...
71 if test -z "$OPTIM"; then
72 if test "x$with_optim" = x; then
73 # Default to optimize-for-size and debug
74 OPTIM="-Os -g"
75 else
76 OPTIM="$with_optim $OPTIM"
77 fi
78 fi
79
80 if test $PICFLAG = 1 -a $uname != AIX; then
81 OPTIM="-fPIC $OPTIM"
82 fi
83
84 case $uname in
85 Linux*)
86 if test x$enable_pie = xyes; then
87 PIEFLAGS="-pie -fPIE"
88 fi
89 ;;
90
91 *)
92 if test x$enable_pie = xyes; then
93 echo "Sorry, --enable-pie is not supported on this OS!"
94 fi
95 ;;
96 esac
97
98 if test "x$with_optim" = x; then
99 # Add useful warning options for tracking down problems...
100 OPTIM="-Wall -Wno-format-y2k $OPTIM"
101 # Additional warning options for alpha testing...
102 OPTIM="-Wshadow -Wunused $OPTIM"
103 fi
104
105 case "$uname" in
106 HP-UX*)
107 if test "x$enable_32bit" = xyes; then
108 # Build 32-bit libraries, 64-bit base...
109 if test -z "$with_arch32flags"; then
110 ARCH32FLAGS="-milp32"
111 else
112 ARCH32FLAGS="$with_arch32flags"
113 fi
114
115 if test -z "$with_archflags"; then
116 if test -z "$with_arch64flags"; then
117 ARCHFLAGS="-mlp64"
118 else
119 ARCHFLAGS="$with_arch64flags"
120 fi
121 fi
122 fi
123
124 if test "x$enable_64bit" = xyes; then
125 # Build 64-bit libraries, 32-bit base...
126 if test -z "$with_arch64flags"; then
127 ARCH64FLAGS="-mlp64"
128 else
129 ARCH64FLAGS="$with_arch64flags"
130 fi
131
132 if test -z "$with_archflags"; then
133 if test -z "$with_arch32flags"; then
134 ARCHFLAGS="-milp32"
135 else
136 ARCHFLAGS="$with_arch32flags"
137 fi
138 fi
139 fi
140 ;;
141
142 IRIX)
143 if test "x$enable_32bit" = xyes; then
144 # Build 32-bit libraries, 64-bit base...
145 if test -z "$with_arch32flags"; then
146 ARCH32FLAGS="-n32 -mips3"
147 else
148 ARCH32FLAGS="$with_arch32flags"
149 fi
150
151 if test -z "$with_archflags"; then
152 if test -z "$with_arch64flags"; then
153 ARCHFLAGS="-64 -mips4"
154 else
155 ARCHFLAGS="$with_arch64flags"
156 fi
157 fi
158 fi
159
160 if test "x$enable_64bit" = xyes; then
161 # Build 64-bit libraries, 32-bit base...
162 if test -z "$with_arch64flags"; then
163 ARCH64FLAGS="-64 -mips4"
164 else
165 ARCH64FLAGS="$with_arch64flags"
166 fi
167
168 if test -z "$with_archflags"; then
169 if test -z "$with_arch32flags"; then
170 ARCHFLAGS="-n32 -mips3"
171 else
172 ARCHFLAGS="$with_arch32flags"
173 fi
174 fi
175 fi
176 ;;
177
178 Linux*)
179 if test "x$enable_32bit" = xyes; then
180 # Build 32-bit libraries, 64-bit base...
181 if test -z "$with_arch32flags"; then
182 ARCH32FLAGS="-m32"
183 else
184 ARCH32FLAGS="$with_arch32flags"
185 fi
186
187 if test -z "$with_archflags"; then
188 if test -z "$with_arch64flags"; then
189 ARCHFLAGS="-m64"
190 else
191 ARCHFLAGS="$with_arch64flags"
192 fi
193 fi
194 fi
195
196 if test "x$enable_64bit" = xyes; then
197 # Build 64-bit libraries, 32-bit base...
198 if test -z "$with_arch64flags"; then
199 ARCH64FLAGS="-m64"
200 else
201 ARCH64FLAGS="$with_arch64flags"
202 fi
203
204 if test -z "$with_archflags"; then
205 if test -z "$with_arch32flags"; then
206 ARCHFLAGS="-m32"
207 else
208 ARCHFLAGS="$with_arch32flags"
209 fi
210 fi
211 fi
212 ;;
213
214 SunOS*)
215 if test "x$enable_32bit" = xyes; then
216 # Build 32-bit libraries, 64-bit base...
217 if test -z "$with_arch32flags"; then
218 ARCH32FLAGS="-m32"
219 else
220 ARCH32FLAGS="$with_arch32flags"
221 fi
222
223 if test -z "$with_archflags"; then
224 if test -z "$with_arch64flags"; then
225 ARCHFLAGS="-m64"
226 else
227 ARCHFLAGS="$with_arch64flags"
228 fi
229 fi
230 fi
231
232 if test "x$enable_64bit" = xyes; then
233 # Build 64-bit libraries, 32-bit base...
234 if test -z "$with_arch64flags"; then
235 ARCH64FLAGS="-m64"
236 else
237 ARCH64FLAGS="$with_arch64flags"
238 fi
239
240 if test -z "$with_archflags"; then
241 if test -z "$with_arch32flags"; then
242 ARCHFLAGS="-m32"
243 else
244 ARCHFLAGS="$with_arch32flags"
245 fi
246 fi
247 fi
248 ;;
249 esac
250 else
251 # Add vendor-specific compiler options...
252 case $uname in
253 AIX*)
254 if test -z "$OPTIM"; then
255 if test "x$with_optim" = x; then
256 OPTIM="-O2 -qmaxmem=6000"
257 else
258 OPTIM="$with_optim $OPTIM"
259 fi
260 fi
261 ;;
262 HP-UX*)
263 if test -z "$OPTIM"; then
264 if test "x$with_optim" = x; then
265 OPTIM="+O2"
266 else
267 OPTIM="$with_optim $OPTIM"
268 fi
269 fi
270
271 CFLAGS="-Ae $CFLAGS"
272 # Warning 336 is "empty translation unit"
273 # Warning 829 is passing constant string as char *
274 CXXFLAGS="+W336,829 $CXXFLAGS"
275
276 if test $PICFLAG = 1; then
277 OPTIM="+z $OPTIM"
278 fi
279 ;;
280 IRIX)
281 if test -z "$OPTIM"; then
282 if test "x$with_optim" = x; then
283 OPTIM="-O2"
284 else
285 OPTIM="$with_optim $OPTIM"
286 fi
287 fi
288
289 if test "x$with_optim" = x; then
290 OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM"
291 fi
292
293 if test "x$enable_32bit" = xyes; then
294 # Build 32-bit libraries, 64-bit base...
295 if test -z "$with_arch32flags"; then
296 ARCH32FLAGS="-n32 -mips3"
297 else
298 ARCH32FLAGS="$with_arch32flags"
299 fi
300
301 if test -z "$with_archflags"; then
302 if test -z "$with_arch64flags"; then
303 ARCHFLAGS="-64 -mips4"
304 else
305 ARCHFLAGS="$with_arch64flags"
306 fi
307 fi
308 fi
309
310 if test "x$enable_64bit" = xyes; then
311 # Build 64-bit libraries, 32-bit base...
312 if test -z "$with_arch64flags"; then
313 ARCH64FLAGS="-64 -mips4"
314 else
315 ARCH64FLAGS="$with_arch64flags"
316 fi
317
318 if test -z "$with_archflags"; then
319 if test -z "$with_arch32flags"; then
320 ARCHFLAGS="-n32 -mips3"
321 else
322 ARCHFLAGS="$with_arch32flags"
323 fi
324 fi
325 fi
326 ;;
327 OSF*)
328 # Tru64 UNIX aka Digital UNIX aka OSF/1
329 if test -z "$OPTIM"; then
330 if test "x$with_optim" = x; then
331 OPTIM="-O"
332 else
333 OPTIM="$with_optim"
334 fi
335 fi
336 ;;
337 SunOS*)
338 # Solaris
339 if test -z "$OPTIM"; then
340 if test "x$with_optim" = x; then
341 OPTIM="-xO2"
342 else
343 OPTIM="$with_optim $OPTIM"
344 fi
345 fi
346
347 if test $PICFLAG = 1; then
348 OPTIM="-KPIC $OPTIM"
349 fi
350
351 if test "x$enable_32bit" = xyes; then
352 # Compiling on a Solaris system, build 64-bit
353 # binaries with separate 32-bit libraries...
354 ARCH32FLAGS="-xarch=generic"
355
356 if test "x$with_optim" = x; then
357 # Suppress all of Sun's questionable
358 # warning messages, and default to
359 # 64-bit compiles of everything else...
360 OPTIM="-w $OPTIM"
361 fi
362
363 if test -z "$with_archflags"; then
364 if test -z "$with_arch64flags"; then
365 ARCHFLAGS="-xarch=generic64"
366 else
367 ARCHFLAGS="$with_arch64flags"
368 fi
369 fi
370 else
371 if test "x$enable_64bit" = xyes; then
372 # Build 64-bit libraries...
373 ARCH64FLAGS="-xarch=generic64"
374 fi
375
376 if test "x$with_optim" = x; then
377 # Suppress all of Sun's questionable
378 # warning messages, and default to
379 # 32-bit compiles of everything else...
380 OPTIM="-w $OPTIM"
381 fi
382
383 if test -z "$with_archflags"; then
384 if test -z "$with_arch32flags"; then
385 ARCHFLAGS="-xarch=generic"
386 else
387 ARCHFLAGS="$with_arch32flags"
388 fi
389 fi
390 fi
391 ;;
392 UNIX_SVR*)
393 # UnixWare
394 if test -z "$OPTIM"; then
395 if test "x$with_optim" = x; then
396 OPTIM="-O"
397 else
398 OPTIM="$with_optim $OPTIM"
399 fi
400 fi
401
402 if test $PICFLAG = 1; then
403 OPTIM="-KPIC $OPTIM"
404 fi
405 ;;
406 *)
407 # Running some other operating system; inform the user they
408 # should contribute the necessary options to
409 # cups-support@cups.org...
410 echo "Building CUPS with default compiler optimizations; contact"
411 echo "cups-bugs@cups.org with uname and compiler options needed"
412 echo "for your platform, or set the CFLAGS and CXXFLAGS"
413 echo "environment variable before running configure."
414 ;;
415 esac
416 fi
417
418 # Add general compiler options per platform...
419 case $uname in
420 HP-UX*)
421 # HP-UX 10.20 (at least) needs this definition to get the
422 # h_errno global...
423 OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
424
425 # HP-UX 11.00 (at least) needs this definition to get the
426 # u_short type used by the IP headers...
427 OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
428 ;;
429
430 OSF*)
431 # Tru64 UNIX aka Digital UNIX aka OSF/1 need to be told
432 # to be POSIX-compliant...
433 OPTIM="$OPTIM -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED -D_OSF_SOURCE"
434 ;;
435 esac
436
437 dnl
438 dnl End of "$Id: cups-compiler.m4 6145 2006-12-06 20:10:16Z mike $".
439 dnl