]> 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 4953 2006-01-19 20:30:48Z 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
32 AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no],
33 [if test x$enable_debug = xyes; then
34 OPTIM="-g"
35 fi])
36
37 AC_ARG_ENABLE(pie, [ --enable-pie use GCC -fpie option, default=no])
38
39 dnl Update compiler options...
40 CXXLIBS=""
41 AC_SUBST(CXXLIBS)
42
43 if test -n "$GCC"; then
44 if test -z "$OPTIM"; then
45 if test "x$with_optim" = x; then
46 # Default to optimize-for-size and debug
47 OPTIM="-Os -g"
48 else
49 OPTIM="$with_optim $OPTIM"
50 fi
51 fi
52
53 if test $PICFLAG = 1 -a $uname != AIX; then
54 OPTIM="-fPIC $OPTIM"
55 fi
56
57 case $uname in
58 Darwin*)
59 if test "x$with_optim" = x; then
60 if test "x`uname -m`" = xi386; then
61 # Build universal binaries for OSX on Intel...
62 OPTIM="-arch i386 -arch ppc $OPTIM"
63 DSOFLAGS="-arch i386 -arch ppc $DSOFLAGS"
64 fi
65 fi
66 ;;
67
68 Linux*)
69 if test x$enable_pie = xyes; then
70 OPTIM="$OPTIM -fpie"
71 LDFLAGS="$LDFLAGS -pie"
72 fi
73 ;;
74 esac
75
76 if test "x$with_optim" = x; then
77 # Add useful warning options for tracking down problems...
78 OPTIM="-Wall -Wno-format-y2k $OPTIM"
79 # Additional warning options for alpha testing...
80 OPTIM="-Wshadow -Wunused $OPTIM"
81 fi
82 else
83 case $uname in
84 AIX*)
85 if test -z "$OPTIM"; then
86 if test "x$with_optim" = x; then
87 OPTIM="-O2 -qmaxmem=6000"
88 else
89 OPTIM="$with_optim $OPTIM"
90 fi
91 fi
92 ;;
93 HP-UX*)
94 if test -z "$OPTIM"; then
95 if test "x$with_optim" = x; then
96 OPTIM="+O2"
97 else
98 OPTIM="$with_optim $OPTIM"
99 fi
100 fi
101
102 CFLAGS="-Ae $CFLAGS"
103
104 if test "x$with_optim" = x; then
105 OPTIM="+DAportable $OPTIM"
106 fi
107
108 if test $PICFLAG = 1; then
109 OPTIM="+z $OPTIM"
110 fi
111 ;;
112 IRIX)
113 if test -z "$OPTIM"; then
114 if test "x$with_optim" = x; then
115 OPTIM="-O2"
116 else
117 OPTIM="$with_optim $OPTIM"
118 fi
119 fi
120
121 if test $uversion -ge 62 -a "x$with_optim" = x; then
122 OPTIM="$OPTIM -n32 -mips3"
123 fi
124
125 if test "x$with_optim" = x; then
126 # Show most warnings, but suppress the
127 # ones about arguments not being used,
128 # string constants assigned to const
129 # char *'s, etc. We only set the warning
130 # options on IRIX 6.2 and higher because
131 # of limitations in the older SGI compiler
132 # tools.
133 if test $uversion -ge 62; then
134 OPTIM="-fullwarn -woff 1183,1209,1349,3201 $OPTIM"
135 fi
136 fi
137 ;;
138 SunOS*)
139 # Solaris
140 if test -z "$OPTIM"; then
141 if test "x$with_optim" = x; then
142 OPTIM="-xO4"
143 else
144 OPTIM="$with_optim $OPTIM"
145 fi
146 fi
147
148 if test "x$with_optim" = x; then
149 # Specify "generic" SPARC output and suppress
150 # all of Sun's questionable warning messages...
151 OPTIM="-w $OPTIM -xarch=generic"
152 fi
153
154 if test $PICFLAG = 1; then
155 OPTIM="-KPIC $OPTIM"
156 fi
157 ;;
158 UNIX_SVR*)
159 # UnixWare
160 if test -z "$OPTIM"; then
161 if test "x$with_optim" = x; then
162 OPTIM="-O"
163 else
164 OPTIM="$with_optim $OPTIM"
165 fi
166 fi
167
168 if test $PICFLAG = 1; then
169 OPTIM="-KPIC $OPTIM"
170 fi
171 ;;
172 *)
173 # Running some other operating system; inform the user they
174 # should contribute the necessary options to
175 # cups-support@cups.org...
176 echo "Building CUPS with default compiler optimizations; contact"
177 echo "cups-bugs@cups.org with uname and compiler options needed"
178 echo "for your platform, or set the CFLAGS and CXXFLAGS"
179 echo "environment variable before running configure."
180 ;;
181 esac
182 fi
183
184 if test $uname = HP-UX; then
185 # HP-UX 10.20 (at least) needs this definition to get the
186 # h_errno global...
187 OPTIM="$OPTIM -D_XOPEN_SOURCE_EXTENDED"
188
189 # HP-UX 11.00 (at least) needs this definition to get the
190 # u_short type used by the IP headers...
191 OPTIM="$OPTIM -D_INCLUDE_HPUX_SOURCE"
192 fi
193
194 dnl
195 dnl End of "$Id: cups-compiler.m4 4953 2006-01-19 20:30:48Z mike $".
196 dnl