2 dnl Initialize configure bits.
4 dnl Define OPTLEVEL='-O2' if new inlining code present.
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
14 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
15 esac], [multilib=yes])dnl
17 glibcpp_basedir=$auxdir/$1/libstdc++-v3
18 AC_SUBST(glibcpp_basedir)
20 AM_INIT_AUTOMAKE(libstdc++, 2.90.8)
22 # Never versions of autoconf add an underscore to these functions.
23 # Prevent future problems ...
24 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
25 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
26 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
27 ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
31 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
32 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
33 # are probably using a cross compiler, which will not be able to fully
34 # link an executable. This should really be fixed in autoconf
37 AC_DEFUN(LIB_AC_PROG_CC,
38 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
39 dnl Fool anybody using AC_PROG_CC.
40 AC_PROVIDE([AC_PROG_CC])
41 AC_CHECK_PROG(CC, gcc, gcc)
42 if test -z "$CC"; then
43 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
44 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
49 if test $ac_cv_prog_gcc = yes; then
51 dnl Check whether -g works, even if CFLAGS is set, in case the package
52 dnl plays around with CFLAGS (such as to build both debugging and
53 dnl normal versions of a library), tasteless as that idea is.
54 ac_test_CFLAGS="${CFLAGS+set}"
55 ac_save_CFLAGS="$CFLAGS"
58 if test "$ac_test_CFLAGS" = set; then
59 CFLAGS="$ac_save_CFLAGS"
60 elif test $ac_cv_prog_cc_g = yes; then
67 test "${CFLAGS+set}" = set || CFLAGS="-g"
73 # Can't just call these here as g++ requires libstc++ to be built....
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 # Use CXX_libstdcxx so that we do not cause CXX to be cached with the
82 # flags that come in CXX while configuring libstdc++. They're different
83 # from those used for all other target libraries. If CXX is set in
84 # the environment, respect that here.
86 AC_CHECK_PROGS(CXX_libstdcxx, $CCC c++ g++ gcc CC cxx cc++, gcc)
89 test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
93 if test $ac_cv_prog_gxx = yes; then
95 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
96 dnl plays around with CXXFLAGS (such as to build both debugging and
97 dnl normal versions of a library), tasteless as that idea is.
98 ac_test_CXXFLAGS="${CXXFLAGS+set}"
99 ac_save_CXXFLAGS="$CXXFLAGS"
102 if test "$ac_test_CXXFLAGS" = set; then
103 CXXFLAGS="$ac_save_CXXFLAGS"
104 elif test $ac_cv_prog_cxx_g = yes; then
111 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
117 AC_CHECK_TOOL(AS, as)
118 AC_CHECK_TOOL(AR, ar)
119 AC_CHECK_TOOL(RANLIB, ranlib, :)
125 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
126 # at least currently, we never actually build a program, so we never
127 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
128 # fails, because we are probably configuring with a cross compiler
129 # which cant create executables. So we include AC_EXEEXT to keep
130 # automake happy, but we dont execute it, since we dont care about
136 # configure.host sets the following important variables
137 # glibcpp_cflags - host specific C compiler flags
138 # glibcpp_cxxflags - host specific C++ compiler flags
142 . [$]{glibcpp_basedir}/configure.host
144 case [$]{glibcpp_basedir} in
145 /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
146 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
149 # This does for the target what configure.host does for the host. In
150 # addition to modifying the same flags, it also sets up symlinks.
153 GLIBCPP_CFLAGS="[$]{glibcpp_cflags}"
154 GLIBCPP_CXXFLAGS="[$]{glibcpp_cxxflags}"
155 AC_SUBST(GLIBCPP_CFLAGS)
156 AC_SUBST(GLIBCPP_CXXFLAGS)
161 dnl Check to see if g++ can compile this library, and if so, if any version-
162 dnl specific precautions need to be taken.
164 dnl GLIBCPP_CHECK_COMPILER_VERSION
165 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
166 if test ! -f stamp-sanity-compiler; then
167 AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3])
171 #if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
174 ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to gcc-2.95 or above]))
176 AC_MSG_RESULT($gpp_satisfactory)
177 touch stamp-sanity-compiler
183 dnl Test for newer compiler features, or features that are present in newer
184 dnl compiler version but not older compiler versions should be placed
187 dnl Define WFMT_FLAGS='-fdiagnostics-show-location=once' if possible
189 dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
190 dnl new inlining code or the new system_header pragma will die on -Werror.
191 dnl Leave it out by default and use maint-mode to use it.
193 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
194 dnl compiler supports it.
195 dnl GLIBCPP_CHECK_COMPILER_FEATURES
196 AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
197 # All these tests are for C++; save the language and the compiler flags.
198 # The CXXFLAGS thing is suspicious, but based on similar bits
199 # found in GLIBCPP_CONFIGURE.
202 ac_test_CXXFLAGS="${CXXFLAGS+set}"
203 ac_save_CXXFLAGS="$CXXFLAGS"
205 # Check for maintainer-mode bits.
206 if test x"$USE_MAINTAINER_MODE" = xno; then
212 # Check for more sophisticated diagnostic control.
213 AC_MSG_CHECKING([for g++ that supports -fdiagnostics-show-location=once])
214 CXXFLAGS='-Werror -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"
220 # this is the suspicious part
223 if test x"$ac_gabydiags" = x"yes"; then
224 WFMT_FLAGS='-fdiagnostics-show-location=once'
226 AC_MSG_RESULT($ac_gabydiags)
228 # Check for -ffunction-sections -fdata-sections
229 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
230 CXXFLAGS='-Werror -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"
236 # this is the suspicious part
239 if test x"$ac_fdsections" = x"yes" && test x"$enable_debug" = x"no"; then
240 SECTION_FLAGS='-ffunction-sections -fdata-sections'
242 AC_MSG_RESULT($ac_fdsections)
247 AC_SUBST(SECTION_FLAGS)
252 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
253 dnl the native linker is in use, all variables will be defined to something
254 dnl safe (like an empty string).
256 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
257 dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
259 dnl GLIBCPP_CHECK_LINKER_FEATURES
260 AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
261 # If we're not using GNU ld, then there's no point in even trying these
262 # tests. Check for that first. We should have already tested for gld
263 # by now (in libtool), but require it now just to be safe...
266 AC_REQUIRE([AC_PROG_LD])
269 if test "$ac_cv_prog_gnu_ld" = "notbroken"; then
270 # GNU ld it is! Joy and bunny rabbits!
272 # All these tests are for C++; save the language and the compiler flags.
273 # Need to do this so that g++ won't try to link in libstdc++
274 ac_test_CFLAGS="${CFLAGS+set}"
275 ac_save_CFLAGS="$CFLAGS"
276 CFLAGS='-x c++ -Wl,--gc-sections'
278 # Check for -Wl,--gc-sections
279 # XXX This test is broken at the moment, as symbols required for
280 # linking are now in libsupc++ (not built yet.....). In addition,
281 # this test has cored on solaris in the past. In addition,
282 # --gc-sections doesn't really work at the moment (keeps on discarding
283 # used sections, first .eh_frame and now some of the glibc sections for
284 # iconv). Bzzzzt. Thanks for playing, maybe next time.
285 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
293 ], [ac_sectionLDflags=yes],[ac_sectionLFflags=no], [ac_sectionLDflags=yes])
294 if test "$ac_test_CFLAGS" = set; then
295 CFLAGS="$ac_save_CFLAGS"
297 # this is the suspicious part
300 if test "$ac_sectionLDflags" = "yes"; then
301 SECTION_LDFLAGS='-Wl,--gc-sections'
303 AC_MSG_RESULT($ac_sectionLDflags)
306 # Set linker optimization flags.
307 if test x"$ac_cv_prog_gnu_ld" = x"yes" && test x"$enable_debug" = x"no"; then
308 OPT_LDFLAGS='-Wl,-O1'
311 AC_SUBST(SECTION_LDFLAGS)
312 AC_SUBST(OPT_LDFLAGS)
317 dnl Check to see if the (math function) argument passed is
318 dnl declared when using the c++ compiler
319 dnl ASSUMES argument is a math function with ONE parameter
321 dnl GLIBCPP_CHECK_MATH_DECL_1
322 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [
323 AC_MSG_CHECKING([for $1 declaration])
324 if test x${glibcpp_cv_func_$1_use+set} != xset; then
325 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
328 AC_TRY_COMPILE([#include <math.h>],
330 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
334 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
338 dnl Check to see if the (math function) argument passed is
339 dnl 1) declared when using the c++ compiler
340 dnl 2) has "C" linkage
341 dnl 3) if not, see if 1) and 2) for argument prepended with '_'
343 dnl Define HAVE_CARGF etc if "cargf" is declared and links
345 dnl argument 1 is name of function to check
347 dnl ASSUMES argument is a math function with ONE parameter
349 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
350 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
351 GLIBCPP_CHECK_MATH_DECL_1($1)
352 if test x$glibcpp_cv_func_$1_use = x"yes"; then
355 GLIBCPP_CHECK_MATH_DECL_1(_$1)
356 if test x$glibcpp_cv_func__$1_use = x"yes"; then
364 dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
365 dnl of functions at once. It's an all-or-nothing check -- either
366 dnl HAVE_XYZ is defined for each of the functions, or for none of them.
367 dnl Doing it this way saves significant configure time.
368 AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [
369 AC_MSG_CHECKING([for $1 functions])
370 AC_CACHE_VAL(glibcpp_cv_func_$2_use, [
373 AC_TRY_COMPILE([#include <math.h>],
374 [ `for x in $3; do echo "$x (0);"; done` ],
375 [glibcpp_cv_func_$2_use=yes],
376 [glibcpp_cv_func_$2_use=no])
378 AC_MSG_RESULT($glibcpp_cv_func_$2_use)
379 if test x$glibcpp_cv_func_$2_use = x"yes"; then
385 dnl Check to see if the (math function) argument passed is
386 dnl declared when using the c++ compiler
387 dnl ASSUMES argument is a math function with ONE parameter
389 dnl GLIBCPP_CHECK_MATH_DECL_2
390 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [
391 AC_MSG_CHECKING([for $1 declaration])
392 if test x${glibcpp_cv_func_$1_use+set} != xset; then
393 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
396 AC_TRY_COMPILE([#include <math.h>],
398 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
402 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
406 dnl Check to see if the (math function) argument passed is
407 dnl 1) declared when using the c++ compiler
408 dnl 2) has "C" linkage
410 dnl Define HAVE_CARGF etc if "cargf" is declared and links
412 dnl argument 1 is name of function to check
414 dnl ASSUMES argument is a math function with TWO parameters
416 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
417 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
418 GLIBCPP_CHECK_MATH_DECL_2($1)
419 if test x$glibcpp_cv_func_$1_use = x"yes"; then
422 GLIBCPP_CHECK_MATH_DECL_2(_$1)
423 if test x$glibcpp_cv_func__$1_use = x"yes"; then
431 dnl Check to see if the (math function) argument passed is
432 dnl declared when using the c++ compiler
433 dnl ASSUMES argument is a math function with ONE parameter
435 dnl GLIBCPP_CHECK_MATH_DECL_3
436 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [
437 AC_MSG_CHECKING([for $1 declaration])
438 if test x${glibcpp_cv_func_$1_use+set} != xset; then
439 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
442 AC_TRY_COMPILE([#include <math.h>],
444 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
448 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
452 dnl Check to see if the (math function) argument passed is
453 dnl 1) declared when using the c++ compiler
454 dnl 2) has "C" linkage
456 dnl Define HAVE_CARGF etc if "cargf" is declared and links
458 dnl argument 1 is name of function to check
460 dnl ASSUMES argument is a math function with THREE parameters
462 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
463 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
464 GLIBCPP_CHECK_MATH_DECL_3($1)
465 if test x$glibcpp_cv_func_$1_use = x"yes"; then
468 GLIBCPP_CHECK_MATH_DECL_3(_$1)
469 if test x$glibcpp_cv_func__$1_use = x"yes"; then
477 dnl Check to see if the (stdlib function) argument passed is
478 dnl 1) declared when using the c++ compiler
479 dnl 2) has "C" linkage
481 dnl Define HAVE_STRTOLD if "strtold" is declared and links
482 dnl Define HAVE_STRTOF if "strtof" is declared and links
484 dnl argument 1 is name of function to check
486 dnl ASSUMES argument is a math function with TWO parameters
488 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
489 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
490 AC_MSG_CHECKING([for $1 declaration])
491 if test x${glibcpp_cv_func_$1_use+set} != xset; then
492 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
495 AC_TRY_COMPILE([#include <stdlib.h>],
497 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
501 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
502 if test x$glibcpp_cv_func_$1_use = x"yes"; then
509 dnl Because the builtins are picky picky picky about the arguments they take,
510 dnl do an explict linkage tests here.
511 dnl Check to see if the (math function) argument passed is
512 dnl 1) declared when using the c++ compiler
513 dnl 2) has "C" linkage
515 dnl Define HAVE_CARGF etc if "cargf" is declared and links
517 dnl argument 1 is name of function to check
519 dnl ASSUMES argument is a math function with ONE parameter
521 dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
522 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
523 AC_MSG_CHECKING([for $1 declaration])
524 if test x${glibcpp_cv_func_$1_use+set} != xset; then
525 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
528 AC_TRY_COMPILE([#include <math.h>],
530 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
534 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
535 if test x$glibcpp_cv_func_$1_use = x"yes"; then
536 AC_MSG_CHECKING([for $1 linkage])
537 if test x${glibcpp_cv_func_$1_link+set} != xset; then
538 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
539 AC_TRY_LINK([#include <math.h>],
541 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
544 AC_MSG_RESULT($glibcpp_cv_func_$1_link)
545 if test x$glibcpp_cv_func_$1_link = x"yes"; then
546 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
547 AC_DEFINE_UNQUOTED(${ac_tr_func})
554 dnl Check to see what builtin math functions are supported
556 dnl check for __builtin_abs
557 dnl check for __builtin_fabsf
558 dnl check for __builtin_fabs
559 dnl check for __builtin_fabl
560 dnl check for __builtin_labs
561 dnl check for __builtin_sqrtf
562 dnl check for __builtin_sqrtl
563 dnl check for __builtin_fsqrt
564 dnl check for __builtin_sinf
565 dnl check for __builtin_sin
566 dnl check for __builtin_sinl
567 dnl check for __builtin_cosf
568 dnl check for __builtin_cos
569 dnl check for __builtin_cosl
571 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
572 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
573 dnl Test for builtin math functions.
574 dnl These are made in gcc/c-common.c
575 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
576 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
577 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
578 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
579 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
581 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
582 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fsqrt)
583 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
585 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
586 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
587 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
589 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
590 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
591 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
593 dnl There is, without a doubt, a more elegant way to have these
594 dnl names exported so that they won't be stripped out of acconfig.h by
595 dnl autoheader. I leave this as an exercise to somebody less frustrated
596 dnl than I.... please email the libstdc++ list if you can figure out a
597 dnl more elegant approach (see autoconf/acgen.m4 and specifically
598 dnl AC_CHECK_FUNC for things to steal.)
600 if test x$dummyvar = x"yes"; then
601 AC_DEFINE(HAVE___BUILTIN_ABS)
602 AC_DEFINE(HAVE___BUILTIN_LABS)
603 AC_DEFINE(HAVE___BUILTIN_COS)
604 AC_DEFINE(HAVE___BUILTIN_COSF)
605 AC_DEFINE(HAVE___BUILTIN_COSL)
606 AC_DEFINE(HAVE___BUILTIN_FABS)
607 AC_DEFINE(HAVE___BUILTIN_FABSF)
608 AC_DEFINE(HAVE___BUILTIN_FABSL)
609 AC_DEFINE(HAVE___BUILTIN_SIN)
610 AC_DEFINE(HAVE___BUILTIN_SINF)
611 AC_DEFINE(HAVE___BUILTIN_SINL)
612 AC_DEFINE(HAVE___BUILTIN_FSQRT)
613 AC_DEFINE(HAVE___BUILTIN_SQRTF)
614 AC_DEFINE(HAVE___BUILTIN_SQRTL)
620 dnl Check to see what the underlying c library
621 dnl These checks need to do two things:
622 dnl 1) make sure the name is declared when using the c++ compiler
623 dnl 2) make sure the name has "C" linkage
624 dnl This might seem like overkill but experience has shown that it's not...
626 dnl Define HAVE_STRTOF etc if "strtof" is found.
627 dnl Define HAVE_STRTOLD etc if "strtold" is found.
629 dnl GLIBCPP_CHECK_STDLIB_SUPPORT
630 AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
631 ac_test_CXXFLAGS="${CXXFLAGS+set}"
632 ac_save_CXXFLAGS="$CXXFLAGS"
633 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
635 AC_CHECK_FUNCS(strtof)
636 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
638 CXXFLAGS="$ac_save_CXXFLAGS"
643 dnl Check to see what the underlying c library or math library is like.
644 dnl These checks need to do two things:
645 dnl 1) make sure the name is declared when using the c++ compiler
646 dnl 2) make sure the name has "C" linkage
647 dnl This might seem like overkill but experience has shown that it's not...
649 dnl Define HAVE_CARGF etc if "cargf" is found.
651 dnl GLIBCPP_CHECK_MATH_SUPPORT
652 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
653 ac_test_CXXFLAGS="${CXXFLAGS+set}"
654 ac_save_CXXFLAGS="$CXXFLAGS"
655 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
658 AC_CHECK_LIB(m, sin, libm="-lm")
662 dnl Check to see if certain C math functions exist.
663 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
664 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
665 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
666 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
667 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
668 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
669 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
671 dnl Check to see if basic C math functions have float versions.
672 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig,
677 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
680 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
681 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
682 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
683 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
684 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
685 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
686 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
687 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
688 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
689 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
690 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
691 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
692 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
694 dnl Check to see if basic C math functions have long double versions.
695 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig,
700 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round,
703 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
704 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
705 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
706 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
707 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
708 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
709 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
710 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
711 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
712 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
713 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
714 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
715 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
716 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
717 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
718 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
720 dnl Some runtimes have these functions with a preceding underscore. Please
721 dnl keep this sync'd with the one above. And if you add any new symbol,
722 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
723 dnl Check to see if certain C math functions exist.
725 dnl Check to see if basic C math functions have float versions.
726 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
728 _acosf _asinf _atanf \
730 _coshf _sinhf _tanhf)
731 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
735 dnl Check to see if basic C math functions have long double versions.
736 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
738 _acosl _asinl _atanl \
740 _coshl _sinhl _tanhl)
741 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
746 CXXFLAGS="$ac_save_CXXFLAGS"
751 dnl Check to see if there is native support for complex
753 dnl Don't compile bits in math/* if native support exits.
755 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "atan2l/copysignl" is found.
757 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
758 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
759 dnl Check for complex versions of math functions of platform.
760 AC_CHECK_LIB(m, main)
761 AC_REPLACE_MATHFUNCS(nan hypot hypotf atan2f expf copysignf)
763 dnl Compile the long double complex functions only if the function
764 dnl provides the non-complex long double functions that are needed.
765 dnl Currently this includes copysignl and atan2l, which should be
766 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
767 USE_COMPLEX_LONG_DOUBLE=no
768 if test x$ac_cv_func_atan2l = x"yes" \
769 && test x$ac_cv_func_copysignl = x"yes"; then
770 USE_COMPLEX_LONG_DOUBLE=yes
771 AC_REPLACE_MATHFUNCS(hypotl signbitl)
774 AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
778 dnl Check to see what architecture and operating system we are compiling
779 dnl for. Also, if architecture- or OS-specific flags are required for
780 dnl compilation, pick them up here.
782 dnl GLIBCPP_CHECK_TARGET
783 AC_DEFUN(GLIBCPP_CHECK_TARGET, [
784 . [$]{glibcpp_basedir}/configure.target
785 AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
786 AC_MSG_RESULT(OS config directory is $os_include_dir)
787 AC_LINK_FILES($os_include_dir/bits/os_defines.h, include/bits/os_defines.h)
792 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
793 dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
794 dnl must have been previously checked.)
796 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
797 dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h
799 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
800 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
802 dnl Test wchar.h for mbstate_t, which is needed for char_traits and
803 dnl others even if wchar_t support is not on.
804 AC_MSG_CHECKING([for mbstate_t])
805 AC_TRY_COMPILE([#include <wchar.h>],
806 [mbstate_t teststate;],
807 have_mbstate_t=yes, have_mbstate_t=no)
808 AC_MSG_RESULT($have_mbstate_t)
809 if test x"$have_mbstate_t" = xyes; then
810 AC_DEFINE(HAVE_MBSTATE_T)
813 dnl Sanity check for existence of ISO C99 headers for extended encoding.
814 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
815 AC_CHECK_HEADER(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
817 dnl Only continue checking if the ISO C99 headers exist and support is on.
818 if test x"$ac_has_wchar_h" = xyes && test x"$ac_has_wctype_h" = xyes \
819 && test x"$enable_c_mbchar" != xno; then
821 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
822 dnl numeric_limits can instantiate type_traits<wchar_t>
823 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
824 AC_TRY_COMPILE([#include <wchar.h>],
825 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
826 has_wchar_minmax=yes, has_wchar_minmax=no)
827 AC_MSG_RESULT($has_wchar_minmax)
829 dnl Test wchar.h for WEOF, which is what we use to determine whether
830 dnl to specialize for char_traits<wchar_t> or not.
831 AC_MSG_CHECKING([for WEOF])
834 #include <stddef.h>],
836 has_weof=yes, has_weof=no)
837 AC_MSG_RESULT($has_weof)
839 dnl Tests for wide character functions used in char_traits<wchar_t>.
840 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset \
841 wcsrtombs mbsrtowcs, ac_wfuncs=yes, ac_wfuncs=no)
843 AC_MSG_CHECKING([for ISO C99 wchar_t support])
844 if test x"$has_weof" = xyes && test x"$has_wchar_minmax" = xyes \
845 && test x"$ac_wfuncs" = xyes; then
846 ac_isoC99_wchar_t=yes
850 AC_MSG_RESULT($ac_isoC99_wchar_t)
852 dnl Use iconv for wchar_t to char conversions. As such, check for
853 dnl X/Open Portability Guide, version 2 features (XPG2).
854 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
855 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
857 dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
858 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
860 LIBS="$LIBS $libiconv"
862 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
863 ac_XPG2funcs=yes, ac_XPG2funcs=no)
867 AC_MSG_CHECKING([for XPG2 wchar_t support])
868 if test x"$ac_has_iconv_h" = xyes && test x"$ac_has_langinfo_h" = xyes \
869 && test x"$ac_XPG2funcs" = xyes; then
874 AC_MSG_RESULT($ac_XPG2_wchar_t)
876 dnl At the moment, only enable wchar_t specializations if all the
877 dnl above support is present.
878 AC_MSG_CHECKING([for enabled wchar_t specializations])
879 if test x"$ac_isoC99_wchar_t" = xyes \
880 && test x"$ac_XPG2_wchar_t" = xyes; then
881 libinst_wstring_la="libinst-wstring.la"
882 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
885 libinst_wstring_la=""
888 AC_SUBST(libinst_wstring_la)
891 dnl Wide characters disabled by the user.
892 AC_MSG_WARN([wchar_t support disabled.])
898 dnl Check to see if this version of GNU C++ is afflicted by bugs in
899 dnl __complex__ float support.
901 dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
903 dnl Check to see if this version of GNU C++ is afflicted by bugs in
904 dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
905 dnl gcc-2.95.x when using the library, unless we define the default copy
906 dnl ctor in the specializations of complex<>.
908 dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
909 dnl GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT
910 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT, [
911 AC_REQUIRE([AC_PROG_CXX])
913 AC_MSG_CHECKING([for GNU C++ __complex__ support])
914 AC_CACHE_VAL(glibcpp_cv_complex, [
917 AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
918 dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
919 [ dcomplex x; f(x); ],
920 glibcpp_cv_complex=ok,
921 glibcpp_cv_complex=buggy
925 AC_MSG_RESULT($glibcpp_cv_complex)
926 if test $glibcpp_cv_complex = buggy; then
927 AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
930 AC_MSG_CHECKING([for GNU C++ __complex__ float support])
931 AC_CACHE_VAL(glibcpp_cv_float_complex, [
935 cat > conftest.h <<EOB
937 // Check for buggy __complex__ that causes ICE in most versions of egcs
938 // and gcc-2.95.x on certain platforms (eg., x86-win32).
940 // See http://gcc.gnu.org/ml/gcc-bugs/1999-07n/msg00845.html for
941 // more info on the bug itself.
946 __complex__ float m_value;
947 float_complex (float = 0.0f, float = 0.0f);
948 float_complex (__complex__ float val) : m_value (val) {}
949 float_complex foo (const float_complex &val)
950 { return float_complex (~val.m_value); }
953 AC_TRY_COMPILE([#include "conftest.h"], ,
954 glibcpp_cv_float_complex=ok,
955 glibcpp_cv_float_complex=buggy
959 AC_MSG_RESULT($glibcpp_cv_float_complex)
960 if test $glibcpp_cv_float_complex = buggy; then
961 AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
967 dnl Check for special debugging mode; not for production use.
969 dnl GLIBCPP_ENABLE_DEBUG
970 dnl --enable-debug sets '-ggdb3 -O0'.
971 dnl --disable-debug sets '-g' and whatever optimization options the
972 dnl compiler can handle.
973 dnl + --enable-maintainer-mode automatically defaults this to on.
974 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
975 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
976 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
977 dnl defaults to `no'.
978 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
979 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
981 changequote(<<, >>)dnl
982 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
984 [case "${enableval}" in
985 yes) enable_debug=yes ;;
986 no) enable_debug=no ;;
987 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
989 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
991 dnl Option parsed, now set things appropriately
992 case "${enable_debug}" in
994 DEBUG_FLAGS='-O0 -ggdb3'
1000 AC_SUBST(DEBUG_FLAGS)
1005 dnl Check for "unusual" flags to pass to the compiler while building.
1007 dnl GLIBCPP_ENABLE_CXX_FLAGS
1008 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1009 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1010 dnl Somehow this same set of flags must be passed when [re]building
1012 dnl --disable-cxx-flags passes nothing.
1013 dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
1014 dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
1015 dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
1016 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
1017 dnl If "default flags" is an empty string (or "none"), the effect is
1018 dnl the same as --disable or --enable=no.
1019 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1020 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1021 AC_ARG_ENABLE(cxx-flags,
1022 changequote(<<, >>)dnl
1023 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
1024 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1025 changequote([, ])dnl
1026 [case "x$enableval" in
1028 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1030 enable_cxx_flags='' ;;
1032 enable_cxx_flags="$enableval" ;;
1034 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
1036 dnl Thinko on my part during design. This kludge is the workaround.
1037 if test "$enable_cxx_flags" = "none"; then
1038 enable_cxx_flags='';
1041 dnl Run through flags (either default or command-line) and set anything
1042 dnl extra (e.g., #defines) that must accompany particular g++ options.
1043 if test -n "$enable_cxx_flags"; then
1044 for f in $enable_cxx_flags; do
1048 *) # and we're trying to pass /what/ exactly?
1049 AC_MSG_ERROR([compiler flags start with a -]) ;;
1053 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1054 AC_SUBST(EXTRA_CXX_FLAGS)
1059 dnl Check for which locale library to use: gnu or generic.
1061 dnl GLIBCPP_ENABLE_CLOCALE
1062 dnl --enable-clocale=gnu sets config/c_locale_gnu.cc and friends
1063 dnl --enable-clocale=generic sets config/c_locale_generic.cc and friends
1065 dnl default is generic
1067 AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
1068 AC_MSG_CHECKING([for clocale to use])
1069 AC_ARG_ENABLE(clocale,
1070 [ --enable-clocale enable model for target locale package.
1071 --enable-clocale=MODEL use MODEL target-speific locale package. [default=generic]
1073 if test x$enable_clocale = xno; then
1074 enable_clocale=generic
1076 enable_clocale=generic)
1078 enable_clocale_flag=$enable_clocale
1080 dnl Check if a valid locale package
1081 case x${enable_clocale_flag} in
1083 CLOCALE_H=config/c_locale_gnu.h
1084 CLOCALE_CC=config/c_locale_gnu.cc
1088 CLOCALE_H=config/c_locale_generic.h
1089 CLOCALE_CC=config/c_locale_generic.cc
1090 AC_MSG_RESULT(generic)
1093 echo "$enable_clocale is an unknown locale package" 1>&2
1098 AC_LINK_FILES($CLOCALE_H, include/bits/c++locale.h)
1099 AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
1104 dnl Check for which I/O library to use: libio, or something specific.
1106 dnl GLIBCPP_ENABLE_CSTDIO
1107 dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
1109 dnl default is stdio
1111 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1112 AC_MSG_CHECKING([for cstdio to use])
1113 AC_ARG_ENABLE(cstdio,
1114 [ --enable-cstdio enable stdio for target io package.
1115 --enable-cstdio=LIB use LIB target-speific io package. [default=stdio]
1117 if test x$enable_cstdio = xno; then
1120 enable_cstdio=stdio)
1122 enable_cstdio_flag=$enable_cstdio
1124 dnl Check if a valid I/O package
1125 case x${enable_cstdio_flag} in
1127 CSTDIO_H=config/c_io_libio.h
1128 CSTDIO_CC=config/c_io_libio.cc
1129 AC_MSG_RESULT(libio)
1131 # see if we are on a system with libio native (ie, linux)
1132 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1134 # Need to check and see what version of glibc is being used. If
1135 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1136 # compile most of libio for linux systems.
1137 if test x$has_libio = x"yes"; then
1140 AC_MSG_CHECKING([for glibc version >= 2.2])
1141 AC_EGREP_CPP([ok], [
1142 #include <features.h>
1143 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1146 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1147 AC_MSG_RESULT($glibc_satisfactory)
1151 # XXX at the moment, admit defeat and force the recompilation
1152 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
1153 glibc_satisfactory=no
1155 if test x$glibc_satisfactory = x"yes"; then
1160 # bkoz XXX need to add checks to enable this
1161 # pme XXX here's a first pass at such a check
1162 if test x$enable_c_mbchar != xno; then
1170 # Using libio, but <libio.h> doesn't exist on the target system. . .
1172 # bkoz XXX need to add checks to enable this
1173 # pme XXX here's a first pass at such a check
1174 if test x$enable_c_mbchar != xno; then
1181 xstdio | x | xno | xnone | xyes)
1183 CSTDIO_H=config/c_io_stdio.h
1184 CSTDIO_CC=config/c_io_stdio.cc
1185 AC_MSG_RESULT(stdio)
1187 # We're not using stdio.
1190 # Wide characters are not supported with this package.
1194 echo "$enable_cstdio is an unknown io package" 1>&2
1198 AC_LINK_FILES($CSTDIO_H, include/bits/c++io.h)
1199 AC_LINK_FILES($CSTDIO_CC, src/c++io.cc)
1201 # 2000-08-04 bkoz hack
1202 CCODECVT_C=config/c_io_libio_codecvt.c
1203 AC_LINK_FILES($CCODECVT_C, libio/c_codecvt.c)
1204 # 2000-08-04 bkoz hack
1206 AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO,
1207 test "$need_libio" = yes || test "$need_wlibio" = yes)
1208 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1209 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1210 if test "$need_libio" = yes || test "$need_wlibio" = yes; then
1211 libio_la=../libio/libio.la
1220 dnl Check for which threading library to use.
1222 dnl GLIBCPP_ENABLE_THREADS
1223 dnl --enable-threads=posix sets config/threads-posix.h et. al.
1225 dnl Default is no threads, which also disables _IO_MTSAFE_IO in
1226 dnl libio. Any actual thread package will enable it.
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. [default=no]
1236 if test x$enable_threads = xno; then
1241 enable_threads_flag=$enable_threads
1243 dnl Check if a valid thread package
1244 case x${enable_threads_flag} in
1247 target_thread_file='single'
1251 target_thread_file='posix'
1253 xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
1254 xsolaris | xwin32 | xdce | xvxworks)
1255 target_thread_file=$enable_threads_flag
1258 echo "$enable_threads is an unknown thread package" 1>&2
1263 dnl Check for thread package actually supported in libstdc++
1265 case "$target_thread_file" in
1267 THREADH=threads-no.h
1270 THREADH=threads-posix.h
1272 decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
1273 AC_MSG_ERROR(thread package $THREADS not yet supported)
1276 AC_MSG_ERROR($THREADS is an unsupported/unknown thread package)
1279 AC_MSG_RESULT($THREADH)
1281 AC_LINK_FILES(config/$THREADH, include/bits/c++threads.h)
1282 if test $THREADH != threads-no.h; then
1283 AC_DEFINE(_GLIBCPP_USE_THREADS)
1289 dnl Check for template specializations for the 'long long' type extension.
1291 dnl GLIBCPP_ENABLE_LONG_LONG
1292 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1293 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1294 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1295 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1296 dnl defaults to `no'.
1297 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1299 dnl GLIBCPP_ENABLE_LONG_LONG
1300 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1301 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1303 AC_ARG_ENABLE(long-long,
1304 changequote(<<, >>)dnl
1305 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1306 changequote([, ])dnl
1307 [case "$enableval" in
1308 yes) enable_long_long=yes ;;
1309 no) enable_long_long=no ;;
1310 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1312 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1314 # Allow use of os-dependent settings, so that macros that turn on
1315 # C99 capabilities can be defined and used in a consistent way.
1316 OS_INC_PATH=${srcdir}/$os_include_dir
1317 ac_test_CFLAGS="${CFLAGS+set}"
1318 ac_save_CFLAGS="$CFLAGS"
1319 CFLAGS="-I$OS_INC_PATH"
1321 # Check for the existence of functions used if long long is enabled.
1322 AC_CHECK_FUNC(strtoll,,ac_strtoll=no)
1323 AC_CHECK_FUNC(strtoull,,ac_strtoull=no)
1325 # Check for lldiv_t, et. al.
1326 AC_MSG_CHECKING([for lldiv_t declaration])
1327 AC_CACHE_VAL(glibcpp_lldiv_t_use, [
1328 AC_TRY_COMPILE([#include <bits/os_defines.h>
1329 #include <stdlib.h>],
1331 [glibcpp_lldiv_t_use=yes], [glibcpp_lldiv_t_use=no])
1333 AC_MSG_RESULT($glibcpp_lldiv_t_use)
1334 if test x$glibcpp_lldiv_t_use = x"yes"; then
1335 AC_DEFINE(HAVE_LLDIV_T)
1338 AC_MSG_CHECKING([for enabled long long])
1339 if test x"$ac_strtoll" = xno || test x"$ac_strtoull" = xno; then
1340 enable_long_long=no;
1342 AC_MSG_RESULT($enable_long_long)
1344 # Option parsed, now set things appropriately
1345 if test x"$enable_long_long" = xyes; then
1346 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1350 CFLAGS="$ac_save_CFLAGS"
1355 dnl Check for what kind of C headers to use.
1357 dnl GLIBCPP_ENABLE_CHEADERS
1358 dnl --enable-cheaders= [does stuff].
1359 dnl --disable-cheaders [does not do anything, really].
1360 dnl + This will eventually need to be 'c_shadow' by default.
1361 dnl + Usage: GLIBCPP_ENABLE_CHEADERS[(DEFAULT)]
1362 dnl Where DEFAULT is either `c' or `c_std' or 'c_shadow'.
1363 dnl If ommitted, it defaults to `c_std'.
1364 AC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl
1365 define([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl
1366 AC_MSG_CHECKING([for c header strategy to use])
1367 AC_ARG_ENABLE(cheaders,
1368 changequote(<<, >>)dnl
1369 << --enable-cheaders construct "C" header files for
1370 g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT],
1372 [case "$enableval" in
1377 enable_cheaders=c_std
1380 enable_cheaders=c_shadow
1382 *) AC_MSG_ERROR([Unknown argument to enable/disable "C" headers])
1385 enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT)
1386 AC_MSG_RESULT($enable_cheaders)
1388 dnl Option parsed, now set things appropriately
1389 case "$enable_cheaders" in
1391 CSHADOW_FLAGS="-fno-builtin"
1392 C_INCLUDE_DIR='${top_srcdir}/include/c_shadow'
1393 AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
1397 C_INCLUDE_DIR='${top_srcdir}/include/c_std'
1401 C_INCLUDE_DIR='${top_srcdir}/include/c'
1405 AC_SUBST(CSHADOW_FLAGS)
1406 AC_SUBST(C_INCLUDE_DIR)
1407 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cheaders" = c_shadow)
1412 dnl Check for wide character support. Has the same effect as the option
1413 dnl in gcc's configure, but in a form that autoconf can mess with.
1415 dnl GLIBCPP_ENABLE_C_MBCHAR
1416 dnl --enable-c-mbchar requests all the wchar_t stuff.
1417 dnl --disable-c-mbchar doesn't.
1418 dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1419 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1420 dnl defaults to `no'.
1421 AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1422 define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1423 AC_ARG_ENABLE(c-mbchar,
1424 changequote(<<, >>)dnl
1425 << --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1426 changequote([, ])dnl
1427 [case "$enableval" in
1428 yes) enable_c_mbchar=yes ;;
1429 no) enable_c_mbchar=no ;;
1430 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1432 enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1433 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1438 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1440 dnl GLIBCPP_INCLUDE_DIR
1442 dnl TOPLEVEL_INCLUDES
1443 dnl LIBMATH_INCLUDES
1444 dnl LIBSUPCXX_INCLUDES
1446 dnl CSHADOW_INCLUDES
1448 dnl GLIBCPP_EXPORT_INCLUDE
1449 AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1450 # Root level of the include sources.
1451 GLIBCPP_INCLUDE_DIR='$(top_srcdir)/include'
1453 # Can either use include/c or include/c_std to grab "C" headers. This
1454 # variable is set to the include directory currently in use.
1455 # set with C_INCLUDE_DIR in GLIBCPP_ENABLE_CHEADERS
1457 # Passed down for canadian crosses.
1458 if test x"$CANADIAN" = xyes; then
1459 TOPLEVEL_INCLUDES='-I$(includedir)'
1462 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1464 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1466 #if GLIBCPP_NEED_LIBIO
1467 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1469 #LIBIO_INCLUDES='-I$(top_srcdir)/libio'
1472 #if GLIBCPP_USE_CSHADOW
1473 # CSHADOW_INCLUDES='-I$(GLIBCPP_INCLUDE_DIR)/std -I$(C_INCLUDE_DIR) \
1474 # -I$(top_blddir)/cshadow'
1476 CSTD_INCLUDES='-I$(GLIBCPP_INCLUDE_DIR)/std -I$(C_INCLUDE_DIR)'
1479 # Now, export this to all the little Makefiles....
1480 AC_SUBST(GLIBCPP_INCLUDE_DIR)
1481 AC_SUBST(TOPLEVEL_INCLUDES)
1482 AC_SUBST(LIBMATH_INCLUDES)
1483 AC_SUBST(LIBSUPCXX_INCLUDES)
1484 AC_SUBST(LIBIO_INCLUDES)
1485 AC_SUBST(CSTD_INCLUDES)
1490 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1492 AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1493 # Optimization flags that are probably a good idea for thrill-seekers. Just
1494 # uncomment the lines below and make, everything else is ready to go...
1495 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1497 AC_SUBST(OPTIMIZE_CXXFLAGS)
1499 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1500 AC_SUBST(WARN_FLAGS)
1504 dnl GLIBCPP_EXPORT_INSTALL_INFO
1505 dnl calculates gxx_install_dir
1507 AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
1509 AC_MSG_CHECKING([for interface version number])
1510 libstdcxx_interface=$INTERFACE
1511 AC_MSG_RESULT($libstdcxx_interface)
1513 # Process the option --with-gxx-include-dir=<path to include-files directory>
1514 AC_MSG_CHECKING([for --with-gxx-include-dir])
1515 AC_ARG_WITH(gxx-include-dir,
1516 [ --with-gxx-include-dir the installation directory for include files],
1517 [case "${withval}" in
1519 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
1526 gxx_include_dir=${withval}
1528 esac], [gxx_include_dir=no])
1529 AC_MSG_RESULT($gxx_include_dir)
1531 # Process the option "--enable-version-specific-runtime-libs"
1532 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
1533 AC_ARG_ENABLE(version-specific-runtime-libs,
1534 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
1535 [ version_specific_libs=yes
1536 # Need the gcc compiler version to know where to install libraries
1537 # and header files if --enable-version-specific-runtime-libs option
1540 gcc_tmp=`grep version_string ${srcdir}/../gcc/version.c | awk '{print $6}'`
1541 gcc_num=`echo ${gcc_tmp} | sed 's/\"//g'`
1542 gcc_version=$gcc_num
1543 gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/$(gcc_version)/include/g++'
1545 AC_SUBST(gcc_version)
1546 AM_CONDITIONAL(VERSION_SPECIFIC_LIBS, test x"$version_specific_libs" = x"yes")
1547 ],version_specific_libs=no)
1548 AC_MSG_RESULT($version_specific_libs)
1550 AC_MSG_CHECKING([for install location])
1551 if test x"$version_specific_libs" = x"no" \
1552 && test x"$gxx_include_dir"=x"no"; then
1553 gxx_include_dir=${prefix}/include/g++-${libstdcxx_interface}
1555 AC_MSG_RESULT($gxx_include_dir)
1556 AC_SUBST(gxx_include_dir)
1560 # Check whether LC_MESSAGES is available in <locale.h>.
1561 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1563 # This file file be copied and used freely without restrictions. It can
1564 # be used in projects which are not available under the GNU Public License
1565 # but which still want to provide support for the GNU gettext functionality.
1566 # Please note that the actual code is *not* freely available.
1570 AC_DEFUN(AC_LC_MESSAGES, [
1571 AC_CHECK_HEADER(locale.h, [
1572 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1573 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1574 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1575 if test $ac_cv_val_LC_MESSAGES = yes; then
1576 AC_DEFINE(HAVE_LC_MESSAGES)
1582 # Check for functions in math library.
1583 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1585 # This file can be copied and used freely without restrictions. It can
1586 # be used in projects which are not available under the GNU Public License
1587 # but which still want to provide support for the GNU gettext functionality.
1588 # Please note that the actual code is *not* freely available.
1592 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1593 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1594 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1595 AC_SUBST(LIBMATHOBJS)dnl
1599 # Check for string functions.
1600 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1602 # This file can be copied and used freely without restrictions. It can
1603 # be used in projects which are not available under the GNU Public License
1604 # but which still want to provide support for the GNU gettext functionality.
1605 # Please note that the actual code is *not* freely available.
1609 dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1610 AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1611 [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1612 AC_SUBST(LIBSTRINGOBJS)dnl
1616 dnl This macro searches for a GNU version of make. If a match is found, the
1617 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1618 dnl set to "#". This is useful for including a special features in a Makefile,
1619 dnl which cannot be handled by other versions of make. The variable
1620 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1621 dnl the empty string otherwise.
1623 dnl Here is an example of its use:
1625 dnl Makefile.in might contain:
1627 dnl # A failsafe way of putting a dependency rule into a makefile
1629 dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1631 dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1632 dnl @ifGNUmake@ include $(DEPEND)
1633 dnl @ifGNUmake@ endif
1635 dnl Then configure.in would normally contain:
1637 dnl CHECK_GNU_MAKE()
1638 dnl AC_OUTPUT(Makefile)
1640 dnl Then perhaps to cause gnu make to override any other make, we could do
1641 dnl something like this (note that GNU make always looks for GNUmakefile first):
1643 dnl if ! test x$_cv_gnu_make_command = x ; then
1644 dnl mv Makefile GNUmakefile
1645 dnl echo .DEFAULT: > Makefile ;
1646 dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1649 dnl Then, if any (well almost any) other make is called, and GNU make also
1650 dnl exists, then the other make wraps the GNU make.
1652 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1653 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
1655 dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1656 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1657 dnl #### conditional's subshell (" --version" is not a command), using a
1658 dnl #### different option to grep(1).
1660 dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not
1661 dnl #### ${MAKE:-make}).
1664 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1665 _cv_gnu_make_command='' ;
1666 dnl Search all the common names for GNU make
1667 for a in "${MAKE-make}" make gmake gnumake ; do
1668 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
1670 _cv_gnu_make_command=$a ;
1675 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1676 dnl string, '#' otherwise
1677 if test "x$_cv_gnu_make_command" != "x" ; then
1685 sinclude(../libtool.m4)
1686 dnl The lines below arrange for aclocal not to bring an installed
1687 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1688 dnl add a definition of LIBTOOL to Makefile.in.
1689 ifelse(,,,[AC_SUBST(LIBTOOL)
1690 AC_DEFUN([AM_PROG_LIBTOOL])
1691 AC_DEFUN([AC_LIBTOOL_DLOPEN])
1692 AC_DEFUN([AC_PROG_LD])