acinclude.m4 revision 97403
197403Sobriendnl 297403Sobriendnl Initialize configure bits. 397403Sobriendnl 497403Sobriendnl GLIBCPP_CONFIGURE 597403SobrienAC_DEFUN(GLIBCPP_CONFIGURE, [ 697403Sobrien dnl Default to --enable-multilib 797403Sobrien AC_ARG_ENABLE(multilib, 897403Sobrien [ --enable-multilib build hella library versions (default)], 997403Sobrien [case "${enableval}" in 1097403Sobrien yes) multilib=yes ;; 1197403Sobrien no) multilib=no ;; 1297403Sobrien *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;; 1397403Sobrien esac], [multilib=yes])dnl 1497403Sobrien 1597403Sobrien # When building with srcdir == objdir, links to the source files will 1697403Sobrien # be created in directories within the target_subdir. We have to 1797403Sobrien # adjust toplevel_srcdir accordingly, so that configure finds 1897403Sobrien # install-sh and other auxiliary files that live in the top-level 1997403Sobrien # source directory. 2097403Sobrien if test "${srcdir}" = "."; then 2197403Sobrien if test -z "${with_target_subdir}"; then 2297403Sobrien toprel=".." 2397403Sobrien else 2497403Sobrien if test "${with_target_subdir}" != "."; then 2597403Sobrien toprel="${with_multisrctop}../.." 2697403Sobrien else 2797403Sobrien toprel="${with_multisrctop}.." 2897403Sobrien fi 2997403Sobrien fi 3097403Sobrien else 3197403Sobrien toprel=".." 3297403Sobrien fi 3397403Sobrien AC_CONFIG_AUX_DIR(${srcdir}/$toprel) 3497403Sobrien toplevel_srcdir=\${top_srcdir}/$toprel 3597403Sobrien AC_SUBST(toplevel_srcdir) 3697403Sobrien 3797403Sobrien # Export build and source directories. 3897403Sobrien # These need to be absolute paths, yet at the same time need to 3997403Sobrien # canonicalize only relative paths, because then amd will not unmount 4097403Sobrien # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd. 4197403Sobrien glibcpp_builddir=`pwd` 4297403Sobrien case $srcdir in 4397403Sobrien [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;; 4497403Sobrien *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;; 4597403Sobrien esac 4697403Sobrien AC_SUBST(glibcpp_builddir) 4797403Sobrien AC_SUBST(glibcpp_srcdir) 4897403Sobrien 4997403Sobrien dnl This is here just to satisfy automake. 5097403Sobrien ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)]) 5197403Sobrien 5297403Sobrien AC_PROG_AWK 5397403Sobrien # Will set LN_S to either 'ln -s' or 'ln'. With autoconf 2.5x, can also 5497403Sobrien # be 'cp -p' if linking isn't available. 5597403Sobrien #ac_cv_prog_LN_S='cp -p' 5697403Sobrien AC_PROG_LN_S 5797403Sobrien 5897403Sobrien # We use these options to decide which functions to include. 5997403Sobrien AC_ARG_WITH(target-subdir, 6097403Sobrien [ --with-target-subdir=SUBDIR 6197403Sobrien configuring in a subdirectory]) 6297403Sobrien AC_ARG_WITH(cross-host, 6397403Sobrien [ --with-cross-host=HOST configuring with a cross compiler]) 6497403Sobrien 6597403Sobrien glibcpp_basedir=$srcdir/$toprel/$1/libstdc++-v3 6697403Sobrien AC_SUBST(glibcpp_basedir) 6797403Sobrien 6897403Sobrien # Never versions of autoconf add an underscore to these functions. 6997403Sobrien # Prevent future problems ... 7097403Sobrien ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))]) 7197403Sobrien ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))]) 7297403Sobrien ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))]) 7397403Sobrien ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))]) 7497403Sobrien 7597403Sobrien # AC_PROG_CC 7697403Sobrien # FIXME: We temporarily define our own version of AC_PROG_CC. This is 7797403Sobrien # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We 7897403Sobrien # are probably using a cross compiler, which will not be able to fully 7997403Sobrien # link an executable. This is addressed in later versions of autoconf. 8097403Sobrien 8197403Sobrien AC_DEFUN(LIB_AC_PROG_CC, 8297403Sobrien [AC_BEFORE([$0], [AC_PROG_CPP])dnl 8397403Sobrien dnl Fool anybody using AC_PROG_CC. 8497403Sobrien AC_PROVIDE([AC_PROG_CC]) 8597403Sobrien AC_CHECK_PROG(CC, gcc, gcc) 8697403Sobrien if test -z "$CC"; then 8797403Sobrien AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) 8897403Sobrien test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) 8997403Sobrien fi 9097403Sobrien 9197403Sobrien AC_PROG_CC_GNU 9297403Sobrien 9397403Sobrien if test $ac_cv_prog_gcc = yes; then 9497403Sobrien GCC=yes 9597403Sobrien dnl Check whether -g works, even if CFLAGS is set, in case the package 9697403Sobrien dnl plays around with CFLAGS (such as to build both debugging and 9797403Sobrien dnl normal versions of a library), tasteless as that idea is. 9897403Sobrien ac_test_CFLAGS="${CFLAGS+set}" 9997403Sobrien ac_save_CFLAGS="$CFLAGS" 10097403Sobrien CFLAGS= 10197403Sobrien AC_PROG_CC_G 10297403Sobrien if test "$ac_test_CFLAGS" = set; then 10397403Sobrien CFLAGS="$ac_save_CFLAGS" 10497403Sobrien elif test $ac_cv_prog_cc_g = yes; then 10597403Sobrien CFLAGS="-g -O2" 10697403Sobrien else 10797403Sobrien CFLAGS="-O2" 10897403Sobrien fi 10997403Sobrien else 11097403Sobrien GCC= 11197403Sobrien test "${CFLAGS+set}" = set || CFLAGS="-g" 11297403Sobrien fi 11397403Sobrien ]) 11497403Sobrien 11597403Sobrien LIB_AC_PROG_CC 11697403Sobrien 11797403Sobrien # Likewise for AC_PROG_CXX. We can't just call it directly because g++ 11897403Sobrien # will try to link in libstdc++. 11997403Sobrien AC_DEFUN(LIB_AC_PROG_CXX, 12097403Sobrien [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl 12197403Sobrien dnl Fool anybody using AC_PROG_CXX. 12297403Sobrien AC_PROVIDE([AC_PROG_CXX]) 12397403Sobrien # Use glibcpp_CXX so that we do not cause CXX to be cached with the 12497403Sobrien # flags that come in CXX while configuring libstdc++. They're different 12597403Sobrien # from those used for all other target libraries. If CXX is set in 12697403Sobrien # the environment, respect that here. 12797403Sobrien glibcpp_CXX=$CXX 12897403Sobrien AC_CHECK_PROGS(glibcpp_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc) 12997403Sobrien AC_SUBST(glibcpp_CXX) 13097403Sobrien CXX=$glibcpp_CXX 13197403Sobrien test -z "$glibcpp_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH]) 13297403Sobrien 13397403Sobrien AC_PROG_CXX_GNU 13497403Sobrien 13597403Sobrien if test $ac_cv_prog_gxx = yes; then 13697403Sobrien GXX=yes 13797403Sobrien dnl Check whether -g works, even if CXXFLAGS is set, in case the package 13897403Sobrien dnl plays around with CXXFLAGS (such as to build both debugging and 13997403Sobrien dnl normal versions of a library), tasteless as that idea is. 14097403Sobrien ac_test_CXXFLAGS="${CXXFLAGS+set}" 14197403Sobrien ac_save_CXXFLAGS="$CXXFLAGS" 14297403Sobrien CXXFLAGS= 14397403Sobrien AC_PROG_CXX_G 14497403Sobrien if test "$ac_test_CXXFLAGS" = set; then 14597403Sobrien CXXFLAGS="$ac_save_CXXFLAGS" 14697403Sobrien elif test $ac_cv_prog_cxx_g = yes; then 14797403Sobrien CXXFLAGS="-g -O2" 14897403Sobrien else 14997403Sobrien CXXFLAGS="-O2" 15097403Sobrien fi 15197403Sobrien else 15297403Sobrien GXX= 15397403Sobrien test "${CXXFLAGS+set}" = set || CXXFLAGS="-g" 15497403Sobrien fi 15597403Sobrien ]) 15697403Sobrien 15797403Sobrien LIB_AC_PROG_CXX 15897403Sobrien 15997403Sobrien # For some reason, gettext needs this. 16097403Sobrien AC_ISC_POSIX 16197403Sobrien 16297403Sobrien AC_CHECK_TOOL(AS, as) 16397403Sobrien AC_CHECK_TOOL(AR, ar) 16497403Sobrien AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error) 16597403Sobrien AC_PROG_INSTALL 16697403Sobrien 16797403Sobrien AM_MAINTAINER_MODE 16897403Sobrien 16997403Sobrien # We need AC_EXEEXT to keep automake happy in cygnus mode. However, 17097403Sobrien # at least currently, we never actually build a program, so we never 17197403Sobrien # need to use $(EXEEXT). Moreover, the test for EXEEXT normally 17297403Sobrien # fails, because we are probably configuring with a cross compiler 17397403Sobrien # which can't create executables. So we include AC_EXEEXT to keep 17497403Sobrien # automake happy, but we don't execute it, since we don't care about 17597403Sobrien # the result. 17697403Sobrien if false; then 17797403Sobrien # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands 17897403Sobrien # to nothing, so nothing would remain between `then' and `fi' if it 17997403Sobrien # were not for the `:' below. 18097403Sobrien : 18197403Sobrien AC_EXEEXT 18297403Sobrien fi 18397403Sobrien 18497403Sobrien . [$]{glibcpp_basedir}/configure.host 18597403Sobrien 18697403Sobrien case [$]{glibcpp_basedir} in 18797403Sobrien /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;; 18897403Sobrien *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;; 18997403Sobrien esac 19097403Sobrien 19197403Sobrien # This does for the target what configure.host does for the host. In 19297403Sobrien # addition to possibly modifying the same flags, it also sets up symlinks. 19397403Sobrien GLIBCPP_CHECK_TARGET 19497403Sobrien 19597403Sobrien]) 19697403Sobrien 19797403Sobrien 19897403Sobriendnl 19997403Sobriendnl Check to see if g++ can compile this library, and if so, if any version- 20097403Sobriendnl specific precautions need to be taken. 20197403Sobriendnl 20297403Sobriendnl GLIBCPP_CHECK_COMPILER_VERSION 20397403SobrienAC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [ 20497403Sobrienif test ! -f stamp-sanity-compiler; then 20597403Sobrien AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3]) 20697403Sobrien AC_LANG_SAVE 20797403Sobrien AC_LANG_CPLUSPLUS 20897403Sobrien AC_TRY_COMPILE(, [ 20997403Sobrien #if __GNUC__ < 3 21097403Sobrien not_ok 21197403Sobrien #endif 21297403Sobrien ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to GCC 3.0 or above])) 21397403Sobrien AC_LANG_RESTORE 21497403Sobrien AC_MSG_RESULT($gpp_satisfactory) 21597403Sobrien touch stamp-sanity-compiler 21697403Sobrienfi 21797403Sobrien]) 21897403Sobrien 21997403Sobrien 22097403Sobriendnl 22197403Sobriendnl Tests for newer compiler features, or features that are present in newer 22297403Sobriendnl compiler versions but not older compiler versions still in use, should 22397403Sobriendnl be placed here. 22497403Sobriendnl 22597403Sobriendnl Define WERROR='-Werror' if requested and possible; g++'s that lack the 22697403Sobriendnl new inlining code or the new system_header pragma will die on -Werror. 22797403Sobriendnl Leave it out by default and use maint-mode to use it. 22897403Sobriendnl 22997403Sobriendnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if 23097403Sobriendnl compiler supports it and the user has not requested debug mode. 23197403Sobriendnl 23297403Sobriendnl GLIBCPP_CHECK_COMPILER_FEATURES 23397403SobrienAC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [ 23497403Sobrien # All these tests are for C++; save the language and the compiler flags. 23597403Sobrien # The CXXFLAGS thing is suspicious, but based on similar bits previously 23697403Sobrien # found in GLIBCPP_CONFIGURE. 23797403Sobrien AC_LANG_SAVE 23897403Sobrien AC_LANG_CPLUSPLUS 23997403Sobrien ac_test_CXXFLAGS="${CXXFLAGS+set}" 24097403Sobrien ac_save_CXXFLAGS="$CXXFLAGS" 24197403Sobrien 24297403Sobrien # Check for maintainer-mode bits. 24397403Sobrien if test x"$USE_MAINTAINER_MODE" = xno; then 24497403Sobrien WERROR='' 24597403Sobrien else 24697403Sobrien WERROR='-Werror' 24797403Sobrien fi 24897403Sobrien 24997403Sobrien # Check for -ffunction-sections -fdata-sections 25097403Sobrien AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections]) 25197403Sobrien CXXFLAGS='-Werror -ffunction-sections -fdata-sections' 25297403Sobrien AC_TRY_COMPILE(, [int foo; 25397403Sobrien ], [ac_fdsections=yes], [ac_fdsections=no]) 25497403Sobrien if test "$ac_test_CXXFLAGS" = set; then 25597403Sobrien CXXFLAGS="$ac_save_CXXFLAGS" 25697403Sobrien else 25797403Sobrien # this is the suspicious part 25897403Sobrien CXXFLAGS='' 25997403Sobrien fi 26097403Sobrien if test x"$ac_fdsections" = x"yes" && 26197403Sobrien test x"$enable_debug" = x"no"; then 26297403Sobrien SECTION_FLAGS='-ffunction-sections -fdata-sections' 26397403Sobrien fi 26497403Sobrien AC_MSG_RESULT($ac_fdsections) 26597403Sobrien 26697403Sobrien AC_LANG_RESTORE 26797403Sobrien AC_SUBST(WERROR) 26897403Sobrien AC_SUBST(SECTION_FLAGS) 26997403Sobrien]) 27097403Sobrien 27197403Sobrien 27297403Sobriendnl 27397403Sobriendnl If GNU ld is in use, check to see if tricky linker opts can be used. If 27497403Sobriendnl the native linker is in use, all variables will be defined to something 27597403Sobriendnl safe (like an empty string). 27697403Sobriendnl 27797403Sobriendnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible. 27897403Sobriendnl Define OPT_LDFLAGS='-Wl,-O1' if possible. 27997403Sobriendnl Define LD, with_gnu_ld, and (possibly) glibcpp_gnu_ld_version as 28097403Sobriendnl side-effects of testing. 28197403Sobriendnl 28297403Sobriendnl GLIBCPP_CHECK_LINKER_FEATURES 28397403SobrienAC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [ 28497403Sobrien # If we're not using GNU ld, then there's no point in even trying these 28597403Sobrien # tests. Check for that first. We should have already tested for gld 28697403Sobrien # by now (in libtool), but require it now just to be safe... 28797403Sobrien test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS='' 28897403Sobrien test -z "$OPT_LDFLAGS" && OPT_LDFLAGS='' 28997403Sobrien AC_REQUIRE([AC_PROG_LD]) 29097403Sobrien 29197403Sobrien # The name set by libtool depends on the version of libtool. Shame on us 29297403Sobrien # for depending on an impl detail, but c'est la vie. Older versions used 29397403Sobrien # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on 29497403Sobrien # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually 29597403Sobrien # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't 29697403Sobrien # set (hence we're using an older libtool), then set it. 29797403Sobrien if test x${with_gnu_ld+set} != xset; then 29897403Sobrien if test x${ac_cv_prog_gnu_ld+set} != xset; then 29997403Sobrien # We got through "ac_require(ac_prog_ld)" and still not set? Huh? 30097403Sobrien with_gnu_ld=no 30197403Sobrien else 30297403Sobrien with_gnu_ld=$ac_cv_prog_gnu_ld 30397403Sobrien fi 30497403Sobrien fi 30597403Sobrien 30697403Sobrien # Start by getting the version number. I think the libtool test already 30797403Sobrien # does some of this, but throws away the result. 30897403Sobrien changequote(,) 30997403Sobrien ldver=`$LD --version 2>/dev/null | head -1 | \ 31097403Sobrien sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'` 31197403Sobrien changequote([,]) 31297403Sobrien glibcpp_gnu_ld_version=`echo $ldver | \ 31397403Sobrien $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'` 31497403Sobrien 31597403Sobrien # Set --gc-sections. 31697403Sobrien if test "$with_gnu_ld" = "notbroken"; then 31797403Sobrien # GNU ld it is! Joy and bunny rabbits! 31897403Sobrien 31997403Sobrien # All these tests are for C++; save the language and the compiler flags. 32097403Sobrien # Need to do this so that g++ won't try to link in libstdc++ 32197403Sobrien ac_test_CFLAGS="${CFLAGS+set}" 32297403Sobrien ac_save_CFLAGS="$CFLAGS" 32397403Sobrien CFLAGS='-x c++ -Wl,--gc-sections' 32497403Sobrien 32597403Sobrien # Check for -Wl,--gc-sections 32697403Sobrien # XXX This test is broken at the moment, as symbols required for 32797403Sobrien # linking are now in libsupc++ (not built yet.....). In addition, 32897403Sobrien # this test has cored on solaris in the past. In addition, 32997403Sobrien # --gc-sections doesn't really work at the moment (keeps on discarding 33097403Sobrien # used sections, first .eh_frame and now some of the glibc sections for 33197403Sobrien # iconv). Bzzzzt. Thanks for playing, maybe next time. 33297403Sobrien AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections]) 33397403Sobrien AC_TRY_RUN([ 33497403Sobrien int main(void) 33597403Sobrien { 33697403Sobrien try { throw 1; } 33797403Sobrien catch (...) { }; 33897403Sobrien return 0; 33997403Sobrien } 34097403Sobrien ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes]) 34197403Sobrien if test "$ac_test_CFLAGS" = set; then 34297403Sobrien CFLAGS="$ac_save_CFLAGS" 34397403Sobrien else 34497403Sobrien # this is the suspicious part 34597403Sobrien CFLAGS='' 34697403Sobrien fi 34797403Sobrien if test "$ac_sectionLDflags" = "yes"; then 34897403Sobrien SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" 34997403Sobrien fi 35097403Sobrien AC_MSG_RESULT($ac_sectionLDflags) 35197403Sobrien fi 35297403Sobrien 35397403Sobrien # Set linker optimization flags. 35497403Sobrien if test x"$with_gnu_ld" = x"yes" && test x"$enable_debug" = x"no"; then 35597403Sobrien OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS" 35697403Sobrien fi 35797403Sobrien 35897403Sobrien AC_SUBST(SECTION_LDFLAGS) 35997403Sobrien AC_SUBST(OPT_LDFLAGS) 36097403Sobrien]) 36197403Sobrien 36297403Sobrien 36397403Sobriendnl 36497403Sobriendnl Check to see if the (math function) argument passed is 36597403Sobriendnl declared when using the c++ compiler 36697403Sobriendnl ASSUMES argument is a math function with ONE parameter 36797403Sobriendnl 36897403Sobriendnl GLIBCPP_CHECK_MATH_DECL_1 36997403SobrienAC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [ 37097403Sobrien AC_MSG_CHECKING([for $1 declaration]) 37197403Sobrien if test x${glibcpp_cv_func_$1_use+set} != xset; then 37297403Sobrien AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ 37397403Sobrien AC_LANG_SAVE 37497403Sobrien AC_LANG_CPLUSPLUS 37597403Sobrien AC_TRY_COMPILE([#include <math.h> 37697403Sobrien #ifdef HAVE_IEEEFP_H 37797403Sobrien #include <ieeefp.h> 37897403Sobrien #endif 37997403Sobrien ], 38097403Sobrien [ $1(0);], 38197403Sobrien [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) 38297403Sobrien AC_LANG_RESTORE 38397403Sobrien ]) 38497403Sobrien fi 38597403Sobrien AC_MSG_RESULT($glibcpp_cv_func_$1_use) 38697403Sobrien]) 38797403Sobrien 38897403Sobriendnl 38997403Sobriendnl Check to see if the (math function) argument passed is 39097403Sobriendnl 1) declared when using the c++ compiler 39197403Sobriendnl 2) has "C" linkage 39297403Sobriendnl 3) if not, see if 1) and 2) for argument prepended with '_' 39397403Sobriendnl 39497403Sobriendnl Define HAVE_CARGF etc if "cargf" is declared and links 39597403Sobriendnl 39697403Sobriendnl argument 1 is name of function to check 39797403Sobriendnl 39897403Sobriendnl ASSUMES argument is a math function with ONE parameter 39997403Sobriendnl 40097403Sobriendnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1 40197403SobrienAC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [ 40297403Sobrien GLIBCPP_CHECK_MATH_DECL_1($1) 40397403Sobrien if test x$glibcpp_cv_func_$1_use = x"yes"; then 40497403Sobrien AC_CHECK_FUNCS($1) 40597403Sobrien else 40697403Sobrien GLIBCPP_CHECK_MATH_DECL_1(_$1) 40797403Sobrien if test x$glibcpp_cv_func__$1_use = x"yes"; then 40897403Sobrien AC_CHECK_FUNCS(_$1) 40997403Sobrien fi 41097403Sobrien fi 41197403Sobrien]) 41297403Sobrien 41397403Sobrien 41497403Sobriendnl 41597403Sobriendnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of 41697403Sobriendnl of functions at once. It's an all-or-nothing check -- either 41797403Sobriendnl HAVE_XYZ is defined for each of the functions, or for none of them. 41897403Sobriendnl Doing it this way saves significant configure time. 41997403SobrienAC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [ 42097403Sobrien AC_MSG_CHECKING([for $1 functions]) 42197403Sobrien AC_CACHE_VAL(glibcpp_cv_func_$2_use, [ 42297403Sobrien AC_LANG_SAVE 42397403Sobrien AC_LANG_CPLUSPLUS 42497403Sobrien AC_TRY_COMPILE([#include <math.h>], 42597403Sobrien [ `for x in $3; do echo "$x (0);"; done` ], 42697403Sobrien [glibcpp_cv_func_$2_use=yes], 42797403Sobrien [glibcpp_cv_func_$2_use=no]) 42897403Sobrien AC_LANG_RESTORE]) 42997403Sobrien AC_MSG_RESULT($glibcpp_cv_func_$2_use) 43097403Sobrien if test x$glibcpp_cv_func_$2_use = x"yes"; then 43197403Sobrien AC_CHECK_FUNCS($3) 43297403Sobrien fi 43397403Sobrien]) 43497403Sobrien 43597403Sobriendnl 43697403Sobriendnl Check to see if the (math function) argument passed is 43797403Sobriendnl declared when using the c++ compiler 43897403Sobriendnl ASSUMES argument is a math function with TWO parameters 43997403Sobriendnl 44097403Sobriendnl GLIBCPP_CHECK_MATH_DECL_2 44197403SobrienAC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [ 44297403Sobrien AC_MSG_CHECKING([for $1 declaration]) 44397403Sobrien if test x${glibcpp_cv_func_$1_use+set} != xset; then 44497403Sobrien AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ 44597403Sobrien AC_LANG_SAVE 44697403Sobrien AC_LANG_CPLUSPLUS 44797403Sobrien AC_TRY_COMPILE([#include <math.h>], 44897403Sobrien [ $1(0, 0);], 44997403Sobrien [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) 45097403Sobrien AC_LANG_RESTORE 45197403Sobrien ]) 45297403Sobrien fi 45397403Sobrien AC_MSG_RESULT($glibcpp_cv_func_$1_use) 45497403Sobrien]) 45597403Sobrien 45697403Sobriendnl 45797403Sobriendnl Check to see if the (math function) argument passed is 45897403Sobriendnl 1) declared when using the c++ compiler 45997403Sobriendnl 2) has "C" linkage 46097403Sobriendnl 46197403Sobriendnl Define HAVE_CARGF etc if "cargf" is declared and links 46297403Sobriendnl 46397403Sobriendnl argument 1 is name of function to check 46497403Sobriendnl 46597403Sobriendnl ASSUMES argument is a math function with TWO parameters 46697403Sobriendnl 46797403Sobriendnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2 46897403SobrienAC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [ 46997403Sobrien GLIBCPP_CHECK_MATH_DECL_2($1) 47097403Sobrien if test x$glibcpp_cv_func_$1_use = x"yes"; then 47197403Sobrien AC_CHECK_FUNCS($1) 47297403Sobrien else 47397403Sobrien GLIBCPP_CHECK_MATH_DECL_2(_$1) 47497403Sobrien if test x$glibcpp_cv_func__$1_use = x"yes"; then 47597403Sobrien AC_CHECK_FUNCS(_$1) 47697403Sobrien fi 47797403Sobrien fi 47897403Sobrien]) 47997403Sobrien 48097403Sobrien 48197403Sobriendnl 48297403Sobriendnl Check to see if the (math function) argument passed is 48397403Sobriendnl declared when using the c++ compiler 48497403Sobriendnl ASSUMES argument is a math function with THREE parameters 48597403Sobriendnl 48697403Sobriendnl GLIBCPP_CHECK_MATH_DECL_3 48797403SobrienAC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [ 48897403Sobrien AC_MSG_CHECKING([for $1 declaration]) 48997403Sobrien if test x${glibcpp_cv_func_$1_use+set} != xset; then 49097403Sobrien AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ 49197403Sobrien AC_LANG_SAVE 49297403Sobrien AC_LANG_CPLUSPLUS 49397403Sobrien AC_TRY_COMPILE([#include <math.h>], 49497403Sobrien [ $1(0, 0, 0);], 49597403Sobrien [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) 49697403Sobrien AC_LANG_RESTORE 49797403Sobrien ]) 49897403Sobrien fi 49997403Sobrien AC_MSG_RESULT($glibcpp_cv_func_$1_use) 50097403Sobrien]) 50197403Sobrien 50297403Sobriendnl 50397403Sobriendnl Check to see if the (math function) argument passed is 50497403Sobriendnl 1) declared when using the c++ compiler 50597403Sobriendnl 2) has "C" linkage 50697403Sobriendnl 50797403Sobriendnl Define HAVE_CARGF etc if "cargf" is declared and links 50897403Sobriendnl 50997403Sobriendnl argument 1 is name of function to check 51097403Sobriendnl 51197403Sobriendnl ASSUMES argument is a math function with THREE parameters 51297403Sobriendnl 51397403Sobriendnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3 51497403SobrienAC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [ 51597403Sobrien GLIBCPP_CHECK_MATH_DECL_3($1) 51697403Sobrien if test x$glibcpp_cv_func_$1_use = x"yes"; then 51797403Sobrien AC_CHECK_FUNCS($1) 51897403Sobrien else 51997403Sobrien GLIBCPP_CHECK_MATH_DECL_3(_$1) 52097403Sobrien if test x$glibcpp_cv_func__$1_use = x"yes"; then 52197403Sobrien AC_CHECK_FUNCS(_$1) 52297403Sobrien fi 52397403Sobrien fi 52497403Sobrien]) 52597403Sobrien 52697403Sobrien 52797403Sobriendnl 52897403Sobriendnl Check to see if the (stdlib function) argument passed is 52997403Sobriendnl 1) declared when using the c++ compiler 53097403Sobriendnl 2) has "C" linkage 53197403Sobriendnl 53297403Sobriendnl argument 1 is name of function to check 53397403Sobriendnl 53497403Sobriendnl ASSUMES argument is a math function with TWO parameters 53597403Sobriendnl 53697403Sobriendnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2 53797403SobrienAC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [ 53897403Sobrien AC_MSG_CHECKING([for $1 declaration]) 53997403Sobrien if test x${glibcpp_cv_func_$1_use+set} != xset; then 54097403Sobrien AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ 54197403Sobrien AC_LANG_SAVE 54297403Sobrien AC_LANG_CPLUSPLUS 54397403Sobrien AC_TRY_COMPILE([#include <stdlib.h>], 54497403Sobrien [ $1(0, 0);], 54597403Sobrien [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) 54697403Sobrien AC_LANG_RESTORE 54797403Sobrien ]) 54897403Sobrien fi 54997403Sobrien AC_MSG_RESULT($glibcpp_cv_func_$1_use) 55097403Sobrien if test x$glibcpp_cv_func_$1_use = x"yes"; then 55197403Sobrien AC_CHECK_FUNCS($1) 55297403Sobrien fi 55397403Sobrien]) 55497403Sobrien 55597403Sobrien 55697403Sobriendnl 55797403Sobriendnl Check to see if the (stdlib function) argument passed is 55897403Sobriendnl 1) declared when using the c++ compiler 55997403Sobriendnl 2) has "C" linkage 56097403Sobriendnl 56197403Sobriendnl argument 1 is name of function to check 56297403Sobriendnl 56397403Sobriendnl ASSUMES argument is a function with THREE parameters 56497403Sobriendnl 56597403Sobriendnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3 56697403SobrienAC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3, [ 56797403Sobrien AC_MSG_CHECKING([for $1 declaration]) 56897403Sobrien if test x${glibcpp_cv_func_$1_use+set} != xset; then 56997403Sobrien AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ 57097403Sobrien AC_LANG_SAVE 57197403Sobrien AC_LANG_CPLUSPLUS 57297403Sobrien AC_TRY_COMPILE([#include <stdlib.h>], 57397403Sobrien [ $1(0, 0, 0);], 57497403Sobrien [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) 57597403Sobrien AC_LANG_RESTORE 57697403Sobrien ]) 57797403Sobrien fi 57897403Sobrien AC_MSG_RESULT($glibcpp_cv_func_$1_use) 57997403Sobrien if test x$glibcpp_cv_func_$1_use = x"yes"; then 58097403Sobrien AC_CHECK_FUNCS($1) 58197403Sobrien fi 58297403Sobrien]) 58397403Sobrien 58497403Sobrien 58597403Sobriendnl 58697403Sobriendnl Because the builtins are picky picky picky about the arguments they take, 58797403Sobriendnl do an explict linkage tests here. 58897403Sobriendnl Check to see if the (math function) argument passed is 58997403Sobriendnl 1) declared when using the c++ compiler 59097403Sobriendnl 2) has "C" linkage 59197403Sobriendnl 59297403Sobriendnl Define HAVE_CARGF etc if "cargf" is declared and links 59397403Sobriendnl 59497403Sobriendnl argument 1 is name of function to check 59597403Sobriendnl 59697403Sobriendnl ASSUMES argument is a math function with ONE parameter 59797403Sobriendnl 59897403Sobriendnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1 59997403SobrienAC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [ 60097403Sobrien AC_MSG_CHECKING([for $1 declaration]) 60197403Sobrien if test x${glibcpp_cv_func_$1_use+set} != xset; then 60297403Sobrien AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ 60397403Sobrien AC_LANG_SAVE 60497403Sobrien AC_LANG_CPLUSPLUS 60597403Sobrien AC_TRY_COMPILE([#include <math.h>], 60697403Sobrien [ $1(0);], 60797403Sobrien [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) 60897403Sobrien AC_LANG_RESTORE 60997403Sobrien ]) 61097403Sobrien fi 61197403Sobrien AC_MSG_RESULT($glibcpp_cv_func_$1_use) 61297403Sobrien if test x$glibcpp_cv_func_$1_use = x"yes"; then 61397403Sobrien AC_MSG_CHECKING([for $1 linkage]) 61497403Sobrien if test x${glibcpp_cv_func_$1_link+set} != xset; then 61597403Sobrien AC_CACHE_VAL(glibcpp_cv_func_$1_link, [ 61697403Sobrien AC_TRY_LINK([#include <math.h>], 61797403Sobrien [ $1(0);], 61897403Sobrien [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no]) 61997403Sobrien ]) 62097403Sobrien fi 62197403Sobrien AC_MSG_RESULT($glibcpp_cv_func_$1_link) 62297403Sobrien if test x$glibcpp_cv_func_$1_link = x"yes"; then 62397403Sobrien ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` 62497403Sobrien AC_DEFINE_UNQUOTED(${ac_tr_func}) 62597403Sobrien fi 62697403Sobrien fi 62797403Sobrien]) 62897403Sobrien 62997403Sobrien 63097403Sobriendnl 63197403Sobriendnl Check to see what builtin math functions are supported 63297403Sobriendnl 63397403Sobriendnl check for __builtin_abs 63497403Sobriendnl check for __builtin_fabsf 63597403Sobriendnl check for __builtin_fabs 63697403Sobriendnl check for __builtin_fabl 63797403Sobriendnl check for __builtin_labs 63897403Sobriendnl check for __builtin_sqrtf 63997403Sobriendnl check for __builtin_sqrtl 64097403Sobriendnl check for __builtin_sqrt 64197403Sobriendnl check for __builtin_sinf 64297403Sobriendnl check for __builtin_sin 64397403Sobriendnl check for __builtin_sinl 64497403Sobriendnl check for __builtin_cosf 64597403Sobriendnl check for __builtin_cos 64697403Sobriendnl check for __builtin_cosl 64797403Sobriendnl 64897403Sobriendnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT 64997403SobrienAC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [ 65097403Sobrien dnl Test for builtin math functions. 65197403Sobrien dnl These are made in gcc/c-common.c 65297403Sobrien GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs) 65397403Sobrien GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf) 65497403Sobrien GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs) 65597403Sobrien GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl) 65697403Sobrien GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs) 65797403Sobrien 65897403Sobrien GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf) 65997403Sobrien GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrt) 66097403Sobrien GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl) 66197403Sobrien 66297403Sobrien GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf) 66397403Sobrien GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin) 66497403Sobrien GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl) 66597403Sobrien 66697403Sobrien GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf) 66797403Sobrien GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos) 66897403Sobrien GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl) 66997403Sobrien 67097403Sobrien dnl There is, without a doubt, a more elegant way to have these 67197403Sobrien dnl names exported so that they won't be stripped out of acconfig.h by 67297403Sobrien dnl autoheader. I leave this as an exercise to somebody less frustrated 67397403Sobrien dnl than I.... please email the libstdc++ list if you can figure out a 67497403Sobrien dnl more elegant approach (see autoconf/acgen.m4 and specifically 67597403Sobrien dnl AC_CHECK_FUNC for things to steal.) 67697403Sobrien dummyvar=no 67797403Sobrien if test x$dummyvar = x"yes"; then 67897403Sobrien AC_DEFINE(HAVE___BUILTIN_ABS) 67997403Sobrien AC_DEFINE(HAVE___BUILTIN_LABS) 68097403Sobrien AC_DEFINE(HAVE___BUILTIN_COS) 68197403Sobrien AC_DEFINE(HAVE___BUILTIN_COSF) 68297403Sobrien AC_DEFINE(HAVE___BUILTIN_COSL) 68397403Sobrien AC_DEFINE(HAVE___BUILTIN_FABS) 68497403Sobrien AC_DEFINE(HAVE___BUILTIN_FABSF) 68597403Sobrien AC_DEFINE(HAVE___BUILTIN_FABSL) 68697403Sobrien AC_DEFINE(HAVE___BUILTIN_SIN) 68797403Sobrien AC_DEFINE(HAVE___BUILTIN_SINF) 68897403Sobrien AC_DEFINE(HAVE___BUILTIN_SINL) 68997403Sobrien AC_DEFINE(HAVE___BUILTIN_SQRT) 69097403Sobrien AC_DEFINE(HAVE___BUILTIN_SQRTF) 69197403Sobrien AC_DEFINE(HAVE___BUILTIN_SQRTL) 69297403Sobrien fi 69397403Sobrien]) 69497403Sobrien 69597403Sobrien 69697403Sobriendnl 69797403Sobriendnl Check to see what the underlying c library 69897403Sobriendnl These checks need to do two things: 69997403Sobriendnl 1) make sure the name is declared when using the c++ compiler 70097403Sobriendnl 2) make sure the name has "C" linkage 70197403Sobriendnl This might seem like overkill but experience has shown that it's not... 70297403Sobriendnl 70397403Sobriendnl Define HAVE_STRTOLD if "strtold" is declared and links 70497403Sobriendnl Define HAVE_STRTOF if "strtof" is declared and links 70597403Sobriendnl Define HAVE_DRAND48 if "drand48" is declared and links 70697403Sobriendnl 70797403Sobriendnl GLIBCPP_CHECK_STDLIB_SUPPORT 70897403SobrienAC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [ 70997403Sobrien ac_test_CXXFLAGS="${CXXFLAGS+set}" 71097403Sobrien ac_save_CXXFLAGS="$CXXFLAGS" 71197403Sobrien CXXFLAGS='-fno-builtins -D_GNU_SOURCE' 71297403Sobrien 71397403Sobrien GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold) 71497403Sobrien GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof) 71597403Sobrien AC_CHECK_FUNCS(drand48) 71697403Sobrien 71797403Sobrien CXXFLAGS="$ac_save_CXXFLAGS" 71897403Sobrien]) 71997403Sobrien 72097403Sobrien 72197403Sobriendnl 72297403Sobriendnl Check to see what the underlying c library or math library is like. 72397403Sobriendnl These checks need to do two things: 72497403Sobriendnl 1) make sure the name is declared when using the c++ compiler 72597403Sobriendnl 2) make sure the name has "C" linkage 72697403Sobriendnl This might seem like overkill but experience has shown that it's not... 72797403Sobriendnl 72897403Sobriendnl Define HAVE_CARGF etc if "cargf" is found. 72997403Sobriendnl 73097403Sobriendnl GLIBCPP_CHECK_MATH_SUPPORT 73197403SobrienAC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [ 73297403Sobrien ac_test_CXXFLAGS="${CXXFLAGS+set}" 73397403Sobrien ac_save_CXXFLAGS="$CXXFLAGS" 73497403Sobrien CXXFLAGS='-fno-builtins -D_GNU_SOURCE' 73597403Sobrien 73697403Sobrien dnl Check libm 73797403Sobrien AC_CHECK_LIB(m, sin, libm="-lm") 73897403Sobrien ac_save_LIBS="$LIBS" 73997403Sobrien LIBS="$LIBS $libm" 74097403Sobrien 74197403Sobrien dnl Check to see if certain C math functions exist. 74297403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf) 74397403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan) 74497403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite) 74597403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign) 74697403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos) 74797403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass) 74897403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass) 74997403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypot) 75097403Sobrien 75197403Sobrien dnl Check to see if basic C math functions have float versions. 75297403Sobrien GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig, 75397403Sobrien float_trig, 75497403Sobrien acosf asinf atanf \ 75597403Sobrien cosf sinf tanf \ 75697403Sobrien coshf sinhf tanhf) 75797403Sobrien GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round, 75897403Sobrien float_round, 75997403Sobrien ceilf floorf) 76097403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expf) 76197403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf) 76297403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff) 76397403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f) 76497403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf) 76597403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf) 76697403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf) 76797403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf) 76897403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf) 76997403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf) 77097403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f) 77197403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff) 77297403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf) 77397403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf) 77497403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf) 77597403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef) 77697403Sobrien 77797403Sobrien dnl Check to see if basic C math functions have long double versions. 77897403Sobrien GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig, 77997403Sobrien long_double_trig, 78097403Sobrien acosl asinl atanl \ 78197403Sobrien cosl sinl tanl \ 78297403Sobrien coshl sinhl tanhl) 78397403Sobrien GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round, 78497403Sobrien long_double_round, 78597403Sobrien ceill floorl) 78697403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl) 78797403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl) 78897403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl) 78997403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l) 79097403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl) 79197403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl) 79297403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl) 79397403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl) 79497403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl) 79597403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl) 79697403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl) 79797403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l) 79897403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl) 79997403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl) 80097403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl) 80197403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl) 80297403Sobrien GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel) 80397403Sobrien 80497403Sobrien dnl Some runtimes have these functions with a preceding underscore. Please 80597403Sobrien dnl keep this sync'd with the one above. And if you add any new symbol, 80697403Sobrien dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h. 80797403Sobrien dnl Check to see if certain C math functions exist. 80897403Sobrien 80997403Sobrien dnl Check to see if basic C math functions have float versions. 81097403Sobrien GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig, 81197403Sobrien _float_trig, 81297403Sobrien _acosf _asinf _atanf \ 81397403Sobrien _cosf _sinf _tanf \ 81497403Sobrien _coshf _sinhf _tanhf) 81597403Sobrien GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round, 81697403Sobrien _float_round, 81797403Sobrien _ceilf _floorf) 81897403Sobrien 81997403Sobrien dnl Check to see if basic C math functions have long double versions. 82097403Sobrien GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig, 82197403Sobrien _long_double_trig, 82297403Sobrien _acosl _asinl _atanl \ 82397403Sobrien _cosl _sinl _tanl \ 82497403Sobrien _coshl _sinhl _tanhl) 82597403Sobrien GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round, 82697403Sobrien _long_double_round, 82797403Sobrien _ceill _floorl) 82897403Sobrien 82997403Sobrien LIBS="$ac_save_LIBS" 83097403Sobrien CXXFLAGS="$ac_save_CXXFLAGS" 83197403Sobrien]) 83297403Sobrien 83397403Sobrien 83497403Sobriendnl 83597403Sobriendnl Check to see if there is native support for complex 83697403Sobriendnl 83797403Sobriendnl Don't compile bits in math/* if native support exits. 83897403Sobriendnl 83997403Sobriendnl Define USE_COMPLEX_LONG_DOUBLE etc if "copysignl" is found. 84097403Sobriendnl 84197403Sobriendnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT 84297403SobrienAC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [ 84397403Sobrien dnl Check for complex versions of math functions of platform. 84497403Sobrien AC_CHECK_LIB(m, main) 84597403Sobrien AC_REPLACE_MATHFUNCS(nan copysignf) 84697403Sobrien 84797403Sobrien dnl For __signbit to signbit conversions. 84897403Sobrien AC_CHECK_FUNCS([__signbit], , [LIBMATHOBJS="$LIBMATHOBJS signbit.lo"]) 84997403Sobrien AC_CHECK_FUNCS([__signbitf], , [LIBMATHOBJS="$LIBMATHOBJS signbitf.lo"]) 85097403Sobrien 85197403Sobrien dnl Compile the long double complex functions only if the function 85297403Sobrien dnl provides the non-complex long double functions that are needed. 85397403Sobrien dnl Currently this includes copysignl, which should be 85497403Sobrien dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above. 85597403Sobrien if test x$ac_cv_func_copysignl = x"yes"; then 85697403Sobrien AC_CHECK_FUNCS([__signbitl], , [LIBMATHOBJS="$LIBMATHOBJS signbitl.lo"]) 85797403Sobrien fi 85897403Sobrien 85997403Sobrien AC_SUBST(LIBMATHOBJS) 86097403Sobrien]) 86197403Sobrien 86297403Sobrien 86397403Sobriendnl Check to see what architecture and operating system we are compiling 86497403Sobriendnl for. Also, if architecture- or OS-specific flags are required for 86597403Sobriendnl compilation, pick them up here. 86697403Sobriendnl 86797403Sobriendnl GLIBCPP_CHECK_TARGET 86897403SobrienAC_DEFUN(GLIBCPP_CHECK_TARGET, [ 86997403Sobrien . [$]{glibcpp_basedir}/configure.target 87097403Sobrien AC_MSG_RESULT(CPU config directory is $cpu_include_dir) 87197403Sobrien AC_MSG_RESULT(OS config directory is $os_include_dir) 87297403Sobrien]) 87397403Sobrien 87497403Sobrien 87597403Sobriendnl 87697403Sobriendnl Check to see if this target can enable the wchar_t parts of libstdc++. 87797403Sobriendnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This 87897403Sobriendnl must have been previously checked.) 87997403Sobriendnl 88097403Sobriendnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found 88197403Sobriendnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h 88297403Sobriendnl 88397403Sobriendnl GLIBCPP_CHECK_WCHAR_T_SUPPORT 88497403SobrienAC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [ 88597403Sobrien 88697403Sobrien dnl Test wchar.h for mbstate_t, which is needed for char_traits and 88797403Sobrien dnl others even if wchar_t support is not on. 88897403Sobrien AC_MSG_CHECKING([for mbstate_t]) 88997403Sobrien AC_TRY_COMPILE([#include <wchar.h>], 89097403Sobrien [mbstate_t teststate;], 89197403Sobrien have_mbstate_t=yes, have_mbstate_t=no) 89297403Sobrien AC_MSG_RESULT($have_mbstate_t) 89397403Sobrien if test x"$have_mbstate_t" = xyes; then 89497403Sobrien AC_DEFINE(HAVE_MBSTATE_T) 89597403Sobrien fi 89697403Sobrien 89797403Sobrien dnl Sanity check for existence of ISO C99 headers for extended encoding. 89897403Sobrien AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no) 89997403Sobrien AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no) 90097403Sobrien 90197403Sobrien dnl Only continue checking if the ISO C99 headers exist and support is on. 90297403Sobrien if test x"$ac_has_wchar_h" = xyes && 90397403Sobrien test x"$ac_has_wctype_h" = xyes && 90497403Sobrien test x"$enable_c_mbchar" != xno; then 90597403Sobrien 90697403Sobrien dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before 90797403Sobrien dnl numeric_limits can instantiate type_traits<wchar_t> 90897403Sobrien AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX]) 90997403Sobrien AC_TRY_COMPILE([#include <wchar.h>], 91097403Sobrien [int i = WCHAR_MIN; int j = WCHAR_MAX;], 91197403Sobrien has_wchar_minmax=yes, has_wchar_minmax=no) 91297403Sobrien AC_MSG_RESULT($has_wchar_minmax) 91397403Sobrien 91497403Sobrien dnl Test wchar.h for WEOF, which is what we use to determine whether 91597403Sobrien dnl to specialize for char_traits<wchar_t> or not. 91697403Sobrien AC_MSG_CHECKING([for WEOF]) 91797403Sobrien AC_TRY_COMPILE([ 91897403Sobrien #include <wchar.h> 91997403Sobrien #include <stddef.h>], 92097403Sobrien [wint_t i = WEOF;], 92197403Sobrien has_weof=yes, has_weof=no) 92297403Sobrien AC_MSG_RESULT($has_weof) 92397403Sobrien 92497403Sobrien dnl Tests for wide character functions used in char_traits<wchar_t>. 92597403Sobrien ac_wfuncs=yes 92697403Sobrien AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset,, \ 92797403Sobrien ac_wfuncs=no) 92897403Sobrien 92997403Sobrien dnl Checks for names injected into std:: by the c_std headers. 93097403Sobrien AC_CHECK_FUNCS(btowc wctob fgetwc fgetwc fgetws fputwc fputws fwide \ 93197403Sobrien fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \ 93297403Sobrien vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \ 93397403Sobrien mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \ 93497403Sobrien wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \ 93597403Sobrien wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \ 93697403Sobrien ac_wfuncs=no) 93797403Sobrien 93897403Sobrien AC_MSG_CHECKING([for ISO C99 wchar_t support]) 93997403Sobrien if test x"$has_weof" = xyes && 94097403Sobrien test x"$has_wchar_minmax" = xyes && 94197403Sobrien test x"$ac_wfuncs" = xyes; then 94297403Sobrien ac_isoC99_wchar_t=yes 94397403Sobrien else 94497403Sobrien ac_isoC99_wchar_t=no 94597403Sobrien fi 94697403Sobrien AC_MSG_RESULT($ac_isoC99_wchar_t) 94797403Sobrien 94897403Sobrien dnl Use iconv for wchar_t to char conversions. As such, check for 94997403Sobrien dnl X/Open Portability Guide, version 2 features (XPG2). 95097403Sobrien AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no) 95197403Sobrien AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no) 95297403Sobrien 95397403Sobrien dnl Check for existence of libiconv.a providing XPG2 wchar_t support. 95497403Sobrien AC_CHECK_LIB(iconv, iconv, libiconv="-liconv") 95597403Sobrien ac_save_LIBS="$LIBS" 95697403Sobrien LIBS="$LIBS $libiconv" 95797403Sobrien 95897403Sobrien AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \ 95997403Sobrien ac_XPG2funcs=yes, ac_XPG2funcs=no) 96097403Sobrien 96197403Sobrien LIBS="$ac_save_LIBS" 96297403Sobrien 96397403Sobrien AC_MSG_CHECKING([for XPG2 wchar_t support]) 96497403Sobrien if test x"$ac_has_iconv_h" = xyes && 96597403Sobrien test x"$ac_has_langinfo_h" = xyes && 96697403Sobrien test x"$ac_XPG2funcs" = xyes; then 96797403Sobrien ac_XPG2_wchar_t=yes 96897403Sobrien else 96997403Sobrien ac_XPG2_wchar_t=no 97097403Sobrien fi 97197403Sobrien AC_MSG_RESULT($ac_XPG2_wchar_t) 97297403Sobrien 97397403Sobrien dnl At the moment, only enable wchar_t specializations if all the 97497403Sobrien dnl above support is present. 97597403Sobrien AC_MSG_CHECKING([for enabled wchar_t specializations]) 97697403Sobrien if test x"$ac_isoC99_wchar_t" = xyes && 97797403Sobrien test x"$ac_XPG2_wchar_t" = xyes; then 97897403Sobrien AC_DEFINE(_GLIBCPP_USE_WCHAR_T) 97997403Sobrien AC_MSG_RESULT("yes") 98097403Sobrien else 98197403Sobrien AC_MSG_RESULT("no") 98297403Sobrien fi 98397403Sobrien else 98497403Sobrien dnl Wide characters disabled by the user. 98597403Sobrien AC_MSG_WARN([wchar_t support disabled.]) 98697403Sobrien fi 98797403Sobrien]) 98897403Sobrien 98997403Sobrien 99097403Sobriendnl 99197403Sobriendnl Check for special debugging mode; not for production use. 99297403Sobriendnl 99397403Sobriendnl GLIBCPP_ENABLE_DEBUG 99497403Sobriendnl --enable-debug sets '-ggdb3 -O0'. 99597403Sobriendnl --disable-debug sets '-g' and whatever optimization options the 99697403Sobriendnl compiler can handle. 99797403Sobriendnl + --enable-maintainer-mode automatically defaults this to on. 99897403Sobriendnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...? 99997403Sobriendnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)] 100097403Sobriendnl Where DEFAULT is either `yes' or `no'. If ommitted, it 100197403Sobriendnl defaults to `no'. 100297403SobrienAC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl 100397403Sobriendefine([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl 100497403SobrienAC_ARG_ENABLE(debug, 100597403Sobrienchangequote(<<, >>)dnl 100697403Sobrien<< --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT], 100797403Sobrienchangequote([, ])dnl 100897403Sobrien[case "${enableval}" in 100997403Sobrien yes) enable_debug=yes ;; 101097403Sobrien no) enable_debug=no ;; 101197403Sobrien *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;; 101297403Sobrien esac], 101397403Sobrienenable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl 101497403Sobrien 101597403Sobriendnl Option parsed, now set things appropriately 101697403Sobriencase "${enable_debug}" in 101797403Sobrien yes) 101897403Sobrien DEBUG_FLAGS='-O0 -ggdb3' 101997403Sobrien ;; 102097403Sobrien no) 102197403Sobrien DEBUG_FLAGS='-g' 102297403Sobrien ;; 102397403Sobrienesac 102497403SobrienAC_SUBST(DEBUG_FLAGS) 102597403Sobrien]) 102697403Sobrien 102797403Sobrien 102897403Sobriendnl 102997403Sobriendnl Check for "unusual" flags to pass to the compiler while building. 103097403Sobriendnl 103197403Sobriendnl GLIBCPP_ENABLE_CXX_FLAGS 103297403Sobriendnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing 103397403Sobriendnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc. 103497403Sobriendnl Somehow this same set of flags must be passed when [re]building 103597403Sobriendnl libgcc. 103697403Sobriendnl --disable-cxx-flags passes nothing. 103797403Sobriendnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html 103897403Sobriendnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html 103997403Sobriendnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html 104097403Sobriendnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags) 104197403Sobriendnl If "default flags" is an empty string (or "none"), the effect is 104297403Sobriendnl the same as --disable or --enable=no. 104397403SobrienAC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl 104497403Sobriendefine([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl 104597403SobrienAC_ARG_ENABLE(cxx-flags, 104697403Sobrienchangequote(<<, >>)dnl 104797403Sobrien<< --enable-cxx-flags=FLAGS pass compiler FLAGS when building library; 104897403Sobrien [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], 104997403Sobrienchangequote([, ])dnl 105097403Sobrien[case "x$enableval" in 105197403Sobrien xyes) 105297403Sobrien AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;; 105397403Sobrien xno|x) 105497403Sobrien enable_cxx_flags='' ;; 105597403Sobrien *) 105697403Sobrien enable_cxx_flags="$enableval" ;; 105797403Sobrien esac], 105897403Sobrienenable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT') 105997403Sobrien 106097403Sobriendnl Thinko on my part during design. This kludge is the workaround. 106197403Sobrienif test "$enable_cxx_flags" = "none"; then 106297403Sobrien enable_cxx_flags=''; 106397403Sobrienfi 106497403Sobrien 106597403Sobriendnl Run through flags (either default or command-line) and set anything 106697403Sobriendnl extra (e.g., #defines) that must accompany particular g++ options. 106797403Sobrienif test -n "$enable_cxx_flags"; then 106897403Sobrien for f in $enable_cxx_flags; do 106997403Sobrien case "$f" in 107097403Sobrien -fhonor-std) ;; 107197403Sobrien -*) ;; 107297403Sobrien *) # and we're trying to pass /what/ exactly? 107397403Sobrien AC_MSG_ERROR([compiler flags start with a -]) ;; 107497403Sobrien esac 107597403Sobrien done 107697403Sobrienfi 107797403SobrienEXTRA_CXX_FLAGS="$enable_cxx_flags" 107897403SobrienAC_SUBST(EXTRA_CXX_FLAGS) 107997403Sobrien]) 108097403Sobrien 108197403Sobrien 108297403Sobriendnl 108397403Sobriendnl Check for which locale library to use: gnu or generic. 108497403Sobriendnl 108597403Sobriendnl GLIBCPP_ENABLE_CLOCALE 108697403Sobriendnl --enable-clocale=gnu sets config/locale/c_locale_gnu.cc and friends 108797403Sobriendnl --enable-clocale=generic sets config/locale/c_locale_generic.cc and friends 108897403Sobriendnl 108997403Sobriendnl default is generic 109097403Sobriendnl 109197403SobrienAC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [ 109297403Sobrien AC_MSG_CHECKING([for clocale to use]) 109397403Sobrien AC_ARG_ENABLE(clocale, 109497403Sobrien [ --enable-clocale enable model for target locale package. 109597403Sobrien --enable-clocale=MODEL use MODEL target-speific locale package. [default=generic] 109697403Sobrien ], 109797403Sobrien if test x$enable_clocale = xno; then 109897403Sobrien enable_clocale=no 109997403Sobrien fi, 110097403Sobrien enable_clocale=no) 110197403Sobrien 110297403Sobrien enable_clocale_flag=$enable_clocale 110397403Sobrien 110497403Sobrien dnl Probe for locale support if no specific model is specified. 110597403Sobrien dnl Default to "generic" 110697403Sobrien if test x$enable_clocale_flag = xno; then 110797403Sobrien case x${target_os} in 110897403Sobrien xlinux* | xgnu*) 110997403Sobrien AC_EGREP_CPP([_GLIBCPP_ok], [ 111097403Sobrien #include <features.h> 111197403Sobrien #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) 111297403Sobrien _GLIBCPP_ok 111397403Sobrien #endif 111497403Sobrien ], enable_clocale_flag=gnu, enable_clocale_flag=generic) 111597403Sobrien 111697403Sobrien # Test for bugs early in glibc-2.2.x series 111797403Sobrien if test x$enable_clocale_flag = xgnu; then 111897403Sobrien AC_TRY_RUN([ 111997403Sobrien #define _GNU_SOURCE 1 112097403Sobrien #include <locale.h> 112197403Sobrien int main() 112297403Sobrien { 112397403Sobrien const char __one[] = "�uglein Augmen"; 112497403Sobrien const char __two[] = "�uglein"; 112597403Sobrien int i; 112697403Sobrien int j; 112797403Sobrien __locale_t loc; 112897403Sobrien __locale_t loc_dup; 112997403Sobrien loc = __newlocale(1 << LC_ALL, "de_DE", 0); 113097403Sobrien loc_dup = __duplocale(loc); 113197403Sobrien i = __strcoll_l(__one, __two, loc); 113297403Sobrien j = __strcoll_l(__one, __two, loc_dup); 113397403Sobrien return 0; 113497403Sobrien } 113597403Sobrien ], 113697403Sobrien [enable_clocale_flag=gnu],[enable_clocale_flag=generic], 113797403Sobrien [enable_clocale_flag=generic]) 113897403Sobrien fi 113997403Sobrien 114097403Sobrien # ... at some point put __strxfrm_l tests in as well. 114197403Sobrien ;; 114297403Sobrien *) 114397403Sobrien enable_clocale_flag=generic 114497403Sobrien ;; 114597403Sobrien esac 114697403Sobrien fi 114797403Sobrien 114897403Sobrien dnl Deal with gettext issues. 114997403Sobrien AC_ARG_ENABLE(nls, 115097403Sobrien [ --enable-nls use Native Language Support (default)], 115197403Sobrien , enable_nls=yes) 115297403Sobrien USE_NLS=no 115397403Sobrien 115497403Sobrien dnl Set configure bits for specified locale package 115597403Sobrien case x${enable_clocale_flag} in 115697403Sobrien xgeneric) 115797403Sobrien AC_MSG_RESULT(generic) 115897403Sobrien 115997403Sobrien CLOCALE_H=config/locale/generic/c_locale.h 116097403Sobrien CLOCALE_CC=config/locale/generic/c_locale.cc 116197403Sobrien CCODECVT_H=config/locale/generic/codecvt_specializations.h 116297403Sobrien CCOLLATE_CC=config/locale/generic/collate_members.cc 116397403Sobrien CCTYPE_CC=config/locale/generic/ctype_members.cc 116497403Sobrien CMESSAGES_H=config/locale/generic/messages_members.h 116597403Sobrien CMESSAGES_CC=config/locale/generic/messages_members.cc 116697403Sobrien CMONEY_CC=config/locale/generic/monetary_members.cc 116797403Sobrien CNUMERIC_CC=config/locale/generic/numeric_members.cc 116897403Sobrien CTIME_CC=config/locale/generic/time_members.cc 116997403Sobrien ;; 117097403Sobrien xgnu) 117197403Sobrien AC_MSG_RESULT(gnu) 117297403Sobrien 117397403Sobrien # Declare intention to use gettext, and add support for specific 117497403Sobrien # languages. 117597403Sobrien # For some reason, ALL_LINGUAS has to be before AM_GNU_GETTEXT 117697403Sobrien ALL_LINGUAS="de fr" 117797403Sobrien 117897403Sobrien # Don't call AM_GNU_GETTEXT here. Instead, assume glibc. 117997403Sobrien AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) 118097403Sobrien if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then 118197403Sobrien USE_NLS=yes 118297403Sobrien fi 118397403Sobrien 118497403Sobrien # Export the build objects. 118597403Sobrien for ling in $ALL_LINGUAS; do \ 118697403Sobrien glibcpp_MOFILES="$glibcpp_MOFILES $ling.mo"; \ 118797403Sobrien glibcpp_POFILES="$glibcpp_POFILES $ling.po"; \ 118897403Sobrien done 118997403Sobrien AC_SUBST(glibcpp_MOFILES) 119097403Sobrien AC_SUBST(glibcpp_POFILES) 119197403Sobrien 119297403Sobrien CLOCALE_H=config/locale/gnu/c_locale.h 119397403Sobrien CLOCALE_CC=config/locale/gnu/c_locale.cc 119497403Sobrien CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h 119597403Sobrien CCOLLATE_CC=config/locale/gnu/collate_members.cc 119697403Sobrien CCTYPE_CC=config/locale/gnu/ctype_members.cc 119797403Sobrien CMESSAGES_H=config/locale/gnu/messages_members.h 119897403Sobrien CMESSAGES_CC=config/locale/gnu/messages_members.cc 119997403Sobrien CMONEY_CC=config/locale/gnu/monetary_members.cc 120097403Sobrien CNUMERIC_CC=config/locale/gnu/numeric_members.cc 120197403Sobrien CTIME_CC=config/locale/gnu/time_members.cc 120297403Sobrien ;; 120397403Sobrien xieee_1003.1-2001) 120497403Sobrien AC_MSG_RESULT(generic) 120597403Sobrien 120697403Sobrien CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h 120797403Sobrien CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc 120897403Sobrien CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h 120997403Sobrien CCOLLATE_CC=config/locale/generic/collate_members.cc 121097403Sobrien CCTYPE_CC=config/locale/generic/ctype_members.cc 121197403Sobrien CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h 121297403Sobrien CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc 121397403Sobrien CMONEY_CC=config/locale/generic/monetary_members.cc 121497403Sobrien CNUMERIC_CC=config/locale/generic/numeric_members.cc 121597403Sobrien CTIME_CC=config/locale/generic/time_members.cc 121697403Sobrien ;; 121797403Sobrien *) 121897403Sobrien echo "$enable_clocale is an unknown locale package" 1>&2 121997403Sobrien exit 1 122097403Sobrien ;; 122197403Sobrien esac 122297403Sobrien 122397403Sobrien # This is where the testsuite looks for locale catalogs, using the 122497403Sobrien # -DLOCALEDIR define during testsuite compilation. 122597403Sobrien glibcpp_localedir=${glibcpp_builddir}/po/share/locale 122697403Sobrien AC_SUBST(glibcpp_localedir) 122797403Sobrien 122897403Sobrien AC_SUBST(USE_NLS) 122997403Sobrien AC_SUBST(CLOCALE_H) 123097403Sobrien AC_SUBST(CCODECVT_H) 123197403Sobrien AC_SUBST(CMESSAGES_H) 123297403Sobrien AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc) 123397403Sobrien AC_LINK_FILES($CCOLLATE_CC, src/collate.cc) 123497403Sobrien AC_LINK_FILES($CCTYPE_CC, src/ctype.cc) 123597403Sobrien AC_LINK_FILES($CMESSAGES_CC, src/messages.cc) 123697403Sobrien AC_LINK_FILES($CMONEY_CC, src/monetary.cc) 123797403Sobrien AC_LINK_FILES($CNUMERIC_CC, src/numeric.cc) 123897403Sobrien AC_LINK_FILES($CTIME_CC, src/time.cc) 123997403Sobrien]) 124097403Sobrien 124197403Sobrien 124297403Sobriendnl 124397403Sobriendnl Check for which I/O library to use: libio, or something specific. 124497403Sobriendnl 124597403Sobriendnl GLIBCPP_ENABLE_CSTDIO 124697403Sobriendnl --enable-cstdio=libio sets config/io/c_io_libio.h and friends 124797403Sobriendnl 124897403Sobriendnl default is stdio 124997403Sobriendnl 125097403SobrienAC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [ 125197403Sobrien AC_MSG_CHECKING([for cstdio to use]) 125297403Sobrien AC_ARG_ENABLE(cstdio, 125397403Sobrien [ --enable-cstdio enable stdio for target io package. 125497403Sobrien --enable-cstdio=LIB use LIB target-speific io package. [default=stdio] 125597403Sobrien ], 125697403Sobrien if test x$enable_cstdio = xno; then 125797403Sobrien enable_cstdio=stdio 125897403Sobrien fi, 125997403Sobrien enable_cstdio=stdio) 126097403Sobrien 126197403Sobrien enable_cstdio_flag=$enable_cstdio 126297403Sobrien 126397403Sobrien dnl Check if a valid I/O package 126497403Sobrien case x${enable_cstdio_flag} in 126597403Sobrien xlibio) 126697403Sobrien CSTDIO_H=config/io/c_io_libio.h 126797403Sobrien BASIC_FILE_H=config/io/basic_file_libio.h 126897403Sobrien BASIC_FILE_CC=config/io/basic_file_libio.cc 126997403Sobrien AC_MSG_RESULT(libio) 127097403Sobrien 127197403Sobrien # see if we are on a system with libio native (ie, linux) 127297403Sobrien AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no) 127397403Sobrien 127497403Sobrien # Need to check and see what version of glibc is being used. If 127597403Sobrien # it's not glibc-2.2 or higher, then we'll need to go ahead and 127697403Sobrien # compile most of libio for linux systems. 127797403Sobrien if test x$has_libio = x"yes"; then 127897403Sobrien case "$target" in 127997403Sobrien *-*-linux*) 128097403Sobrien AC_MSG_CHECKING([for glibc version >= 2.2]) 128197403Sobrien AC_EGREP_CPP([ok], [ 128297403Sobrien #include <features.h> 128397403Sobrien #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) 128497403Sobrien ok 128597403Sobrien #endif 128697403Sobrien ], glibc_satisfactory=yes, glibc_satisfactory=no) 128797403Sobrien AC_MSG_RESULT($glibc_satisfactory) 128897403Sobrien ;; 128997403Sobrien esac 129097403Sobrien 129197403Sobrien # XXX at the moment, admit defeat and force the recompilation 129297403Sobrien # XXX of glibc even on glibc-2.2 systems, because libio is not synched. 129397403Sobrien glibc_satisfactory=no 129497403Sobrien 129597403Sobrien if test x$glibc_satisfactory = x"yes"; then 129697403Sobrien need_libio=no 129797403Sobrien need_wlibio=no 129897403Sobrien else 129997403Sobrien need_libio=yes 130097403Sobrien # bkoz XXX need to add checks to enable this 130197403Sobrien # pme XXX here's a first pass at such a check 130297403Sobrien if test x$enable_c_mbchar != xno; then 130397403Sobrien need_wlibio=yes 130497403Sobrien else 130597403Sobrien need_wlibio=no 130697403Sobrien fi 130797403Sobrien fi 130897403Sobrien 130997403Sobrien else 131097403Sobrien # Using libio, but <libio.h> doesn't exist on the target system. . . 131197403Sobrien need_libio=yes 131297403Sobrien # bkoz XXX need to add checks to enable this 131397403Sobrien # pme XXX here's a first pass at such a check 131497403Sobrien if test x$enable_c_mbchar != xno; then 131597403Sobrien need_wlibio=yes 131697403Sobrien else 131797403Sobrien need_wlibio=no 131897403Sobrien fi 131997403Sobrien fi 132097403Sobrien ;; 132197403Sobrien xstdio | x | xno | xnone | xyes) 132297403Sobrien # default 132397403Sobrien CSTDIO_H=config/io/c_io_stdio.h 132497403Sobrien BASIC_FILE_H=config/io/basic_file_stdio.h 132597403Sobrien BASIC_FILE_CC=config/io/basic_file_stdio.cc 132697403Sobrien AC_MSG_RESULT(stdio) 132797403Sobrien 132897403Sobrien # We're not using stdio. 132997403Sobrien need_libio=no 133097403Sobrien need_wlibio=no 133197403Sobrien ;; 133297403Sobrien *) 133397403Sobrien echo "$enable_cstdio is an unknown io package" 1>&2 133497403Sobrien exit 1 133597403Sobrien ;; 133697403Sobrien esac 133797403Sobrien AC_SUBST(CSTDIO_H) 133897403Sobrien AC_SUBST(BASIC_FILE_H) 133997403Sobrien AC_LINK_FILES($BASIC_FILE_CC, src/basic_file.cc) 134097403Sobrien 134197403Sobrien # 2000-08-04 bkoz hack 134297403Sobrien CCODECVT_C=config/io/c_io_libio_codecvt.c 134397403Sobrien AC_SUBST(CCODECVT_C) 134497403Sobrien # 2000-08-04 bkoz hack 134597403Sobrien 134697403Sobrien AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO, 134797403Sobrien test "$need_libio" = yes || test "$need_wlibio" = yes) 134897403Sobrien AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes) 134997403Sobrien AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes) 135097403Sobrien if test "$need_libio" = yes || test "$need_wlibio" = yes; then 135197403Sobrien libio_la=../libio/libio.la 135297403Sobrien else 135397403Sobrien libio_la= 135497403Sobrien fi 135597403Sobrien AC_SUBST(libio_la) 135697403Sobrien]) 135797403Sobrien 135897403Sobrien 135997403Sobriendnl 136097403Sobriendnl Setup to use the gcc gthr.h thread-specific memory and mutex model. 136197403Sobriendnl We must stage the required headers so that they will be installed 136297403Sobriendnl with the library (unlike libgcc, the STL implementation is provided 136397403Sobriendnl solely within headers). Since we must not inject random user-space 136497403Sobriendnl macro names into user-provided C++ code, we first stage into <file>-in 136597403Sobriendnl and process to <file> with an output command. The reason for a two- 136697403Sobriendnl stage process here is to correctly handle $srcdir!=$objdir without 136797403Sobriendnl having to write complex code (the sed commands to clean the macro 136897403Sobriendnl namespace are complex and fragile enough as it is). We must also 136997403Sobriendnl add a relative path so that -I- is supported properly. 137097403Sobriendnl 137197403SobrienAC_DEFUN(GLIBCPP_ENABLE_THREADS, [ 137297403Sobrien AC_MSG_CHECKING([for thread model used by GCC]) 137397403Sobrien target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` 137497403Sobrien AC_MSG_RESULT([$target_thread_file]) 137597403Sobrien 137697403Sobrien if test $target_thread_file != single; then 137797403Sobrien AC_DEFINE(HAVE_GTHR_DEFAULT) 137897403Sobrien AC_DEFINE(_GLIBCPP_SUPPORTS_WEAK, __GXX_WEAK__) 137997403Sobrien fi 138097403Sobrien 138197403Sobrien glibcpp_thread_h=gthr-$target_thread_file.h 138297403Sobrien AC_SUBST(glibcpp_thread_h) 138397403Sobrien]) 138497403Sobrien 138597403Sobrien 138697403Sobriendnl 138797403Sobriendnl Check for exception handling support. If an explicit enable/disable 138897403Sobriendnl sjlj exceptions is given, we don't have to detect. Otherwise the 138997403Sobriendnl target may or may not support call frame exceptions. 139097403Sobriendnl 139197403Sobriendnl GLIBCPP_ENABLE_SJLJ_EXCEPTIONS 139297403Sobriendnl --enable-sjlj-exceptions forces the use of builtin setjmp. 139397403Sobriendnl --disable-sjlj-exceptions forces the use of call frame unwinding. 139497403Sobriendnl 139597403Sobriendnl Define _GLIBCPP_SJLJ_EXCEPTIONS if the compiler is configured for it. 139697403Sobriendnl 139797403SobrienAC_DEFUN(GLIBCPP_ENABLE_SJLJ_EXCEPTIONS, [ 139897403Sobrien AC_MSG_CHECKING([for exception model to use]) 139997403Sobrien AC_LANG_SAVE 140097403Sobrien AC_LANG_CPLUSPLUS 140197403Sobrien AC_ARG_ENABLE(sjlj-exceptions, 140297403Sobrien [ --enable-sjlj-exceptions force use of builtin_setjmp for exceptions], 140397403Sobrien [:], 140497403Sobrien [dnl Botheration. Now we've got to detect the exception model. 140597403Sobrien dnl Link tests against libgcc.a are problematic since -- at least 140697403Sobrien dnl as of this writing -- we've not been given proper -L bits for 140797403Sobrien dnl single-tree newlib and libgloss. 140897403Sobrien dnl 140997403Sobrien dnl This is what AC_TRY_COMPILE would do if it didn't delete the 141097403Sobrien dnl conftest files before we got a change to grep them first. 141197403Sobrien cat > conftest.$ac_ext << EOF 141297403Sobrien[#]line __oline__ "configure" 141397403Sobrienstruct S { ~S(); }; 141497403Sobrienvoid bar(); 141597403Sobrienvoid foo() 141697403Sobrien{ 141797403Sobrien S s; 141897403Sobrien bar(); 141997403Sobrien} 142097403SobrienEOF 142197403Sobrien old_CXXFLAGS="$CXXFLAGS" 142297403Sobrien CXXFLAGS="-S -fexceptions" 142397403Sobrien if AC_TRY_EVAL(ac_compile); then 142497403Sobrien if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then 142597403Sobrien enable_sjlj_exceptions=yes 142697403Sobrien elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then 142797403Sobrien enable_sjlj_exceptions=no 142897403Sobrien fi 142997403Sobrien fi 143097403Sobrien CXXFLAGS="$old_CXXFLAGS" 143197403Sobrien rm -f conftest*]) 143297403Sobrien if test x$enable_sjlj_exceptions = xyes; then 143397403Sobrien AC_DEFINE(_GLIBCPP_SJLJ_EXCEPTIONS, 1, 143497403Sobrien [Define if the compiler is configured for setjmp/longjmp exceptions.]) 143597403Sobrien ac_exception_model_name=sjlj 143697403Sobrien elif test x$enable_sjlj_exceptions = xno; then 143797403Sobrien ac_exception_model_name="call frame" 143897403Sobrien else 143997403Sobrien AC_MSG_ERROR([unable to detect exception model]) 144097403Sobrien fi 144197403Sobrien AC_LANG_RESTORE 144297403Sobrien AC_MSG_RESULT($ac_exception_model_name) 144397403Sobrien]) 144497403Sobrien 144597403Sobrien 144697403Sobriendnl 144797403Sobriendnl Check for libunwind exception handling support. If enabled then 144897403Sobriendnl we assume that the _Unwind_* functions that make up the Unwind ABI 144997403Sobriendnl (_Unwind_RaiseException, _Unwind_Resume, etc.) are defined by 145097403Sobriendnl libunwind instead of libgcc and that libstdc++ has a dependency 145197403Sobriendnl on libunwind as well as libgcc. 145297403Sobriendnl 145397403Sobriendnl GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS 145497403Sobriendnl --enable-libunwind-exceptions forces the use of libunwind. 145597403Sobriendnl --disable-libunwind-exceptions assumes there is no libunwind. 145697403Sobriendnl 145797403Sobriendnl Define _GLIBCPP_LIBUNWIND_EXCEPTIONS if requested. 145897403Sobriendnl 145997403SobrienAC_DEFUN(GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS, [ 146097403Sobrien AC_MSG_CHECKING([for use of libunwind]) 146197403Sobrien AC_ARG_ENABLE(libunwind-exceptions, 146297403Sobrien [ --enable-libunwind-exceptions force use of libunwind for exceptions], 146397403Sobrien use_libunwind_exceptions=$enableval, 146497403Sobrien use_libunwind_exceptions=no) 146597403Sobrien AC_MSG_RESULT($use_libunwind_exceptions) 146697403Sobrien dnl Option parsed, now set things appropriately 146797403Sobrien if test x"$use_libunwind_exceptions" = xyes; then 146897403Sobrien LIBUNWIND_FLAG="-lunwind" 146997403Sobrien else 147097403Sobrien LIBUNWIND_FLAG="" 147197403Sobrien fi 147297403Sobrien AC_SUBST(LIBUNWIND_FLAG) 147397403Sobrien]) 147497403Sobrien 147597403Sobriendnl 147697403Sobriendnl Check for ISO/IEC 9899:1999 "C99" support. 147797403Sobriendnl 147897403Sobriendnl GLIBCPP_ENABLE_C99 147997403Sobriendnl --enable-c99 defines _GLIBCPP_USE_C99 148097403Sobriendnl --disable-c99 leaves _GLIBCPP_USE_C99 undefined 148197403Sobriendnl + Usage: GLIBCPP_ENABLE_C99[(DEFAULT)] 148297403Sobriendnl Where DEFAULT is either `yes' or `no'. If omitted, it 148397403Sobriendnl defaults to `no'. 148497403Sobriendnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'. 148597403Sobriendnl 148697403Sobriendnl GLIBCPP_ENABLE_C99 148797403SobrienAC_DEFUN(GLIBCPP_ENABLE_C99, [dnl 148897403Sobrien define([GLIBCPP_ENABLE_C99_DEFAULT], ifelse($1, yes, yes, no))dnl 148997403Sobrien 149097403Sobrien AC_ARG_ENABLE(c99, 149197403Sobrien changequote(<<, >>)dnl 149297403Sobrien <<--enable-c99 turns on 'ISO/IEC 9899:1999 support' [default=>>GLIBCPP_ENABLE_C99_DEFAULT], 149397403Sobrien changequote([, ])dnl 149497403Sobrien [case "$enableval" in 149597403Sobrien yes) enable_c99=yes ;; 149697403Sobrien no) enable_c99=no ;; 149797403Sobrien *) AC_MSG_ERROR([Unknown argument to enable/disable C99]) ;; 149897403Sobrien esac], 149997403Sobrien enable_c99=GLIBCPP_ENABLE_C99_DEFAULT)dnl 150097403Sobrien 150197403Sobrien AC_LANG_SAVE 150297403Sobrien AC_LANG_CPLUSPLUS 150397403Sobrien 150497403Sobrien # Check for the existence of <math.h> functions used if C99 is enabled. 150597403Sobrien ac_c99_math=yes; 150697403Sobrien AC_MSG_CHECKING([for ISO C99 support in <math.h>]) 150797403Sobrien AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no]) 150897403Sobrien AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no]) 150997403Sobrien AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no]) 151097403Sobrien AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no]) 151197403Sobrien AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no]) 151297403Sobrien AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no]) 151397403Sobrien AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no]) 151497403Sobrien AC_TRY_COMPILE([#include <math.h>], 151597403Sobrien [isgreaterequal(0.0,0.0);],, [ac_c99_math=no]) 151697403Sobrien AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no]) 151797403Sobrien AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no]) 151897403Sobrien AC_TRY_COMPILE([#include <math.h>], 151997403Sobrien [islessgreater(0.0,0.0);],, [ac_c99_math=no]) 152097403Sobrien AC_TRY_COMPILE([#include <math.h>], 152197403Sobrien [isunordered(0.0,0.0);],, [ac_c99_math=no]) 152297403Sobrien AC_MSG_RESULT($ac_c99_math) 152397403Sobrien 152497403Sobrien # Check for the existence in <stdio.h> of vscanf, et. al. 152597403Sobrien ac_c99_stdio=yes; 152697403Sobrien AC_MSG_CHECKING([for ISO C99 support in <stdio.h>]) 152797403Sobrien AC_TRY_COMPILE([#include <stdio.h>], 152897403Sobrien [snprintf("12", 0, "%i");],, [ac_c99_stdio=no]) 152997403Sobrien AC_TRY_COMPILE([#include <stdio.h> 153097403Sobrien #include <stdarg.h> 153197403Sobrien void foo(char* fmt, ...) 153297403Sobrien {va_list args; va_start(args, fmt); 153397403Sobrien vfscanf(stderr, "%i", args);}], 153497403Sobrien [],, [ac_c99_stdio=no]) 153597403Sobrien AC_TRY_COMPILE([#include <stdio.h> 153697403Sobrien #include <stdarg.h> 153797403Sobrien void foo(char* fmt, ...) 153897403Sobrien {va_list args; va_start(args, fmt); 153997403Sobrien vscanf("%i", args);}], 154097403Sobrien [],, [ac_c99_stdio=no]) 154197403Sobrien AC_TRY_COMPILE([#include <stdio.h> 154297403Sobrien #include <stdarg.h> 154397403Sobrien void foo(char* fmt, ...) 154497403Sobrien {va_list args; va_start(args, fmt); 154597403Sobrien vsnprintf(fmt, 0, "%i", args);}], 154697403Sobrien [],, [ac_c99_stdio=no]) 154797403Sobrien AC_TRY_COMPILE([#include <stdio.h> 154897403Sobrien #include <stdarg.h> 154997403Sobrien void foo(char* fmt, ...) 155097403Sobrien {va_list args; va_start(args, fmt); 155197403Sobrien vsscanf(fmt, "%i", args);}], 155297403Sobrien [],, [ac_c99_stdio=no]) 155397403Sobrien AC_MSG_RESULT($ac_c99_stdio) 155497403Sobrien 155597403Sobrien # Check for the existence in <stdlib.h> of lldiv_t, et. al. 155697403Sobrien ac_c99_stdlib=yes; 155797403Sobrien AC_MSG_CHECKING([for lldiv_t declaration]) 155897403Sobrien AC_CACHE_VAL(ac_c99_lldiv_t, [ 155997403Sobrien AC_TRY_COMPILE([#include <stdlib.h>], 156097403Sobrien [ lldiv_t mydivt;], 156197403Sobrien [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no]) 156297403Sobrien ]) 156397403Sobrien AC_MSG_RESULT($ac_c99_lldiv_t) 156497403Sobrien 156597403Sobrien AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>]) 156697403Sobrien AC_TRY_COMPILE([#include <stdlib.h>], 156797403Sobrien [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no]) 156897403Sobrien AC_TRY_COMPILE([#include <stdlib.h>], 156997403Sobrien [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no]) 157097403Sobrien AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no]) 157197403Sobrien AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no]) 157297403Sobrien AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no]) 157397403Sobrien AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no]) 157497403Sobrien if test x"$ac_c99_lldiv_t" = x"no"; then 157597403Sobrien ac_c99_stdlib=no; 157697403Sobrien fi; 157797403Sobrien AC_MSG_RESULT($ac_c99_stdlib) 157897403Sobrien 157997403Sobrien # Check for the existence of <wchar.h> functions used if C99 is enabled. 158097403Sobrien # XXX the wchar.h checks should be rolled into the general C99 bits. 158197403Sobrien ac_c99_wchar=yes; 158297403Sobrien AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>]) 158397403Sobrien AC_TRY_COMPILE([#include <wchar.h>], 158497403Sobrien [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no]) 158597403Sobrien AC_TRY_COMPILE([#include <wchar.h>], 158697403Sobrien [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no]) 158797403Sobrien AC_TRY_COMPILE([#include <wchar.h>], 158897403Sobrien [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no]) 158997403Sobrien AC_MSG_RESULT($ac_c99_wchar) 159097403Sobrien 159197403Sobrien AC_MSG_CHECKING([for enabled ISO C99 support]) 159297403Sobrien if test x"$ac_c99_math" = x"no" || 159397403Sobrien test x"$ac_c99_stdio" = x"no" || 159497403Sobrien test x"$ac_c99_stdlib" = x"no" || 159597403Sobrien test x"$ac_c99_wchar" = x"no"; then 159697403Sobrien enable_c99=no; 159797403Sobrien fi; 159897403Sobrien AC_MSG_RESULT($enable_c99) 159997403Sobrien 160097403Sobrien # Option parsed, now set things appropriately 160197403Sobrien if test x"$enable_c99" = x"yes"; then 160297403Sobrien AC_DEFINE(_GLIBCPP_USE_C99) 160397403Sobrien fi 160497403Sobrien 160597403Sobrien AC_LANG_RESTORE 160697403Sobrien]) 160797403Sobrien 160897403Sobrien 160997403Sobriendnl 161097403Sobriendnl Check for template specializations for the 'long long' type extension. 161197403Sobriendnl The result determines only whether 'long long' I/O is enabled; things 161297403Sobriendnl like numeric_limits<> specializations are always available. 161397403Sobriendnl 161497403Sobriendnl GLIBCPP_ENABLE_LONG_LONG 161597403Sobriendnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG 161697403Sobriendnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined 161797403Sobriendnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)] 161897403Sobriendnl Where DEFAULT is either `yes' or `no'. If omitted, it 161997403Sobriendnl defaults to `no'. 162097403Sobriendnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'. 162197403Sobriendnl 162297403Sobriendnl GLIBCPP_ENABLE_LONG_LONG 162397403SobrienAC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl 162497403Sobrien define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl 162597403Sobrien 162697403Sobrien AC_ARG_ENABLE(long-long, 162797403Sobrien changequote(<<, >>)dnl 162897403Sobrien <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT], 162997403Sobrien changequote([, ])dnl 163097403Sobrien [case "$enableval" in 163197403Sobrien yes) enable_long_long=yes ;; 163297403Sobrien no) enable_long_long=no ;; 163397403Sobrien *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;; 163497403Sobrien esac], 163597403Sobrien enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl 163697403Sobrien 163797403Sobrien AC_LANG_SAVE 163897403Sobrien AC_LANG_CPLUSPLUS 163997403Sobrien 164097403Sobrien AC_MSG_CHECKING([for enabled long long I/O support]) 164197403Sobrien # iostreams require strtoll, strtoull to compile 164297403Sobrien AC_TRY_COMPILE([#include <stdlib.h>], 164397403Sobrien [char* tmp; strtoll("gnu", &tmp, 10);],,[enable_long_long=no]) 164497403Sobrien AC_TRY_COMPILE([#include <stdlib.h>], 164597403Sobrien [char* tmp; strtoull("gnu", &tmp, 10);],,[enable_long_long=no]) 164697403Sobrien 164797403Sobrien # Option parsed, now set things appropriately 164897403Sobrien if test x"$enable_long_long" = xyes; then 164997403Sobrien AC_DEFINE(_GLIBCPP_USE_LONG_LONG) 165097403Sobrien fi 165197403Sobrien AC_MSG_RESULT($enable_long_long) 165297403Sobrien 165397403Sobrien AC_LANG_RESTORE 165497403Sobrien]) 165597403Sobrien 165697403Sobrien 165797403Sobriendnl 165897403Sobriendnl Check for what kind of C headers to use. 165997403Sobriendnl 166097403Sobriendnl GLIBCPP_ENABLE_CHEADERS 166197403Sobriendnl --enable-cheaders= [does stuff]. 166297403Sobriendnl --disable-cheaders [does not do anything, really]. 166397403Sobriendnl + This will eventually need to be 'c_shadow' by default. 166497403Sobriendnl + Usage: GLIBCPP_ENABLE_CHEADERS[(DEFAULT)] 166597403Sobriendnl Where DEFAULT is either `c' or `c_std' or 'c_shadow'. 166697403Sobriendnl If ommitted, it defaults to `c_std'. 166797403SobrienAC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl 166897403Sobriendefine([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl 166997403SobrienAC_MSG_CHECKING([for c header strategy to use]) 167097403SobrienAC_ARG_ENABLE(cheaders, 167197403Sobrienchangequote(<<, >>)dnl 167297403Sobrien<< --enable-cheaders construct "C" header files for g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT], 167397403Sobrienchangequote([, ]) 167497403Sobrien [case "$enableval" in 167597403Sobrien c) 167697403Sobrien enable_cheaders=c 167797403Sobrien ;; 167897403Sobrien c_std) 167997403Sobrien enable_cheaders=c_std 168097403Sobrien ;; 168197403Sobrien c_shadow) 168297403Sobrien enable_cheaders=c_shadow 168397403Sobrien ;; 168497403Sobrien *) AC_MSG_ERROR([Unknown argument to enable/disable "C" headers]) 168597403Sobrien ;; 168697403Sobrien esac], 168797403Sobrien enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT) 168897403Sobrien AC_MSG_RESULT($enable_cheaders) 168997403Sobrien 169097403Sobrien dnl Option parsed, now set things appropriately 169197403Sobrien case "$enable_cheaders" in 169297403Sobrien c_shadow) 169397403Sobrien CSHADOW_FLAGS="-fno-builtin" 169497403Sobrien C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_shadow' 169597403Sobrien ;; 169697403Sobrien c_std) 169797403Sobrien CSHADOW_FLAGS="" 169897403Sobrien C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_std' 169997403Sobrien ;; 170097403Sobrien c) 170197403Sobrien CSHADOW_FLAGS="" 170297403Sobrien C_INCLUDE_DIR='${glibcpp_srcdir}/include/c' 170397403Sobrien ;; 170497403Sobrien esac 170597403Sobrien 170697403Sobrien AC_SUBST(CSHADOW_FLAGS) 170797403Sobrien AC_SUBST(C_INCLUDE_DIR) 170897403Sobrien AM_CONDITIONAL(GLIBCPP_C_HEADERS_C, test "$enable_cheaders" = c) 170997403Sobrien AM_CONDITIONAL(GLIBCPP_C_HEADERS_C_STD, test "$enable_cheaders" = c_std) 171097403Sobrien]) 171197403Sobrien 171297403Sobrien 171397403Sobriendnl 171497403Sobriendnl Check for wide character support. Has the same effect as the option 171597403Sobriendnl in gcc's configure, but in a form that autoconf can mess with. 171697403Sobriendnl 171797403Sobriendnl GLIBCPP_ENABLE_C_MBCHAR 171897403Sobriendnl --enable-c-mbchar requests all the wchar_t stuff. 171997403Sobriendnl --disable-c-mbchar doesn't. 172097403Sobriendnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)] 172197403Sobriendnl Where DEFAULT is either `yes' or `no'. If ommitted, it 172297403Sobriendnl defaults to `no'. 172397403SobrienAC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl 172497403Sobriendefine([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl 172597403SobrienAC_ARG_ENABLE(c-mbchar, 172697403Sobrienchangequote(<<, >>)dnl 172797403Sobrien<< --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], 172897403Sobrienchangequote([, ])dnl 172997403Sobrien[case "$enableval" in 173097403Sobrien yes) enable_c_mbchar=yes ;; 173197403Sobrien no) enable_c_mbchar=no ;; 173297403Sobrien *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;; 173397403Sobrien esac], 173497403Sobrienenable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl 173597403Sobriendnl Option parsed, now other scripts can test enable_c_mbchar for yes/no. 173697403Sobrien]) 173797403Sobrien 173897403Sobrien 173997403Sobriendnl 174097403Sobriendnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's. 174197403Sobriendnl 174297403Sobriendnl TOPLEVEL_INCLUDES 174397403Sobriendnl LIBMATH_INCLUDES 174497403Sobriendnl LIBSUPCXX_INCLUDES 174597403Sobriendnl LIBIO_INCLUDES 174697403Sobriendnl CSHADOW_INCLUDES 174797403Sobriendnl 174897403Sobriendnl GLIBCPP_EXPORT_INCLUDES 174997403SobrienAC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [ 175097403Sobrien # Root level of the build directory include sources. 175197403Sobrien GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include" 175297403Sobrien 175397403Sobrien # Passed down for canadian crosses. 175497403Sobrien if test x"$CANADIAN" = xyes; then 175597403Sobrien TOPLEVEL_INCLUDES='-I$(includedir)' 175697403Sobrien fi 175797403Sobrien 175897403Sobrien LIBMATH_INCLUDES='-I$(top_srcdir)/libmath' 175997403Sobrien 176097403Sobrien LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++' 176197403Sobrien 176297403Sobrien if test x"$need_libio" = xyes; then 176397403Sobrien LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio' 176497403Sobrien AC_SUBST(LIBIO_INCLUDES) 176597403Sobrien fi 176697403Sobrien 176797403Sobrien # Now, export this to all the little Makefiles.... 176897403Sobrien AC_SUBST(GLIBCPP_INCLUDES) 176997403Sobrien AC_SUBST(TOPLEVEL_INCLUDES) 177097403Sobrien AC_SUBST(LIBMATH_INCLUDES) 177197403Sobrien AC_SUBST(LIBSUPCXX_INCLUDES) 177297403Sobrien]) 177397403Sobrien 177497403Sobrien 177597403Sobriendnl 177697403Sobriendnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's. 177797403Sobriendnl 177897403SobrienAC_DEFUN(GLIBCPP_EXPORT_FLAGS, [ 177997403Sobrien # Optimization flags that are probably a good idea for thrill-seekers. Just 178097403Sobrien # uncomment the lines below and make, everything else is ready to go... 178197403Sobrien # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc 178297403Sobrien OPTIMIZE_CXXFLAGS= 178397403Sobrien AC_SUBST(OPTIMIZE_CXXFLAGS) 178497403Sobrien 178597403Sobrien WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline' 178697403Sobrien AC_SUBST(WARN_FLAGS) 178797403Sobrien]) 178897403Sobrien 178997403Sobriendnl 179097403Sobriendnl GLIBCPP_EXPORT_INSTALL_INFO 179197403Sobriendnl calculates gxx_install_dir 179297403Sobriendnl exports glibcpp_toolexecdir 179397403Sobriendnl exports glibcpp_toolexeclibdir 179497403Sobriendnl exports glibcpp_prefixdir 179597403Sobriendnl 179697403Sobriendnl Assumes cross_compiling bits already done, and with_cross_host in 179797403Sobriendnl particular 179897403Sobriendnl 179997403Sobriendnl GLIBCPP_EXPORT_INSTALL_INFO 180097403SobrienAC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [ 180197403Sobrien# Assumes glibcpp_builddir, glibcpp_srcdir are alreay set up and 180297403Sobrien# exported correctly in GLIBCPP_CONFIGURE. 180397403Sobrienglibcpp_toolexecdir=no 180497403Sobrienglibcpp_toolexeclibdir=no 180597403Sobrienglibcpp_prefixdir=${prefix} 180697403Sobrien 180797403SobrienAC_MSG_CHECKING([for interface version number]) 180897403Sobrienlibstdcxx_interface=$INTERFACE 180997403SobrienAC_MSG_RESULT($libstdcxx_interface) 181097403Sobrien 181197403Sobrien# Process the option --with-gxx-include-dir=<path to include-files directory> 181297403SobrienAC_MSG_CHECKING([for --with-gxx-include-dir]) 181397403SobrienAC_ARG_WITH(gxx-include-dir, 181497403Sobrien[ --with-gxx-include-dir the installation directory for include files], 181597403Sobrien[case "${withval}" in 181697403Sobrien yes) 181797403Sobrien AC_MSG_ERROR(Missing directory for --with-gxx-include-dir) 181897403Sobrien gxx_include_dir=no 181997403Sobrien ;; 182097403Sobrien no) 182197403Sobrien gxx_include_dir=no 182297403Sobrien ;; 182397403Sobrien *) 182497403Sobrien gxx_include_dir=${withval} 182597403Sobrien ;; 182697403Sobrienesac], [gxx_include_dir=no]) 182797403SobrienAC_MSG_RESULT($gxx_include_dir) 182897403Sobrien 182997403Sobrien# Process the option "--enable-version-specific-runtime-libs" 183097403SobrienAC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) 183197403SobrienAC_ARG_ENABLE(version-specific-runtime-libs, 183297403Sobrien[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ], 183397403Sobrien[case "$enableval" in 183497403Sobrien yes) version_specific_libs=yes ;; 183597403Sobrien no) version_specific_libs=no ;; 183697403Sobrien *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; 183797403Sobrien esac], 183897403Sobrienversion_specific_libs=no)dnl 183997403Sobrien# Option set, now we can test it. 184097403SobrienAC_MSG_RESULT($version_specific_libs) 184197403Sobrien 184297403Sobrienif test $version_specific_libs = yes; then 184397403Sobrien # Need the gcc compiler version to know where to install libraries 184497403Sobrien # and header files if --enable-version-specific-runtime-libs option 184597403Sobrien # is selected. 184697403Sobrien changequote(,)dnl 184797403Sobrien gcc_version_trigger=${srcdir}/../gcc/version.c 184897403Sobrien gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'` 184997403Sobrien gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'` 185097403Sobrien if test x"$gxx_include_dir" = x"no"; then 185197403Sobrien gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/g++ 185297403Sobrien fi 185397403Sobrien glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)' 185497403Sobrien glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)' 185597403Sobrien changequote([,])dnl 185697403Sobrienfi 185797403Sobrien 185897403Sobrien# Default case for install directory for include files. 185997403Sobrienif test $version_specific_libs = no && 186097403Sobrien test $gxx_include_dir = no; then 186197403Sobrien gxx_include_dir='$(prefix)'/include/g++-${libstdcxx_interface} 186297403Sobrienfi 186397403Sobrien 186497403Sobrien# Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir 186597403Sobrien# Install a library built with a cross compiler in tooldir, not libdir. 186697403Sobrienif test x"$glibcpp_toolexecdir" = x"no"; then 186797403Sobrien if test -n "$with_cross_host" && 186897403Sobrien test x"$with_cross_host" != x"no"; then 186997403Sobrien glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)' 187097403Sobrien glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)' 187197403Sobrien else 187297403Sobrien glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)' 187397403Sobrien glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)' 187497403Sobrien fi 187597403Sobrienfi 187697403Sobrien 187797403SobrienAC_MSG_CHECKING([for install location]) 187897403SobrienAC_MSG_RESULT($gxx_include_dir) 187997403Sobrien 188097403SobrienAC_SUBST(glibcpp_prefixdir) 188197403SobrienAC_SUBST(gxx_include_dir) 188297403SobrienAC_SUBST(glibcpp_toolexecdir) 188397403SobrienAC_SUBST(glibcpp_toolexeclibdir) 188497403Sobrien]) 188597403Sobrien 188697403Sobrien 188797403Sobrien# Check for functions in math library. 188897403Sobrien# Ulrich Drepper <drepper@cygnus.com>, 1998. 188997403Sobrien# 189097403Sobrien# This file can be copied and used freely without restrictions. It can 189197403Sobrien# be used in projects which are not available under the GNU Public License 189297403Sobrien# but which still want to provide support for the GNU gettext functionality. 189397403Sobrien# Please note that the actual code is *not* freely available. 189497403Sobrien 189597403Sobrien# serial 1 189697403Sobrien 189797403Sobriendnl AC_REPLACE_MATHFUNCS(FUNCTION...) 189897403SobrienAC_DEFUN(AC_REPLACE_MATHFUNCS, 189997403Sobrien[AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])]) 190097403Sobrien 190197403Sobrien 190297403Sobriendnl This macro searches for a GNU version of make. If a match is found, the 190397403Sobriendnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is 190497403Sobriendnl set to "#". This is useful for including a special features in a Makefile, 190597403Sobriendnl which cannot be handled by other versions of make. The variable 190697403Sobriendnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists, 190797403Sobriendnl the empty string otherwise. 190897403Sobriendnl 190997403Sobriendnl Here is an example of its use: 191097403Sobriendnl 191197403Sobriendnl Makefile.in might contain: 191297403Sobriendnl 191397403Sobriendnl # A failsafe way of putting a dependency rule into a makefile 191497403Sobriendnl $(DEPEND): 191597403Sobriendnl $(CC) -MM $(srcdir)/*.c > $(DEPEND) 191697403Sobriendnl 191797403Sobriendnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND))) 191897403Sobriendnl @ifGNUmake@ include $(DEPEND) 191997403Sobriendnl @ifGNUmake@ endif 192097403Sobriendnl 192197403Sobriendnl Then configure.in would normally contain: 192297403Sobriendnl 192397403Sobriendnl CHECK_GNU_MAKE() 192497403Sobriendnl AC_OUTPUT(Makefile) 192597403Sobriendnl 192697403Sobriendnl Then perhaps to cause gnu make to override any other make, we could do 192797403Sobriendnl something like this (note that GNU make always looks for GNUmakefile first): 192897403Sobriendnl 192997403Sobriendnl if ! test x$_cv_gnu_make_command = x ; then 193097403Sobriendnl mv Makefile GNUmakefile 193197403Sobriendnl echo .DEFAULT: > Makefile ; 193297403Sobriendnl echo \ $_cv_gnu_make_command \$@ >> Makefile; 193397403Sobriendnl fi 193497403Sobriendnl 193597403Sobriendnl Then, if any (well almost any) other make is called, and GNU make also 193697403Sobriendnl exists, then the other make wraps the GNU make. 193797403Sobriendnl 193897403Sobriendnl @author John Darrington <j.darrington@elvis.murdoch.edu.au> 193997403Sobriendnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme 194097403Sobriendnl 194197403Sobriendnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending 194297403Sobriendnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the 194397403Sobriendnl #### conditional's subshell (" --version" is not a command), using a 194497403Sobriendnl #### different option to grep(1). 194597403Sobriendnl #### -pme 194697403Sobriendnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not 194797403Sobriendnl #### ${MAKE:-make}). 194897403Sobriendnl #### -msokolov 194997403SobrienAC_DEFUN( 195097403Sobrien GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command, 195197403Sobrien _cv_gnu_make_command='' ; 195297403Sobriendnl Search all the common names for GNU make 195397403Sobrien for a in "${MAKE-make}" make gmake gnumake ; do 195497403Sobrien if ( $a --version 2> /dev/null | grep -c GNU > /dev/null ) 195597403Sobrien then 195697403Sobrien _cv_gnu_make_command=$a ; 195797403Sobrien break; 195897403Sobrien fi 195997403Sobrien done ; 196097403Sobrien ) ; 196197403Sobriendnl If there was a GNU version, then set @ifGNUmake@ to the empty 196297403Sobriendnl string, '#' otherwise 196397403Sobrien if test "x$_cv_gnu_make_command" != "x" ; then 196497403Sobrien ifGNUmake='' ; 196597403Sobrien else 196697403Sobrien ifGNUmake='#' ; 196797403Sobrien fi 196897403Sobrien AC_SUBST(ifGNUmake) 196997403Sobrien]) 197097403Sobrien 197197403Sobrien 197297403Sobriendnl Check for headers for, and arguments to, the setrlimit() function. 197397403Sobriendnl Used only in testsuite_hooks.h. 197497403SobrienAC_DEFUN(GLIBCPP_CHECK_SETRLIMIT_ancilliary, [ 197597403Sobrien AC_TRY_COMPILE([#include <sys/resource.h> 197697403Sobrien #include <unistd.h> 197797403Sobrien ], [ int f = RLIMIT_$1 ; ], 197897403Sobrien [glibcpp_mresult=1], [glibcpp_mresult=0]) 197997403Sobrien AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcpp_mresult, 198097403Sobrien [Only used in build directory testsuite_hooks.h.]) 198197403Sobrien]) 198297403SobrienAC_DEFUN(GLIBCPP_CHECK_SETRLIMIT, [ 198397403Sobrien setrlimit_have_headers=yes 198497403Sobrien AC_CHECK_HEADERS(sys/resource.h unistd.h, 198597403Sobrien [], 198697403Sobrien setrlimit_have_headers=no) 198797403Sobrien # If don't have the headers, then we can't run the tests now, and we 198897403Sobrien # won't be seeing any of these during testsuite compilation. 198997403Sobrien if test $setrlimit_have_headers = yes; then 199097403Sobrien # Can't do these in a loop, else the resulting syntax is wrong. 199197403Sobrien GLIBCPP_CHECK_SETRLIMIT_ancilliary(DATA) 199297403Sobrien GLIBCPP_CHECK_SETRLIMIT_ancilliary(RSS) 199397403Sobrien GLIBCPP_CHECK_SETRLIMIT_ancilliary(VMEM) 199497403Sobrien GLIBCPP_CHECK_SETRLIMIT_ancilliary(AS) 199597403Sobrien 199697403Sobrien # Check for rlimit, setrlimit. 199797403Sobrien AC_CACHE_VAL(ac_setrlimit, [ 199897403Sobrien AC_TRY_COMPILE([#include <sys/resource.h> 199997403Sobrien #include <unistd.h> 200097403Sobrien ], 200197403Sobrien [ struct rlimit r; setrlimit(0, &r);], 200297403Sobrien [ac_setrlimit=yes], [ac_setrlimit=no]) 200397403Sobrien ]) 200497403Sobrien fi 200597403Sobrien 200697403Sobrien AC_MSG_CHECKING([for testsuite memory limit support]) 200797403Sobrien if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then 200897403Sobrien ac_mem_limits=yes 200997403Sobrien AC_DEFINE(_GLIBCPP_MEM_LIMITS) 201097403Sobrien else 201197403Sobrien ac_mem_limits=no 201297403Sobrien fi 201397403Sobrien AC_MSG_RESULT($ac_mem_limits) 201497403Sobrien]) 201597403Sobrien 201697403Sobrien 201797403Sobriendnl 201897403Sobriendnl Does any necessary configuration of the testsuite directory. Generates 201997403Sobriendnl the testsuite_hooks.h header. 202097403Sobriendnl 202197403Sobriendnl GLIBCPP_CONFIGURE_TESTSUITE [no args] 202297403SobrienAC_DEFUN(GLIBCPP_CONFIGURE_TESTSUITE, [ 202397403Sobrien GLIBCPP_CHECK_SETRLIMIT 202497403Sobrien 202597403Sobrien # Look for setenv, so that extended locale tests can be performed. 202697403Sobrien GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv) 202797403Sobrien]) 202897403Sobrien 202997403Sobrien 203097403Sobriensinclude(../libtool.m4) 203197403Sobriendnl The lines below arrange for aclocal not to bring an installed 203297403Sobriendnl libtool.m4 into aclocal.m4, while still arranging for automake to 203397403Sobriendnl add a definition of LIBTOOL to Makefile.in. 203497403Sobrienifelse(,,,[AC_SUBST(LIBTOOL) 203597403SobrienAC_DEFUN([AM_PROG_LIBTOOL]) 203697403SobrienAC_DEFUN([AC_LIBTOOL_DLOPEN]) 203797403SobrienAC_DEFUN([AC_PROG_LD]) 203897403Sobrien]) 203997403Sobrien 204097403Sobrien 204197403Sobrien# Check whether LC_MESSAGES is available in <locale.h>. 204297403Sobrien# Ulrich Drepper <drepper@cygnus.com>, 1995. 204397403Sobrien# 204497403Sobrien# This file file be copied and used freely without restrictions. It can 204597403Sobrien# be used in projects which are not available under the GNU Public License 204697403Sobrien# but which still want to provide support for the GNU gettext functionality. 204797403Sobrien# Please note that the actual code is *not* freely available. 204897403Sobrien 204997403Sobrien# serial 1 205097403Sobrien 205197403SobrienAC_DEFUN(AC_LC_MESSAGES, [ 205297403Sobrien AC_CHECK_HEADER(locale.h, [ 205397403Sobrien AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES, 205497403Sobrien [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], 205597403Sobrien ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)]) 205697403Sobrien if test $ac_cv_val_LC_MESSAGES = yes; then 205797403Sobrien AC_DEFINE(HAVE_LC_MESSAGES) 205897403Sobrien fi 205997403Sobrien ]) 206097403Sobrien]) 206197403Sobrien 206297403Sobrien 206397403Sobriendnl 206497403Sobriendnl Check for whether the Boost-derived checks should be turned on. 206597403Sobriendnl 206697403Sobriendnl GLIBCPP_ENABLE_CONCEPT_CHECKS 206797403Sobriendnl --enable-concept-checks turns them on. 206897403Sobriendnl --disable-concept-checks leaves them off. 206997403Sobriendnl + Usage: GLIBCPP_ENABLE_CONCEPT_CHECKS[(DEFAULT)] 207097403Sobriendnl Where DEFAULT is either `yes' or `no'. If ommitted, it 207197403Sobriendnl defaults to `no'. 207297403SobrienAC_DEFUN(GLIBCPP_ENABLE_CONCEPT_CHECKS, [dnl 207397403Sobriendefine([GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT], ifelse($1, yes, yes, no))dnl 207497403SobrienAC_ARG_ENABLE(concept-checks, 207597403Sobrienchangequote(<<, >>)dnl 207697403Sobrien<< --enable-concept-checks use Boost-derived template checks [default=>>GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT], 207797403Sobrienchangequote([, ])dnl 207897403Sobrien[case "$enableval" in 207997403Sobrien yes) enable_concept_checks=yes ;; 208097403Sobrien no) enable_concept_checks=no ;; 208197403Sobrien *) AC_MSG_ERROR([Unknown argument to enable/disable concept checks]) ;; 208297403Sobrien esac], 208397403Sobrienenable_concept_checks=GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT)dnl 208497403Sobriendnl Option parsed, now set things appropriately 208597403Sobrienif test x"$enable_concept_checks" = xyes; then 208697403Sobrien AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS) 208797403Sobrienfi 208897403Sobrien]) 208997403Sobrien 209097403Sobrien 209197403Sobriendnl 209297403Sobriendnl Add version tags to symbols in shared library (or not), additionally 209397403Sobriendnl marking other symbols as private/local (or not). 209497403Sobriendnl 209597403Sobriendnl GLIBCPP_ENABLE_SYMVERS 209697403Sobriendnl --enable-symvers=style adds a version script to the linker call when 209797403Sobriendnl creating the shared library. The choice of version script is 209897403Sobriendnl controlled by 'style'. 209997403Sobriendnl --disable-symvers does not. 210097403Sobriendnl + Usage: GLIBCPP_ENABLE_SYMVERS[(DEFAULT)] 210197403Sobriendnl Where DEFAULT is either `yes' or `no'. If ommitted, it 210297403Sobriendnl defaults to `no'. Passing `yes' tries to choose a default style 210397403Sobriendnl based on linker characteristics. Passing 'no' disables versioning. 210497403SobrienAC_DEFUN(GLIBCPP_ENABLE_SYMVERS, [dnl 210597403Sobriendefine([GLIBCPP_ENABLE_SYMVERS_DEFAULT], ifelse($1, yes, yes, no))dnl 210697403SobrienAC_ARG_ENABLE(symvers, 210797403Sobrienchangequote(<<, >>)dnl 210897403Sobrien<< --enable-symvers=style enables symbol versioning of the shared library [default=>>GLIBCPP_ENABLE_SYMVERS_DEFAULT], 210997403Sobrienchangequote([, ])dnl 211097403Sobrien[case "$enableval" in 211197403Sobrien yes) enable_symvers=yes ;; 211297403Sobrien no) enable_symvers=no ;; 211397403Sobrien # other names here, just as sanity checks 211497403Sobrien #gnu|sun|etcetera) enable_symvers=$enableval ;; 211597403Sobrien gnu) enable_symvers=$enableval ;; 211697403Sobrien *) AC_MSG_ERROR([Unknown argument to enable/disable symvers]) ;; 211797403Sobrien esac], 211897403Sobrienenable_symvers=GLIBCPP_ENABLE_SYMVERS_DEFAULT)dnl 211997403Sobrien 212097403Sobrien# If we never went through the GLIBCPP_CHECK_LINKER_FEATURES macro, then we 212197403Sobrien# don't know enough about $LD to do tricks... 212297403Sobrienif test x$enable_shared = xno || 212397403Sobrien test x$LD = x || 212497403Sobrien test x$glibcpp_gnu_ld_version = x; then 212597403Sobrien enable_symvers=no 212697403Sobrienfi 212797403Sobrien 212897403Sobrien# Check to see if libgcc_s exists, indicating that shared libgcc is possible. 212997403SobrienAC_MSG_CHECKING([for shared libgcc]) 213097403Sobrienac_save_CFLAGS="$CFLAGS" 213197403SobrienCFLAGS=' -lgcc_s' 213297403SobrienAC_TRY_LINK( , [return 0], glibcpp_shared_libgcc=yes, glibcpp_shared_libgcc=no) 213397403SobrienCFLAGS="$ac_save_CFLAGS" 213497403SobrienAC_MSG_RESULT($glibcpp_shared_libgcc) 213597403Sobrien 213697403Sobrien# For GNU ld, we need at least this version. It's 2.12 in the same format 213797403Sobrien# as the tested-for version. See GLIBCPP_CHECK_LINKER_FEATURES for more. 213897403Sobrienglibcpp_min_gnu_ld_version=21200 213997403Sobrien 214097403Sobrien# Check to see if unspecified "yes" value can win, given results 214197403Sobrien# above. 214297403Sobrienif test $enable_symvers = yes ; then 214397403Sobrien if test $with_gnu_ld = yes && 214497403Sobrien test $glibcpp_shared_libgcc = yes ; 214597403Sobrien then 214697403Sobrien if test $glibcpp_gnu_ld_version -ge $glibcpp_min_gnu_ld_version ; then 214797403Sobrien enable_symvers=gnu 214897403Sobrien else 214997403Sobrien ac_test_CFLAGS="${CFLAGS+set}" 215097403Sobrien ac_save_CFLAGS="$CFLAGS" 215197403Sobrien CFLAGS='-shared -Wl,--version-script,conftest.map' 215297403Sobrien enable_symvers=no 215397403Sobrien changequote(,) 215497403Sobrien echo 'FOO { global: f[a-z]o; local: *; };' > conftest.map 215597403Sobrien changequote([,]) 215697403Sobrien AC_TRY_LINK([int foo;],, enable_symvers=gnu) 215797403Sobrien if test "$ac_test_CFLAGS" = set; then 215897403Sobrien CFLAGS="$ac_save_CFLAGS" 215997403Sobrien else 216097403Sobrien # this is the suspicious part 216197403Sobrien CFLAGS='' 216297403Sobrien fi 216397403Sobrien rm -f conftest.map 216497403Sobrien fi 216597403Sobrien else 216697403Sobrien # just fail for now 216797403Sobrien enable_symvers=no 216897403Sobrien fi 216997403Sobrienfi 217097403Sobrien 217197403Sobriendnl Everything parsed; figure out what file to use. 217297403Sobriencase $enable_symvers in 217397403Sobrien no) 217497403Sobrien LINKER_MAP=config/linker-map.dummy 217597403Sobrien ;; 217697403Sobrien gnu) 217797403Sobrien LINKER_MAP=config/linker-map.gnu 217897403Sobrien ;; 217997403Sobrienesac 218097403Sobrien 218197403SobrienAC_LINK_FILES($LINKER_MAP, src/linker.map) 218297403SobrienAM_CONDITIONAL(GLIBCPP_BUILD_VERSIONED_SHLIB, test $enable_symvers != no) 218397403SobrienAC_MSG_CHECKING([versioning on shared library symbols]) 218497403SobrienAC_MSG_RESULT($enable_symvers) 218597403Sobrien]) 218697403Sobrien 2187