]> git.saurik.com Git - wxWidgets.git/blame - build/aclocal/bakefile-lang.m4
removed isql.h and isqlext.h from files.bkl too
[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
24dnl $Id$
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
62dnl CodeWarrior Metrowerks compiler defines __MWERKS__ for both C and C++
63AC_DEFUN([AC_BAKEFILE_PROG_MWCC],
64[
65 _AC_BAKEFILE_LANG_COMPILER(Metrowerks, C, __MWERKS__, MWCC=yes)
66])
67
68AC_DEFUN([AC_BAKEFILE_PROG_MWCXX],
69[
70 _AC_BAKEFILE_LANG_COMPILER(Metrowerks, C++, __MWERKS__, MWCXX=yes)
71])
72
73dnl IBM xlC compiler defines __xlC__ for both C and C++
74AC_DEFUN([AC_BAKEFILE_PROG_XLCC],
75[
76 _AC_BAKEFILE_LANG_COMPILER([IBM xlC], C, __xlC__, XLCC=yes)
77])
78
79AC_DEFUN([AC_BAKEFILE_PROG_XLCXX],
80[
81 _AC_BAKEFILE_LANG_COMPILER([IBM xlC], C++, __xlC__, XLCXX=yes)
948b08e2
VZ
82])
83
ab0ad5f1
VZ
84dnl recent versions of SGI mipsPro compiler define _SGI_COMPILER_VERSION
85dnl
86dnl NB: old versions define _COMPILER_VERSION but this could probably be
87dnl defined by other compilers too so don't test for it to be safe
948b08e2
VZ
88AC_DEFUN([AC_BAKEFILE_PROG_SGICC],
89[
90 _AC_BAKEFILE_LANG_COMPILER(SGI, C, _SGI_COMPILER_VERSION, SGICC=yes)
91])
92
93AC_DEFUN([AC_BAKEFILE_PROG_SGICXX],
94[
95 _AC_BAKEFILE_LANG_COMPILER(SGI, C++, _SGI_COMPILER_VERSION, SGICXX=yes)
96])
97
ab0ad5f1 98dnl Sun compiler defines __SUNPRO_C/__SUNPRO_CC
948b08e2
VZ
99AC_DEFUN([AC_BAKEFILE_PROG_SUNCC],
100[
101 _AC_BAKEFILE_LANG_COMPILER(Sun, C, __SUNPRO_C, SUNCC=yes)
102])
103
948b08e2
VZ
104AC_DEFUN([AC_BAKEFILE_PROG_SUNCXX],
105[
106 _AC_BAKEFILE_LANG_COMPILER(Sun, C++, __SUNPRO_CC, SUNCXX=yes)
107])
108
ab0ad5f1
VZ
109dnl Intel icc compiler defines __INTEL_COMPILER for both C and C++
110AC_DEFUN([AC_BAKEFILE_PROG_INTELCC],
111[
112 _AC_BAKEFILE_LANG_COMPILER(Intel, C, __INTEL_COMPILER, INTELCC=yes)
113])
114
115AC_DEFUN([AC_BAKEFILE_PROG_INTELCXX],
116[
117 _AC_BAKEFILE_LANG_COMPILER(Intel, C++, __INTEL_COMPILER, INTELCXX=yes)
118])
948b08e2 119
14cde513
VZ
120dnl HP-UX aCC: see http://docs.hp.com/en/6162/preprocess.htm#macropredef
121AC_DEFUN([AC_BAKEFILE_PROG_HPCC],
122[
123 _AC_BAKEFILE_LANG_COMPILER(HP, C, __HP_cc, HPCC=yes)
124])
125
126AC_DEFUN([AC_BAKEFILE_PROG_HPCXX],
127[
128 _AC_BAKEFILE_LANG_COMPILER(HP, C++, __HP_aCC, HPCXX=yes)
129])
130
a1aa0349
VZ
131dnl Tru64 cc and cxx
132AC_DEFUN([AC_BAKEFILE_PROG_COMPAQCC],
133[
134 _AC_BAKEFILE_LANG_COMPILER(Compaq, C, __DECC, COMPAQCC=yes)
135])
136
137AC_DEFUN([AC_BAKEFILE_PROG_COMPAQCXX],
138[
139 _AC_BAKEFILE_LANG_COMPILER(Compaq, C++, __DECCXX, COMPAQCXX=yes)
140])
141
948b08e2
VZ
142dnl ===========================================================================
143dnl macros to detect specialty compiler options
144dnl ===========================================================================
145
146dnl Figure out if we need to pass -ext o to compiler (MetroWerks)
147AC_DEFUN([AC_BAKEFILE_METROWERKS_EXTO],
a1aa0349 148[AC_CACHE_CHECK([if the _AC_LANG compiler requires -ext o], bakefile_cv_[]_AC_LANG_ABBREV[]_exto,
948b08e2
VZ
149dnl First create an empty conf test
150[AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
151dnl Now remove .o and .c.o or .cc.o
152rm -f conftest.$ac_objext conftest.$ac_ext.o
153dnl Now compile the test
154AS_IF([AC_TRY_EVAL(ac_compile)],
155dnl If the test succeeded look for conftest.c.o or conftest.cc.o
156[for ac_file in `(ls conftest.* 2>/dev/null)`; do
157 case $ac_file in
158 conftest.$ac_ext.o)
a1aa0349 159 bakefile_cv_[]_AC_LANG_ABBREV[]_exto="-ext o"
948b08e2
VZ
160 ;;
161 *)
162 ;;
163 esac
164done],
165[AC_MSG_FAILURE([cannot figure out if compiler needs -ext o: cannot compile])
166]) dnl AS_IF
167
168rm -f conftest.$ac_ext.o conftest.$ac_objext conftest.$ac_ext
169]) dnl AC_CACHE_CHECK
170
a1aa0349 171if test "x$bakefile_cv_[]_AC_LANG_ABBREV[]_exto" '!=' "x"; then
948b08e2 172 if test "[]_AC_LANG_ABBREV[]" = "c"; then
a1aa0349 173 CFLAGS="$bakefile_cv_[]_AC_LANG_ABBREV[]_exto $CFLAGS"
948b08e2
VZ
174 fi
175 if test "[]_AC_LANG_ABBREV[]" = "cxx"; then
a1aa0349 176 CXXFLAGS="$bakefile_cv_[]_AC_LANG_ABBREV[]_exto $CXXFLAGS"
948b08e2
VZ
177 fi
178fi
179]) dnl AC_DEFUN
180
181
182dnl ===========================================================================
183dnl Macros to do all of the compiler detections as one macro
184dnl ===========================================================================
3006edc0
VZ
185
186dnl check for different proprietary compilers depending on target platform
187dnl _AC_BAKEFILE_PROG_COMPILER(LANG)
188AC_DEFUN([_AC_BAKEFILE_PROG_COMPILER],
948b08e2 189[
3006edc0 190 AC_PROG_$1
15e5ef78
VZ
191
192 dnl Intel compiler can be used under several different OS and even
193 dnl different architectures (x86, amd64 and Itanium) so it's easier to just
194 dnl always test for it
3006edc0 195 AC_BAKEFILE_PROG_INTEL$1
15e5ef78 196
ab0ad5f1 197 dnl if we're using gcc, we can't be using any of incompatible compilers
3006edc0
VZ
198 if test "x$G$1" != "xyes"; then
199 if test "x$1" = "xC"; then
200 AC_BAKEFILE_METROWERKS_EXTO
a1aa0349 201 if test "x$bakefile_cv_c_exto" '!=' "x"; then
3006edc0
VZ
202 unset ac_cv_prog_cc_g
203 _AC_PROG_CC_G
204 fi
ab0ad5f1 205 fi
3006edc0
VZ
206
207 dnl most of these compilers are only used under well-defined OS so
208 dnl don't waste time checking for them on other ones
209 case `uname -s` in
210 AIX*)
211 AC_BAKEFILE_PROG_XL$1
212 ;;
213
214 Darwin)
215 AC_BAKEFILE_PROG_MW$1
216 AC_BAKEFILE_PROG_XL$1
217 ;;
218
219 IRIX*)
220 AC_BAKEFILE_PROG_SGI$1
221 ;;
222
15e5ef78
VZ
223 Linux*)
224 dnl Sun CC is now available under Linux too
225 AC_BAKEFILE_PROG_SUN$1
226 ;;
227
3006edc0
VZ
228 HP-UX*)
229 AC_BAKEFILE_PROG_HP$1
230 ;;
a1aa0349
VZ
231
232 OSF1)
233 AC_BAKEFILE_PROG_COMPAQ$1
234 ;;
235
236 SunOS)
237 AC_BAKEFILE_PROG_SUN$1
238 ;;
3006edc0 239 esac
948b08e2 240 fi
948b08e2
VZ
241])
242
3006edc0
VZ
243AC_DEFUN([AC_BAKEFILE_PROG_CC],
244[
245 _AC_BAKEFILE_PROG_COMPILER(CC)
246])
247
948b08e2
VZ
248AC_DEFUN([AC_BAKEFILE_PROG_CXX],
249[
3006edc0 250 _AC_BAKEFILE_PROG_COMPILER(CXX)
948b08e2
VZ
251])
252