]> git.saurik.com Git - wxWidgets.git/blame - build/aclocal/bakefile-lang.m4
Fix assert when adding items with bitmaps wxBitmapComboBox.
[wxWidgets.git] / build / aclocal / bakefile-lang.m4
CommitLineData
2e91a01a 1dnl
15e5ef78 2dnl This file is part of Bakefile (http://www.bakefile.org)
2e91a01a
VZ
3dnl
4dnl Copyright (C) 2003-2007 Vaclav Slavik, David Elliott and others
5dnl
6dnl Permission is hereby granted, free of charge, to any person obtaining a
7dnl copy of this software and associated documentation files (the "Software"),
8dnl to deal in the Software without restriction, including without limitation
9dnl the rights to use, copy, modify, merge, publish, distribute, sublicense,
10dnl and/or sell copies of the Software, and to permit persons to whom the
11dnl Software is furnished to do so, subject to the following conditions:
12dnl
13dnl The above copyright notice and this permission notice shall be included in
14dnl all copies or substantial portions of the Software.
15dnl
16dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22dnl DEALINGS IN THE SOFTWARE.
23dnl
7e528ef6 24dnl $Id$
2e91a01a 25dnl
e3b13be4 26dnl Compiler detection macros by David Elliott and Vadim Zeitlin
2e91a01a 27dnl
948b08e2
VZ
28
29
30dnl ===========================================================================
e3b13be4 31dnl Macros to detect different C/C++ compilers
948b08e2
VZ
32dnl ===========================================================================
33
948b08e2
VZ
34dnl Based on autoconf _AC_LANG_COMPILER_GNU
35dnl _AC_BAKEFILE_LANG_COMPILER(NAME, LANG, SYMBOL, IF-YES, IF-NO)
36AC_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 )
948b08e2
VZ
54 if test "x$bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3" = "xyes"; then
55 :; $4
56 else
57 :; $5
58 fi
e3b13be4
VZ
59 AC_LANG_POP($2)
60])
61
05622061
VZ
62dnl More specific version of the above macro checking whether the compiler
63dnl version is at least the given one (assumes that we do use this compiler)
64dnl
65dnl _AC_BAKEFILE_LANG_COMPILER_LATER_THAN(NAME, LANG, SYMBOL, VER, VERMSG, IF-YES, IF-NO)
66AC_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
e3b13be4
VZ
92dnl CodeWarrior Metrowerks compiler defines __MWERKS__ for both C and C++
93AC_DEFUN([AC_BAKEFILE_PROG_MWCC],
94[
95 _AC_BAKEFILE_LANG_COMPILER(Metrowerks, C, __MWERKS__, MWCC=yes)
96])
97
98AC_DEFUN([AC_BAKEFILE_PROG_MWCXX],
99[
100 _AC_BAKEFILE_LANG_COMPILER(Metrowerks, C++, __MWERKS__, MWCXX=yes)
101])
102
103dnl IBM xlC compiler defines __xlC__ for both C and C++
104AC_DEFUN([AC_BAKEFILE_PROG_XLCC],
105[
106 _AC_BAKEFILE_LANG_COMPILER([IBM xlC], C, __xlC__, XLCC=yes)
107])
108
109AC_DEFUN([AC_BAKEFILE_PROG_XLCXX],
110[
111 _AC_BAKEFILE_LANG_COMPILER([IBM xlC], C++, __xlC__, XLCXX=yes)
948b08e2
VZ
112])
113
ab0ad5f1
VZ
114dnl recent versions of SGI mipsPro compiler define _SGI_COMPILER_VERSION
115dnl
116dnl NB: old versions define _COMPILER_VERSION but this could probably be
117dnl defined by other compilers too so don't test for it to be safe
948b08e2
VZ
118AC_DEFUN([AC_BAKEFILE_PROG_SGICC],
119[
120 _AC_BAKEFILE_LANG_COMPILER(SGI, C, _SGI_COMPILER_VERSION, SGICC=yes)
121])
122
123AC_DEFUN([AC_BAKEFILE_PROG_SGICXX],
124[
125 _AC_BAKEFILE_LANG_COMPILER(SGI, C++, _SGI_COMPILER_VERSION, SGICXX=yes)
126])
127
ab0ad5f1 128dnl Sun compiler defines __SUNPRO_C/__SUNPRO_CC
948b08e2
VZ
129AC_DEFUN([AC_BAKEFILE_PROG_SUNCC],
130[
131 _AC_BAKEFILE_LANG_COMPILER(Sun, C, __SUNPRO_C, SUNCC=yes)
132])
133
948b08e2
VZ
134AC_DEFUN([AC_BAKEFILE_PROG_SUNCXX],
135[
136 _AC_BAKEFILE_LANG_COMPILER(Sun, C++, __SUNPRO_CC, SUNCXX=yes)
137])
138
ab0ad5f1
VZ
139dnl Intel icc compiler defines __INTEL_COMPILER for both C and C++
140AC_DEFUN([AC_BAKEFILE_PROG_INTELCC],
141[
142 _AC_BAKEFILE_LANG_COMPILER(Intel, C, __INTEL_COMPILER, INTELCC=yes)
143])
144
145AC_DEFUN([AC_BAKEFILE_PROG_INTELCXX],
146[
147 _AC_BAKEFILE_LANG_COMPILER(Intel, C++, __INTEL_COMPILER, INTELCXX=yes)
148])
948b08e2 149
05622061
VZ
150dnl Intel compiler command line options changed in incompatible ways sometimes
151dnl before v8 (-KPIC was replaced with gcc-compatible -fPIC) and again in v10
152dnl (-create-pch deprecated in favour of -pch-create) so we need to test for
153dnl its exact version too
154AC_DEFUN([AC_BAKEFILE_PROG_INTELCC_8],
155[
156 _AC_BAKEFILE_LANG_COMPILER_LATER_THAN(Intel, C, __INTEL_COMPILER, 800, 8, INTELCC8=yes)
157])
158AC_DEFUN([AC_BAKEFILE_PROG_INTELCXX_8],
159[
160 _AC_BAKEFILE_LANG_COMPILER_LATER_THAN(Intel, C++, __INTEL_COMPILER, 800, 8, INTELCXX8=yes)
161])
162
163AC_DEFUN([AC_BAKEFILE_PROG_INTELCC_10],
164[
165 _AC_BAKEFILE_LANG_COMPILER_LATER_THAN(Intel, C, __INTEL_COMPILER, 1000, 10, INTELCC10=yes)
166])
167
168AC_DEFUN([AC_BAKEFILE_PROG_INTELCXX_10],
169[
170 _AC_BAKEFILE_LANG_COMPILER_LATER_THAN(Intel, C++, __INTEL_COMPILER, 1000, 10, INTELCXX10=yes)
171])
172
14cde513
VZ
173dnl HP-UX aCC: see http://docs.hp.com/en/6162/preprocess.htm#macropredef
174AC_DEFUN([AC_BAKEFILE_PROG_HPCC],
175[
176 _AC_BAKEFILE_LANG_COMPILER(HP, C, __HP_cc, HPCC=yes)
177])
178
179AC_DEFUN([AC_BAKEFILE_PROG_HPCXX],
180[
181 _AC_BAKEFILE_LANG_COMPILER(HP, C++, __HP_aCC, HPCXX=yes)
182])
183
a1aa0349
VZ
184dnl Tru64 cc and cxx
185AC_DEFUN([AC_BAKEFILE_PROG_COMPAQCC],
186[
187 _AC_BAKEFILE_LANG_COMPILER(Compaq, C, __DECC, COMPAQCC=yes)
188])
189
190AC_DEFUN([AC_BAKEFILE_PROG_COMPAQCXX],
191[
192 _AC_BAKEFILE_LANG_COMPILER(Compaq, C++, __DECCXX, COMPAQCXX=yes)
193])
194
948b08e2
VZ
195dnl ===========================================================================
196dnl macros to detect specialty compiler options
197dnl ===========================================================================
198
199dnl Figure out if we need to pass -ext o to compiler (MetroWerks)
200AC_DEFUN([AC_BAKEFILE_METROWERKS_EXTO],
a1aa0349 201[AC_CACHE_CHECK([if the _AC_LANG compiler requires -ext o], bakefile_cv_[]_AC_LANG_ABBREV[]_exto,
948b08e2
VZ
202dnl First create an empty conf test
203[AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
204dnl Now remove .o and .c.o or .cc.o
205rm -f conftest.$ac_objext conftest.$ac_ext.o
206dnl Now compile the test
207AS_IF([AC_TRY_EVAL(ac_compile)],
208dnl 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)
a1aa0349 212 bakefile_cv_[]_AC_LANG_ABBREV[]_exto="-ext o"
948b08e2
VZ
213 ;;
214 *)
215 ;;
216 esac
217done],
218[AC_MSG_FAILURE([cannot figure out if compiler needs -ext o: cannot compile])
219]) dnl AS_IF
220
221rm -f conftest.$ac_ext.o conftest.$ac_objext conftest.$ac_ext
222]) dnl AC_CACHE_CHECK
223
a1aa0349 224if test "x$bakefile_cv_[]_AC_LANG_ABBREV[]_exto" '!=' "x"; then
948b08e2 225 if test "[]_AC_LANG_ABBREV[]" = "c"; then
a1aa0349 226 CFLAGS="$bakefile_cv_[]_AC_LANG_ABBREV[]_exto $CFLAGS"
948b08e2
VZ
227 fi
228 if test "[]_AC_LANG_ABBREV[]" = "cxx"; then
a1aa0349 229 CXXFLAGS="$bakefile_cv_[]_AC_LANG_ABBREV[]_exto $CXXFLAGS"
948b08e2
VZ
230 fi
231fi
232]) dnl AC_DEFUN
233
234
235dnl ===========================================================================
236dnl Macros to do all of the compiler detections as one macro
237dnl ===========================================================================
3006edc0
VZ
238
239dnl check for different proprietary compilers depending on target platform
240dnl _AC_BAKEFILE_PROG_COMPILER(LANG)
241AC_DEFUN([_AC_BAKEFILE_PROG_COMPILER],
948b08e2 242[
4164cd68 243 AC_REQUIRE([AC_PROG_$1])
15e5ef78
VZ
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
3006edc0 248 AC_BAKEFILE_PROG_INTEL$1
15e5ef78 249
05622061
VZ
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
ab0ad5f1 256 dnl if we're using gcc, we can't be using any of incompatible compilers
3006edc0
VZ
257 if test "x$G$1" != "xyes"; then
258 if test "x$1" = "xC"; then
259 AC_BAKEFILE_METROWERKS_EXTO
a1aa0349 260 if test "x$bakefile_cv_c_exto" '!=' "x"; then
3006edc0
VZ
261 unset ac_cv_prog_cc_g
262 _AC_PROG_CC_G
263 fi
ab0ad5f1 264 fi
3006edc0
VZ
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
05622061
VZ
275 if test "$MW$1" != "yes"; then
276 AC_BAKEFILE_PROG_XL$1
277 fi
3006edc0
VZ
278 ;;
279
280 IRIX*)
281 AC_BAKEFILE_PROG_SGI$1
282 ;;
283
15e5ef78 284 Linux*)
05622061
VZ
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
15e5ef78
VZ
290 ;;
291
3006edc0
VZ
292 HP-UX*)
293 AC_BAKEFILE_PROG_HP$1
294 ;;
a1aa0349
VZ
295
296 OSF1)
297 AC_BAKEFILE_PROG_COMPAQ$1
298 ;;
299
300 SunOS)
301 AC_BAKEFILE_PROG_SUN$1
302 ;;
3006edc0 303 esac
948b08e2 304 fi
948b08e2
VZ
305])
306
3006edc0
VZ
307AC_DEFUN([AC_BAKEFILE_PROG_CC],
308[
309 _AC_BAKEFILE_PROG_COMPILER(CC)
310])
311
948b08e2
VZ
312AC_DEFUN([AC_BAKEFILE_PROG_CXX],
313[
3006edc0 314 _AC_BAKEFILE_PROG_COMPILER(CXX)
948b08e2
VZ
315])
316