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