]>
Commit | Line | Data |
---|---|---|
b2dad0e3 BK |
1 | dnl |
2 | dnl Initialize configure bits. | |
3 | dnl | |
4 | dnl Define OPTLEVEL='-O2' if new inlining code present. | |
5 | dnl | |
6 | dnl GLIBCPP_CONFIGURE | |
7 | AC_DEFUN(GLIBCPP_CONFIGURE, [ | |
8 | dnl Default to --enable-multilib | |
9 | AC_ARG_ENABLE(multilib, | |
10 | [ --enable-multilib build hella library versions (default)], | |
11 | [case "${enableval}" in | |
12 | yes) multilib=yes ;; | |
13 | no) multilib=no ;; | |
14 | *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;; | |
15 | esac], [multilib=yes])dnl | |
16 | ||
17 | dnl We may get other options which we dont document: | |
18 | dnl --with-target-subdir, --with-multisrctop, --with-multisubdir | |
19 | if test "[$]{srcdir}" = "."; then | |
20 | if test "[$]{with_target_subdir}" != "."; then | |
21 | glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1" | |
22 | else | |
23 | glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}$1" | |
24 | fi | |
25 | else | |
26 | glibcpp_basedir="[$]{srcdir}/$1" | |
27 | fi | |
28 | AC_SUBST(glibcpp_basedir) | |
29 | ||
30 | AC_CANONICAL_HOST | |
31 | ||
32 | AM_INIT_AUTOMAKE(libstdc++, 2.90.8) | |
33 | ||
34 | # FIXME: We temporarily define our own version of AC_PROG_CC. This is | |
35 | # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We | |
36 | # are probably using a cross compiler, which will not be able to fully | |
37 | # link an executable. This should really be fixed in autoconf | |
38 | # itself. | |
39 | ||
40 | AC_DEFUN(LIB_AC_PROG_CC, | |
41 | [AC_BEFORE([$0], [AC_PROG_CPP])dnl | |
42 | dnl Fool anybody using AC_PROG_CC. | |
43 | AC_PROVIDE([AC_PROG_CC]) | |
44 | AC_CHECK_PROG(CC, gcc, gcc) | |
45 | if test -z "$CC"; then | |
46 | AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) | |
47 | test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) | |
48 | fi | |
49 | ||
50 | AC_PROG_CC_GNU | |
51 | ||
52 | if test $ac_cv_prog_gcc = yes; then | |
53 | GCC=yes | |
54 | dnl Check whether -g works, even if CFLAGS is set, in case the package | |
55 | dnl plays around with CFLAGS (such as to build both debugging and | |
56 | dnl normal versions of a library), tasteless as that idea is. | |
57 | ac_test_CFLAGS="${CFLAGS+set}" | |
58 | ac_save_CFLAGS="$CFLAGS" | |
59 | CFLAGS= | |
60 | AC_PROG_CC_G | |
61 | if test "$ac_test_CFLAGS" = set; then | |
62 | CFLAGS="$ac_save_CFLAGS" | |
63 | elif test $ac_cv_prog_cc_g = yes; then | |
64 | CFLAGS="-g -O2" | |
65 | else | |
66 | CFLAGS="-O2" | |
67 | fi | |
68 | else | |
69 | GCC= | |
70 | test "${CFLAGS+set}" = set || CFLAGS="-g" | |
71 | fi | |
72 | ]) | |
73 | ||
74 | LIB_AC_PROG_CC | |
75 | ||
76 | # Likewise for AC_PROG_CXX. | |
77 | AC_DEFUN(LIB_AC_PROG_CXX, | |
78 | [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl | |
79 | dnl Fool anybody using AC_PROG_CXX. | |
80 | AC_PROVIDE([AC_PROG_CXX]) | |
81 | AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc) | |
82 | test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH]) | |
83 | ||
84 | AC_PROG_CXX_GNU | |
85 | ||
86 | if test $ac_cv_prog_gxx = yes; then | |
87 | GXX=yes | |
88 | dnl Check whether -g works, even if CXXFLAGS is set, in case the package | |
89 | dnl plays around with CXXFLAGS (such as to build both debugging and | |
90 | dnl normal versions of a library), tasteless as that idea is. | |
91 | ac_test_CXXFLAGS="${CXXFLAGS+set}" | |
92 | ac_save_CXXFLAGS="$CXXFLAGS" | |
93 | CXXFLAGS= | |
94 | AC_PROG_CXX_G | |
95 | if test "$ac_test_CXXFLAGS" = set; then | |
96 | CXXFLAGS="$ac_save_CXXFLAGS" | |
97 | elif test $ac_cv_prog_cxx_g = yes; then | |
98 | CXXFLAGS="-g -O2" | |
99 | else | |
100 | CXXFLAGS="-O2" | |
101 | fi | |
102 | else | |
103 | GXX= | |
104 | test "${CXXFLAGS+set}" = set || CXXFLAGS="-g" | |
105 | fi | |
106 | ]) | |
107 | ||
108 | LIB_AC_PROG_CXX | |
109 | ||
110 | # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we dont | |
111 | # run it explicitly here, it will be run implicitly before | |
112 | # LIBGCJ_CONFIGURE, which doesn't work because that means that it will | |
113 | # be run before AC_CANONICAL_HOST. | |
114 | AC_CANONICAL_BUILD | |
115 | ||
116 | AC_CHECK_TOOL(AS, as) | |
117 | AC_CHECK_TOOL(AR, ar) | |
118 | AC_CHECK_TOOL(RANLIB, ranlib, :) | |
119 | ||
120 | AC_PROG_INSTALL | |
121 | ||
122 | AM_MAINTAINER_MODE | |
123 | ||
124 | # We need AC_EXEEXT to keep automake happy in cygnus mode. However, | |
125 | # at least currently, we never actually build a program, so we never | |
126 | # need to use $(EXEEXT). Moreover, the test for EXEEXT normally | |
127 | # fails, because we are probably configuring with a cross compiler | |
128 | # which cant create executables. So we include AC_EXEEXT to keep | |
129 | # automake happy, but we dont execute it, since we dont care about | |
130 | # the result. | |
131 | if false; then | |
132 | AC_EXEEXT | |
133 | fi | |
134 | ||
135 | # configure.host sets the following important variables | |
136 | # glibcpp_cflags - host specific C compiler flags | |
137 | # glibcpp_cxxflags - host specific C++ compiler flags | |
138 | ||
139 | glibcpp_cflags= | |
140 | glibcpp_cxxflags= | |
141 | ||
142 | . [$]{glibcpp_basedir}/configure.host | |
143 | ||
144 | case [$]{glibcpp_basedir} in | |
145 | /* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;; | |
146 | *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;; | |
147 | esac | |
148 | ||
149 | GLIBCPP_CFLAGS="[$]{glibcpp_cflags}" | |
150 | GLIBCPP_CXXFLAGS="[$]{glibcpp_cxxflags}" | |
151 | AC_SUBST(GLIBCPP_CFLAGS) | |
152 | AC_SUBST(GLIBCPP_CXXFLAGS) | |
153 | ]) | |
154 | ||
155 | ||
156 | dnl | |
8bd636c5 | 157 | dnl Check to see if g++ can compile this library, and if so, if any version- |
c470c17d BK |
158 | dnl specific precautions need to be taken. |
159 | dnl | |
160 | dnl GLIBCPP_CHECK_COMPILER_VERSION | |
161 | AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [ | |
c470c17d BK |
162 | # Sanity check that g++ is capable of dealing with v-3. |
163 | AC_MSG_CHECKING([for g++ that will successfully compile this code]) | |
164 | AC_EGREP_CPP([ok], [ | |
165 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) | |
166 | ok | |
167 | #endif | |
168 | ], gpp_satisfactory=yes, AC_MSG_ERROR("please upgrade to gcc-2.95 or above")) | |
169 | AC_MSG_RESULT($gpp_satisfactory) | |
170 | ]) | |
171 | ||
172 | ||
173 | dnl | |
174 | dnl Test for newer compiler features, or features that are present in newer | |
d3a12960 BK |
175 | dnl compiler version but not older compiler versions should be placed |
176 | dnl here. | |
b2dad0e3 | 177 | dnl |
c470c17d BK |
178 | dnl Define WFMT_FLAGS='-fdiagnostics-show-location=once' if possible |
179 | dnl | |
8bd636c5 | 180 | dnl Define WERROR='-Werror' if possible; g++'s that lack the new inlining |
c470c17d | 181 | dnl code or the new system_header pragma will die. |
b2dad0e3 | 182 | dnl |
c470c17d BK |
183 | dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if |
184 | dnl compiler supports it. | |
185 | dnl GLIBCPP_CHECK_COMPILER_FEATURES | |
186 | AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [ | |
a4e99046 PE |
187 | # All these tests are for C++; save the language and the compiler flags. |
188 | # The CXXFLAGS thing is suspicious, but based on similar bits | |
189 | # found in GLIBCPP_CONFIGURE. | |
190 | AC_LANG_SAVE | |
191 | AC_LANG_CPLUSPLUS | |
192 | ac_test_CXXFLAGS="${CXXFLAGS+set}" | |
193 | ac_save_CXXFLAGS="$CXXFLAGS" | |
194 | WERROR='-Werror' | |
195 | ||
d3a12960 BK |
196 | # Check for pragma system_header. |
197 | AC_MSG_CHECKING([for g++ that supports pragma system_header]) | |
8bd636c5 PE |
198 | CXXFLAGS='-Wunknown-pragmas -Werror' |
199 | AC_TRY_COMPILE([#pragma system_header], [int foo; | |
11a6e9a7 | 200 | ], [ac_newpragma=yes], [ac_newpragma=no]) |
8bd636c5 PE |
201 | if test "$ac_test_CXXFLAGS" = set; then |
202 | CXXFLAGS="$ac_save_CXXFLAGS" | |
203 | else | |
204 | # this is the suspicious part | |
205 | CXXFLAGS='' | |
206 | fi | |
11a6e9a7 PE |
207 | if test "$ac_newpragma" = "no"; then |
208 | WERROR="$WERROR -Wno-unknown-pragmas" | |
8bd636c5 | 209 | fi |
11a6e9a7 | 210 | AC_MSG_RESULT($ac_newpragma) |
8bd636c5 | 211 | |
d3a12960 BK |
212 | # Check for more sophisticated diagnostic control. |
213 | AC_MSG_CHECKING([for g++ that supports -fdiagnostics-show-location=once]) | |
a4e99046 PE |
214 | CXXFLAGS='-fdiagnostics-show-location=once' |
215 | AC_TRY_COMPILE(, [int foo; | |
216 | ], [ac_gabydiags=yes], [ac_gabydiags=no]) | |
217 | if test "$ac_test_CXXFLAGS" = set; then | |
218 | CXXFLAGS="$ac_save_CXXFLAGS" | |
219 | else | |
220 | # this is the suspicious part | |
221 | CXXFLAGS='' | |
222 | fi | |
223 | if test "$ac_gabydiags" = "yes"; then | |
c470c17d | 224 | WFMT_FLAGS='-fdiagnostics-show-location=once' |
a4e99046 PE |
225 | fi |
226 | AC_MSG_RESULT($ac_gabydiags) | |
227 | ||
c470c17d BK |
228 | # Check for -ffunction-sections -fdata-sections |
229 | AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections]) | |
230 | CXXFLAGS='-ffunction-sections -fdata-sections' | |
231 | AC_TRY_COMPILE(, [int foo; | |
232 | ], [ac_fdsections=yes], [ac_fdsections=no]) | |
233 | if test "$ac_test_CXXFLAGS" = set; then | |
234 | CXXFLAGS="$ac_save_CXXFLAGS" | |
235 | else | |
236 | # this is the suspicious part | |
237 | CXXFLAGS='' | |
238 | fi | |
239 | if test "$ac_fdsections" = "yes"; then | |
240 | SECTION_FLAGS='-ffunction-sections -fdata-sections' | |
241 | fi | |
242 | AC_MSG_RESULT($ac_fdsections) | |
243 | ||
a4e99046 | 244 | AC_LANG_RESTORE |
8bd636c5 | 245 | AC_SUBST(WERROR) |
c470c17d BK |
246 | AC_SUBST(WFMT_FLAGS) |
247 | AC_SUBST(SECTION_FLAGS) | |
b2dad0e3 BK |
248 | ]) |
249 | ||
c470c17d BK |
250 | |
251 | dnl | |
252 | dnl Check to see if tricky linker opts can be used. | |
253 | dnl | |
254 | dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible | |
255 | dnl GLIBCPP_CHECK_LINKER_FEATURES | |
256 | AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [ | |
257 | # All these tests are for C++; save the language and the compiler flags. | |
5f349042 BK |
258 | # Need to do this so that g++ won't try to link in libstdc++ |
259 | ac_test_CFLAGS="${CFLAGS+set}" | |
260 | ac_save_CFLAGS="$CFLAGS" | |
261 | CFLAGS='-x c++ -Wl,--gc-sections' | |
c470c17d BK |
262 | |
263 | # Check for -Wl,--gc-sections | |
264 | AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections]) | |
38bd7296 | 265 | AC_TRY_RUN([ |
5f349042 | 266 | int main(void) |
38bd7296 BK |
267 | { |
268 | try { throw 1; } | |
269 | catch (...) { }; | |
270 | return 0; | |
271 | } | |
272 | ], [ac_sectionLDflags=yes], [ac_sectionLFflags=no], [ac_sectionLDflags=yes]) | |
5f349042 BK |
273 | if test "$ac_test_CFLAGS" = set; then |
274 | CFLAGS="$ac_save_CFLAGS" | |
c470c17d BK |
275 | else |
276 | # this is the suspicious part | |
5f349042 | 277 | CFLAGS='' |
c470c17d BK |
278 | fi |
279 | if test "$ac_sectionLDflags" = "yes"; then | |
280 | SECTION_LDFLAGS='-Wl,--gc-sections' | |
281 | fi | |
282 | AC_MSG_RESULT($ac_sectionLDflags) | |
283 | ||
c470c17d BK |
284 | AC_SUBST(SECTION_LDFLAGS) |
285 | ]) | |
286 | ||
287 | ||
b2dad0e3 | 288 | dnl |
11fc1858 | 289 | dnl Check to see if the (math function) argument passed is |
38bd7296 BK |
290 | dnl 1) declared when using the c++ compiler |
291 | dnl 2) has "C" linkage | |
292 | dnl | |
293 | dnl Define HAVE_CARGF etc if "cargf" is declared and links | |
294 | dnl | |
295 | dnl argument 1 is name of function to check | |
296 | dnl | |
297 | dnl ASSUMES argument is a math function with ONE parameter | |
298 | dnl | |
299 | dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1 | |
300 | AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [ | |
301 | AC_LANG_SAVE | |
302 | AC_LANG_CPLUSPLUS | |
303 | AC_MSG_CHECKING([for $1 declaration]) | |
304 | AC_TRY_COMPILE([#include <math.h>], | |
305 | [ $1(0);], | |
306 | [use_$1=yes], [use_$1=no]) | |
307 | AC_MSG_RESULT($use_$1) | |
308 | AC_LANG_RESTORE | |
309 | if test x$use_$1 = x"yes"; then | |
310 | AC_CHECK_FUNCS($1) | |
311 | fi | |
312 | ]) | |
313 | ||
314 | ||
315 | dnl | |
11fc1858 | 316 | dnl Check to see if the (math function) argument passed is |
38bd7296 BK |
317 | dnl 1) declared when using the c++ compiler |
318 | dnl 2) has "C" linkage | |
319 | dnl | |
320 | dnl Define HAVE_CARGF etc if "cargf" is declared and links | |
321 | dnl | |
322 | dnl argument 1 is name of function to check | |
323 | dnl | |
324 | dnl ASSUMES argument is a math function with TWO parameters | |
325 | dnl | |
326 | dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2 | |
327 | AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [ | |
328 | AC_LANG_SAVE | |
329 | AC_LANG_CPLUSPLUS | |
330 | AC_MSG_CHECKING([for $1 declaration]) | |
331 | AC_TRY_COMPILE([#include <math.h>], | |
332 | [ $1(0, 0);], | |
333 | [use_$1=yes], [use_$1=no]) | |
334 | AC_MSG_RESULT($use_$1) | |
335 | AC_LANG_RESTORE | |
336 | if test x$use_$1 = x"yes"; then | |
337 | AC_CHECK_FUNCS($1) | |
338 | fi | |
339 | ]) | |
340 | ||
341 | ||
342 | dnl | |
11fc1858 | 343 | dnl Check to see if the (math function) argument passed is |
38bd7296 BK |
344 | dnl 1) declared when using the c++ compiler |
345 | dnl 2) has "C" linkage | |
346 | dnl | |
347 | dnl Define HAVE_CARGF etc if "cargf" is declared and links | |
348 | dnl | |
349 | dnl argument 1 is name of function to check | |
350 | dnl | |
351 | dnl ASSUMES argument is a math function with THREE parameters | |
352 | dnl | |
353 | dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3 | |
354 | AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [ | |
355 | AC_LANG_SAVE | |
356 | AC_LANG_CPLUSPLUS | |
357 | AC_MSG_CHECKING([for $1 declaration]) | |
358 | AC_TRY_COMPILE([#include <math.h>], | |
359 | [ $1(0, 0, 0);], | |
360 | [use_$1=yes], [use_$1=no]) | |
361 | AC_MSG_RESULT($use_$1) | |
362 | AC_LANG_RESTORE | |
363 | if test x$use_$1 = x"yes"; then | |
364 | AC_CHECK_FUNCS($1) | |
365 | fi | |
366 | ]) | |
367 | ||
368 | ||
11fc1858 BK |
369 | dnl |
370 | dnl Because the builtins are picky picky picky about the arguments they take, | |
371 | dnl do an explict linkage tests here. | |
372 | dnl Check to see if the (math function) argument passed is | |
373 | dnl 1) declared when using the c++ compiler | |
374 | dnl 2) has "C" linkage | |
375 | dnl | |
376 | dnl Define HAVE_CARGF etc if "cargf" is declared and links | |
377 | dnl | |
378 | dnl argument 1 is name of function to check | |
379 | dnl | |
380 | dnl ASSUMES argument is a math function with ONE parameter | |
381 | dnl | |
382 | dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1 | |
383 | AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [ | |
384 | AC_LANG_SAVE | |
385 | AC_LANG_CPLUSPLUS | |
386 | AC_MSG_CHECKING([for $1 declaration]) | |
387 | AC_TRY_COMPILE([#include <math.h>], | |
388 | [ $1(0);], | |
389 | [use_$1=yes], [use_$1=no]) | |
390 | AC_MSG_RESULT($use_$1) | |
391 | AC_LANG_RESTORE | |
392 | if test x$use_$1 = x"yes"; then | |
393 | AC_MSG_CHECKING([for $1 linkage]) | |
394 | AC_TRY_LINK([#include <math.h>], | |
395 | [ $1(0);], | |
396 | [link_$1=yes], [link_$1=no]) | |
397 | AC_MSG_RESULT($link_$1) | |
398 | if test x$link_$1 = x"yes"; then | |
399 | ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` | |
400 | AC_DEFINE_UNQUOTED(${ac_tr_func}) | |
401 | fi | |
402 | fi | |
403 | ]) | |
404 | ||
405 | ||
406 | dnl | |
407 | dnl Check to see what builtin math functions are supported | |
408 | dnl | |
409 | dnl check for __builtin_abs | |
410 | dnl check for __builtin_fabsf | |
411 | dnl check for __builtin_fabs | |
412 | dnl check for __builtin_fabl | |
413 | dnl check for __builtin_labs | |
414 | dnl check for __builtin_sqrtf | |
415 | dnl check for __builtin_sqrtl | |
416 | dnl check for __builtin_fsqrt | |
417 | dnl check for __builtin_sinf | |
418 | dnl check for __builtin_sin | |
419 | dnl check for __builtin_sinl | |
420 | dnl check for __builtin_cosf | |
421 | dnl check for __builtin_cos | |
422 | dnl check for __builtin_cosl | |
423 | dnl | |
424 | dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT | |
425 | AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [ | |
426 | dnl Test for builtin math functions. | |
427 | dnl These are made in gcc/c-common.c | |
428 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs) | |
429 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf) | |
430 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs) | |
431 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl) | |
432 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs) | |
433 | ||
434 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf) | |
435 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fsqrt) | |
436 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl) | |
437 | ||
438 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf) | |
439 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin) | |
440 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl) | |
441 | ||
442 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf) | |
443 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos) | |
444 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl) | |
445 | ||
446 | dnl There is, without a doubt, a more elegant way to have these | |
447 | dnl names exported so that they won't be stripped out of acconfig.h by | |
448 | dnl autoheader. I leave this as an exercise to somebody less frustrated | |
449 | dnl than I.... please email the libstdc++ list if you can figure out a | |
450 | dnl more elegant approach (see autoconf/acgen.m4 and specifically | |
451 | dnl AC_CHECK_FUNC for things to steal.) | |
452 | dummyvar=no | |
453 | if test x$dummyvar = x"yes"; then | |
454 | AC_DEFINE(HAVE___BUILTIN_ABS) | |
455 | AC_DEFINE(HAVE___BUILTIN_LABS) | |
456 | AC_DEFINE(HAVE___BUILTIN_COS) | |
457 | AC_DEFINE(HAVE___BUILTIN_COSF) | |
458 | AC_DEFINE(HAVE___BUILTIN_COSL) | |
459 | AC_DEFINE(HAVE___BUILTIN_FABS) | |
460 | AC_DEFINE(HAVE___BUILTIN_FABSF) | |
461 | AC_DEFINE(HAVE___BUILTIN_FABSL) | |
462 | AC_DEFINE(HAVE___BUILTIN_SIN) | |
463 | AC_DEFINE(HAVE___BUILTIN_SINF) | |
464 | AC_DEFINE(HAVE___BUILTIN_SINL) | |
465 | AC_DEFINE(HAVE___BUILTIN_FSQRT) | |
466 | AC_DEFINE(HAVE___BUILTIN_SQRTF) | |
467 | AC_DEFINE(HAVE___BUILTIN_SQRTL) | |
468 | fi | |
469 | ]) | |
470 | ||
471 | ||
2f103494 BK |
472 | dnl |
473 | dnl Check to see what the underlying c library or math library is like. | |
38bd7296 BK |
474 | dnl These checks need to do two things: |
475 | dnl 1) make sure the name is declared when using the c++ compiler | |
476 | dnl 2) make sure the name has "C" linkage | |
477 | dnl This might seem like overkill but experience has shown that it's not... | |
2f103494 BK |
478 | dnl |
479 | dnl Define HAVE_CARGF etc if "cargf" is found. | |
480 | dnl | |
481 | dnl GLIBCPP_CHECK_MATH_SUPPORT | |
482 | AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [ | |
38bd7296 BK |
483 | ac_test_CXXFLAGS="${CXXFLAGS+set}" |
484 | ac_save_CXXFLAGS="$CXXFLAGS" | |
4f76382d | 485 | CXXFLAGS='-fno-builtins -D_GNU_SOURCE' |
aac350aa BK |
486 | |
487 | dnl Check libm | |
2f103494 | 488 | AC_CHECK_LIB(m, sin, libm="-lm") |
38bd7296 | 489 | ac_save_LIBS="$LIBS" |
2f103494 BK |
490 | LIBS="$LIBS $libm" |
491 | ||
38bd7296 BK |
492 | dnl Although not math functions, needed and for some reason checked here. |
493 | AC_CHECK_FUNCS(strtof strtold) | |
494 | ||
495 | dnl Check to see if certain C math functions exist. | |
496 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf) | |
497 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan) | |
498 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite) | |
499 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign) | |
500 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos) | |
501 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass) | |
502 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass) | |
503 | ||
504 | dnl Check to see if basic C math functions have float versions. | |
505 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf) | |
506 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff) | |
507 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(acosf) | |
508 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(asinf) | |
509 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(atanf) | |
510 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f) | |
511 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(ceilf) | |
512 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(cosf) | |
513 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(coshf) | |
514 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expf) | |
515 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf) | |
516 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(floorf) | |
517 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf) | |
518 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf) | |
519 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf) | |
520 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf) | |
521 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f) | |
522 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff) | |
523 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf) | |
524 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinf) | |
525 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinhf) | |
526 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf) | |
527 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanf) | |
528 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanhf) | |
529 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf) | |
530 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef) | |
531 | ||
532 | dnl Check to see if basic C math functions have long double versions. | |
533 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl) | |
534 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl) | |
11fc1858 | 535 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl) |
38bd7296 BK |
536 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(acosl) |
537 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(asinl) | |
538 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(atanl) | |
539 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l) | |
540 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(ceill) | |
541 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(cosl) | |
542 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(coshl) | |
543 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl) | |
544 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl) | |
545 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(floorl) | |
546 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl) | |
547 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl) | |
548 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl) | |
549 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl) | |
550 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l) | |
551 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl) | |
552 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl) | |
11fc1858 | 553 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinl) |
38bd7296 BK |
554 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinhl) |
555 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl) | |
556 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanl) | |
557 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanhl) | |
558 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl) | |
559 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel) | |
560 | ||
561 | dnl Some runtimes have these functions with a preceding underscore. Please | |
562 | dnl keep this sync'd with the one above. And if you add any new symbol, | |
563 | dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h. | |
564 | dnl Check to see if certain C math functions exist. | |
565 | dnl Check to see if certain C math functions exist. | |
566 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinf) | |
567 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnan) | |
568 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finite) | |
569 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_copysign) | |
570 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincos) | |
571 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fpclass) | |
572 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_qfpclass) | |
573 | ||
574 | dnl Check to see if basic C math functions have float versions. | |
575 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnanf) | |
576 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinff) | |
577 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_acosf) | |
578 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_asinf) | |
579 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_atanf) | |
580 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_atan2f) | |
581 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_ceilf) | |
582 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_cosf) | |
583 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_coshf) | |
584 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_expf) | |
585 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fabsf) | |
586 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_floorf) | |
587 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_fmodf) | |
588 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_frexpf) | |
589 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_ldexpf) | |
590 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_logf) | |
591 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_log10f) | |
592 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_modff) | |
593 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_powf) | |
594 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinf) | |
595 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinhf) | |
596 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sqrtf) | |
597 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanf) | |
598 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanhf) | |
599 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincosf) | |
600 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finitef) | |
601 | ||
602 | dnl Check to see if basic C math functions have long double versions. | |
603 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnanl) | |
604 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinfl) | |
11fc1858 | 605 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_copysignl) |
38bd7296 BK |
606 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_acosl) |
607 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_asinl) | |
608 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_atanl) | |
609 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_atan2l) | |
610 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_ceill) | |
611 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_cosl) | |
612 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_coshl) | |
613 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_expl) | |
614 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fabsl) | |
615 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_floorl) | |
616 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_fmodl) | |
617 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_frexpl) | |
618 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_ldexpl) | |
619 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_logl) | |
620 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_log10l) | |
621 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_modfl) | |
622 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_powl) | |
11fc1858 | 623 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinl) |
38bd7296 BK |
624 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinhl) |
625 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sqrtl) | |
626 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanl) | |
627 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanhl) | |
628 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincosl) | |
629 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finitel) | |
630 | ||
631 | LIBS="$ac_save_LIBS" | |
632 | CXXFLAGS="$ac_save_CXXFLAGS" | |
2f103494 BK |
633 | ]) |
634 | ||
635 | ||
636 | dnl | |
637 | dnl Check to see if there is native support for complex | |
638 | dnl | |
639 | dnl Don't compile bits in math/* if native support exits. | |
640 | dnl | |
641 | dnl Define USE_COMPLEX_LONG_DOUBLE etc if "cargf" is found. | |
642 | dnl | |
643 | dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT | |
644 | AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [ | |
645 | dnl Check for complex versions of math functions of platform. | |
646 | AC_CHECK_HEADERS([complex.h]) | |
647 | AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf c_log c_logf \ | |
648 | clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt csqrtf \ | |
11fc1858 BK |
649 | ctan ctanf ctanh ctanhf carg cargf nan hypot hypotf atan2f expf copysignf) |
650 | ||
651 | dnl Compile the long double complex functions only if the function | |
652 | dnl provides the non-complex long double functions that are needed. | |
653 | dnl Currently this includes copysignl and atan2l, which should be | |
654 | dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above. | |
655 | USE_COMPLEX_LONG_DOUBLE=no | |
656 | if test x$ac_cv_func_atan2l = x"yes" \ | |
657 | && test x$ac_cv_func_copysignl = x"yes"; then | |
658 | USE_COMPLEX_LONG_DOUBLE=yes | |
659 | AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl cpowl csinhl csinl \ | |
660 | csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l) | |
661 | fi | |
662 | ||
2f103494 BK |
663 | AC_SUBST(USE_COMPLEX_LONG_DOUBLE) |
664 | ]) | |
665 | ||
54fa7415 | 666 | |
b2dad0e3 BK |
667 | dnl Check to see what architecture we are compiling for. If it's |
668 | dnl supported, use special hand-crafted routines to provide thread | |
cde28f0d BK |
669 | dnl primitives. Also, if architecture-specific flags are required for |
670 | dnl compilation, add them here. | |
b2dad0e3 | 671 | dnl |
f3b004d8 BK |
672 | dnl Depending on what is found, select configure/cpu/*/bits/atomicity.h |
673 | dnl If not found, select configure/cpu/generic/bits/atomicity.h | |
b2dad0e3 BK |
674 | dnl |
675 | dnl GLIBCPP_CHECK_CPU | |
676 | AC_DEFUN(GLIBCPP_CHECK_CPU, [ | |
677 | AC_MSG_CHECKING([for cpu primitives directory]) | |
c470c17d | 678 | CPU_FLAGS= |
b2dad0e3 BK |
679 | case "$target_cpu" in |
680 | alpha*) | |
681 | cpu_include_dir="config/cpu/alpha" | |
682 | ;; | |
683 | arm*) | |
684 | cpu_include_dir="config/cpu/arm" | |
685 | ;; | |
bf93f43b | 686 | i386) |
b2dad0e3 | 687 | cpu_include_dir="config/cpu/i386" |
bf93f43b BK |
688 | ;; |
689 | i486 | i586 | i686 | i786) | |
690 | cpu_include_dir="config/cpu/i486" | |
b2dad0e3 BK |
691 | ;; |
692 | powerpc | rs6000) | |
693 | cpu_include_dir="config/cpu/powerpc" | |
c470c17d | 694 | CPU_FLAGS='-mcpu=powerpc' |
b2dad0e3 BK |
695 | ;; |
696 | sparc64 | ultrasparc) | |
697 | cpu_include_dir="config/cpu/sparc/sparc64" | |
698 | ;; | |
699 | sparc*) | |
700 | cpu_include_dir="config/cpu/sparc/sparc32" | |
701 | ;; | |
702 | *) | |
703 | cpu_include_dir="config/cpu/generic" | |
704 | ;; | |
705 | esac | |
706 | AC_MSG_RESULT($cpu_include_dir) | |
707 | AC_SUBST(cpu_include_dir) | |
c470c17d | 708 | AC_SUBST(CPU_FLAGS) |
b2dad0e3 BK |
709 | ]) |
710 | ||
711 | ||
712 | dnl | |
713 | dnl Check to see what the underlying c library's interface to ctype looks | |
714 | dnl like. Bits of locale rely on things like isspace, toupper, etc. This | |
715 | dnl stuff makes sure the right bits from the clibrary get called. | |
716 | dnl | |
717 | dnl Depending on what is found, select various configure/*/bits/ctype_base.h | |
718 | dnl Depending on what is found, select various configure/*/ctype.cc | |
719 | dnl | |
720 | dnl GLIBCPP_CHECK_CTYPE | |
721 | AC_DEFUN(GLIBCPP_CHECK_CTYPE, [ | |
722 | AC_CHECK_HEADER(ctype.h, [ | |
723 | ||
724 | dnl If doesn't match any specified, go with defaults. | |
725 | ctype_default=yes | |
726 | ||
727 | dnl Test for <ctype> functionality -- gnu-linux | |
8445e42a | 728 | AC_MSG_CHECKING([<ctype> for gnu-linux ]) |
b2dad0e3 BK |
729 | AC_TRY_COMPILE([#include <ctype.h>], |
730 | [int | |
731 | foo (int a) | |
732 | { return _ISspace + _ISprint + _IScntrl + _ISupper + _ISlower + _ISalpha \ | |
733 | + _ISdigit + _ISpunct + _ISxdigit + _ISalnum + _ISgraph \ | |
734 | + __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];}], \ | |
735 | ctype_linux=yes, ctype_linux=no) | |
736 | AC_MSG_RESULT($ctype_linux) | |
737 | if test $ctype_linux = "yes"; then | |
738 | ctype_include_dir="config/gnu-linux" | |
739 | ctype_default=no | |
740 | fi | |
741 | ||
6ad50467 | 742 | dnl Test for <ctype> functionality -- FreeBSD 4.0 |
65dd21b7 | 743 | if test $ctype_default = "yes"; then |
6ad50467 | 744 | AC_MSG_CHECKING([<ctype> for freebsd 4.0 ]) |
7b267e3e BK |
745 | AC_TRY_COMPILE([#include <ctype.h>], |
746 | [int | |
747 | foo (int a) | |
748 | { return _CTYPE_S + _CTYPE_R + _CTYPE_C + _CTYPE_U + _CTYPE_L + _CTYPE_A \ | |
749 | + _CTYPE_D + _CTYPE_P + _CTYPE_X + _CTYPE_G ;}], \ | |
750 | ctype_bsd=yes, ctype_bsd=no) | |
751 | AC_MSG_RESULT($ctype_bsd) | |
752 | if test $ctype_bsd = "yes"; then | |
753 | ctype_include_dir="config/bsd" | |
754 | ctype_default=no | |
755 | fi | |
65dd21b7 | 756 | fi |
7b267e3e | 757 | |
6ad50467 | 758 | dnl Test for <ctype> functionality -- FreeBSD 3.4 |
65dd21b7 | 759 | if test $ctype_default = "yes"; then |
6ad50467 BK |
760 | AC_MSG_CHECKING([<ctype> for freebsd 3.4 ]) |
761 | AC_TRY_COMPILE([#include <ctype.h>], | |
762 | [int | |
763 | foo (int a) | |
764 | { return _S + _R + _C + _U + _L + _A \ | |
765 | + _D + _P + _X + _G + __istype (a, 0);}], \ | |
766 | ctype_freebsd34=yes, ctype_freebsd34=no) | |
767 | AC_MSG_RESULT($ctype_freebsd34) | |
768 | if test $ctype_freebsd34 = "yes"; then | |
769 | ctype_include_dir="config/bsd" | |
770 | ctype_default=no | |
771 | fi | |
65dd21b7 | 772 | fi |
6ad50467 | 773 | |
b2dad0e3 BK |
774 | dnl Test for <ctype> functionality -- solaris 2.6 and 2.7 |
775 | if test $ctype_default = "yes"; then | |
8445e42a | 776 | AC_MSG_CHECKING([<ctype> for solaris 2.[6,7,8] ]) |
b2dad0e3 BK |
777 | AC_TRY_COMPILE([#include <ctype.h>], |
778 | [int | |
779 | foo (int a) | |
780 | { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \ | |
781 | + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \ | |
782 | + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}], \ | |
783 | ctype_solaris=yes, ctype_solaris=no) | |
784 | AC_MSG_RESULT($ctype_solaris) | |
785 | ||
786 | if test $ctype_solaris = "yes"; then | |
787 | AC_MSG_CHECKING([ for version]) | |
788 | AC_LANG_CPLUSPLUS | |
789 | AC_TRY_COMPILE([#include <ctype.h>], | |
790 | [typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;],\ | |
791 | ctype_solaris26=yes, ctype_solaris26=no) | |
792 | AC_LANG_C | |
793 | if test $ctype_solaris26 = "yes"; then | |
794 | ctype_include_dir="config/solaris/solaris2.6" | |
795 | AC_MSG_RESULT("solaris2.6") | |
796 | ctype_default=no | |
797 | else | |
798 | ctype_include_dir="config/solaris/solaris2.7" | |
32a4595e | 799 | AC_MSG_RESULT("solaris2.[7,8]") |
b2dad0e3 BK |
800 | ctype_default=no |
801 | fi | |
802 | fi | |
803 | fi | |
804 | ||
805 | dnl Test for <ctype> functionality -- solaris 2.5.1 | |
806 | if test $ctype_default = "yes"; then | |
8445e42a | 807 | AC_MSG_CHECKING([<ctype> for solaris 2.5.1 ]) |
b2dad0e3 BK |
808 | AC_TRY_COMPILE([#include <ctype.h>], |
809 | [int | |
810 | foo (int a) | |
811 | { return _U + _L + _N + _S + _P + _C + _X + _B \ | |
812 | + __ctype[a];}], \ | |
813 | ctype_solaris25=yes, ctype_solaris25=no) | |
814 | AC_MSG_RESULT($ctype_solaris25) | |
815 | if test $ctype_solaris25 = "yes"; then | |
816 | ctype_include_dir="config/solaris/solaris2.5" | |
817 | ctype_default=no | |
818 | fi | |
819 | fi | |
820 | ||
821 | dnl Test for <ctype> functionality -- aix | |
822 | if test $ctype_default = "yes"; then | |
8445e42a | 823 | AC_MSG_CHECKING([<ctype> for aix ]) |
b2dad0e3 BK |
824 | AC_TRY_COMPILE([#include <ctype.h>], |
825 | [int | |
826 | foo (int a) | |
827 | { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \ | |
828 | + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \ | |
829 | + _VALC('a') + _IS('c', 0);}], \ | |
830 | ctype_aix=yes, ctype_aix=no) | |
831 | AC_MSG_RESULT($ctype_aix) | |
832 | if test $ctype_aix = "yes"; then | |
833 | ctype_include_dir="config/aix" | |
834 | ctype_default=no | |
835 | fi | |
836 | fi | |
837 | ||
838 | dnl Test for <ctype> functionality -- newlib | |
839 | if test $ctype_default = "yes"; then | |
8445e42a | 840 | AC_MSG_CHECKING([<ctype> for newlib ]) |
b2dad0e3 BK |
841 | AC_TRY_COMPILE([#include <ctype.h>], |
842 | [int | |
843 | foo (int a) | |
844 | { return _U + _L + _N + _S + _P + _C + _X + _B \ | |
845 | + _ctype_[a];}], \ | |
846 | ctype_newlib=yes, ctype_newlib=no) | |
847 | AC_MSG_RESULT($ctype_newlib) | |
848 | if test $ctype_newlib = "yes"; then | |
849 | ctype_include_dir="config/newlib" | |
850 | ctype_default=no | |
851 | fi | |
852 | fi | |
853 | ||
854 | if test $ctype_default = "yes"; then | |
855 | ctype_include_dir="config/generic" | |
856 | AC_MSG_WARN("Using default ctype headers.") | |
857 | fi | |
858 | AC_SUBST(ctype_include_dir) | |
859 | ]) | |
860 | ]) | |
861 | ||
862 | ||
b2dad0e3 BK |
863 | dnl |
864 | dnl Check to see if this target can enable the wchar_t parts of libstdc++. | |
865 | dnl | |
866 | dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found | |
867 | dnl Define _GLIBCPP_NEED_MBSTATE_T if mbstate_t is not in wchar.h | |
b2dad0e3 BK |
868 | dnl |
869 | dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT | |
870 | AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [ | |
3840fa2a BK |
871 | |
872 | dnl Sanity check for existence of ISO C9X headers for extended encoding. | |
873 | AC_CHECK_HEADER(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no) | |
874 | AC_CHECK_HEADER(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no) | |
875 | ||
876 | dnl Only continue checking if the ISO C9X headers exist. | |
877 | if test x"$ac_has_wchar_h" = xyes && test x"$ac_has_wctype_h" = xyes; then | |
878 | ||
879 | dnl Test wchar.h for mbstate_t, which is needed for char_traits and others. | |
880 | AC_MSG_CHECKING([for mbstate_t]) | |
881 | AC_TRY_COMPILE([#include <wchar.h>], | |
882 | [mbstate_t teststate;], | |
883 | use_native_mbstatet=yes, use_native_mbstatet=no) | |
884 | AC_MSG_RESULT($use_native_mbstatet) | |
885 | if test x"$use_native_mbstatet" = xno; then | |
886 | AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T) | |
887 | fi | |
b2dad0e3 | 888 | |
3840fa2a BK |
889 | dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before |
890 | dnl numeric_limits can instantiate type_traits<wchar_t> | |
891 | AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX]) | |
892 | AC_TRY_COMPILE([#include <wchar.h>], | |
893 | [int i = WCHAR_MIN; int j = WCHAR_MAX;], | |
894 | has_wchar_minmax=yes, has_wchar_minmax=no) | |
895 | AC_MSG_RESULT($has_wchar_minmax) | |
b2dad0e3 | 896 | |
3840fa2a BK |
897 | dnl Test wchar.h for WEOF, which is what we use to determine whether |
898 | dnl to specialize for char_traits<wchar_t> or not. | |
899 | AC_MSG_CHECKING([for WEOF]) | |
900 | AC_TRY_COMPILE([ | |
901 | #include <wchar.h> | |
902 | #include <stddef.h>], | |
903 | [wint_t i = WEOF;], | |
904 | has_weof=yes, has_weof=no) | |
905 | AC_MSG_RESULT($has_weof) | |
906 | ||
907 | dnl Tests for wide character functions used in char_traits<wchar_t>. | |
908 | AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset, ac_wfuncs=yes, ac_wfuncs=no) | |
909 | ||
910 | AC_MSG_CHECKING([for ISO C9X wchar_t support]) | |
911 | if test x"$has_weof" = xyes && test x"$has_wchar_minmax" = xyes && test x"$ac_wfuncs" = xyes; then | |
912 | ac_isoC9X_wchar_t=yes | |
913 | else | |
914 | ac_isoC9X_wchar_t=no | |
915 | fi | |
916 | AC_MSG_RESULT($ac_isoC9X_wchar_t) | |
917 | ||
918 | dnl Use iconv for wchar_t to char conversions. As such, check for | |
919 | dnl X/Open Portability Guide, version 2 features (XPG2). | |
920 | AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no) | |
921 | AC_CHECK_FUNCS(iconv_open iconv_close iconv, ac_XPG2funcs=yes, ac_XPG2funcs=no) | |
922 | ||
923 | AC_MSG_CHECKING([for XPG2 wchar_t support]) | |
924 | if test x"$ac_has_iconv_h" = xyes && test x"$ac_XPG2funcs" = xyes; then | |
925 | ac_XPG2_wchar_t=yes | |
926 | else | |
927 | ac_XPG2_wchar_t=no | |
928 | fi | |
929 | AC_MSG_RESULT($ac_XPG2_wchar_t) | |
930 | ||
931 | dnl At the moment, only enable wchar_t specializations if all the | |
932 | dnl above support is present. | |
933 | AC_MSG_CHECKING([for enabled wchar_t specializations]) | |
934 | if test x"$ac_isoC9X_wchar_t" = xyes && test x"$ac_XPG2_wchar_t" = xyes; then | |
935 | libinst_wstring_la="libinst-wstring.la" | |
936 | AC_DEFINE(_GLIBCPP_USE_WCHAR_T) | |
937 | AC_MSG_RESULT("yes") | |
938 | else | |
939 | libinst_wstring_la="" | |
940 | AC_MSG_RESULT("no") | |
941 | fi | |
942 | AC_SUBST(libinst_wstring_la) | |
943 | ||
b2dad0e3 | 944 | else |
3840fa2a BK |
945 | AC_MSG_WARN([<wchar.h> not found]) |
946 | AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T) | |
b2dad0e3 | 947 | fi |
b2dad0e3 BK |
948 | ]) |
949 | ||
950 | ||
951 | dnl | |
952 | dnl Check to see if this version of GNU C++ is afflicted by bugs in | |
953 | dnl __complex__ float support. | |
954 | dnl | |
955 | dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy. | |
956 | dnl | |
2f103494 BK |
957 | dnl Check to see if this version of GNU C++ is afflicted by bugs in |
958 | dnl __complex__ support.Check for buggy __complex__ that will cause ICE in | |
959 | dnl gcc-2.95.x when using the library, unless we define the default copy | |
960 | dnl ctor in the specializations of complex<>. | |
961 | dnl | |
962 | dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy. | |
963 | dnl GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT | |
964 | AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT, [ | |
b2dad0e3 | 965 | AC_REQUIRE([AC_PROG_CXX]) |
2f103494 BK |
966 | |
967 | AC_MSG_CHECKING([for GNU C++ __complex__ support]) | |
968 | AC_CACHE_VAL(glibcpp_cv_complex, [ | |
969 | AC_LANG_SAVE | |
970 | AC_LANG_CPLUSPLUS | |
971 | AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \ | |
972 | dcomplex f(const dcomplex& x) { return dcomplex(x); }], \ | |
973 | [ dcomplex x; f(x); ], | |
974 | glibcpp_cv_complex=ok, | |
975 | glibcpp_cv_complex=buggy | |
976 | ) | |
977 | AC_LANG_RESTORE | |
978 | ]) | |
979 | AC_MSG_RESULT($glibcpp_cv_complex) | |
980 | if test $glibcpp_cv_complex = buggy; then | |
981 | AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX) | |
982 | fi | |
983 | ||
b2dad0e3 BK |
984 | AC_MSG_CHECKING([for GNU C++ __complex__ float support]) |
985 | AC_CACHE_VAL(glibcpp_cv_float_complex, [ | |
986 | AC_LANG_SAVE | |
987 | AC_LANG_CPLUSPLUS | |
988 | rm -f conftest.h | |
989 | cat > conftest.h <<EOB | |
990 | // | |
991 | // Check for buggy __complex__ that causes ICE in most versions of egcs | |
992 | // and gcc-2.95.x on certain platforms (eg., x86-win32). | |
993 | // | |
994 | // See http://egcs.cygnus.com/ml/gcc-bugs/1999-07/msg00845.html for | |
995 | // more info on the bug itself. | |
996 | // | |
997 | struct | |
998 | float_complex | |
999 | { | |
1000 | __complex__ float m_value; | |
1001 | float_complex (float = 0.0f, float = 0.0f); | |
1002 | float_complex (__complex__ float val) : m_value (val) {} | |
1003 | float_complex foo (const float_complex &val) | |
1004 | { return float_complex (~val.m_value); } | |
1005 | }; | |
1006 | EOB | |
1007 | AC_TRY_COMPILE([#include "conftest.h"], , | |
1008 | glibcpp_cv_float_complex=ok, | |
1009 | glibcpp_cv_float_complex=buggy | |
1010 | ) | |
1011 | AC_LANG_RESTORE | |
1012 | ]) | |
1013 | AC_MSG_RESULT($glibcpp_cv_float_complex) | |
1014 | if test $glibcpp_cv_float_complex = buggy; then | |
1015 | AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX) | |
1016 | fi | |
1017 | ]) | |
1018 | ||
1019 | ||
b2dad0e3 | 1020 | dnl |
8bd636c5 | 1021 | dnl Check for special debugging mode; not for production use. |
b2dad0e3 BK |
1022 | dnl |
1023 | dnl GLIBCPP_ENABLE_DEBUG | |
1024 | dnl --enable-debug sets '-ggdb -O0'. | |
1025 | dnl --disable-debug sets '-g' and whatever optimization options the | |
1026 | dnl compiler can handle. | |
1027 | dnl + Perhaps --enable-maintainer-mode should automatically turn this on? | |
1028 | dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...? | |
1029 | dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)] | |
1030 | dnl Where DEFAULT is either `yes' or `no'. If ommitted, it | |
1031 | dnl defaults to `no'. | |
1032 | AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl | |
1033 | define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl | |
1034 | AC_ARG_ENABLE(debug, | |
1035 | changequote(<<, >>)dnl | |
1036 | << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT], | |
1037 | changequote([, ])dnl | |
1038 | [case "$enableval" in | |
1039 | yes) enable_debug=yes ;; | |
1040 | no) enable_debug=no ;; | |
1041 | *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;; | |
1042 | esac], | |
1043 | enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl | |
1044 | dnl Option parsed, now set things appropriately | |
1045 | case "$enable_debug" in | |
cde28f0d | 1046 | yes) |
c470c17d | 1047 | DEBUG_FLAGS='-O0 -ggdb' |
cde28f0d | 1048 | ;; |
f3b004d8 | 1049 | no) |
c470c17d | 1050 | DEBUG_FLAGS='-g' |
f3b004d8 | 1051 | ;; |
b2dad0e3 | 1052 | esac |
c470c17d | 1053 | AC_SUBST(DEBUG_FLAGS) |
b2dad0e3 BK |
1054 | ]) |
1055 | ||
1056 | ||
dcfa0bc8 PE |
1057 | dnl |
1058 | dnl Check for "unusual" flags to pass to the compiler while building. | |
1059 | dnl | |
1060 | dnl GLIBCPP_ENABLE_CXX_FLAGS | |
1061 | dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing | |
1062 | dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc. | |
1063 | dnl Somehow this same set of flags must be passed when [re]building | |
1064 | dnl libgcc. | |
1065 | dnl --disable-cxx-flags passes nothing. | |
32a4595e PE |
1066 | dnl + See http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00131.html |
1067 | dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00284.html | |
1068 | dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00035.html | |
dcfa0bc8 | 1069 | dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags) |
32a4595e PE |
1070 | dnl If "default flags" is an empty string (or "none"), the effect is |
1071 | dnl the same as --disable or --enable=no. | |
dcfa0bc8 PE |
1072 | AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl |
1073 | define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl | |
1074 | AC_ARG_ENABLE(cxx-flags, | |
1075 | changequote(<<, >>)dnl | |
1076 | << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library; | |
1077 | [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], | |
1078 | changequote([, ])dnl | |
1079 | [case "x$enableval" in | |
1080 | xyes) AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;; | |
32a4595e | 1081 | xno|x) enable_cxx_flags='' ;; |
dcfa0bc8 PE |
1082 | *) enable_cxx_flags="$enableval" ;; |
1083 | esac], | |
1084 | enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')dnl | |
32a4595e PE |
1085 | dnl Thinko on my part during design. This kludge is the workaround. |
1086 | if test "$enable_cxx_flags" = "none"; then enable_cxx_flags=''; fi | |
1087 | dnl Run through flags (either default or command-line) and set anything | |
1088 | dnl extra (e.g., #defines) that must accompany particular g++ options. | |
dcfa0bc8 PE |
1089 | if test -n "$enable_cxx_flags"; then |
1090 | for f in $enable_cxx_flags; do | |
1091 | case "$f" in | |
991a40fc | 1092 | -fhonor-std) ;; |
dcfa0bc8 PE |
1093 | -*) ;; |
1094 | *) # and we're trying to pass /what/ exactly? | |
1095 | AC_MSG_ERROR([compiler flags start with a -]) ;; | |
1096 | esac | |
1097 | done | |
1098 | fi | |
1099 | EXTRA_CXX_FLAGS="$enable_cxx_flags" | |
1100 | AC_SUBST(EXTRA_CXX_FLAGS) | |
1101 | ]) | |
1102 | ||
1103 | ||
b2dad0e3 BK |
1104 | dnl |
1105 | dnl Check for instructions to automatically rebuild libgcc.a. Requires, | |
1106 | dnl of course, the location of the gcc objdir. Note that if --disable- | |
1107 | dnl namespaces is in effect, rebuilding libgcc.a is an expensive no-op. | |
1108 | dnl | |
1109 | dnl GLIBCPP_ENABLE_RELIBGCC | |
1110 | dnl --enable-libgcc-rebuild=/absolute/path/to/gcc/objdir sets GCC_OBJDIR | |
1111 | dnl (presumably in the top-level Makefile) to /absol.../objdir | |
1112 | dnl --disable-libgcc-rebuild will not touch libgcc.a at all (maybe print | |
1113 | dnl a warning if this is given along with --enable-namespaces), by | |
1114 | dnl setting GCC_OBJDIR to `no'. | |
1115 | dnl + Doing this by default is going to be interesting. What default | |
1116 | dnl "on" value can there be? | |
1117 | dnl + Usage: GLIBCPP_ENABLE_RELIBGCC[(DEFAULT)] | |
1118 | dnl The default path should be ../.. if bundled with GCC source. | |
1119 | dnl If ommitted, it defaults to `no'. | |
1120 | dnl | |
1121 | AC_DEFUN(GLIBCPP_ENABLE_RELIBGCC, [dnl | |
1122 | define([GLIBCPP_ENABLE_RELIBGCC_DEFAULT], ifelse($1,, no, $1))dnl | |
1123 | AC_ARG_ENABLE(libgcc-rebuild, | |
1124 | changequote(<<, >>)dnl | |
1125 | << --enable-libgcc-rebuild=DIR also rebuild libgcc.a; DIR is | |
1126 | the GCC objdir; see install.html>>, | |
1127 | changequote([, ])dnl | |
1128 | [case "$enableval" in | |
1129 | yes) AC_MSG_ERROR([--enable-libgcc-rebuild needs a pathname]) ;; | |
1130 | no) enable_libgcc_rebuild=no ;; | |
1131 | *) if test -d "$enableval" && test -d "${enableval}/gcc" && \ | |
1132 | test -d "${enableval}/libiberty" | |
1133 | then | |
1134 | enable_libgcc_rebuild="$enableval" | |
1135 | else | |
1136 | AC_MSG_ERROR(["$enableval" does not appear to be the GCC objdir]) | |
1137 | fi | |
1138 | ;; | |
1139 | esac], | |
1140 | enable_libgcc_rebuild=GLIBCPP_ENABLE_RELIBGCC_DEFAULT)dnl | |
1141 | GCC_OBJDIR="$enable_libgcc_rebuild" | |
1142 | AC_SUBST(GCC_OBJDIR) | |
1143 | ]) | |
1144 | ||
1145 | ||
1146 | dnl | |
8bd636c5 | 1147 | dnl Check for which I/O library to use: libio, or something specific. |
b2dad0e3 BK |
1148 | dnl |
1149 | dnl GLIBCPP_ENABLE_CSTDIO | |
1150 | dnl --enable-cstdio=libio sets config/c_io_libio.h and friends | |
1151 | dnl | |
1152 | dnl default is libio | |
1153 | dnl | |
1154 | AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [ | |
1155 | AC_MSG_CHECKING([for cstdio to use]) | |
1156 | AC_ARG_ENABLE(cstdio, | |
1157 | [ --enable-cstdio enable GNU libio for target io package. (default) | |
1158 | --enable-cstdio=LIB use LIB target-speific io package.], | |
1159 | if test x$enable_cstdio = xno; then | |
1160 | enable_cstdio=libio | |
1161 | fi, | |
1162 | enable_cstdio=libio) | |
1163 | ||
1164 | enable_cstdio_flag=$enable_cstdio | |
1165 | ||
1166 | dnl Check if a valid thread package | |
1167 | case x${enable_cstdio_flag} in | |
1168 | xlibio | x | xno | xnone | xyes) | |
c4561450 BK |
1169 | # default |
1170 | CSTDIO_H=config/c_io_libio.h | |
1171 | CSTDIO_CC=config/c_io_libio.cc | |
1172 | AC_MSG_RESULT(libio) | |
1173 | ||
1174 | # see if we are on a system with libio native (ie, linux) | |
1175 | AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no) | |
1176 | ||
1177 | # bkoz XXX hack hack need version checks, this is temporary | |
1178 | has_libio=no | |
1179 | ||
1180 | if test $has_libio = "yes"; then | |
1181 | BUILD_LIBIO_INCLUDE= | |
1182 | need_libio=no | |
1183 | else | |
1184 | BUILD_LIBIO_INCLUDE='-I../libio' | |
1185 | need_libio=yes | |
1186 | fi | |
1187 | AC_SUBST(BUILD_LIBIO_INCLUDE) | |
1188 | ||
1189 | # see if the _G_config.h header needs to be built. | |
1190 | # NB: This replaces the _G_CONFIG_H machinery in libio-v2 | |
1191 | AC_CHECK_HEADER(_G_config.h, has_gconf_h=yes, has_gconf_h=no) | |
1192 | AM_CONDITIONAL(GLIBCPP_NEED_LIBIO_CONFIG_H, test "$has_gconf_h" = no) | |
1193 | # bkoz XXX hack need to add support for non-glibc systems here | |
1194 | has_gconf=no | |
1195 | ||
1196 | # bkoz XXX need to add checks for this | |
1197 | need_wlibio=yes | |
1198 | ;; | |
b2dad0e3 | 1199 | xwince) |
c4561450 BK |
1200 | CSTDIO_H=config/c_io_wince.h |
1201 | CSTDIO_CC=config/c_io_wince.cc | |
1202 | AC_MSG_RESULT(wince) | |
1203 | ||
1204 | need_libio=no | |
1205 | BUILD_LIBIO_INCLUDE= | |
1206 | AC_SUBST(BUILD_LIBIO_INCLUDE) | |
1207 | ;; | |
b2dad0e3 | 1208 | *) |
c4561450 BK |
1209 | echo "$enable_cstdio is an unknown io package" 1>&2 |
1210 | exit 1 | |
1211 | ;; | |
b2dad0e3 | 1212 | esac |
c4561450 BK |
1213 | AC_LINK_FILES($CSTDIO_H, bits/c++io.h) |
1214 | AC_LINK_FILES($CSTDIO_CC, src/c++io.cc) | |
b2dad0e3 | 1215 | AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes) |
20427c6b | 1216 | AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes) |
b2dad0e3 BK |
1217 | ]) |
1218 | ||
1219 | ||
1220 | dnl | |
8bd636c5 | 1221 | dnl Check for which threading library to use. |
b2dad0e3 BK |
1222 | dnl |
1223 | dnl GLIBCPP_ENABLE_THREADS | |
1224 | dnl --enable-threads=posix sets config/threads-posix.h et. al. | |
1225 | dnl | |
1226 | dnl default is no threads | |
1227 | dnl | |
1228 | AC_DEFUN(GLIBCPP_ENABLE_THREADS, [ | |
1229 | dnl Note this comes from the gcc/config.in and libjava/config.in | |
1230 | dnl Efforts should be made to keep this in sync. | |
1231 | AC_MSG_CHECKING([for threads package to use]) | |
1232 | AC_ARG_ENABLE(threads, | |
1233 | [ --enable-threads enable thread usage for target GCC. | |
1234 | --enable-threads=LIB use LIB thread package for target GCC.], | |
1235 | if test x$enable_threads = xno; then | |
1236 | enable_threads='' | |
1237 | fi, | |
1238 | enable_threads='') | |
1239 | ||
1240 | enable_threads_flag=$enable_threads | |
1241 | ||
1242 | dnl Check if a valid thread package | |
1243 | case x${enable_threads_flag} in | |
1244 | x | xno | xnone) | |
1245 | # No threads | |
1246 | target_thread_file='single' | |
1247 | ;; | |
1248 | xyes) | |
1249 | # default | |
1250 | target_thread_file='' | |
1251 | ;; | |
1252 | xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \ | |
1253 | xsolaris | xwin32 | xdce | xvxworks) | |
1254 | target_thread_file=$enable_threads_flag | |
1255 | ;; | |
1256 | *) | |
1257 | echo "$enable_threads is an unknown thread package" 1>&2 | |
1258 | exit 1 | |
1259 | ;; | |
1260 | esac | |
1261 | ||
1262 | dnl Check for thread package actually supported in libstdc++ | |
1263 | case "$target_thread_file" in | |
1264 | no | none | single) | |
1265 | THREADS=none | |
1266 | ;; | |
1267 | posix | pthreads) | |
1268 | THREADS=posix | |
0828a0bd | 1269 | case "$target" in |
b2dad0e3 BK |
1270 | *-*-linux*) |
1271 | ;; | |
1272 | esac | |
1273 | ;; | |
1274 | decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks) | |
1275 | AC_MSG_ERROR(thread package $THREADS not yet supported) | |
1276 | ;; | |
1277 | *) | |
1278 | AC_MSG_ERROR($THREADS is an unknown thread package) | |
1279 | ;; | |
1280 | esac | |
1281 | AC_MSG_RESULT($THREADS) | |
1282 | ||
1283 | THREADLIBS= | |
1284 | THREADINCS= | |
1285 | THREADDEPS= | |
1286 | THREADOBJS= | |
1287 | THREADH= | |
1288 | THREADSPEC= | |
1289 | case "$THREADS" in | |
1290 | posix) | |
1291 | AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=]) | |
1292 | THREADLIBS=-lpthread | |
1293 | THREADSPEC=-lpthread | |
1294 | dnl Not presently used | |
1295 | dnl THREADOBJS=threads-posix.lo | |
1296 | THREADH=threads-posix.h | |
1297 | ;; | |
1298 | none) | |
1299 | dnl Not presently used | |
1300 | dnl THREADOBJS=threads-no.lo | |
1301 | THREADH=threads-no.h | |
1302 | ;; | |
1303 | esac | |
1304 | AC_SUBST(THREADLIBS) | |
1305 | AC_SUBST(THREADINCS) | |
1306 | AC_SUBST(THREADDEPS) | |
1307 | AC_SUBST(THREADOBJS) | |
1308 | AC_SUBST(THREADSPEC) | |
c4561450 | 1309 | AC_LINK_FILES(config/$THREADH, bits/c++threads.h) |
b2dad0e3 BK |
1310 | ]) |
1311 | ||
1312 | ||
1313 | dnl | |
8bd636c5 | 1314 | dnl Check for template specializations for the 'long long' type extension. |
b2dad0e3 BK |
1315 | dnl |
1316 | dnl GLIBCPP_ENABLE_LONG_LONG | |
1317 | dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG | |
1318 | dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined | |
1319 | dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)] | |
1320 | dnl Where DEFAULT is either `yes' or `no'. If ommitted, it | |
1321 | dnl defaults to `no'. | |
0137be2d | 1322 | dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'. |
b2dad0e3 BK |
1323 | dnl |
1324 | dnl GLIBCPP_ENABLE_LONG_LONG | |
1325 | AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl | |
1326 | define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl | |
30ff6342 | 1327 | |
b2dad0e3 BK |
1328 | AC_ARG_ENABLE(long-long, |
1329 | changequote(<<, >>)dnl | |
d0d88ce3 | 1330 | <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT], |
b2dad0e3 BK |
1331 | changequote([, ])dnl |
1332 | [case "$enableval" in | |
1333 | yes) enable_long_long=yes ;; | |
1334 | no) enable_long_long=no ;; | |
1335 | *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;; | |
1336 | esac], | |
1337 | enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl | |
30ff6342 BK |
1338 | |
1339 | # Check for the existance of functions used if long long is enabled. | |
1340 | AC_CHECK_FUNC(strtoll,,ac_strtoll=no) | |
1341 | AC_CHECK_FUNC(strtoull,,ac_strtoull=no) | |
1342 | ||
3840fa2a | 1343 | AC_MSG_CHECKING([for enabled long long]) |
30ff6342 | 1344 | if test x"$ac_strtoll" = xno || test x"$ac_strtoull" = xno; then |
3840fa2a BK |
1345 | enable_long_long=no; |
1346 | fi; | |
d0d88ce3 | 1347 | AC_MSG_RESULT($enable_long_long) |
3840fa2a | 1348 | |
b2dad0e3 BK |
1349 | dnl Option parsed, now set things appropriately |
1350 | case "$enable_long_long" in | |
1351 | yes) AC_DEFINE(_GLIBCPP_USE_LONG_LONG) | |
1352 | ;; | |
1353 | esac | |
1354 | ]) | |
1355 | ||
1356 | ||
99246c90 | 1357 | dnl |
8bd636c5 | 1358 | dnl Check for whether or not to do shadowed C headers. |
99246c90 PE |
1359 | dnl |
1360 | dnl GLIBCPP_ENABLE_SHADOW | |
d0d88ce3 BK |
1361 | dnl --enable-cshadow-headers [does stuff]. |
1362 | dnl --disable-cshadow-headers [does not do stuff]. | |
99246c90 PE |
1363 | dnl + This will eventually need to be on by default. |
1364 | dnl + Usage: GLIBCPP_ENABLE_SHADOW[(DEFAULT)] | |
1365 | dnl Where DEFAULT is either `yes' or `no'. If ommitted, it | |
1366 | dnl defaults to `no'. | |
1367 | AC_DEFUN(GLIBCPP_ENABLE_SHADOW, [dnl | |
1368 | define([GLIBCPP_ENABLE_SHADOW_DEFAULT], ifelse($1, yes, yes, no))dnl | |
d0d88ce3 BK |
1369 | AC_MSG_CHECKING([for enabled cshadow headers]) |
1370 | AC_ARG_ENABLE(cshadow-headers, | |
99246c90 | 1371 | changequote(<<, >>)dnl |
d0d88ce3 BK |
1372 | << --enable-cshadow-headers construct "shadowed" C header files for |
1373 | g++ [default=>>GLIBCPP_ENABLE_SHADOW_DEFAULT], | |
99246c90 PE |
1374 | changequote([, ])dnl |
1375 | [case "$enableval" in | |
d0d88ce3 BK |
1376 | yes) enable_cshadow_headers=yes |
1377 | ;; | |
1378 | no) enable_cshadow_headers=no | |
1379 | ;; | |
1380 | *) AC_MSG_ERROR([Unknown argument to enable/disable shadowed C headers]) | |
1381 | ;; | |
99246c90 | 1382 | esac], |
d0d88ce3 BK |
1383 | enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)dnl |
1384 | AC_MSG_RESULT($enable_cshadow_headers) | |
99246c90 | 1385 | dnl Option parsed, now set things appropriately |
d0d88ce3 | 1386 | case "$enable_cshadow_headers" in |
99246c90 | 1387 | yes) |
e95706d5 | 1388 | CSHADOWFLAGS="-D_GNU_SOURCE" |
5b80666b | 1389 | CSHADOW_INCLUDES=" -I$srcdir/shadow -I$blddir/cshadow" |
99246c90 PE |
1390 | ;; |
1391 | no) | |
5b80666b BK |
1392 | CSHADOWFLAGS="" |
1393 | CSHADOW_INCLUDES="" | |
99246c90 PE |
1394 | ;; |
1395 | esac | |
5b80666b BK |
1396 | |
1397 | AC_SUBST(CSHADOWFLAGS) | |
1398 | AC_SUBST(CSHADOW_INCLUDES) | |
1399 | AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cshadow_headers" = yes) | |
99246c90 | 1400 | ]) |
b2dad0e3 BK |
1401 | |
1402 | ||
af9fe0d1 BK |
1403 | # Check whether LC_MESSAGES is available in <locale.h>. |
1404 | # Ulrich Drepper <drepper@cygnus.com>, 1995. | |
1405 | # | |
1406 | # This file file be copied and used freely without restrictions. It can | |
1407 | # be used in projects which are not available under the GNU Public License | |
1408 | # but which still want to provide support for the GNU gettext functionality. | |
1409 | # Please note that the actual code is *not* freely available. | |
1410 | ||
1411 | # serial 1 | |
1412 | ||
1413 | AC_DEFUN(AC_LC_MESSAGES, | |
1414 | [if test $ac_cv_header_locale_h = yes; then | |
1415 | AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES, | |
1416 | [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], | |
1417 | ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)]) | |
1418 | if test $ac_cv_val_LC_MESSAGES = yes; then | |
1419 | AC_DEFINE(HAVE_LC_MESSAGES) | |
1420 | fi | |
1421 | fi]) | |
1422 | ||
1423 | ||
1424 | # Check for functions in math library. | |
1425 | # Ulrich Drepper <drepper@cygnus.com>, 1998. | |
1426 | # | |
1427 | # This file can be copied and used freely without restrictions. It can | |
1428 | # be used in projects which are not available under the GNU Public License | |
1429 | # but which still want to provide support for the GNU gettext functionality. | |
1430 | # Please note that the actual code is *not* freely available. | |
1431 | ||
1432 | # serial 1 | |
1433 | ||
1434 | dnl AC_REPLACE_MATHFUNCS(FUNCTION...) | |
1435 | AC_DEFUN(AC_REPLACE_MATHFUNCS, | |
1436 | [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"]) | |
1437 | AC_SUBST(LIBMATHOBJS)dnl | |
1438 | ]) | |
1439 | ||
1440 | ||
1441 | # Check for string functions. | |
1442 | # Ulrich Drepper <drepper@cygnus.com>, 1998. | |
1443 | # | |
1444 | # This file can be copied and used freely without restrictions. It can | |
1445 | # be used in projects which are not available under the GNU Public License | |
1446 | # but which still want to provide support for the GNU gettext functionality. | |
1447 | # Please note that the actual code is *not* freely available. | |
1448 | ||
1449 | # serial 1 | |
1450 | ||
1451 | dnl AC_REPLACE_STRINGFUNCS(FUNCTION...) | |
1452 | AC_DEFUN(AC_REPLACE_STRINGFUNCS, | |
1453 | [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"]) | |
1454 | AC_SUBST(LIBSTRINGOBJS)dnl | |
1455 | ]) | |
29bd52c8 PE |
1456 | |
1457 | ||
1458 | dnl This macro searches for a GNU version of make. If a match is found, the | |
1459 | dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is | |
1460 | dnl set to "#". This is useful for including a special features in a Makefile, | |
1461 | dnl which cannot be handled by other versions of make. The variable | |
1462 | dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists, | |
1463 | dnl the empty string otherwise. | |
1464 | dnl | |
1465 | dnl Here is an example of its use: | |
1466 | dnl | |
1467 | dnl Makefile.in might contain: | |
1468 | dnl | |
1469 | dnl # A failsafe way of putting a dependency rule into a makefile | |
1470 | dnl $(DEPEND): | |
1471 | dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND) | |
1472 | dnl | |
1473 | dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND))) | |
1474 | dnl @ifGNUmake@ include $(DEPEND) | |
1475 | dnl @ifGNUmake@ endif | |
1476 | dnl | |
1477 | dnl Then configure.in would normally contain: | |
1478 | dnl | |
1479 | dnl CHECK_GNU_MAKE() | |
1480 | dnl AC_OUTPUT(Makefile) | |
1481 | dnl | |
1482 | dnl Then perhaps to cause gnu make to override any other make, we could do | |
1483 | dnl something like this (note that GNU make always looks for GNUmakefile first): | |
1484 | dnl | |
1485 | dnl if ! test x$_cv_gnu_make_command = x ; then | |
1486 | dnl mv Makefile GNUmakefile | |
1487 | dnl echo .DEFAULT: > Makefile ; | |
1488 | dnl echo \ $_cv_gnu_make_command \$@ >> Makefile; | |
1489 | dnl fi | |
1490 | dnl | |
1491 | dnl Then, if any (well almost any) other make is called, and GNU make also | |
1492 | dnl exists, then the other make wraps the GNU make. | |
1493 | dnl | |
1494 | dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au> | |
1495 | dnl @version $Id: check_gnu_make.m4,v 1.1 2000/06/15 10:49:36 simons Exp $ | |
1496 | dnl | |
1497 | dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending | |
1498 | dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the | |
1499 | dnl #### conditional's subshell (" --version" is not a command). | |
1500 | dnl #### -pme | |
1501 | AC_DEFUN( | |
1502 | GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command, | |
1503 | _cv_gnu_make_command='' ; | |
1504 | dnl Search all the common names for GNU make | |
1505 | for a in "${MAKE:-make}" make gmake gnumake ; do | |
1506 | if ( $a --version 2> /dev/null | grep -q GNU ) ; then | |
1507 | _cv_gnu_make_command=$a ; | |
1508 | break; | |
1509 | fi | |
1510 | done ; | |
1511 | ) ; | |
1512 | dnl If there was a GNU version, then set @ifGNUmake@ to the empty | |
1513 | dnl string, '#' otherwise | |
1514 | if test "x$_cv_gnu_make_command" != "x" ; then | |
1515 | ifGNUmake='' ; | |
1516 | else | |
1517 | ifGNUmake='#' ; | |
1518 | fi | |
1519 | AC_SUBST(ifGNUmake) | |
1520 | ]) | |
1521 | ||
1522 |