-dnl
-dnl Tests for newer compiler features, or features that are present in newer
-dnl compiler versions but not older compiler versions still in use, should
-dnl be placed here.
-dnl
-dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
-dnl new inlining code or the new system_header pragma will die on -Werror.
-dnl Leave it out by default and use maint-mode to use it.
-dnl
-dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
-dnl compiler supports it and the user has not requested debug mode.
-dnl
-dnl GLIBCPP_CHECK_COMPILER_FEATURES
-AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
- # All these tests are for C++; save the language and the compiler flags.
- # The CXXFLAGS thing is suspicious, but based on similar bits previously
- # found in GLIBCPP_CONFIGURE.
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- ac_test_CXXFLAGS="${CXXFLAGS+set}"
- ac_save_CXXFLAGS="$CXXFLAGS"
-
- # Check for maintainer-mode bits.
- if test x"$USE_MAINTAINER_MODE" = xno; then
- WERROR=''
- else
- WERROR='-Werror'
- fi
-
- # Check for -ffunction-sections -fdata-sections
- AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
- CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
- AC_TRY_COMPILE(, [int foo;
- ], [ac_fdsections=yes], [ac_fdsections=no])
- if test "$ac_test_CXXFLAGS" = set; then
- CXXFLAGS="$ac_save_CXXFLAGS"
- else
- # this is the suspicious part
- CXXFLAGS=''
- fi
- if test x"$ac_fdsections" = x"yes" &&
- test x"$enable_debug" = x"no"; then
- SECTION_FLAGS='-ffunction-sections -fdata-sections'
- fi
- AC_MSG_RESULT($ac_fdsections)
-
- AC_LANG_RESTORE
- AC_SUBST(WERROR)
- AC_SUBST(SECTION_FLAGS)
-])
-
-
-dnl
-dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
-dnl the native linker is in use, all variables will be defined to something
-dnl safe (like an empty string).
-dnl
-dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
-dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
-dnl Define LD, with_gnu_ld, and (possibly) glibcpp_gnu_ld_version as
-dnl side-effects of testing.
-dnl
-dnl GLIBCPP_CHECK_LINKER_FEATURES
-AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
- # If we're not using GNU ld, then there's no point in even trying these
- # tests. Check for that first. We should have already tested for gld
- # by now (in libtool), but require it now just to be safe...
- test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
- test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
- AC_REQUIRE([AC_PROG_LD])
-
- # The name set by libtool depends on the version of libtool. Shame on us
- # for depending on an impl detail, but c'est la vie. Older versions used
- # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
- # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
- # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
- # set (hence we're using an older libtool), then set it.
- if test x${with_gnu_ld+set} != xset; then
- if test x${ac_cv_prog_gnu_ld+set} != xset; then
- # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
- with_gnu_ld=no
- else
- with_gnu_ld=$ac_cv_prog_gnu_ld
- fi
- fi
-
- # Start by getting the version number. I think the libtool test already
- # does some of this, but throws away the result.
- changequote(,)
- ldver=`$LD --version 2>/dev/null | head -1 | \
- sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
- changequote([,])
- glibcpp_gnu_ld_version=`echo $ldver | \
- $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
-
- # Set --gc-sections.
- if test "$with_gnu_ld" = "notbroken"; then
- # GNU ld it is! Joy and bunny rabbits!
-
- # All these tests are for C++; save the language and the compiler flags.
- # Need to do this so that g++ won't try to link in libstdc++
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS='-x c++ -Wl,--gc-sections'
-
- # Check for -Wl,--gc-sections
- # XXX This test is broken at the moment, as symbols required for
- # linking are now in libsupc++ (not built yet.....). In addition,
- # this test has cored on solaris in the past. In addition,
- # --gc-sections doesn't really work at the moment (keeps on discarding
- # used sections, first .eh_frame and now some of the glibc sections for
- # iconv). Bzzzzt. Thanks for playing, maybe next time.
- AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
- AC_TRY_RUN([
- int main(void)
- {
- try { throw 1; }
- catch (...) { };
- return 0;
- }
- ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- else
- # this is the suspicious part
- CFLAGS=''
- fi
- if test "$ac_sectionLDflags" = "yes"; then
- SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
- fi
- AC_MSG_RESULT($ac_sectionLDflags)
- fi
-
- # Set linker optimization flags.
- if test x"$with_gnu_ld" = x"yes" && test x"$enable_debug" = x"no"; then
- OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
- fi
-
- AC_SUBST(SECTION_LDFLAGS)
- AC_SUBST(OPT_LDFLAGS)
-])
-
-
-dnl
-dnl Check to see if the (math function) argument passed is
-dnl declared when using the c++ compiler
-dnl ASSUMES argument is a math function with ONE parameter
-dnl
-dnl GLIBCPP_CHECK_MATH_DECL_1
-AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [
- AC_MSG_CHECKING([for $1 declaration])
- if test x${glibcpp_cv_func_$1_use+set} != xset; then
- AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <math.h>
- #ifdef HAVE_IEEEFP_H
- #include <ieeefp.h>
- #endif
- ],
- [ $1(0);],
- [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
- AC_LANG_RESTORE
- ])
- fi
- AC_MSG_RESULT($glibcpp_cv_func_$1_use)
-])
-
-dnl
-dnl Check to see if the (math function) argument passed is
-dnl 1) declared when using the c++ compiler
-dnl 2) has "C" linkage
-dnl 3) if not, see if 1) and 2) for argument prepended with '_'
-dnl
-dnl Define HAVE_CARGF etc if "cargf" is declared and links
-dnl
-dnl argument 1 is name of function to check
-dnl
-dnl ASSUMES argument is a math function with ONE parameter
-dnl
-dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
-AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
- GLIBCPP_CHECK_MATH_DECL_1($1)
- if test x$glibcpp_cv_func_$1_use = x"yes"; then
- AC_CHECK_FUNCS($1)
- else
- GLIBCPP_CHECK_MATH_DECL_1(_$1)
- if test x$glibcpp_cv_func__$1_use = x"yes"; then
- AC_CHECK_FUNCS(_$1)
- fi
- fi
-])
-
-
-dnl
-dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
-dnl of functions at once. It's an all-or-nothing check -- either
-dnl HAVE_XYZ is defined for each of the functions, or for none of them.
-dnl Doing it this way saves significant configure time.
-AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [
- AC_MSG_CHECKING([for $1 functions])
- AC_CACHE_VAL(glibcpp_cv_func_$2_use, [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <math.h>],
- [ `for x in $3; do echo "$x (0);"; done` ],
- [glibcpp_cv_func_$2_use=yes],
- [glibcpp_cv_func_$2_use=no])
- AC_LANG_RESTORE])
- AC_MSG_RESULT($glibcpp_cv_func_$2_use)
- if test x$glibcpp_cv_func_$2_use = x"yes"; then
- AC_CHECK_FUNCS($3)
- fi
-])
-
-dnl
-dnl Check to see if the (math function) argument passed is
-dnl declared when using the c++ compiler
-dnl ASSUMES argument is a math function with TWO parameters
-dnl
-dnl GLIBCPP_CHECK_MATH_DECL_2
-AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [
- AC_MSG_CHECKING([for $1 declaration])
- if test x${glibcpp_cv_func_$1_use+set} != xset; then
- AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <math.h>],
- [ $1(0, 0);],
- [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
- AC_LANG_RESTORE
- ])
- fi
- AC_MSG_RESULT($glibcpp_cv_func_$1_use)
-])
-
-dnl
-dnl Check to see if the (math function) argument passed is
-dnl 1) declared when using the c++ compiler
-dnl 2) has "C" linkage
-dnl
-dnl Define HAVE_CARGF etc if "cargf" is declared and links
-dnl
-dnl argument 1 is name of function to check
-dnl
-dnl ASSUMES argument is a math function with TWO parameters
-dnl
-dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
-AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
- GLIBCPP_CHECK_MATH_DECL_2($1)
- if test x$glibcpp_cv_func_$1_use = x"yes"; then
- AC_CHECK_FUNCS($1)
- else
- GLIBCPP_CHECK_MATH_DECL_2(_$1)
- if test x$glibcpp_cv_func__$1_use = x"yes"; then
- AC_CHECK_FUNCS(_$1)
- fi
- fi
-])
-
-
-dnl
-dnl Check to see if the (math function) argument passed is
-dnl declared when using the c++ compiler
-dnl ASSUMES argument is a math function with THREE parameters
-dnl
-dnl GLIBCPP_CHECK_MATH_DECL_3
-AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [
- AC_MSG_CHECKING([for $1 declaration])
- if test x${glibcpp_cv_func_$1_use+set} != xset; then
- AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <math.h>],
- [ $1(0, 0, 0);],
- [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
- AC_LANG_RESTORE
- ])
- fi
- AC_MSG_RESULT($glibcpp_cv_func_$1_use)
-])
-
-dnl
-dnl Check to see if the (math function) argument passed is
-dnl 1) declared when using the c++ compiler
-dnl 2) has "C" linkage
-dnl
-dnl Define HAVE_CARGF etc if "cargf" is declared and links
-dnl
-dnl argument 1 is name of function to check
-dnl
-dnl ASSUMES argument is a math function with THREE parameters
-dnl
-dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
-AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
- GLIBCPP_CHECK_MATH_DECL_3($1)
- if test x$glibcpp_cv_func_$1_use = x"yes"; then
- AC_CHECK_FUNCS($1)
- else
- GLIBCPP_CHECK_MATH_DECL_3(_$1)
- if test x$glibcpp_cv_func__$1_use = x"yes"; then
- AC_CHECK_FUNCS(_$1)
- fi
- fi
-])
-
-
-dnl
-dnl Check to see if the (stdlib function) argument passed is
-dnl 1) declared when using the c++ compiler
-dnl 2) has "C" linkage
-dnl
-dnl argument 1 is name of function to check
-dnl
-dnl ASSUMES argument is a math function with TWO parameters
-dnl
-dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
-AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
- AC_MSG_CHECKING([for $1 declaration])
- if test x${glibcpp_cv_func_$1_use+set} != xset; then
- AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <stdlib.h>],
- [ $1(0, 0);],
- [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
- AC_LANG_RESTORE
- ])
- fi
- AC_MSG_RESULT($glibcpp_cv_func_$1_use)
- if test x$glibcpp_cv_func_$1_use = x"yes"; then
- AC_CHECK_FUNCS($1)
- fi
-])
-
-
-dnl
-dnl Check to see if the (stdlib function) argument passed is
-dnl 1) declared when using the c++ compiler
-dnl 2) has "C" linkage
-dnl
-dnl argument 1 is name of function to check
-dnl
-dnl ASSUMES argument is a function with THREE parameters
-dnl
-dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3
-AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3, [
- AC_MSG_CHECKING([for $1 declaration])
- if test x${glibcpp_cv_func_$1_use+set} != xset; then
- AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <stdlib.h>],
- [ $1(0, 0, 0);],
- [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
- AC_LANG_RESTORE
- ])
- fi
- AC_MSG_RESULT($glibcpp_cv_func_$1_use)
- if test x$glibcpp_cv_func_$1_use = x"yes"; then
- AC_CHECK_FUNCS($1)
- fi
-])
-
-dnl
-dnl Check to see if the (unistd function) argument passed is
-dnl 1) declared when using the c++ compiler
-dnl 2) has "C" linkage
-dnl
-dnl argument 1 is name of function to check
-dnl
-dnl ASSUMES argument is a function with ONE parameter
-dnl
-dnl GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1
-AC_DEFUN(GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1, [
- AC_MSG_CHECKING([for $1 declaration])
- if test x${glibcpp_cv_func_$1_use+set} != xset; then
- AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <unistd.h>],
- [ $1(0);],
- [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
- AC_LANG_RESTORE
- ])
- fi
- AC_MSG_RESULT($glibcpp_cv_func_$1_use)
- if test x$glibcpp_cv_func_$1_use = x"yes"; then
- AC_CHECK_FUNCS($1)
- fi
-])
-
-dnl
-dnl Because the builtins are picky picky picky about the arguments they take,
-dnl do an explict linkage tests here.
-dnl Check to see if the (math function) argument passed is
-dnl 1) declared when using the c++ compiler
-dnl 2) has "C" linkage
-dnl
-dnl Define HAVE_CARGF etc if "cargf" is declared and links
-dnl
-dnl argument 1 is name of function to check
-dnl
-dnl ASSUMES argument is a math function with ONE parameter
-dnl
-dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
-AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
- AC_MSG_CHECKING([for $1 declaration])
- if test x${glibcpp_cv_func_$1_use+set} != xset; then
- AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <math.h>],
- [ $1(0);],
- [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
- AC_LANG_RESTORE
- ])
- fi
- AC_MSG_RESULT($glibcpp_cv_func_$1_use)
- if test x$glibcpp_cv_func_$1_use = x"yes"; then
- AC_MSG_CHECKING([for $1 linkage])
- if test x${glibcpp_cv_func_$1_link+set} != xset; then
- AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
- AC_TRY_LINK([#include <math.h>],
- [ $1(0);],
- [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
- ])
- fi
- AC_MSG_RESULT($glibcpp_cv_func_$1_link)
- if test x$glibcpp_cv_func_$1_link = x"yes"; then
- ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- AC_DEFINE_UNQUOTED(${ac_tr_func})
- fi
- fi
-])
-
-
-dnl
-dnl Check to see what builtin math functions are supported
-dnl
-dnl check for __builtin_abs
-dnl check for __builtin_fabsf
-dnl check for __builtin_fabs
-dnl check for __builtin_fabl
-dnl check for __builtin_labs
-dnl check for __builtin_sqrtf
-dnl check for __builtin_sqrtl
-dnl check for __builtin_sqrt
-dnl check for __builtin_sinf
-dnl check for __builtin_sin
-dnl check for __builtin_sinl
-dnl check for __builtin_cosf
-dnl check for __builtin_cos
-dnl check for __builtin_cosl
-dnl
-dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
-AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
- dnl Test for builtin math functions.
- dnl These are made in gcc/c-common.c
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
-
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrt)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
-
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
-
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
-
- dnl There is, without a doubt, a more elegant way to have these
- dnl names exported so that they won't be stripped out of acconfig.h by
- dnl autoheader. I leave this as an exercise to somebody less frustrated
- dnl than I.... please email the libstdc++ list if you can figure out a
- dnl more elegant approach (see autoconf/acgen.m4 and specifically
- dnl AC_CHECK_FUNC for things to steal.)
- dummyvar=no
- if test x$dummyvar = x"yes"; then
- AC_DEFINE(HAVE___BUILTIN_ABS)
- AC_DEFINE(HAVE___BUILTIN_LABS)
- AC_DEFINE(HAVE___BUILTIN_COS)
- AC_DEFINE(HAVE___BUILTIN_COSF)
- AC_DEFINE(HAVE___BUILTIN_COSL)
- AC_DEFINE(HAVE___BUILTIN_FABS)
- AC_DEFINE(HAVE___BUILTIN_FABSF)
- AC_DEFINE(HAVE___BUILTIN_FABSL)
- AC_DEFINE(HAVE___BUILTIN_SIN)
- AC_DEFINE(HAVE___BUILTIN_SINF)
- AC_DEFINE(HAVE___BUILTIN_SINL)
- AC_DEFINE(HAVE___BUILTIN_SQRT)
- AC_DEFINE(HAVE___BUILTIN_SQRTF)
- AC_DEFINE(HAVE___BUILTIN_SQRTL)
- fi
-])
-
-dnl
-dnl Check to see what the underlying c library is like
-dnl These checks need to do two things:
-dnl 1) make sure the name is declared when using the c++ compiler
-dnl 2) make sure the name has "C" linkage
-dnl This might seem like overkill but experience has shown that it's not...
-dnl
-dnl Define HAVE_STRTOLD if "strtold" is declared and links
-dnl Define HAVE_STRTOF if "strtof" is declared and links
-dnl Define HAVE_DRAND48 if "drand48" is declared and links
-dnl
-dnl GLIBCPP_CHECK_STDLIB_SUPPORT
-AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
- ac_test_CXXFLAGS="${CXXFLAGS+set}"
- ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
-
- GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
- GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof)
- AC_CHECK_FUNCS(drand48)
-
- CXXFLAGS="$ac_save_CXXFLAGS"
-])
-
-dnl
-dnl Check to see what the underlying c library is like
-dnl These checks need to do two things:
-dnl 1) make sure the name is declared when using the c++ compiler
-dnl 2) make sure the name has "C" linkage
-dnl This might seem like overkill but experience has shown that it's not...
-dnl
-dnl Define HAVE_ISATTY if "isatty" is declared and links
-dnl
-dnl GLIBCPP_CHECK_UNISTD_SUPPORT
-AC_DEFUN(GLIBCPP_CHECK_UNISTD_SUPPORT, [
- ac_test_CXXFLAGS="${CXXFLAGS+set}"
- ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
-
- GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1(isatty)
-
- CXXFLAGS="$ac_save_CXXFLAGS"
-])
-
-dnl
-dnl Check to see what the underlying c library or math library is like.
-dnl These checks need to do two things:
-dnl 1) make sure the name is declared when using the c++ compiler
-dnl 2) make sure the name has "C" linkage
-dnl This might seem like overkill but experience has shown that it's not...
-dnl
-dnl Define HAVE_CARGF etc if "cargf" is found.
-dnl
-dnl GLIBCPP_CHECK_MATH_SUPPORT
-AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
- ac_test_CXXFLAGS="${CXXFLAGS+set}"
- ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
-
- dnl Check libm
- AC_CHECK_LIB(m, sin, libm="-lm")
- ac_save_LIBS="$LIBS"
- LIBS="$LIBS $libm"
-
- dnl Check to see if certain C math functions exist.
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypot)
-
- dnl Check to see if basic C math functions have float versions.
- GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig,
- float_trig,
- acosf asinf atanf \
- cosf sinf tanf \
- coshf sinhf tanhf)
- GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
- float_round,
- ceilf floorf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
-
- dnl Check to see if basic C math functions have long double versions.
- GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig,
- long_double_trig,
- acosl asinl atanl \
- cosl sinl tanl \
- coshl sinhl tanhl)
- GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round,
- long_double_round,
- ceill floorl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
-
- dnl Some runtimes have these functions with a preceding underscore. Please
- dnl keep this sync'd with the one above. And if you add any new symbol,
- dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
- dnl Check to see if certain C math functions exist.
-
- dnl Check to see if basic C math functions have float versions.
- GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
- _float_trig,
- _acosf _asinf _atanf \
- _cosf _sinf _tanf \
- _coshf _sinhf _tanhf)
- GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
- _float_round,
- _ceilf _floorf)
-
- dnl Check to see if basic C math functions have long double versions.
- GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
- _long_double_trig,
- _acosl _asinl _atanl \
- _cosl _sinl _tanl \
- _coshl _sinhl _tanhl)
- GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
- _long_double_round,
- _ceill _floorl)
-
- LIBS="$ac_save_LIBS"
- CXXFLAGS="$ac_save_CXXFLAGS"
-])
-
-
-dnl
-dnl Check to see if there is native support for complex
-dnl
-dnl Don't compile bits in math/* if native support exits.
-dnl
-dnl Define USE_COMPLEX_LONG_DOUBLE etc if "copysignl" is found.
-dnl
-dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
-AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
- dnl Check for complex versions of math functions of platform.
- AC_CHECK_LIB(m, main)
- AC_REPLACE_MATHFUNCS(nan copysignf)
-
- dnl For __signbit to signbit conversions.
- AC_CHECK_FUNCS([__signbit], , [LIBMATHOBJS="$LIBMATHOBJS signbit.lo"])
- AC_CHECK_FUNCS([__signbitf], , [LIBMATHOBJS="$LIBMATHOBJS signbitf.lo"])
-
- dnl Compile the long double complex functions only if the function
- dnl provides the non-complex long double functions that are needed.
- dnl Currently this includes copysignl, which should be
- dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
- if test x$ac_cv_func_copysignl = x"yes"; then
- AC_CHECK_FUNCS([__signbitl], , [LIBMATHOBJS="$LIBMATHOBJS signbitl.lo"])
- fi
-
- AC_SUBST(LIBMATHOBJS)
-])
-
-
-dnl Check to see what architecture and operating system we are compiling
-dnl for. Also, if architecture- or OS-specific flags are required for
-dnl compilation, pick them up here.
-dnl
-dnl GLIBCPP_CHECK_TARGET
-AC_DEFUN(GLIBCPP_CHECK_TARGET, [
- . [$]{glibcpp_basedir}/configure.target
- AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
- AC_MSG_RESULT(OS config directory is $os_include_dir)
-])
-
-
-dnl
-dnl Check to see if this target can enable the wchar_t parts of libstdc++.
-dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
-dnl must have been previously checked.)
-dnl
-dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
-dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h
-dnl
-dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
-AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
-
- dnl Test wchar.h for mbstate_t, which is needed for char_traits and
- dnl others even if wchar_t support is not on.
- AC_MSG_CHECKING([for mbstate_t])
- AC_TRY_COMPILE([#include <wchar.h>],
- [mbstate_t teststate;],
- have_mbstate_t=yes, have_mbstate_t=no)
- AC_MSG_RESULT($have_mbstate_t)
- if test x"$have_mbstate_t" = xyes; then
- AC_DEFINE(HAVE_MBSTATE_T)
- fi
-
- dnl Sanity check for existence of ISO C99 headers for extended encoding.
- AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
- AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
-
- dnl Only continue checking if the ISO C99 headers exist and support is on.
- if test x"$ac_has_wchar_h" = xyes &&
- test x"$ac_has_wctype_h" = xyes &&
- test x"$enable_c_mbchar" != xno; then
-
- dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
- dnl numeric_limits can instantiate type_traits<wchar_t>
- AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
- AC_TRY_COMPILE([#include <wchar.h>],
- [int i = WCHAR_MIN; int j = WCHAR_MAX;],
- has_wchar_minmax=yes, has_wchar_minmax=no)
- AC_MSG_RESULT($has_wchar_minmax)
-
- dnl Test wchar.h for WEOF, which is what we use to determine whether
- dnl to specialize for char_traits<wchar_t> or not.
- AC_MSG_CHECKING([for WEOF])
- AC_TRY_COMPILE([
- #include <wchar.h>
- #include <stddef.h>],
- [wint_t i = WEOF;],
- has_weof=yes, has_weof=no)
- AC_MSG_RESULT($has_weof)
-
- dnl Tests for wide character functions used in char_traits<wchar_t>.
- ac_wfuncs=yes
- AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset,, \
- ac_wfuncs=no)
-
- dnl Checks for names injected into std:: by the c_std headers.
- AC_CHECK_FUNCS(btowc wctob fgetwc fgetwc fgetws fputwc fputws fwide \
- fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
- vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
- mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
- wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
- wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \
- ac_wfuncs=no)
-
- AC_MSG_CHECKING([for ISO C99 wchar_t support])
- if test x"$has_weof" = xyes &&
- test x"$has_wchar_minmax" = xyes &&
- test x"$ac_wfuncs" = xyes; then
- ac_isoC99_wchar_t=yes
- else
- ac_isoC99_wchar_t=no
- fi
- AC_MSG_RESULT($ac_isoC99_wchar_t)
-
- dnl Use iconv for wchar_t to char conversions. As such, check for
- dnl X/Open Portability Guide, version 2 features (XPG2).
- AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
- AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
-
- dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
- AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
- ac_save_LIBS="$LIBS"
- LIBS="$LIBS $libiconv"
-
- AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
- ac_XPG2funcs=yes, ac_XPG2funcs=no)
-
- LIBS="$ac_save_LIBS"
-
- AC_MSG_CHECKING([for XPG2 wchar_t support])
- if test x"$ac_has_iconv_h" = xyes &&
- test x"$ac_has_langinfo_h" = xyes &&
- test x"$ac_XPG2funcs" = xyes; then
- ac_XPG2_wchar_t=yes
- else
- ac_XPG2_wchar_t=no
- fi
- AC_MSG_RESULT($ac_XPG2_wchar_t)
-
- dnl At the moment, only enable wchar_t specializations if all the
- dnl above support is present.
- AC_MSG_CHECKING([for enabled wchar_t specializations])
- if test x"$ac_isoC99_wchar_t" = xyes &&
- test x"$ac_XPG2_wchar_t" = xyes; then
- AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
- AC_MSG_RESULT("yes")
- else
- AC_MSG_RESULT("no")
- fi
- else
- dnl Wide characters disabled by the user.
- AC_MSG_WARN([wchar_t support disabled.])
- fi
-])