]> git.ipfire.org Git - thirdparty/cups.git/blame - config-scripts/cups-compiler.m4
To prepare to load cups into easysw/current, perform 4 renames.
[thirdparty/cups.git] / config-scripts / cups-compiler.m4
CommitLineData
ef416fc2 1dnl
2dnl "$Id: cups-compiler.m4 4915 2006-01-11 15:57:53Z mike $"
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
30AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging, default=no],
31 [if test x$enable_debug = xyes; then
32 OPTIM="-g"
33 fi])
34
35AC_ARG_WITH(optim, [ --with-optim="flags" set optimization flags ])
36
37dnl Update compiler options...
38CXXLIBS=""
39AC_SUBST(CXXLIBS)
40
41if 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
86else
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
186fi
187
188if 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"
196fi
197
198dnl
199dnl End of "$Id: cups-compiler.m4 4915 2006-01-11 15:57:53Z mike $".
200dnl