2 dnl Initialize configure bits.
4 dnl GLIBCPP_TOPREL_CONFIGURE
5 AC_DEFUN(GLIBCPP_TOPREL_CONFIGURE, [
6 dnl Default to --enable-multilib (this is also passed by default
7 dnl from the ubercommon-top-level configure)
8 AC_ARG_ENABLE(multilib,
9 [ --enable-multilib build hella library versions (default)],
10 [case "${enableval}" in
13 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
14 esac], [multilib=yes])dnl
16 # When building with srcdir == objdir, links to the source files will
17 # be created in directories within the target_subdir. We have to
18 # adjust toplevel_srcdir accordingly, so that configure finds
19 # install-sh and other auxiliary files that live in the top-level
21 if test "${srcdir}" = "."; then
22 if test -z "${with_target_subdir}"; then
25 if test "${with_target_subdir}" != "."; then
26 toprel="${with_multisrctop}../.."
28 toprel="${with_multisrctop}.."
34 AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
35 toplevel_srcdir=\${top_srcdir}/$toprel
36 AC_SUBST(toplevel_srcdir)
40 dnl Initialize configure bits.
43 AC_DEFUN(GLIBCPP_CONFIGURE, [
45 #possibly test for the presence of the compiler sources here?
47 # Export build and source directories.
48 # These need to be absolute paths, yet at the same time need to
49 # canonicalize only relative paths, because then amd will not unmount
50 # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
51 glibcpp_builddir=`${PWDCMD-pwd}`
53 [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
54 *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
56 AC_SUBST(glibcpp_builddir)
57 AC_SUBST(glibcpp_srcdir)
59 dnl This is here just to satisfy automake.
60 ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)])
63 # Will set LN_S to either 'ln -s' or 'ln'. With autoconf 2.5x, can also
64 # be 'cp -p' if linking isn't available. Uncomment the next line to
65 # force a particular method.
66 #ac_cv_prog_LN_S='cp -p'
69 # We use these options to decide which functions to include.
70 AC_ARG_WITH(target-subdir,
71 [ --with-target-subdir=SUBDIR
72 configuring in a subdirectory])
73 AC_ARG_WITH(cross-host,
74 [ --with-cross-host=HOST configuring with a cross compiler])
76 glibcpp_basedir=$srcdir/$toprel/$1/libstdc++-v3
77 AC_SUBST(glibcpp_basedir)
79 # Never versions of autoconf add an underscore to these functions.
80 # Prevent future problems ...
81 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
82 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
83 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
84 ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
87 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
88 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
89 # are probably using a cross compiler, which will not be able to fully
90 # link an executable. This is addressed in later versions of autoconf.
92 AC_DEFUN(LIB_AC_PROG_CC,
93 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
94 dnl Fool anybody using AC_PROG_CC.
95 AC_PROVIDE([AC_PROG_CC])
96 AC_CHECK_PROG(CC, gcc, gcc)
97 if test -z "$CC"; then
98 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
99 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
104 if test $ac_cv_prog_gcc = yes; then
106 dnl Check whether -g works, even if CFLAGS is set, in case the package
107 dnl plays around with CFLAGS (such as to build both debugging and
108 dnl normal versions of a library), tasteless as that idea is.
109 ac_test_CFLAGS="${CFLAGS+set}"
110 ac_save_CFLAGS="$CFLAGS"
113 if test "$ac_test_CFLAGS" = set; then
114 CFLAGS="$ac_save_CFLAGS"
115 elif test $ac_cv_prog_cc_g = yes; then
122 test "${CFLAGS+set}" = set || CFLAGS="-g"
128 # Likewise for AC_PROG_CXX. We can't just call it directly because g++
129 # will try to link in libstdc++.
130 AC_DEFUN(LIB_AC_PROG_CXX,
131 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
132 dnl Fool anybody using AC_PROG_CXX.
133 AC_PROVIDE([AC_PROG_CXX])
134 # Use glibcpp_CXX so that we do not cause CXX to be cached with the
135 # flags that come in CXX while configuring libstdc++. They're different
136 # from those used for all other target libraries. If CXX is set in
137 # the environment, respect that here.
139 AC_CHECK_PROGS(glibcpp_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
140 AC_SUBST(glibcpp_CXX)
142 test -z "$glibcpp_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
146 if test $ac_cv_prog_gxx = yes; then
148 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
149 dnl plays around with CXXFLAGS (such as to build both debugging and
150 dnl normal versions of a library), tasteless as that idea is.
151 ac_test_CXXFLAGS="${CXXFLAGS+set}"
152 ac_save_CXXFLAGS="$CXXFLAGS"
155 if test "$ac_test_CXXFLAGS" = set; then
156 CXXFLAGS="$ac_save_CXXFLAGS"
157 elif test $ac_cv_prog_cxx_g = yes; then
164 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
170 # For directory versioning (e.g., headers) and other variables.
171 AC_MSG_CHECKING([for GCC version number])
172 gcc_version=`$glibcpp_CXX -dumpversion`
173 AC_MSG_RESULT($gcc_version)
175 # For some reason, gettext needs this.
178 AC_CHECK_TOOL(AS, as)
179 AC_CHECK_TOOL(AR, ar)
180 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
185 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
186 # at least currently, we never actually build a program, so we never
187 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
188 # fails, because we are probably configuring with a cross compiler
189 # which can't create executables. So we include AC_EXEEXT to keep
190 # automake happy, but we don't execute it, since we don't care about
193 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
194 # to nothing, so nothing would remain between `then' and `fi' if it
195 # were not for the `:' below.
200 case [$]{glibcpp_basedir} in
201 /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
202 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
205 # Find platform-specific directories containing configuration info. In
206 # addition to possibly modifying the same flags, it also sets up symlinks.
212 dnl Check to see if g++ can compile this library, and if so, if any version-
213 dnl specific precautions need to be taken.
215 dnl GLIBCPP_CHECK_COMPILER_VERSION
216 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
217 if test ! -f stamp-sanity-compiler; then
218 AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3])
225 ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to GCC 3.0 or above]))
227 AC_MSG_RESULT($gpp_satisfactory)
228 touch stamp-sanity-compiler
234 dnl Tests for newer compiler features, or features that are present in newer
235 dnl compiler versions but not older compiler versions still in use, should
238 dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
239 dnl new inlining code or the new system_header pragma will die on -Werror.
240 dnl Leave it out by default and use maint-mode to use it.
242 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
243 dnl compiler supports it and the user has not requested debug mode.
245 dnl GLIBCPP_CHECK_COMPILER_FEATURES
246 AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
247 # All these tests are for C++; save the language and the compiler flags.
248 # The CXXFLAGS thing is suspicious, but based on similar bits previously
249 # found in GLIBCPP_CONFIGURE.
252 ac_test_CXXFLAGS="${CXXFLAGS+set}"
253 ac_save_CXXFLAGS="$CXXFLAGS"
255 # Check for maintainer-mode bits.
256 if test x"$USE_MAINTAINER_MODE" = xno; then
262 # Check for -ffunction-sections -fdata-sections
263 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
264 CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
265 AC_TRY_COMPILE(, [int foo;
266 ], [ac_fdsections=yes], [ac_fdsections=no])
267 if test "$ac_test_CXXFLAGS" = set; then
268 CXXFLAGS="$ac_save_CXXFLAGS"
270 # this is the suspicious part
273 if test x"$ac_fdsections" = x"yes" &&
274 test x"$enable_debug" = x"no"; then
275 SECTION_FLAGS='-ffunction-sections -fdata-sections'
277 AC_MSG_RESULT($ac_fdsections)
281 AC_SUBST(SECTION_FLAGS)
286 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
287 dnl the native linker is in use, all variables will be defined to something
288 dnl safe (like an empty string).
290 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
291 dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
292 dnl Define LD, with_gnu_ld, and (possibly) glibcpp_gnu_ld_version as
293 dnl side-effects of testing.
295 dnl GLIBCPP_CHECK_LINKER_FEATURES
296 AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
297 # If we're not using GNU ld, then there's no point in even trying these
298 # tests. Check for that first. We should have already tested for gld
299 # by now (in libtool), but require it now just to be safe...
300 test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
301 test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
302 AC_REQUIRE([AC_PROG_LD])
304 # The name set by libtool depends on the version of libtool. Shame on us
305 # for depending on an impl detail, but c'est la vie. Older versions used
306 # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
307 # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
308 # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
309 # set (hence we're using an older libtool), then set it.
310 if test x${with_gnu_ld+set} != xset; then
311 if test x${ac_cv_prog_gnu_ld+set} != xset; then
312 # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
315 with_gnu_ld=$ac_cv_prog_gnu_ld
319 # Start by getting the version number. I think the libtool test already
320 # does some of this, but throws away the result.
322 ldver=`$LD --version 2>/dev/null | head -1 | \
323 sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
325 glibcpp_gnu_ld_version=`echo $ldver | \
326 $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
329 if test "$with_gnu_ld" = "notbroken"; then
330 # GNU ld it is! Joy and bunny rabbits!
332 # All these tests are for C++; save the language and the compiler flags.
333 # Need to do this so that g++ won't try to link in libstdc++
334 ac_test_CFLAGS="${CFLAGS+set}"
335 ac_save_CFLAGS="$CFLAGS"
336 CFLAGS='-x c++ -Wl,--gc-sections'
338 # Check for -Wl,--gc-sections
339 # XXX This test is broken at the moment, as symbols required for
340 # linking are now in libsupc++ (not built yet.....). In addition,
341 # this test has cored on solaris in the past. In addition,
342 # --gc-sections doesn't really work at the moment (keeps on discarding
343 # used sections, first .eh_frame and now some of the glibc sections for
344 # iconv). Bzzzzt. Thanks for playing, maybe next time.
345 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
353 ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
354 if test "$ac_test_CFLAGS" = set; then
355 CFLAGS="$ac_save_CFLAGS"
357 # this is the suspicious part
360 if test "$ac_sectionLDflags" = "yes"; then
361 SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
363 AC_MSG_RESULT($ac_sectionLDflags)
366 # Set linker optimization flags.
367 if test x"$with_gnu_ld" = x"yes" && test x"$enable_debug" = x"no"; then
368 OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
371 AC_SUBST(SECTION_LDFLAGS)
372 AC_SUBST(OPT_LDFLAGS)
377 dnl Check to see if the (math function) argument passed is
378 dnl declared when using the c++ compiler
379 dnl ASSUMES argument is a math function with ONE parameter
381 dnl GLIBCPP_CHECK_MATH_DECL_1
382 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [
383 AC_MSG_CHECKING([for $1 declaration])
384 if test x${glibcpp_cv_func_$1_use+set} != xset; then
385 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
388 AC_TRY_COMPILE([#include <math.h>
394 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
398 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
402 dnl Check to see if the (math function) argument passed is
403 dnl 1) declared when using the c++ compiler
404 dnl 2) has "C" linkage
405 dnl 3) if not, see if 1) and 2) for argument prepended with '_'
407 dnl Define HAVE_CARGF etc if "cargf" is declared and links
409 dnl argument 1 is name of function to check
411 dnl ASSUMES argument is a math function with ONE parameter
413 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
414 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
415 GLIBCPP_CHECK_MATH_DECL_1($1)
416 if test x$glibcpp_cv_func_$1_use = x"yes"; then
419 GLIBCPP_CHECK_MATH_DECL_1(_$1)
420 if test x$glibcpp_cv_func__$1_use = x"yes"; then
428 dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
429 dnl of functions at once. It's an all-or-nothing check -- either
430 dnl HAVE_XYZ is defined for each of the functions, or for none of them.
431 dnl Doing it this way saves significant configure time.
432 AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [
433 AC_MSG_CHECKING([for $1 functions])
434 AC_CACHE_VAL(glibcpp_cv_func_$2_use, [
437 AC_TRY_COMPILE([#include <math.h>],
438 [ `for x in $3; do echo "$x (0);"; done` ],
439 [glibcpp_cv_func_$2_use=yes],
440 [glibcpp_cv_func_$2_use=no])
442 AC_MSG_RESULT($glibcpp_cv_func_$2_use)
443 if test x$glibcpp_cv_func_$2_use = x"yes"; then
449 dnl Check to see if the (math function) argument passed is
450 dnl declared when using the c++ compiler
451 dnl ASSUMES argument is a math function with TWO parameters
453 dnl GLIBCPP_CHECK_MATH_DECL_2
454 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [
455 AC_MSG_CHECKING([for $1 declaration])
456 if test x${glibcpp_cv_func_$1_use+set} != xset; then
457 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
460 AC_TRY_COMPILE([#include <math.h>],
462 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
466 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
470 dnl Check to see if the (math function) argument passed is
471 dnl 1) declared when using the c++ compiler
472 dnl 2) has "C" linkage
474 dnl Define HAVE_CARGF etc if "cargf" is declared and links
476 dnl argument 1 is name of function to check
478 dnl ASSUMES argument is a math function with TWO parameters
480 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
481 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
482 GLIBCPP_CHECK_MATH_DECL_2($1)
483 if test x$glibcpp_cv_func_$1_use = x"yes"; then
486 GLIBCPP_CHECK_MATH_DECL_2(_$1)
487 if test x$glibcpp_cv_func__$1_use = x"yes"; then
495 dnl Check to see if the (math function) argument passed is
496 dnl declared when using the c++ compiler
497 dnl ASSUMES argument is a math function with THREE parameters
499 dnl GLIBCPP_CHECK_MATH_DECL_3
500 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [
501 AC_MSG_CHECKING([for $1 declaration])
502 if test x${glibcpp_cv_func_$1_use+set} != xset; then
503 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
506 AC_TRY_COMPILE([#include <math.h>],
508 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
512 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
516 dnl Check to see if the (math function) argument passed is
517 dnl 1) declared when using the c++ compiler
518 dnl 2) has "C" linkage
520 dnl Define HAVE_CARGF etc if "cargf" is declared and links
522 dnl argument 1 is name of function to check
524 dnl ASSUMES argument is a math function with THREE parameters
526 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
527 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
528 GLIBCPP_CHECK_MATH_DECL_3($1)
529 if test x$glibcpp_cv_func_$1_use = x"yes"; then
532 GLIBCPP_CHECK_MATH_DECL_3(_$1)
533 if test x$glibcpp_cv_func__$1_use = x"yes"; then
541 dnl Check to see if the (stdlib function) argument passed is
542 dnl 1) declared when using the c++ compiler
543 dnl 2) has "C" linkage
545 dnl argument 1 is name of function to check
547 dnl ASSUMES argument is a math function with TWO parameters
549 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
550 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
551 AC_MSG_CHECKING([for $1 declaration])
552 if test x${glibcpp_cv_func_$1_use+set} != xset; then
553 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
556 AC_TRY_COMPILE([#include <stdlib.h>],
558 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
562 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
563 if test x$glibcpp_cv_func_$1_use = x"yes"; then
570 dnl Check to see if the (stdlib function) argument passed is
571 dnl 1) declared when using the c++ compiler
572 dnl 2) has "C" linkage
574 dnl argument 1 is name of function to check
576 dnl ASSUMES argument is a function with THREE parameters
578 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3
579 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3, [
580 AC_MSG_CHECKING([for $1 declaration])
581 if test x${glibcpp_cv_func_$1_use+set} != xset; then
582 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
585 AC_TRY_COMPILE([#include <stdlib.h>],
587 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
591 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
592 if test x$glibcpp_cv_func_$1_use = x"yes"; then
599 dnl Because the builtins are picky picky picky about the arguments they take,
600 dnl do an explict linkage tests here.
601 dnl Check to see if the (math function) argument passed is
602 dnl 1) declared when using the c++ compiler
603 dnl 2) has "C" linkage
605 dnl Define HAVE_CARGF etc if "cargf" is declared and links
607 dnl argument 1 is name of function to check
609 dnl ASSUMES argument is a math function with ONE parameter
611 dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
612 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
613 AC_MSG_CHECKING([for $1 declaration])
614 if test x${glibcpp_cv_func_$1_use+set} != xset; then
615 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
618 AC_TRY_COMPILE([#include <math.h>],
620 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
624 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
625 if test x$glibcpp_cv_func_$1_use = x"yes"; then
626 AC_MSG_CHECKING([for $1 linkage])
627 if test x${glibcpp_cv_func_$1_link+set} != xset; then
628 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
629 AC_TRY_LINK([#include <math.h>],
631 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
634 AC_MSG_RESULT($glibcpp_cv_func_$1_link)
635 if test x$glibcpp_cv_func_$1_link = x"yes"; then
636 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
637 AC_DEFINE_UNQUOTED(${ac_tr_func})
644 dnl Check to see what builtin math functions are supported
646 dnl check for __builtin_abs
647 dnl check for __builtin_fabsf
648 dnl check for __builtin_fabs
649 dnl check for __builtin_fabl
650 dnl check for __builtin_labs
651 dnl check for __builtin_sqrtf
652 dnl check for __builtin_sqrtl
653 dnl check for __builtin_sqrt
654 dnl check for __builtin_sinf
655 dnl check for __builtin_sin
656 dnl check for __builtin_sinl
657 dnl check for __builtin_cosf
658 dnl check for __builtin_cos
659 dnl check for __builtin_cosl
661 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
662 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
663 dnl Test for builtin math functions.
664 dnl These are made in gcc/c-common.c
665 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
666 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
667 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
668 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
669 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
671 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
672 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrt)
673 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
675 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
676 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
677 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
679 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
680 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
681 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
683 dnl There is, without a doubt, a more elegant way to have these
684 dnl names exported so that they won't be stripped out of acconfig.h by
685 dnl autoheader. I leave this as an exercise to somebody less frustrated
686 dnl than I.... please email the libstdc++ list if you can figure out a
687 dnl more elegant approach (see autoconf/acgen.m4 and specifically
688 dnl AC_CHECK_FUNC for things to steal.)
690 if test x$dummyvar = x"yes"; then
691 AC_DEFINE(HAVE___BUILTIN_ABS)
692 AC_DEFINE(HAVE___BUILTIN_LABS)
693 AC_DEFINE(HAVE___BUILTIN_COS)
694 AC_DEFINE(HAVE___BUILTIN_COSF)
695 AC_DEFINE(HAVE___BUILTIN_COSL)
696 AC_DEFINE(HAVE___BUILTIN_FABS)
697 AC_DEFINE(HAVE___BUILTIN_FABSF)
698 AC_DEFINE(HAVE___BUILTIN_FABSL)
699 AC_DEFINE(HAVE___BUILTIN_SIN)
700 AC_DEFINE(HAVE___BUILTIN_SINF)
701 AC_DEFINE(HAVE___BUILTIN_SINL)
702 AC_DEFINE(HAVE___BUILTIN_SQRT)
703 AC_DEFINE(HAVE___BUILTIN_SQRTF)
704 AC_DEFINE(HAVE___BUILTIN_SQRTL)
710 dnl Check to see what the underlying c library
711 dnl These checks need to do two things:
712 dnl 1) make sure the name is declared when using the c++ compiler
713 dnl 2) make sure the name has "C" linkage
714 dnl This might seem like overkill but experience has shown that it's not...
716 dnl Define HAVE_STRTOLD if "strtold" is declared and links
717 dnl Define HAVE_STRTOF if "strtof" is declared and links
718 dnl Define HAVE_DRAND48 if "drand48" is declared and links
720 dnl GLIBCPP_CHECK_STDLIB_SUPPORT
721 AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
722 ac_test_CXXFLAGS="${CXXFLAGS+set}"
723 ac_save_CXXFLAGS="$CXXFLAGS"
724 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
726 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
727 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof)
728 AC_CHECK_FUNCS(drand48)
730 CXXFLAGS="$ac_save_CXXFLAGS"
735 dnl Check to see what the underlying c library or math library is like.
736 dnl These checks need to do two things:
737 dnl 1) make sure the name is declared when using the c++ compiler
738 dnl 2) make sure the name has "C" linkage
739 dnl This might seem like overkill but experience has shown that it's not...
741 dnl Define HAVE_CARGF etc if "cargf" is found.
743 dnl GLIBCPP_CHECK_MATH_SUPPORT
744 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
745 ac_test_CXXFLAGS="${CXXFLAGS+set}"
746 ac_save_CXXFLAGS="$CXXFLAGS"
747 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
750 AC_CHECK_LIB(m, sin, libm="-lm")
754 dnl Check to see if certain C math functions exist.
755 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
756 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
757 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
758 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
759 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
760 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
761 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
762 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypot)
764 dnl Check to see if basic C math functions have float versions.
765 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig,
770 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
773 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expf)
774 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
775 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
776 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
777 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
778 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
779 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
780 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf)
781 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
782 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
783 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
784 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
785 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
786 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
787 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
788 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
790 dnl Check to see if basic C math functions have long double versions.
791 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig,
796 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round,
799 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
800 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
801 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
802 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
803 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
804 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
805 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
806 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
807 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl)
808 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
809 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
810 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
811 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
812 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
813 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
814 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
815 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
817 dnl Some runtimes have these functions with a preceding underscore. Please
818 dnl keep this sync'd with the one above. And if you add any new symbol,
819 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
820 dnl Check to see if certain C math functions exist.
822 dnl Check to see if basic C math functions have float versions.
823 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
825 _acosf _asinf _atanf \
827 _coshf _sinhf _tanhf)
828 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
832 dnl Check to see if basic C math functions have long double versions.
833 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
835 _acosl _asinl _atanl \
837 _coshl _sinhl _tanhl)
838 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
843 CXXFLAGS="$ac_save_CXXFLAGS"
848 dnl Check to see if there is native support for complex
850 dnl Don't compile bits in math/* if native support exits.
852 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "copysignl" is found.
854 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
855 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
856 dnl Check for complex versions of math functions of platform.
857 AC_CHECK_LIB(m, main)
858 AC_REPLACE_MATHFUNCS(nan copysignf)
860 dnl For __signbit to signbit conversions.
861 AC_CHECK_FUNCS([__signbit], , [LIBMATHOBJS="$LIBMATHOBJS signbit.lo"])
862 AC_CHECK_FUNCS([__signbitf], , [LIBMATHOBJS="$LIBMATHOBJS signbitf.lo"])
864 dnl Compile the long double complex functions only if the function
865 dnl provides the non-complex long double functions that are needed.
866 dnl Currently this includes copysignl, which should be
867 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
868 if test x$ac_cv_func_copysignl = x"yes"; then
869 AC_CHECK_FUNCS([__signbitl], , [LIBMATHOBJS="$LIBMATHOBJS signbitl.lo"])
872 AC_SUBST(LIBMATHOBJS)
876 dnl Check to see what architecture and operating system we are compiling
877 dnl for. Also, if architecture- or OS-specific flags are required for
878 dnl compilation, pick them up here.
880 dnl GLIBCPP_CHECK_TARGET
881 AC_DEFUN(GLIBCPP_CHECK_TARGET, [
882 . [$]{glibcpp_basedir}/configure.target
883 AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
884 AC_MSG_RESULT(OS config directory is $os_include_dir)
889 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
890 dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
891 dnl must have been previously checked.)
893 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
894 dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h
896 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
897 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
899 dnl Test wchar.h for mbstate_t, which is needed for char_traits and
900 dnl others even if wchar_t support is not on.
901 AC_MSG_CHECKING([for mbstate_t])
902 AC_TRY_COMPILE([#include <wchar.h>],
903 [mbstate_t teststate;],
904 have_mbstate_t=yes, have_mbstate_t=no)
905 AC_MSG_RESULT($have_mbstate_t)
906 if test x"$have_mbstate_t" = xyes; then
907 AC_DEFINE(HAVE_MBSTATE_T)
910 dnl Sanity check for existence of ISO C99 headers for extended encoding.
911 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
912 AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
914 dnl Only continue checking if the ISO C99 headers exist and support is on.
915 if test x"$ac_has_wchar_h" = xyes &&
916 test x"$ac_has_wctype_h" = xyes &&
917 test x"$enable_c_mbchar" != xno; then
919 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
920 dnl numeric_limits can instantiate type_traits<wchar_t>
921 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
922 AC_TRY_COMPILE([#include <wchar.h>],
923 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
924 has_wchar_minmax=yes, has_wchar_minmax=no)
925 AC_MSG_RESULT($has_wchar_minmax)
927 dnl Test wchar.h for WEOF, which is what we use to determine whether
928 dnl to specialize for char_traits<wchar_t> or not.
929 AC_MSG_CHECKING([for WEOF])
932 #include <stddef.h>],
934 has_weof=yes, has_weof=no)
935 AC_MSG_RESULT($has_weof)
937 dnl Tests for wide character functions used in char_traits<wchar_t>.
939 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset,, \
942 dnl Checks for names injected into std:: by the c_std headers.
943 AC_CHECK_FUNCS(btowc wctob fgetwc fgetwc fgetws fputwc fputws fwide \
944 fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
945 vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
946 mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
947 wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
948 wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \
951 AC_MSG_CHECKING([for ISO C99 wchar_t support])
952 if test x"$has_weof" = xyes &&
953 test x"$has_wchar_minmax" = xyes &&
954 test x"$ac_wfuncs" = xyes; then
955 ac_isoC99_wchar_t=yes
959 AC_MSG_RESULT($ac_isoC99_wchar_t)
961 dnl Use iconv for wchar_t to char conversions. As such, check for
962 dnl X/Open Portability Guide, version 2 features (XPG2).
963 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
964 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
966 dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
967 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
969 LIBS="$LIBS $libiconv"
971 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
972 ac_XPG2funcs=yes, ac_XPG2funcs=no)
976 AC_MSG_CHECKING([for XPG2 wchar_t support])
977 if test x"$ac_has_iconv_h" = xyes &&
978 test x"$ac_has_langinfo_h" = xyes &&
979 test x"$ac_XPG2funcs" = xyes; then
984 AC_MSG_RESULT($ac_XPG2_wchar_t)
986 dnl At the moment, only enable wchar_t specializations if all the
987 dnl above support is present.
988 AC_MSG_CHECKING([for enabled wchar_t specializations])
989 if test x"$ac_isoC99_wchar_t" = xyes &&
990 test x"$ac_XPG2_wchar_t" = xyes; then
991 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
997 dnl Wide characters disabled by the user.
998 AC_MSG_WARN([wchar_t support disabled.])
1004 dnl Check for special debugging mode; not for production use.
1006 dnl GLIBCPP_ENABLE_DEBUG
1007 dnl --enable-debug sets '-ggdb3 -O0'.
1008 dnl --disable-debug sets '-g' and whatever optimization options the
1009 dnl compiler can handle.
1010 dnl + --enable-maintainer-mode automatically defaults this to on.
1011 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
1012 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
1013 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1014 dnl defaults to `no'.
1015 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
1016 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
1017 AC_ARG_ENABLE(debug,
1018 changequote(<<, >>)dnl
1019 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
1020 changequote([, ])dnl
1021 [case "${enableval}" in
1022 yes) enable_debug=yes ;;
1023 no) enable_debug=no ;;
1024 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
1026 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
1028 dnl Option parsed, now set things appropriately
1029 case "${enable_debug}" in
1031 DEBUG_FLAGS='-O0 -ggdb3'
1037 AC_SUBST(DEBUG_FLAGS)
1042 dnl Check for "unusual" flags to pass to the compiler while building.
1044 dnl GLIBCPP_ENABLE_CXX_FLAGS
1045 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1046 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1047 dnl Somehow this same set of flags must be passed when [re]building
1049 dnl --disable-cxx-flags passes nothing.
1050 dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
1051 dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
1052 dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
1053 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
1054 dnl If "default flags" is an empty string (or "none"), the effect is
1055 dnl the same as --disable or --enable=no.
1056 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1057 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1058 AC_ARG_ENABLE(cxx-flags,
1059 changequote(<<, >>)dnl
1060 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
1061 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1062 changequote([, ])dnl
1063 [case "x$enableval" in
1065 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1067 enable_cxx_flags='' ;;
1069 enable_cxx_flags="$enableval" ;;
1071 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
1073 dnl Thinko on my part during design. This kludge is the workaround.
1074 if test "$enable_cxx_flags" = "none"; then
1075 enable_cxx_flags='';
1078 dnl Run through flags (either default or command-line) and set anything
1079 dnl extra (e.g., #defines) that must accompany particular g++ options.
1080 if test -n "$enable_cxx_flags"; then
1081 for f in $enable_cxx_flags; do
1085 *) # and we're trying to pass /what/ exactly?
1086 AC_MSG_ERROR([compiler flags start with a -]) ;;
1090 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1091 AC_SUBST(EXTRA_CXX_FLAGS)
1096 dnl Check for which locale library to use: gnu or generic.
1098 dnl GLIBCPP_ENABLE_CLOCALE
1099 dnl --enable-clocale=gnu sets config/locale/c_locale_gnu.cc and friends
1100 dnl --enable-clocale=generic sets config/locale/c_locale_generic.cc and friends
1102 dnl default is generic
1104 AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
1105 AC_MSG_CHECKING([for clocale to use])
1106 AC_ARG_ENABLE(clocale,
1107 [ --enable-clocale enable model for target locale package.
1108 --enable-clocale=MODEL use MODEL target-speific locale package. [default=generic]
1110 if test x$enable_clocale = xno; then
1115 enable_clocale_flag=$enable_clocale
1117 dnl Probe for locale support if no specific model is specified.
1118 dnl Default to "generic"
1119 if test x$enable_clocale_flag = xno; then
1120 case x${target_os} in
1122 AC_EGREP_CPP([_GLIBCPP_ok], [
1123 #include <features.h>
1124 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1127 ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
1129 # Test for bugs early in glibc-2.2.x series
1130 if test x$enable_clocale_flag = xgnu; then
1132 #define _GNU_SOURCE 1
1136 const char __one[] = "Äuglein Augmen";
1137 const char __two[] = "Äuglein";
1142 loc = __newlocale(1 << LC_ALL, "de_DE", 0);
1143 loc_dup = __duplocale(loc);
1144 i = __strcoll_l(__one, __two, loc);
1145 j = __strcoll_l(__one, __two, loc_dup);
1149 [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
1150 [enable_clocale_flag=generic])
1153 # ... at some point put __strxfrm_l tests in as well.
1156 enable_clocale_flag=generic
1161 dnl Deal with gettext issues.
1163 [ --enable-nls use Native Language Support (default)],
1167 dnl Set configure bits for specified locale package
1168 case x${enable_clocale_flag} in
1170 AC_MSG_RESULT(generic)
1172 CLOCALE_H=config/locale/generic/c_locale.h
1173 CLOCALE_CC=config/locale/generic/c_locale.cc
1174 CCODECVT_H=config/locale/generic/codecvt_specializations.h
1175 CCOLLATE_CC=config/locale/generic/collate_members.cc
1176 CCTYPE_CC=config/locale/generic/ctype_members.cc
1177 CMESSAGES_H=config/locale/generic/messages_members.h
1178 CMESSAGES_CC=config/locale/generic/messages_members.cc
1179 CMONEY_CC=config/locale/generic/monetary_members.cc
1180 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1181 CTIME_CC=config/locale/generic/time_members.cc
1186 # Declare intention to use gettext, and add support for specific
1188 # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
1191 # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
1192 AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
1193 if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
1196 # Export the build objects.
1197 for ling in $ALL_LINGUAS; do \
1198 glibcpp_MOFILES="$glibcpp_MOFILES $ling.mo"; \
1199 glibcpp_POFILES="$glibcpp_POFILES $ling.po"; \
1201 AC_SUBST(glibcpp_MOFILES)
1202 AC_SUBST(glibcpp_POFILES)
1204 CLOCALE_H=config/locale/gnu/c_locale.h
1205 CLOCALE_CC=config/locale/gnu/c_locale.cc
1206 CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1207 CCOLLATE_CC=config/locale/gnu/collate_members.cc
1208 CCTYPE_CC=config/locale/gnu/ctype_members.cc
1209 CMESSAGES_H=config/locale/gnu/messages_members.h
1210 CMESSAGES_CC=config/locale/gnu/messages_members.cc
1211 CMONEY_CC=config/locale/gnu/monetary_members.cc
1212 CNUMERIC_CC=config/locale/gnu/numeric_members.cc
1213 CTIME_CC=config/locale/gnu/time_members.cc
1216 AC_MSG_RESULT(generic)
1218 CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h
1219 CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc
1220 CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1221 CCOLLATE_CC=config/locale/generic/collate_members.cc
1222 CCTYPE_CC=config/locale/generic/ctype_members.cc
1223 CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h
1224 CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc
1225 CMONEY_CC=config/locale/generic/monetary_members.cc
1226 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1227 CTIME_CC=config/locale/generic/time_members.cc
1230 echo "$enable_clocale is an unknown locale package" 1>&2
1235 # This is where the testsuite looks for locale catalogs, using the
1236 # -DLOCALEDIR define during testsuite compilation.
1237 glibcpp_localedir=${glibcpp_builddir}/po/share/locale
1238 AC_SUBST(glibcpp_localedir)
1242 AC_SUBST(CCODECVT_H)
1243 AC_SUBST(CMESSAGES_H)
1244 AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
1245 AC_LINK_FILES($CCOLLATE_CC, src/collate.cc)
1246 AC_LINK_FILES($CCTYPE_CC, src/ctype.cc)
1247 AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
1248 AC_LINK_FILES($CMONEY_CC, src/monetary.cc)
1249 AC_LINK_FILES($CNUMERIC_CC, src/numeric.cc)
1250 AC_LINK_FILES($CTIME_CC, src/time.cc)
1255 dnl Check for which I/O library to use: libio, or something specific.
1257 dnl GLIBCPP_ENABLE_CSTDIO
1258 dnl --enable-cstdio=libio sets config/io/c_io_libio.h and friends
1260 dnl default is stdio
1262 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1263 AC_MSG_CHECKING([for cstdio to use])
1264 AC_ARG_ENABLE(cstdio,
1265 [ --enable-cstdio enable stdio for target io package.
1266 --enable-cstdio=LIB use LIB target-speific io package. [default=stdio]
1268 if test x$enable_cstdio = xno; then
1271 enable_cstdio=stdio)
1273 enable_cstdio_flag=$enable_cstdio
1275 dnl Check if a valid I/O package
1276 case x${enable_cstdio_flag} in
1278 CSTDIO_H=config/io/c_io_libio.h
1279 BASIC_FILE_H=config/io/basic_file_libio.h
1280 BASIC_FILE_CC=config/io/basic_file_libio.cc
1281 AC_MSG_RESULT(libio)
1283 # see if we are on a system with libio native (ie, linux)
1284 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1286 # Need to check and see what version of glibc is being used. If
1287 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1288 # compile most of libio for linux systems.
1289 if test x$has_libio = x"yes"; then
1292 AC_MSG_CHECKING([for glibc version >= 2.2])
1293 AC_EGREP_CPP([ok], [
1294 #include <features.h>
1295 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1298 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1299 AC_MSG_RESULT($glibc_satisfactory)
1303 # XXX at the moment, admit defeat and force the recompilation
1304 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
1305 glibc_satisfactory=no
1307 if test x$glibc_satisfactory = x"yes"; then
1312 # bkoz XXX need to add checks to enable this
1313 # pme XXX here's a first pass at such a check
1314 if test x$enable_c_mbchar != xno; then
1322 # Using libio, but <libio.h> doesn't exist on the target system. . .
1324 # bkoz XXX need to add checks to enable this
1325 # pme XXX here's a first pass at such a check
1326 if test x$enable_c_mbchar != xno; then
1333 xstdio | x | xno | xnone | xyes)
1335 CSTDIO_H=config/io/c_io_stdio.h
1336 BASIC_FILE_H=config/io/basic_file_stdio.h
1337 BASIC_FILE_CC=config/io/basic_file_stdio.cc
1338 AC_MSG_RESULT(stdio)
1340 # We're not using stdio.
1345 echo "$enable_cstdio is an unknown io package" 1>&2
1350 AC_SUBST(BASIC_FILE_H)
1351 AC_LINK_FILES($BASIC_FILE_CC, src/basic_file.cc)
1353 # 2000-08-04 bkoz hack
1354 CCODECVT_C=config/io/c_io_libio_codecvt.c
1355 AC_SUBST(CCODECVT_C)
1356 # 2000-08-04 bkoz hack
1358 AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO,
1359 test "$need_libio" = yes || test "$need_wlibio" = yes)
1360 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1361 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1362 if test "$need_libio" = yes || test "$need_wlibio" = yes; then
1363 libio_la=../libio/libio.la
1372 dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
1373 dnl We must stage the required headers so that they will be installed
1374 dnl with the library (unlike libgcc, the STL implementation is provided
1375 dnl solely within headers). Since we must not inject random user-space
1376 dnl macro names into user-provided C++ code, we first stage into <file>-in
1377 dnl and process to <file> with an output command. The reason for a two-
1378 dnl stage process here is to correctly handle $srcdir!=$objdir without
1379 dnl having to write complex code (the sed commands to clean the macro
1380 dnl namespace are complex and fragile enough as it is). We must also
1381 dnl add a relative path so that -I- is supported properly.
1383 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1384 AC_MSG_CHECKING([for thread model used by GCC])
1385 target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
1386 AC_MSG_RESULT([$target_thread_file])
1388 if test $target_thread_file != single; then
1389 AC_DEFINE(HAVE_GTHR_DEFAULT)
1390 AC_DEFINE(_GLIBCPP_SUPPORTS_WEAK, __GXX_WEAK__)
1393 glibcpp_thread_h=gthr-$target_thread_file.h
1394 AC_SUBST(glibcpp_thread_h)
1399 dnl Check for exception handling support. If an explicit enable/disable
1400 dnl sjlj exceptions is given, we don't have to detect. Otherwise the
1401 dnl target may or may not support call frame exceptions.
1403 dnl GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
1404 dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
1405 dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1407 dnl Define _GLIBCPP_SJLJ_EXCEPTIONS if the compiler is configured for it.
1409 AC_DEFUN(GLIBCPP_ENABLE_SJLJ_EXCEPTIONS, [
1410 AC_MSG_CHECKING([for exception model to use])
1413 AC_ARG_ENABLE(sjlj-exceptions,
1414 [ --enable-sjlj-exceptions force use of builtin_setjmp for exceptions],
1416 [dnl Botheration. Now we've got to detect the exception model.
1417 dnl Link tests against libgcc.a are problematic since -- at least
1418 dnl as of this writing -- we've not been given proper -L bits for
1419 dnl single-tree newlib and libgloss.
1421 dnl This is what AC_TRY_COMPILE would do if it didn't delete the
1422 dnl conftest files before we got a change to grep them first.
1423 cat > conftest.$ac_ext << EOF
1424 [#]line __oline__ "configure"
1433 old_CXXFLAGS="$CXXFLAGS"
1434 CXXFLAGS="-S -fexceptions"
1435 if AC_TRY_EVAL(ac_compile); then
1436 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
1437 enable_sjlj_exceptions=yes
1438 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
1439 enable_sjlj_exceptions=no
1442 CXXFLAGS="$old_CXXFLAGS"
1444 if test x$enable_sjlj_exceptions = xyes; then
1445 AC_DEFINE(_GLIBCPP_SJLJ_EXCEPTIONS, 1,
1446 [Define if the compiler is configured for setjmp/longjmp exceptions.])
1447 ac_exception_model_name=sjlj
1448 elif test x$enable_sjlj_exceptions = xno; then
1449 ac_exception_model_name="call frame"
1451 AC_MSG_ERROR([unable to detect exception model])
1454 AC_MSG_RESULT($ac_exception_model_name)
1459 dnl Check for libunwind exception handling support. If enabled then
1460 dnl we assume that the _Unwind_* functions that make up the Unwind ABI
1461 dnl (_Unwind_RaiseException, _Unwind_Resume, etc.) are defined by
1462 dnl libunwind instead of libgcc and that libstdc++ has a dependency
1463 dnl on libunwind as well as libgcc.
1465 dnl GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS
1466 dnl --enable-libunwind-exceptions forces the use of libunwind.
1467 dnl --disable-libunwind-exceptions assumes there is no libunwind.
1469 dnl Define _GLIBCPP_LIBUNWIND_EXCEPTIONS if requested.
1471 AC_DEFUN(GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS, [
1472 AC_MSG_CHECKING([for use of libunwind])
1473 AC_ARG_ENABLE(libunwind-exceptions,
1474 [ --enable-libunwind-exceptions force use of libunwind for exceptions],
1475 use_libunwind_exceptions=$enableval,
1476 use_libunwind_exceptions=no)
1477 AC_MSG_RESULT($use_libunwind_exceptions)
1478 dnl Option parsed, now set things appropriately
1479 if test x"$use_libunwind_exceptions" = xyes; then
1480 LIBUNWIND_FLAG="-lunwind"
1484 AC_SUBST(LIBUNWIND_FLAG)
1488 dnl Check for ISO/IEC 9899:1999 "C99" support.
1490 dnl GLIBCPP_ENABLE_C99
1491 dnl --enable-c99 defines _GLIBCPP_USE_C99
1492 dnl --disable-c99 leaves _GLIBCPP_USE_C99 undefined
1493 dnl + Usage: GLIBCPP_ENABLE_C99[(DEFAULT)]
1494 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1495 dnl defaults to `no'.
1496 dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
1498 dnl GLIBCPP_ENABLE_C99
1499 AC_DEFUN(GLIBCPP_ENABLE_C99, [dnl
1500 define([GLIBCPP_ENABLE_C99_DEFAULT], ifelse($1, yes, yes, no))dnl
1503 changequote(<<, >>)dnl
1504 <<--enable-c99 turns on 'ISO/IEC 9899:1999 support' [default=>>GLIBCPP_ENABLE_C99_DEFAULT],
1505 changequote([, ])dnl
1506 [case "$enableval" in
1507 yes) enable_c99=yes ;;
1508 no) enable_c99=no ;;
1509 *) AC_MSG_ERROR([Unknown argument to enable/disable C99]) ;;
1511 enable_c99=GLIBCPP_ENABLE_C99_DEFAULT)dnl
1516 # Check for the existence of <math.h> functions used if C99 is enabled.
1518 AC_MSG_CHECKING([for ISO C99 support in <math.h>])
1519 AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no])
1520 AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no])
1521 AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no])
1522 AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no])
1523 AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no])
1524 AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no])
1525 AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no])
1526 AC_TRY_COMPILE([#include <math.h>],
1527 [isgreaterequal(0.0,0.0);],, [ac_c99_math=no])
1528 AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no])
1529 AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no])
1530 AC_TRY_COMPILE([#include <math.h>],
1531 [islessgreater(0.0,0.0);],, [ac_c99_math=no])
1532 AC_TRY_COMPILE([#include <math.h>],
1533 [isunordered(0.0,0.0);],, [ac_c99_math=no])
1534 AC_MSG_RESULT($ac_c99_math)
1536 # Check for the existence in <stdio.h> of vscanf, et. al.
1538 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
1539 AC_TRY_COMPILE([#include <stdio.h>],
1540 [snprintf("12", 0, "%i");],, [ac_c99_stdio=no])
1541 AC_TRY_COMPILE([#include <stdio.h>
1543 void foo(char* fmt, ...)
1544 {va_list args; va_start(args, fmt);
1545 vfscanf(stderr, "%i", args);}],
1546 [],, [ac_c99_stdio=no])
1547 AC_TRY_COMPILE([#include <stdio.h>
1549 void foo(char* fmt, ...)
1550 {va_list args; va_start(args, fmt);
1551 vscanf("%i", args);}],
1552 [],, [ac_c99_stdio=no])
1553 AC_TRY_COMPILE([#include <stdio.h>
1555 void foo(char* fmt, ...)
1556 {va_list args; va_start(args, fmt);
1557 vsnprintf(fmt, 0, "%i", args);}],
1558 [],, [ac_c99_stdio=no])
1559 AC_TRY_COMPILE([#include <stdio.h>
1561 void foo(char* fmt, ...)
1562 {va_list args; va_start(args, fmt);
1563 vsscanf(fmt, "%i", args);}],
1564 [],, [ac_c99_stdio=no])
1565 AC_MSG_RESULT($ac_c99_stdio)
1567 # Check for the existence in <stdlib.h> of lldiv_t, et. al.
1569 AC_MSG_CHECKING([for lldiv_t declaration])
1570 AC_CACHE_VAL(ac_c99_lldiv_t, [
1571 AC_TRY_COMPILE([#include <stdlib.h>],
1573 [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no])
1575 AC_MSG_RESULT($ac_c99_lldiv_t)
1577 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
1578 AC_TRY_COMPILE([#include <stdlib.h>],
1579 [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no])
1580 AC_TRY_COMPILE([#include <stdlib.h>],
1581 [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no])
1582 AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no])
1583 AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no])
1584 AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no])
1585 AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no])
1586 if test x"$ac_c99_lldiv_t" = x"no"; then
1589 AC_MSG_RESULT($ac_c99_stdlib)
1591 # Check for the existence of <wchar.h> functions used if C99 is enabled.
1592 # XXX the wchar.h checks should be rolled into the general C99 bits.
1594 AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>])
1595 AC_TRY_COMPILE([#include <wchar.h>],
1596 [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no])
1597 AC_TRY_COMPILE([#include <wchar.h>],
1598 [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no])
1599 AC_TRY_COMPILE([#include <wchar.h>],
1600 [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no])
1601 AC_MSG_RESULT($ac_c99_wchar)
1603 AC_MSG_CHECKING([for enabled ISO C99 support])
1604 if test x"$ac_c99_math" = x"no" ||
1605 test x"$ac_c99_stdio" = x"no" ||
1606 test x"$ac_c99_stdlib" = x"no" ||
1607 test x"$ac_c99_wchar" = x"no"; then
1610 AC_MSG_RESULT($enable_c99)
1612 # Option parsed, now set things appropriately
1613 if test x"$enable_c99" = x"yes"; then
1614 AC_DEFINE(_GLIBCPP_USE_C99)
1622 dnl Check for template specializations for the 'long long' type extension.
1623 dnl The result determines only whether 'long long' I/O is enabled; things
1624 dnl like numeric_limits<> specializations are always available.
1626 dnl GLIBCPP_ENABLE_LONG_LONG
1627 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1628 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1629 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1630 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1631 dnl defaults to `no'.
1632 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1634 dnl GLIBCPP_ENABLE_LONG_LONG
1635 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1636 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1638 AC_ARG_ENABLE(long-long,
1639 changequote(<<, >>)dnl
1640 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1641 changequote([, ])dnl
1642 [case "$enableval" in
1643 yes) enable_long_long=yes ;;
1644 no) enable_long_long=no ;;
1645 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1647 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1652 AC_MSG_CHECKING([for enabled long long I/O support])
1653 # iostreams require strtoll, strtoull to compile
1654 AC_TRY_COMPILE([#include <stdlib.h>],
1655 [char* tmp; strtoll("gnu", &tmp, 10);],,[enable_long_long=no])
1656 AC_TRY_COMPILE([#include <stdlib.h>],
1657 [char* tmp; strtoull("gnu", &tmp, 10);],,[enable_long_long=no])
1659 # Option parsed, now set things appropriately
1660 if test x"$enable_long_long" = xyes; then
1661 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1663 AC_MSG_RESULT($enable_long_long)
1670 dnl Check for what kind of C headers to use.
1672 dnl GLIBCPP_ENABLE_CHEADERS
1673 dnl --enable-cheaders= [does stuff].
1674 dnl --disable-cheaders [does not do anything, really].
1675 dnl + This will eventually need to be 'c_shadow' by default.
1676 dnl + Usage: GLIBCPP_ENABLE_CHEADERS[(DEFAULT)]
1677 dnl Where DEFAULT is either `c' or `c_std' or 'c_shadow'.
1678 dnl If ommitted, it defaults to `c_std'.
1679 AC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl
1680 define([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl
1681 AC_MSG_CHECKING([for c header strategy to use])
1682 AC_ARG_ENABLE(cheaders,
1683 changequote(<<, >>)dnl
1684 << --enable-cheaders construct "C" header files for g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT],
1686 [case "$enableval" in
1691 enable_cheaders=c_std
1694 enable_cheaders=c_shadow
1696 *) AC_MSG_ERROR([Unknown argument to enable/disable "C" headers])
1699 enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT)
1700 AC_MSG_RESULT($enable_cheaders)
1702 dnl Option parsed, now set things appropriately
1703 case "$enable_cheaders" in
1705 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_shadow'
1708 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_std'
1711 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c'
1715 AC_SUBST(C_INCLUDE_DIR)
1716 AM_CONDITIONAL(GLIBCPP_C_HEADERS_C, test "$enable_cheaders" = c)
1717 AM_CONDITIONAL(GLIBCPP_C_HEADERS_C_STD, test "$enable_cheaders" = c_std)
1718 AM_CONDITIONAL(GLIBCPP_C_HEADERS_COMPATIBILITY, test "$c_compatibility" = yes)
1723 dnl Check for wide character support. Has the same effect as the option
1724 dnl in gcc's configure, but in a form that autoconf can mess with.
1726 dnl GLIBCPP_ENABLE_C_MBCHAR
1727 dnl --enable-c-mbchar requests all the wchar_t stuff.
1728 dnl --disable-c-mbchar doesn't.
1729 dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1730 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1731 dnl defaults to `no'.
1732 AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1733 define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1734 AC_ARG_ENABLE(c-mbchar,
1735 changequote(<<, >>)dnl
1736 << --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1737 changequote([, ])dnl
1738 [case "$enableval" in
1739 yes) enable_c_mbchar=yes ;;
1740 no) enable_c_mbchar=no ;;
1741 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1743 enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1744 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1749 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1751 dnl TOPLEVEL_INCLUDES
1752 dnl LIBMATH_INCLUDES
1753 dnl LIBSUPCXX_INCLUDES
1755 dnl CSHADOW_INCLUDES
1757 dnl GLIBCPP_EXPORT_INCLUDES
1758 AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1759 # Root level of the build directory include sources.
1760 GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include"
1762 # Passed down for canadian crosses.
1763 if test x"$CANADIAN" = xyes; then
1764 TOPLEVEL_INCLUDES='-I$(includedir)'
1767 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1769 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1771 if test x"$need_libio" = xyes; then
1772 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1773 AC_SUBST(LIBIO_INCLUDES)
1776 # Now, export this to all the little Makefiles....
1777 AC_SUBST(GLIBCPP_INCLUDES)
1778 AC_SUBST(TOPLEVEL_INCLUDES)
1779 AC_SUBST(LIBMATH_INCLUDES)
1780 AC_SUBST(LIBSUPCXX_INCLUDES)
1785 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1787 AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1788 # Optimization flags that are probably a good idea for thrill-seekers. Just
1789 # uncomment the lines below and make, everything else is ready to go...
1790 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1792 AC_SUBST(OPTIMIZE_CXXFLAGS)
1794 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1795 AC_SUBST(WARN_FLAGS)
1799 dnl GLIBCPP_EXPORT_INSTALL_INFO
1800 dnl calculates gxx_install_dir
1801 dnl exports glibcpp_toolexecdir
1802 dnl exports glibcpp_toolexeclibdir
1803 dnl exports glibcpp_prefixdir
1805 dnl Assumes cross_compiling bits already done, and with_cross_host in
1808 dnl GLIBCPP_EXPORT_INSTALL_INFO
1809 AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
1810 # Assumes glibcpp_builddir, glibcpp_srcdir are alreay set up and
1811 # exported correctly in GLIBCPP_CONFIGURE.
1812 glibcpp_toolexecdir=no
1813 glibcpp_toolexeclibdir=no
1814 glibcpp_prefixdir=${prefix}
1816 # Process the option --with-gxx-include-dir=<path to include-files directory>
1817 AC_MSG_CHECKING([for --with-gxx-include-dir])
1818 AC_ARG_WITH(gxx-include-dir,
1819 [ --with-gxx-include-dir the installation directory for include files],
1820 [case "${withval}" in
1822 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
1829 gxx_include_dir=${withval}
1831 esac], [gxx_include_dir=no])
1832 AC_MSG_RESULT($gxx_include_dir)
1834 # Process the option "--enable-version-specific-runtime-libs"
1835 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
1836 AC_ARG_ENABLE(version-specific-runtime-libs,
1837 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
1838 [case "$enableval" in
1839 yes) version_specific_libs=yes ;;
1840 no) version_specific_libs=no ;;
1841 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
1843 version_specific_libs=no)dnl
1844 # Option set, now we can test it.
1845 AC_MSG_RESULT($version_specific_libs)
1847 # Default case for install directory for include files.
1848 if test $version_specific_libs = no && test $gxx_include_dir = no; then
1849 gxx_include_dir='$(prefix)'/include/c++/${gcc_version}
1852 # Version-specific runtime libs processing.
1853 if test $version_specific_libs = yes; then
1854 # Need the gcc compiler version to know where to install libraries
1855 # and header files if --enable-version-specific-runtime-libs option
1857 if test x"$gxx_include_dir" = x"no"; then
1858 gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/c++
1860 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1861 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
1864 # Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
1865 # Install a library built with a cross compiler in tooldir, not libdir.
1866 if test x"$glibcpp_toolexecdir" = x"no"; then
1867 if test -n "$with_cross_host" &&
1868 test x"$with_cross_host" != x"no"; then
1869 glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
1870 glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)'
1872 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1873 glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)'
1877 AC_MSG_CHECKING([for install location])
1878 AC_MSG_RESULT($gxx_include_dir)
1880 AC_SUBST(glibcpp_prefixdir)
1881 AC_SUBST(gxx_include_dir)
1882 AC_SUBST(glibcpp_toolexecdir)
1883 AC_SUBST(glibcpp_toolexeclibdir)
1887 # Check for functions in math library.
1888 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1890 # This file can be copied and used freely without restrictions. It can
1891 # be used in projects which are not available under the GNU Public License
1892 # but which still want to provide support for the GNU gettext functionality.
1893 # Please note that the actual code is *not* freely available.
1897 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1898 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1899 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])])
1902 dnl This macro searches for a GNU version of make. If a match is found, the
1903 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1904 dnl set to "#". This is useful for including a special features in a Makefile,
1905 dnl which cannot be handled by other versions of make. The variable
1906 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1907 dnl the empty string otherwise.
1909 dnl Here is an example of its use:
1911 dnl Makefile.in might contain:
1913 dnl # A failsafe way of putting a dependency rule into a makefile
1915 dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1917 dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1918 dnl @ifGNUmake@ include $(DEPEND)
1919 dnl @ifGNUmake@ endif
1921 dnl Then configure.in would normally contain:
1923 dnl CHECK_GNU_MAKE()
1924 dnl AC_OUTPUT(Makefile)
1926 dnl Then perhaps to cause gnu make to override any other make, we could do
1927 dnl something like this (note that GNU make always looks for GNUmakefile first):
1929 dnl if ! test x$_cv_gnu_make_command = x ; then
1930 dnl mv Makefile GNUmakefile
1931 dnl echo .DEFAULT: > Makefile ;
1932 dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1935 dnl Then, if any (well almost any) other make is called, and GNU make also
1936 dnl exists, then the other make wraps the GNU make.
1938 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1939 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
1941 dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1942 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1943 dnl #### conditional's subshell (" --version" is not a command), using a
1944 dnl #### different option to grep(1).
1946 dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not
1947 dnl #### ${MAKE:-make}).
1950 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1951 _cv_gnu_make_command='' ;
1952 dnl Search all the common names for GNU make
1953 for a in "${MAKE-make}" make gmake gnumake ; do
1954 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
1956 _cv_gnu_make_command=$a ;
1961 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1962 dnl string, '#' otherwise
1963 if test "x$_cv_gnu_make_command" != "x" ; then
1972 dnl Check for headers for, and arguments to, the setrlimit() function.
1973 dnl Used only in testsuite_hooks.h.
1974 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT_ancilliary, [
1975 AC_TRY_COMPILE([#include <sys/resource.h>
1977 ], [ int f = RLIMIT_$1 ; ],
1978 [glibcpp_mresult=1], [glibcpp_mresult=0])
1979 AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcpp_mresult,
1980 [Only used in build directory testsuite_hooks.h.])
1982 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT, [
1983 setrlimit_have_headers=yes
1984 AC_CHECK_HEADERS(sys/resource.h unistd.h,
1986 setrlimit_have_headers=no)
1987 # If don't have the headers, then we can't run the tests now, and we
1988 # won't be seeing any of these during testsuite compilation.
1989 if test $setrlimit_have_headers = yes; then
1990 # Can't do these in a loop, else the resulting syntax is wrong.
1991 GLIBCPP_CHECK_SETRLIMIT_ancilliary(DATA)
1992 GLIBCPP_CHECK_SETRLIMIT_ancilliary(RSS)
1993 GLIBCPP_CHECK_SETRLIMIT_ancilliary(VMEM)
1994 GLIBCPP_CHECK_SETRLIMIT_ancilliary(AS)
1996 # Check for rlimit, setrlimit.
1997 AC_CACHE_VAL(ac_setrlimit, [
1998 AC_TRY_COMPILE([#include <sys/resource.h>
2001 [ struct rlimit r; setrlimit(0, &r);],
2002 [ac_setrlimit=yes], [ac_setrlimit=no])
2006 AC_MSG_CHECKING([for testsuite memory limit support])
2007 if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then
2009 AC_DEFINE(_GLIBCPP_MEM_LIMITS)
2013 AC_MSG_RESULT($ac_mem_limits)
2018 dnl Does any necessary configuration of the testsuite directory. Generates
2019 dnl the testsuite_hooks.h header.
2021 dnl GLIBCPP_CONFIGURE_TESTSUITE [no args]
2022 AC_DEFUN(GLIBCPP_CONFIGURE_TESTSUITE, [
2023 GLIBCPP_CHECK_SETRLIMIT
2025 # Look for setenv, so that extended locale tests can be performed.
2026 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv)
2030 sinclude(../libtool.m4)
2031 dnl The lines below arrange for aclocal not to bring an installed
2032 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
2033 dnl add a definition of LIBTOOL to Makefile.in.
2034 ifelse(,,,[AC_SUBST(LIBTOOL)
2035 AC_DEFUN([AM_PROG_LIBTOOL])
2036 AC_DEFUN([AC_LIBTOOL_DLOPEN])
2037 AC_DEFUN([AC_PROG_LD])
2041 # Check whether LC_MESSAGES is available in <locale.h>.
2042 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2044 # This file file be copied and used freely without restrictions. It can
2045 # be used in projects which are not available under the GNU Public License
2046 # but which still want to provide support for the GNU gettext functionality.
2047 # Please note that the actual code is *not* freely available.
2051 AC_DEFUN(AC_LC_MESSAGES, [
2052 AC_CHECK_HEADER(locale.h, [
2053 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
2054 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2055 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
2056 if test $ac_cv_val_LC_MESSAGES = yes; then
2057 AC_DEFINE(HAVE_LC_MESSAGES)
2064 dnl Check for whether the Boost-derived checks should be turned on.
2066 dnl GLIBCPP_ENABLE_CONCEPT_CHECKS
2067 dnl --enable-concept-checks turns them on.
2068 dnl --disable-concept-checks leaves them off.
2069 dnl + Usage: GLIBCPP_ENABLE_CONCEPT_CHECKS[(DEFAULT)]
2070 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
2071 dnl defaults to `no'.
2072 AC_DEFUN(GLIBCPP_ENABLE_CONCEPT_CHECKS, [dnl
2073 define([GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT], ifelse($1, yes, yes, no))dnl
2074 AC_ARG_ENABLE(concept-checks,
2075 changequote(<<, >>)dnl
2076 << --enable-concept-checks use Boost-derived template checks [default=>>GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT],
2077 changequote([, ])dnl
2078 [case "$enableval" in
2079 yes) enable_concept_checks=yes ;;
2080 no) enable_concept_checks=no ;;
2081 *) AC_MSG_ERROR([Unknown argument to enable/disable concept checks]) ;;
2083 enable_concept_checks=GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT)dnl
2084 dnl Option parsed, now set things appropriately
2085 if test x"$enable_concept_checks" = xyes; then
2086 AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS)
2092 dnl Add version tags to symbols in shared library (or not), additionally
2093 dnl marking other symbols as private/local (or not).
2095 dnl GLIBCPP_ENABLE_SYMVERS
2096 dnl --enable-symvers=style adds a version script to the linker call when
2097 dnl creating the shared library. The choice of version script is
2098 dnl controlled by 'style'.
2099 dnl --disable-symvers does not.
2100 dnl + Usage: GLIBCPP_ENABLE_SYMVERS[(DEFAULT)]
2101 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
2102 dnl defaults to `no'. Passing `yes' tries to choose a default style
2103 dnl based on linker characteristics. Passing 'no' disables versioning.
2104 AC_DEFUN(GLIBCPP_ENABLE_SYMVERS, [dnl
2105 define([GLIBCPP_ENABLE_SYMVERS_DEFAULT], ifelse($1, yes, yes, no))dnl
2106 AC_ARG_ENABLE(symvers,
2107 changequote(<<, >>)dnl
2108 << --enable-symvers=style enables symbol versioning of the shared library [default=>>GLIBCPP_ENABLE_SYMVERS_DEFAULT],
2109 changequote([, ])dnl
2110 [case "$enableval" in
2111 yes) enable_symvers=yes ;;
2112 no) enable_symvers=no ;;
2113 # other names here, just as sanity checks
2114 #gnu|sun|etcetera) enable_symvers=$enableval ;;
2115 gnu) enable_symvers=$enableval ;;
2116 *) AC_MSG_ERROR([Unknown argument to enable/disable symvers]) ;;
2118 enable_symvers=GLIBCPP_ENABLE_SYMVERS_DEFAULT)dnl
2120 # If we never went through the GLIBCPP_CHECK_LINKER_FEATURES macro, then we
2121 # don't know enough about $LD to do tricks...
2122 if test x$enable_shared = xno ||
2124 test x$glibcpp_gnu_ld_version = x; then
2128 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
2129 AC_MSG_CHECKING([for shared libgcc])
2130 ac_save_CFLAGS="$CFLAGS"
2132 AC_TRY_LINK( , [return 0], glibcpp_shared_libgcc=yes, glibcpp_shared_libgcc=no)
2133 CFLAGS="$ac_save_CFLAGS"
2134 AC_MSG_RESULT($glibcpp_shared_libgcc)
2136 # For GNU ld, we need at least this version. It's 2.12 in the same format
2137 # as the tested-for version. See GLIBCPP_CHECK_LINKER_FEATURES for more.
2138 glibcpp_min_gnu_ld_version=21200
2140 # Check to see if unspecified "yes" value can win, given results
2142 if test $enable_symvers = yes ; then
2143 if test $with_gnu_ld = yes &&
2144 test $glibcpp_shared_libgcc = yes ;
2146 if test $glibcpp_gnu_ld_version -ge $glibcpp_min_gnu_ld_version ; then
2149 ac_test_CFLAGS="${CFLAGS+set}"
2150 ac_save_CFLAGS="$CFLAGS"
2151 CFLAGS='-shared -Wl,--version-script,conftest.map'
2154 echo 'FOO { global: f[a-z]o; local: *; };' > conftest.map
2156 AC_TRY_LINK([int foo;],, enable_symvers=gnu)
2157 if test "$ac_test_CFLAGS" = set; then
2158 CFLAGS="$ac_save_CFLAGS"
2160 # this is the suspicious part
2171 dnl Everything parsed; figure out what file to use.
2172 case $enable_symvers in
2174 LINKER_MAP=config/linker-map.dummy
2177 LINKER_MAP=config/linker-map.gnu
2181 AC_LINK_FILES($LINKER_MAP, src/linker.map)
2182 AM_CONDITIONAL(GLIBCPP_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
2183 AC_MSG_CHECKING([versioning on shared library symbols])
2184 AC_MSG_RESULT($enable_symvers)