]> git.saurik.com Git - wxWidgets.git/blob - build/aclocal/bakefile-lang.m4
don't restore the focus manually after closing the dialog, default Windows behaviour...
[wxWidgets.git] / build / aclocal / bakefile-lang.m4
1 dnl
2 dnl This file is part of Bakefile (http://www.bakefile.org)
3 dnl
4 dnl Copyright (C) 2003-2007 Vaclav Slavik, David Elliott and others
5 dnl
6 dnl Permission is hereby granted, free of charge, to any person obtaining a
7 dnl copy of this software and associated documentation files (the "Software"),
8 dnl to deal in the Software without restriction, including without limitation
9 dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 dnl and/or sell copies of the Software, and to permit persons to whom the
11 dnl Software is furnished to do so, subject to the following conditions:
12 dnl
13 dnl The above copyright notice and this permission notice shall be included in
14 dnl all copies or substantial portions of the Software.
15 dnl
16 dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 dnl DEALINGS IN THE SOFTWARE.
23 dnl
24 dnl $Id$
25 dnl
26 dnl Compiler detection macros by David Elliott and Vadim Zeitlin
27 dnl
28
29
30 dnl ===========================================================================
31 dnl Macros to detect different C/C++ compilers
32 dnl ===========================================================================
33
34 dnl Based on autoconf _AC_LANG_COMPILER_GNU
35 dnl _AC_BAKEFILE_LANG_COMPILER(NAME, LANG, SYMBOL, IF-YES, IF-NO)
36 AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER],
37 [
38 AC_LANG_PUSH($2)
39 AC_CACHE_CHECK(
40 [whether we are using the $1 $2 compiler],
41 [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3],
42 [AC_TRY_COMPILE(
43 [],
44 [
45 #ifndef $3
46 choke me
47 #endif
48 ],
49 [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3=yes],
50 [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3=no]
51 )
52 ]
53 )
54 if test "x$bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3" = "xyes"; then
55 :; $4
56 else
57 :; $5
58 fi
59 AC_LANG_POP($2)
60 ])
61
62 dnl More specific version of the above macro checking whether the compiler
63 dnl version is at least the given one (assumes that we do use this compiler)
64 dnl
65 dnl _AC_BAKEFILE_LANG_COMPILER_LATER_THAN(NAME, LANG, SYMBOL, VER, VERMSG, IF-YES, IF-NO)
66 AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_LATER_THAN],
67 [
68 AC_LANG_PUSH($2)
69 AC_CACHE_CHECK(
70 [whether we are using $1 $2 compiler v$5 or later],
71 [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3[]_lt_[]$4],
72 [AC_TRY_COMPILE(
73 [],
74 [
75 #ifndef $3 || $3 < $4
76 choke me
77 #endif
78 ],
79 [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3[]_lt_[]$4=yes],
80 [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3[]_lt_[]$4=no]
81 )
82 ]
83 )
84 if test "x$bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3[]_lt_[]$4" = "xyes"; then
85 :; $6
86 else
87 :; $7
88 fi
89 AC_LANG_POP($2)
90 ])
91
92 dnl CodeWarrior Metrowerks compiler defines __MWERKS__ for both C and C++
93 AC_DEFUN([AC_BAKEFILE_PROG_MWCC],
94 [
95 _AC_BAKEFILE_LANG_COMPILER(Metrowerks, C, __MWERKS__, MWCC=yes)
96 ])
97
98 AC_DEFUN([AC_BAKEFILE_PROG_MWCXX],
99 [
100 _AC_BAKEFILE_LANG_COMPILER(Metrowerks, C++, __MWERKS__, MWCXX=yes)
101 ])
102
103 dnl IBM xlC compiler defines __xlC__ for both C and C++
104 AC_DEFUN([AC_BAKEFILE_PROG_XLCC],
105 [
106 _AC_BAKEFILE_LANG_COMPILER([IBM xlC], C, __xlC__, XLCC=yes)
107 ])
108
109 AC_DEFUN([AC_BAKEFILE_PROG_XLCXX],
110 [
111 _AC_BAKEFILE_LANG_COMPILER([IBM xlC], C++, __xlC__, XLCXX=yes)
112 ])
113
114 dnl recent versions of SGI mipsPro compiler define _SGI_COMPILER_VERSION
115 dnl
116 dnl NB: old versions define _COMPILER_VERSION but this could probably be
117 dnl defined by other compilers too so don't test for it to be safe
118 AC_DEFUN([AC_BAKEFILE_PROG_SGICC],
119 [
120 _AC_BAKEFILE_LANG_COMPILER(SGI, C, _SGI_COMPILER_VERSION, SGICC=yes)
121 ])
122
123 AC_DEFUN([AC_BAKEFILE_PROG_SGICXX],
124 [
125 _AC_BAKEFILE_LANG_COMPILER(SGI, C++, _SGI_COMPILER_VERSION, SGICXX=yes)
126 ])
127
128 dnl Sun compiler defines __SUNPRO_C/__SUNPRO_CC
129 AC_DEFUN([AC_BAKEFILE_PROG_SUNCC],
130 [
131 _AC_BAKEFILE_LANG_COMPILER(Sun, C, __SUNPRO_C, SUNCC=yes)
132 ])
133
134 AC_DEFUN([AC_BAKEFILE_PROG_SUNCXX],
135 [
136 _AC_BAKEFILE_LANG_COMPILER(Sun, C++, __SUNPRO_CC, SUNCXX=yes)
137 ])
138
139 dnl Intel icc compiler defines __INTEL_COMPILER for both C and C++
140 AC_DEFUN([AC_BAKEFILE_PROG_INTELCC],
141 [
142 _AC_BAKEFILE_LANG_COMPILER(Intel, C, __INTEL_COMPILER, INTELCC=yes)
143 ])
144
145 AC_DEFUN([AC_BAKEFILE_PROG_INTELCXX],
146 [
147 _AC_BAKEFILE_LANG_COMPILER(Intel, C++, __INTEL_COMPILER, INTELCXX=yes)
148 ])
149
150 dnl Intel compiler command line options changed in incompatible ways sometimes
151 dnl before v8 (-KPIC was replaced with gcc-compatible -fPIC) and again in v10
152 dnl (-create-pch deprecated in favour of -pch-create) so we need to test for
153 dnl its exact version too
154 AC_DEFUN([AC_BAKEFILE_PROG_INTELCC_8],
155 [
156 _AC_BAKEFILE_LANG_COMPILER_LATER_THAN(Intel, C, __INTEL_COMPILER, 800, 8, INTELCC8=yes)
157 ])
158 AC_DEFUN([AC_BAKEFILE_PROG_INTELCXX_8],
159 [
160 _AC_BAKEFILE_LANG_COMPILER_LATER_THAN(Intel, C++, __INTEL_COMPILER, 800, 8, INTELCXX8=yes)
161 ])
162
163 AC_DEFUN([AC_BAKEFILE_PROG_INTELCC_10],
164 [
165 _AC_BAKEFILE_LANG_COMPILER_LATER_THAN(Intel, C, __INTEL_COMPILER, 1000, 10, INTELCC10=yes)
166 ])
167
168 AC_DEFUN([AC_BAKEFILE_PROG_INTELCXX_10],
169 [
170 _AC_BAKEFILE_LANG_COMPILER_LATER_THAN(Intel, C++, __INTEL_COMPILER, 1000, 10, INTELCXX10=yes)
171 ])
172
173 dnl HP-UX aCC: see http://docs.hp.com/en/6162/preprocess.htm#macropredef
174 AC_DEFUN([AC_BAKEFILE_PROG_HPCC],
175 [
176 _AC_BAKEFILE_LANG_COMPILER(HP, C, __HP_cc, HPCC=yes)
177 ])
178
179 AC_DEFUN([AC_BAKEFILE_PROG_HPCXX],
180 [
181 _AC_BAKEFILE_LANG_COMPILER(HP, C++, __HP_aCC, HPCXX=yes)
182 ])
183
184 dnl Tru64 cc and cxx
185 AC_DEFUN([AC_BAKEFILE_PROG_COMPAQCC],
186 [
187 _AC_BAKEFILE_LANG_COMPILER(Compaq, C, __DECC, COMPAQCC=yes)
188 ])
189
190 AC_DEFUN([AC_BAKEFILE_PROG_COMPAQCXX],
191 [
192 _AC_BAKEFILE_LANG_COMPILER(Compaq, C++, __DECCXX, COMPAQCXX=yes)
193 ])
194
195 dnl ===========================================================================
196 dnl macros to detect specialty compiler options
197 dnl ===========================================================================
198
199 dnl Figure out if we need to pass -ext o to compiler (MetroWerks)
200 AC_DEFUN([AC_BAKEFILE_METROWERKS_EXTO],
201 [AC_CACHE_CHECK([if the _AC_LANG compiler requires -ext o], bakefile_cv_[]_AC_LANG_ABBREV[]_exto,
202 dnl First create an empty conf test
203 [AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
204 dnl Now remove .o and .c.o or .cc.o
205 rm -f conftest.$ac_objext conftest.$ac_ext.o
206 dnl Now compile the test
207 AS_IF([AC_TRY_EVAL(ac_compile)],
208 dnl If the test succeeded look for conftest.c.o or conftest.cc.o
209 [for ac_file in `(ls conftest.* 2>/dev/null)`; do
210 case $ac_file in
211 conftest.$ac_ext.o)
212 bakefile_cv_[]_AC_LANG_ABBREV[]_exto="-ext o"
213 ;;
214 *)
215 ;;
216 esac
217 done],
218 [AC_MSG_FAILURE([cannot figure out if compiler needs -ext o: cannot compile])
219 ]) dnl AS_IF
220
221 rm -f conftest.$ac_ext.o conftest.$ac_objext conftest.$ac_ext
222 ]) dnl AC_CACHE_CHECK
223
224 if test "x$bakefile_cv_[]_AC_LANG_ABBREV[]_exto" '!=' "x"; then
225 if test "[]_AC_LANG_ABBREV[]" = "c"; then
226 CFLAGS="$bakefile_cv_[]_AC_LANG_ABBREV[]_exto $CFLAGS"
227 fi
228 if test "[]_AC_LANG_ABBREV[]" = "cxx"; then
229 CXXFLAGS="$bakefile_cv_[]_AC_LANG_ABBREV[]_exto $CXXFLAGS"
230 fi
231 fi
232 ]) dnl AC_DEFUN
233
234
235 dnl ===========================================================================
236 dnl Macros to do all of the compiler detections as one macro
237 dnl ===========================================================================
238
239 dnl check for different proprietary compilers depending on target platform
240 dnl _AC_BAKEFILE_PROG_COMPILER(LANG)
241 AC_DEFUN([_AC_BAKEFILE_PROG_COMPILER],
242 [
243 AC_PROG_$1
244
245 dnl Intel compiler can be used under several different OS and even
246 dnl different architectures (x86, amd64 and Itanium) so it's easier to just
247 dnl always test for it
248 AC_BAKEFILE_PROG_INTEL$1
249
250 dnl If we use Intel compiler we also need to know its version
251 if test "$INTEL$1" = "yes"; then
252 AC_BAKEFILE_PROG_INTEL$1_8
253 AC_BAKEFILE_PROG_INTEL$1_10
254 fi
255
256 dnl if we're using gcc, we can't be using any of incompatible compilers
257 if test "x$G$1" != "xyes"; then
258 if test "x$1" = "xC"; then
259 AC_BAKEFILE_METROWERKS_EXTO
260 if test "x$bakefile_cv_c_exto" '!=' "x"; then
261 unset ac_cv_prog_cc_g
262 _AC_PROG_CC_G
263 fi
264 fi
265
266 dnl most of these compilers are only used under well-defined OS so
267 dnl don't waste time checking for them on other ones
268 case `uname -s` in
269 AIX*)
270 AC_BAKEFILE_PROG_XL$1
271 ;;
272
273 Darwin)
274 AC_BAKEFILE_PROG_MW$1
275 if test "$MW$1" != "yes"; then
276 AC_BAKEFILE_PROG_XL$1
277 fi
278 ;;
279
280 IRIX*)
281 AC_BAKEFILE_PROG_SGI$1
282 ;;
283
284 Linux*)
285 dnl Sun CC is now available under Linux too, test for it unless
286 dnl we already found that we were using a different compiler
287 if test "$INTEL$1" != "yes"; then
288 AC_BAKEFILE_PROG_SUN$1
289 fi
290 ;;
291
292 HP-UX*)
293 AC_BAKEFILE_PROG_HP$1
294 ;;
295
296 OSF1)
297 AC_BAKEFILE_PROG_COMPAQ$1
298 ;;
299
300 SunOS)
301 AC_BAKEFILE_PROG_SUN$1
302 ;;
303 esac
304 fi
305 ])
306
307 AC_DEFUN([AC_BAKEFILE_PROG_CC],
308 [
309 _AC_BAKEFILE_PROG_COMPILER(CC)
310 ])
311
312 AC_DEFUN([AC_BAKEFILE_PROG_CXX],
313 [
314 _AC_BAKEFILE_PROG_COMPILER(CXX)
315 ])
316