]> 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
b86bc4cf 2dnl "$Id: cups-compiler.m4 6145 2006-12-06 20:10:16Z 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...
27OPTIM=""
28AC_SUBST(OPTIM)
29
fa73b229 30AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ])
ef416fc2 31AC_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 36dnl Setup general architecture flags...
37AC_ARG_WITH(archflags, [ --with-archflags="flags"
38 set default architecture flags ])
39
40if test -z "$with_archflags"; then
41 ARCHFLAGS=""
42else
43 ARCHFLAGS="$with_archflags"
44fi
45
46AC_SUBST(ARCHFLAGS)
47
e1d6a774 48dnl Setup support for separate 32/64-bit library generation...
ed486911 49AC_ARG_WITH(arch32flags, [ --with-arch32flags="flags"
50 specifies 32-bit architecture flags])
e1d6a774 51ARCH32FLAGS=""
e1d6a774 52AC_SUBST(ARCH32FLAGS)
e1d6a774 53
ed486911 54AC_ARG_WITH(arch64flags, [ --with-arch64flags="flags"
55 specifies 64-bit architecture flags])
e1d6a774 56ARCH64FLAGS=""
e1d6a774 57AC_SUBST(ARCH64FLAGS)
e1d6a774 58
59dnl Position-Independent Executable support on Linux and *BSD...
a74454a7 60AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fPIE option, default=no])
ef416fc2 61
62dnl Update compiler options...
63CXXLIBS=""
64AC_SUBST(CXXLIBS)
65
a74454a7 66PIEFLAGS=""
67AC_SUBST(PIEFLAGS)
68
ef416fc2 69if test -n "$GCC"; then
2abf387c 70 # Add GCC-specific compiler options...
ef416fc2 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
ef416fc2 85 Linux*)
fa73b229 86 if test x$enable_pie = xyes; then
a74454a7 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!"
fa73b229 94 fi
ef416fc2 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
e1d6a774 104
105 case "$uname" in
b86bc4cf 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
e1d6a774 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
e1d6a774 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
e1d6a774 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
e1d6a774 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
e1d6a774 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
e1d6a774 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
e1d6a774 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
e1d6a774 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
e1d6a774 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
e1d6a774 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
e1d6a774 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
e1d6a774 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
e1d6a774 246 fi
247 fi
248 ;;
249 esac
ef416fc2 250else
2abf387c 251 # Add vendor-specific compiler options...
ef416fc2 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"
e1d6a774 272 # Warning 336 is "empty translation unit"
273 # Warning 829 is passing constant string as char *
274 CXXFLAGS="+W336,829 $CXXFLAGS"
ef416fc2 275
ef416fc2 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
e1d6a774 289 if test "x$with_optim" = x; then
290 OPTIM="-fullwarn -woff 1183,1209,1349,1506,3201 $OPTIM"
ef416fc2 291 fi
292
e1d6a774 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
e1d6a774 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
e1d6a774 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
e1d6a774 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
ef416fc2 324 fi
325 fi
326 ;;
2abf387c 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 ;;
ef416fc2 337 SunOS*)
338 # Solaris
339 if test -z "$OPTIM"; then
340 if test "x$with_optim" = x; then
ed486911 341 OPTIM="-xO2"
ef416fc2 342 else
343 OPTIM="$with_optim $OPTIM"
344 fi
345 fi
346
ef416fc2 347 if test $PICFLAG = 1; then
348 OPTIM="-KPIC $OPTIM"
349 fi
e1d6a774 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"
e1d6a774 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"
f301802f 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
e1d6a774 369 fi
370 else
371 if test "x$enable_64bit" = xyes; then
372 # Build 64-bit libraries...
373 ARCH64FLAGS="-xarch=generic64"
f301802f 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
e1d6a774 382
f301802f 383 if test -z "$with_archflags"; then
384 if test -z "$with_arch32flags"; then
385 ARCHFLAGS="-xarch=generic"
386 else
387 ARCHFLAGS="$with_arch32flags"
e1d6a774 388 fi
e1d6a774 389 fi
390 fi
ef416fc2 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
416fi
417
2abf387c 418# Add general compiler options per platform...
419case $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 ;;
435esac
ef416fc2 436
437dnl
b86bc4cf 438dnl End of "$Id: cups-compiler.m4 6145 2006-12-06 20:10:16Z mike $".
ef416fc2 439dnl