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(..)])
53 # Will set LN_S to either 'ln -s' or 'ln'. With autoconf 2.5x, can also
54 # be 'cp -p' if linking isn't available.
55 #ac_cv_prog_LN_S='cp -p'
58 # We use these options to decide which functions to include.
59 AC_ARG_WITH(target-subdir,
60 [ --with-target-subdir=SUBDIR
61 configuring in a subdirectory])
62 AC_ARG_WITH(cross-host,
63 [ --with-cross-host=HOST configuring with a cross compiler])
65 glibcpp_basedir=$srcdir/$toprel/$1/libstdc++-v3
66 AC_SUBST(glibcpp_basedir)
68 # Never versions of autoconf add an underscore to these functions.
69 # Prevent future problems ...
70 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
71 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
72 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
73 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 is addressed in later versions of autoconf.
81 AC_DEFUN(LIB_AC_PROG_CC,
82 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
83 dnl Fool anybody using AC_PROG_CC.
84 AC_PROVIDE([AC_PROG_CC])
85 AC_CHECK_PROG(CC, gcc, gcc)
86 if test -z "$CC"; then
87 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
88 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
93 if test $ac_cv_prog_gcc = yes; then
95 dnl Check whether -g works, even if CFLAGS is set, in case the package
96 dnl plays around with CFLAGS (such as to build both debugging and
97 dnl normal versions of a library), tasteless as that idea is.
98 ac_test_CFLAGS="${CFLAGS+set}"
99 ac_save_CFLAGS="$CFLAGS"
102 if test "$ac_test_CFLAGS" = set; then
103 CFLAGS="$ac_save_CFLAGS"
104 elif test $ac_cv_prog_cc_g = yes; then
111 test "${CFLAGS+set}" = set || CFLAGS="-g"
117 # Likewise for AC_PROG_CXX. We can't just call it directly because g++
118 # will try to link in libstdc++.
119 AC_DEFUN(LIB_AC_PROG_CXX,
120 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
121 dnl Fool anybody using AC_PROG_CXX.
122 AC_PROVIDE([AC_PROG_CXX])
123 # Use glibcpp_CXX so that we do not cause CXX to be cached with the
124 # flags that come in CXX while configuring libstdc++. They're different
125 # from those used for all other target libraries. If CXX is set in
126 # the environment, respect that here.
128 AC_CHECK_PROGS(glibcpp_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
129 AC_SUBST(glibcpp_CXX)
131 test -z "$glibcpp_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
135 if test $ac_cv_prog_gxx = yes; then
137 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
138 dnl plays around with CXXFLAGS (such as to build both debugging and
139 dnl normal versions of a library), tasteless as that idea is.
140 ac_test_CXXFLAGS="${CXXFLAGS+set}"
141 ac_save_CXXFLAGS="$CXXFLAGS"
144 if test "$ac_test_CXXFLAGS" = set; then
145 CXXFLAGS="$ac_save_CXXFLAGS"
146 elif test $ac_cv_prog_cxx_g = yes; then
153 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
159 # For some reason, gettext needs this.
162 AC_CHECK_TOOL(AS, as)
163 AC_CHECK_TOOL(AR, ar)
164 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
169 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
170 # at least currently, we never actually build a program, so we never
171 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
172 # fails, because we are probably configuring with a cross compiler
173 # which can't create executables. So we include AC_EXEEXT to keep
174 # automake happy, but we don't execute it, since we don't care about
177 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
178 # to nothing, so nothing would remain between `then' and `fi' if it
179 # were not for the `:' below.
184 . [$]{glibcpp_basedir}/configure.host
186 case [$]{glibcpp_basedir} in
187 /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
188 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
191 # This does for the target what configure.host does for the host. In
192 # addition to possibly modifying the same flags, it also sets up symlinks.
199 dnl Check to see if g++ can compile this library, and if so, if any version-
200 dnl specific precautions need to be taken.
202 dnl GLIBCPP_CHECK_COMPILER_VERSION
203 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
204 if test ! -f stamp-sanity-compiler; then
205 AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3])
212 ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to GCC 3.0 or above]))
214 AC_MSG_RESULT($gpp_satisfactory)
215 touch stamp-sanity-compiler
221 dnl Tests for newer compiler features, or features that are present in newer
222 dnl compiler versions but not older compiler versions still in use, should
225 dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
226 dnl new inlining code or the new system_header pragma will die on -Werror.
227 dnl Leave it out by default and use maint-mode to use it.
229 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
230 dnl compiler supports it and the user has not requested debug mode.
232 dnl GLIBCPP_CHECK_COMPILER_FEATURES
233 AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
234 # All these tests are for C++; save the language and the compiler flags.
235 # The CXXFLAGS thing is suspicious, but based on similar bits previously
236 # found in GLIBCPP_CONFIGURE.
239 ac_test_CXXFLAGS="${CXXFLAGS+set}"
240 ac_save_CXXFLAGS="$CXXFLAGS"
242 # Check for maintainer-mode bits.
243 if test x"$USE_MAINTAINER_MODE" = xno; then
249 # Check for -ffunction-sections -fdata-sections
250 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
251 CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
252 AC_TRY_COMPILE(, [int foo;
253 ], [ac_fdsections=yes], [ac_fdsections=no])
254 if test "$ac_test_CXXFLAGS" = set; then
255 CXXFLAGS="$ac_save_CXXFLAGS"
257 # this is the suspicious part
260 if test x"$ac_fdsections" = x"yes" &&
261 test x"$enable_debug" = x"no"; then
262 SECTION_FLAGS='-ffunction-sections -fdata-sections'
264 AC_MSG_RESULT($ac_fdsections)
268 AC_SUBST(SECTION_FLAGS)
273 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
274 dnl the native linker is in use, all variables will be defined to something
275 dnl safe (like an empty string).
277 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
278 dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
279 dnl Define LD, with_gnu_ld, and (possibly) glibcpp_gnu_ld_version as
280 dnl side-effects of testing.
282 dnl GLIBCPP_CHECK_LINKER_FEATURES
283 AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
284 # If we're not using GNU ld, then there's no point in even trying these
285 # tests. Check for that first. We should have already tested for gld
286 # by now (in libtool), but require it now just to be safe...
287 test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
288 test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
289 AC_REQUIRE([AC_PROG_LD])
291 # The name set by libtool depends on the version of libtool. Shame on us
292 # for depending on an impl detail, but c'est la vie. Older versions used
293 # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
294 # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
295 # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
296 # set (hence we're using an older libtool), then set it.
297 if test x${with_gnu_ld+set} != xset; then
298 if test x${ac_cv_prog_gnu_ld+set} != xset; then
299 # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
302 with_gnu_ld=$ac_cv_prog_gnu_ld
306 # Start by getting the version number. I think the libtool test already
307 # does some of this, but throws away the result.
309 ldver=`$LD --version 2>/dev/null | head -1 | \
310 sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
312 glibcpp_gnu_ld_version=`echo $ldver | \
313 $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
316 if test "$with_gnu_ld" = "notbroken"; then
317 # GNU ld it is! Joy and bunny rabbits!
319 # All these tests are for C++; save the language and the compiler flags.
320 # Need to do this so that g++ won't try to link in libstdc++
321 ac_test_CFLAGS="${CFLAGS+set}"
322 ac_save_CFLAGS="$CFLAGS"
323 CFLAGS='-x c++ -Wl,--gc-sections'
325 # Check for -Wl,--gc-sections
326 # XXX This test is broken at the moment, as symbols required for
327 # linking are now in libsupc++ (not built yet.....). In addition,
328 # this test has cored on solaris in the past. In addition,
329 # --gc-sections doesn't really work at the moment (keeps on discarding
330 # used sections, first .eh_frame and now some of the glibc sections for
331 # iconv). Bzzzzt. Thanks for playing, maybe next time.
332 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
340 ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
341 if test "$ac_test_CFLAGS" = set; then
342 CFLAGS="$ac_save_CFLAGS"
344 # this is the suspicious part
347 if test "$ac_sectionLDflags" = "yes"; then
348 SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
350 AC_MSG_RESULT($ac_sectionLDflags)
353 # Set linker optimization flags.
354 if test x"$with_gnu_ld" = x"yes" && test x"$enable_debug" = x"no"; then
355 OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
358 AC_SUBST(SECTION_LDFLAGS)
359 AC_SUBST(OPT_LDFLAGS)
364 dnl Check to see if the (math function) argument passed is
365 dnl declared when using the c++ compiler
366 dnl ASSUMES argument is a math function with ONE parameter
368 dnl GLIBCPP_CHECK_MATH_DECL_1
369 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [
370 AC_MSG_CHECKING([for $1 declaration])
371 if test x${glibcpp_cv_func_$1_use+set} != xset; then
372 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
375 AC_TRY_COMPILE([#include <math.h>
381 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
385 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
389 dnl Check to see if the (math function) argument passed is
390 dnl 1) declared when using the c++ compiler
391 dnl 2) has "C" linkage
392 dnl 3) if not, see if 1) and 2) for argument prepended with '_'
394 dnl Define HAVE_CARGF etc if "cargf" is declared and links
396 dnl argument 1 is name of function to check
398 dnl ASSUMES argument is a math function with ONE parameter
400 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
401 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
402 GLIBCPP_CHECK_MATH_DECL_1($1)
403 if test x$glibcpp_cv_func_$1_use = x"yes"; then
406 GLIBCPP_CHECK_MATH_DECL_1(_$1)
407 if test x$glibcpp_cv_func__$1_use = x"yes"; then
415 dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
416 dnl of functions at once. It's an all-or-nothing check -- either
417 dnl HAVE_XYZ is defined for each of the functions, or for none of them.
418 dnl Doing it this way saves significant configure time.
419 AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [
420 AC_MSG_CHECKING([for $1 functions])
421 AC_CACHE_VAL(glibcpp_cv_func_$2_use, [
424 AC_TRY_COMPILE([#include <math.h>],
425 [ `for x in $3; do echo "$x (0);"; done` ],
426 [glibcpp_cv_func_$2_use=yes],
427 [glibcpp_cv_func_$2_use=no])
429 AC_MSG_RESULT($glibcpp_cv_func_$2_use)
430 if test x$glibcpp_cv_func_$2_use = x"yes"; then
436 dnl Check to see if the (math function) argument passed is
437 dnl declared when using the c++ compiler
438 dnl ASSUMES argument is a math function with TWO parameters
440 dnl GLIBCPP_CHECK_MATH_DECL_2
441 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [
442 AC_MSG_CHECKING([for $1 declaration])
443 if test x${glibcpp_cv_func_$1_use+set} != xset; then
444 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
447 AC_TRY_COMPILE([#include <math.h>],
449 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
453 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
457 dnl Check to see if the (math function) argument passed is
458 dnl 1) declared when using the c++ compiler
459 dnl 2) has "C" linkage
461 dnl Define HAVE_CARGF etc if "cargf" is declared and links
463 dnl argument 1 is name of function to check
465 dnl ASSUMES argument is a math function with TWO parameters
467 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
468 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
469 GLIBCPP_CHECK_MATH_DECL_2($1)
470 if test x$glibcpp_cv_func_$1_use = x"yes"; then
473 GLIBCPP_CHECK_MATH_DECL_2(_$1)
474 if test x$glibcpp_cv_func__$1_use = x"yes"; then
482 dnl Check to see if the (math function) argument passed is
483 dnl declared when using the c++ compiler
484 dnl ASSUMES argument is a math function with THREE parameters
486 dnl GLIBCPP_CHECK_MATH_DECL_3
487 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [
488 AC_MSG_CHECKING([for $1 declaration])
489 if test x${glibcpp_cv_func_$1_use+set} != xset; then
490 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
493 AC_TRY_COMPILE([#include <math.h>],
495 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
499 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
503 dnl Check to see if the (math function) argument passed is
504 dnl 1) declared when using the c++ compiler
505 dnl 2) has "C" linkage
507 dnl Define HAVE_CARGF etc if "cargf" is declared and links
509 dnl argument 1 is name of function to check
511 dnl ASSUMES argument is a math function with THREE parameters
513 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
514 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
515 GLIBCPP_CHECK_MATH_DECL_3($1)
516 if test x$glibcpp_cv_func_$1_use = x"yes"; then
519 GLIBCPP_CHECK_MATH_DECL_3(_$1)
520 if test x$glibcpp_cv_func__$1_use = x"yes"; then
528 dnl Check to see if the (stdlib function) argument passed is
529 dnl 1) declared when using the c++ compiler
530 dnl 2) has "C" linkage
532 dnl argument 1 is name of function to check
534 dnl ASSUMES argument is a math function with TWO parameters
536 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
537 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
538 AC_MSG_CHECKING([for $1 declaration])
539 if test x${glibcpp_cv_func_$1_use+set} != xset; then
540 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
543 AC_TRY_COMPILE([#include <stdlib.h>],
545 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
549 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
550 if test x$glibcpp_cv_func_$1_use = x"yes"; then
557 dnl Check to see if the (stdlib function) argument passed is
558 dnl 1) declared when using the c++ compiler
559 dnl 2) has "C" linkage
561 dnl argument 1 is name of function to check
563 dnl ASSUMES argument is a function with THREE parameters
565 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3
566 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3, [
567 AC_MSG_CHECKING([for $1 declaration])
568 if test x${glibcpp_cv_func_$1_use+set} != xset; then
569 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
572 AC_TRY_COMPILE([#include <stdlib.h>],
574 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
578 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
579 if test x$glibcpp_cv_func_$1_use = x"yes"; then
586 dnl Because the builtins are picky picky picky about the arguments they take,
587 dnl do an explict linkage tests here.
588 dnl Check to see if the (math function) argument passed is
589 dnl 1) declared when using the c++ compiler
590 dnl 2) has "C" linkage
592 dnl Define HAVE_CARGF etc if "cargf" is declared and links
594 dnl argument 1 is name of function to check
596 dnl ASSUMES argument is a math function with ONE parameter
598 dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
599 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
600 AC_MSG_CHECKING([for $1 declaration])
601 if test x${glibcpp_cv_func_$1_use+set} != xset; then
602 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
605 AC_TRY_COMPILE([#include <math.h>],
607 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
611 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
612 if test x$glibcpp_cv_func_$1_use = x"yes"; then
613 AC_MSG_CHECKING([for $1 linkage])
614 if test x${glibcpp_cv_func_$1_link+set} != xset; then
615 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
616 AC_TRY_LINK([#include <math.h>],
618 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
621 AC_MSG_RESULT($glibcpp_cv_func_$1_link)
622 if test x$glibcpp_cv_func_$1_link = x"yes"; then
623 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
624 AC_DEFINE_UNQUOTED(${ac_tr_func})
631 dnl Check to see what builtin math functions are supported
633 dnl check for __builtin_abs
634 dnl check for __builtin_fabsf
635 dnl check for __builtin_fabs
636 dnl check for __builtin_fabl
637 dnl check for __builtin_labs
638 dnl check for __builtin_sqrtf
639 dnl check for __builtin_sqrtl
640 dnl check for __builtin_sqrt
641 dnl check for __builtin_sinf
642 dnl check for __builtin_sin
643 dnl check for __builtin_sinl
644 dnl check for __builtin_cosf
645 dnl check for __builtin_cos
646 dnl check for __builtin_cosl
648 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
649 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
650 dnl Test for builtin math functions.
651 dnl These are made in gcc/c-common.c
652 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
653 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
654 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
655 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
656 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
658 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
659 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrt)
660 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
662 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
663 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
664 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
666 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
667 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
668 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
670 dnl There is, without a doubt, a more elegant way to have these
671 dnl names exported so that they won't be stripped out of acconfig.h by
672 dnl autoheader. I leave this as an exercise to somebody less frustrated
673 dnl than I.... please email the libstdc++ list if you can figure out a
674 dnl more elegant approach (see autoconf/acgen.m4 and specifically
675 dnl AC_CHECK_FUNC for things to steal.)
677 if test x$dummyvar = x"yes"; then
678 AC_DEFINE(HAVE___BUILTIN_ABS)
679 AC_DEFINE(HAVE___BUILTIN_LABS)
680 AC_DEFINE(HAVE___BUILTIN_COS)
681 AC_DEFINE(HAVE___BUILTIN_COSF)
682 AC_DEFINE(HAVE___BUILTIN_COSL)
683 AC_DEFINE(HAVE___BUILTIN_FABS)
684 AC_DEFINE(HAVE___BUILTIN_FABSF)
685 AC_DEFINE(HAVE___BUILTIN_FABSL)
686 AC_DEFINE(HAVE___BUILTIN_SIN)
687 AC_DEFINE(HAVE___BUILTIN_SINF)
688 AC_DEFINE(HAVE___BUILTIN_SINL)
689 AC_DEFINE(HAVE___BUILTIN_SQRT)
690 AC_DEFINE(HAVE___BUILTIN_SQRTF)
691 AC_DEFINE(HAVE___BUILTIN_SQRTL)
697 dnl Check to see what the underlying c library
698 dnl These checks need to do two things:
699 dnl 1) make sure the name is declared when using the c++ compiler
700 dnl 2) make sure the name has "C" linkage
701 dnl This might seem like overkill but experience has shown that it's not...
703 dnl Define HAVE_STRTOLD if "strtold" is declared and links
704 dnl Define HAVE_STRTOF if "strtof" is declared and links
705 dnl Define HAVE_DRAND48 if "drand48" is declared and links
707 dnl GLIBCPP_CHECK_STDLIB_SUPPORT
708 AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
709 ac_test_CXXFLAGS="${CXXFLAGS+set}"
710 ac_save_CXXFLAGS="$CXXFLAGS"
711 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
713 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
714 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof)
715 AC_CHECK_FUNCS(drand48)
717 CXXFLAGS="$ac_save_CXXFLAGS"
722 dnl Check to see what the underlying c library or math library is like.
723 dnl These checks need to do two things:
724 dnl 1) make sure the name is declared when using the c++ compiler
725 dnl 2) make sure the name has "C" linkage
726 dnl This might seem like overkill but experience has shown that it's not...
728 dnl Define HAVE_CARGF etc if "cargf" is found.
730 dnl GLIBCPP_CHECK_MATH_SUPPORT
731 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
732 ac_test_CXXFLAGS="${CXXFLAGS+set}"
733 ac_save_CXXFLAGS="$CXXFLAGS"
734 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
737 AC_CHECK_LIB(m, sin, libm="-lm")
741 dnl Check to see if certain C math functions exist.
742 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
743 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
744 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
745 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
746 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
747 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
748 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
749 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypot)
751 dnl Check to see if basic C math functions have float versions.
752 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig,
757 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
760 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
761 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
762 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
763 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
764 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
765 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
766 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf)
767 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
768 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
769 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
770 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
771 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
772 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
773 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
774 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
776 dnl Check to see if basic C math functions have long double versions.
777 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig,
782 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round,
785 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
786 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
787 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
788 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
789 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
790 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
791 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
792 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
793 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl)
794 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
795 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
796 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
797 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
798 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
799 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
800 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
801 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
803 dnl Some runtimes have these functions with a preceding underscore. Please
804 dnl keep this sync'd with the one above. And if you add any new symbol,
805 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
806 dnl Check to see if certain C math functions exist.
808 dnl Check to see if basic C math functions have float versions.
809 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
811 _acosf _asinf _atanf \
813 _coshf _sinhf _tanhf)
814 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
818 dnl Check to see if basic C math functions have long double versions.
819 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
821 _acosl _asinl _atanl \
823 _coshl _sinhl _tanhl)
824 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
829 CXXFLAGS="$ac_save_CXXFLAGS"
834 dnl Check to see if there is native support for complex
836 dnl Don't compile bits in math/* if native support exits.
838 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "copysignl" is found.
840 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
841 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
842 dnl Check for complex versions of math functions of platform.
843 AC_CHECK_LIB(m, main)
844 AC_REPLACE_MATHFUNCS(nan copysignf)
846 dnl Compile the long double complex functions only if the function
847 dnl provides the non-complex long double functions that are needed.
848 dnl Currently this includes copysignl, which should be
849 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
850 USE_COMPLEX_LONG_DOUBLE=no
851 if test x$ac_cv_func_copysignl = x"yes"; then
852 USE_COMPLEX_LONG_DOUBLE=yes
853 AC_REPLACE_MATHFUNCS(signbitl)
856 AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
860 dnl Check to see what architecture and operating system we are compiling
861 dnl for. Also, if architecture- or OS-specific flags are required for
862 dnl compilation, pick them up here.
864 dnl GLIBCPP_CHECK_TARGET
865 AC_DEFUN(GLIBCPP_CHECK_TARGET, [
866 . [$]{glibcpp_basedir}/configure.target
867 AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
868 AC_MSG_RESULT(OS config directory is $os_include_dir)
873 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
874 dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
875 dnl must have been previously checked.)
877 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
878 dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h
880 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
881 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
883 dnl Test wchar.h for mbstate_t, which is needed for char_traits and
884 dnl others even if wchar_t support is not on.
885 AC_MSG_CHECKING([for mbstate_t])
886 AC_TRY_COMPILE([#include <wchar.h>],
887 [mbstate_t teststate;],
888 have_mbstate_t=yes, have_mbstate_t=no)
889 AC_MSG_RESULT($have_mbstate_t)
890 if test x"$have_mbstate_t" = xyes; then
891 AC_DEFINE(HAVE_MBSTATE_T)
894 dnl Sanity check for existence of ISO C99 headers for extended encoding.
895 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
896 AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
898 dnl Only continue checking if the ISO C99 headers exist and support is on.
899 if test x"$ac_has_wchar_h" = xyes &&
900 test x"$ac_has_wctype_h" = xyes &&
901 test x"$enable_c_mbchar" != xno; then
903 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
904 dnl numeric_limits can instantiate type_traits<wchar_t>
905 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
906 AC_TRY_COMPILE([#include <wchar.h>],
907 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
908 has_wchar_minmax=yes, has_wchar_minmax=no)
909 AC_MSG_RESULT($has_wchar_minmax)
911 dnl Test wchar.h for WEOF, which is what we use to determine whether
912 dnl to specialize for char_traits<wchar_t> or not.
913 AC_MSG_CHECKING([for WEOF])
916 #include <stddef.h>],
918 has_weof=yes, has_weof=no)
919 AC_MSG_RESULT($has_weof)
921 dnl Tests for wide character functions used in char_traits<wchar_t>.
923 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset,, \
926 dnl Checks for names injected into std:: by the c_std headers.
927 AC_CHECK_FUNCS(btowc wctob fgetwc fgetwc fgetws fputwc fputws fwide \
928 fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
929 vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
930 mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
931 wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
932 wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \
935 AC_MSG_CHECKING([for ISO C99 wchar_t support])
936 if test x"$has_weof" = xyes &&
937 test x"$has_wchar_minmax" = xyes &&
938 test x"$ac_wfuncs" = xyes; then
939 ac_isoC99_wchar_t=yes
943 AC_MSG_RESULT($ac_isoC99_wchar_t)
945 dnl Use iconv for wchar_t to char conversions. As such, check for
946 dnl X/Open Portability Guide, version 2 features (XPG2).
947 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
948 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
950 dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
951 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
953 LIBS="$LIBS $libiconv"
955 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
956 ac_XPG2funcs=yes, ac_XPG2funcs=no)
960 AC_MSG_CHECKING([for XPG2 wchar_t support])
961 if test x"$ac_has_iconv_h" = xyes &&
962 test x"$ac_has_langinfo_h" = xyes &&
963 test x"$ac_XPG2funcs" = xyes; then
968 AC_MSG_RESULT($ac_XPG2_wchar_t)
970 dnl At the moment, only enable wchar_t specializations if all the
971 dnl above support is present.
972 AC_MSG_CHECKING([for enabled wchar_t specializations])
973 if test x"$ac_isoC99_wchar_t" = xyes &&
974 test x"$ac_XPG2_wchar_t" = xyes; then
975 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
981 dnl Wide characters disabled by the user.
982 AC_MSG_WARN([wchar_t support disabled.])
988 dnl Check for special debugging mode; not for production use.
990 dnl GLIBCPP_ENABLE_DEBUG
991 dnl --enable-debug sets '-ggdb3 -O0'.
992 dnl --disable-debug sets '-g' and whatever optimization options the
993 dnl compiler can handle.
994 dnl + --enable-maintainer-mode automatically defaults this to on.
995 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
996 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
997 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
998 dnl defaults to `no'.
999 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
1000 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
1001 AC_ARG_ENABLE(debug,
1002 changequote(<<, >>)dnl
1003 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
1004 changequote([, ])dnl
1005 [case "${enableval}" in
1006 yes) enable_debug=yes ;;
1007 no) enable_debug=no ;;
1008 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
1010 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
1012 dnl Option parsed, now set things appropriately
1013 case "${enable_debug}" in
1015 DEBUG_FLAGS='-O0 -ggdb3'
1021 AC_SUBST(DEBUG_FLAGS)
1026 dnl Check for "unusual" flags to pass to the compiler while building.
1028 dnl GLIBCPP_ENABLE_CXX_FLAGS
1029 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1030 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1031 dnl Somehow this same set of flags must be passed when [re]building
1033 dnl --disable-cxx-flags passes nothing.
1034 dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
1035 dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
1036 dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
1037 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
1038 dnl If "default flags" is an empty string (or "none"), the effect is
1039 dnl the same as --disable or --enable=no.
1040 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1041 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1042 AC_ARG_ENABLE(cxx-flags,
1043 changequote(<<, >>)dnl
1044 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
1045 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1046 changequote([, ])dnl
1047 [case "x$enableval" in
1049 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1051 enable_cxx_flags='' ;;
1053 enable_cxx_flags="$enableval" ;;
1055 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
1057 dnl Thinko on my part during design. This kludge is the workaround.
1058 if test "$enable_cxx_flags" = "none"; then
1059 enable_cxx_flags='';
1062 dnl Run through flags (either default or command-line) and set anything
1063 dnl extra (e.g., #defines) that must accompany particular g++ options.
1064 if test -n "$enable_cxx_flags"; then
1065 for f in $enable_cxx_flags; do
1069 *) # and we're trying to pass /what/ exactly?
1070 AC_MSG_ERROR([compiler flags start with a -]) ;;
1074 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1075 AC_SUBST(EXTRA_CXX_FLAGS)
1080 dnl Check for which locale library to use: gnu or generic.
1082 dnl GLIBCPP_ENABLE_CLOCALE
1083 dnl --enable-clocale=gnu sets config/locale/c_locale_gnu.cc and friends
1084 dnl --enable-clocale=generic sets config/locale/c_locale_generic.cc and friends
1086 dnl default is generic
1088 AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
1089 AC_MSG_CHECKING([for clocale to use])
1090 AC_ARG_ENABLE(clocale,
1091 [ --enable-clocale enable model for target locale package.
1092 --enable-clocale=MODEL use MODEL target-speific locale package. [default=generic]
1094 if test x$enable_clocale = xno; then
1099 enable_clocale_flag=$enable_clocale
1101 dnl Probe for locale support if no specific model is specified.
1102 dnl Default to "generic"
1103 if test x$enable_clocale_flag = xno; then
1104 case x${target_os} in
1106 AC_EGREP_CPP([_GLIBCPP_ok], [
1107 #include <features.h>
1108 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1111 ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
1113 # Test for bugs early in glibc-2.2.x series
1114 if test x$enable_clocale_flag = xgnu; then
1116 #define _GNU_SOURCE 1
1120 const char __one[] = "Äuglein Augmen";
1121 const char __two[] = "Äuglein";
1126 loc = __newlocale(1 << LC_ALL, "de_DE", 0);
1127 loc_dup = __duplocale(loc);
1128 i = __strcoll_l(__one, __two, loc);
1129 j = __strcoll_l(__one, __two, loc_dup);
1133 [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
1134 [enable_clocale_flag=generic])
1137 # ... at some point put __strxfrm_l tests in as well.
1140 enable_clocale_flag=generic
1145 dnl Set configure bits for specified locale package
1146 case x${enable_clocale_flag} in
1148 AC_MSG_RESULT(generic)
1150 # Don't use gettext.
1153 CLOCALE_H=config/locale/generic/c_locale.h
1154 CLOCALE_CC=config/locale/generic/c_locale.cc
1155 CCODECVT_H=config/locale/generic/codecvt_specializations.h
1156 CCOLLATE_CC=config/locale/generic/collate_members.cc
1157 CCTYPE_CC=config/locale/generic/ctype_members.cc
1158 CMESSAGES_H=config/locale/generic/messages_members.h
1159 CMESSAGES_CC=config/locale/generic/messages_members.cc
1160 CMONEY_CC=config/locale/generic/monetary_members.cc
1161 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1162 CTIME_CC=config/locale/generic/time_members.cc
1167 # Declare intention to use gettext, and add support for specific
1169 # For some reason, ALL_LINGUAS has to be before AM_GNU_GETTEXT
1171 # Don't call AM_GNU_GETTEXT here. Instead, assume glibc.
1172 # Need to deal with MSGFMT, USE_NLS, and glibcpp_[P,M]OFILES
1175 # Export the build objects.
1176 for ling in $ALL_LINGUAS; do \
1177 glibcpp_MOFILES="$glibcpp_MOFILES $ling.mo"; \
1178 glibcpp_POFILES="$glibcpp_POFILES $ling.po"; \
1180 AC_SUBST(glibcpp_MOFILES)
1181 AC_SUBST(glibcpp_POFILES)
1183 CLOCALE_H=config/locale/gnu/c_locale.h
1184 CLOCALE_CC=config/locale/gnu/c_locale.cc
1185 CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1186 CCOLLATE_CC=config/locale/gnu/collate_members.cc
1187 CCTYPE_CC=config/locale/gnu/ctype_members.cc
1188 CMESSAGES_H=config/locale/gnu/messages_members.h
1189 CMESSAGES_CC=config/locale/gnu/messages_members.cc
1190 CMONEY_CC=config/locale/gnu/monetary_members.cc
1191 CNUMERIC_CC=config/locale/gnu/numeric_members.cc
1192 CTIME_CC=config/locale/gnu/time_members.cc
1195 AC_MSG_RESULT(generic)
1197 # Don't use gettext.
1200 CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h
1201 CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc
1202 CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1203 CCOLLATE_CC=config/locale/generic/collate_members.cc
1204 CCTYPE_CC=config/locale/generic/ctype_members.cc
1205 CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h
1206 CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc
1207 CMONEY_CC=config/locale/generic/monetary_members.cc
1208 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1209 CTIME_CC=config/locale/generic/time_members.cc
1212 echo "$enable_clocale is an unknown locale package" 1>&2
1217 # This is where the testsuite looks for locale catalogs, using the
1218 # -DLOCALEDIR define during testsuite compilation.
1219 glibcpp_localedir=${glibcpp_builddir}/po/share/locale
1220 AC_SUBST(glibcpp_localedir)
1224 AC_SUBST(CCODECVT_H)
1225 AC_SUBST(CMESSAGES_H)
1226 AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
1227 AC_LINK_FILES($CCOLLATE_CC, src/collate.cc)
1228 AC_LINK_FILES($CCTYPE_CC, src/ctype.cc)
1229 AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
1230 AC_LINK_FILES($CMONEY_CC, src/monetary.cc)
1231 AC_LINK_FILES($CNUMERIC_CC, src/numeric.cc)
1232 AC_LINK_FILES($CTIME_CC, src/time.cc)
1237 dnl Check for which I/O library to use: libio, or something specific.
1239 dnl GLIBCPP_ENABLE_CSTDIO
1240 dnl --enable-cstdio=libio sets config/io/c_io_libio.h and friends
1242 dnl default is stdio
1244 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1245 AC_MSG_CHECKING([for cstdio to use])
1246 AC_ARG_ENABLE(cstdio,
1247 [ --enable-cstdio enable stdio for target io package.
1248 --enable-cstdio=LIB use LIB target-speific io package. [default=stdio]
1250 if test x$enable_cstdio = xno; then
1253 enable_cstdio=stdio)
1255 enable_cstdio_flag=$enable_cstdio
1257 dnl Check if a valid I/O package
1258 case x${enable_cstdio_flag} in
1260 CSTDIO_H=config/io/c_io_libio.h
1261 BASIC_FILE_H=config/io/basic_file_libio.h
1262 BASIC_FILE_CC=config/io/basic_file_libio.cc
1263 AC_MSG_RESULT(libio)
1265 # see if we are on a system with libio native (ie, linux)
1266 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1268 # Need to check and see what version of glibc is being used. If
1269 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1270 # compile most of libio for linux systems.
1271 if test x$has_libio = x"yes"; then
1274 AC_MSG_CHECKING([for glibc version >= 2.2])
1275 AC_EGREP_CPP([ok], [
1276 #include <features.h>
1277 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1280 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1281 AC_MSG_RESULT($glibc_satisfactory)
1285 # XXX at the moment, admit defeat and force the recompilation
1286 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
1287 glibc_satisfactory=no
1289 if test x$glibc_satisfactory = x"yes"; then
1294 # bkoz XXX need to add checks to enable this
1295 # pme XXX here's a first pass at such a check
1296 if test x$enable_c_mbchar != xno; then
1304 # Using libio, but <libio.h> doesn't exist on the target system. . .
1306 # bkoz XXX need to add checks to enable this
1307 # pme XXX here's a first pass at such a check
1308 if test x$enable_c_mbchar != xno; then
1315 xstdio | x | xno | xnone | xyes)
1317 CSTDIO_H=config/io/c_io_stdio.h
1318 BASIC_FILE_H=config/io/basic_file_stdio.h
1319 BASIC_FILE_CC=config/io/basic_file_stdio.cc
1320 AC_MSG_RESULT(stdio)
1322 # We're not using stdio.
1327 echo "$enable_cstdio is an unknown io package" 1>&2
1332 AC_SUBST(BASIC_FILE_H)
1333 AC_LINK_FILES($BASIC_FILE_CC, src/basic_file.cc)
1335 # 2000-08-04 bkoz hack
1336 CCODECVT_C=config/io/c_io_libio_codecvt.c
1337 AC_SUBST(CCODECVT_C)
1338 # 2000-08-04 bkoz hack
1340 AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO,
1341 test "$need_libio" = yes || test "$need_wlibio" = yes)
1342 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1343 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1344 if test "$need_libio" = yes || test "$need_wlibio" = yes; then
1345 libio_la=../libio/libio.la
1354 dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
1355 dnl We must stage the required headers so that they will be installed
1356 dnl with the library (unlike libgcc, the STL implementation is provided
1357 dnl solely within headers). Since we must not inject random user-space
1358 dnl macro names into user-provided C++ code, we first stage into <file>-in
1359 dnl and process to <file> with an output command. The reason for a two-
1360 dnl stage process here is to correctly handle $srcdir!=$objdir without
1361 dnl having to write complex code (the sed commands to clean the macro
1362 dnl namespace are complex and fragile enough as it is). We must also
1363 dnl add a relative path so that -I- is supported properly.
1365 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1366 AC_MSG_CHECKING([for thread model used by GCC])
1367 target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
1368 AC_MSG_RESULT([$target_thread_file])
1370 if test $target_thread_file != single; then
1371 AC_DEFINE(HAVE_GTHR_DEFAULT)
1372 AC_DEFINE(_GLIBCPP_SUPPORTS_WEAK, __GXX_WEAK__)
1375 glibcpp_thread_h=gthr-$target_thread_file.h
1376 AC_SUBST(glibcpp_thread_h)
1381 dnl Check for exception handling support. If an explicit enable/disable
1382 dnl sjlj exceptions is given, we don't have to detect. Otherwise the
1383 dnl target may or may not support call frame exceptions.
1385 dnl GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
1386 dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
1387 dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1389 dnl Define _GLIBCPP_SJLJ_EXCEPTIONS if the compiler is configured for it.
1391 AC_DEFUN(GLIBCPP_ENABLE_SJLJ_EXCEPTIONS, [
1392 AC_MSG_CHECKING([for exception model to use])
1395 AC_ARG_ENABLE(sjlj-exceptions,
1396 [ --enable-sjlj-exceptions force use of builtin_setjmp for exceptions],
1398 [dnl Botheration. Now we've got to detect the exception model.
1399 dnl Link tests against libgcc.a are problematic since -- at least
1400 dnl as of this writing -- we've not been given proper -L bits for
1401 dnl single-tree newlib and libgloss.
1403 dnl This is what AC_TRY_COMPILE would do if it didn't delete the
1404 dnl conftest files before we got a change to grep them first.
1405 cat > conftest.$ac_ext << EOF
1406 [#]line __oline__ "configure"
1415 old_CXXFLAGS="$CXXFLAGS"
1417 if AC_TRY_EVAL(ac_compile); then
1418 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
1419 enable_sjlj_exceptions=yes
1420 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
1421 enable_sjlj_exceptions=no
1424 CXXFLAGS="$old_CXXFLAGS"
1426 if test x$enable_sjlj_exceptions = xyes; then
1427 AC_DEFINE(_GLIBCPP_SJLJ_EXCEPTIONS, 1,
1428 [Define if the compiler is configured for setjmp/longjmp exceptions.])
1429 ac_exception_model_name=sjlj
1430 elif test x$enable_sjlj_exceptions = xno; then
1431 ac_exception_model_name="call frame"
1433 AC_MSG_ERROR([unable to detect exception model])
1436 AC_MSG_RESULT($ac_exception_model_name)
1441 dnl Check for libunwind exception handling support. If enabled then
1442 dnl we assume that the _Unwind_* functions that make up the Unwind ABI
1443 dnl (_Unwind_RaiseException, _Unwind_Resume, etc.) are defined by
1444 dnl libunwind instead of libgcc and that libstdc++ has a dependency
1445 dnl on libunwind as well as libgcc.
1447 dnl GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS
1448 dnl --enable-libunwind-exceptions forces the use of libunwind.
1449 dnl --disable-libunwind-exceptions assumes there is no libunwind.
1451 dnl Define _GLIBCPP_LIBUNWIND_EXCEPTIONS if requested.
1453 AC_DEFUN(GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS, [
1454 AC_MSG_CHECKING([for use of libunwind])
1455 AC_ARG_ENABLE(libunwind-exceptions,
1456 [ --enable-libunwind-exceptions force use of libunwind for exceptions],
1457 use_libunwind_exceptions=$enableval,
1458 use_libunwind_exceptions=no)
1459 AC_MSG_RESULT($use_libunwind_exceptions)
1460 dnl Option parsed, now set things appropriately
1461 if test x"$use_libunwind_exceptions" = xyes; then
1462 LIBUNWIND_FLAG="-lunwind"
1466 AC_SUBST(LIBUNWIND_FLAG)
1470 dnl Check for ISO/IEC 9899:1999 "C99" support.
1472 dnl GLIBCPP_ENABLE_C99
1473 dnl --enable-c99 defines _GLIBCPP_USE_C99
1474 dnl --disable-c99 leaves _GLIBCPP_USE_C99 undefined
1475 dnl + Usage: GLIBCPP_ENABLE_C99[(DEFAULT)]
1476 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1477 dnl defaults to `no'.
1478 dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
1480 dnl GLIBCPP_ENABLE_C99
1481 AC_DEFUN(GLIBCPP_ENABLE_C99, [dnl
1482 define([GLIBCPP_ENABLE_C99_DEFAULT], ifelse($1, yes, yes, no))dnl
1485 changequote(<<, >>)dnl
1486 <<--enable-c99 turns on 'ISO/IEC 9899:1999 support' [default=>>GLIBCPP_ENABLE_C99_DEFAULT],
1487 changequote([, ])dnl
1488 [case "$enableval" in
1489 yes) enable_c99=yes ;;
1490 no) enable_c99=no ;;
1491 *) AC_MSG_ERROR([Unknown argument to enable/disable C99]) ;;
1493 enable_c99=GLIBCPP_ENABLE_C99_DEFAULT)dnl
1498 # Check for the existence of <math.h> functions used if C99 is enabled.
1500 AC_MSG_CHECKING([for ISO C99 support in <math.h>])
1501 AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no])
1502 AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no])
1503 AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no])
1504 AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no])
1505 AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no])
1506 AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no])
1507 AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no])
1508 AC_TRY_COMPILE([#include <math.h>],
1509 [isgreaterequal(0.0,0.0);],, [ac_c99_math=no])
1510 AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no])
1511 AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no])
1512 AC_TRY_COMPILE([#include <math.h>],
1513 [islessgreater(0.0,0.0);],, [ac_c99_math=no])
1514 AC_TRY_COMPILE([#include <math.h>],
1515 [isunordered(0.0,0.0);],, [ac_c99_math=no])
1516 AC_MSG_RESULT($ac_c99_math)
1518 # Check for the existence in <stdio.h> of vscanf, et. al.
1520 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
1521 AC_TRY_COMPILE([#include <stdio.h>],
1522 [snprintf("12", 0, "%i");],, [ac_c99_stdio=no])
1523 AC_TRY_COMPILE([#include <stdio.h>
1525 void foo(char* fmt, ...)
1526 {va_list args; va_start(args, fmt);
1527 vfscanf(stderr, "%i", args);}],
1528 [],, [ac_c99_stdio=no])
1529 AC_TRY_COMPILE([#include <stdio.h>
1531 void foo(char* fmt, ...)
1532 {va_list args; va_start(args, fmt);
1533 vscanf("%i", args);}],
1534 [],, [ac_c99_stdio=no])
1535 AC_TRY_COMPILE([#include <stdio.h>
1537 void foo(char* fmt, ...)
1538 {va_list args; va_start(args, fmt);
1539 vsnprintf(fmt, 0, "%i", args);}],
1540 [],, [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 vsscanf(fmt, "%i", args);}],
1546 [],, [ac_c99_stdio=no])
1547 AC_MSG_RESULT($ac_c99_stdio)
1549 # Check for the existence in <stdlib.h> of lldiv_t, et. al.
1551 AC_MSG_CHECKING([for lldiv_t declaration])
1552 AC_CACHE_VAL(ac_c99_lldiv_t, [
1553 AC_TRY_COMPILE([#include <stdlib.h>],
1555 [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no])
1557 AC_MSG_RESULT($ac_c99_lldiv_t)
1559 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
1560 AC_TRY_COMPILE([#include <stdlib.h>],
1561 [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no])
1562 AC_TRY_COMPILE([#include <stdlib.h>],
1563 [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no])
1564 AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no])
1565 AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no])
1566 AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no])
1567 AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no])
1568 if test x"$ac_c99_lldiv_t" = x"no"; then
1571 AC_MSG_RESULT($ac_c99_stdlib)
1573 # Check for the existence of <wchar.h> functions used if C99 is enabled.
1574 # XXX the wchar.h checks should be rolled into the general C99 bits.
1576 AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>])
1577 AC_TRY_COMPILE([#include <wchar.h>],
1578 [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no])
1579 AC_TRY_COMPILE([#include <wchar.h>],
1580 [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no])
1581 AC_TRY_COMPILE([#include <wchar.h>],
1582 [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no])
1583 AC_MSG_RESULT($ac_c99_wchar)
1585 AC_MSG_CHECKING([for enabled ISO C99 support])
1586 if test x"$ac_c99_math" = x"no" ||
1587 test x"$ac_c99_stdio" = x"no" ||
1588 test x"$ac_c99_stdlib" = x"no" ||
1589 test x"$ac_c99_wchar" = x"no"; then
1592 AC_MSG_RESULT($enable_c99)
1594 # Option parsed, now set things appropriately
1595 if test x"$enable_c99" = x"yes"; then
1596 AC_DEFINE(_GLIBCPP_USE_C99)
1604 dnl Check for template specializations for the 'long long' type extension.
1605 dnl The result determines only whether 'long long' I/O is enabled; things
1606 dnl like numeric_limits<> specializations are always available.
1608 dnl GLIBCPP_ENABLE_LONG_LONG
1609 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1610 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1611 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1612 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1613 dnl defaults to `no'.
1614 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1616 dnl GLIBCPP_ENABLE_LONG_LONG
1617 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1618 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1620 AC_ARG_ENABLE(long-long,
1621 changequote(<<, >>)dnl
1622 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1623 changequote([, ])dnl
1624 [case "$enableval" in
1625 yes) enable_long_long=yes ;;
1626 no) enable_long_long=no ;;
1627 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1629 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1634 AC_MSG_CHECKING([for enabled long long I/O support])
1635 # iostreams require strtoll, strtoull to compile
1636 AC_TRY_COMPILE([#include <stdlib.h>],
1637 [char* tmp; strtoll("gnu", &tmp, 10);],,[enable_long_long=no])
1638 AC_TRY_COMPILE([#include <stdlib.h>],
1639 [char* tmp; strtoull("gnu", &tmp, 10);],,[enable_long_long=no])
1641 # Option parsed, now set things appropriately
1642 if test x"$enable_long_long" = xyes; then
1643 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1645 AC_MSG_RESULT($enable_long_long)
1652 dnl Check for what kind of C headers to use.
1654 dnl GLIBCPP_ENABLE_CHEADERS
1655 dnl --enable-cheaders= [does stuff].
1656 dnl --disable-cheaders [does not do anything, really].
1657 dnl + This will eventually need to be 'c_shadow' by default.
1658 dnl + Usage: GLIBCPP_ENABLE_CHEADERS[(DEFAULT)]
1659 dnl Where DEFAULT is either `c' or `c_std' or 'c_shadow'.
1660 dnl If ommitted, it defaults to `c_std'.
1661 AC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl
1662 define([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl
1663 AC_MSG_CHECKING([for c header strategy to use])
1664 AC_ARG_ENABLE(cheaders,
1665 changequote(<<, >>)dnl
1666 << --enable-cheaders construct "C" header files for g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT],
1668 [case "$enableval" in
1673 enable_cheaders=c_std
1676 enable_cheaders=c_shadow
1678 *) AC_MSG_ERROR([Unknown argument to enable/disable "C" headers])
1681 enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT)
1682 AC_MSG_RESULT($enable_cheaders)
1684 dnl Option parsed, now set things appropriately
1685 case "$enable_cheaders" in
1687 CSHADOW_FLAGS="-fno-builtin"
1688 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_shadow'
1689 AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
1693 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_std'
1697 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c'
1701 AC_SUBST(CSHADOW_FLAGS)
1702 AC_SUBST(C_INCLUDE_DIR)
1703 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cheaders" = c_shadow)
1708 dnl Check for wide character support. Has the same effect as the option
1709 dnl in gcc's configure, but in a form that autoconf can mess with.
1711 dnl GLIBCPP_ENABLE_C_MBCHAR
1712 dnl --enable-c-mbchar requests all the wchar_t stuff.
1713 dnl --disable-c-mbchar doesn't.
1714 dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1715 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1716 dnl defaults to `no'.
1717 AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1718 define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1719 AC_ARG_ENABLE(c-mbchar,
1720 changequote(<<, >>)dnl
1721 << --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1722 changequote([, ])dnl
1723 [case "$enableval" in
1724 yes) enable_c_mbchar=yes ;;
1725 no) enable_c_mbchar=no ;;
1726 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1728 enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1729 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1734 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1736 dnl TOPLEVEL_INCLUDES
1737 dnl LIBMATH_INCLUDES
1738 dnl LIBSUPCXX_INCLUDES
1740 dnl CSHADOW_INCLUDES
1742 dnl GLIBCPP_EXPORT_INCLUDES
1743 AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1744 # Root level of the build directory include sources.
1745 GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include"
1747 # Passed down for canadian crosses.
1748 if test x"$CANADIAN" = xyes; then
1749 TOPLEVEL_INCLUDES='-I$(includedir)'
1752 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1754 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1756 if test x"$need_libio" = xyes; then
1757 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1758 AC_SUBST(LIBIO_INCLUDES)
1761 # Now, export this to all the little Makefiles....
1762 AC_SUBST(GLIBCPP_INCLUDES)
1763 AC_SUBST(TOPLEVEL_INCLUDES)
1764 AC_SUBST(LIBMATH_INCLUDES)
1765 AC_SUBST(LIBSUPCXX_INCLUDES)
1770 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1772 AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1773 # Optimization flags that are probably a good idea for thrill-seekers. Just
1774 # uncomment the lines below and make, everything else is ready to go...
1775 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1777 AC_SUBST(OPTIMIZE_CXXFLAGS)
1779 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1780 AC_SUBST(WARN_FLAGS)
1784 dnl GLIBCPP_EXPORT_INSTALL_INFO
1785 dnl calculates gxx_install_dir
1786 dnl exports glibcpp_toolexecdir
1787 dnl exports glibcpp_toolexeclibdir
1788 dnl exports glibcpp_prefixdir
1790 dnl Assumes cross_compiling bits already done, and with_cross_host in
1793 dnl GLIBCPP_EXPORT_INSTALL_INFO
1794 AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
1795 # Assumes glibcpp_builddir, glibcpp_srcdir are alreay set up and
1796 # exported correctly in GLIBCPP_CONFIGURE.
1797 glibcpp_toolexecdir=no
1798 glibcpp_toolexeclibdir=no
1799 glibcpp_prefixdir=${prefix}
1801 AC_MSG_CHECKING([for interface version number])
1802 libstdcxx_interface=$INTERFACE
1803 AC_MSG_RESULT($libstdcxx_interface)
1805 # Process the option --with-gxx-include-dir=<path to include-files directory>
1806 AC_MSG_CHECKING([for --with-gxx-include-dir])
1807 AC_ARG_WITH(gxx-include-dir,
1808 [ --with-gxx-include-dir the installation directory for include files],
1809 [case "${withval}" in
1811 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
1818 gxx_include_dir=${withval}
1820 esac], [gxx_include_dir=no])
1821 AC_MSG_RESULT($gxx_include_dir)
1823 # Process the option "--enable-version-specific-runtime-libs"
1824 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
1825 AC_ARG_ENABLE(version-specific-runtime-libs,
1826 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
1827 [case "$enableval" in
1828 yes) version_specific_libs=yes ;;
1829 no) version_specific_libs=no ;;
1830 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
1832 version_specific_libs=no)dnl
1833 # Option set, now we can test it.
1834 AC_MSG_RESULT($version_specific_libs)
1836 if test $version_specific_libs = yes; then
1837 # Need the gcc compiler version to know where to install libraries
1838 # and header files if --enable-version-specific-runtime-libs option
1841 gcc_version_trigger=${srcdir}/../gcc/version.c
1842 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'`
1843 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
1844 gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/g++
1845 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1846 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
1850 # Default case for install directory for include files.
1851 if test $version_specific_libs = no &&
1852 test $gxx_include_dir = no; then
1853 gxx_include_dir='$(prefix)'/include/g++-${libstdcxx_interface}
1856 # Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
1857 # Install a library built with a cross compiler in tooldir, not libdir.
1858 if test x"$glibcpp_toolexecdir" = x"no"; then
1859 if test -n "$with_cross_host" &&
1860 test x"$with_cross_host" != x"no"; then
1861 glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
1862 glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)'
1864 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1865 glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)'
1869 AC_MSG_CHECKING([for install location])
1870 AC_MSG_RESULT($gxx_include_dir)
1872 AC_SUBST(glibcpp_prefixdir)
1873 AC_SUBST(gxx_include_dir)
1874 AC_SUBST(glibcpp_toolexecdir)
1875 AC_SUBST(glibcpp_toolexeclibdir)
1879 # Check for functions in math library.
1880 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1882 # This file can be copied and used freely without restrictions. It can
1883 # be used in projects which are not available under the GNU Public License
1884 # but which still want to provide support for the GNU gettext functionality.
1885 # Please note that the actual code is *not* freely available.
1889 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1890 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1891 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1892 AC_SUBST(LIBMATHOBJS)dnl
1897 dnl This macro searches for a GNU version of make. If a match is found, the
1898 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1899 dnl set to "#". This is useful for including a special features in a Makefile,
1900 dnl which cannot be handled by other versions of make. The variable
1901 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1902 dnl the empty string otherwise.
1904 dnl Here is an example of its use:
1906 dnl Makefile.in might contain:
1908 dnl # A failsafe way of putting a dependency rule into a makefile
1910 dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1912 dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1913 dnl @ifGNUmake@ include $(DEPEND)
1914 dnl @ifGNUmake@ endif
1916 dnl Then configure.in would normally contain:
1918 dnl CHECK_GNU_MAKE()
1919 dnl AC_OUTPUT(Makefile)
1921 dnl Then perhaps to cause gnu make to override any other make, we could do
1922 dnl something like this (note that GNU make always looks for GNUmakefile first):
1924 dnl if ! test x$_cv_gnu_make_command = x ; then
1925 dnl mv Makefile GNUmakefile
1926 dnl echo .DEFAULT: > Makefile ;
1927 dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1930 dnl Then, if any (well almost any) other make is called, and GNU make also
1931 dnl exists, then the other make wraps the GNU make.
1933 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1934 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
1936 dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1937 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1938 dnl #### conditional's subshell (" --version" is not a command), using a
1939 dnl #### different option to grep(1).
1941 dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not
1942 dnl #### ${MAKE:-make}).
1945 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1946 _cv_gnu_make_command='' ;
1947 dnl Search all the common names for GNU make
1948 for a in "${MAKE-make}" make gmake gnumake ; do
1949 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
1951 _cv_gnu_make_command=$a ;
1956 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1957 dnl string, '#' otherwise
1958 if test "x$_cv_gnu_make_command" != "x" ; then
1967 dnl Check for headers for, and arguments to, the setrlimit() function.
1968 dnl Used only in testsuite_hooks.h.
1969 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT_ancilliary, [
1970 AC_TRY_COMPILE([#include <sys/resource.h>
1972 ], [ int f = RLIMIT_$1 ; ],
1973 [glibcpp_mresult=1], [glibcpp_mresult=0])
1974 AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcpp_mresult,
1975 [Only used in build directory testsuite_hooks.h.])
1977 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT, [
1978 setrlimit_have_headers=yes
1979 AC_CHECK_HEADERS(sys/resource.h unistd.h,
1981 setrlimit_have_headers=no)
1982 # If don't have the headers, then we can't run the tests now, and we
1983 # won't be seeing any of these during testsuite compilation.
1984 if test $setrlimit_have_headers = yes; then
1985 # Can't do these in a loop, else the resulting syntax is wrong.
1986 GLIBCPP_CHECK_SETRLIMIT_ancilliary(DATA)
1987 GLIBCPP_CHECK_SETRLIMIT_ancilliary(RSS)
1988 GLIBCPP_CHECK_SETRLIMIT_ancilliary(VMEM)
1989 GLIBCPP_CHECK_SETRLIMIT_ancilliary(AS)
1991 # Check for rlimit, setrlimit.
1992 AC_CACHE_VAL(ac_setrlimit, [
1993 AC_TRY_COMPILE([#include <sys/resource.h>
1996 [ struct rlimit r; setrlimit(0, &r);],
1997 [ac_setrlimit=yes], [ac_setrlimit=no])
2001 AC_MSG_CHECKING([for testsuite memory limit support])
2002 if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then
2004 AC_DEFINE(_GLIBCPP_MEM_LIMITS)
2008 AC_MSG_RESULT($ac_mem_limits)
2013 dnl Does any necessary configuration of the testsuite directory. Generates
2014 dnl the testsuite_hooks.h header.
2016 dnl GLIBCPP_CONFIGURE_TESTSUITE [no args]
2017 AC_DEFUN(GLIBCPP_CONFIGURE_TESTSUITE, [
2018 GLIBCPP_CHECK_SETRLIMIT
2020 # Look for setenv, so that extended locale tests can be performed.
2021 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv)
2025 sinclude(../libtool.m4)
2026 dnl The lines below arrange for aclocal not to bring an installed
2027 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
2028 dnl add a definition of LIBTOOL to Makefile.in.
2029 ifelse(,,,[AC_SUBST(LIBTOOL)
2030 AC_DEFUN([AM_PROG_LIBTOOL])
2031 AC_DEFUN([AC_LIBTOOL_DLOPEN])
2032 AC_DEFUN([AC_PROG_LD])
2036 # Check whether LC_MESSAGES is available in <locale.h>.
2037 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2039 # This file file be copied and used freely without restrictions. It can
2040 # be used in projects which are not available under the GNU Public License
2041 # but which still want to provide support for the GNU gettext functionality.
2042 # Please note that the actual code is *not* freely available.
2046 AC_DEFUN(AC_LC_MESSAGES, [
2047 AC_CHECK_HEADER(locale.h, [
2048 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
2049 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2050 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
2051 if test $ac_cv_val_LC_MESSAGES = yes; then
2052 AC_DEFINE(HAVE_LC_MESSAGES)
2059 dnl Check for whether the Boost-derived checks should be turned on.
2061 dnl GLIBCPP_ENABLE_CONCEPT_CHECKS
2062 dnl --enable-concept-checks turns them on.
2063 dnl --disable-concept-checks leaves them off.
2064 dnl + Usage: GLIBCPP_ENABLE_CONCEPT_CHECKS[(DEFAULT)]
2065 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
2066 dnl defaults to `no'.
2067 AC_DEFUN(GLIBCPP_ENABLE_CONCEPT_CHECKS, [dnl
2068 define([GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT], ifelse($1, yes, yes, no))dnl
2069 AC_ARG_ENABLE(concept-checks,
2070 changequote(<<, >>)dnl
2071 << --enable-concept-checks use Boost-derived template checks [default=>>GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT],
2072 changequote([, ])dnl
2073 [case "$enableval" in
2074 yes) enable_concept_checks=yes ;;
2075 no) enable_concept_checks=no ;;
2076 *) AC_MSG_ERROR([Unknown argument to enable/disable concept checks]) ;;
2078 enable_concept_checks=GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT)dnl
2079 dnl Option parsed, now set things appropriately
2080 if test x"$enable_concept_checks" = xyes; then
2081 AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS)
2087 dnl Add version tags to symbols in shared library (or not), additionally
2088 dnl marking other symbols as private/local (or not).
2090 dnl GLIBCPP_ENABLE_SYMVERS
2091 dnl --enable-symvers=style adds a version script to the linker call when
2092 dnl creating the shared library. The choice of version script is
2093 dnl controlled by 'style'.
2094 dnl --disable-symvers does not.
2095 dnl + Usage: GLIBCPP_ENABLE_SYMVERS[(DEFAULT)]
2096 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
2097 dnl defaults to `no'. Passing `yes' tries to choose a default style
2098 dnl based on linker characteristics. Passing 'no' disables versioning.
2099 AC_DEFUN(GLIBCPP_ENABLE_SYMVERS, [dnl
2100 define([GLIBCPP_ENABLE_SYMVERS_DEFAULT], ifelse($1, yes, yes, no))dnl
2101 AC_ARG_ENABLE(symvers,
2102 changequote(<<, >>)dnl
2103 << --enable-symvers=style enables symbol versioning of the shared library [default=>>GLIBCPP_ENABLE_SYMVERS_DEFAULT],
2104 changequote([, ])dnl
2105 [case "$enableval" in
2106 yes) enable_symvers=yes ;;
2107 no) enable_symvers=no ;;
2108 # other names here, just as sanity checks
2109 #gnu|sun|etcetera) enable_symvers=$enableval ;;
2110 gnu) enable_symvers=$enableval ;;
2111 *) AC_MSG_ERROR([Unknown argument to enable/disable symvers]) ;;
2113 enable_symvers=GLIBCPP_ENABLE_SYMVERS_DEFAULT)dnl
2115 # If we never went through the GLIBCPP_CHECK_LINKER_FEATURES macro, then we
2116 # don't know enough about $LD to do tricks...
2117 if test x$enable_shared = xno ||
2119 test x$glibcpp_gnu_ld_version = x; then
2123 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
2124 AC_MSG_CHECKING([for shared libgcc])
2125 ac_save_CFLAGS="$CFLAGS"
2127 AC_TRY_LINK( , [return 0], glibcpp_shared_libgcc=yes, glibcpp_shared_libgcc=no)
2128 CFLAGS="$ac_save_CFLAGS"
2129 AC_MSG_RESULT($glibcpp_shared_libgcc)
2131 # For GNU ld, we need at least this version. It's 2.12 in the same format
2132 # as the tested-for version. See GLIBCPP_CHECK_LINKER_FEATURES for more.
2133 glibcpp_min_gnu_ld_version=21200
2135 # Check to see if unspecified "yes" value can win, given results
2137 if test $enable_symvers = yes ; then
2138 if test $with_gnu_ld = yes &&
2139 test $glibcpp_shared_libgcc = yes ;
2141 if test $glibcpp_gnu_ld_version -ge $glibcpp_min_gnu_ld_version ; then
2144 ac_test_CFLAGS="${CFLAGS+set}"
2145 ac_save_CFLAGS="$CFLAGS"
2146 CFLAGS='-shared -Wl,--version-script,conftest.map'
2149 echo 'FOO { global: f[a-z]o; local: *; };' > conftest.map
2151 AC_TRY_LINK([int foo;],, enable_symvers=gnu)
2152 if test "$ac_test_CFLAGS" = set; then
2153 CFLAGS="$ac_save_CFLAGS"
2155 # this is the suspicious part
2166 dnl Everything parsed; figure out what file to use.
2167 case $enable_symvers in
2169 LINKER_MAP=config/linker-map.dummy
2172 LINKER_MAP=config/linker-map.gnu
2176 AC_LINK_FILES($LINKER_MAP, src/linker.map)
2177 AM_CONDITIONAL(GLIBCPP_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
2178 AC_MSG_CHECKING([versioning on shared library symbols])
2179 AC_MSG_RESULT($enable_symvers)