]> git.saurik.com Git - wxWidgets.git/blob - build/aclocal/bakefile-lang.m4
added all .m4 files used by our configure; run aclocal with -I build/aclocal argument now
[wxWidgets.git] / build / aclocal / bakefile-lang.m4
1 dnl ---------------------------------------------------------------------------
2 dnl Compiler detection macros by David Elliott
3 dnl ---------------------------------------------------------------------------
4
5
6 dnl ===========================================================================
7 dnl Macros to detect non-GNU compilers (MetroWerks, XLC)
8 dnl ===========================================================================
9
10 dnl Based on autoconf _AC_LANG_COMPILER_GNU
11 AC_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
24 dnl Loosely based on autoconf AC_PROG_CC
25 dnl TODO: Maybe this should wrap the call to AC_PROG_CC and be used instead.
26 AC_DEFUN([AC_BAKEFILE_PROG_MWCC],
27 [AC_LANG_PUSH(C)
28 _AC_BAKEFILE_LANG_COMPILER_MWERKS
29 MWCC=`test $bakefile_cv_c_compiler_mwerks = yes && echo yes`
30 AC_LANG_POP(C)
31 ])
32
33 dnl Loosely based on autoconf AC_PROG_CXX
34 dnl TODO: Maybe this should wrap the call to AC_PROG_CXX and be used instead.
35 AC_DEFUN([AC_BAKEFILE_PROG_MWCXX],
36 [AC_LANG_PUSH(C++)
37 _AC_BAKEFILE_LANG_COMPILER_MWERKS
38 MWCXX=`test $bakefile_cv_cxx_compiler_mwerks = yes && echo yes`
39 AC_LANG_POP(C++)
40 ])
41
42 dnl Based on autoconf _AC_LANG_COMPILER_GNU
43 AC_DEFUN([_AC_BAKEFILE_LANG_COMPILER_XLC],
44 [AC_CACHE_CHECK([whether we are using the IBM xlC _AC_LANG compiler],
45 [wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc],
46 [AC_TRY_COMPILE([],[#ifndef __xlC__
47 choke me
48 #endif
49 ],
50 [wx_compiler_xlc=yes],
51 [wx_compiler_xlc=no])
52 wx_cv_[]_AC_LANG_ABBREV[]_compiler_xlc=$wx_compiler_xlc
53 ])
54 ])
55
56 dnl Loosely based on autoconf AC_PROG_CC
57 AC_DEFUN([AC_BAKEFILE_PROG_XLCC],
58 [AC_LANG_PUSH(C)
59 _AC_BAKEFILE_LANG_COMPILER_XLC
60 XLCC=`test $wx_cv_c_compiler_xlc = yes && echo yes`
61 AC_LANG_POP(C)
62 ])
63
64 dnl Loosely based on autoconf AC_PROG_CXX
65 AC_DEFUN([AC_BAKEFILE_PROG_XLCXX],
66 [AC_LANG_PUSH(C++)
67 _AC_BAKEFILE_LANG_COMPILER_XLC
68 XLCXX=`test $wx_cv_cxx_compiler_xlc = yes && echo yes`
69 AC_LANG_POP(C++)
70 ])
71
72 dnl Based on autoconf _AC_LANG_COMPILER_GNU
73 dnl _AC_BAKEFILE_LANG_COMPILER(NAME, LANG, SYMBOL, IF-YES, IF-NO)
74 AC_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
100 AC_DEFUN([AC_BAKEFILE_PROG_SGICC],
101 [
102 _AC_BAKEFILE_LANG_COMPILER(SGI, C, _SGI_COMPILER_VERSION, SGICC=yes)
103 ])
104
105 AC_DEFUN([AC_BAKEFILE_PROG_SGICXX],
106 [
107 _AC_BAKEFILE_LANG_COMPILER(SGI, C++, _SGI_COMPILER_VERSION, SGICXX=yes)
108 ])
109
110 dnl Loosely based on autoconf AC_PROG_CC
111 AC_DEFUN([AC_BAKEFILE_PROG_SUNCC],
112 [
113 _AC_BAKEFILE_LANG_COMPILER(Sun, C, __SUNPRO_C, SUNCC=yes)
114 ])
115
116 dnl Loosely based on autoconf AC_PROG_CC
117 AC_DEFUN([AC_BAKEFILE_PROG_SUNCXX],
118 [
119 _AC_BAKEFILE_LANG_COMPILER(Sun, C++, __SUNPRO_CC, SUNCXX=yes)
120 ])
121
122
123 dnl ===========================================================================
124 dnl macros to detect specialty compiler options
125 dnl ===========================================================================
126
127 dnl Figure out if we need to pass -ext o to compiler (MetroWerks)
128 AC_DEFUN([AC_BAKEFILE_METROWERKS_EXTO],
129 [AC_CACHE_CHECK([if the _AC_LANG compiler requires -ext o], wx_cv_[]_AC_LANG_ABBREV[]_exto,
130 dnl First create an empty conf test
131 [AC_LANG_CONFTEST([AC_LANG_PROGRAM()])
132 dnl Now remove .o and .c.o or .cc.o
133 rm -f conftest.$ac_objext conftest.$ac_ext.o
134 dnl Now compile the test
135 AS_IF([AC_TRY_EVAL(ac_compile)],
136 dnl If the test succeeded look for conftest.c.o or conftest.cc.o
137 [for ac_file in `(ls conftest.* 2>/dev/null)`; do
138 case $ac_file in
139 conftest.$ac_ext.o)
140 wx_cv_[]_AC_LANG_ABBREV[]_exto="-ext o"
141 ;;
142 *)
143 ;;
144 esac
145 done],
146 [AC_MSG_FAILURE([cannot figure out if compiler needs -ext o: cannot compile])
147 ]) dnl AS_IF
148
149 rm -f conftest.$ac_ext.o conftest.$ac_objext conftest.$ac_ext
150 ]) dnl AC_CACHE_CHECK
151
152 if test "x$wx_cv_[]_AC_LANG_ABBREV[]_exto" '!=' "x"; then
153 if test "[]_AC_LANG_ABBREV[]" = "c"; then
154 CFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CFLAGS"
155 fi
156 if test "[]_AC_LANG_ABBREV[]" = "cxx"; then
157 CXXFLAGS="$wx_cv_[]_AC_LANG_ABBREV[]_exto $CXXFLAGS"
158 fi
159 fi
160 ]) dnl AC_DEFUN
161
162
163 dnl ===========================================================================
164 dnl Macros to do all of the compiler detections as one macro
165 dnl ===========================================================================
166 AC_DEFUN([AC_BAKEFILE_PROG_CC],
167 [
168 AC_PROG_CC
169 AC_BAKEFILE_METROWERKS_EXTO
170 dnl By the time we find out that we need -ext o some tests have failed.
171 if test "x$wx_cv_c_exto" '!=' "x"; then
172 unset ac_cv_prog_cc_g
173 _AC_PROG_CC_G
174 fi
175 AC_BAKEFILE_PROG_MWCC
176 AC_BAKEFILE_PROG_XLCC
177 AC_BAKEFILE_PROG_SGICC
178 AC_BAKEFILE_PROG_SUNCC
179 ])
180
181 AC_DEFUN([AC_BAKEFILE_PROG_CXX],
182 [
183 AC_PROG_CXX
184 AC_BAKEFILE_METROWERKS_EXTO
185 dnl By the time we find out that we need -ext o some tests have failed.
186 if test "x$wx_cv_cxx_exto" '!=' "x"; then
187 unset ac_cv_prog_cxx_g
188 _AC_PROG_CXX_G
189 fi
190 AC_BAKEFILE_PROG_MWCXX
191 AC_BAKEFILE_PROG_XLCXX
192 AC_BAKEFILE_PROG_SGICXX
193 AC_BAKEFILE_PROG_SUNCXX
194 ])
195