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.50+, 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]))])
77 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
78 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
79 # are probably using a cross compiler, which will not be able to fully
80 # link an executable. This should really be fixed in autoconf
83 AC_DEFUN(LIB_AC_PROG_CC,
84 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
85 dnl Fool anybody using AC_PROG_CC.
86 AC_PROVIDE([AC_PROG_CC])
87 AC_CHECK_PROG(CC, gcc, gcc)
88 if test -z "$CC"; then
89 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
90 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
95 if test $ac_cv_prog_gcc = yes; then
97 dnl Check whether -g works, even if CFLAGS is set, in case the package
98 dnl plays around with CFLAGS (such as to build both debugging and
99 dnl normal versions of a library), tasteless as that idea is.
100 ac_test_CFLAGS="${CFLAGS+set}"
101 ac_save_CFLAGS="$CFLAGS"
104 if test "$ac_test_CFLAGS" = set; then
105 CFLAGS="$ac_save_CFLAGS"
106 elif test $ac_cv_prog_cc_g = yes; then
113 test "${CFLAGS+set}" = set || CFLAGS="-g"
119 # Can't just call these here as g++ requires libstc++ to be built....
122 # Likewise for AC_PROG_CXX.
123 AC_DEFUN(LIB_AC_PROG_CXX,
124 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
125 dnl Fool anybody using AC_PROG_CXX.
126 AC_PROVIDE([AC_PROG_CXX])
127 # Use glibcpp_CXX so that we do not cause CXX to be cached with the
128 # flags that come in CXX while configuring libstdc++. They're different
129 # from those used for all other target libraries. If CXX is set in
130 # the environment, respect that here.
132 AC_CHECK_PROGS(glibcpp_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
133 AC_SUBST(glibcpp_CXX)
135 test -z "$glibcpp_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
139 if test $ac_cv_prog_gxx = yes; then
141 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
142 dnl plays around with CXXFLAGS (such as to build both debugging and
143 dnl normal versions of a library), tasteless as that idea is.
144 ac_test_CXXFLAGS="${CXXFLAGS+set}"
145 ac_save_CXXFLAGS="$CXXFLAGS"
148 if test "$ac_test_CXXFLAGS" = set; then
149 CXXFLAGS="$ac_save_CXXFLAGS"
150 elif test $ac_cv_prog_cxx_g = yes; then
157 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
163 # For some reason, gettext needs this.
166 AC_CHECK_TOOL(AS, as)
167 AC_CHECK_TOOL(AR, ar)
168 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
173 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
174 # at least currently, we never actually build a program, so we never
175 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
176 # fails, because we are probably configuring with a cross compiler
177 # which can't create executables. So we include AC_EXEEXT to keep
178 # automake happy, but we don't execute it, since we don't care about
181 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
182 # to nothing, so nothing would remain between `then' and `fi' if it
183 # were not for the `:' below.
188 . [$]{glibcpp_basedir}/configure.host
190 case [$]{glibcpp_basedir} in
191 /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
192 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
195 # This does for the target what configure.host does for the host. In
196 # addition to possibly modifying the same flags, it also sets up symlinks.
204 dnl Check to see if g++ can compile this library, and if so, if any version-
205 dnl specific precautions need to be taken.
207 dnl GLIBCPP_CHECK_COMPILER_VERSION
208 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
209 if test ! -f stamp-sanity-compiler; then
210 AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3])
217 ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to GCC 3.0 or above]))
219 AC_MSG_RESULT($gpp_satisfactory)
220 touch stamp-sanity-compiler
226 dnl Tests for newer compiler features, or features that are present in newer
227 dnl compiler versions but not older compiler versions still in use, should
230 dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
231 dnl new inlining code or the new system_header pragma will die on -Werror.
232 dnl Leave it out by default and use maint-mode to use it.
234 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
235 dnl compiler supports it and the user has not requested debug mode.
237 dnl GLIBCPP_CHECK_COMPILER_FEATURES
238 AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
239 # All these tests are for C++; save the language and the compiler flags.
240 # The CXXFLAGS thing is suspicious, but based on similar bits previously
241 # found in GLIBCPP_CONFIGURE.
244 ac_test_CXXFLAGS="${CXXFLAGS+set}"
245 ac_save_CXXFLAGS="$CXXFLAGS"
247 # Check for maintainer-mode bits.
248 if test x"$USE_MAINTAINER_MODE" = xno; then
254 # Check for -ffunction-sections -fdata-sections
255 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
256 CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
257 AC_TRY_COMPILE(, [int foo;
258 ], [ac_fdsections=yes], [ac_fdsections=no])
259 if test "$ac_test_CXXFLAGS" = set; then
260 CXXFLAGS="$ac_save_CXXFLAGS"
262 # this is the suspicious part
265 if test x"$ac_fdsections" = x"yes" &&
266 test x"$enable_debug" = x"no"; then
267 SECTION_FLAGS='-ffunction-sections -fdata-sections'
269 AC_MSG_RESULT($ac_fdsections)
273 AC_SUBST(SECTION_FLAGS)
278 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
279 dnl the native linker is in use, all variables will be defined to something
280 dnl safe (like an empty string).
282 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
283 dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
284 dnl Define LD, with_gnu_ld, and (possibly) glibcpp_gnu_ld_version as
285 dnl side-effects of testing.
287 dnl GLIBCPP_CHECK_LINKER_FEATURES
288 AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
289 # If we're not using GNU ld, then there's no point in even trying these
290 # tests. Check for that first. We should have already tested for gld
291 # by now (in libtool), but require it now just to be safe...
292 test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
293 test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
294 AC_REQUIRE([AC_PROG_LD])
296 # The name set by libtool depends on the version of libtool. Shame on us
297 # for depending on an impl detail, but c'est la vie. Older versions used
298 # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
299 # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
300 # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
301 # set (hence we're using an older libtool), then set it.
302 if test x${with_gnu_ld+set} != xset; then
303 if test x${ac_cv_prog_gnu_ld+set} != xset; then
304 # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
307 with_gnu_ld=$ac_cv_prog_gnu_ld
311 # Start by getting the version number. I think the libtool test already
312 # does some of this, but throws away the result.
314 ldver=`$LD --version 2>/dev/null | head -1 | \
315 sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
317 glibcpp_gnu_ld_version=`echo $ldver | \
318 $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
321 if test "$with_gnu_ld" = "notbroken"; then
322 # GNU ld it is! Joy and bunny rabbits!
324 # All these tests are for C++; save the language and the compiler flags.
325 # Need to do this so that g++ won't try to link in libstdc++
326 ac_test_CFLAGS="${CFLAGS+set}"
327 ac_save_CFLAGS="$CFLAGS"
328 CFLAGS='-x c++ -Wl,--gc-sections'
330 # Check for -Wl,--gc-sections
331 # XXX This test is broken at the moment, as symbols required for
332 # linking are now in libsupc++ (not built yet.....). In addition,
333 # this test has cored on solaris in the past. In addition,
334 # --gc-sections doesn't really work at the moment (keeps on discarding
335 # used sections, first .eh_frame and now some of the glibc sections for
336 # iconv). Bzzzzt. Thanks for playing, maybe next time.
337 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
345 ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
346 if test "$ac_test_CFLAGS" = set; then
347 CFLAGS="$ac_save_CFLAGS"
349 # this is the suspicious part
352 if test "$ac_sectionLDflags" = "yes"; then
353 SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
355 AC_MSG_RESULT($ac_sectionLDflags)
358 # Set linker optimization flags.
359 if test x"$with_gnu_ld" = x"yes" && test x"$enable_debug" = x"no"; then
360 OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
363 AC_SUBST(SECTION_LDFLAGS)
364 AC_SUBST(OPT_LDFLAGS)
369 dnl Check to see if the (math function) argument passed is
370 dnl declared when using the c++ compiler
371 dnl ASSUMES argument is a math function with ONE parameter
373 dnl GLIBCPP_CHECK_MATH_DECL_1
374 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [
375 AC_MSG_CHECKING([for $1 declaration])
376 if test x${glibcpp_cv_func_$1_use+set} != xset; then
377 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
380 AC_TRY_COMPILE([#include <math.h>
386 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
390 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
394 dnl Check to see if the (math function) argument passed is
395 dnl 1) declared when using the c++ compiler
396 dnl 2) has "C" linkage
397 dnl 3) if not, see if 1) and 2) for argument prepended with '_'
399 dnl Define HAVE_CARGF etc if "cargf" is declared and links
401 dnl argument 1 is name of function to check
403 dnl ASSUMES argument is a math function with ONE parameter
405 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
406 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
407 GLIBCPP_CHECK_MATH_DECL_1($1)
408 if test x$glibcpp_cv_func_$1_use = x"yes"; then
411 GLIBCPP_CHECK_MATH_DECL_1(_$1)
412 if test x$glibcpp_cv_func__$1_use = x"yes"; then
420 dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
421 dnl of functions at once. It's an all-or-nothing check -- either
422 dnl HAVE_XYZ is defined for each of the functions, or for none of them.
423 dnl Doing it this way saves significant configure time.
424 AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [
425 AC_MSG_CHECKING([for $1 functions])
426 AC_CACHE_VAL(glibcpp_cv_func_$2_use, [
429 AC_TRY_COMPILE([#include <math.h>],
430 [ `for x in $3; do echo "$x (0);"; done` ],
431 [glibcpp_cv_func_$2_use=yes],
432 [glibcpp_cv_func_$2_use=no])
434 AC_MSG_RESULT($glibcpp_cv_func_$2_use)
435 if test x$glibcpp_cv_func_$2_use = x"yes"; then
441 dnl Check to see if the (math function) argument passed is
442 dnl declared when using the c++ compiler
443 dnl ASSUMES argument is a math function with TWO parameters
445 dnl GLIBCPP_CHECK_MATH_DECL_2
446 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [
447 AC_MSG_CHECKING([for $1 declaration])
448 if test x${glibcpp_cv_func_$1_use+set} != xset; then
449 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
452 AC_TRY_COMPILE([#include <math.h>],
454 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
458 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
462 dnl Check to see if the (math function) argument passed is
463 dnl 1) declared when using the c++ compiler
464 dnl 2) has "C" linkage
466 dnl Define HAVE_CARGF etc if "cargf" is declared and links
468 dnl argument 1 is name of function to check
470 dnl ASSUMES argument is a math function with TWO parameters
472 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
473 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
474 GLIBCPP_CHECK_MATH_DECL_2($1)
475 if test x$glibcpp_cv_func_$1_use = x"yes"; then
478 GLIBCPP_CHECK_MATH_DECL_2(_$1)
479 if test x$glibcpp_cv_func__$1_use = x"yes"; then
487 dnl Check to see if the (math function) argument passed is
488 dnl declared when using the c++ compiler
489 dnl ASSUMES argument is a math function with THREE parameters
491 dnl GLIBCPP_CHECK_MATH_DECL_3
492 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [
493 AC_MSG_CHECKING([for $1 declaration])
494 if test x${glibcpp_cv_func_$1_use+set} != xset; then
495 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
498 AC_TRY_COMPILE([#include <math.h>],
500 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
504 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
508 dnl Check to see if the (math function) argument passed is
509 dnl 1) declared when using the c++ compiler
510 dnl 2) has "C" linkage
512 dnl Define HAVE_CARGF etc if "cargf" is declared and links
514 dnl argument 1 is name of function to check
516 dnl ASSUMES argument is a math function with THREE parameters
518 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
519 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
520 GLIBCPP_CHECK_MATH_DECL_3($1)
521 if test x$glibcpp_cv_func_$1_use = x"yes"; then
524 GLIBCPP_CHECK_MATH_DECL_3(_$1)
525 if test x$glibcpp_cv_func__$1_use = x"yes"; then
533 dnl Check to see if the (stdlib function) argument passed is
534 dnl 1) declared when using the c++ compiler
535 dnl 2) has "C" linkage
537 dnl argument 1 is name of function to check
539 dnl ASSUMES argument is a math function with TWO parameters
541 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
542 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
543 AC_MSG_CHECKING([for $1 declaration])
544 if test x${glibcpp_cv_func_$1_use+set} != xset; then
545 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
548 AC_TRY_COMPILE([#include <stdlib.h>],
550 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
554 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
555 if test x$glibcpp_cv_func_$1_use = x"yes"; then
562 dnl Because the builtins are picky picky picky about the arguments they take,
563 dnl do an explict linkage tests here.
564 dnl Check to see if the (math function) argument passed is
565 dnl 1) declared when using the c++ compiler
566 dnl 2) has "C" linkage
568 dnl Define HAVE_CARGF etc if "cargf" is declared and links
570 dnl argument 1 is name of function to check
572 dnl ASSUMES argument is a math function with ONE parameter
574 dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
575 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
576 AC_MSG_CHECKING([for $1 declaration])
577 if test x${glibcpp_cv_func_$1_use+set} != xset; then
578 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
581 AC_TRY_COMPILE([#include <math.h>],
583 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
587 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
588 if test x$glibcpp_cv_func_$1_use = x"yes"; then
589 AC_MSG_CHECKING([for $1 linkage])
590 if test x${glibcpp_cv_func_$1_link+set} != xset; then
591 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
592 AC_TRY_LINK([#include <math.h>],
594 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
597 AC_MSG_RESULT($glibcpp_cv_func_$1_link)
598 if test x$glibcpp_cv_func_$1_link = x"yes"; then
599 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
600 AC_DEFINE_UNQUOTED(${ac_tr_func})
607 dnl Check to see what builtin math functions are supported
609 dnl check for __builtin_abs
610 dnl check for __builtin_fabsf
611 dnl check for __builtin_fabs
612 dnl check for __builtin_fabl
613 dnl check for __builtin_labs
614 dnl check for __builtin_sqrtf
615 dnl check for __builtin_sqrtl
616 dnl check for __builtin_sqrt
617 dnl check for __builtin_sinf
618 dnl check for __builtin_sin
619 dnl check for __builtin_sinl
620 dnl check for __builtin_cosf
621 dnl check for __builtin_cos
622 dnl check for __builtin_cosl
624 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
625 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
626 dnl Test for builtin math functions.
627 dnl These are made in gcc/c-common.c
628 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
629 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
630 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
631 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
632 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
634 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
635 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrt)
636 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
638 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
639 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
640 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
642 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
643 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
644 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
646 dnl There is, without a doubt, a more elegant way to have these
647 dnl names exported so that they won't be stripped out of acconfig.h by
648 dnl autoheader. I leave this as an exercise to somebody less frustrated
649 dnl than I.... please email the libstdc++ list if you can figure out a
650 dnl more elegant approach (see autoconf/acgen.m4 and specifically
651 dnl AC_CHECK_FUNC for things to steal.)
653 if test x$dummyvar = x"yes"; then
654 AC_DEFINE(HAVE___BUILTIN_ABS)
655 AC_DEFINE(HAVE___BUILTIN_LABS)
656 AC_DEFINE(HAVE___BUILTIN_COS)
657 AC_DEFINE(HAVE___BUILTIN_COSF)
658 AC_DEFINE(HAVE___BUILTIN_COSL)
659 AC_DEFINE(HAVE___BUILTIN_FABS)
660 AC_DEFINE(HAVE___BUILTIN_FABSF)
661 AC_DEFINE(HAVE___BUILTIN_FABSL)
662 AC_DEFINE(HAVE___BUILTIN_SIN)
663 AC_DEFINE(HAVE___BUILTIN_SINF)
664 AC_DEFINE(HAVE___BUILTIN_SINL)
665 AC_DEFINE(HAVE___BUILTIN_SQRT)
666 AC_DEFINE(HAVE___BUILTIN_SQRTF)
667 AC_DEFINE(HAVE___BUILTIN_SQRTL)
673 dnl Check to see what the underlying c library
674 dnl These checks need to do two things:
675 dnl 1) make sure the name is declared when using the c++ compiler
676 dnl 2) make sure the name has "C" linkage
677 dnl This might seem like overkill but experience has shown that it's not...
679 dnl Define HAVE_STRTOLD if "strtold" is declared and links
680 dnl Define HAVE_STRTOF if "strtof" is declared and links
681 dnl Define HAVE_DRAND48 if "drand48" is declared and links
683 dnl GLIBCPP_CHECK_STDLIB_SUPPORT
684 AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
685 ac_test_CXXFLAGS="${CXXFLAGS+set}"
686 ac_save_CXXFLAGS="$CXXFLAGS"
687 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
689 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
690 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof)
691 AC_CHECK_FUNCS(drand48)
693 CXXFLAGS="$ac_save_CXXFLAGS"
698 dnl Check to see what the underlying c library or math library is like.
699 dnl These checks need to do two things:
700 dnl 1) make sure the name is declared when using the c++ compiler
701 dnl 2) make sure the name has "C" linkage
702 dnl This might seem like overkill but experience has shown that it's not...
704 dnl Define HAVE_CARGF etc if "cargf" is found.
706 dnl GLIBCPP_CHECK_MATH_SUPPORT
707 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
708 ac_test_CXXFLAGS="${CXXFLAGS+set}"
709 ac_save_CXXFLAGS="$CXXFLAGS"
710 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
713 AC_CHECK_LIB(m, sin, libm="-lm")
717 dnl Check to see if certain C math functions exist.
718 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
719 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
720 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
721 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
722 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
723 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
724 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
725 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypot)
727 dnl Check to see if basic C math functions have float versions.
728 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig,
733 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
736 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
737 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
738 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
739 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
740 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
741 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
742 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf)
743 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
744 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
745 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
746 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
747 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
748 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
749 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
750 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
752 dnl Check to see if basic C math functions have long double versions.
753 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig,
758 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round,
761 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
762 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
763 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
764 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
765 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
766 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
767 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
768 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
769 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl)
770 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
771 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
772 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
773 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
774 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
775 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
776 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
777 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
779 dnl Some runtimes have these functions with a preceding underscore. Please
780 dnl keep this sync'd with the one above. And if you add any new symbol,
781 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
782 dnl Check to see if certain C math functions exist.
784 dnl Check to see if basic C math functions have float versions.
785 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
787 _acosf _asinf _atanf \
789 _coshf _sinhf _tanhf)
790 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
794 dnl Check to see if basic C math functions have long double versions.
795 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
797 _acosl _asinl _atanl \
799 _coshl _sinhl _tanhl)
800 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
805 CXXFLAGS="$ac_save_CXXFLAGS"
810 dnl Check to see if there is native support for complex
812 dnl Don't compile bits in math/* if native support exits.
814 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "copysignl" is found.
816 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
817 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
818 dnl Check for complex versions of math functions of platform.
819 AC_CHECK_LIB(m, main)
820 AC_REPLACE_MATHFUNCS(nan copysignf)
822 dnl Compile the long double complex functions only if the function
823 dnl provides the non-complex long double functions that are needed.
824 dnl Currently this includes copysignl, which should be
825 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
826 USE_COMPLEX_LONG_DOUBLE=no
827 if test x$ac_cv_func_copysignl = x"yes"; then
828 USE_COMPLEX_LONG_DOUBLE=yes
829 AC_REPLACE_MATHFUNCS(signbitl)
832 AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
836 dnl Check to see what architecture and operating system we are compiling
837 dnl for. Also, if architecture- or OS-specific flags are required for
838 dnl compilation, pick them up here.
840 dnl GLIBCPP_CHECK_TARGET
841 AC_DEFUN(GLIBCPP_CHECK_TARGET, [
842 . [$]{glibcpp_basedir}/configure.target
843 AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
844 AC_MSG_RESULT(OS config directory is $os_include_dir)
849 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
850 dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
851 dnl must have been previously checked.)
853 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
854 dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h
856 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
857 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
859 dnl Test wchar.h for mbstate_t, which is needed for char_traits and
860 dnl others even if wchar_t support is not on.
861 AC_MSG_CHECKING([for mbstate_t])
862 AC_TRY_COMPILE([#include <wchar.h>],
863 [mbstate_t teststate;],
864 have_mbstate_t=yes, have_mbstate_t=no)
865 AC_MSG_RESULT($have_mbstate_t)
866 if test x"$have_mbstate_t" = xyes; then
867 AC_DEFINE(HAVE_MBSTATE_T)
870 dnl Sanity check for existence of ISO C99 headers for extended encoding.
871 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
872 AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
874 dnl Only continue checking if the ISO C99 headers exist and support is on.
875 if test x"$ac_has_wchar_h" = xyes &&
876 test x"$ac_has_wctype_h" = xyes &&
877 test x"$enable_c_mbchar" != xno; then
879 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
880 dnl numeric_limits can instantiate type_traits<wchar_t>
881 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
882 AC_TRY_COMPILE([#include <wchar.h>],
883 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
884 has_wchar_minmax=yes, has_wchar_minmax=no)
885 AC_MSG_RESULT($has_wchar_minmax)
887 dnl Test wchar.h for WEOF, which is what we use to determine whether
888 dnl to specialize for char_traits<wchar_t> or not.
889 AC_MSG_CHECKING([for WEOF])
892 #include <stddef.h>],
894 has_weof=yes, has_weof=no)
895 AC_MSG_RESULT($has_weof)
897 dnl Tests for wide character functions used in char_traits<wchar_t>.
899 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset,, \
902 dnl Checks for names injected into std:: by the c_std headers.
903 AC_CHECK_FUNCS(btowc wctob fgetwc fgetwc fgetws fputwc fputws fwide \
904 fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
905 vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
906 mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
907 wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
908 wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \
911 AC_MSG_CHECKING([for ISO C99 wchar_t support])
912 if test x"$has_weof" = xyes &&
913 test x"$has_wchar_minmax" = xyes &&
914 test x"$ac_wfuncs" = xyes; then
915 ac_isoC99_wchar_t=yes
919 AC_MSG_RESULT($ac_isoC99_wchar_t)
921 dnl Use iconv for wchar_t to char conversions. As such, check for
922 dnl X/Open Portability Guide, version 2 features (XPG2).
923 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
924 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
926 dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
927 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
929 LIBS="$LIBS $libiconv"
931 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
932 ac_XPG2funcs=yes, ac_XPG2funcs=no)
936 AC_MSG_CHECKING([for XPG2 wchar_t support])
937 if test x"$ac_has_iconv_h" = xyes &&
938 test x"$ac_has_langinfo_h" = xyes &&
939 test x"$ac_XPG2funcs" = xyes; then
944 AC_MSG_RESULT($ac_XPG2_wchar_t)
946 dnl At the moment, only enable wchar_t specializations if all the
947 dnl above support is present.
948 AC_MSG_CHECKING([for enabled wchar_t specializations])
949 if test x"$ac_isoC99_wchar_t" = xyes &&
950 test x"$ac_XPG2_wchar_t" = xyes; then
951 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
957 dnl Wide characters disabled by the user.
958 AC_MSG_WARN([wchar_t support disabled.])
964 dnl Check for special debugging mode; not for production use.
966 dnl GLIBCPP_ENABLE_DEBUG
967 dnl --enable-debug sets '-ggdb3 -O0'.
968 dnl --disable-debug sets '-g' and whatever optimization options the
969 dnl compiler can handle.
970 dnl + --enable-maintainer-mode automatically defaults this to on.
971 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
972 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
973 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
974 dnl defaults to `no'.
975 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
976 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
978 changequote(<<, >>)dnl
979 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
981 [case "${enableval}" in
982 yes) enable_debug=yes ;;
983 no) enable_debug=no ;;
984 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
986 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
988 dnl Option parsed, now set things appropriately
989 case "${enable_debug}" in
991 DEBUG_FLAGS='-O0 -ggdb3'
997 AC_SUBST(DEBUG_FLAGS)
1002 dnl Check for "unusual" flags to pass to the compiler while building.
1004 dnl GLIBCPP_ENABLE_CXX_FLAGS
1005 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1006 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1007 dnl Somehow this same set of flags must be passed when [re]building
1009 dnl --disable-cxx-flags passes nothing.
1010 dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
1011 dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
1012 dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
1013 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
1014 dnl If "default flags" is an empty string (or "none"), the effect is
1015 dnl the same as --disable or --enable=no.
1016 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1017 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1018 AC_ARG_ENABLE(cxx-flags,
1019 changequote(<<, >>)dnl
1020 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
1021 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1022 changequote([, ])dnl
1023 [case "x$enableval" in
1025 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1027 enable_cxx_flags='' ;;
1029 enable_cxx_flags="$enableval" ;;
1031 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
1033 dnl Thinko on my part during design. This kludge is the workaround.
1034 if test "$enable_cxx_flags" = "none"; then
1035 enable_cxx_flags='';
1038 dnl Run through flags (either default or command-line) and set anything
1039 dnl extra (e.g., #defines) that must accompany particular g++ options.
1040 if test -n "$enable_cxx_flags"; then
1041 for f in $enable_cxx_flags; do
1045 *) # and we're trying to pass /what/ exactly?
1046 AC_MSG_ERROR([compiler flags start with a -]) ;;
1050 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1051 AC_SUBST(EXTRA_CXX_FLAGS)
1056 dnl Check for which locale library to use: gnu or generic.
1058 dnl GLIBCPP_ENABLE_CLOCALE
1059 dnl --enable-clocale=gnu sets config/locale/c_locale_gnu.cc and friends
1060 dnl --enable-clocale=generic sets config/locale/c_locale_generic.cc and friends
1062 dnl default is generic
1064 AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
1065 AC_MSG_CHECKING([for clocale to use])
1066 AC_ARG_ENABLE(clocale,
1067 [ --enable-clocale enable model for target locale package.
1068 --enable-clocale=MODEL use MODEL target-speific locale package. [default=generic]
1070 if test x$enable_clocale = xno; then
1075 enable_clocale_flag=$enable_clocale
1077 dnl Probe for locale support if no specific model is specified.
1078 dnl Default to "generic"
1079 if test x$enable_clocale_flag = xno; then
1080 case x${target_os} in
1082 AC_EGREP_CPP([_GLIBCPP_ok], [
1083 #include <features.h>
1084 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1087 ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
1089 # Test for bugs early in glibc-2.2.x series
1090 if test x$enable_clocale_flag = xgnu; then
1092 #define _GNU_SOURCE 1
1096 const char __one[] = "Äuglein Augmen";
1097 const char __two[] = "Äuglein";
1102 loc = __newlocale(1 << LC_ALL, "de_DE", 0);
1103 loc_dup = __duplocale(loc);
1104 i = __strcoll_l(__one, __two, loc);
1105 j = __strcoll_l(__one, __two, loc_dup);
1109 [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
1110 [enable_clocale_flag=generic])
1113 # ... at some point put __strxfrm_l tests in as well.
1116 enable_clocale_flag=generic
1121 dnl Set configure bits for specified locale package
1122 case x${enable_clocale_flag} in
1124 AC_MSG_RESULT(generic)
1126 # Don't use gettext.
1129 CLOCALE_H=config/locale/generic/c_locale.h
1130 CLOCALE_CC=config/locale/generic/c_locale.cc
1131 CCODECVT_H=config/locale/generic/codecvt_specializations.h
1132 CCOLLATE_CC=config/locale/generic/collate_members.cc
1133 CCTYPE_CC=config/locale/generic/ctype_members.cc
1134 CMESSAGES_H=config/locale/generic/messages_members.h
1135 CMESSAGES_CC=config/locale/generic/messages_members.cc
1136 CMONEY_CC=config/locale/generic/monetary_members.cc
1137 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1138 CTIME_CC=config/locale/generic/time_members.cc
1143 # Declare intention to use gettext, and add support for specific
1145 # For some reason, ALL_LINGUAS has to be before AM_GNU_GETTEXT
1147 # Don't call AM_GNU_GETTEXT here. Instead, assume glibc.
1148 # Need to deal with MSGFMT, USE_NLS, and glibcpp_[P,M]OFILES
1151 # Export the build objects.
1152 for ling in $ALL_LINGUAS; do \
1153 glibcpp_MOFILES="$glibcpp_MOFILES $ling.mo"; \
1154 glibcpp_POFILES="$glibcpp_POFILES $ling.po"; \
1156 AC_SUBST(glibcpp_MOFILES)
1157 AC_SUBST(glibcpp_POFILES)
1159 CLOCALE_H=config/locale/gnu/c_locale.h
1160 CLOCALE_CC=config/locale/gnu/c_locale.cc
1161 CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1162 CCOLLATE_CC=config/locale/gnu/collate_members.cc
1163 CCTYPE_CC=config/locale/gnu/ctype_members.cc
1164 CMESSAGES_H=config/locale/gnu/messages_members.h
1165 CMESSAGES_CC=config/locale/gnu/messages_members.cc
1166 CMONEY_CC=config/locale/gnu/monetary_members.cc
1167 CNUMERIC_CC=config/locale/gnu/numeric_members.cc
1168 CTIME_CC=config/locale/gnu/time_members.cc
1171 AC_MSG_RESULT(generic)
1173 # Don't use gettext.
1176 CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h
1177 CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc
1178 CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1179 CCOLLATE_CC=config/locale/generic/collate_members.cc
1180 CCTYPE_CC=config/locale/generic/ctype_members.cc
1181 CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h
1182 CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc
1183 CMONEY_CC=config/locale/generic/monetary_members.cc
1184 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1185 CTIME_CC=config/locale/generic/time_members.cc
1188 echo "$enable_clocale is an unknown locale package" 1>&2
1193 # This is where the testsuite looks for locale catalogs, using the
1194 # -DLOCALEDIR define during testsuite compilation.
1195 glibcpp_localedir=${glibcpp_builddir}/po/share/locale
1196 AC_SUBST(glibcpp_localedir)
1200 AC_SUBST(CCODECVT_H)
1201 AC_SUBST(CMESSAGES_H)
1202 AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
1203 AC_LINK_FILES($CCOLLATE_CC, src/collate.cc)
1204 AC_LINK_FILES($CCTYPE_CC, src/ctype.cc)
1205 AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
1206 AC_LINK_FILES($CMONEY_CC, src/monetary.cc)
1207 AC_LINK_FILES($CNUMERIC_CC, src/numeric.cc)
1208 AC_LINK_FILES($CTIME_CC, src/time.cc)
1213 dnl Check for which I/O library to use: libio, or something specific.
1215 dnl GLIBCPP_ENABLE_CSTDIO
1216 dnl --enable-cstdio=libio sets config/io/c_io_libio.h and friends
1218 dnl default is stdio
1220 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1221 AC_MSG_CHECKING([for cstdio to use])
1222 AC_ARG_ENABLE(cstdio,
1223 [ --enable-cstdio enable stdio for target io package.
1224 --enable-cstdio=LIB use LIB target-speific io package. [default=stdio]
1226 if test x$enable_cstdio = xno; then
1229 enable_cstdio=stdio)
1231 enable_cstdio_flag=$enable_cstdio
1233 dnl Check if a valid I/O package
1234 case x${enable_cstdio_flag} in
1236 CSTDIO_H=config/io/c_io_libio.h
1237 BASIC_FILE_H=config/io/basic_file_libio.h
1238 BASIC_FILE_CC=config/io/basic_file_libio.cc
1239 AC_MSG_RESULT(libio)
1241 # see if we are on a system with libio native (ie, linux)
1242 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1244 # Need to check and see what version of glibc is being used. If
1245 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1246 # compile most of libio for linux systems.
1247 if test x$has_libio = x"yes"; then
1250 AC_MSG_CHECKING([for glibc version >= 2.2])
1251 AC_EGREP_CPP([ok], [
1252 #include <features.h>
1253 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1256 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1257 AC_MSG_RESULT($glibc_satisfactory)
1261 # XXX at the moment, admit defeat and force the recompilation
1262 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
1263 glibc_satisfactory=no
1265 if test x$glibc_satisfactory = x"yes"; then
1270 # bkoz XXX need to add checks to enable this
1271 # pme XXX here's a first pass at such a check
1272 if test x$enable_c_mbchar != xno; then
1280 # Using libio, but <libio.h> doesn't exist on the target system. . .
1282 # bkoz XXX need to add checks to enable this
1283 # pme XXX here's a first pass at such a check
1284 if test x$enable_c_mbchar != xno; then
1291 xstdio | x | xno | xnone | xyes)
1293 CSTDIO_H=config/io/c_io_stdio.h
1294 BASIC_FILE_H=config/io/basic_file_stdio.h
1295 BASIC_FILE_CC=config/io/basic_file_stdio.cc
1296 AC_MSG_RESULT(stdio)
1298 # We're not using stdio.
1303 echo "$enable_cstdio is an unknown io package" 1>&2
1308 AC_SUBST(BASIC_FILE_H)
1309 AC_LINK_FILES($BASIC_FILE_CC, src/basic_file.cc)
1311 # 2000-08-04 bkoz hack
1312 CCODECVT_C=config/io/c_io_libio_codecvt.c
1313 AC_SUBST(CCODECVT_C)
1314 # 2000-08-04 bkoz hack
1316 AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO,
1317 test "$need_libio" = yes || test "$need_wlibio" = yes)
1318 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1319 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1320 if test "$need_libio" = yes || test "$need_wlibio" = yes; then
1321 libio_la=../libio/libio.la
1330 dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
1331 dnl We must stage the required headers so that they will be installed
1332 dnl with the library (unlike libgcc, the STL implementation is provided
1333 dnl solely within headers). Since we must not inject random user-space
1334 dnl macro names into user-provided C++ code, we first stage into <file>-in
1335 dnl and process to <file> with an output command. The reason for a two-
1336 dnl stage process here is to correctly handle $srcdir!=$objdir without
1337 dnl having to write complex code (the sed commands to clean the macro
1338 dnl namespace are complex and fragile enough as it is). We must also
1339 dnl add a relative path so that -I- is supported properly.
1341 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1342 AC_MSG_CHECKING([for thread model used by GCC])
1343 target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
1344 AC_MSG_RESULT([$target_thread_file])
1346 if test $target_thread_file != single; then
1347 AC_DEFINE(HAVE_GTHR_DEFAULT)
1348 AC_DEFINE(_GLIBCPP_SUPPORTS_WEAK, __GXX_WEAK__)
1351 glibcpp_thread_h=gthr-$target_thread_file.h
1352 AC_SUBST(glibcpp_thread_h)
1357 dnl Check for exception handling support. If an explicit enable/disable
1358 dnl sjlj exceptions is given, we don't have to detect. Otherwise the
1359 dnl target may or may not support call frame exceptions.
1361 dnl GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
1362 dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
1363 dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1365 dnl Define _GLIBCPP_SJLJ_EXCEPTIONS if the compiler is configured for it.
1367 AC_DEFUN(GLIBCPP_ENABLE_SJLJ_EXCEPTIONS, [
1368 AC_MSG_CHECKING([for exception model to use])
1371 AC_ARG_ENABLE(sjlj-exceptions,
1372 [ --enable-sjlj-exceptions force use of builtin_setjmp for exceptions],
1374 [dnl Botheration. Now we've got to detect the exception model.
1375 dnl Link tests against libgcc.a are problematic since -- at least
1376 dnl as of this writing -- we've not been given proper -L bits for
1377 dnl single-tree newlib and libgloss.
1379 dnl This is what AC_TRY_COMPILE would do if it didn't delete the
1380 dnl conftest files before we got a change to grep them first.
1381 cat > conftest.$ac_ext << EOF
1382 [#]line __oline__ "configure"
1391 old_CXXFLAGS="$CXXFLAGS"
1393 if AC_TRY_EVAL(ac_compile); then
1394 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
1395 enable_sjlj_exceptions=yes
1396 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
1397 enable_sjlj_exceptions=no
1400 CXXFLAGS="$old_CXXFLAGS"
1402 if test x$enable_sjlj_exceptions = xyes; then
1403 AC_DEFINE(_GLIBCPP_SJLJ_EXCEPTIONS, 1,
1404 [Define if the compiler is configured for setjmp/longjmp exceptions.])
1405 ac_exception_model_name=sjlj
1406 elif test x$enable_sjlj_exceptions = xno; then
1407 ac_exception_model_name="call frame"
1409 AC_MSG_ERROR([unable to detect exception model])
1412 AC_MSG_RESULT($ac_exception_model_name)
1417 dnl Check for ISO/IEC 9899:1999 "C99" support.
1419 dnl GLIBCPP_ENABLE_C99
1420 dnl --enable-c99 defines _GLIBCPP_USE_C99
1421 dnl --disable-c99 leaves _GLIBCPP_USE_C99 undefined
1422 dnl + Usage: GLIBCPP_ENABLE_C99[(DEFAULT)]
1423 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1424 dnl defaults to `no'.
1425 dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
1427 dnl GLIBCPP_ENABLE_C99
1428 AC_DEFUN(GLIBCPP_ENABLE_C99, [dnl
1429 define([GLIBCPP_ENABLE_C99_DEFAULT], ifelse($1, yes, yes, no))dnl
1432 changequote(<<, >>)dnl
1433 <<--enable-c99 turns on 'ISO/IEC 9899:1999 support' [default=>>GLIBCPP_ENABLE_C99_DEFAULT],
1434 changequote([, ])dnl
1435 [case "$enableval" in
1436 yes) enable_c99=yes ;;
1437 no) enable_c99=no ;;
1438 *) AC_MSG_ERROR([Unknown argument to enable/disable C99]) ;;
1440 enable_c99=GLIBCPP_ENABLE_C99_DEFAULT)dnl
1445 # Check for the existence of <math.h> functions used if C99 is enabled.
1447 AC_MSG_CHECKING([for ISO C99 support in <math.h>])
1448 AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no])
1449 AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no])
1450 AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no])
1451 AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no])
1452 AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no])
1453 AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no])
1454 AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no])
1455 AC_TRY_COMPILE([#include <math.h>],
1456 [isgreaterequal(0.0,0.0);],, [ac_c99_math=no])
1457 AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no])
1458 AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no])
1459 AC_TRY_COMPILE([#include <math.h>],
1460 [islessgreater(0.0,0.0);],, [ac_c99_math=no])
1461 AC_TRY_COMPILE([#include <math.h>],
1462 [isunordered(0.0,0.0);],, [ac_c99_math=no])
1463 AC_MSG_RESULT($ac_c99_math)
1465 # Check for the existence in <stdio.h> of vscanf, et. al.
1467 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
1468 AC_TRY_COMPILE([#include <stdio.h>],
1469 [snprintf("12", 0, "%i");],, [ac_c99_stdio=no])
1470 AC_TRY_COMPILE([#include <stdio.h>
1472 void foo(char* fmt, ...)
1473 {va_list args; va_start(args, fmt);
1474 vfscanf(stderr, "%i", args);}],
1475 [],, [ac_c99_stdio=no])
1476 AC_TRY_COMPILE([#include <stdio.h>
1478 void foo(char* fmt, ...)
1479 {va_list args; va_start(args, fmt);
1480 vscanf("%i", args);}],
1481 [],, [ac_c99_stdio=no])
1482 AC_TRY_COMPILE([#include <stdio.h>
1484 void foo(char* fmt, ...)
1485 {va_list args; va_start(args, fmt);
1486 vsnprintf(fmt, 0, "%i", args);}],
1487 [],, [ac_c99_stdio=no])
1488 AC_TRY_COMPILE([#include <stdio.h>
1490 void foo(char* fmt, ...)
1491 {va_list args; va_start(args, fmt);
1492 vsscanf(fmt, "%i", args);}],
1493 [],, [ac_c99_stdio=no])
1494 AC_MSG_RESULT($ac_c99_stdio)
1496 # Check for the existence in <stdlib.h> of lldiv_t, et. al.
1498 AC_MSG_CHECKING([for lldiv_t declaration])
1499 AC_CACHE_VAL(ac_c99_lldiv_t, [
1500 AC_TRY_COMPILE([#include <stdlib.h>],
1502 [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no])
1504 AC_MSG_RESULT($ac_c99_lldiv_t)
1506 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
1507 AC_TRY_COMPILE([#include <stdlib.h>],
1508 [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no])
1509 AC_TRY_COMPILE([#include <stdlib.h>],
1510 [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no])
1511 AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no])
1512 AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no])
1513 AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no])
1514 AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no])
1515 if test x"$ac_c99_lldiv_t" = x"no"; then
1518 AC_MSG_RESULT($ac_c99_stdlib)
1520 # Check for the existence of <wchar.h> functions used if C99 is enabled.
1521 # XXX the wchar.h checks should be rolled into the general C99 bits.
1523 AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>])
1524 AC_TRY_COMPILE([#include <wchar.h>],
1525 [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no])
1526 AC_TRY_COMPILE([#include <wchar.h>],
1527 [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no])
1528 AC_TRY_COMPILE([#include <wchar.h>],
1529 [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no])
1530 AC_MSG_RESULT($ac_c99_wchar)
1532 AC_MSG_CHECKING([for enabled ISO C99 support])
1533 if test x"$ac_c99_math" = x"no" ||
1534 test x"$ac_c99_stdio" = x"no" ||
1535 test x"$ac_c99_stdlib" = x"no" ||
1536 test x"$ac_c99_wchar" = x"no"; then
1539 AC_MSG_RESULT($enable_c99)
1541 # Option parsed, now set things appropriately
1542 if test x"$enable_c99" = x"yes"; then
1543 AC_DEFINE(_GLIBCPP_USE_C99)
1551 dnl Check for template specializations for the 'long long' type extension.
1552 dnl The result determines only whether 'long long' I/O is enabled; things
1553 dnl like numeric_limits<> specializations are always available.
1555 dnl GLIBCPP_ENABLE_LONG_LONG
1556 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1557 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1558 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1559 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1560 dnl defaults to `no'.
1561 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1563 dnl GLIBCPP_ENABLE_LONG_LONG
1564 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1565 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1567 AC_ARG_ENABLE(long-long,
1568 changequote(<<, >>)dnl
1569 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1570 changequote([, ])dnl
1571 [case "$enableval" in
1572 yes) enable_long_long=yes ;;
1573 no) enable_long_long=no ;;
1574 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1576 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1581 AC_MSG_CHECKING([for enabled long long I/O support])
1582 # iostreams require strtoll, strtoull to compile
1583 AC_TRY_COMPILE([#include <stdlib.h>],
1584 [char* tmp; strtoll("gnu", &tmp, 10);],,[enable_long_long=no])
1585 AC_TRY_COMPILE([#include <stdlib.h>],
1586 [char* tmp; strtoull("gnu", &tmp, 10);],,[enable_long_long=no])
1588 # Option parsed, now set things appropriately
1589 if test x"$enable_long_long" = xyes; then
1590 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1592 AC_MSG_RESULT($enable_long_long)
1599 dnl Check for what kind of C headers to use.
1601 dnl GLIBCPP_ENABLE_CHEADERS
1602 dnl --enable-cheaders= [does stuff].
1603 dnl --disable-cheaders [does not do anything, really].
1604 dnl + This will eventually need to be 'c_shadow' by default.
1605 dnl + Usage: GLIBCPP_ENABLE_CHEADERS[(DEFAULT)]
1606 dnl Where DEFAULT is either `c' or `c_std' or 'c_shadow'.
1607 dnl If ommitted, it defaults to `c_std'.
1608 AC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl
1609 define([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl
1610 AC_MSG_CHECKING([for c header strategy to use])
1611 AC_ARG_ENABLE(cheaders,
1612 changequote(<<, >>)dnl
1613 << --enable-cheaders construct "C" header files for g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT],
1615 [case "$enableval" in
1620 enable_cheaders=c_std
1623 enable_cheaders=c_shadow
1625 *) AC_MSG_ERROR([Unknown argument to enable/disable "C" headers])
1628 enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT)
1629 AC_MSG_RESULT($enable_cheaders)
1631 dnl Option parsed, now set things appropriately
1632 case "$enable_cheaders" in
1634 CSHADOW_FLAGS="-fno-builtin"
1635 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_shadow'
1636 AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
1640 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_std'
1644 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c'
1648 AC_SUBST(CSHADOW_FLAGS)
1649 AC_SUBST(C_INCLUDE_DIR)
1650 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cheaders" = c_shadow)
1655 dnl Check for wide character support. Has the same effect as the option
1656 dnl in gcc's configure, but in a form that autoconf can mess with.
1658 dnl GLIBCPP_ENABLE_C_MBCHAR
1659 dnl --enable-c-mbchar requests all the wchar_t stuff.
1660 dnl --disable-c-mbchar doesn't.
1661 dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1662 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1663 dnl defaults to `no'.
1664 AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1665 define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1666 AC_ARG_ENABLE(c-mbchar,
1667 changequote(<<, >>)dnl
1668 << --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1669 changequote([, ])dnl
1670 [case "$enableval" in
1671 yes) enable_c_mbchar=yes ;;
1672 no) enable_c_mbchar=no ;;
1673 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1675 enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1676 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1681 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1683 dnl TOPLEVEL_INCLUDES
1684 dnl LIBMATH_INCLUDES
1685 dnl LIBSUPCXX_INCLUDES
1687 dnl CSHADOW_INCLUDES
1689 dnl GLIBCPP_EXPORT_INCLUDES
1690 AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1691 # Root level of the build directory include sources.
1692 GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include"
1694 # Passed down for canadian crosses.
1695 if test x"$CANADIAN" = xyes; then
1696 TOPLEVEL_INCLUDES='-I$(includedir)'
1699 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1701 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1703 if test x"$need_libio" = xyes; then
1704 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1705 AC_SUBST(LIBIO_INCLUDES)
1708 # Now, export this to all the little Makefiles....
1709 AC_SUBST(GLIBCPP_INCLUDES)
1710 AC_SUBST(TOPLEVEL_INCLUDES)
1711 AC_SUBST(LIBMATH_INCLUDES)
1712 AC_SUBST(LIBSUPCXX_INCLUDES)
1717 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1719 AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1720 # Optimization flags that are probably a good idea for thrill-seekers. Just
1721 # uncomment the lines below and make, everything else is ready to go...
1722 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1724 AC_SUBST(OPTIMIZE_CXXFLAGS)
1726 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1727 AC_SUBST(WARN_FLAGS)
1731 dnl GLIBCPP_EXPORT_INSTALL_INFO
1732 dnl calculates gxx_install_dir
1733 dnl exports glibcpp_toolexecdir
1734 dnl exports glibcpp_toolexeclibdir
1735 dnl exports glibcpp_prefixdir
1737 dnl Assumes cross_compiling bits already done, and with_cross_host in
1740 dnl GLIBCPP_EXPORT_INSTALL_INFO
1741 AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
1742 # Assumes glibcpp_builddir, glibcpp_srcdir are alreay set up and
1743 # exported correctly in GLIBCPP_CONFIGURE.
1744 glibcpp_toolexecdir=no
1745 glibcpp_toolexeclibdir=no
1746 glibcpp_prefixdir=${prefix}
1748 AC_MSG_CHECKING([for interface version number])
1749 libstdcxx_interface=$INTERFACE
1750 AC_MSG_RESULT($libstdcxx_interface)
1752 # Process the option --with-gxx-include-dir=<path to include-files directory>
1753 AC_MSG_CHECKING([for --with-gxx-include-dir])
1754 AC_ARG_WITH(gxx-include-dir,
1755 [ --with-gxx-include-dir the installation directory for include files],
1756 [case "${withval}" in
1758 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
1765 gxx_include_dir=${withval}
1767 esac], [gxx_include_dir=no])
1768 AC_MSG_RESULT($gxx_include_dir)
1770 # Process the option "--enable-version-specific-runtime-libs"
1771 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
1772 AC_ARG_ENABLE(version-specific-runtime-libs,
1773 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
1774 [case "$enableval" in
1775 yes) version_specific_libs=yes ;;
1776 no) version_specific_libs=no ;;
1777 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
1779 version_specific_libs=no)dnl
1780 # Option set, now we can test it.
1781 AC_MSG_RESULT($version_specific_libs)
1783 if test $version_specific_libs = yes; then
1784 # Need the gcc compiler version to know where to install libraries
1785 # and header files if --enable-version-specific-runtime-libs option
1788 gcc_version_trigger=${srcdir}/../gcc/version.c
1789 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'`
1790 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
1791 gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/g++
1792 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1793 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
1797 # Default case for install directory for include files.
1798 if test $version_specific_libs = no &&
1799 test $gxx_include_dir = no; then
1800 gxx_include_dir='$(prefix)'/include/g++-${libstdcxx_interface}
1803 # Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
1804 # Install a library built with a cross compiler in tooldir, not libdir.
1805 if test x"$glibcpp_toolexecdir" = x"no"; then
1806 if test -n "$with_cross_host" &&
1807 test x"$with_cross_host" != x"no"; then
1808 glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
1809 glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)'
1811 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1812 glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)'
1816 AC_MSG_CHECKING([for install location])
1817 AC_MSG_RESULT($gxx_include_dir)
1819 AC_SUBST(glibcpp_prefixdir)
1820 AC_SUBST(gxx_include_dir)
1821 AC_SUBST(glibcpp_toolexecdir)
1822 AC_SUBST(glibcpp_toolexeclibdir)
1826 # Check for functions in math library.
1827 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1829 # This file can be copied and used freely without restrictions. It can
1830 # be used in projects which are not available under the GNU Public License
1831 # but which still want to provide support for the GNU gettext functionality.
1832 # Please note that the actual code is *not* freely available.
1836 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1837 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1838 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1839 AC_SUBST(LIBMATHOBJS)dnl
1844 dnl This macro searches for a GNU version of make. If a match is found, the
1845 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1846 dnl set to "#". This is useful for including a special features in a Makefile,
1847 dnl which cannot be handled by other versions of make. The variable
1848 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1849 dnl the empty string otherwise.
1851 dnl Here is an example of its use:
1853 dnl Makefile.in might contain:
1855 dnl # A failsafe way of putting a dependency rule into a makefile
1857 dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1859 dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1860 dnl @ifGNUmake@ include $(DEPEND)
1861 dnl @ifGNUmake@ endif
1863 dnl Then configure.in would normally contain:
1865 dnl CHECK_GNU_MAKE()
1866 dnl AC_OUTPUT(Makefile)
1868 dnl Then perhaps to cause gnu make to override any other make, we could do
1869 dnl something like this (note that GNU make always looks for GNUmakefile first):
1871 dnl if ! test x$_cv_gnu_make_command = x ; then
1872 dnl mv Makefile GNUmakefile
1873 dnl echo .DEFAULT: > Makefile ;
1874 dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1877 dnl Then, if any (well almost any) other make is called, and GNU make also
1878 dnl exists, then the other make wraps the GNU make.
1880 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1881 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
1883 dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1884 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1885 dnl #### conditional's subshell (" --version" is not a command), using a
1886 dnl #### different option to grep(1).
1888 dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not
1889 dnl #### ${MAKE:-make}).
1892 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1893 _cv_gnu_make_command='' ;
1894 dnl Search all the common names for GNU make
1895 for a in "${MAKE-make}" make gmake gnumake ; do
1896 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
1898 _cv_gnu_make_command=$a ;
1903 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1904 dnl string, '#' otherwise
1905 if test "x$_cv_gnu_make_command" != "x" ; then
1914 dnl Check for headers for, and arguments to, the setrlimit() function.
1915 dnl Used only in testsuite_hooks.h.
1916 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT_ancilliary, [
1917 AC_TRY_COMPILE([#include <sys/resource.h>
1919 ], [ int f = RLIMIT_$1 ; ],
1920 [glibcpp_mresult=1], [glibcpp_mresult=0])
1921 AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcpp_mresult,
1922 [Only used in build directory testsuite_hooks.h.])
1924 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT, [
1925 setrlimit_have_headers=yes
1926 AC_CHECK_HEADERS(sys/resource.h unistd.h,
1928 setrlimit_have_headers=no)
1929 # If don't have the headers, then we can't run the tests now, and we
1930 # won't be seeing any of these during testsuite compilation.
1931 if test $setrlimit_have_headers = yes; then
1932 # Can't do these in a loop, else the resulting syntax is wrong.
1933 GLIBCPP_CHECK_SETRLIMIT_ancilliary(DATA)
1934 GLIBCPP_CHECK_SETRLIMIT_ancilliary(RSS)
1935 GLIBCPP_CHECK_SETRLIMIT_ancilliary(VMEM)
1936 GLIBCPP_CHECK_SETRLIMIT_ancilliary(AS)
1938 # Check for rlimit, setrlimit.
1939 AC_CACHE_VAL(ac_setrlimit, [
1940 AC_TRY_COMPILE([#include <sys/resource.h>
1943 [ struct rlimit r; setrlimit(0, &r);],
1944 [ac_setrlimit=yes], [ac_setrlimit=no])
1948 AC_MSG_CHECKING([for testsuite memory limit support])
1949 if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then
1951 AC_DEFINE(_GLIBCPP_MEM_LIMITS)
1955 AC_MSG_RESULT($ac_mem_limits)
1960 dnl Does any necessary configuration of the testsuite directory. Generates
1961 dnl the testsuite_hooks.h header.
1963 dnl GLIBCPP_CONFIGURE_TESTSUITE [no args]
1964 AC_DEFUN(GLIBCPP_CONFIGURE_TESTSUITE, [
1965 GLIBCPP_CHECK_SETRLIMIT
1967 # Look for setenv, so that extended locale tests can be performed.
1968 AC_CHECK_FUNCS(setenv)
1972 sinclude(../libtool.m4)
1973 dnl The lines below arrange for aclocal not to bring an installed
1974 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1975 dnl add a definition of LIBTOOL to Makefile.in.
1976 ifelse(,,,[AC_SUBST(LIBTOOL)
1977 AC_DEFUN([AM_PROG_LIBTOOL])
1978 AC_DEFUN([AC_LIBTOOL_DLOPEN])
1979 AC_DEFUN([AC_PROG_LD])
1983 # Check whether LC_MESSAGES is available in <locale.h>.
1984 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1986 # This file file be copied and used freely without restrictions. It can
1987 # be used in projects which are not available under the GNU Public License
1988 # but which still want to provide support for the GNU gettext functionality.
1989 # Please note that the actual code is *not* freely available.
1993 AC_DEFUN(AC_LC_MESSAGES, [
1994 AC_CHECK_HEADER(locale.h, [
1995 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1996 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1997 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1998 if test $ac_cv_val_LC_MESSAGES = yes; then
1999 AC_DEFINE(HAVE_LC_MESSAGES)
2006 dnl Check for whether the Boost-derived checks should be turned on.
2008 dnl GLIBCPP_ENABLE_CONCEPT_CHECKS
2009 dnl --enable-concept-checks turns them on.
2010 dnl --disable-concept-checks leaves them off.
2011 dnl + Usage: GLIBCPP_ENABLE_CONCEPT_CHECKS[(DEFAULT)]
2012 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
2013 dnl defaults to `no'.
2014 AC_DEFUN(GLIBCPP_ENABLE_CONCEPT_CHECKS, [dnl
2015 define([GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT], ifelse($1, yes, yes, no))dnl
2016 AC_ARG_ENABLE(concept-checks,
2017 changequote(<<, >>)dnl
2018 << --enable-concept-checks use Boost-derived template checks [default=>>GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT],
2019 changequote([, ])dnl
2020 [case "$enableval" in
2021 yes) enable_concept_checks=yes ;;
2022 no) enable_concept_checks=no ;;
2023 *) AC_MSG_ERROR([Unknown argument to enable/disable concept checks]) ;;
2025 enable_concept_checks=GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT)dnl
2026 dnl Option parsed, now set things appropriately
2027 if test x"$enable_concept_checks" = xyes; then
2028 AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS)
2034 dnl Add version tags to symbols in shared library (or not), additionally
2035 dnl marking other symbols as private/local (or not).
2037 dnl GLIBCPP_ENABLE_SYMVERS
2038 dnl --enable-symvers=style adds a version script to the linker call when
2039 dnl creating the shared library. The choice of version script is
2040 dnl controlled by 'style'.
2041 dnl --disable-symvers does not.
2042 dnl + Usage: GLIBCPP_ENABLE_SYMVERS[(DEFAULT)]
2043 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
2044 dnl defaults to `no'. Passing `yes' tries to choose a default style
2045 dnl based on linker characteristics. Passing 'no' disables versioning.
2046 AC_DEFUN(GLIBCPP_ENABLE_SYMVERS, [dnl
2047 define([GLIBCPP_ENABLE_SYMVERS_DEFAULT], ifelse($1, yes, yes, no))dnl
2048 AC_ARG_ENABLE(symvers,
2049 changequote(<<, >>)dnl
2050 << --enable-symvers=style enables symbol versioning of the shared library [default=>>GLIBCPP_ENABLE_SYMVERS_DEFAULT],
2051 changequote([, ])dnl
2052 [case "$enableval" in
2053 yes) enable_symvers=yes ;;
2054 no) enable_symvers=no ;;
2055 # other names here, just as sanity checks
2056 #gnu|sun|etcetera) enable_symvers=$enableval ;;
2057 gnu) enable_symvers=$enableval ;;
2058 *) AC_MSG_ERROR([Unknown argument to enable/disable symvers]) ;;
2060 enable_symvers=GLIBCPP_ENABLE_SYMVERS_DEFAULT)dnl
2062 # If we never went through the GLIBCPP_CHECK_LINKER_FEATURES macro, then we
2063 # don't know enough about $LD to do tricks...
2064 if test x$enable_shared = xno ||
2066 test x$glibcpp_gnu_ld_version = x; then
2070 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
2071 AC_MSG_CHECKING([for shared libgcc])
2072 ac_save_CFLAGS="$CFLAGS"
2074 AC_TRY_LINK( , [return 0], glibcpp_shared_libgcc=yes, glibcpp_shared_libgcc=no)
2075 CFLAGS="$ac_save_CFLAGS"
2076 AC_MSG_RESULT($glibcpp_shared_libgcc)
2078 # For GNU ld, we need at least this version. It's 2.12 in the same format
2079 # as the tested-for version. See GLIBCPP_CHECK_LINKER_FEATURES for more.
2080 glibcpp_min_gnu_ld_version=21200
2082 # Check to see if unspecified "yes" value can win, given results
2084 if test $enable_symvers = yes ; then
2085 if test $with_gnu_ld = yes &&
2086 test $glibcpp_shared_libgcc = yes ;
2088 if test $glibcpp_gnu_ld_version -ge $glibcpp_min_gnu_ld_version ; then
2091 ac_test_CFLAGS="${CFLAGS+set}"
2092 ac_save_CFLAGS="$CFLAGS"
2093 CFLAGS='-shared -Wl,--version-script,conftest.map'
2096 echo 'FOO { global: f[a-z]o; local: *; };' > conftest.map
2098 AC_TRY_LINK([int foo;],, enable_symvers=gnu)
2099 if test "$ac_test_CFLAGS" = set; then
2100 CFLAGS="$ac_save_CFLAGS"
2102 # this is the suspicious part
2113 dnl Everything parsed; figure out what file to use.
2114 case $enable_symvers in
2116 LINKER_MAP=config/linker-map.dummy
2119 LINKER_MAP=config/linker-map.gnu
2123 AC_LINK_FILES($LINKER_MAP, src/linker.map)
2124 AM_CONDITIONAL(GLIBCPP_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
2125 AC_MSG_CHECKING([versioning on shared library symbols])
2126 AC_MSG_RESULT($enable_symvers)