dnl
dnl Defines:
dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible
-dnl OPT_LDFLAGS='-Wl,-O1' if possible
+dnl OPT_LDFLAGS='-Wl,-O1' and '-z,relro' if possible
dnl LD (as a side effect of testing)
dnl Sets:
dnl with_gnu_ld
# Start by getting the version number. I think the libtool test already
# does some of this, but throws away the result.
+ AC_MSG_CHECKING([for ld version])
changequote(,)
ldver=`$LD --version 2>/dev/null | head -1 | \
sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
changequote([,])
glibcxx_gnu_ld_version=`echo $ldver | \
$AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
+ AC_MSG_RESULT($glibcxx_gnu_ld_version)
# Set --gc-sections.
- if test "$with_gnu_ld" = "notbroken"; then
- # GNU ld it is! Joy and bunny rabbits!
+ glibcxx_gcsections_min_ld=21602
+ if test x"$with_gnu_ld" = x"yes" &&
+ test $glibcxx_gnu_ld_version -gt $glibcxx_gcsections_min_ld ; then
- # 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++
+ # Sufficiently young GNU ld it is! Joy and bunny rabbits!
+ # NB: This flag only works reliably after 2.16.1. Configure tests
+ # for this are difficult, so hard wire a value that should work.
+
+ # All these tests are for C++, but run with the "C" compiler driver.
+ # Need to do this so that g++ won't try to link in libstdc++/libsupc++.
ac_test_CFLAGS="${CFLAGS+set}"
ac_save_CFLAGS="$CFLAGS"
- CFLAGS='-x c++ -Wl,--gc-sections'
+ 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])
+ AC_TRY_LINK([ int one(void) { return 1; }
+ int two(void) { return 2; }
+ ], [ two(); ] , [ac_gcsections=yes], [ac_gcsections=no])
+ if test "$ac_gcsections" = "yes"; then
+ rm -f conftest.c
+ touch conftest.c
+ if $CC -c conftest.c; then
+ if $LD --gc-sections -o conftest conftest.o 2>&1 | \
+ grep "Warning: gc-sections option ignored" > /dev/null; then
+ ac_gcsections=no
+ fi
+ fi
+ rm -f conftest.c conftest.o conftest
+ fi
+ if test "$ac_gcsections" = "yes"; then
+ SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
+ fi
+ AC_MSG_RESULT($ac_gcsections)
+
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
+
+ # Set -z,relro.
+ # Note this is only for shared objects.
+ ac_ld_relro=no
+ if test x"$with_gnu_ld" = x"yes"; then
+ AC_MSG_CHECKING([for ld that supports -Wl,-z,relro])
+ cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"`
+ if test -n "$cxx_z_relo"; then
+ OPT_LDFLAGS="-Wl,-z,relro"
+ ac_ld_relro=yes
fi
- AC_MSG_RESULT($ac_sectionLDflags)
+ AC_MSG_RESULT($ac_ld_relro)
fi
# Set linker optimization flags.
dnl various HAVE_LIMIT_* for individual limit names
dnl
AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT_ancilliary], [
+ AC_MSG_CHECKING([for RLIMIT_$1])
AC_TRY_COMPILE(
[#include <unistd.h>
#include <sys/time.h>
[glibcxx_mresult=1], [glibcxx_mresult=0])
AC_DEFINE_UNQUOTED(HAVE_LIMIT_$1, $glibcxx_mresult,
[Only used in build directory testsuite_hooks.h.])
+ if test $glibcxx_mresult = 1 ; then res=yes ; else res=no ; fi
+ AC_MSG_RESULT($res)
])
AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT], [
dnl Define HAVE_S_ISREG / HAVE_S_IFREG appropriately.
dnl
AC_DEFUN([GLIBCXX_CHECK_S_ISREG_OR_S_IFREG], [
+ AC_MSG_CHECKING([for S_ISREG or S_IFREG])
AC_CACHE_VAL(glibcxx_cv_S_ISREG, [
AC_TRY_LINK(
[#include <sys/stat.h>],
[glibcxx_cv_S_IFREG=yes],
[glibcxx_cv_S_IFREG=no])
])
+ res=no
if test $glibcxx_cv_S_ISREG = yes; then
AC_DEFINE(HAVE_S_ISREG, 1,
[Define if S_IFREG is available in <sys/stat.h>.])
+ res=S_ISREG
elif test $glibcxx_cv_S_IFREG = yes; then
AC_DEFINE(HAVE_S_IFREG, 1,
[Define if S_IFREG is available in <sys/stat.h>.])
+ res=S_IFREG
fi
+ AC_MSG_RESULT($res)
])
dnl Check whether poll is available in <poll.h>, and define HAVE_POLL.
dnl
AC_DEFUN([GLIBCXX_CHECK_POLL], [
+ AC_MSG_CHECKING([for poll])
AC_CACHE_VAL(glibcxx_cv_POLL, [
AC_TRY_LINK(
[#include <poll.h>],
if test $glibcxx_cv_POLL = yes; then
AC_DEFINE(HAVE_POLL, 1, [Define if poll is available in <poll.h>.])
fi
+ AC_MSG_RESULT($glibcxx_cv_POLL)
])
dnl Check whether writev is available in <sys/uio.h>, and define HAVE_WRITEV.
dnl
AC_DEFUN([GLIBCXX_CHECK_WRITEV], [
+ AC_MSG_CHECKING([for writev])
AC_CACHE_VAL(glibcxx_cv_WRITEV, [
AC_TRY_LINK(
[#include <sys/uio.h>],
if test $glibcxx_cv_WRITEV = yes; then
AC_DEFINE(HAVE_WRITEV, 1, [Define if writev is available in <sys/uio.h>.])
fi
+ AC_MSG_RESULT($glibcxx_cv_WRITEV)
])
dnl Check whether int64_t is available in <stdint.h>, and define HAVE_INT64_T.
dnl
AC_DEFUN([GLIBCXX_CHECK_INT64_T], [
+ AC_MSG_CHECKING([for int64_t])
AC_CACHE_VAL(glibcxx_cv_INT64_T, [
AC_TRY_COMPILE(
[#include <stdint.h>],
if test $glibcxx_cv_INT64_T = yes; then
AC_DEFINE(HAVE_INT64_T, 1, [Define if int64_t is available in <stdint.h>.])
fi
+ AC_MSG_RESULT($glibcxx_cv_INT64_T)
])
AC_LANG_CPLUSPLUS
ac_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS -fno-exceptions"
+ AC_MSG_CHECKING([for LFS support])
AC_CACHE_VAL(glibcxx_cv_LFS, [
AC_TRY_LINK(
[#include <unistd.h>
if test $glibcxx_cv_LFS = yes; then
AC_DEFINE(_GLIBCXX_USE_LFS, 1, [Define if LFS support is available.])
fi
+ AC_MSG_RESULT($glibcxx_cv_LFS)
CXXFLAGS="$ac_save_CXXFLAGS"
AC_LANG_RESTORE
])
dnl GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE must be done before this.
dnl
dnl Sets:
-dnl enable_abi_check / GLIBCXX_TEST_ABI
+dnl enable_abi_check
dnl GLIBCXX_TEST_WCHAR_T
dnl GLIBCXX_TEST_THREAD
dnl Substs:
dnl baseline_dir
dnl
AC_DEFUN([GLIBCXX_CONFIGURE_TESTSUITE], [
- if $GLIBCXX_IS_NATIVE && test $is_hosted = yes; then
+ if $GLIBCXX_IS_NATIVE ; then
# Do checks for resource limit functions.
GLIBCXX_CHECK_SETRLIMIT
# Look for setenv, so that extended locale tests can be performed.
GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv)
+ fi
- if test $enable_symvers = no; then
- enable_abi_check=no
- else
- case "$host" in
- *-*-cygwin*)
- enable_abi_check=no ;;
- *)
- enable_abi_check=yes ;;
- esac
- fi
+ if $GLIBCXX_IS_NATIVE && test $is_hosted = yes &&
+ test $enable_symvers != no; then
+ case "$host" in
+ *-*-cygwin*)
+ enable_abi_check=no ;;
+ *)
+ enable_abi_check=yes ;;
+ esac
else
# Only build this as native, since automake does not understand
# CXX_FOR_BUILD.
enable_abi_check=no
fi
-
+
# Export file names for ABI checking.
- baseline_dir="$glibcxx_srcdir/config/abi/${abi_baseline_pair}\$(MULTISUBDIR)"
+ baseline_dir="$glibcxx_srcdir/config/abi/post/${abi_baseline_pair}\$(MULTISUBDIR)"
AC_SUBST(baseline_dir)
-
- GLIBCXX_CONDITIONAL(GLIBCXX_TEST_WCHAR_T, test $enable_wchar_t = yes)
- GLIBCXX_CONDITIONAL(GLIBCXX_TEST_THREAD, test $enable_thread = yes)
- GLIBCXX_CONDITIONAL(GLIBCXX_TEST_ABI, test $enable_abi_check = yes)
])
in <cmath> in namespace std.])
fi
- # Check for the existence of <complex.h> complex functions.
+ # Check for the existence of <complex.h> complex math functions.
# This is necessary even though libstdc++ uses the builtin versions
# of these functions, because if the builtin cannot be used, a reference
# to the library function is emitted.
- # In addition, need to explicitly specify "C" compilation for this
- # one, or else the backwards C++ <complex.h> include will be selected.
- save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS -x c"
AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no)
ac_c99_complex=no;
if test x"$ac_has_complex_h" = x"yes"; then
ccosf(tmpf);
ccoshf(tmpf);
cexpf(tmpf);
+ clogf(tmpf);
csinf(tmpf);
csinhf(tmpf);
csqrtf(tmpf);
ccos(tmpd);
ccosh(tmpd);
cexp(tmpd);
+ clog(tmpd);
csin(tmpd);
csinh(tmpd);
csqrt(tmpd);
ccosl(tmpld);
ccoshl(tmpld);
cexpl(tmpld);
+ clogl(tmpld);
csinl(tmpld);
csinhl(tmpld);
csqrtl(tmpld);
cpowl(tmpld, tmpld);
],[ac_c99_complex=yes], [ac_c99_complex=no])
fi
- CXXFLAGS="$save_CXXFLAGS"
AC_MSG_RESULT($ac_c99_complex)
if test x"$ac_c99_complex" = x"yes"; then
AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX, 1,
AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
AC_CACHE_VAL(ac_c99_stdlib, [
AC_TRY_COMPILE([#include <stdlib.h>],
- [char* tmp;
- strtof("gnu", &tmp);
+ [char* tmp;
+ strtof("gnu", &tmp);
strtold("gnu", &tmp);
- llabs(10);
- lldiv(10,1);
- atoll("10");
+ strtoll("gnu", &tmp, 10);
+ strtoull("gnu", &tmp, 10);
+ llabs(10);
+ lldiv(10,1);
+ atoll("10");
_Exit(0);
lldiv_t mydivt;],[ac_c99_stdlib=yes], [ac_c99_stdlib=no])
])
])
+dnl
+dnl Check for ISO/IEC 9899:1999 "C99" support to ISO/IEC DTR 19768 "TR1"
+dnl facilities in Chapter 8, "C compatibility".
+dnl
+AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+
+ # Check for the existence of <complex.h> complex math functions used
+ # by tr1/complex.
+ AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no)
+ ac_c99_complex_tr1=no;
+ if test x"$ac_has_complex_h" = x"yes"; then
+ AC_MSG_CHECKING([for ISO C99 support to TR1 in <complex.h>])
+ AC_TRY_COMPILE([#include <complex.h>],
+ [typedef __complex__ float float_type; float_type tmpf;
+ cacosf(tmpf);
+ casinf(tmpf);
+ catanf(tmpf);
+ cacoshf(tmpf);
+ casinhf(tmpf);
+ catanhf(tmpf);
+ typedef __complex__ double double_type; double_type tmpd;
+ cacos(tmpd);
+ casin(tmpd);
+ catan(tmpd);
+ cacosh(tmpd);
+ casinh(tmpd);
+ catanh(tmpd);
+ typedef __complex__ long double ld_type; ld_type tmpld;
+ cacosl(tmpld);
+ casinl(tmpld);
+ catanl(tmpld);
+ cacoshl(tmpld);
+ casinhl(tmpld);
+ catanhl(tmpld);
+ ],[ac_c99_complex_tr1=yes], [ac_c99_complex_tr1=no])
+ fi
+ AC_MSG_RESULT($ac_c99_complex_tr1)
+ if test x"$ac_c99_complex_tr1" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX_TR1, 1,
+ [Define if C99 functions in <complex.h> should be used in
+ <tr1/complex>. Using compiler builtins for these functions
+ requires corresponding C99 library functions to be present.])
+ fi
+
+ # Check for the existence of <ctype.h> functions.
+ AC_MSG_CHECKING([for ISO C99 support to TR1 in <ctype.h>])
+ AC_CACHE_VAL(ac_c99_ctype_tr1, [
+ AC_TRY_COMPILE([#include <ctype.h>],
+ [int ch;
+ int ret;
+ ret = isblank(ch);
+ ],[ac_c99_ctype_tr1=yes], [ac_c99_ctype_tr1=no])
+ ])
+ AC_MSG_RESULT($ac_c99_ctype_tr1)
+ if test x"$ac_c99_ctype_tr1" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_C99_CTYPE_TR1, 1,
+ [Define if C99 functions in <ctype.h> should be imported in
+ <tr1/cctype> in namespace std::tr1.])
+ fi
+
+ # Check for the existence of <fenv.h> functions.
+ AC_CHECK_HEADERS(fenv.h, ac_has_fenv_h=yes, ac_has_fenv_h=no)
+ ac_c99_fenv_tr1=no;
+ if test x"$ac_has_fenv_h" = x"yes"; then
+ AC_MSG_CHECKING([for ISO C99 support to TR1 in <fenv.h>])
+ AC_TRY_COMPILE([#include <fenv.h>],
+ [int except, mode;
+ fexcept_t* pflag;
+ fenv_t* penv;
+ int ret;
+ ret = feclearexcept(except);
+ ret = fegetexceptflag(pflag, except);
+ ret = feraiseexcept(except);
+ ret = fesetexceptflag(pflag, except);
+ ret = fetestexcept(except);
+ ret = fegetround();
+ ret = fesetround(mode);
+ ret = fegetenv(penv);
+ ret = feholdexcept(penv);
+ ret = fesetenv(penv);
+ ret = feupdateenv(penv);
+ ],[ac_c99_fenv_tr1=yes], [ac_c99_fenv_tr1=no])
+ fi
+ AC_MSG_RESULT($ac_c99_fenv_tr1)
+ if test x"$ac_c99_fenv_tr1" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_C99_FENV_TR1, 1,
+ [Define if C99 functions in <fenv.h> should be imported in
+ <tr1/cfenv> in namespace std::tr1.])
+ fi
+
+ # Check for the existence of <stdint.h> types.
+ AC_MSG_CHECKING([for ISO C99 support to TR1 in <stdint.h>])
+ AC_CACHE_VAL(ac_c99_stdint_tr1, [
+ AC_TRY_COMPILE([#include <stdint.h>],
+ [typedef int8_t my_int8_t;
+ typedef int16_t my_int16_t;
+ typedef int32_t my_int32_t;
+ typedef int64_t my_int64_t;
+ typedef int_fast8_t my_int_fast8_t;
+ typedef int_fast16_t my_int_fast16_t;
+ typedef int_fast32_t my_int_fast32_t;
+ typedef int_fast64_t my_int_fast64_t;
+ typedef int_least8_t my_int_least8_t;
+ typedef int_least16_t my_int_least16_t;
+ typedef int_least32_t my_int_least32_t;
+ typedef int_least64_t my_int_least64_t;
+ typedef intmax_t my_intmax_t;
+ typedef intptr_t my_intptr_t;
+ typedef uint8_t my_uint8_t;
+ typedef uint16_t my_uint16_t;
+ typedef uint32_t my_uint32_t;
+ typedef uint64_t my_uint64_t;
+ typedef uint_fast8_t my_uint_fast8_t;
+ typedef uint_fast16_t my_uint_fast16_t;
+ typedef uint_fast32_t my_uint_fast32_t;
+ typedef uint_fast64_t my_uint_fast64_t;
+ typedef uint_least8_t my_uint_least8_t;
+ typedef uint_least16_t my_uint_least16_t;
+ typedef uint_least32_t my_uint_least32_t;
+ typedef uint_least64_t my_uint_least64_t;
+ typedef uintmax_t my_uintmax_t;
+ typedef uintptr_t my_uintptr_t;
+ ],[ac_c99_stdint_tr1=yes], [ac_c99_stdint_tr1=no])
+ ])
+ AC_MSG_RESULT($ac_c99_stdint_tr1)
+ if test x"$ac_c99_stdint_tr1" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_C99_STDINT_TR1, 1,
+ [Define if C99 types in <stdint.h> should be imported in
+ <tr1/cstdint> in namespace std::tr1.])
+ fi
+
+ # Check for the existence of <inttypes.h> functions (NB: doesn't make
+ # sense if the previous check fails, per C99, 7.8/1).
+ ac_c99_inttypes_tr1=no;
+ if test x"$ac_c99_stdint_tr1" = x"yes"; then
+ AC_MSG_CHECKING([for ISO C99 support to TR1 in <inttypes.h>])
+ AC_TRY_COMPILE([#include <inttypes.h>],
+ [intmax_t i, numer, denom, base;
+ const char* s;
+ char** endptr;
+ intmax_t ret = imaxabs(i);
+ imaxdiv_t dret = imaxdiv(numer, denom);
+ ret = strtoimax(s, endptr, base);
+ uintmax_t uret = strtoumax(s, endptr, base);
+ ],[ac_c99_inttypes_tr1=yes], [ac_c99_inttypes_tr1=no])
+ fi
+ AC_MSG_RESULT($ac_c99_inttypes_tr1)
+ if test x"$ac_c99_inttypes_tr1" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_TR1, 1,
+ [Define if C99 functions in <inttypes.h> should be imported in
+ <tr1/cinttypes> in namespace std::tr1.])
+ fi
+
+ # Check for the existence of <wchar.h> functions.
+ AC_MSG_CHECKING([for ISO C99 support to TR1 in <wchar.h>])
+ AC_CACHE_VAL(ac_c99_wchar_tr1, [
+ AC_TRY_COMPILE([#include <wchar.h>
+ #include <stdio.h>
+ #include <stdarg.h>],
+ [const wchar_t* nptr;
+ const wchar_t* format;
+ const wchar_t* s;
+ wchar_t** endptr;
+ FILE* stream;
+ va_list arg;
+ int base;
+ float fret = wcstof(nptr, endptr);
+ long double ldret = wcstold(nptr, endptr);
+ int ret = vfwscanf(stream, format, arg);
+ ret = vswscanf(s, format, arg);
+ ret = vwscanf(format, arg);
+ long long llret = wcstoll(nptr, endptr, base);
+ unsigned long long ullret = wcstoull(nptr, endptr, base);
+ ],[ac_c99_wchar_tr1=yes], [ac_c99_wchar_tr1=no])
+ ])
+ AC_MSG_RESULT($ac_c99_wchar_tr1)
+ if test x"$ac_c99_wchar_tr1" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_C99_WCHAR_TR1, 1,
+ [Define if C99 functions in <wchar.h> should be imported in
+ <tr1/cwchar> in namespace std::tr1.])
+ fi
+
+ # Check for the existence of <wctype.h> functions.
+ AC_MSG_CHECKING([for ISO C99 support to TR1 in <wctype.h>])
+ AC_CACHE_VAL(ac_c99_wctype_tr1, [
+ AC_TRY_COMPILE([#include <wctype.h>],
+ [wint_t ch;
+ int ret = iswblank(ch);
+ ],[ac_c99_wctype_tr1=yes], [ac_c99_wctype_tr1=no])
+ ])
+ AC_MSG_RESULT($ac_c99_wctype_tr1)
+ if test x"$ac_c99_wctype_tr1" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_C99_WCTYPE_TR1, 1,
+ [Define if C99 functions in <wctype.h> should be imported in
+ <tr1/cwctype> in namespace std::tr1.])
+ fi
+
+ AC_LANG_RESTORE
+])
+
+
dnl
dnl Check for what type of C headers to use.
dnl
if test $enable_libstdcxx_allocator_flag = auto; then
case ${target_os} in
linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
- enable_libstdcxx_allocator_flag=mt
+ enable_libstdcxx_allocator_flag=new
;;
*)
enable_libstdcxx_allocator_flag=new
dnl glibcxx_PCHFLAGS
dnl
AC_DEFUN([GLIBCXX_ENABLE_PCH], [
- AC_MSG_CHECKING([for enabled PCH])
GLIBCXX_ENABLE(libstdcxx-pch,$1,,[build pre-compiled libstdc++ headers])
- AC_MSG_RESULT([$enable_libstdcxx_pch])
-
if test $enable_libstdcxx_pch = yes; then
AC_CACHE_CHECK([for compiler with PCH support],
[glibcxx_cv_prog_CXX_pch],
enable_libstdcxx_pch=$glibcxx_cv_prog_CXX_pch
fi
+ AC_MSG_CHECKING([for enabled PCH])
+ AC_MSG_RESULT([$enable_libstdcxx_pch])
+
GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes)
if test $enable_libstdcxx_pch = yes; then
glibcxx_PCHFLAGS="-include bits/stdc++.h"
enable_sjlj_exceptions=yes
elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
enable_sjlj_exceptions=no
+ elif grep __cxa_end_cleanup conftest.s >/dev/null 2>&1 ; then
+ enable_sjlj_exceptions=no
fi
fi
CXXFLAGS="$old_CXXFLAGS"
rm -f conftest*
fi
- # This is a tad weird, for hysterical raisins. We have to map enable/disable
- # to two different models.
+ # This is a tad weird, for hysterical raisins. We have to map
+ # enable/disable to two different models.
case $enable_sjlj_exceptions in
yes)
AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1,
GLIBCXX_ENABLE(symvers,$1,[=STYLE],
[enables symbol versioning of the shared library],
- [permit yes|no|gnu])
+ [permit yes|no|gnu|gnu-versioned-namespace|darwin|darwin-export])
# If we never went through the GLIBCXX_CHECK_LINKER_FEATURES macro, then we
# don't know enough about $LD to do tricks...
AC_REQUIRE([GLIBCXX_CHECK_LINKER_FEATURES])
-# FIXME The following test is too strict, in theory.
-if test $enable_shared = no ||
- test "x$LD" = x ||
- test x$glibcxx_gnu_ld_version = x; then
- enable_symvers=no
+
+# Turn a 'yes' into a suitable default.
+if test x$enable_symvers = xyes ; then
+ if test $enable_shared = no || test "x$LD" = x ; then
+ enable_symvers=no
+ else
+ if test $with_gnu_ld = yes ; then
+ enable_symvers=gnu
+ else
+ case ${target_os} in
+ darwin*)
+ enable_symvers=darwin ;;
+ *)
+ enable_symvers=no ;;
+ esac
+ fi
+ fi
+fi
+
+# Check to see if 'darwin' or 'darwin-export' can win.
+if test x$enable_symvers = xdarwin-export ; then
+ enable_symvers=darwin
fi
-# Check to see if libgcc_s exists, indicating that shared libgcc is possible.
-if test $enable_symvers != no; then
+# Check to see if 'gnu' can win.
+if test $enable_symvers = gnu || test $enable_symvers = gnu-versioned-namespace; then
+ # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
AC_MSG_CHECKING([for shared libgcc])
ac_save_CFLAGS="$CFLAGS"
CFLAGS=' -lgcc_s'
fi
fi
AC_MSG_RESULT($glibcxx_shared_libgcc)
-fi
-
-# For GNU ld, we need at least this version. The format is described in
-# GLIBCXX_CHECK_LINKER_FEATURES above.
-glibcxx_min_gnu_ld_version=21400
-# XXXXXXXXXXX glibcxx_gnu_ld_version=21390
-# Check to see if unspecified "yes" value can win, given results above.
-# Change "yes" into either "no" or a style name.
-if test $enable_symvers = yes; then
- if test $with_gnu_ld = yes &&
- test $glibcxx_shared_libgcc = yes;
- then
- if test $glibcxx_gnu_ld_version -ge $glibcxx_min_gnu_ld_version ; then
- enable_symvers=gnu
- else
- # The right tools, the right setup, but too old. Fallbacks?
- AC_MSG_WARN(=== Linker version $glibcxx_gnu_ld_version is too old for)
- AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
- AC_MSG_WARN(=== You would need to upgrade your binutils to version)
- AC_MSG_WARN(=== $glibcxx_min_gnu_ld_version or later and rebuild GCC.)
- if test $glibcxx_gnu_ld_version -ge 21200 ; then
- # Globbing fix is present, proper block support is not.
- dnl AC_MSG_WARN([=== Dude, you are soooo close. Maybe we can fake it.])
- dnl enable_symvers=???
- AC_MSG_WARN([=== Symbol versioning will be disabled.])
- enable_symvers=no
- else
- # 2.11 or older.
- AC_MSG_WARN([=== Symbol versioning will be disabled.])
- enable_symvers=no
- fi
- fi
- else
+ # For GNU ld, we need at least this version. The format is described in
+ # GLIBCXX_CHECK_LINKER_FEATURES above.
+ glibcxx_min_gnu_ld_version=21400
+
+ # If no shared libgcc, can't win.
+ if test $glibcxx_shared_libgcc != yes; then
+ AC_MSG_WARN([=== You have requested GNU symbol versioning, but])
+ AC_MSG_WARN([=== you are not building a shared libgcc_s.])
+ AC_MSG_WARN([=== Symbol versioning will be disabled.])
+ enable_symvers=no
+ elif test $with_gnu_ld != yes ; then
# just fail for now
- AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
- AC_MSG_WARN([=== either you are not using a supported linker, or you are])
- AC_MSG_WARN([=== not building a shared libgcc_s (which is required).])
+ AC_MSG_WARN([=== You have requested GNU symbol versioning, but])
+ AC_MSG_WARN([=== you are not using the GNU linker.])
+ AC_MSG_WARN([=== Symbol versioning will be disabled.])
+ enable_symvers=no
+ elif test $glibcxx_gnu_ld_version -lt $glibcxx_min_gnu_ld_version ; then
+ # The right tools, the right setup, but too old. Fallbacks?
+ AC_MSG_WARN(=== Linker version $glibcxx_gnu_ld_version is too old for)
+ AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
+ AC_MSG_WARN(=== You would need to upgrade your binutils to version)
+ AC_MSG_WARN(=== $glibcxx_min_gnu_ld_version or later and rebuild GCC.)
AC_MSG_WARN([=== Symbol versioning will be disabled.])
enable_symvers=no
fi
# Everything parsed; figure out what file to use.
case $enable_symvers in
no)
- SYMVER_MAP=config/linker-map.dummy
+ SYMVER_FILE=config/abi/pre/none.ver
;;
gnu)
- SYMVER_MAP=config/linker-map.gnu
- AC_DEFINE(_GLIBCXX_SYMVER, 1,
- [Define to use symbol versioning in the shared library.])
+ SYMVER_FILE=config/abi/pre/gnu.ver
+ AC_DEFINE(_GLIBCXX_SYMVER_GNU, 1,
+ [Define to use GNU versioning in the shared library.])
+ ;;
+ gnu-versioned-namespace)
+ SYMVER_FILE=config/abi/pre/gnu-versioned-namespace.ver
+ AC_DEFINE(_GLIBCXX_SYMVER_GNU_NAMESPACE, 1,
+ [Define to use GNU namespace versioning in the shared library.])
+ ;;
+ darwin)
+ SYMVER_FILE=config/abi/pre/gnu.ver
+ AC_DEFINE(_GLIBCXX_SYMVER_DARWIN, 1,
+ [Define to use darwin versioning in the shared library.])
;;
esac
-AC_SUBST(SYMVER_MAP)
+if test x$enable_symvers != xno ; then
+ AC_DEFINE(_GLIBCXX_SYMVER, 1,
+ [Define to use symbol versioning in the shared library.])
+fi
+
+AC_SUBST(SYMVER_FILE)
AC_SUBST(port_specific_symbol_files)
-GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
+GLIBCXX_CONDITIONAL(ENABLE_SYMVERS, test $enable_symvers != no)
+GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU, test $enable_symvers = gnu)
+GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU_NAMESPACE, test $enable_symvers = gnu-versioned-namespace)
+GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_DARWIN, test $enable_symvers = darwin)
AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
+
+# Now, set up compatibility support, if any.
+# In addition, need this to deal with std::size_t mangling in
+# src/compatibility.cc. In a perfect world, could use
+# typeid(std::size_t).name()[0] to do direct substitution.
+AC_MSG_CHECKING([for size_t as unsigned int])
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS="-Werror"
+AC_TRY_COMPILE(, [__SIZE_TYPE__* stp; unsigned int* uip; stp = uip;],
+ [glibcxx_size_t_is_i=yes], [glibcxx_size_t_is_i=no])
+CFLAGS=$ac_save_CFLAGS
+if test "$glibcxx_size_t_is_i" = yes; then
+ AC_DEFINE(_GLIBCXX_SIZE_T_IS_UINT, 1, [Define if size_t is unsigned int.])
+fi
+AC_MSG_RESULT([$glibcxx_size_t_is_i])
+
+AC_MSG_CHECKING([for ptrdiff_t as int])
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS="-Werror"
+AC_TRY_COMPILE(, [__PTRDIFF_TYPE__* ptp; int* ip; ptp = ip;],
+ [glibcxx_ptrdiff_t_is_i=yes], [glibcxx_ptrdiff_t_is_i=no])
+CFLAGS=$ac_save_CFLAGS
+if test "$glibcxx_ptrdiff_t_is_i" = yes; then
+ AC_DEFINE(_GLIBCXX_PTRDIFF_T_IS_INT, 1, [Define if ptrdiff_t is int.])
+fi
+AC_MSG_RESULT([$glibcxx_ptrdiff_t_is_i])
])
])
])
+# Macros from the top-level gcc directory.
+m4_include([../config/tls.m4])
-dnl vim:et:ts=2:sw=2