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" &&
360 test x"$enable_debug" = x"no"; then
361 OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
364 AC_SUBST(SECTION_LDFLAGS)
365 AC_SUBST(OPT_LDFLAGS)
370 dnl Check to see if the (math function) argument passed is
371 dnl declared when using the c++ compiler
372 dnl ASSUMES argument is a math function with ONE parameter
374 dnl GLIBCPP_CHECK_MATH_DECL_1
375 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [
376 AC_MSG_CHECKING([for $1 declaration])
377 if test x${glibcpp_cv_func_$1_use+set} != xset; then
378 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
381 AC_TRY_COMPILE([#include <math.h>
387 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
391 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
395 dnl Check to see if the (math function) argument passed is
396 dnl 1) declared when using the c++ compiler
397 dnl 2) has "C" linkage
398 dnl 3) if not, see if 1) and 2) for argument prepended with '_'
400 dnl Define HAVE_CARGF etc if "cargf" is declared and links
402 dnl argument 1 is name of function to check
404 dnl ASSUMES argument is a math function with ONE parameter
406 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
407 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
408 GLIBCPP_CHECK_MATH_DECL_1($1)
409 if test x$glibcpp_cv_func_$1_use = x"yes"; then
412 GLIBCPP_CHECK_MATH_DECL_1(_$1)
413 if test x$glibcpp_cv_func__$1_use = x"yes"; then
421 dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
422 dnl of functions at once. It's an all-or-nothing check -- either
423 dnl HAVE_XYZ is defined for each of the functions, or for none of them.
424 dnl Doing it this way saves significant configure time.
425 AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [
426 AC_MSG_CHECKING([for $1 functions])
427 AC_CACHE_VAL(glibcpp_cv_func_$2_use, [
430 AC_TRY_COMPILE([#include <math.h>],
431 [ `for x in $3; do echo "$x (0);"; done` ],
432 [glibcpp_cv_func_$2_use=yes],
433 [glibcpp_cv_func_$2_use=no])
435 AC_MSG_RESULT($glibcpp_cv_func_$2_use)
436 if test x$glibcpp_cv_func_$2_use = x"yes"; then
442 dnl Check to see if the (math function) argument passed is
443 dnl declared when using the c++ compiler
444 dnl ASSUMES argument is a math function with TWO parameters
446 dnl GLIBCPP_CHECK_MATH_DECL_2
447 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [
448 AC_MSG_CHECKING([for $1 declaration])
449 if test x${glibcpp_cv_func_$1_use+set} != xset; then
450 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
453 AC_TRY_COMPILE([#include <math.h>],
455 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
459 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
463 dnl Check to see if the (math function) argument passed is
464 dnl 1) declared when using the c++ compiler
465 dnl 2) has "C" linkage
467 dnl Define HAVE_CARGF etc if "cargf" is declared and links
469 dnl argument 1 is name of function to check
471 dnl ASSUMES argument is a math function with TWO parameters
473 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
474 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
475 GLIBCPP_CHECK_MATH_DECL_2($1)
476 if test x$glibcpp_cv_func_$1_use = x"yes"; then
479 GLIBCPP_CHECK_MATH_DECL_2(_$1)
480 if test x$glibcpp_cv_func__$1_use = x"yes"; then
488 dnl Check to see if the (math function) argument passed is
489 dnl declared when using the c++ compiler
490 dnl ASSUMES argument is a math function with THREE parameters
492 dnl GLIBCPP_CHECK_MATH_DECL_3
493 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [
494 AC_MSG_CHECKING([for $1 declaration])
495 if test x${glibcpp_cv_func_$1_use+set} != xset; then
496 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
499 AC_TRY_COMPILE([#include <math.h>],
501 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
505 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
509 dnl Check to see if the (math function) argument passed is
510 dnl 1) declared when using the c++ compiler
511 dnl 2) has "C" linkage
513 dnl Define HAVE_CARGF etc if "cargf" is declared and links
515 dnl argument 1 is name of function to check
517 dnl ASSUMES argument is a math function with THREE parameters
519 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
520 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
521 GLIBCPP_CHECK_MATH_DECL_3($1)
522 if test x$glibcpp_cv_func_$1_use = x"yes"; then
525 GLIBCPP_CHECK_MATH_DECL_3(_$1)
526 if test x$glibcpp_cv_func__$1_use = x"yes"; then
534 dnl Check to see if the (stdlib function) argument passed is
535 dnl 1) declared when using the c++ compiler
536 dnl 2) has "C" linkage
538 dnl argument 1 is name of function to check
540 dnl ASSUMES argument is a math function with TWO parameters
542 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
543 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
544 AC_MSG_CHECKING([for $1 declaration])
545 if test x${glibcpp_cv_func_$1_use+set} != xset; then
546 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
549 AC_TRY_COMPILE([#include <stdlib.h>],
551 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
555 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
556 if test x$glibcpp_cv_func_$1_use = x"yes"; then
563 dnl Because the builtins are picky picky picky about the arguments they take,
564 dnl do an explict linkage tests here.
565 dnl Check to see if the (math function) argument passed is
566 dnl 1) declared when using the c++ compiler
567 dnl 2) has "C" linkage
569 dnl Define HAVE_CARGF etc if "cargf" is declared and links
571 dnl argument 1 is name of function to check
573 dnl ASSUMES argument is a math function with ONE parameter
575 dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
576 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
577 AC_MSG_CHECKING([for $1 declaration])
578 if test x${glibcpp_cv_func_$1_use+set} != xset; then
579 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
582 AC_TRY_COMPILE([#include <math.h>],
584 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
588 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
589 if test x$glibcpp_cv_func_$1_use = x"yes"; then
590 AC_MSG_CHECKING([for $1 linkage])
591 if test x${glibcpp_cv_func_$1_link+set} != xset; then
592 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
593 AC_TRY_LINK([#include <math.h>],
595 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
598 AC_MSG_RESULT($glibcpp_cv_func_$1_link)
599 if test x$glibcpp_cv_func_$1_link = x"yes"; then
600 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
601 AC_DEFINE_UNQUOTED(${ac_tr_func})
608 dnl Check to see what builtin math functions are supported
610 dnl check for __builtin_abs
611 dnl check for __builtin_fabsf
612 dnl check for __builtin_fabs
613 dnl check for __builtin_fabl
614 dnl check for __builtin_labs
615 dnl check for __builtin_sqrtf
616 dnl check for __builtin_sqrtl
617 dnl check for __builtin_sqrt
618 dnl check for __builtin_sinf
619 dnl check for __builtin_sin
620 dnl check for __builtin_sinl
621 dnl check for __builtin_cosf
622 dnl check for __builtin_cos
623 dnl check for __builtin_cosl
625 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
626 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
627 dnl Test for builtin math functions.
628 dnl These are made in gcc/c-common.c
629 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
630 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
631 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
632 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
633 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
635 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
636 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrt)
637 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
639 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
640 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
641 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
643 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
644 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
645 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
647 dnl There is, without a doubt, a more elegant way to have these
648 dnl names exported so that they won't be stripped out of acconfig.h by
649 dnl autoheader. I leave this as an exercise to somebody less frustrated
650 dnl than I.... please email the libstdc++ list if you can figure out a
651 dnl more elegant approach (see autoconf/acgen.m4 and specifically
652 dnl AC_CHECK_FUNC for things to steal.)
654 if test x$dummyvar = x"yes"; then
655 AC_DEFINE(HAVE___BUILTIN_ABS)
656 AC_DEFINE(HAVE___BUILTIN_LABS)
657 AC_DEFINE(HAVE___BUILTIN_COS)
658 AC_DEFINE(HAVE___BUILTIN_COSF)
659 AC_DEFINE(HAVE___BUILTIN_COSL)
660 AC_DEFINE(HAVE___BUILTIN_FABS)
661 AC_DEFINE(HAVE___BUILTIN_FABSF)
662 AC_DEFINE(HAVE___BUILTIN_FABSL)
663 AC_DEFINE(HAVE___BUILTIN_SIN)
664 AC_DEFINE(HAVE___BUILTIN_SINF)
665 AC_DEFINE(HAVE___BUILTIN_SINL)
666 AC_DEFINE(HAVE___BUILTIN_SQRT)
667 AC_DEFINE(HAVE___BUILTIN_SQRTF)
668 AC_DEFINE(HAVE___BUILTIN_SQRTL)
674 dnl Check to see what the underlying c library
675 dnl These checks need to do two things:
676 dnl 1) make sure the name is declared when using the c++ compiler
677 dnl 2) make sure the name has "C" linkage
678 dnl This might seem like overkill but experience has shown that it's not...
680 dnl Define HAVE_STRTOLD if "strtold" is declared and links
681 dnl Define HAVE_STRTOF if "strtof" is declared and links
682 dnl Define HAVE_DRAND48 if "drand48" is declared and links
684 dnl GLIBCPP_CHECK_STDLIB_SUPPORT
685 AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
686 ac_test_CXXFLAGS="${CXXFLAGS+set}"
687 ac_save_CXXFLAGS="$CXXFLAGS"
688 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
690 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
691 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof)
692 AC_CHECK_FUNCS(drand48)
694 CXXFLAGS="$ac_save_CXXFLAGS"
699 dnl Check to see what the underlying c library or math library is like.
700 dnl These checks need to do two things:
701 dnl 1) make sure the name is declared when using the c++ compiler
702 dnl 2) make sure the name has "C" linkage
703 dnl This might seem like overkill but experience has shown that it's not...
705 dnl Define HAVE_CARGF etc if "cargf" is found.
707 dnl GLIBCPP_CHECK_MATH_SUPPORT
708 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
709 ac_test_CXXFLAGS="${CXXFLAGS+set}"
710 ac_save_CXXFLAGS="$CXXFLAGS"
711 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
714 AC_CHECK_LIB(m, sin, libm="-lm")
718 dnl Check to see if certain C math functions exist.
719 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
720 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
721 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
722 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
723 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
724 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
725 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
726 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypot)
728 dnl Check to see if basic C math functions have float versions.
729 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig,
734 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
737 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
738 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
739 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
740 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
741 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
742 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
743 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf)
744 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
745 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
746 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
747 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
748 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
749 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
750 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
751 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
753 dnl Check to see if basic C math functions have long double versions.
754 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig,
759 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round,
762 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
763 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
764 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
765 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
766 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
767 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
768 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
769 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
770 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl)
771 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
772 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
773 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
774 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
775 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
776 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
777 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
778 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
780 dnl Some runtimes have these functions with a preceding underscore. Please
781 dnl keep this sync'd with the one above. And if you add any new symbol,
782 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
783 dnl Check to see if certain C math functions exist.
785 dnl Check to see if basic C math functions have float versions.
786 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
788 _acosf _asinf _atanf \
790 _coshf _sinhf _tanhf)
791 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
795 dnl Check to see if basic C math functions have long double versions.
796 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
798 _acosl _asinl _atanl \
800 _coshl _sinhl _tanhl)
801 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
806 CXXFLAGS="$ac_save_CXXFLAGS"
811 dnl Check to see if there is native support for complex
813 dnl Don't compile bits in math/* if native support exits.
815 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "copysignl" is found.
817 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
818 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
819 dnl Check for complex versions of math functions of platform.
820 AC_CHECK_LIB(m, main)
821 AC_REPLACE_MATHFUNCS(nan copysignf)
823 dnl Compile the long double complex functions only if the function
824 dnl provides the non-complex long double functions that are needed.
825 dnl Currently this includes copysignl, which should be
826 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
827 USE_COMPLEX_LONG_DOUBLE=no
828 if test x$ac_cv_func_copysignl = x"yes"; then
829 USE_COMPLEX_LONG_DOUBLE=yes
830 AC_REPLACE_MATHFUNCS(signbitl)
833 AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
837 dnl Check to see what architecture and operating system we are compiling
838 dnl for. Also, if architecture- or OS-specific flags are required for
839 dnl compilation, pick them up here.
841 dnl GLIBCPP_CHECK_TARGET
842 AC_DEFUN(GLIBCPP_CHECK_TARGET, [
843 . [$]{glibcpp_basedir}/configure.target
844 AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
845 AC_MSG_RESULT(OS config directory is $os_include_dir)
850 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
851 dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
852 dnl must have been previously checked.)
854 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
855 dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h
857 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
858 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
860 dnl Test wchar.h for mbstate_t, which is needed for char_traits and
861 dnl others even if wchar_t support is not on.
862 AC_MSG_CHECKING([for mbstate_t])
863 AC_TRY_COMPILE([#include <wchar.h>],
864 [mbstate_t teststate;],
865 have_mbstate_t=yes, have_mbstate_t=no)
866 AC_MSG_RESULT($have_mbstate_t)
867 if test x"$have_mbstate_t" = xyes; then
868 AC_DEFINE(HAVE_MBSTATE_T)
871 dnl Sanity check for existence of ISO C99 headers for extended encoding.
872 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
873 AC_CHECK_HEADER(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
875 dnl Only continue checking if the ISO C99 headers exist and support is on.
876 if test x"$ac_has_wchar_h" = xyes &&
877 test x"$ac_has_wctype_h" = xyes &&
878 test x"$enable_c_mbchar" != xno; then
880 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
881 dnl numeric_limits can instantiate type_traits<wchar_t>
882 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
883 AC_TRY_COMPILE([#include <wchar.h>],
884 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
885 has_wchar_minmax=yes, has_wchar_minmax=no)
886 AC_MSG_RESULT($has_wchar_minmax)
888 dnl Test wchar.h for WEOF, which is what we use to determine whether
889 dnl to specialize for char_traits<wchar_t> or not.
890 AC_MSG_CHECKING([for WEOF])
893 #include <stddef.h>],
895 has_weof=yes, has_weof=no)
896 AC_MSG_RESULT($has_weof)
898 dnl Tests for wide character functions used in char_traits<wchar_t>.
900 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset,, \
903 dnl Checks for names injected into std:: by the c_std headers.
904 AC_CHECK_FUNCS(btowc wctob fgetwc fgetwc fgetws fputwc fputws fwide \
905 fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
906 vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
907 mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
908 wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
909 wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \
912 AC_MSG_CHECKING([for ISO C99 wchar_t support])
913 if test x"$has_weof" = xyes &&
914 test x"$has_wchar_minmax" = xyes &&
915 test x"$ac_wfuncs" = xyes; then
916 ac_isoC99_wchar_t=yes
920 AC_MSG_RESULT($ac_isoC99_wchar_t)
922 dnl Use iconv for wchar_t to char conversions. As such, check for
923 dnl X/Open Portability Guide, version 2 features (XPG2).
924 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
925 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
927 dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
928 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
930 LIBS="$LIBS $libiconv"
932 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
933 ac_XPG2funcs=yes, ac_XPG2funcs=no)
937 AC_MSG_CHECKING([for XPG2 wchar_t support])
938 if test x"$ac_has_iconv_h" = xyes &&
939 test x"$ac_has_langinfo_h" = xyes &&
940 test x"$ac_XPG2funcs" = xyes; then
945 AC_MSG_RESULT($ac_XPG2_wchar_t)
947 dnl At the moment, only enable wchar_t specializations if all the
948 dnl above support is present.
949 AC_MSG_CHECKING([for enabled wchar_t specializations])
950 if test x"$ac_isoC99_wchar_t" = xyes &&
951 test x"$ac_XPG2_wchar_t" = xyes; then
952 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
958 dnl Wide characters disabled by the user.
959 AC_MSG_WARN([wchar_t support disabled.])
965 dnl Check for special debugging mode; not for production use.
967 dnl GLIBCPP_ENABLE_DEBUG
968 dnl --enable-debug sets '-ggdb3 -O0'.
969 dnl --disable-debug sets '-g' and whatever optimization options the
970 dnl compiler can handle.
971 dnl + --enable-maintainer-mode automatically defaults this to on.
972 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
973 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
974 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
975 dnl defaults to `no'.
976 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
977 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
979 changequote(<<, >>)dnl
980 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
982 [case "${enableval}" in
983 yes) enable_debug=yes ;;
984 no) enable_debug=no ;;
985 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
987 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
989 dnl Option parsed, now set things appropriately
990 case "${enable_debug}" in
992 DEBUG_FLAGS='-O0 -ggdb3'
998 AC_SUBST(DEBUG_FLAGS)
1003 dnl Check for "unusual" flags to pass to the compiler while building.
1005 dnl GLIBCPP_ENABLE_CXX_FLAGS
1006 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1007 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1008 dnl Somehow this same set of flags must be passed when [re]building
1010 dnl --disable-cxx-flags passes nothing.
1011 dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
1012 dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
1013 dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
1014 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
1015 dnl If "default flags" is an empty string (or "none"), the effect is
1016 dnl the same as --disable or --enable=no.
1017 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1018 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1019 AC_ARG_ENABLE(cxx-flags,
1020 changequote(<<, >>)dnl
1021 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
1022 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1023 changequote([, ])dnl
1024 [case "x$enableval" in
1026 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1028 enable_cxx_flags='' ;;
1030 enable_cxx_flags="$enableval" ;;
1032 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
1034 dnl Thinko on my part during design. This kludge is the workaround.
1035 if test "$enable_cxx_flags" = "none"; then
1036 enable_cxx_flags='';
1039 dnl Run through flags (either default or command-line) and set anything
1040 dnl extra (e.g., #defines) that must accompany particular g++ options.
1041 if test -n "$enable_cxx_flags"; then
1042 for f in $enable_cxx_flags; do
1046 *) # and we're trying to pass /what/ exactly?
1047 AC_MSG_ERROR([compiler flags start with a -]) ;;
1051 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1052 AC_SUBST(EXTRA_CXX_FLAGS)
1057 dnl Check for which locale library to use: gnu or generic.
1059 dnl GLIBCPP_ENABLE_CLOCALE
1060 dnl --enable-clocale=gnu sets config/locale/c_locale_gnu.cc and friends
1061 dnl --enable-clocale=generic sets config/locale/c_locale_generic.cc and friends
1063 dnl default is generic
1065 AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
1066 AC_MSG_CHECKING([for clocale to use])
1067 AC_ARG_ENABLE(clocale,
1068 [ --enable-clocale enable model for target locale package.
1069 --enable-clocale=MODEL use MODEL target-speific locale package. [default=generic]
1071 if test x$enable_clocale = xno; then
1076 enable_clocale_flag=$enable_clocale
1078 dnl Probe for locale support if no specific model is specified.
1079 dnl Default to "generic"
1080 if test x$enable_clocale_flag = xno; then
1081 case x${target_os} in
1083 AC_EGREP_CPP([_GLIBCPP_ok], [
1084 #include <features.h>
1085 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1088 ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
1090 # Test for bugs early in glibc-2.2.x series
1091 if test x$enable_clocale_flag = xgnu; then
1093 #define _GNU_SOURCE 1
1097 const char __one[] = "Äuglein Augmen";
1098 const char __two[] = "Äuglein";
1103 loc = __newlocale(1 << LC_ALL, "de_DE", 0);
1104 loc_dup = __duplocale(loc);
1105 i = __strcoll_l(__one, __two, loc);
1106 j = __strcoll_l(__one, __two, loc_dup);
1110 [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
1111 [enable_clocale_flag=generic])
1114 # ... at some point put __strxfrm_l tests in as well.
1117 enable_clocale_flag=generic
1122 dnl Set configure bits for specified locale package
1123 case x${enable_clocale_flag} in
1125 AC_MSG_RESULT(generic)
1127 # Don't use gettext.
1130 CLOCALE_H=config/locale/c_locale_generic.h
1131 CLOCALE_CC=config/locale/c_locale_generic.cc
1132 CCODECVT_H=config/locale/codecvt_specializations_generic.h
1133 CCOLLATE_CC=config/locale/collate_members_generic.cc
1134 CCTYPE_CC=config/locale/ctype_members_generic.cc
1135 CMESSAGES_H=config/locale/messages_members_generic.h
1136 CMESSAGES_CC=config/locale/messages_members_generic.cc
1137 CMONEY_CC=config/locale/moneypunct_members_generic.cc
1138 CNUMERIC_CC=config/locale/numpunct_members_generic.cc
1139 CTIME_CC=config/locale/time_members_generic.cc
1144 # Declare intention to use gettext, and add support for specific
1146 # For some reason, ALL_LINGUAS has to be before AM_GNU_GETTEXT
1148 # Don't call AM_GNU_GETTEXT here. Instead, assume glibc.
1149 # Need to deal with MSGFMT, USE_NLS, and glibcpp_[P,M]OFILES
1152 # Export the build objects.
1153 for ling in $ALL_LINGUAS; do \
1154 glibcpp_MOFILES="$glibcpp_MOFILES $ling.mo"; \
1155 glibcpp_POFILES="$glibcpp_POFILES $ling.po"; \
1157 AC_SUBST(glibcpp_MOFILES)
1158 AC_SUBST(glibcpp_POFILES)
1160 CLOCALE_H=config/locale/c_locale_gnu.h
1161 CLOCALE_CC=config/locale/c_locale_gnu.cc
1162 CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
1163 CCOLLATE_CC=config/locale/collate_members_gnu.cc
1164 CCTYPE_CC=config/locale/ctype_members_gnu.cc
1165 CMESSAGES_H=config/locale/messages_members_gnu.h
1166 CMESSAGES_CC=config/locale/messages_members_gnu.cc
1167 CMONEY_CC=config/locale/moneypunct_members_gnu.cc
1168 CNUMERIC_CC=config/locale/numpunct_members_gnu.cc
1169 CTIME_CC=config/locale/time_members_gnu.cc
1172 AC_MSG_RESULT(generic)
1174 # Don't use gettext.
1177 CLOCALE_H=config/locale/c_locale_ieee_1003.1-200x.h
1178 CLOCALE_CC=config/locale/c_locale_ieee_1003.1-200x.cc
1179 CCODECVT_H=config/locale/codecvt_specializations_ieee_1003.1-200x.h
1180 CCOLLATE_CC=config/locale/collate_members_generic.cc
1181 CCTYPE_CC=config/locale/ctype_members_generic.cc
1182 CMESSAGES_H=config/locale/messages_members_ieee_1003.1-200x.h
1183 CMESSAGES_CC=config/locale/messages_members_ieee_1003.1-200x.cc
1184 CMONEY_CC=config/locale/moneypunct_members_generic.cc
1185 CNUMERIC_CC=config/locale/numpunct_members_generic.cc
1186 CTIME_CC=config/locale/time_members_generic.cc
1189 echo "$enable_clocale is an unknown locale package" 1>&2
1194 # This is where the testsuite looks for locale catalogs, using the
1195 # -DLOCALEDIR define during testsuite compilation.
1196 glibcpp_localedir=${glibcpp_builddir}/po/share/locale
1197 AC_SUBST(glibcpp_localedir)
1201 AC_SUBST(CCODECVT_H)
1202 AC_SUBST(CMESSAGES_H)
1203 AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
1204 AC_LINK_FILES($CCOLLATE_CC, src/collate.cc)
1205 AC_LINK_FILES($CCTYPE_CC, src/ctype.cc)
1206 AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
1207 AC_LINK_FILES($CMONEY_CC, src/moneypunct.cc)
1208 AC_LINK_FILES($CNUMERIC_CC, src/numpunct.cc)
1209 AC_LINK_FILES($CTIME_CC, src/time.cc)
1214 dnl Check for which I/O library to use: libio, or something specific.
1216 dnl GLIBCPP_ENABLE_CSTDIO
1217 dnl --enable-cstdio=libio sets config/io/c_io_libio.h and friends
1219 dnl default is stdio
1221 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1222 AC_MSG_CHECKING([for cstdio to use])
1223 AC_ARG_ENABLE(cstdio,
1224 [ --enable-cstdio enable stdio for target io package.
1225 --enable-cstdio=LIB use LIB target-speific io package. [default=stdio]
1227 if test x$enable_cstdio = xno; then
1230 enable_cstdio=stdio)
1232 enable_cstdio_flag=$enable_cstdio
1234 dnl Check if a valid I/O package
1235 case x${enable_cstdio_flag} in
1237 CSTDIO_H=config/io/c_io_libio.h
1238 BASIC_FILE_H=config/io/basic_file_libio.h
1239 BASIC_FILE_CC=config/io/basic_file_libio.cc
1240 AC_MSG_RESULT(libio)
1242 # see if we are on a system with libio native (ie, linux)
1243 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1245 # Need to check and see what version of glibc is being used. If
1246 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1247 # compile most of libio for linux systems.
1248 if test x$has_libio = x"yes"; then
1251 AC_MSG_CHECKING([for glibc version >= 2.2])
1252 AC_EGREP_CPP([ok], [
1253 #include <features.h>
1254 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1257 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1258 AC_MSG_RESULT($glibc_satisfactory)
1262 # XXX at the moment, admit defeat and force the recompilation
1263 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
1264 glibc_satisfactory=no
1266 if test x$glibc_satisfactory = x"yes"; then
1271 # bkoz XXX need to add checks to enable this
1272 # pme XXX here's a first pass at such a check
1273 if test x$enable_c_mbchar != xno; then
1281 # Using libio, but <libio.h> doesn't exist on the target system. . .
1283 # bkoz XXX need to add checks to enable this
1284 # pme XXX here's a first pass at such a check
1285 if test x$enable_c_mbchar != xno; then
1292 xstdio | x | xno | xnone | xyes)
1294 CSTDIO_H=config/io/c_io_stdio.h
1295 BASIC_FILE_H=config/io/basic_file_stdio.h
1296 BASIC_FILE_CC=config/io/basic_file_stdio.cc
1297 AC_MSG_RESULT(stdio)
1299 # We're not using stdio.
1304 echo "$enable_cstdio is an unknown io package" 1>&2
1309 AC_SUBST(BASIC_FILE_H)
1310 AC_LINK_FILES($BASIC_FILE_CC, src/basic_file.cc)
1312 # 2000-08-04 bkoz hack
1313 CCODECVT_C=config/io/c_io_libio_codecvt.c
1314 AC_SUBST(CCODECVT_C)
1315 # 2000-08-04 bkoz hack
1317 AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO,
1318 test "$need_libio" = yes || test "$need_wlibio" = yes)
1319 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1320 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1321 if test "$need_libio" = yes || test "$need_wlibio" = yes; then
1322 libio_la=../libio/libio.la
1331 dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
1332 dnl We must stage the required headers so that they will be installed
1333 dnl with the library (unlike libgcc, the STL implementation is provided
1334 dnl solely within headers). Since we must not inject random user-space
1335 dnl macro names into user-provided C++ code, we first stage into <file>-in
1336 dnl and process to <file> with an output command. The reason for a two-
1337 dnl stage process here is to correctly handle $srcdir!=$objdir without
1338 dnl having to write complex code (the sed commands to clean the macro
1339 dnl namespace are complex and fragile enough as it is). We must also
1340 dnl add a relative path so that -I- is supported properly.
1342 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1343 AC_MSG_CHECKING([for thread model used by GCC])
1344 target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
1345 AC_MSG_RESULT([$target_thread_file])
1347 if test $target_thread_file != single; then
1348 AC_DEFINE(HAVE_GTHR_DEFAULT)
1349 AC_DEFINE(_GLIBCPP_SUPPORTS_WEAK, __GXX_WEAK__)
1352 glibcpp_thread_h=gthr-$target_thread_file.h
1353 AC_SUBST(glibcpp_thread_h)
1358 dnl Check for exception handling support. If an explicit enable/disable
1359 dnl sjlj exceptions is given, we don't have to detect. Otherwise the
1360 dnl target may or may not support call frame exceptions.
1362 dnl GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
1363 dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
1364 dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1366 dnl Define _GLIBCPP_SJLJ_EXCEPTIONS if the compiler is configured for it.
1368 AC_DEFUN(GLIBCPP_ENABLE_SJLJ_EXCEPTIONS, [
1369 AC_MSG_CHECKING([for exception model to use])
1372 AC_ARG_ENABLE(sjlj-exceptions,
1373 [ --enable-sjlj-exceptions force use of builtin_setjmp for exceptions],
1375 [dnl Botheration. Now we've got to detect the exception model.
1376 dnl Link tests against libgcc.a are problematic since -- at least
1377 dnl as of this writing -- we've not been given proper -L bits for
1378 dnl single-tree newlib and libgloss.
1380 dnl This is what AC_TRY_COMPILE would do if it didn't delete the
1381 dnl conftest files before we got a change to grep them first.
1382 cat > conftest.$ac_ext << EOF
1383 [#]line __oline__ "configure"
1392 old_CXXFLAGS="$CXXFLAGS"
1394 if AC_TRY_EVAL(ac_compile); then
1395 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
1396 enable_sjlj_exceptions=yes
1397 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
1398 enable_sjlj_exceptions=no
1401 CXXFLAGS="$old_CXXFLAGS"
1403 if test x$enable_sjlj_exceptions = xyes; then
1404 AC_DEFINE(_GLIBCPP_SJLJ_EXCEPTIONS, 1,
1405 [Define if the compiler is configured for setjmp/longjmp exceptions.])
1406 ac_exception_model_name=sjlj
1407 elif test x$enable_sjlj_exceptions = xno; then
1408 ac_exception_model_name="call frame"
1410 AC_MSG_ERROR([unable to detect exception model])
1413 AC_MSG_RESULT($ac_exception_model_name)
1418 dnl Check for ISO/IEC 9899:1999 "C99" support.
1420 dnl GLIBCPP_ENABLE_C99
1421 dnl --enable-c99 defines _GLIBCPP_USE_C99
1422 dnl --disable-c99 leaves _GLIBCPP_USE_C99 undefined
1423 dnl + Usage: GLIBCPP_ENABLE_C99[(DEFAULT)]
1424 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1425 dnl defaults to `no'.
1426 dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
1428 dnl GLIBCPP_ENABLE_C99
1429 AC_DEFUN(GLIBCPP_ENABLE_C99, [dnl
1430 define([GLIBCPP_ENABLE_C99_DEFAULT], ifelse($1, yes, yes, no))dnl
1433 changequote(<<, >>)dnl
1434 <<--enable-c99 turns on 'ISO/IEC 9899:1999 support' [default=>>GLIBCPP_ENABLE_C99_DEFAULT],
1435 changequote([, ])dnl
1436 [case "$enableval" in
1437 yes) enable_c99=yes ;;
1438 no) enable_c99=no ;;
1439 *) AC_MSG_ERROR([Unknown argument to enable/disable C99]) ;;
1441 enable_c99=GLIBCPP_ENABLE_C99_DEFAULT)dnl
1446 # Check for the existence of <math.h> functions used if C99 is enabled.
1448 AC_MSG_CHECKING([for ISO C99 support in <math.h>])
1449 AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no])
1450 AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no])
1451 AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no])
1452 AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no])
1453 AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no])
1454 AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no])
1455 AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no])
1456 AC_TRY_COMPILE([#include <math.h>],
1457 [isgreaterequal(0.0,0.0);],, [ac_c99_math=no])
1458 AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no])
1459 AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no])
1460 AC_TRY_COMPILE([#include <math.h>],
1461 [islessgreater(0.0,0.0);],, [ac_c99_math=no])
1462 AC_TRY_COMPILE([#include <math.h>],
1463 [isunordered(0.0,0.0);],, [ac_c99_math=no])
1464 AC_MSG_RESULT($ac_c99_math)
1466 # Check for the existence in <stdio.h> of vscanf, et. al.
1468 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
1469 AC_TRY_COMPILE([#include <stdio.h>],
1470 [snprintf("12", 0, "%i");],, [ac_c99_stdio=no])
1471 AC_TRY_COMPILE([#include <stdio.h>
1473 void foo(char* fmt, ...)
1474 {va_list args; va_start(args, fmt);
1475 vfscanf(stderr, "%i", args);}],
1476 [],, [ac_c99_stdio=no])
1477 AC_TRY_COMPILE([#include <stdio.h>
1479 void foo(char* fmt, ...)
1480 {va_list args; va_start(args, fmt);
1481 vscanf("%i", args);}],
1482 [],, [ac_c99_stdio=no])
1483 AC_TRY_COMPILE([#include <stdio.h>
1485 void foo(char* fmt, ...)
1486 {va_list args; va_start(args, fmt);
1487 vsnprintf(fmt, 0, "%i", args);}],
1488 [],, [ac_c99_stdio=no])
1489 AC_TRY_COMPILE([#include <stdio.h>
1491 void foo(char* fmt, ...)
1492 {va_list args; va_start(args, fmt);
1493 vsscanf(fmt, "%i", args);}],
1494 [],, [ac_c99_stdio=no])
1495 AC_MSG_RESULT($ac_c99_stdio)
1497 # Check for the existence in <stdlib.h> of lldiv_t, et. al.
1499 AC_MSG_CHECKING([for lldiv_t declaration])
1500 AC_CACHE_VAL(ac_c99_lldiv_t, [
1501 AC_TRY_COMPILE([#include <stdlib.h>],
1503 [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no])
1505 AC_MSG_RESULT($ac_c99_lldiv_t)
1507 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
1508 AC_TRY_COMPILE([#include <stdlib.h>],
1509 [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no])
1510 AC_TRY_COMPILE([#include <stdlib.h>],
1511 [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no])
1512 AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no])
1513 AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no])
1514 AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no])
1515 AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no])
1516 if test x"$ac_c99_lldiv_t" = x"no"; then
1519 AC_MSG_RESULT($ac_c99_stdlib)
1521 # Check for the existence of <wchar.h> functions used if C99 is enabled.
1522 # XXX the wchar.h checks should be rolled into the general C99 bits.
1524 AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>])
1525 AC_TRY_COMPILE([#include <wchar.h>],
1526 [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no])
1527 AC_TRY_COMPILE([#include <wchar.h>],
1528 [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no])
1529 AC_TRY_COMPILE([#include <wchar.h>],
1530 [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no])
1531 AC_MSG_RESULT($ac_c99_wchar)
1533 AC_MSG_CHECKING([for enabled ISO C99 support])
1534 if test x"$ac_c99_math" = x"no" ||
1535 test x"$ac_c99_stdio" = x"no" ||
1536 test x"$ac_c99_stdlib" = x"no" ||
1537 test x"$ac_c99_wchar" = x"no"; then
1540 AC_MSG_RESULT($enable_c99)
1542 # Option parsed, now set things appropriately
1543 if test x"$enable_c99" = x"yes"; then
1544 AC_DEFINE(_GLIBCPP_USE_C99)
1552 dnl Check for template specializations for the 'long long' type extension.
1553 dnl The result determines only whether 'long long' I/O is enabled; things
1554 dnl like numeric_limits<> specializations are always available.
1556 dnl GLIBCPP_ENABLE_LONG_LONG
1557 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1558 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1559 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1560 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1561 dnl defaults to `no'.
1562 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1564 dnl GLIBCPP_ENABLE_LONG_LONG
1565 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1566 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1568 AC_ARG_ENABLE(long-long,
1569 changequote(<<, >>)dnl
1570 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1571 changequote([, ])dnl
1572 [case "$enableval" in
1573 yes) enable_long_long=yes ;;
1574 no) enable_long_long=no ;;
1575 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1577 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1582 AC_MSG_CHECKING([for enabled long long I/O support])
1583 # iostreams require strtoll, strtoull to compile
1584 AC_TRY_COMPILE([#include <stdlib.h>],
1585 [char* tmp; strtoll("gnu", &tmp, 10);],,[enable_long_long=no])
1586 AC_TRY_COMPILE([#include <stdlib.h>],
1587 [char* tmp; strtoull("gnu", &tmp, 10);],,[enable_long_long=no])
1589 # Option parsed, now set things appropriately
1590 if test x"$enable_long_long" = xyes; then
1591 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1593 AC_MSG_RESULT($enable_long_long)
1600 dnl Check for what kind of C headers to use.
1602 dnl GLIBCPP_ENABLE_CHEADERS
1603 dnl --enable-cheaders= [does stuff].
1604 dnl --disable-cheaders [does not do anything, really].
1605 dnl + This will eventually need to be 'c_shadow' by default.
1606 dnl + Usage: GLIBCPP_ENABLE_CHEADERS[(DEFAULT)]
1607 dnl Where DEFAULT is either `c' or `c_std' or 'c_shadow'.
1608 dnl If ommitted, it defaults to `c_std'.
1609 AC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl
1610 define([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl
1611 AC_MSG_CHECKING([for c header strategy to use])
1612 AC_ARG_ENABLE(cheaders,
1613 changequote(<<, >>)dnl
1614 << --enable-cheaders construct "C" header files for g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT],
1616 [case "$enableval" in
1621 enable_cheaders=c_std
1624 enable_cheaders=c_shadow
1626 *) AC_MSG_ERROR([Unknown argument to enable/disable "C" headers])
1629 enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT)
1630 AC_MSG_RESULT($enable_cheaders)
1632 dnl Option parsed, now set things appropriately
1633 case "$enable_cheaders" in
1635 CSHADOW_FLAGS="-fno-builtin"
1636 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_shadow'
1637 AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
1641 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_std'
1645 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c'
1649 AC_SUBST(CSHADOW_FLAGS)
1650 AC_SUBST(C_INCLUDE_DIR)
1651 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cheaders" = c_shadow)
1656 dnl Check for wide character support. Has the same effect as the option
1657 dnl in gcc's configure, but in a form that autoconf can mess with.
1659 dnl GLIBCPP_ENABLE_C_MBCHAR
1660 dnl --enable-c-mbchar requests all the wchar_t stuff.
1661 dnl --disable-c-mbchar doesn't.
1662 dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1663 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1664 dnl defaults to `no'.
1665 AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1666 define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1667 AC_ARG_ENABLE(c-mbchar,
1668 changequote(<<, >>)dnl
1669 << --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1670 changequote([, ])dnl
1671 [case "$enableval" in
1672 yes) enable_c_mbchar=yes ;;
1673 no) enable_c_mbchar=no ;;
1674 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1676 enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1677 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1682 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1684 dnl TOPLEVEL_INCLUDES
1685 dnl LIBMATH_INCLUDES
1686 dnl LIBSUPCXX_INCLUDES
1688 dnl CSHADOW_INCLUDES
1690 dnl GLIBCPP_EXPORT_INCLUDES
1691 AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1692 # Root level of the build directory include sources.
1693 GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include"
1695 # Passed down for canadian crosses.
1696 if test x"$CANADIAN" = xyes; then
1697 TOPLEVEL_INCLUDES='-I$(includedir)'
1700 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1702 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1704 if test x"$need_libio" = xyes; then
1705 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1706 AC_SUBST(LIBIO_INCLUDES)
1709 # Now, export this to all the little Makefiles....
1710 AC_SUBST(GLIBCPP_INCLUDES)
1711 AC_SUBST(TOPLEVEL_INCLUDES)
1712 AC_SUBST(LIBMATH_INCLUDES)
1713 AC_SUBST(LIBSUPCXX_INCLUDES)
1718 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1720 AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1721 # Optimization flags that are probably a good idea for thrill-seekers. Just
1722 # uncomment the lines below and make, everything else is ready to go...
1723 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1725 AC_SUBST(OPTIMIZE_CXXFLAGS)
1727 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1728 AC_SUBST(WARN_FLAGS)
1732 dnl GLIBCPP_EXPORT_INSTALL_INFO
1733 dnl calculates gxx_install_dir
1734 dnl exports glibcpp_toolexecdir
1735 dnl exports glibcpp_toolexeclibdir
1736 dnl exports glibcpp_prefixdir
1738 dnl Assumes cross_compiling bits already done, and with_cross_host in
1741 dnl GLIBCPP_EXPORT_INSTALL_INFO
1742 AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
1743 # Assumes glibcpp_builddir, glibcpp_srcdir are alreay set up and
1744 # exported correctly in GLIBCPP_CONFIGURE.
1745 glibcpp_toolexecdir=no
1746 glibcpp_toolexeclibdir=no
1747 glibcpp_prefixdir=${prefix}
1749 AC_MSG_CHECKING([for interface version number])
1750 libstdcxx_interface=$INTERFACE
1751 AC_MSG_RESULT($libstdcxx_interface)
1753 # Process the option --with-gxx-include-dir=<path to include-files directory>
1754 AC_MSG_CHECKING([for --with-gxx-include-dir])
1755 AC_ARG_WITH(gxx-include-dir,
1756 [ --with-gxx-include-dir the installation directory for include files],
1757 [case "${withval}" in
1759 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
1766 gxx_include_dir=${withval}
1768 esac], [gxx_include_dir=no])
1769 AC_MSG_RESULT($gxx_include_dir)
1771 # Process the option "--enable-version-specific-runtime-libs"
1772 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
1773 AC_ARG_ENABLE(version-specific-runtime-libs,
1774 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
1775 [case "$enableval" in
1776 yes) version_specific_libs=yes ;;
1777 no) version_specific_libs=no ;;
1778 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
1780 version_specific_libs=no)dnl
1781 # Option set, now we can test it.
1782 AC_MSG_RESULT($version_specific_libs)
1784 if test $version_specific_libs = yes; then
1785 # Need the gcc compiler version to know where to install libraries
1786 # and header files if --enable-version-specific-runtime-libs option
1789 gcc_version_trigger=${srcdir}/../gcc/version.c
1790 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'`
1791 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
1792 gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/g++
1793 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1794 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
1798 # Default case for install directory for include files.
1799 if test $version_specific_libs = no &&
1800 test $gxx_include_dir = no; then
1801 gxx_include_dir='$(prefix)'/include/g++-${libstdcxx_interface}
1804 # Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
1805 # Install a library built with a cross compiler in tooldir, not libdir.
1806 if test x"$glibcpp_toolexecdir" = x"no"; then
1807 if test -n "$with_cross_host" &&
1808 test x"$with_cross_host" != x"no"; then
1809 glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
1810 glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)'
1812 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1813 glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)'
1817 AC_MSG_CHECKING([for install location])
1818 AC_MSG_RESULT($gxx_include_dir)
1820 AC_SUBST(glibcpp_prefixdir)
1821 AC_SUBST(gxx_include_dir)
1822 AC_SUBST(glibcpp_toolexecdir)
1823 AC_SUBST(glibcpp_toolexeclibdir)
1827 # Check for functions in math library.
1828 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1830 # This file can be copied and used freely without restrictions. It can
1831 # be used in projects which are not available under the GNU Public License
1832 # but which still want to provide support for the GNU gettext functionality.
1833 # Please note that the actual code is *not* freely available.
1837 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1838 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1839 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1840 AC_SUBST(LIBMATHOBJS)dnl
1845 dnl This macro searches for a GNU version of make. If a match is found, the
1846 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1847 dnl set to "#". This is useful for including a special features in a Makefile,
1848 dnl which cannot be handled by other versions of make. The variable
1849 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1850 dnl the empty string otherwise.
1852 dnl Here is an example of its use:
1854 dnl Makefile.in might contain:
1856 dnl # A failsafe way of putting a dependency rule into a makefile
1858 dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1860 dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1861 dnl @ifGNUmake@ include $(DEPEND)
1862 dnl @ifGNUmake@ endif
1864 dnl Then configure.in would normally contain:
1866 dnl CHECK_GNU_MAKE()
1867 dnl AC_OUTPUT(Makefile)
1869 dnl Then perhaps to cause gnu make to override any other make, we could do
1870 dnl something like this (note that GNU make always looks for GNUmakefile first):
1872 dnl if ! test x$_cv_gnu_make_command = x ; then
1873 dnl mv Makefile GNUmakefile
1874 dnl echo .DEFAULT: > Makefile ;
1875 dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1878 dnl Then, if any (well almost any) other make is called, and GNU make also
1879 dnl exists, then the other make wraps the GNU make.
1881 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1882 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
1884 dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1885 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1886 dnl #### conditional's subshell (" --version" is not a command), using a
1887 dnl #### different option to grep(1).
1889 dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not
1890 dnl #### ${MAKE:-make}).
1893 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1894 _cv_gnu_make_command='' ;
1895 dnl Search all the common names for GNU make
1896 for a in "${MAKE-make}" make gmake gnumake ; do
1897 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
1899 _cv_gnu_make_command=$a ;
1904 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1905 dnl string, '#' otherwise
1906 if test "x$_cv_gnu_make_command" != "x" ; then
1915 dnl Check for headers for, and arguments to, the setrlimit() function.
1916 dnl Used only in testsuite_hooks.h.
1917 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT_ancilliary, [
1918 AC_TRY_COMPILE([#include <sys/resource.h>
1920 ], [ int f = RLIMIT_$1 ; ],
1921 [glibcpp_mresult=1], [glibcpp_mresult=0])
1922 AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcpp_mresult,
1923 [Only used in build directory testsuite_hooks.h.])
1925 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT, [
1926 setrlimit_have_headers=yes
1927 AC_CHECK_HEADERS(sys/resource.h unistd.h,
1929 setrlimit_have_headers=no)
1930 # If don't have the headers, then we can't run the tests now, and we
1931 # won't be seeing any of these during testsuite compilation.
1932 if test $setrlimit_have_headers = yes; then
1933 # Can't do these in a loop, else the resulting syntax is wrong.
1934 GLIBCPP_CHECK_SETRLIMIT_ancilliary(DATA)
1935 GLIBCPP_CHECK_SETRLIMIT_ancilliary(RSS)
1936 GLIBCPP_CHECK_SETRLIMIT_ancilliary(VMEM)
1937 GLIBCPP_CHECK_SETRLIMIT_ancilliary(AS)
1939 # Check for rlimit, setrlimit.
1940 AC_CACHE_VAL(ac_setrlimit, [
1941 AC_TRY_COMPILE([#include <sys/resource.h>
1944 [ struct rlimit r; setrlimit(0, &r);],
1945 [ac_setrlimit=yes], [ac_setrlimit=no])
1949 AC_MSG_CHECKING([for testsuite memory limit support])
1950 if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then
1952 AC_DEFINE(_GLIBCPP_MEM_LIMITS)
1956 AC_MSG_RESULT($ac_mem_limits)
1961 dnl Does any necessary configuration of the testsuite directory. Generates
1962 dnl the testsuite_hooks.h header.
1964 dnl GLIBCPP_CONFIGURE_TESTSUITE [no args]
1965 AC_DEFUN(GLIBCPP_CONFIGURE_TESTSUITE, [
1966 GLIBCPP_CHECK_SETRLIMIT
1968 # Look for setenv, so that extended locale tests can be performed.
1969 AC_CHECK_FUNCS(setenv)
1973 sinclude(../libtool.m4)
1974 dnl The lines below arrange for aclocal not to bring an installed
1975 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1976 dnl add a definition of LIBTOOL to Makefile.in.
1977 ifelse(,,,[AC_SUBST(LIBTOOL)
1978 AC_DEFUN([AM_PROG_LIBTOOL])
1979 AC_DEFUN([AC_LIBTOOL_DLOPEN])
1980 AC_DEFUN([AC_PROG_LD])
1984 # Check whether LC_MESSAGES is available in <locale.h>.
1985 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1987 # This file file be copied and used freely without restrictions. It can
1988 # be used in projects which are not available under the GNU Public License
1989 # but which still want to provide support for the GNU gettext functionality.
1990 # Please note that the actual code is *not* freely available.
1994 AC_DEFUN(AC_LC_MESSAGES, [
1995 AC_CHECK_HEADER(locale.h, [
1996 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1997 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1998 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1999 if test $ac_cv_val_LC_MESSAGES = yes; then
2000 AC_DEFINE(HAVE_LC_MESSAGES)
2007 dnl Check for whether the Boost-derived checks should be turned on.
2009 dnl GLIBCPP_ENABLE_CONCEPT_CHECKS
2010 dnl --enable-concept-checks turns them on.
2011 dnl --disable-concept-checks leaves them off.
2012 dnl + Usage: GLIBCPP_ENABLE_CONCEPT_CHECKS[(DEFAULT)]
2013 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
2014 dnl defaults to `no'.
2015 AC_DEFUN(GLIBCPP_ENABLE_CONCEPT_CHECKS, [dnl
2016 define([GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT], ifelse($1, yes, yes, no))dnl
2017 AC_ARG_ENABLE(concept-checks,
2018 changequote(<<, >>)dnl
2019 << --enable-concept-checks use Boost-derived template checks [default=>>GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT],
2020 changequote([, ])dnl
2021 [case "$enableval" in
2022 yes) enable_concept_checks=yes ;;
2023 no) enable_concept_checks=no ;;
2024 *) AC_MSG_ERROR([Unknown argument to enable/disable concept checks]) ;;
2026 enable_concept_checks=GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT)dnl
2027 dnl Option parsed, now set things appropriately
2028 if test x"$enable_concept_checks" = xyes; then
2029 AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS)
2035 dnl Add version tags to symbols in shared library (or not), additionally
2036 dnl marking other symbols as private/local (or not).
2038 dnl GLIBCPP_ENABLE_SYMVERS
2039 dnl --enable-symvers=style adds a version script to the linker call when
2040 dnl creating the shared library. The choice of version script is
2041 dnl controlled by 'style'.
2042 dnl --disable-symvers does not.
2043 dnl + Usage: GLIBCPP_ENABLE_SYMVERS[(DEFAULT)]
2044 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
2045 dnl defaults to `no'. Passing `yes' tries to choose a default style
2046 dnl based on linker characteristics. Passing 'no' disables versioning.
2047 AC_DEFUN(GLIBCPP_ENABLE_SYMVERS, [dnl
2048 define([GLIBCPP_ENABLE_SYMVERS_DEFAULT], ifelse($1, yes, yes, no))dnl
2049 AC_ARG_ENABLE(symvers,
2050 changequote(<<, >>)dnl
2051 << --enable-symvers=style enables symbol versioning of the shared library [default=>>GLIBCPP_ENABLE_SYMVERS_DEFAULT],
2052 changequote([, ])dnl
2053 [case "$enableval" in
2054 yes) enable_symvers=yes ;;
2055 no) enable_symvers=no ;;
2056 # other names here, just as sanity checks
2057 #gnu|sun|etcetera) enable_symvers=$enableval ;;
2058 gnu) enable_symvers=$enableval ;;
2059 *) AC_MSG_ERROR([Unknown argument to enable/disable symvers]) ;;
2061 enable_symvers=GLIBCPP_ENABLE_SYMVERS_DEFAULT)dnl
2063 # If we never went through the GLIBCPP_CHECK_LINKER_FEATURES macro, then we
2064 # don't know enough about $LD to do tricks...
2065 if test $enable_shared = no || test x$LD = x ; then
2069 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
2070 AC_MSG_CHECKING([for shared libgcc])
2071 ac_save_CFLAGS="$CFLAGS"
2073 AC_TRY_LINK( , [return 0], glibcpp_shared_libgcc=yes, glibcpp_shared_libgcc=no)
2074 CFLAGS="$ac_save_CFLAGS"
2075 AC_MSG_RESULT($glibcpp_shared_libgcc)
2077 # For GNU ld, we need at least this version. It's 2.12 in the same format
2078 # as the tested-for version. See GLIBCPP_CHECK_LINKER_FEATURES for more.
2079 glibcpp_min_gnu_ld_version=21200
2081 # Check to see if unspecified "yes" value can win, given results
2083 if test $enable_symvers = yes ; then
2084 if test $with_gnu_ld = yes &&
2085 test $glibcpp_gnu_ld_version -ge $glibcpp_min_gnu_ld_version &&
2086 test $glibcpp_shared_libgcc = yes ;
2095 dnl Everything parsed; figure out what file to use.
2096 case $enable_symvers in
2098 LINKER_MAP=config/linker-map.dummy
2101 LINKER_MAP=config/linker-map.gnu
2105 AC_LINK_FILES($LINKER_MAP, src/linker.map)
2106 AM_CONDITIONAL(GLIBCPP_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
2107 AC_MSG_CHECKING([versioning on shared library symbols])
2108 AC_MSG_RESULT($enable_symvers)