2 dnl Initialize configure bits.
5 AC_DEFUN(GLIBCPP_CONFIGURE, [
6 dnl Default to --enable-multilib
7 AC_ARG_ENABLE(multilib,
8 [ --enable-multilib build hella library versions (default)],
9 [case "${enableval}" in
12 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
13 esac], [multilib=yes])dnl
15 # When building with srcdir == objdir, links to the source files will
16 # be created in directories within the target_subdir. We have to
17 # adjust toplevel_srcdir accordingly, so that configure finds
18 # install-sh and other auxiliary files that live in the top-level
20 if test "${srcdir}" = "."; then
21 if test -z "${with_target_subdir}"; then
24 if test "${with_target_subdir}" != "."; then
25 toprel="${with_multisrctop}../.."
27 toprel="${with_multisrctop}.."
33 AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
34 toplevel_srcdir=\${top_srcdir}/$toprel
35 AC_SUBST(toplevel_srcdir)
37 # Export build and source directories.
38 # These need to be absolute paths, yet at the same time need to
39 # canonicalize only relative paths, because then amd will not unmount
40 # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
41 glibcpp_builddir=`pwd`
43 [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
44 *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
46 AC_SUBST(glibcpp_builddir)
47 AC_SUBST(glibcpp_srcdir)
49 dnl This is here just to satisfy automake.
50 ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)])
52 # Will set LN_S to either 'ln -s' or 'ln'. With autoconf 2.50+, can also
53 # be 'cp -p' if linking isn't available.
54 #ac_cv_prog_LN_S='cp -p'
57 # We use these options to decide which functions to include.
58 AC_ARG_WITH(target-subdir,
59 [ --with-target-subdir=SUBDIR
60 configuring in a subdirectory])
61 AC_ARG_WITH(cross-host,
62 [ --with-cross-host=HOST configuring with a cross compiler])
64 glibcpp_basedir=$srcdir/$toprel/$1/libstdc++-v3
65 AC_SUBST(glibcpp_basedir)
67 # Never versions of autoconf add an underscore to these functions.
68 # Prevent future problems ...
69 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
70 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
71 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
72 ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
76 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
77 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
78 # are probably using a cross compiler, which will not be able to fully
79 # link an executable. This should really be fixed in autoconf
82 AC_DEFUN(LIB_AC_PROG_CC,
83 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
84 dnl Fool anybody using AC_PROG_CC.
85 AC_PROVIDE([AC_PROG_CC])
86 AC_CHECK_PROG(CC, gcc, gcc)
87 if test -z "$CC"; then
88 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
89 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
94 if test $ac_cv_prog_gcc = yes; then
96 dnl Check whether -g works, even if CFLAGS is set, in case the package
97 dnl plays around with CFLAGS (such as to build both debugging and
98 dnl normal versions of a library), tasteless as that idea is.
99 ac_test_CFLAGS="${CFLAGS+set}"
100 ac_save_CFLAGS="$CFLAGS"
103 if test "$ac_test_CFLAGS" = set; then
104 CFLAGS="$ac_save_CFLAGS"
105 elif test $ac_cv_prog_cc_g = yes; then
112 test "${CFLAGS+set}" = set || CFLAGS="-g"
118 # Can't just call these here as g++ requires libstc++ to be built....
121 # Likewise for AC_PROG_CXX.
122 AC_DEFUN(LIB_AC_PROG_CXX,
123 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
124 dnl Fool anybody using AC_PROG_CXX.
125 AC_PROVIDE([AC_PROG_CXX])
126 # Use glibcpp_CXX so that we do not cause CXX to be cached with the
127 # flags that come in CXX while configuring libstdc++. They're different
128 # from those used for all other target libraries. If CXX is set in
129 # the environment, respect that here.
131 AC_CHECK_PROGS(glibcpp_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
132 AC_SUBST(glibcpp_CXX)
134 test -z "$glibcpp_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
138 if test $ac_cv_prog_gxx = yes; then
140 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
141 dnl plays around with CXXFLAGS (such as to build both debugging and
142 dnl normal versions of a library), tasteless as that idea is.
143 ac_test_CXXFLAGS="${CXXFLAGS+set}"
144 ac_save_CXXFLAGS="$CXXFLAGS"
147 if test "$ac_test_CXXFLAGS" = set; then
148 CXXFLAGS="$ac_save_CXXFLAGS"
149 elif test $ac_cv_prog_cxx_g = yes; then
156 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
162 # For some reason, gettext needs this.
165 AC_CHECK_TOOL(AS, as)
166 AC_CHECK_TOOL(AR, ar)
167 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
172 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
173 # at least currently, we never actually build a program, so we never
174 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
175 # fails, because we are probably configuring with a cross compiler
176 # which can't create executables. So we include AC_EXEEXT to keep
177 # automake happy, but we don't execute it, since we don't care about
180 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
181 # to nothing, so nothing would remain between `then' and `fi' if it
182 # were not for the `:' below.
187 . [$]{glibcpp_basedir}/configure.host
189 case [$]{glibcpp_basedir} in
190 /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
191 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
194 # This does for the target what configure.host does for the host. In
195 # addition to possibly modifying the same flags, it also sets up symlinks.
203 dnl Check to see if g++ can compile this library, and if so, if any version-
204 dnl specific precautions need to be taken.
206 dnl GLIBCPP_CHECK_COMPILER_VERSION
207 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
208 if test ! -f stamp-sanity-compiler; then
209 AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3])
216 ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to GCC 3.0 or above]))
218 AC_MSG_RESULT($gpp_satisfactory)
219 touch stamp-sanity-compiler
225 dnl Tests for newer compiler features, or features that are present in newer
226 dnl compiler versions but not older compiler versions still in use, should
229 dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
230 dnl new inlining code or the new system_header pragma will die on -Werror.
231 dnl Leave it out by default and use maint-mode to use it.
233 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
234 dnl compiler supports it and the user has not requested debug mode.
236 dnl GLIBCPP_CHECK_COMPILER_FEATURES
237 AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
238 # All these tests are for C++; save the language and the compiler flags.
239 # The CXXFLAGS thing is suspicious, but based on similar bits previously
240 # found in GLIBCPP_CONFIGURE.
243 ac_test_CXXFLAGS="${CXXFLAGS+set}"
244 ac_save_CXXFLAGS="$CXXFLAGS"
246 # Check for maintainer-mode bits.
247 if test x"$USE_MAINTAINER_MODE" = xno; then
253 # Check for -ffunction-sections -fdata-sections
254 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
255 CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
256 AC_TRY_COMPILE(, [int foo;
257 ], [ac_fdsections=yes], [ac_fdsections=no])
258 if test "$ac_test_CXXFLAGS" = set; then
259 CXXFLAGS="$ac_save_CXXFLAGS"
261 # this is the suspicious part
264 if test x"$ac_fdsections" = x"yes" &&
265 test x"$enable_debug" = x"no"; then
266 SECTION_FLAGS='-ffunction-sections -fdata-sections'
268 AC_MSG_RESULT($ac_fdsections)
272 AC_SUBST(SECTION_FLAGS)
277 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
278 dnl the native linker is in use, all variables will be defined to something
279 dnl safe (like an empty string).
281 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
282 dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
284 dnl GLIBCPP_CHECK_LINKER_FEATURES
285 AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
286 # If we're not using GNU ld, then there's no point in even trying these
287 # tests. Check for that first. We should have already tested for gld
288 # by now (in libtool), but require it now just to be safe...
289 test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
290 test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
291 AC_REQUIRE([AC_PROG_LD])
294 if test "$ac_cv_prog_gnu_ld" = "notbroken"; then
295 # GNU ld it is! Joy and bunny rabbits!
297 # All these tests are for C++; save the language and the compiler flags.
298 # Need to do this so that g++ won't try to link in libstdc++
299 ac_test_CFLAGS="${CFLAGS+set}"
300 ac_save_CFLAGS="$CFLAGS"
301 CFLAGS='-x c++ -Wl,--gc-sections'
303 # Check for -Wl,--gc-sections
304 # XXX This test is broken at the moment, as symbols required for
305 # linking are now in libsupc++ (not built yet.....). In addition,
306 # this test has cored on solaris in the past. In addition,
307 # --gc-sections doesn't really work at the moment (keeps on discarding
308 # used sections, first .eh_frame and now some of the glibc sections for
309 # iconv). Bzzzzt. Thanks for playing, maybe next time.
310 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
318 ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
319 if test "$ac_test_CFLAGS" = set; then
320 CFLAGS="$ac_save_CFLAGS"
322 # this is the suspicious part
325 if test "$ac_sectionLDflags" = "yes"; then
326 SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
328 AC_MSG_RESULT($ac_sectionLDflags)
331 # Set linker optimization flags.
332 if test x"$ac_cv_prog_gnu_ld" = x"yes" &&
333 test x"$enable_debug" = x"no"; then
334 OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
337 AC_SUBST(SECTION_LDFLAGS)
338 AC_SUBST(OPT_LDFLAGS)
343 dnl Check to see if the (math function) argument passed is
344 dnl declared when using the c++ compiler
345 dnl ASSUMES argument is a math function with ONE parameter
347 dnl GLIBCPP_CHECK_MATH_DECL_1
348 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [
349 AC_MSG_CHECKING([for $1 declaration])
350 if test x${glibcpp_cv_func_$1_use+set} != xset; then
351 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
354 AC_TRY_COMPILE([#include <math.h>
360 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
364 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
368 dnl Check to see if the (math function) argument passed is
369 dnl 1) declared when using the c++ compiler
370 dnl 2) has "C" linkage
371 dnl 3) if not, see if 1) and 2) for argument prepended with '_'
373 dnl Define HAVE_CARGF etc if "cargf" is declared and links
375 dnl argument 1 is name of function to check
377 dnl ASSUMES argument is a math function with ONE parameter
379 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
380 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
381 GLIBCPP_CHECK_MATH_DECL_1($1)
382 if test x$glibcpp_cv_func_$1_use = x"yes"; then
385 GLIBCPP_CHECK_MATH_DECL_1(_$1)
386 if test x$glibcpp_cv_func__$1_use = x"yes"; then
394 dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
395 dnl of functions at once. It's an all-or-nothing check -- either
396 dnl HAVE_XYZ is defined for each of the functions, or for none of them.
397 dnl Doing it this way saves significant configure time.
398 AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [
399 AC_MSG_CHECKING([for $1 functions])
400 AC_CACHE_VAL(glibcpp_cv_func_$2_use, [
403 AC_TRY_COMPILE([#include <math.h>],
404 [ `for x in $3; do echo "$x (0);"; done` ],
405 [glibcpp_cv_func_$2_use=yes],
406 [glibcpp_cv_func_$2_use=no])
408 AC_MSG_RESULT($glibcpp_cv_func_$2_use)
409 if test x$glibcpp_cv_func_$2_use = x"yes"; then
415 dnl Check to see if the (math function) argument passed is
416 dnl declared when using the c++ compiler
417 dnl ASSUMES argument is a math function with TWO parameters
419 dnl GLIBCPP_CHECK_MATH_DECL_2
420 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [
421 AC_MSG_CHECKING([for $1 declaration])
422 if test x${glibcpp_cv_func_$1_use+set} != xset; then
423 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
426 AC_TRY_COMPILE([#include <math.h>],
428 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
432 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
436 dnl Check to see if the (math function) argument passed is
437 dnl 1) declared when using the c++ compiler
438 dnl 2) has "C" linkage
440 dnl Define HAVE_CARGF etc if "cargf" is declared and links
442 dnl argument 1 is name of function to check
444 dnl ASSUMES argument is a math function with TWO parameters
446 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
447 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
448 GLIBCPP_CHECK_MATH_DECL_2($1)
449 if test x$glibcpp_cv_func_$1_use = x"yes"; then
452 GLIBCPP_CHECK_MATH_DECL_2(_$1)
453 if test x$glibcpp_cv_func__$1_use = x"yes"; then
461 dnl Check to see if the (math function) argument passed is
462 dnl declared when using the c++ compiler
463 dnl ASSUMES argument is a math function with THREE parameters
465 dnl GLIBCPP_CHECK_MATH_DECL_3
466 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [
467 AC_MSG_CHECKING([for $1 declaration])
468 if test x${glibcpp_cv_func_$1_use+set} != xset; then
469 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
472 AC_TRY_COMPILE([#include <math.h>],
474 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
478 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
482 dnl Check to see if the (math function) argument passed is
483 dnl 1) declared when using the c++ compiler
484 dnl 2) has "C" linkage
486 dnl Define HAVE_CARGF etc if "cargf" is declared and links
488 dnl argument 1 is name of function to check
490 dnl ASSUMES argument is a math function with THREE parameters
492 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
493 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
494 GLIBCPP_CHECK_MATH_DECL_3($1)
495 if test x$glibcpp_cv_func_$1_use = x"yes"; then
498 GLIBCPP_CHECK_MATH_DECL_3(_$1)
499 if test x$glibcpp_cv_func__$1_use = x"yes"; then
507 dnl Check to see if the (stdlib function) argument passed is
508 dnl 1) declared when using the c++ compiler
509 dnl 2) has "C" linkage
511 dnl argument 1 is name of function to check
513 dnl ASSUMES argument is a math function with TWO parameters
515 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
516 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
517 AC_MSG_CHECKING([for $1 declaration])
518 if test x${glibcpp_cv_func_$1_use+set} != xset; then
519 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
522 AC_TRY_COMPILE([#include <stdlib.h>],
524 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
528 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
529 if test x$glibcpp_cv_func_$1_use = x"yes"; then
536 dnl Because the builtins are picky picky picky about the arguments they take,
537 dnl do an explict linkage tests here.
538 dnl Check to see if the (math function) argument passed is
539 dnl 1) declared when using the c++ compiler
540 dnl 2) has "C" linkage
542 dnl Define HAVE_CARGF etc if "cargf" is declared and links
544 dnl argument 1 is name of function to check
546 dnl ASSUMES argument is a math function with ONE parameter
548 dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
549 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
550 AC_MSG_CHECKING([for $1 declaration])
551 if test x${glibcpp_cv_func_$1_use+set} != xset; then
552 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
555 AC_TRY_COMPILE([#include <math.h>],
557 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
561 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
562 if test x$glibcpp_cv_func_$1_use = x"yes"; then
563 AC_MSG_CHECKING([for $1 linkage])
564 if test x${glibcpp_cv_func_$1_link+set} != xset; then
565 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
566 AC_TRY_LINK([#include <math.h>],
568 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
571 AC_MSG_RESULT($glibcpp_cv_func_$1_link)
572 if test x$glibcpp_cv_func_$1_link = x"yes"; then
573 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
574 AC_DEFINE_UNQUOTED(${ac_tr_func})
581 dnl Check to see what builtin math functions are supported
583 dnl check for __builtin_abs
584 dnl check for __builtin_fabsf
585 dnl check for __builtin_fabs
586 dnl check for __builtin_fabl
587 dnl check for __builtin_labs
588 dnl check for __builtin_sqrtf
589 dnl check for __builtin_sqrtl
590 dnl check for __builtin_sqrt
591 dnl check for __builtin_sinf
592 dnl check for __builtin_sin
593 dnl check for __builtin_sinl
594 dnl check for __builtin_cosf
595 dnl check for __builtin_cos
596 dnl check for __builtin_cosl
598 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
599 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
600 dnl Test for builtin math functions.
601 dnl These are made in gcc/c-common.c
602 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
603 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
604 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
605 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
606 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
608 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
609 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrt)
610 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
612 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
613 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
614 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
616 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
617 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
618 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
620 dnl There is, without a doubt, a more elegant way to have these
621 dnl names exported so that they won't be stripped out of acconfig.h by
622 dnl autoheader. I leave this as an exercise to somebody less frustrated
623 dnl than I.... please email the libstdc++ list if you can figure out a
624 dnl more elegant approach (see autoconf/acgen.m4 and specifically
625 dnl AC_CHECK_FUNC for things to steal.)
627 if test x$dummyvar = x"yes"; then
628 AC_DEFINE(HAVE___BUILTIN_ABS)
629 AC_DEFINE(HAVE___BUILTIN_LABS)
630 AC_DEFINE(HAVE___BUILTIN_COS)
631 AC_DEFINE(HAVE___BUILTIN_COSF)
632 AC_DEFINE(HAVE___BUILTIN_COSL)
633 AC_DEFINE(HAVE___BUILTIN_FABS)
634 AC_DEFINE(HAVE___BUILTIN_FABSF)
635 AC_DEFINE(HAVE___BUILTIN_FABSL)
636 AC_DEFINE(HAVE___BUILTIN_SIN)
637 AC_DEFINE(HAVE___BUILTIN_SINF)
638 AC_DEFINE(HAVE___BUILTIN_SINL)
639 AC_DEFINE(HAVE___BUILTIN_SQRT)
640 AC_DEFINE(HAVE___BUILTIN_SQRTF)
641 AC_DEFINE(HAVE___BUILTIN_SQRTL)
647 dnl Check to see what the underlying c library
648 dnl These checks need to do two things:
649 dnl 1) make sure the name is declared when using the c++ compiler
650 dnl 2) make sure the name has "C" linkage
651 dnl This might seem like overkill but experience has shown that it's not...
653 dnl Define HAVE_STRTOLD if "strtold" is declared and links
654 dnl Define HAVE_STRTOF if "strtof" is declared and links
655 dnl Define HAVE_DRAND48 if "drand48" is declared and links
657 dnl GLIBCPP_CHECK_STDLIB_SUPPORT
658 AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
659 ac_test_CXXFLAGS="${CXXFLAGS+set}"
660 ac_save_CXXFLAGS="$CXXFLAGS"
661 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
663 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
664 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof)
665 AC_CHECK_FUNCS(drand48)
667 CXXFLAGS="$ac_save_CXXFLAGS"
672 dnl Check to see what the underlying c library or math library is like.
673 dnl These checks need to do two things:
674 dnl 1) make sure the name is declared when using the c++ compiler
675 dnl 2) make sure the name has "C" linkage
676 dnl This might seem like overkill but experience has shown that it's not...
678 dnl Define HAVE_CARGF etc if "cargf" is found.
680 dnl GLIBCPP_CHECK_MATH_SUPPORT
681 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
682 ac_test_CXXFLAGS="${CXXFLAGS+set}"
683 ac_save_CXXFLAGS="$CXXFLAGS"
684 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
687 AC_CHECK_LIB(m, sin, libm="-lm")
691 dnl Check to see if certain C math functions exist.
692 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
693 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
694 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
695 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
696 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
697 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
698 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
699 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypot)
701 dnl Check to see if basic C math functions have float versions.
702 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig,
707 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
710 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
711 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
712 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
713 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
714 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
715 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
716 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf)
717 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
718 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
719 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
720 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
721 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
722 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
723 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
724 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
726 dnl Check to see if basic C math functions have long double versions.
727 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig,
732 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round,
735 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
736 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
737 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
738 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
739 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
740 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
741 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
742 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
743 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl)
744 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
745 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
746 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
747 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
748 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
749 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
750 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
751 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
753 dnl Some runtimes have these functions with a preceding underscore. Please
754 dnl keep this sync'd with the one above. And if you add any new symbol,
755 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
756 dnl Check to see if certain C math functions exist.
758 dnl Check to see if basic C math functions have float versions.
759 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
761 _acosf _asinf _atanf \
763 _coshf _sinhf _tanhf)
764 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
768 dnl Check to see if basic C math functions have long double versions.
769 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
771 _acosl _asinl _atanl \
773 _coshl _sinhl _tanhl)
774 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
779 CXXFLAGS="$ac_save_CXXFLAGS"
784 dnl Check to see if there is native support for complex
786 dnl Don't compile bits in math/* if native support exits.
788 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "copysignl" is found.
790 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
791 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
792 dnl Check for complex versions of math functions of platform.
793 AC_CHECK_LIB(m, main)
794 AC_REPLACE_MATHFUNCS(nan copysignf)
796 dnl Compile the long double complex functions only if the function
797 dnl provides the non-complex long double functions that are needed.
798 dnl Currently this includes copysignl, which should be
799 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
800 USE_COMPLEX_LONG_DOUBLE=no
801 if test x$ac_cv_func_copysignl = x"yes"; then
802 USE_COMPLEX_LONG_DOUBLE=yes
803 AC_REPLACE_MATHFUNCS(signbitl)
806 AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
810 dnl Check to see what architecture and operating system we are compiling
811 dnl for. Also, if architecture- or OS-specific flags are required for
812 dnl compilation, pick them up here.
814 dnl GLIBCPP_CHECK_TARGET
815 AC_DEFUN(GLIBCPP_CHECK_TARGET, [
816 . [$]{glibcpp_basedir}/configure.target
817 AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
818 AC_MSG_RESULT(OS config directory is $os_include_dir)
823 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
824 dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
825 dnl must have been previously checked.)
827 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
828 dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h
830 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
831 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
833 dnl Test wchar.h for mbstate_t, which is needed for char_traits and
834 dnl others even if wchar_t support is not on.
835 AC_MSG_CHECKING([for mbstate_t])
836 AC_TRY_COMPILE([#include <wchar.h>],
837 [mbstate_t teststate;],
838 have_mbstate_t=yes, have_mbstate_t=no)
839 AC_MSG_RESULT($have_mbstate_t)
840 if test x"$have_mbstate_t" = xyes; then
841 AC_DEFINE(HAVE_MBSTATE_T)
844 dnl Sanity check for existence of ISO C99 headers for extended encoding.
845 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
846 AC_CHECK_HEADER(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
848 dnl Only continue checking if the ISO C99 headers exist and support is on.
849 if test x"$ac_has_wchar_h" = xyes &&
850 test x"$ac_has_wctype_h" = xyes &&
851 test x"$enable_c_mbchar" != xno; then
853 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
854 dnl numeric_limits can instantiate type_traits<wchar_t>
855 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
856 AC_TRY_COMPILE([#include <wchar.h>],
857 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
858 has_wchar_minmax=yes, has_wchar_minmax=no)
859 AC_MSG_RESULT($has_wchar_minmax)
861 dnl Test wchar.h for WEOF, which is what we use to determine whether
862 dnl to specialize for char_traits<wchar_t> or not.
863 AC_MSG_CHECKING([for WEOF])
866 #include <stddef.h>],
868 has_weof=yes, has_weof=no)
869 AC_MSG_RESULT($has_weof)
871 dnl Tests for wide character functions used in char_traits<wchar_t>.
873 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset,, \
876 dnl Checks for names injected into std:: by the c_std headers.
877 AC_CHECK_FUNCS(btowc wctob fgetwc fgetwc fgetws fputwc fputws fwide \
878 fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
879 vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
880 mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
881 wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
882 wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \
885 AC_MSG_CHECKING([for ISO C99 wchar_t support])
886 if test x"$has_weof" = xyes &&
887 test x"$has_wchar_minmax" = xyes &&
888 test x"$ac_wfuncs" = xyes; then
889 ac_isoC99_wchar_t=yes
893 AC_MSG_RESULT($ac_isoC99_wchar_t)
895 dnl Use iconv for wchar_t to char conversions. As such, check for
896 dnl X/Open Portability Guide, version 2 features (XPG2).
897 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
898 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
900 dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
901 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
903 LIBS="$LIBS $libiconv"
905 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
906 ac_XPG2funcs=yes, ac_XPG2funcs=no)
910 AC_MSG_CHECKING([for XPG2 wchar_t support])
911 if test x"$ac_has_iconv_h" = xyes &&
912 test x"$ac_has_langinfo_h" = xyes &&
913 test x"$ac_XPG2funcs" = xyes; then
918 AC_MSG_RESULT($ac_XPG2_wchar_t)
920 dnl At the moment, only enable wchar_t specializations if all the
921 dnl above support is present.
922 AC_MSG_CHECKING([for enabled wchar_t specializations])
923 if test x"$ac_isoC99_wchar_t" = xyes &&
924 test x"$ac_XPG2_wchar_t" = xyes; then
925 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
931 dnl Wide characters disabled by the user.
932 AC_MSG_WARN([wchar_t support disabled.])
938 dnl Check for special debugging mode; not for production use.
940 dnl GLIBCPP_ENABLE_DEBUG
941 dnl --enable-debug sets '-ggdb3 -O0'.
942 dnl --disable-debug sets '-g' and whatever optimization options the
943 dnl compiler can handle.
944 dnl + --enable-maintainer-mode automatically defaults this to on.
945 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
946 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
947 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
948 dnl defaults to `no'.
949 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
950 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
952 changequote(<<, >>)dnl
953 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
955 [case "${enableval}" in
956 yes) enable_debug=yes ;;
957 no) enable_debug=no ;;
958 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
960 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
962 dnl Option parsed, now set things appropriately
963 case "${enable_debug}" in
965 DEBUG_FLAGS='-O0 -ggdb3'
971 AC_SUBST(DEBUG_FLAGS)
976 dnl Check for "unusual" flags to pass to the compiler while building.
978 dnl GLIBCPP_ENABLE_CXX_FLAGS
979 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
980 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
981 dnl Somehow this same set of flags must be passed when [re]building
983 dnl --disable-cxx-flags passes nothing.
984 dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
985 dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
986 dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
987 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
988 dnl If "default flags" is an empty string (or "none"), the effect is
989 dnl the same as --disable or --enable=no.
990 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
991 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
992 AC_ARG_ENABLE(cxx-flags,
993 changequote(<<, >>)dnl
994 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
995 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
997 [case "x$enableval" in
999 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1001 enable_cxx_flags='' ;;
1003 enable_cxx_flags="$enableval" ;;
1005 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
1007 dnl Thinko on my part during design. This kludge is the workaround.
1008 if test "$enable_cxx_flags" = "none"; then
1009 enable_cxx_flags='';
1012 dnl Run through flags (either default or command-line) and set anything
1013 dnl extra (e.g., #defines) that must accompany particular g++ options.
1014 if test -n "$enable_cxx_flags"; then
1015 for f in $enable_cxx_flags; do
1019 *) # and we're trying to pass /what/ exactly?
1020 AC_MSG_ERROR([compiler flags start with a -]) ;;
1024 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1025 AC_SUBST(EXTRA_CXX_FLAGS)
1030 dnl Check for which locale library to use: gnu or generic.
1032 dnl GLIBCPP_ENABLE_CLOCALE
1033 dnl --enable-clocale=gnu sets config/locale/c_locale_gnu.cc and friends
1034 dnl --enable-clocale=generic sets config/locale/c_locale_generic.cc and friends
1036 dnl default is generic
1038 AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
1039 AC_MSG_CHECKING([for clocale to use])
1040 AC_ARG_ENABLE(clocale,
1041 [ --enable-clocale enable model for target locale package.
1042 --enable-clocale=MODEL use MODEL target-speific locale package. [default=generic]
1044 if test x$enable_clocale = xno; then
1049 enable_clocale_flag=$enable_clocale
1051 dnl Probe for locale support if no specific model is specified.
1052 dnl Default to "generic"
1053 if test x$enable_clocale_flag = xno; then
1054 case x${target_os} in
1056 AC_EGREP_CPP([_GLIBCPP_ok], [
1057 #include <features.h>
1058 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1061 ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
1063 # Test for bugs early in glibc-2.2.x series
1064 if test x$enable_clocale_flag = xgnu; then
1066 #define _GNU_SOURCE 1
1070 const char __one[] = "Äuglein Augmen";
1071 const char __two[] = "Äuglein";
1076 loc = __newlocale(1 << LC_ALL, "de_DE", 0);
1077 loc_dup = __duplocale(loc);
1078 i = __strcoll_l(__one, __two, loc);
1079 j = __strcoll_l(__one, __two, loc_dup);
1083 [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
1084 [enable_clocale_flag=generic])
1087 # ... at some point put __strxfrm_l tests in as well.
1090 enable_clocale_flag=generic
1095 dnl Set configure bits for specified locale package
1096 case x${enable_clocale_flag} in
1098 AC_MSG_RESULT(generic)
1100 # Don't use gettext.
1103 CLOCALE_H=config/locale/c_locale_generic.h
1104 CLOCALE_CC=config/locale/c_locale_generic.cc
1105 CCODECVT_H=config/locale/codecvt_specializations_generic.h
1106 CCOLLATE_CC=config/locale/collate_members_generic.cc
1107 CCTYPE_CC=config/locale/ctype_members_generic.cc
1108 CMESSAGES_H=config/locale/messages_members_generic.h
1109 CMESSAGES_CC=config/locale/messages_members_generic.cc
1110 CMONEY_CC=config/locale/moneypunct_members_generic.cc
1111 CNUMERIC_CC=config/locale/numpunct_members_generic.cc
1112 CTIME_CC=config/locale/time_members_generic.cc
1117 # Declare intention to use gettext, and add support for specific
1119 # For some reason, ALL_LINGUAS has to be before AM_GNU_GETTEXT
1121 # Don't call AM_GNU_GETTEXT here. Instead, assume glibc.
1122 # Need to deal with MSGFMT, USE_NLS, and glibcpp_[P,M]OFILES
1125 # Export the build objects.
1126 for ling in $ALL_LINGUAS; do \
1127 glibcpp_MOFILES="$glibcpp_MOFILES $ling.mo"; \
1128 glibcpp_POFILES="$glibcpp_POFILES $ling.po"; \
1130 AC_SUBST(glibcpp_MOFILES)
1131 AC_SUBST(glibcpp_POFILES)
1133 CLOCALE_H=config/locale/c_locale_gnu.h
1134 CLOCALE_CC=config/locale/c_locale_gnu.cc
1135 CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
1136 CCOLLATE_CC=config/locale/collate_members_gnu.cc
1137 CCTYPE_CC=config/locale/ctype_members_gnu.cc
1138 CMESSAGES_H=config/locale/messages_members_gnu.h
1139 CMESSAGES_CC=config/locale/messages_members_gnu.cc
1140 CMONEY_CC=config/locale/moneypunct_members_gnu.cc
1141 CNUMERIC_CC=config/locale/numpunct_members_gnu.cc
1142 CTIME_CC=config/locale/time_members_gnu.cc
1145 AC_MSG_RESULT(generic)
1147 # Don't use gettext.
1150 CLOCALE_H=config/locale/c_locale_ieee_1003.1-200x.h
1151 CLOCALE_CC=config/locale/c_locale_ieee_1003.1-200x.cc
1152 CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
1153 CCOLLATE_CC=config/locale/collate_members_generic.cc
1154 CCTYPE_CC=config/locale/ctype_members_generic.cc
1155 CMESSAGES_H=config/locale/messages_members_ieee_1003.1-200x.h
1156 CMESSAGES_CC=config/locale/messages_members_ieee_1003.1-200x.cc
1157 CMONEY_CC=config/locale/moneypunct_members_generic.cc
1158 CNUMERIC_CC=config/locale/numpunct_members_generic.cc
1159 CTIME_CC=config/locale/time_members_generic.cc
1162 echo "$enable_clocale is an unknown locale package" 1>&2
1167 # This is where the testsuite looks for locale catalogs, using the
1168 # -DLOCALEDIR define during testsuite compilation.
1169 glibcpp_localedir=${glibcpp_builddir}/po/share/locale
1170 AC_SUBST(glibcpp_localedir)
1174 AC_SUBST(CCODECVT_H)
1175 AC_SUBST(CMESSAGES_H)
1176 AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
1177 AC_LINK_FILES($CCOLLATE_CC, src/collate.cc)
1178 AC_LINK_FILES($CCTYPE_CC, src/ctype.cc)
1179 AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
1180 AC_LINK_FILES($CMONEY_CC, src/moneypunct.cc)
1181 AC_LINK_FILES($CNUMERIC_CC, src/numpunct.cc)
1182 AC_LINK_FILES($CTIME_CC, src/time.cc)
1187 dnl Check for which I/O library to use: libio, or something specific.
1189 dnl GLIBCPP_ENABLE_CSTDIO
1190 dnl --enable-cstdio=libio sets config/io/c_io_libio.h and friends
1192 dnl default is stdio
1194 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1195 AC_MSG_CHECKING([for cstdio to use])
1196 AC_ARG_ENABLE(cstdio,
1197 [ --enable-cstdio enable stdio for target io package.
1198 --enable-cstdio=LIB use LIB target-speific io package. [default=stdio]
1200 if test x$enable_cstdio = xno; then
1203 enable_cstdio=stdio)
1205 enable_cstdio_flag=$enable_cstdio
1207 dnl Check if a valid I/O package
1208 case x${enable_cstdio_flag} in
1210 CSTDIO_H=config/io/c_io_libio.h
1211 BASIC_FILE_H=config/io/basic_file_libio.h
1212 BASIC_FILE_CC=config/io/basic_file_libio.cc
1213 AC_MSG_RESULT(libio)
1215 # see if we are on a system with libio native (ie, linux)
1216 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1218 # Need to check and see what version of glibc is being used. If
1219 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1220 # compile most of libio for linux systems.
1221 if test x$has_libio = x"yes"; then
1224 AC_MSG_CHECKING([for glibc version >= 2.2])
1225 AC_EGREP_CPP([ok], [
1226 #include <features.h>
1227 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1230 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1231 AC_MSG_RESULT($glibc_satisfactory)
1235 # XXX at the moment, admit defeat and force the recompilation
1236 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
1237 glibc_satisfactory=no
1239 if test x$glibc_satisfactory = x"yes"; then
1244 # bkoz XXX need to add checks to enable this
1245 # pme XXX here's a first pass at such a check
1246 if test x$enable_c_mbchar != xno; then
1254 # Using libio, but <libio.h> doesn't exist on the target system. . .
1256 # bkoz XXX need to add checks to enable this
1257 # pme XXX here's a first pass at such a check
1258 if test x$enable_c_mbchar != xno; then
1265 xstdio | x | xno | xnone | xyes)
1267 CSTDIO_H=config/io/c_io_stdio.h
1268 BASIC_FILE_H=config/io/basic_file_stdio.h
1269 BASIC_FILE_CC=config/io/basic_file_stdio.cc
1270 AC_MSG_RESULT(stdio)
1272 # We're not using stdio.
1277 echo "$enable_cstdio is an unknown io package" 1>&2
1282 AC_SUBST(BASIC_FILE_H)
1283 AC_LINK_FILES($BASIC_FILE_CC, src/basic_file.cc)
1285 # 2000-08-04 bkoz hack
1286 CCODECVT_C=config/io/c_io_libio_codecvt.c
1287 AC_SUBST(CCODECVT_C)
1288 # 2000-08-04 bkoz hack
1290 AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO,
1291 test "$need_libio" = yes || test "$need_wlibio" = yes)
1292 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1293 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1294 if test "$need_libio" = yes || test "$need_wlibio" = yes; then
1295 libio_la=../libio/libio.la
1304 dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
1305 dnl We must stage the required headers so that they will be installed
1306 dnl with the library (unlike libgcc, the STL implementation is provided
1307 dnl solely within headers). Since we must not inject random user-space
1308 dnl macro names into user-provided C++ code, we first stage into <file>-in
1309 dnl and process to <file> with an output command. The reason for a two-
1310 dnl stage process here is to correctly handle $srcdir!=$objdir without
1311 dnl having to write complex code (the sed commands to clean the macro
1312 dnl namespace are complex and fragile enough as it is). We must also
1313 dnl add a relative path so that -I- is supported properly.
1315 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1316 AC_MSG_CHECKING([for thread model used by GCC])
1317 target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
1318 AC_MSG_RESULT([$target_thread_file])
1320 if test $target_thread_file != single; then
1321 AC_DEFINE(HAVE_GTHR_DEFAULT)
1322 AC_DEFINE(_GLIBCPP_SUPPORTS_WEAK, __GXX_WEAK__)
1325 glibcpp_thread_h=gthr-$target_thread_file.h
1326 AC_SUBST(glibcpp_thread_h)
1331 dnl Check for exception handling support. If an explicit enable/disable
1332 dnl sjlj exceptions is given, we don't have to detect. Otherwise the
1333 dnl target may or may not support call frame exceptions.
1335 dnl GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
1336 dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
1337 dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1339 dnl Define _GLIBCPP_SJLJ_EXCEPTIONS if the compiler is configured for it.
1341 AC_DEFUN(GLIBCPP_ENABLE_SJLJ_EXCEPTIONS, [
1342 AC_MSG_CHECKING([for exception model to use])
1345 AC_ARG_ENABLE(sjlj-exceptions,
1346 [ --enable-sjlj-exceptions force use of builtin_setjmp for exceptions],
1348 [dnl Botheration. Now we've got to detect the exception model.
1349 dnl Link tests against libgcc.a are problematic since -- at least
1350 dnl as of this writing -- we've not been given proper -L bits for
1351 dnl single-tree newlib and libgloss.
1353 dnl This is what AC_TRY_COMPILE would do if it didn't delete the
1354 dnl conftest files before we got a change to grep them first.
1355 cat > conftest.$ac_ext << EOF
1356 [#]line __oline__ "configure"
1365 old_CXXFLAGS="$CXXFLAGS"
1367 if AC_TRY_EVAL(ac_compile); then
1368 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
1369 enable_sjlj_exceptions=yes
1370 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
1371 enable_sjlj_exceptions=no
1374 CXXFLAGS="$old_CXXFLAGS"
1376 if test x$enable_sjlj_exceptions = xyes; then
1377 AC_DEFINE(_GLIBCPP_SJLJ_EXCEPTIONS, 1,
1378 [Define if the compiler is configured for setjmp/longjmp exceptions.])
1379 ac_exception_model_name=sjlj
1380 elif test x$enable_sjlj_exceptions = xno; then
1381 ac_exception_model_name="call frame"
1383 AC_MSG_ERROR([unable to detect exception model])
1386 AC_MSG_RESULT($ac_exception_model_name)
1391 dnl Check for ISO/IEC 9899:1999 "C99" support.
1393 dnl GLIBCPP_ENABLE_C99
1394 dnl --enable-c99 defines _GLIBCPP_USE_C99
1395 dnl --disable-c99 leaves _GLIBCPP_USE_C99 undefined
1396 dnl + Usage: GLIBCPP_ENABLE_C99[(DEFAULT)]
1397 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1398 dnl defaults to `no'.
1399 dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
1401 dnl GLIBCPP_ENABLE_C99
1402 AC_DEFUN(GLIBCPP_ENABLE_C99, [dnl
1403 define([GLIBCPP_ENABLE_C99_DEFAULT], ifelse($1, yes, yes, no))dnl
1406 changequote(<<, >>)dnl
1407 <<--enable-c99 turns on 'ISO/IEC 9899:1999 support' [default=>>GLIBCPP_ENABLE_C99_DEFAULT],
1408 changequote([, ])dnl
1409 [case "$enableval" in
1410 yes) enable_c99=yes ;;
1411 no) enable_c99=no ;;
1412 *) AC_MSG_ERROR([Unknown argument to enable/disable C99]) ;;
1414 enable_c99=GLIBCPP_ENABLE_C99_DEFAULT)dnl
1419 # Check for the existence of <math.h> functions used if C99 is enabled.
1421 AC_MSG_CHECKING([for ISO C99 support in <math.h>])
1422 AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no])
1423 AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no])
1424 AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no])
1425 AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no])
1426 AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no])
1427 AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no])
1428 AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no])
1429 AC_TRY_COMPILE([#include <math.h>],
1430 [isgreaterequal(0.0,0.0);],, [ac_c99_math=no])
1431 AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no])
1432 AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no])
1433 AC_TRY_COMPILE([#include <math.h>],
1434 [islessgreater(0.0,0.0);],, [ac_c99_math=no])
1435 AC_TRY_COMPILE([#include <math.h>],
1436 [isunordered(0.0,0.0);],, [ac_c99_math=no])
1437 AC_MSG_RESULT($ac_c99_math)
1439 # Check for the existence in <stdio.h> of vscanf, et. al.
1441 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
1442 AC_TRY_COMPILE([#include <stdio.h>],
1443 [snprintf("12", 0, "%i");],, [ac_c99_stdio=no])
1444 AC_TRY_COMPILE([#include <stdio.h>
1446 void foo(char* fmt, ...)
1447 {va_list args; va_start(args, fmt);
1448 vfscanf(stderr, "%i", args);}],
1449 [],, [ac_c99_stdio=no])
1450 AC_TRY_COMPILE([#include <stdio.h>
1452 void foo(char* fmt, ...)
1453 {va_list args; va_start(args, fmt);
1454 vscanf("%i", args);}],
1455 [],, [ac_c99_stdio=no])
1456 AC_TRY_COMPILE([#include <stdio.h>
1458 void foo(char* fmt, ...)
1459 {va_list args; va_start(args, fmt);
1460 vsnprintf(fmt, 0, "%i", args);}],
1461 [],, [ac_c99_stdio=no])
1462 AC_TRY_COMPILE([#include <stdio.h>
1464 void foo(char* fmt, ...)
1465 {va_list args; va_start(args, fmt);
1466 vsscanf(fmt, "%i", args);}],
1467 [],, [ac_c99_stdio=no])
1468 AC_MSG_RESULT($ac_c99_stdio)
1470 # Check for the existence in <stdlib.h> of lldiv_t, et. al.
1472 AC_MSG_CHECKING([for lldiv_t declaration])
1473 AC_CACHE_VAL(ac_c99_lldiv_t, [
1474 AC_TRY_COMPILE([#include <stdlib.h>],
1476 [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no])
1478 AC_MSG_RESULT($ac_c99_lldiv_t)
1480 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
1481 AC_TRY_COMPILE([#include <stdlib.h>],
1482 [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no])
1483 AC_TRY_COMPILE([#include <stdlib.h>],
1484 [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no])
1485 AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no])
1486 AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no])
1487 AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no])
1488 AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no])
1489 if test x"$ac_c99_lldiv_t" = x"no"; then
1492 AC_MSG_RESULT($ac_c99_stdlib)
1494 # Check for the existence of <wchar.h> functions used if C99 is enabled.
1495 # XXX the wchar.h checks should be rolled into the general C99 bits.
1497 AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>])
1498 AC_TRY_COMPILE([#include <wchar.h>],
1499 [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no])
1500 AC_TRY_COMPILE([#include <wchar.h>],
1501 [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no])
1502 AC_TRY_COMPILE([#include <wchar.h>],
1503 [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no])
1504 AC_MSG_RESULT($ac_c99_wchar)
1506 AC_MSG_CHECKING([for enabled ISO C99 support])
1507 if test x"$ac_c99_math" = x"no" ||
1508 test x"$ac_c99_stdio" = x"no" ||
1509 test x"$ac_c99_stdlib" = x"no" ||
1510 test x"$ac_c99_wchar" = x"no"; then
1513 AC_MSG_RESULT($enable_c99)
1515 # Option parsed, now set things appropriately
1516 if test x"$enable_c99" = x"yes"; then
1517 AC_DEFINE(_GLIBCPP_USE_C99)
1525 dnl Check for template specializations for the 'long long' type extension.
1526 dnl The result determines only whether 'long long' I/O is enabled; things
1527 dnl like numeric_limits<> specializations are always available.
1529 dnl GLIBCPP_ENABLE_LONG_LONG
1530 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1531 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1532 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1533 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1534 dnl defaults to `no'.
1535 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1537 dnl GLIBCPP_ENABLE_LONG_LONG
1538 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1539 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1541 AC_ARG_ENABLE(long-long,
1542 changequote(<<, >>)dnl
1543 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1544 changequote([, ])dnl
1545 [case "$enableval" in
1546 yes) enable_long_long=yes ;;
1547 no) enable_long_long=no ;;
1548 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1550 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1555 AC_MSG_CHECKING([for enabled long long I/O support])
1556 # iostreams require strtoll, strtoull to compile
1557 AC_TRY_COMPILE([#include <stdlib.h>],
1558 [char* tmp; strtoll("gnu", &tmp, 10);],,[enable_long_long=no])
1559 AC_TRY_COMPILE([#include <stdlib.h>],
1560 [char* tmp; strtoull("gnu", &tmp, 10);],,[enable_long_long=no])
1562 # Option parsed, now set things appropriately
1563 if test x"$enable_long_long" = xyes; then
1564 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1566 AC_MSG_RESULT($enable_long_long)
1573 dnl Check for what kind of C headers to use.
1575 dnl GLIBCPP_ENABLE_CHEADERS
1576 dnl --enable-cheaders= [does stuff].
1577 dnl --disable-cheaders [does not do anything, really].
1578 dnl + This will eventually need to be 'c_shadow' by default.
1579 dnl + Usage: GLIBCPP_ENABLE_CHEADERS[(DEFAULT)]
1580 dnl Where DEFAULT is either `c' or `c_std' or 'c_shadow'.
1581 dnl If ommitted, it defaults to `c_std'.
1582 AC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl
1583 define([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl
1584 AC_MSG_CHECKING([for c header strategy to use])
1585 AC_ARG_ENABLE(cheaders,
1586 changequote(<<, >>)dnl
1587 << --enable-cheaders construct "C" header files for g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT],
1589 [case "$enableval" in
1594 enable_cheaders=c_std
1597 enable_cheaders=c_shadow
1599 *) AC_MSG_ERROR([Unknown argument to enable/disable "C" headers])
1602 enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT)
1603 AC_MSG_RESULT($enable_cheaders)
1605 dnl Option parsed, now set things appropriately
1606 case "$enable_cheaders" in
1608 CSHADOW_FLAGS="-fno-builtin"
1609 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_shadow'
1610 AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
1614 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_std'
1618 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c'
1622 AC_SUBST(CSHADOW_FLAGS)
1623 AC_SUBST(C_INCLUDE_DIR)
1624 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cheaders" = c_shadow)
1629 dnl Check for wide character support. Has the same effect as the option
1630 dnl in gcc's configure, but in a form that autoconf can mess with.
1632 dnl GLIBCPP_ENABLE_C_MBCHAR
1633 dnl --enable-c-mbchar requests all the wchar_t stuff.
1634 dnl --disable-c-mbchar doesn't.
1635 dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1636 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1637 dnl defaults to `no'.
1638 AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1639 define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1640 AC_ARG_ENABLE(c-mbchar,
1641 changequote(<<, >>)dnl
1642 << --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1643 changequote([, ])dnl
1644 [case "$enableval" in
1645 yes) enable_c_mbchar=yes ;;
1646 no) enable_c_mbchar=no ;;
1647 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1649 enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1650 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1655 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1657 dnl TOPLEVEL_INCLUDES
1658 dnl LIBMATH_INCLUDES
1659 dnl LIBSUPCXX_INCLUDES
1661 dnl CSHADOW_INCLUDES
1663 dnl GLIBCPP_EXPORT_INCLUDES
1664 AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1665 # Root level of the build directory include sources.
1666 GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include"
1668 # Passed down for canadian crosses.
1669 if test x"$CANADIAN" = xyes; then
1670 TOPLEVEL_INCLUDES='-I$(includedir)'
1673 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1675 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1677 if test x"$need_libio" = xyes; then
1678 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1679 AC_SUBST(LIBIO_INCLUDES)
1682 # Now, export this to all the little Makefiles....
1683 AC_SUBST(GLIBCPP_INCLUDES)
1684 AC_SUBST(TOPLEVEL_INCLUDES)
1685 AC_SUBST(LIBMATH_INCLUDES)
1686 AC_SUBST(LIBSUPCXX_INCLUDES)
1691 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1693 AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1694 # Optimization flags that are probably a good idea for thrill-seekers. Just
1695 # uncomment the lines below and make, everything else is ready to go...
1696 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1698 AC_SUBST(OPTIMIZE_CXXFLAGS)
1700 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1701 AC_SUBST(WARN_FLAGS)
1705 dnl GLIBCPP_EXPORT_INSTALL_INFO
1706 dnl calculates gxx_install_dir
1707 dnl exports glibcpp_toolexecdir
1708 dnl exports glibcpp_toolexeclibdir
1709 dnl exports glibcpp_prefixdir
1711 dnl Assumes cross_compiling bits already done, and with_cross_host in
1714 dnl GLIBCPP_EXPORT_INSTALL_INFO
1715 AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
1716 # Assumes glibcpp_builddir, glibcpp_srcdir are alreay set up and
1717 # exported correctly in GLIBCPP_CONFIGURE.
1718 glibcpp_toolexecdir=no
1719 glibcpp_toolexeclibdir=no
1720 glibcpp_prefixdir=${prefix}
1722 AC_MSG_CHECKING([for interface version number])
1723 libstdcxx_interface=$INTERFACE
1724 AC_MSG_RESULT($libstdcxx_interface)
1726 # Process the option --with-gxx-include-dir=<path to include-files directory>
1727 AC_MSG_CHECKING([for --with-gxx-include-dir])
1728 AC_ARG_WITH(gxx-include-dir,
1729 [ --with-gxx-include-dir the installation directory for include files],
1730 [case "${withval}" in
1732 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
1739 gxx_include_dir=${withval}
1741 esac], [gxx_include_dir=no])
1742 AC_MSG_RESULT($gxx_include_dir)
1744 # Process the option "--enable-version-specific-runtime-libs"
1745 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
1746 AC_ARG_ENABLE(version-specific-runtime-libs,
1747 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
1748 [case "$enableval" in
1749 yes) version_specific_libs=yes ;;
1750 no) version_specific_libs=no ;;
1751 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
1753 version_specific_libs=no)dnl
1754 # Option set, now we can test it.
1755 AC_MSG_RESULT($version_specific_libs)
1757 if test $version_specific_libs = yes; then
1758 # Need the gcc compiler version to know where to install libraries
1759 # and header files if --enable-version-specific-runtime-libs option
1762 gcc_version_trigger=${srcdir}/../gcc/version.c
1763 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'`
1764 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
1765 gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/g++
1766 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1767 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
1771 # Default case for install directory for include files.
1772 if test $version_specific_libs = no &&
1773 test $gxx_include_dir = no; then
1774 gxx_include_dir='$(prefix)'/include/g++-${libstdcxx_interface}
1777 # Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
1778 # Install a library built with a cross compiler in tooldir, not libdir.
1779 if test x"$glibcpp_toolexecdir" = x"no"; then
1780 if test -n "$with_cross_host" &&
1781 test x"$with_cross_host" != x"no"; then
1782 glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
1783 glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)'
1785 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1786 glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)'
1790 AC_MSG_CHECKING([for install location])
1791 AC_MSG_RESULT($gxx_include_dir)
1793 AC_SUBST(glibcpp_prefixdir)
1794 AC_SUBST(gxx_include_dir)
1795 AC_SUBST(glibcpp_toolexecdir)
1796 AC_SUBST(glibcpp_toolexeclibdir)
1800 # Check for functions in math library.
1801 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1803 # This file can be copied and used freely without restrictions. It can
1804 # be used in projects which are not available under the GNU Public License
1805 # but which still want to provide support for the GNU gettext functionality.
1806 # Please note that the actual code is *not* freely available.
1810 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1811 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1812 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1813 AC_SUBST(LIBMATHOBJS)dnl
1818 dnl This macro searches for a GNU version of make. If a match is found, the
1819 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1820 dnl set to "#". This is useful for including a special features in a Makefile,
1821 dnl which cannot be handled by other versions of make. The variable
1822 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1823 dnl the empty string otherwise.
1825 dnl Here is an example of its use:
1827 dnl Makefile.in might contain:
1829 dnl # A failsafe way of putting a dependency rule into a makefile
1831 dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1833 dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1834 dnl @ifGNUmake@ include $(DEPEND)
1835 dnl @ifGNUmake@ endif
1837 dnl Then configure.in would normally contain:
1839 dnl CHECK_GNU_MAKE()
1840 dnl AC_OUTPUT(Makefile)
1842 dnl Then perhaps to cause gnu make to override any other make, we could do
1843 dnl something like this (note that GNU make always looks for GNUmakefile first):
1845 dnl if ! test x$_cv_gnu_make_command = x ; then
1846 dnl mv Makefile GNUmakefile
1847 dnl echo .DEFAULT: > Makefile ;
1848 dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1851 dnl Then, if any (well almost any) other make is called, and GNU make also
1852 dnl exists, then the other make wraps the GNU make.
1854 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1855 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
1857 dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1858 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1859 dnl #### conditional's subshell (" --version" is not a command), using a
1860 dnl #### different option to grep(1).
1862 dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not
1863 dnl #### ${MAKE:-make}).
1866 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1867 _cv_gnu_make_command='' ;
1868 dnl Search all the common names for GNU make
1869 for a in "${MAKE-make}" make gmake gnumake ; do
1870 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
1872 _cv_gnu_make_command=$a ;
1877 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1878 dnl string, '#' otherwise
1879 if test "x$_cv_gnu_make_command" != "x" ; then
1888 dnl Check for headers for, and arguments to, the setrlimit() function.
1889 dnl Used only in testsuite_hooks.h.
1890 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT_ancilliary, [
1891 AC_TRY_COMPILE([#include <sys/resource.h>
1893 ], [ int f = RLIMIT_$1 ; ],
1894 [glibcpp_mresult=1], [glibcpp_mresult=0])
1895 AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcpp_mresult,
1896 [Only used in build directory testsuite_hooks.h.])
1898 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT, [
1899 setrlimit_have_headers=yes
1900 AC_CHECK_HEADERS(sys/resource.h unistd.h,
1902 setrlimit_have_headers=no)
1903 # If don't have the headers, then we can't run the tests now, and we
1904 # won't be seeing any of these during testsuite compilation.
1905 if test $setrlimit_have_headers = yes; then
1906 # Can't do these in a loop, else the resulting syntax is wrong.
1907 GLIBCPP_CHECK_SETRLIMIT_ancilliary(DATA)
1908 GLIBCPP_CHECK_SETRLIMIT_ancilliary(RSS)
1909 GLIBCPP_CHECK_SETRLIMIT_ancilliary(VMEM)
1910 GLIBCPP_CHECK_SETRLIMIT_ancilliary(AS)
1912 # Check for rlimit, setrlimit.
1913 AC_CACHE_VAL(ac_setrlimit, [
1914 AC_TRY_COMPILE([#include <sys/resource.h>
1917 [ struct rlimit r; setrlimit(0, &r);],
1918 [ac_setrlimit=yes], [ac_setrlimit=no])
1922 AC_MSG_CHECKING([for testsuite memory limit support])
1923 if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then
1925 AC_DEFINE(_GLIBCPP_MEM_LIMITS)
1929 AC_MSG_RESULT($ac_mem_limits)
1934 dnl Does any necessary configuration of the testsuite directory. Generates
1935 dnl the testsuite_hooks.h header.
1937 dnl GLIBCPP_CONFIGURE_TESTSUITE [no args]
1938 AC_DEFUN(GLIBCPP_CONFIGURE_TESTSUITE, [
1939 GLIBCPP_CHECK_SETRLIMIT
1941 # Look for setenv, so that extended locale tests can be performed.
1942 AC_CHECK_FUNCS(setenv)
1946 sinclude(../libtool.m4)
1947 dnl The lines below arrange for aclocal not to bring an installed
1948 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1949 dnl add a definition of LIBTOOL to Makefile.in.
1950 ifelse(,,,[AC_SUBST(LIBTOOL)
1951 AC_DEFUN([AM_PROG_LIBTOOL])
1952 AC_DEFUN([AC_LIBTOOL_DLOPEN])
1953 AC_DEFUN([AC_PROG_LD])
1957 # Check whether LC_MESSAGES is available in <locale.h>.
1958 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1960 # This file file be copied and used freely without restrictions. It can
1961 # be used in projects which are not available under the GNU Public License
1962 # but which still want to provide support for the GNU gettext functionality.
1963 # Please note that the actual code is *not* freely available.
1967 AC_DEFUN(AC_LC_MESSAGES, [
1968 AC_CHECK_HEADER(locale.h, [
1969 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1970 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1971 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1972 if test $ac_cv_val_LC_MESSAGES = yes; then
1973 AC_DEFINE(HAVE_LC_MESSAGES)
1980 dnl Check for whether the Boost-derived checks should be turned on.
1982 dnl GLIBCPP_ENABLE_CONCEPT_CHECKS
1983 dnl --enable-concept-checks turns them on.
1984 dnl --disable-concept-checks leaves them off.
1985 dnl + Usage: GLIBCPP_ENABLE_CONCEPT_CHECKS[(DEFAULT)]
1986 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1987 dnl defaults to `no'.
1988 AC_DEFUN(GLIBCPP_ENABLE_CONCEPT_CHECKS, [dnl
1989 define([GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT], ifelse($1, yes, yes, no))dnl
1990 AC_ARG_ENABLE(concept-checks,
1991 changequote(<<, >>)dnl
1992 << --enable-concept-checks use Boost-derived template checks [default=>>GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT],
1993 changequote([, ])dnl
1994 [case "$enableval" in
1995 yes) enable_concept_checks=yes ;;
1996 no) enable_concept_checks=no ;;
1997 *) AC_MSG_ERROR([Unknown argument to enable/disable concept checks]) ;;
1999 enable_concept_checks=GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT)dnl
2000 dnl Option parsed, now set things appropriately
2001 if test x"$enable_concept_checks" = xyes; then
2002 AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS)