-dnl aclocal.m4 generated automatically by aclocal 1.4-p6
-
-dnl Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl This program is distributed in the hope that it will be useful,
-dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-dnl PARTICULAR PURPOSE.
-
-dnl
-dnl Initialize basic configure bits, set toplevel_srcdir for Makefiles.
-dnl
-dnl GLIBCPP_TOPREL_CONFIGURE
-AC_DEFUN(GLIBCPP_TOPREL_CONFIGURE, [
- dnl Default to --enable-multilib (this is also passed by default
- dnl from the ubercommon-top-level configure)
- AC_ARG_ENABLE(multilib,
- [ --enable-multilib build hella library versions (default)],
- [case "${enableval}" in
- yes) multilib=yes ;;
- no) multilib=no ;;
- *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
- esac], [multilib=yes])dnl
-
- # When building with srcdir == objdir, links to the source files will
- # be created in directories within the target_subdir. We have to
- # adjust toplevel_srcdir accordingly, so that configure finds
- # install-sh and other auxiliary files that live in the top-level
- # source directory.
- if test "${srcdir}" = "."; then
- if test -z "${with_target_subdir}"; then
- toprel=".."
- else
- if test "${with_target_subdir}" != "."; then
- toprel="${with_multisrctop}../.."
- else
- toprel="${with_multisrctop}.."
- fi
- fi
- else
- toprel=".."
- fi
- AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
- toplevel_srcdir=\${top_srcdir}/$toprel
- AC_SUBST(toplevel_srcdir)
-])
-
-dnl
-dnl Initialize the rest of the library configury.
-dnl
-dnl GLIBCPP_CONFIGURE
-AC_DEFUN(GLIBCPP_CONFIGURE, [
- # Export build and source directories.
- # These need to be absolute paths, yet at the same time need to
- # canonicalize only relative paths, because then amd will not unmount
- # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
- glibcpp_builddir=`${PWDCMD-pwd}`
- case $srcdir in
- [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
- *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
- esac
- AC_SUBST(glibcpp_builddir)
- AC_SUBST(glibcpp_srcdir)
-
- dnl This is here just to satisfy automake.
- ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)])
-
- AC_PROG_AWK
- # Will set LN_S to either 'ln -s' or 'ln'. With autoconf 2.5x, can also
- # be 'cp -p' if linking isn't available. Uncomment the next line to
- # force a particular method.
- #ac_cv_prog_LN_S='cp -p'
- AC_PROG_LN_S
-
- # We use these options to decide which functions to include.
- AC_ARG_WITH(target-subdir,
- [ --with-target-subdir=SUBDIR
- configuring in a subdirectory])
- AC_ARG_WITH(cross-host,
- [ --with-cross-host=HOST configuring with a cross compiler])
-
- AC_ARG_WITH(newlib,
- [ --with-newlib Configuring with newlib])
-
- glibcpp_basedir=$srcdir/$toprel/$1/libstdc++-v3
- AC_SUBST(glibcpp_basedir)
-
- # Never versions of autoconf add an underscore to these functions.
- # Prevent future problems ...
- ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
- ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
- ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
- ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
-
- # AC_PROG_CC
- # FIXME: We temporarily define our own version of AC_PROG_CC. This is
- # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
- # are probably using a cross compiler, which will not be able to fully
- # link an executable. This is addressed in later versions of autoconf.
-
- AC_DEFUN(LIB_AC_PROG_CC,
- [AC_BEFORE([$0], [AC_PROG_CPP])dnl
- dnl Fool anybody using AC_PROG_CC.
- AC_PROVIDE([AC_PROG_CC])
- AC_CHECK_PROG(CC, gcc, gcc)
- if test -z "$CC"; then
- AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
- test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
- fi
-
- AC_PROG_CC_GNU
-
- if test $ac_cv_prog_gcc = yes; then
- GCC=yes
- dnl Check whether -g works, even if CFLAGS is set, in case the package
- dnl plays around with CFLAGS (such as to build both debugging and
- dnl normal versions of a library), tasteless as that idea is.
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS=
- AC_PROG_CC_G
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- elif test $ac_cv_prog_cc_g = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-O2"
- fi
- else
- GCC=
- test "${CFLAGS+set}" = set || CFLAGS="-g"
- fi
- ])
-
- LIB_AC_PROG_CC
-
- # Likewise for AC_PROG_CXX. We can't just call it directly because g++
- # will try to link in libstdc++.
- AC_DEFUN(LIB_AC_PROG_CXX,
- [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
- dnl Fool anybody using AC_PROG_CXX.
- AC_PROVIDE([AC_PROG_CXX])
- # Use glibcpp_CXX so that we do not cause CXX to be cached with the
- # flags that come in CXX while configuring libstdc++. They're different
- # from those used for all other target libraries. If CXX is set in
- # the environment, respect that here.
- glibcpp_CXX=$CXX
- AC_CHECK_PROGS(glibcpp_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
- AC_SUBST(glibcpp_CXX)
- CXX=$glibcpp_CXX
- test -z "$glibcpp_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
-
- AC_PROG_CXX_GNU
-
- if test $ac_cv_prog_gxx = yes; then
- GXX=yes
- dnl Check whether -g works, even if CXXFLAGS is set, in case the package
- dnl plays around with CXXFLAGS (such as to build both debugging and
- dnl normal versions of a library), tasteless as that idea is.
- ac_test_CXXFLAGS="${CXXFLAGS+set}"
- ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS=
- AC_PROG_CXX_G
- if test "$ac_test_CXXFLAGS" = set; then
- CXXFLAGS="$ac_save_CXXFLAGS"
- elif test $ac_cv_prog_cxx_g = yes; then
- CXXFLAGS="-g -O2"
- else
- CXXFLAGS="-O2"
- fi
- else
- GXX=
- test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
- fi
- ])
-
- LIB_AC_PROG_CXX
-
- # For directory versioning (e.g., headers) and other variables.
- AC_MSG_CHECKING([for GCC version number])
- gcc_version=`$glibcpp_CXX -dumpversion`
- AC_MSG_RESULT($gcc_version)
-
- # For some reason, gettext needs this.
- AC_ISC_POSIX
-
- AC_CHECK_TOOL(AS, as)
- AC_CHECK_TOOL(AR, ar)
- AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
- AC_PROG_INSTALL
-
- AM_MAINTAINER_MODE
-
- # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
- # at least currently, we never actually build a program, so we never
- # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
- # fails, because we are probably configuring with a cross compiler
- # which can't create executables. So we include AC_EXEEXT to keep
- # automake happy, but we don't execute it, since we don't care about
- # the result.
- if false; then
- # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
- # to nothing, so nothing would remain between `then' and `fi' if it
- # were not for the `:' below.
- :
- AC_EXEEXT
- fi
-
- case [$]{glibcpp_basedir} in
- /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
- *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
- esac
-
- # Set up safe default values for all subsequent AM_CONDITIONAL tests.
- need_libmath=no
- enable_wchar_t=no
- #enable_debug=no
- #glibcpp_pch_comp=no
- #enable_cheaders=c
- #c_compatibility=no
- enable_abi_check=no
- #enable_symvers=no
-
- # Find platform-specific directories containing configuration info. In
- # addition to possibly modifying the same flags, it also sets up symlinks.
- GLIBCPP_CHECK_HOST
-])
-
-
-dnl
-dnl Check to see if g++ can compile this library, and if so, if any version-
-dnl specific precautions need to be taken.
-dnl
-dnl GLIBCPP_CHECK_COMPILER_VERSION
-AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
-if test ! -f stamp-sanity-compiler; then
- AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3])
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE(, [
- #if __GNUC__ < 3
- not_ok
- #endif
- ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to GCC 3.0 or above]))
- AC_LANG_RESTORE
- AC_MSG_RESULT($gpp_satisfactory)
- touch stamp-sanity-compiler
-fi
-])
-
-
-dnl
-dnl Tests for newer compiler features, or features that are present in newer
-dnl compiler versions but not older compiler versions still in use, should
-dnl be placed here.
-dnl
-dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
-dnl new inlining code or the new system_header pragma will die on -Werror.
-dnl Leave it out by default and use maint-mode to use it.
-dnl
-dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
-dnl compiler supports it and the user has not requested debug mode.
-dnl
-dnl GLIBCPP_CHECK_COMPILER_FEATURES
-AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
- # All these tests are for C++; save the language and the compiler flags.
- # The CXXFLAGS thing is suspicious, but based on similar bits previously
- # found in GLIBCPP_CONFIGURE.
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- ac_test_CXXFLAGS="${CXXFLAGS+set}"
- ac_save_CXXFLAGS="$CXXFLAGS"
-
- # Check for maintainer-mode bits.
- if test x"$USE_MAINTAINER_MODE" = xno; then
- WERROR=''
- else
- WERROR='-Werror'
- fi
-
- # Check for -ffunction-sections -fdata-sections
- AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
- CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
- AC_TRY_COMPILE(, [int foo;
- ], [ac_fdsections=yes], [ac_fdsections=no])
- if test "$ac_test_CXXFLAGS" = set; then
- CXXFLAGS="$ac_save_CXXFLAGS"
- else
- # this is the suspicious part
- CXXFLAGS=''
- fi
- if test x"$ac_fdsections" = x"yes"; then
- SECTION_FLAGS='-ffunction-sections -fdata-sections'
- fi
- AC_MSG_RESULT($ac_fdsections)
-
- AC_LANG_RESTORE
- AC_SUBST(WERROR)
- AC_SUBST(SECTION_FLAGS)
-])
-
-
-dnl
-dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
-dnl the native linker is in use, all variables will be defined to something
-dnl safe (like an empty string).
-dnl
-dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
-dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
-dnl Define LD, with_gnu_ld, and (possibly) glibcpp_gnu_ld_version as
-dnl side-effects of testing.
-dnl
-dnl GLIBCPP_CHECK_LINKER_FEATURES
-AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
- # If we're not using GNU ld, then there's no point in even trying these
- # tests. Check for that first. We should have already tested for gld
- # by now (in libtool), but require it now just to be safe...
- test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
- test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
- AC_REQUIRE([AC_PROG_LD])
-
- # The name set by libtool depends on the version of libtool. Shame on us
- # for depending on an impl detail, but c'est la vie. Older versions used
- # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
- # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
- # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
- # set (hence we're using an older libtool), then set it.
- if test x${with_gnu_ld+set} != xset; then
- if test x${ac_cv_prog_gnu_ld+set} != xset; then
- # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
- with_gnu_ld=no
- else
- with_gnu_ld=$ac_cv_prog_gnu_ld
- fi
- fi
-
- # Start by getting the version number. I think the libtool test already
- # does some of this, but throws away the result.
- changequote(,)
- ldver=`$LD --version 2>/dev/null | head -1 | \
- sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
- changequote([,])
- glibcpp_gnu_ld_version=`echo $ldver | \
- $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
-
- # Set --gc-sections.
- if test "$with_gnu_ld" = "notbroken"; then
- # GNU ld it is! Joy and bunny rabbits!
-
- # All these tests are for C++; save the language and the compiler flags.
- # Need to do this so that g++ won't try to link in libstdc++
- ac_test_CFLAGS="${CFLAGS+set}"
- ac_save_CFLAGS="$CFLAGS"
- CFLAGS='-x c++ -Wl,--gc-sections'
-
- # Check for -Wl,--gc-sections
- # XXX This test is broken at the moment, as symbols required for
- # linking are now in libsupc++ (not built yet.....). In addition,
- # this test has cored on solaris in the past. In addition,
- # --gc-sections doesn't really work at the moment (keeps on discarding
- # used sections, first .eh_frame and now some of the glibc sections for
- # iconv). Bzzzzt. Thanks for playing, maybe next time.
- AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
- AC_TRY_RUN([
- int main(void)
- {
- try { throw 1; }
- catch (...) { };
- return 0;
- }
- ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
- if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
- else
- # this is the suspicious part
- CFLAGS=''
- fi
- if test "$ac_sectionLDflags" = "yes"; then
- SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
- fi
- AC_MSG_RESULT($ac_sectionLDflags)
- fi
-
- # Set linker optimization flags.
- if test x"$with_gnu_ld" = x"yes"; then
- OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
- fi
-
- AC_SUBST(SECTION_LDFLAGS)
- AC_SUBST(OPT_LDFLAGS)
-])
-
-
-dnl
-dnl Check to see if the (math function) argument passed is
-dnl declared when using the c++ compiler
-dnl ASSUMES argument is a math function with ONE parameter
-dnl
-dnl GLIBCPP_CHECK_MATH_DECL_1
-AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [
- AC_MSG_CHECKING([for $1 declaration])
- if test x${glibcpp_cv_func_$1_use+set} != xset; then
- AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <math.h>
- #ifdef HAVE_IEEEFP_H
- #include <ieeefp.h>
- #endif
- ],
- [ $1(0);],
- [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
- AC_LANG_RESTORE
- ])
- fi
- AC_MSG_RESULT($glibcpp_cv_func_$1_use)
-])
-
-dnl
-dnl Check to see if the (math function) argument passed is
-dnl 1) declared when using the c++ compiler
-dnl 2) has "C" linkage
-dnl 3) if not, see if 1) and 2) for argument prepended with '_'
-dnl
-dnl Define HAVE_CARGF etc if "cargf" is declared and links
-dnl
-dnl argument 1 is name of function to check
-dnl
-dnl ASSUMES argument is a math function with ONE parameter
-dnl
-dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
-AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
- GLIBCPP_CHECK_MATH_DECL_1($1)
- if test x$glibcpp_cv_func_$1_use = x"yes"; then
- AC_CHECK_FUNCS($1)
- else
- GLIBCPP_CHECK_MATH_DECL_1(_$1)
- if test x$glibcpp_cv_func__$1_use = x"yes"; then
- AC_CHECK_FUNCS(_$1)
- fi
- fi
-])
-
-
-dnl
-dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
-dnl of functions at once. It's an all-or-nothing check -- either
-dnl HAVE_XYZ is defined for each of the functions, or for none of them.
-dnl Doing it this way saves significant configure time.
-AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [
- AC_MSG_CHECKING([for $1 functions])
- AC_CACHE_VAL(glibcpp_cv_func_$2_use, [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <math.h>],
- [ `for x in $3; do echo "$x (0);"; done` ],
- [glibcpp_cv_func_$2_use=yes],
- [glibcpp_cv_func_$2_use=no])
- AC_LANG_RESTORE])
- AC_MSG_RESULT($glibcpp_cv_func_$2_use)
- if test x$glibcpp_cv_func_$2_use = x"yes"; then
- AC_CHECK_FUNCS($3)
- fi
-])
-
-dnl
-dnl Check to see if the (math function) argument passed is
-dnl declared when using the c++ compiler
-dnl ASSUMES argument is a math function with TWO parameters
-dnl
-dnl GLIBCPP_CHECK_MATH_DECL_2
-AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [
- AC_MSG_CHECKING([for $1 declaration])
- if test x${glibcpp_cv_func_$1_use+set} != xset; then
- AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <math.h>],
- [ $1(0, 0);],
- [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
- AC_LANG_RESTORE
- ])
- fi
- AC_MSG_RESULT($glibcpp_cv_func_$1_use)
-])
-
-dnl
-dnl Check to see if the (math function) argument passed is
-dnl 1) declared when using the c++ compiler
-dnl 2) has "C" linkage
-dnl
-dnl Define HAVE_CARGF etc if "cargf" is declared and links
-dnl
-dnl argument 1 is name of function to check
-dnl
-dnl ASSUMES argument is a math function with TWO parameters
-dnl
-dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
-AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
- GLIBCPP_CHECK_MATH_DECL_2($1)
- if test x$glibcpp_cv_func_$1_use = x"yes"; then
- AC_CHECK_FUNCS($1)
- else
- GLIBCPP_CHECK_MATH_DECL_2(_$1)
- if test x$glibcpp_cv_func__$1_use = x"yes"; then
- AC_CHECK_FUNCS(_$1)
- fi
- fi
-])
-
-
-dnl
-dnl Check to see if the (math function) argument passed is
-dnl declared when using the c++ compiler
-dnl ASSUMES argument is a math function with THREE parameters
-dnl
-dnl GLIBCPP_CHECK_MATH_DECL_3
-AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [
- AC_MSG_CHECKING([for $1 declaration])
- if test x${glibcpp_cv_func_$1_use+set} != xset; then
- AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <math.h>],
- [ $1(0, 0, 0);],
- [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
- AC_LANG_RESTORE
- ])
- fi
- AC_MSG_RESULT($glibcpp_cv_func_$1_use)
-])
-
-dnl
-dnl Check to see if the (math function) argument passed is
-dnl 1) declared when using the c++ compiler
-dnl 2) has "C" linkage
-dnl
-dnl Define HAVE_CARGF etc if "cargf" is declared and links
-dnl
-dnl argument 1 is name of function to check
-dnl
-dnl ASSUMES argument is a math function with THREE parameters
-dnl
-dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
-AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
- GLIBCPP_CHECK_MATH_DECL_3($1)
- if test x$glibcpp_cv_func_$1_use = x"yes"; then
- AC_CHECK_FUNCS($1)
- else
- GLIBCPP_CHECK_MATH_DECL_3(_$1)
- if test x$glibcpp_cv_func__$1_use = x"yes"; then
- AC_CHECK_FUNCS(_$1)
- fi
- fi
-])
-
-
-dnl
-dnl Check to see if the (stdlib function) argument passed is
-dnl 1) declared when using the c++ compiler
-dnl 2) has "C" linkage
-dnl
-dnl argument 1 is name of function to check
-dnl
-dnl ASSUMES argument is a math function with TWO parameters
-dnl
-dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
-AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
- AC_MSG_CHECKING([for $1 declaration])
- if test x${glibcpp_cv_func_$1_use+set} != xset; then
- AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <stdlib.h>],
- [ $1(0, 0);],
- [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
- AC_LANG_RESTORE
- ])
- fi
- AC_MSG_RESULT($glibcpp_cv_func_$1_use)
- if test x$glibcpp_cv_func_$1_use = x"yes"; then
- AC_CHECK_FUNCS($1)
- fi
-])
-
-
-dnl
-dnl Check to see if the (stdlib function) argument passed is
-dnl 1) declared when using the c++ compiler
-dnl 2) has "C" linkage
-dnl
-dnl argument 1 is name of function to check
-dnl
-dnl ASSUMES argument is a function with THREE parameters
-dnl
-dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3
-AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3, [
- AC_MSG_CHECKING([for $1 declaration])
- if test x${glibcpp_cv_func_$1_use+set} != xset; then
- AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <stdlib.h>],
- [ $1(0, 0, 0);],
- [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
- AC_LANG_RESTORE
- ])
- fi
- AC_MSG_RESULT($glibcpp_cv_func_$1_use)
- if test x$glibcpp_cv_func_$1_use = x"yes"; then
- AC_CHECK_FUNCS($1)
- fi
-])
-
-dnl
-dnl Because the builtins are picky picky picky about the arguments they take,
-dnl do an explict linkage tests here.
-dnl Check to see if the (math function) argument passed is
-dnl 1) declared when using the c++ compiler
-dnl 2) has "C" linkage
-dnl
-dnl Define HAVE_CARGF etc if "cargf" is declared and links
-dnl
-dnl argument 1 is name of function to check
-dnl
-dnl ASSUMES argument is a math function with ONE parameter
-dnl
-dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
-AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
- AC_MSG_CHECKING([for $1 declaration])
- if test x${glibcpp_cv_func_$1_use+set} != xset; then
- AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
- AC_LANG_SAVE
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <math.h>],
- [ $1(0);],
- [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
- AC_LANG_RESTORE
- ])
- fi
- AC_MSG_RESULT($glibcpp_cv_func_$1_use)
- if test x$glibcpp_cv_func_$1_use = x"yes"; then
- AC_MSG_CHECKING([for $1 linkage])
- if test x${glibcpp_cv_func_$1_link+set} != xset; then
- AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
- AC_TRY_LINK([#include <math.h>],
- [ $1(0);],
- [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
- ])
- fi
- AC_MSG_RESULT($glibcpp_cv_func_$1_link)
- if test x$glibcpp_cv_func_$1_link = x"yes"; then
- ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- AC_DEFINE_UNQUOTED(${ac_tr_func})
- fi
- fi
-])
-
-
-dnl
-dnl Check to see what builtin math functions are supported
-dnl
-dnl check for __builtin_abs
-dnl check for __builtin_fabsf
-dnl check for __builtin_fabs
-dnl check for __builtin_fabl
-dnl check for __builtin_labs
-dnl check for __builtin_sqrtf
-dnl check for __builtin_sqrtl
-dnl check for __builtin_sqrt
-dnl check for __builtin_sinf
-dnl check for __builtin_sin
-dnl check for __builtin_sinl
-dnl check for __builtin_cosf
-dnl check for __builtin_cos
-dnl check for __builtin_cosl
-dnl
-dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
-AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
- dnl Test for builtin math functions.
- dnl These are made in gcc/c-common.c
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
-
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrt)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
-
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
-
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
- GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
-
- dnl There is, without a doubt, a more elegant way to have these
- dnl names exported so that they won't be stripped out of acconfig.h by
- dnl autoheader. I leave this as an exercise to somebody less frustrated
- dnl than I.... please email the libstdc++ list if you can figure out a
- dnl more elegant approach (see autoconf/acgen.m4 and specifically
- dnl AC_CHECK_FUNC for things to steal.)
- dummyvar=no
- if test x$dummyvar = x"yes"; then
- AC_DEFINE(HAVE___BUILTIN_ABS)
- AC_DEFINE(HAVE___BUILTIN_LABS)
- AC_DEFINE(HAVE___BUILTIN_COS)
- AC_DEFINE(HAVE___BUILTIN_COSF)
- AC_DEFINE(HAVE___BUILTIN_COSL)
- AC_DEFINE(HAVE___BUILTIN_FABS)
- AC_DEFINE(HAVE___BUILTIN_FABSF)
- AC_DEFINE(HAVE___BUILTIN_FABSL)
- AC_DEFINE(HAVE___BUILTIN_SIN)
- AC_DEFINE(HAVE___BUILTIN_SINF)
- AC_DEFINE(HAVE___BUILTIN_SINL)
- AC_DEFINE(HAVE___BUILTIN_SQRT)
- AC_DEFINE(HAVE___BUILTIN_SQRTF)
- AC_DEFINE(HAVE___BUILTIN_SQRTL)
- fi
-])
-
-dnl
-dnl Check to see what the underlying c library is like
-dnl These checks need to do two things:
-dnl 1) make sure the name is declared when using the c++ compiler
-dnl 2) make sure the name has "C" linkage
-dnl This might seem like overkill but experience has shown that it's not...
-dnl
-dnl Define HAVE_STRTOLD if "strtold" is declared and links
-dnl Define HAVE_STRTOF if "strtof" is declared and links
-dnl Define HAVE_DRAND48 if "drand48" is declared and links
-dnl
-dnl GLIBCPP_CHECK_STDLIB_SUPPORT
-AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
- ac_test_CXXFLAGS="${CXXFLAGS+set}"
- ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
-
- GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
- GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof)
- AC_CHECK_FUNCS(drand48)
-
- CXXFLAGS="$ac_save_CXXFLAGS"
-])
-
-dnl
-dnl Check to see what the underlying c library or math library is like.
-dnl These checks need to do two things:
-dnl 1) make sure the name is declared when using the c++ compiler
-dnl 2) make sure the name has "C" linkage
-dnl This might seem like overkill but experience has shown that it's not...
-dnl
-dnl Define HAVE_CARGF etc if "cargf" is found.
-dnl
-dnl GLIBCPP_CHECK_MATH_SUPPORT
-AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
- ac_test_CXXFLAGS="${CXXFLAGS+set}"
- ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
-
- dnl Check libm
- AC_CHECK_LIB(m, sin, libm="-lm")
- ac_save_LIBS="$LIBS"
- LIBS="$LIBS $libm"
-
- dnl Check to see if certain C math functions exist.
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypot)
-
- dnl Check to see if basic C math functions have float versions.
- GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig,
- float_trig,
- acosf asinf atanf \
- cosf sinf tanf \
- coshf sinhf tanhf)
- GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
- float_round,
- ceilf floorf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
-
- dnl Check to see if basic C math functions have long double versions.
- GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig,
- long_double_trig,
- acosl asinl atanl \
- cosl sinl tanl \
- coshl sinhl tanhl)
- GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round,
- long_double_round,
- ceill floorl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
- GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
-
- dnl Some runtimes have these functions with a preceding underscore. Please
- dnl keep this sync'd with the one above. And if you add any new symbol,
- dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
- dnl Check to see if certain C math functions exist.
-
- dnl Check to see if basic C math functions have float versions.
- GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
- _float_trig,
- _acosf _asinf _atanf \
- _cosf _sinf _tanf \
- _coshf _sinhf _tanhf)
- GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
- _float_round,
- _ceilf _floorf)
-
- dnl Check to see if basic C math functions have long double versions.
- GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
- _long_double_trig,
- _acosl _asinl _atanl \
- _cosl _sinl _tanl \
- _coshl _sinhl _tanhl)
- GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
- _long_double_round,
- _ceill _floorl)
-
- LIBS="$ac_save_LIBS"
- CXXFLAGS="$ac_save_CXXFLAGS"
-])