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