]> git.saurik.com Git - wxWidgets.git/blame - build/aclocal/bakefile-lang.m4
Changed the wxPlatform syntax as per Vadim's suggestions
[wxWidgets.git] / build / aclocal / bakefile-lang.m4
CommitLineData
948b08e2
VZ
1dnl ---------------------------------------------------------------------------
2dnl Compiler detection macros by David Elliott
3dnl ---------------------------------------------------------------------------
4
5
6dnl ===========================================================================
7dnl Macros to detect non-GNU compilers (MetroWerks, XLC)
8dnl ===========================================================================
9
10dnl Based on autoconf _AC_LANG_COMPILER_GNU
11AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_MWERKS],
12[AC_CACHE_CHECK([whether we are using the Metrowerks _AC_LANG compiler],
13 [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks],
14 [AC_TRY_COMPILE([],[#ifndef __MWERKS__
15 choke me
16#endif
17],
18 [bakefile_compiler_mwerks=yes],
19 [bakefile_compiler_mwerks=no])
20 bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_mwerks=$bakefile_compiler_mwerks
21 ])
22])
23
24dnl Loosely based on autoconf AC_PROG_CC
25dnl TODO: Maybe this should wrap the call to AC_PROG_CC and be used instead.
26AC_DEFUN([AC_BAKEFILE_PROG_MWCC],
27[AC_LANG_PUSH(C)
28_AC_BAKEFILE_LANG_COMPILER_MWERKS
29MWCC=`test $bakefile_cv_c_compiler_mwerks = yes && echo yes`
30AC_LANG_POP(C)
31])
32
33dnl Loosely based on autoconf AC_PROG_CXX
34dnl TODO: Maybe this should wrap the call to AC_PROG_CXX and be used instead.
35AC_DEFUN([AC_BAKEFILE_PROG_MWCXX],
36[AC_LANG_PUSH(C++)
37_AC_BAKEFILE_LANG_COMPILER_MWERKS
38MWCXX=`test $bakefile_cv_cxx_compiler_mwerks = yes && echo yes`
39AC_LANG_POP(C++)
40])
41
42dnl Based on autoconf _AC_LANG_COMPILER_GNU
43AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_XLC],
44[AC_CACHE_CHECK([whether we are using the IBM xlC _AC_LANG compiler],
a1aa0349 45 [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_xlc],
948b08e2
VZ
46 [AC_TRY_COMPILE([],[#ifndef __xlC__
47 choke me
48#endif
49],
a1aa0349
VZ
50 [bakefile_compiler_xlc=yes],
51 [bakefile_compiler_xlc=no])
52 bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_xlc=$bakefile_compiler_xlc
948b08e2
VZ
53 ])
54])
55
56dnl Loosely based on autoconf AC_PROG_CC
57AC_DEFUN([AC_BAKEFILE_PROG_XLCC],
58[AC_LANG_PUSH(C)
59_AC_BAKEFILE_LANG_COMPILER_XLC
a1aa0349 60XLCC=`test $bakefile_cv_c_compiler_xlc = yes && echo yes`
948b08e2
VZ
61AC_LANG_POP(C)
62])
63
64dnl Loosely based on autoconf AC_PROG_CXX
65AC_DEFUN([AC_BAKEFILE_PROG_XLCXX],
66[AC_LANG_PUSH(C++)
67_AC_BAKEFILE_LANG_COMPILER_XLC
a1aa0349 68XLCXX=`test $bakefile_cv_cxx_compiler_xlc = yes && echo yes`
948b08e2
VZ
69AC_LANG_POP(C++)
70])
71
72dnl Based on autoconf _AC_LANG_COMPILER_GNU
73dnl _AC_BAKEFILE_LANG_COMPILER(NAME, LANG, SYMBOL, IF-YES, IF-NO)
74AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER],
75[
76 AC_LANG_PUSH($2)
77 AC_CACHE_CHECK(
78 [whether we are using the $1 $2 compiler],
79 [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3],
80 [AC_TRY_COMPILE(
81 [],
82 [
83 #ifndef $3
84 choke me
85 #endif
86 ],
87 [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3=yes],
88 [bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3=no]
89 )
90 ]
91 )
92 AC_LANG_POP($2)
93 if test "x$bakefile_cv_[]_AC_LANG_ABBREV[]_compiler_[]$3" = "xyes"; then
94 :; $4
95 else
96 :; $5
97 fi
98])
99
ab0ad5f1
VZ
100dnl recent versions of SGI mipsPro compiler define _SGI_COMPILER_VERSION
101dnl
102dnl NB: old versions define _COMPILER_VERSION but this could probably be
103dnl defined by other compilers too so don't test for it to be safe
948b08e2
VZ
104AC_DEFUN([AC_BAKEFILE_PROG_SGICC],
105[
106 _AC_BAKEFILE_LANG_COMPILER(SGI, C, _SGI_COMPILER_VERSION, SGICC=yes)
107])
108
109AC_DEFUN([AC_BAKEFILE_PROG_SGICXX],
110[
111 _AC_BAKEFILE_LANG_COMPILER(SGI, C++, _SGI_COMPILER_VERSION, SGICXX=yes)
112])
113
ab0ad5f1 114dnl Sun compiler defines __SUNPRO_C/__SUNPRO_CC
948b08e2
VZ
115AC_DEFUN([AC_BAKEFILE_PROG_SUNCC],
116[
117 _AC_BAKEFILE_LANG_COMPILER(Sun, C, __SUNPRO_C, SUNCC=yes)
118])
119
948b08e2
VZ
120AC_DEFUN([AC_BAKEFILE_PROG_SUNCXX],
121[
122 _AC_BAKEFILE_LANG_COMPILER(Sun, C++, __SUNPRO_CC, SUNCXX=yes)
123])
124
ab0ad5f1
VZ
125dnl Intel icc compiler defines __INTEL_COMPILER for both C and C++
126AC_DEFUN([AC_BAKEFILE_PROG_INTELCC],
127[
128 _AC_BAKEFILE_LANG_COMPILER(Intel, C, __INTEL_COMPILER, INTELCC=yes)
129])
130
131AC_DEFUN([AC_BAKEFILE_PROG_INTELCXX],
132[
133 _AC_BAKEFILE_LANG_COMPILER(Intel, C++, __INTEL_COMPILER, INTELCXX=yes)
134])
948b08e2 135
14cde513
VZ
136dnl HP-UX aCC: see http://docs.hp.com/en/6162/preprocess.htm#macropredef
137AC_DEFUN([AC_BAKEFILE_PROG_HPCC],
138[
139 _AC_BAKEFILE_LANG_COMPILER(HP, C, __HP_cc, HPCC=yes)
140])
141
142AC_DEFUN([AC_BAKEFILE_PROG_HPCXX],
143[
144 _AC_BAKEFILE_LANG_COMPILER(HP, C++, __HP_aCC, HPCXX=yes)
145])
146
a1aa0349
VZ
147dnl Tru64 cc and cxx
148AC_DEFUN([AC_BAKEFILE_PROG_COMPAQCC],
149[
150 _AC_BAKEFILE_LANG_COMPILER(Compaq, C, __DECC, COMPAQCC=yes)
151])
152
153AC_DEFUN([AC_BAKEFILE_PROG_COMPAQCXX],
154[
155 _AC_BAKEFILE_LANG_COMPILER(Compaq, C++, __DECCXX, COMPAQCXX=yes)
156])
157
948b08e2
VZ
158dnl ===========================================================================
159dnl macros to detect specialty compiler options
160dnl ===========================================================================
161
162dnl Figure out if we need to pass -ext o to compiler (MetroWerks)
163AC_DEFUN([AC_BAKEFILE_METROWERKS_EXTO],
a1aa0349 164[AC_CACHE_CHECK([if the _AC_LANG compiler requires -ext o], bakefile_cv_[]_AC_LANG_ABBREV[]_exto,
948b08e2
VZ
165dnl First create an empty conf test
166[AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
167dnl Now remove .o and .c.o or .cc.o
168rm -f conftest.$ac_objext conftest.$ac_ext.o
169dnl Now compile the test
170AS_IF([AC_TRY_EVAL(ac_compile)],
171dnl If the test succeeded look for conftest.c.o or conftest.cc.o
172[for ac_file in `(ls conftest.* 2>/dev/null)`; do
173 case $ac_file in
174 conftest.$ac_ext.o)
a1aa0349 175 bakefile_cv_[]_AC_LANG_ABBREV[]_exto="-ext o"
948b08e2
VZ
176 ;;
177 *)
178 ;;
179 esac
180done],
181[AC_MSG_FAILURE([cannot figure out if compiler needs -ext o: cannot compile])
182]) dnl AS_IF
183
184rm -f conftest.$ac_ext.o conftest.$ac_objext conftest.$ac_ext
185]) dnl AC_CACHE_CHECK
186
a1aa0349 187if test "x$bakefile_cv_[]_AC_LANG_ABBREV[]_exto" '!=' "x"; then
948b08e2 188 if test "[]_AC_LANG_ABBREV[]" = "c"; then
a1aa0349 189 CFLAGS="$bakefile_cv_[]_AC_LANG_ABBREV[]_exto $CFLAGS"
948b08e2
VZ
190 fi
191 if test "[]_AC_LANG_ABBREV[]" = "cxx"; then
a1aa0349 192 CXXFLAGS="$bakefile_cv_[]_AC_LANG_ABBREV[]_exto $CXXFLAGS"
948b08e2
VZ
193 fi
194fi
195]) dnl AC_DEFUN
196
197
198dnl ===========================================================================
199dnl Macros to do all of the compiler detections as one macro
200dnl ===========================================================================
3006edc0
VZ
201
202dnl check for different proprietary compilers depending on target platform
203dnl _AC_BAKEFILE_PROG_COMPILER(LANG)
204AC_DEFUN([_AC_BAKEFILE_PROG_COMPILER],
948b08e2 205[
3006edc0
VZ
206 AC_PROG_$1
207 AC_BAKEFILE_PROG_INTEL$1
ab0ad5f1 208 dnl if we're using gcc, we can't be using any of incompatible compilers
3006edc0
VZ
209 if test "x$G$1" != "xyes"; then
210 if test "x$1" = "xC"; then
211 AC_BAKEFILE_METROWERKS_EXTO
a1aa0349 212 if test "x$bakefile_cv_c_exto" '!=' "x"; then
3006edc0
VZ
213 unset ac_cv_prog_cc_g
214 _AC_PROG_CC_G
215 fi
ab0ad5f1 216 fi
3006edc0
VZ
217
218 dnl most of these compilers are only used under well-defined OS so
219 dnl don't waste time checking for them on other ones
220 case `uname -s` in
221 AIX*)
222 AC_BAKEFILE_PROG_XL$1
223 ;;
224
225 Darwin)
226 AC_BAKEFILE_PROG_MW$1
227 AC_BAKEFILE_PROG_XL$1
228 ;;
229
230 IRIX*)
231 AC_BAKEFILE_PROG_SGI$1
232 ;;
233
3006edc0
VZ
234 HP-UX*)
235 AC_BAKEFILE_PROG_HP$1
236 ;;
a1aa0349
VZ
237
238 OSF1)
239 AC_BAKEFILE_PROG_COMPAQ$1
240 ;;
241
242 SunOS)
243 AC_BAKEFILE_PROG_SUN$1
244 ;;
3006edc0 245 esac
948b08e2 246 fi
948b08e2
VZ
247])
248
3006edc0
VZ
249AC_DEFUN([AC_BAKEFILE_PROG_CC],
250[
251 _AC_BAKEFILE_PROG_COMPILER(CC)
252])
253
948b08e2
VZ
254AC_DEFUN([AC_BAKEFILE_PROG_CXX],
255[
3006edc0 256 _AC_BAKEFILE_PROG_COMPILER(CXX)
948b08e2
VZ
257])
258