X-Git-Url: http://git.sourceforge.jp/view?a=blobdiff_plain;f=libstdc%2B%2B-v3%2Facinclude.m4;h=f18b7d90b53120d258206f2ee9728c004f6a4b22;hb=182b909943671fec4328395b5c131e3464f83082;hp=6f6b24e30781e6ab0a3f31c1d43324cbacadfb10;hpb=68224f8df257883ccb806659d64e64debadbc11f;p=pf3gnuchains%2Fgcc-fork.git diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 6f6b24e3078..f18b7d90b53 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -1,53 +1,39 @@ dnl -dnl Check to see what architecture and operating system we are compiling -dnl for. Also, if architecture- or OS-specific flags are required for -dnl compilation, pick them up here. +dnl GLIBCXX_CONDITIONAL (NAME, SHELL-TEST) dnl -AC_DEFUN(GLIBCXX_CHECK_HOST, [ - . $glibcxx_srcdir/configure.host - AC_MSG_NOTICE(CPU config directory is $cpu_include_dir) - AC_MSG_NOTICE(OS config directory is $os_include_dir) -]) +dnl Exactly like AM_CONDITIONAL, but delays evaluation of the test until the +dnl end of configure. This lets tested variables be reassigned, and the +dnl conditional will depend on the final state of the variable. For a simple +dnl example of why this is needed, see GLIBCXX_ENABLE_HOSTED. +dnl +m4_define([_m4_divert(glibcxx_diversion)], 8000)dnl +AC_DEFUN([GLIBCXX_CONDITIONAL], [dnl + m4_divert_text([glibcxx_diversion],dnl + AM_CONDITIONAL([$1],[$2]) + )dnl +])dnl +AC_DEFUN([GLIBCXX_EVALUATE_CONDITIONALS], [m4_undivert([glibcxx_diversion])])dnl dnl -dnl Initialize basic configure bits. +dnl Check to see what architecture and operating system we are compiling +dnl for. Also, if architecture- or OS-specific flags are required for +dnl compilation, pick them up here. dnl -dnl Substs: -dnl multi_basedir -dnl -AC_DEFUN(GLIBCXX_TOPREL_CONFIGURE, [ - # Sets up multi_basedir, which is srcdir/.. plus the usual - # "multi_source_toprel_bottom_adjust" lunacy as needed. - AM_ENABLE_MULTILIB(, ..) - - # The generated code is exactly the same, except that automake's looks in - # ".. $srcdir/.." and autoconf's looks in multi_basedir. Apparently other - # things are triggered on the presence of the two ...AUX_DIR[S], but I don't - # know what they are or what the other differences might be (and they keep - # changing anyhow). - # - # Looking in multi_basedir seems smarter, so actually execute that branch. - if false; then - # this is for automake - AC_CONFIG_AUX_DIR(..) - else - # this is for autoconf - AC_CONFIG_AUX_DIRS(${multi_basedir}) - fi - - dnl XXX Turn this on. - dnl AC_LANG_CPLUSPLUS +AC_DEFUN([GLIBCXX_CHECK_HOST], [ + . $glibcxx_srcdir/configure.host + AC_MSG_NOTICE([CPU config directory is $cpu_include_dir]) + AC_MSG_NOTICE([OS config directory is $os_include_dir]) ]) - dnl dnl Initialize the rest of the library configury. At this point we have dnl variables like $host. dnl dnl Sets: dnl gcc_version (x.y.z format) +dnl SUBDIRS dnl Substs: dnl glibcxx_builddir (absolute path) dnl glibcxx_srcdir (absolute path) @@ -60,7 +46,13 @@ dnl - the variables in GLIBCXX_CHECK_HOST / configure.host dnl - default settings for all AM_CONFITIONAL test variables dnl - lots of tools, like CC and CXX dnl -AC_DEFUN(GLIBCXX_CONFIGURE, [ +AC_DEFUN([GLIBCXX_CONFIGURE], [ + # Keep these sync'd with the list in Makefile.am. The first provides an + # expandable list at autoconf time; the second provides an expandable list + # (i.e., shell variable) at configure time. + m4_define([glibcxx_SUBDIRS],[include libmath libsupc++ src po testsuite]) + SUBDIRS='glibcxx_SUBDIRS' + # 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. @@ -88,8 +80,6 @@ AC_DEFUN(GLIBCXX_CONFIGURE, [ AC_HELP_STRING([--with-newlib], [assume newlib as a system C library])) - AC_PROG_CC - # We're almost certainly being configured before anything else which uses # C++, so all of our AC_PROG_* discoveries will be cached. It's vital that # we not cache the value of CXX that we "discover" here, because it's set @@ -102,18 +92,21 @@ AC_DEFUN(GLIBCXX_CONFIGURE, [ # wrong (non-multilib-adjusted) value will be used in multilibs. This # little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS. And as a side # effect, CXXFLAGS is no longer automagically subst'd, so we have to do - # that ourselves. + # that ourselves. Un-preciousing AC_PROG_CC also affects CC and CFLAGS. # # -fno-builtin must be present here so that a non-conflicting form of # std::exit can be guessed by AC_PROG_CXX, and used in later tests. + m4_define([ac_cv_prog_CXX],[glibcxx_cv_prog_CXX]) m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS]) m4_define([_AC_ARG_VAR_PRECIOUS],[]) save_CXXFLAGS="$CXXFLAGS" CXXFLAGS="$CXXFLAGS -fno-builtin" + AC_PROG_CC AC_PROG_CXX CXXFLAGS="$save_CXXFLAGS" m4_rename([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) + AC_SUBST(CFLAGS) AC_SUBST(CXXFLAGS) # For directory versioning (e.g., headers) and other variables. @@ -121,9 +114,6 @@ AC_DEFUN(GLIBCXX_CONFIGURE, [ gcc_version=`$CXX -dumpversion` AC_MSG_RESULT($gcc_version) - # For some reason, gettext needs this. - AC_ISC_POSIX - # Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't # available). Uncomment the next line to force a particular method. AC_PROG_LN_S @@ -135,7 +125,10 @@ AC_DEFUN(GLIBCXX_CONFIGURE, [ AM_MAINTAINER_MODE - # Set up safe default values for all subsequent AM_CONDITIONAL tests. + # Set up safe default values for all subsequent AM_CONDITIONAL tests + # which are themselves conditionally expanded. + ## (Right now, this only matters for enable_wchar_t, but nothing prevents + ## other macros from doing the same. This should be automated.) -pme need_libmath=no enable_wchar_t=no #enable_libstdcxx_debug=no @@ -144,6 +137,7 @@ AC_DEFUN(GLIBCXX_CONFIGURE, [ #c_compatibility=no #enable_abi_check=no #enable_symvers=no + #enable_hosted_libstdcxx=yes # Find platform-specific directories containing configuration info. # Also possibly modify flags used elsewhere, as needed by the platform. @@ -152,6 +146,7 @@ AC_DEFUN(GLIBCXX_CONFIGURE, [ m4_include([linkage.m4]) +m4_include([../config/no-executables.m4]) dnl @@ -166,7 +161,7 @@ dnl Leave it out by default and use maint-mode to use it. dnl SECTION_FLAGS='-ffunction-sections -fdata-sections' if dnl compiler supports it and the user has not requested debug mode. dnl -AC_DEFUN(GLIBCXX_CHECK_COMPILER_FEATURES, [ +AC_DEFUN([GLIBCXX_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 GLIBCXX_CONFIGURE. @@ -219,7 +214,7 @@ dnl dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will dnl set glibcxx_gnu_ld_version to 12345. Zeros cause problems. dnl -AC_DEFUN(GLIBCXX_CHECK_LINKER_FEATURES, [ +AC_DEFUN([GLIBCXX_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... @@ -309,8 +304,10 @@ dnl dnl Defines: dnl HAVE_MBSTATE_T if mbstate_t is not in wchar.h dnl _GLIBCXX_USE_WCHAR_T if all the bits are found. +dnl Substs: +dnl LIBICONV to a -l string containing the iconv library, if needed. dnl -AC_DEFUN(GLIBCXX_CHECK_WCHAR_T_SUPPORT, [ +AC_DEFUN([GLIBCXX_CHECK_WCHAR_T_SUPPORT], [ # Test wchar.h for mbstate_t, which is needed for char_traits and # others even if wchar_t support is not on. AC_MSG_CHECKING([for mbstate_t]) @@ -356,13 +353,18 @@ AC_DEFUN(GLIBCXX_CHECK_WCHAR_T_SUPPORT, [ # Checks for names injected into std:: by the c_std headers. AC_CHECK_FUNCS([btowc wctob fgetwc fgetws fputwc fputws fwide \ - fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \ - vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \ - mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \ + fwprintf fwscanf swprintf swscanf vfwprintf vswprintf \ + vwprintf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \ + mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstol \ wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \ wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr], [],[ac_wfuncs=no]) + # Checks for wide character functions that are not required + # for basic wchar_t support. Don't disable support if they are missing. + # Injection of these is wrapped with guard macros. + AC_CHECK_FUNCS([vfwscanf vswscanf vwscanf wcstof iswblank],[],[]) + AC_MSG_CHECKING([for ISO C99 wchar_t support]) if test x"$has_weof" = xyes && test x"$has_wchar_minmax" = xyes && @@ -380,9 +382,10 @@ AC_DEFUN(GLIBCXX_CHECK_WCHAR_T_SUPPORT, [ AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no) # Check for existence of libiconv.a providing XPG2 wchar_t support. - AC_CHECK_LIB(iconv, iconv, libiconv="-liconv") + AC_CHECK_LIB(iconv, iconv, LIBICONV="-liconv") ac_save_LIBS="$LIBS" - LIBS="$LIBS $libiconv" + LIBS="$LIBS $LIBICONV" + AC_SUBST(LIBICONV) AC_CHECK_FUNCS([iconv_open iconv_close iconv nl_langinfo], [ac_XPG2funcs=yes], [ac_XPG2funcs=no]) @@ -419,10 +422,10 @@ dnl Check for headers for, and arguments to, the setrlimit() function. dnl Used only in testsuite_hooks.h. Called from GLIBCXX_CONFIGURE_TESTSUITE. dnl dnl Defines: -dnl _GLIBCXX_MEM_LIMITS if we can set artificial limits on memory -dnl various HAVE_MEMLIMIT_* for individual limit names +dnl _GLIBCXX_RES_LIMITS if we can set artificial resource limits +dnl various HAVE_LIMIT_* for individual limit names dnl -AC_DEFUN(GLIBCXX_CHECK_SETRLIMIT_ancilliary, [ +AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT_ancilliary], [ AC_TRY_COMPILE( [#include #include @@ -430,11 +433,11 @@ AC_DEFUN(GLIBCXX_CHECK_SETRLIMIT_ancilliary, [ ], [ int f = RLIMIT_$1 ; ], [glibcxx_mresult=1], [glibcxx_mresult=0]) - AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcxx_mresult, + AC_DEFINE_UNQUOTED(HAVE_LIMIT_$1, $glibcxx_mresult, [Only used in build directory testsuite_hooks.h.]) ]) -AC_DEFUN(GLIBCXX_CHECK_SETRLIMIT, [ +AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT], [ setrlimit_have_headers=yes AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h, [], @@ -447,6 +450,7 @@ AC_DEFUN(GLIBCXX_CHECK_SETRLIMIT, [ GLIBCXX_CHECK_SETRLIMIT_ancilliary(RSS) GLIBCXX_CHECK_SETRLIMIT_ancilliary(VMEM) GLIBCXX_CHECK_SETRLIMIT_ancilliary(AS) + GLIBCXX_CHECK_SETRLIMIT_ancilliary(FSIZE) # Check for rlimit, setrlimit. AC_CACHE_VAL(ac_setrlimit, [ @@ -461,14 +465,14 @@ AC_DEFUN(GLIBCXX_CHECK_SETRLIMIT, [ ]) fi - AC_MSG_CHECKING([for testsuite memory limit support]) + AC_MSG_CHECKING([for testsuite resource limits support]) if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then - ac_mem_limits=yes - AC_DEFINE(_GLIBCXX_MEM_LIMITS) + ac_res_limits=yes + AC_DEFINE(_GLIBCXX_RES_LIMITS) else - ac_mem_limits=no + ac_res_limits=no fi - AC_MSG_RESULT($ac_mem_limits) + AC_MSG_RESULT($ac_res_limits) ]) @@ -476,7 +480,7 @@ dnl dnl Check whether S_ISREG (Posix) or S_IFREG is available in . dnl Define HAVE_S_ISREG / HAVE_S_IFREG appropriately. dnl -AC_DEFUN(GLIBCXX_CHECK_S_ISREG_OR_S_IFREG, [ +AC_DEFUN([GLIBCXX_CHECK_S_ISREG_OR_S_IFREG], [ AC_CACHE_VAL(glibcxx_cv_S_ISREG, [ AC_TRY_LINK( [#include ], @@ -506,9 +510,9 @@ AC_DEFUN(GLIBCXX_CHECK_S_ISREG_OR_S_IFREG, [ dnl dnl Check whether poll is available in , and define HAVE_POLL. dnl -AC_DEFUN(GLIBCXX_CHECK_POLL, [ +AC_DEFUN([GLIBCXX_CHECK_POLL], [ AC_CACHE_VAL(glibcxx_cv_POLL, [ - AC_TRY_COMPILE( + AC_TRY_LINK( [#include ], [struct pollfd pfd[1]; pfd[0].events = POLLIN; @@ -525,9 +529,9 @@ AC_DEFUN(GLIBCXX_CHECK_POLL, [ dnl dnl Check whether writev is available in , and define HAVE_WRITEV. dnl -AC_DEFUN(GLIBCXX_CHECK_WRITEV, [ +AC_DEFUN([GLIBCXX_CHECK_WRITEV], [ AC_CACHE_VAL(glibcxx_cv_WRITEV, [ - AC_TRY_COMPILE( + AC_TRY_LINK( [#include ], [struct iovec iov[2]; writev(0, iov, 0);], @@ -541,6 +545,74 @@ AC_DEFUN(GLIBCXX_CHECK_WRITEV, [ dnl +dnl Check whether int64_t is available in , and define HAVE_INT64_T. +dnl +AC_DEFUN([GLIBCXX_CHECK_INT64_T], [ + AC_CACHE_VAL(glibcxx_cv_INT64_T, [ + AC_TRY_COMPILE( + [#include ], + [int64_t var;], + [glibcxx_cv_INT64_T=yes], + [glibcxx_cv_INT64_T=no]) + ]) + if test $glibcxx_cv_INT64_T = yes; then + AC_DEFINE(HAVE_INT64_T) + fi +]) + + +dnl +dnl Check whether LFS support is available. +dnl +AC_DEFUN([GLIBCXX_CHECK_LFS], [ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + ac_save_CXXFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -fno-exceptions" + AC_CACHE_VAL(glibcxx_cv_LFS, [ + AC_TRY_LINK( + [#include + #include + #include + ], + [FILE* fp; + fopen64("t", "w"); + fseeko64(fp, 0, SEEK_CUR); + ftello64(fp); + lseek64(1, 0, SEEK_CUR); + struct stat64 buf; + fstat64(1, &buf);], + [glibcxx_cv_LFS=yes], + [glibcxx_cv_LFS=no]) + ]) + if test $glibcxx_cv_LFS = yes; then + AC_DEFINE(_GLIBCXX_USE_LFS) + fi + CXXFLAGS="$ac_save_CXXFLAGS" + AC_LANG_RESTORE +]) + + +dnl +dnl Check for whether a fully dynamic basic_string implementation should +dnl be turned on, that does not put empty objects in per-process static +dnl memory (mostly useful together with shared memory allocators, see PR +dnl libstdc++/16612 for details). +dnl +dnl --enable-fully-dynamic-string defines _GLIBCXX_FULLY_DYNAMIC_STRING +dnl --disable-fully-dynamic-string leaves _GLIBCXX_FULLY_DYNAMIC_STRING undefined +dnl + Usage: GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING[(DEFAULT)] +dnl Where DEFAULT is either `yes' or `no'. +dnl +AC_DEFUN([GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING], [ + GLIBCXX_ENABLE(fully-dynamic-string,$1,,[do not put empty strings in per-process static memory]) + if test $enable_fully_dynamic_string = yes; then + AC_DEFINE(_GLIBCXX_FULLY_DYNAMIC_STRING) + fi +]) + + +dnl dnl Does any necessary configuration of the testsuite directory. Generates dnl the testsuite_hooks.h header. dnl @@ -548,36 +620,42 @@ dnl GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE must be done before this. dnl dnl Sets: dnl enable_abi_check / GLIBCXX_TEST_ABI +dnl GLIBCXX_TEST_WCHAR_T +dnl GLIBCXX_TEST_THREAD dnl Substs: dnl baseline_dir dnl -AC_DEFUN(GLIBCXX_CONFIGURE_TESTSUITE, [ - if $GLIBCXX_IS_NATIVE; then - # Do checks for memory limit functions. +AC_DEFUN([GLIBCXX_CONFIGURE_TESTSUITE], [ + if $GLIBCXX_IS_NATIVE && test $is_hosted = yes; 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) + + 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 + 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)" AC_SUBST(baseline_dir) - # Determine if checking the ABI is desirable. - 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 - - AM_CONDITIONAL(GLIBCXX_TEST_WCHAR_T, test $enable_wchar_t = yes) - AM_CONDITIONAL(GLIBCXX_TEST_ABI, test $enable_abi_check = yes) + 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) ]) @@ -587,27 +665,27 @@ dnl dnl Substs: dnl GLIBCXX_INCLUDES dnl TOPLEVEL_INCLUDES -dnl LIBMATH_INCLUDES -dnl LIBSUPCXX_INCLUDES dnl -AC_DEFUN(GLIBCXX_EXPORT_INCLUDES, [ - # Root level of the build directory include sources. - GLIBCXX_INCLUDES="-I$glibcxx_builddir/include/$host_alias -I$glibcxx_builddir/include" +AC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [ + # Used for every C++ compile we perform. + GLIBCXX_INCLUDES="\ +-I$glibcxx_builddir/include/$host_alias \ +-I$glibcxx_builddir/include \ +-I$glibcxx_srcdir/libsupc++" - # Passed down for canadian crosses. + # For Canadian crosses, pick this up too. if test $CANADIAN = yes; then - TOPLEVEL_INCLUDES='-I${includedir}' + GLIBCXX_INCLUDES="$GLIBCXX_INCLUDES -I\${includedir}" fi - LIBMATH_INCLUDES='-I${glibcxx_srcdir}/libmath' - - LIBSUPCXX_INCLUDES='-I${glibcxx_srcdir}/libsupc++' + # Stuff in the actual top level. Currently only used by libsupc++ to + # get unwind* headers from the gcc dir. + #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include' + TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc' # Now, export this to all the little Makefiles.... AC_SUBST(GLIBCXX_INCLUDES) AC_SUBST(TOPLEVEL_INCLUDES) - AC_SUBST(LIBMATH_INCLUDES) - AC_SUBST(LIBSUPCXX_INCLUDES) ]) @@ -619,14 +697,14 @@ dnl Substs: dnl OPTIMIZE_CXXFLAGS dnl WARN_FLAGS dnl -AC_DEFUN(GLIBCXX_EXPORT_FLAGS, [ +AC_DEFUN([GLIBCXX_EXPORT_FLAGS], [ # Optimization flags that are probably a good idea for thrill-seekers. Just # uncomment the lines below and make, everything else is ready to go... # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc OPTIMIZE_CXXFLAGS= AC_SUBST(OPTIMIZE_CXXFLAGS) - WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings' + WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual' AC_SUBST(WARN_FLAGS) ]) @@ -643,7 +721,7 @@ dnl dnl Assumes cross_compiling bits already done, and with_cross_host in dnl particular. dnl -AC_DEFUN(GLIBCXX_EXPORT_INSTALL_INFO, [ +AC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [ glibcxx_toolexecdir=no glibcxx_toolexeclibdir=no glibcxx_prefixdir=$prefix @@ -681,12 +759,13 @@ AC_DEFUN(GLIBCXX_EXPORT_INSTALL_INFO, [ if test $version_specific_libs = yes; then # Need the gcc compiler version to know where to install libraries # and header files if --enable-version-specific-runtime-libs option - # is selected. + # is selected. FIXME: these variables are misnamed, there are + # no executables installed in _toolexecdir or _toolexeclibdir. if test x"$gxx_include_dir" = x"no"; then - gxx_include_dir='$libdir/gcc-lib/$host_alias/'$gcc_version/include/c++ + gxx_include_dir='${libdir}/gcc/${host_alias}/'$gcc_version/include/c++ fi - glibcxx_toolexecdir='$libdir/gcc-lib/$host_alias' - glibcxx_toolexeclibdir='$toolexecdir/'$gcc_version'$(MULTISUBDIR)' + glibcxx_toolexecdir='${libdir}/gcc/${host_alias}' + glibcxx_toolexeclibdir='${toolexecdir}/'$gcc_version'$(MULTISUBDIR)' fi # Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir @@ -694,13 +773,13 @@ AC_DEFUN(GLIBCXX_EXPORT_INSTALL_INFO, [ if test x"$glibcxx_toolexecdir" = x"no"; then if test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then - glibcxx_toolexecdir='$(exec_prefix)/$(host_alias)' - glibcxx_toolexeclibdir='$(toolexecdir)/lib' + glibcxx_toolexecdir='${exec_prefix}/${host_alias}' + glibcxx_toolexeclibdir='${toolexecdir}/lib' else - glibcxx_toolexecdir='$(libdir)/gcc-lib/$(host_alias)' - glibcxx_toolexeclibdir='$(libdir)' + glibcxx_toolexecdir='${libdir}/gcc/${host_alias}' + glibcxx_toolexeclibdir='${libdir}' fi - multi_os_directory=`$CC -print-multi-os-directory` + multi_os_directory=`$CXX -print-multi-os-directory` case $multi_os_directory in .) ;; # Avoid trailing /. *) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;; @@ -762,7 +841,7 @@ dnl + Usage: GLIBCXX_ENABLE_C99[(DEFAULT)] dnl Where DEFAULT is either `yes' or `no'. dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'. dnl -AC_DEFUN(GLIBCXX_ENABLE_C99, [ +AC_DEFUN([GLIBCXX_ENABLE_C99], [ GLIBCXX_ENABLE(c99,$1,,[turns on ISO/IEC 9899:1999 support]) AC_LANG_SAVE @@ -788,6 +867,125 @@ AC_DEFUN(GLIBCXX_ENABLE_C99, [ [isunordered(0.0,0.0);],, [ac_c99_math=no]) AC_MSG_RESULT($ac_c99_math) + if test x"$ac_c99_math" = x"yes"; then + AC_DEFINE(_GLIBCXX_USE_C99_MATH) + fi + + # Check for the existence of complex 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. + 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 + ac_c99_complex=yes; + AC_MSG_CHECKING([for ISO C99 support in ]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ float _ComplexT; _ComplexT tmp; + cabsf(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ double _ComplexT; _ComplexT tmp; + cabs(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ long double _ComplexT; _ComplexT tmp; + cabsl(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ float _ComplexT; _ComplexT tmp; + cargf(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ double _ComplexT; _ComplexT tmp; + carg(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ long double _ComplexT; _ComplexT tmp; + cargl(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ float _ComplexT; _ComplexT tmp; + ccosf(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ double _ComplexT; _ComplexT tmp; + ccos(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ long double _ComplexT; _ComplexT tmp; + ccosl(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ float _ComplexT; _ComplexT tmp; + ccoshf(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ double _ComplexT; _ComplexT tmp; + ccosh(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ long double _ComplexT; _ComplexT tmp; + ccoshl(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ float _ComplexT; _ComplexT tmp; + cexpf(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ double _ComplexT; _ComplexT tmp; + cexp(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ long double _ComplexT; _ComplexT tmp; + cexpl(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ float _ComplexT; _ComplexT tmp; + csinf(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ double _ComplexT; _ComplexT tmp; + csin(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ long double _ComplexT; _ComplexT tmp; + csinl(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ float _ComplexT; _ComplexT tmp; + csinhf(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ double _ComplexT; _ComplexT tmp; + csinh(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ long double _ComplexT; _ComplexT tmp; + csinhl(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ float _ComplexT; _ComplexT tmp; + csqrtf(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ double _ComplexT; _ComplexT tmp; + csqrt(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ long double _ComplexT; _ComplexT tmp; + csqrtl(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ float _ComplexT; _ComplexT tmp; + ctanf(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ double _ComplexT; _ComplexT tmp; + ctan(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ long double _ComplexT; _ComplexT tmp; + ctanl(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ float _ComplexT; _ComplexT tmp; + ctanhf(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ double _ComplexT; _ComplexT tmp; + ctanh(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ long double _ComplexT; _ComplexT tmp; + ctanhl(tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ float _ComplexT; _ComplexT tmp; + cpowf(tmp, tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ double _ComplexT; _ComplexT tmp; + cpow(tmp, tmp);],, [ac_c99_complex=no]) + AC_TRY_COMPILE([#include ], + [typedef __complex__ long double _ComplexT; _ComplexT tmp; + cpowl(tmp, tmp);],, [ac_c99_complex=no]) + fi + AC_MSG_RESULT($ac_c99_complex) + + if test x"$ac_c99_complex" = x"yes"; then + AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX_MATH) + fi + # Check for the existence in of vscanf, et. al. ac_c99_stdio=yes; AC_MSG_CHECKING([for ISO C99 support in ]) @@ -857,6 +1055,7 @@ AC_DEFUN(GLIBCXX_ENABLE_C99, [ AC_MSG_CHECKING([for enabled ISO C99 support]) if test x"$ac_c99_math" = x"no" || + test x"$ac_c99_complex" = x"no" || test x"$ac_c99_stdio" = x"no" || test x"$ac_c99_stdlib" = x"no" || test x"$ac_c99_wchar" = x"no"; then @@ -881,7 +1080,7 @@ dnl --disable-cheaders [does not do anything, really]. dnl + Usage: GLIBCXX_ENABLE_CHEADERS[(DEFAULT)] dnl Where DEFAULT is either `c' or `c_std'. dnl -AC_DEFUN(GLIBCXX_ENABLE_CHEADERS, [ +AC_DEFUN([GLIBCXX_ENABLE_CHEADERS], [ GLIBCXX_ENABLE(cheaders,$1,[=KIND], [construct "C" headers for g++], [permit c|c_std]) AC_MSG_NOTICE("C" header strategy set to $enable_cheaders) @@ -889,9 +1088,9 @@ AC_DEFUN(GLIBCXX_ENABLE_CHEADERS, [ C_INCLUDE_DIR='${glibcxx_srcdir}/include/'$enable_cheaders AC_SUBST(C_INCLUDE_DIR) - AM_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c) - AM_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std) - AM_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes) + GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c) + GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std) + GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes) ]) @@ -901,7 +1100,7 @@ dnl a subdirectory of config/locale. dnl dnl Default is generic. dnl -AC_DEFUN(GLIBCXX_ENABLE_CLOCALE, [ +AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [ AC_MSG_CHECKING([for C locale to use]) GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], [use MODEL for target locale package], @@ -920,8 +1119,8 @@ AC_DEFUN(GLIBCXX_ENABLE_CLOCALE, [ # Probe for locale support if no specific model is specified. # Default to "generic". if test $enable_clocale_flag = auto; then - case x${target_os} in - xlinux* | xgnu*) + case ${target_os} in + linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) AC_EGREP_CPP([_GLIBCXX_ok], [ #include #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) @@ -930,7 +1129,7 @@ AC_DEFUN(GLIBCXX_ENABLE_CLOCALE, [ ], enable_clocale_flag=gnu, enable_clocale_flag=generic) # Test for bugs early in glibc-2.2.x series - if test x$enable_clocale_flag = xgnu; then + if test $enable_clocale_flag = gnu; then AC_TRY_RUN([ #define _GNU_SOURCE 1 #include @@ -961,6 +1160,9 @@ AC_DEFUN(GLIBCXX_ENABLE_CLOCALE, [ # ... at some point put __strxfrm_l tests in as well. ;; + darwin* | freebsd*) + enable_clocale_flag=darwin + ;; *) enable_clocale_flag=generic ;; @@ -983,7 +1185,6 @@ AC_DEFUN(GLIBCXX_ENABLE_CLOCALE, [ CLOCALE_H=config/locale/generic/c_locale.h CLOCALE_CC=config/locale/generic/c_locale.cc - CCODECVT_H=config/locale/generic/codecvt_specializations.h CCODECVT_CC=config/locale/generic/codecvt_members.cc CCOLLATE_CC=config/locale/generic/collate_members.cc CCTYPE_CC=config/locale/generic/ctype_members.cc @@ -995,6 +1196,23 @@ AC_DEFUN(GLIBCXX_ENABLE_CLOCALE, [ CTIME_CC=config/locale/generic/time_members.cc CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h ;; + darwin) + AC_MSG_RESULT(darwin or freebsd) + + CLOCALE_H=config/locale/generic/c_locale.h + CLOCALE_CC=config/locale/generic/c_locale.cc + CCODECVT_CC=config/locale/generic/codecvt_members.cc + CCOLLATE_CC=config/locale/generic/collate_members.cc + CCTYPE_CC=config/locale/darwin/ctype_members.cc + CMESSAGES_H=config/locale/generic/messages_members.h + CMESSAGES_CC=config/locale/generic/messages_members.cc + CMONEY_CC=config/locale/generic/monetary_members.cc + CNUMERIC_CC=config/locale/generic/numeric_members.cc + CTIME_H=config/locale/generic/time_members.h + CTIME_CC=config/locale/generic/time_members.cc + CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h + ;; + gnu) AC_MSG_RESULT(gnu) @@ -1018,7 +1236,6 @@ AC_DEFUN(GLIBCXX_ENABLE_CLOCALE, [ CLOCALE_H=config/locale/gnu/c_locale.h CLOCALE_CC=config/locale/gnu/c_locale.cc - CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h CCODECVT_CC=config/locale/gnu/codecvt_members.cc CCOLLATE_CC=config/locale/gnu/collate_members.cc CCTYPE_CC=config/locale/gnu/ctype_members.cc @@ -1035,7 +1252,6 @@ AC_DEFUN(GLIBCXX_ENABLE_CLOCALE, [ CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc - CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h CCODECVT_CC=config/locale/generic/codecvt_members.cc CCOLLATE_CC=config/locale/generic/collate_members.cc CCTYPE_CC=config/locale/generic/ctype_members.cc @@ -1065,7 +1281,6 @@ AC_DEFUN(GLIBCXX_ENABLE_CLOCALE, [ AC_SUBST(USE_NLS) AC_SUBST(CLOCALE_H) - AC_SUBST(CCODECVT_H) AC_SUBST(CMESSAGES_H) AC_SUBST(CCODECVT_CC) AC_SUBST(CCOLLATE_CC) @@ -1081,6 +1296,75 @@ AC_DEFUN(GLIBCXX_ENABLE_CLOCALE, [ dnl +dnl Check for which std::allocator base class to use. The choice is +dnl mapped from a subdirectory of include/ext. +dnl +dnl Default is new. +dnl +AC_DEFUN([GLIBCXX_ENABLE_ALLOCATOR], [ + AC_MSG_CHECKING([for std::allocator base class to use]) + GLIBCXX_ENABLE(libstdcxx-allocator,auto,[=KIND], + [use KIND for target std::allocator base], + [permit new|malloc|mt|bitmap|pool|yes|no|auto]) + + # If they didn't use this option switch, or if they specified --enable + # with no specific model, we'll have to look for one. If they + # specified --disable (???), do likewise. + if test $enable_libstdcxx_allocator = no || + test $enable_libstdcxx_allocator = yes; + then + enable_libstdcxx_allocator=auto + fi + + # Either a known package, or "auto". Auto implies the default choice + # for a particular platform. + enable_libstdcxx_allocator_flag=$enable_libstdcxx_allocator + + # Probe for host-specific support if no specific model is specified. + # Default to "new". + 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 + ;; + esac + fi + AC_MSG_RESULT($enable_libstdcxx_allocator_flag) + + + # Set configure bits for specified locale package + case ${enable_libstdcxx_allocator_flag} in + bitmap) + ALLOCATOR_H=config/allocator/bitmap_allocator_base.h + ALLOCATOR_NAME=__gnu_cxx::bitmap_allocator + ;; + malloc) + ALLOCATOR_H=config/allocator/malloc_allocator_base.h + ALLOCATOR_NAME=__gnu_cxx::malloc_allocator + ;; + mt) + ALLOCATOR_H=config/allocator/mt_allocator_base.h + ALLOCATOR_NAME=__gnu_cxx::__mt_alloc + ;; + new) + ALLOCATOR_H=config/allocator/new_allocator_base.h + ALLOCATOR_NAME=__gnu_cxx::new_allocator + ;; + pool) + ALLOCATOR_H=config/allocator/pool_allocator_base.h + ALLOCATOR_NAME=__gnu_cxx::__pool_alloc + ;; + esac + + AC_SUBST(ALLOCATOR_H) + AC_SUBST(ALLOCATOR_NAME) +]) + + +dnl dnl Check for whether the Boost-derived checks should be turned on. dnl dnl --enable-concept-checks turns them on. @@ -1088,7 +1372,7 @@ dnl --disable-concept-checks leaves them off. dnl + Usage: GLIBCXX_ENABLE_CONCEPT_CHECKS[(DEFAULT)] dnl Where DEFAULT is either `yes' or `no'. dnl -AC_DEFUN(GLIBCXX_ENABLE_CONCEPT_CHECKS, [ +AC_DEFUN([GLIBCXX_ENABLE_CONCEPT_CHECKS], [ GLIBCXX_ENABLE(concept-checks,$1,,[use Boost-derived template checks]) if test $enable_concept_checks = yes; then AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS) @@ -1101,7 +1385,7 @@ dnl Check for which I/O library to use: stdio, or something specific. dnl dnl Default is stdio. dnl -AC_DEFUN(GLIBCXX_ENABLE_CSTDIO, [ +AC_DEFUN([GLIBCXX_ENABLE_CSTDIO], [ AC_MSG_CHECKING([for underlying I/O to use]) GLIBCXX_ENABLE(cstdio,stdio,[=PACKAGE], [use target-specific I/O package], [permit stdio]) @@ -1118,11 +1402,7 @@ AC_DEFUN(GLIBCXX_ENABLE_CSTDIO, [ ;; esac - dnl Set directory for fpos.h - FPOS_H=$fpos_include_dir - AC_SUBST(CSTDIO_H) - AC_SUBST(FPOS_H) AC_SUBST(BASIC_FILE_H) AC_SUBST(BASIC_FILE_CC) ]) @@ -1141,7 +1421,7 @@ dnl + Usage: GLIBCXX_ENABLE_CXX_FLAGS(default flags) dnl If "default flags" is an empty string, the effect is the same dnl as --disable or --enable=no. dnl -AC_DEFUN(GLIBCXX_ENABLE_CXX_FLAGS, [dnl +AC_DEFUN([GLIBCXX_ENABLE_CXX_FLAGS], [dnl AC_MSG_CHECKING([for extra compiler flags for building]) GLIBCXX_ENABLE(cxx-flags,$1,[=FLAGS], [pass compiler FLAGS when building library], @@ -1179,7 +1459,7 @@ dnl --disable-c-mbchar doesn't. dnl + Usage: GLIBCXX_ENABLE_C_MBCHAR[(DEFAULT)] dnl Where DEFAULT is either `yes' or `no'. dnl -AC_DEFUN(GLIBCXX_ENABLE_C_MBCHAR, [ +AC_DEFUN([GLIBCXX_ENABLE_C_MBCHAR], [ GLIBCXX_ENABLE(c-mbchar,$1,,[enable multibyte (wide) characters]) # Option parsed, now other scripts can test enable_c_mbchar for yes/no. ]) @@ -1201,11 +1481,11 @@ dnl dnl + Usage: GLIBCXX_ENABLE_DEBUG[(DEFAULT)] dnl Where DEFAULT is either `yes' or `no'. dnl -AC_DEFUN(GLIBCXX_ENABLE_DEBUG, [ +AC_DEFUN([GLIBCXX_ENABLE_DEBUG], [ AC_MSG_CHECKING([for additional debug build]) GLIBCXX_ENABLE(libstdcxx-debug,$1,,[build extra debug library]) AC_MSG_RESULT($enable_libstdcxx_debug) - AM_CONDITIONAL(GLIBCXX_BUILD_DEBUG, test $enable_libstdcxx_debug = yes) + GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_DEBUG, test $enable_libstdcxx_debug = yes) ]) @@ -1221,7 +1501,7 @@ dnl + Usage: GLIBCXX_ENABLE_DEBUG_FLAGS(default flags) dnl If "default flags" is an empty string, the effect is the same dnl as --disable or --enable=no. dnl -AC_DEFUN(GLIBCXX_ENABLE_DEBUG_FLAGS, [ +AC_DEFUN([GLIBCXX_ENABLE_DEBUG_FLAGS], [ GLIBCXX_ENABLE(libstdcxx-debug-flags,[$1],[=FLAGS], [pass compiler FLAGS when building debug library], [case "x$enable_libstdcxx_debug_flags" in @@ -1239,29 +1519,44 @@ AC_DEFUN(GLIBCXX_ENABLE_DEBUG_FLAGS, [ dnl -dnl Check for libunwind exception handling support. If enabled, then -dnl we assume that the _Unwind_* functions that make up the Unwind ABI -dnl (_Unwind_RaiseException, _Unwind_Resume, etc.) are defined by -dnl libunwind instead of libgcc, and that libstdc++ has a dependency -dnl on libunwind as well as libgcc. +dnl Check if the user only wants a freestanding library implementation. dnl -dnl --enable-libunwind-exceptions forces the use of libunwind. -dnl --disable-libunwind-exceptions assumes there is no libunwind. +dnl --disable-hosted-libstdcxx will turn off most of the library build, +dnl installing only the headers required by [17.4.1.3] and the language +dnl support library. More than that will be built (to keep the Makefiles +dnl conveniently clean), but not installed. dnl -dnl Substs: -dnl LIBUNWIND_FLAG -dnl -AC_DEFUN(GLIBCXX_ENABLE_LIBUNWIND_EXCEPTIONS, [ - AC_MSG_CHECKING([for use of libunwind]) - GLIBCXX_ENABLE(libunwind-exceptions,no,, - [force use of libunwind for exceptions]) - AC_MSG_RESULT($use_libunwind_exceptions) - if test $enable_libunwind_exceptions = yes; then - LIBUNWIND_FLAG="-lunwind" +dnl Sets: +dnl is_hosted (yes/no) +dnl +dnl Defines: +dnl _GLIBCXX_HOSTED (always defined, either to 1 or 0) +dnl +AC_DEFUN([GLIBCXX_ENABLE_HOSTED], [ + AC_ARG_ENABLE([hosted-libstdcxx], + AC_HELP_STRING([--disable-hosted-libstdcxx], + [only build freestanding C++ runtime support]),, + [case "$host" in + arm*-*-symbianelf*) + enable_hosted_libstdcxx=no + ;; + *) + enable_hosted_libstdcxx=yes + ;; + esac]) + if test "$enable_hosted_libstdcxx" = no; then + AC_MSG_NOTICE([Only freestanding libraries will be built]) + is_hosted=no + hosted_define=0 + enable_abi_check=no + enable_libstdcxx_pch=no else - LIBUNWIND_FLAG="" + is_hosted=yes + hosted_define=1 fi - AC_SUBST(LIBUNWIND_FLAG) + GLIBCXX_CONDITIONAL(GLIBCXX_HOSTED, test $is_hosted = yes) + AC_DEFINE_UNQUOTED(_GLIBCXX_HOSTED, $hosted_define, + [Define to 1 if a full hosted library is built, or 0 if freestanding.]) ]) @@ -1274,28 +1569,12 @@ dnl --enable-long-long defines _GLIBCXX_USE_LONG_LONG dnl --disable-long-long leaves _GLIBCXX_USE_LONG_LONG undefined dnl + Usage: GLIBCXX_ENABLE_LONG_LONG[(DEFAULT)] dnl Where DEFAULT is either `yes' or `no'. -dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'. dnl -AC_DEFUN(GLIBCXX_ENABLE_LONG_LONG, [ +AC_DEFUN([GLIBCXX_ENABLE_LONG_LONG], [ GLIBCXX_ENABLE(long-long,$1,,[enables I/O support for 'long long']) - - AC_LANG_SAVE - AC_LANG_CPLUSPLUS - - AC_MSG_CHECKING([for enabled long long I/O support]) - # iostreams require strtoll, strtoull to compile - AC_TRY_COMPILE([#include ], - [char* tmp; strtoll("gnu", &tmp, 10);],,[enable_long_long=no]) - AC_TRY_COMPILE([#include ], - [char* tmp; strtoull("gnu", &tmp, 10);],,[enable_long_long=no]) - - # Option parsed, now set things appropriately if test $enable_long_long = yes; then AC_DEFINE(_GLIBCXX_USE_LONG_LONG) fi - AC_MSG_RESULT($enable_long_long) - - AC_LANG_RESTORE ]) @@ -1313,7 +1592,7 @@ dnl dnl Substs: dnl glibcxx_PCHFLAGS dnl -AC_DEFUN(GLIBCXX_ENABLE_PCH, [ +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]) @@ -1343,7 +1622,7 @@ AC_DEFUN(GLIBCXX_ENABLE_PCH, [ enable_libstdcxx_pch=$glibcxx_cv_prog_CXX_pch fi - AM_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes) + GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes) if test $enable_libstdcxx_pch = yes; then glibcxx_PCHFLAGS="-include bits/stdc++.h" else @@ -1360,25 +1639,26 @@ dnl target may or may not support call frame exceptions. dnl dnl --enable-sjlj-exceptions forces the use of builtin setjmp. dnl --disable-sjlj-exceptions forces the use of call frame unwinding. +dnl Neither one forces an attempt at detection. dnl dnl Defines: dnl _GLIBCXX_SJLJ_EXCEPTIONS if the compiler is configured for it dnl -AC_DEFUN(GLIBCXX_ENABLE_SJLJ_EXCEPTIONS, [ +AC_DEFUN([GLIBCXX_ENABLE_SJLJ_EXCEPTIONS], [ AC_MSG_CHECKING([for exception model to use]) AC_LANG_SAVE AC_LANG_CPLUSPLUS - GLIBCXX_ENABLE(sjlj-exceptions,no,, + GLIBCXX_ENABLE(sjlj-exceptions,auto,, [force use of builtin_setjmp for exceptions], - [:], - [# Botheration. Now we've got to detect the exception model. - # Link tests against libgcc.a are problematic since -- at least - # as of this writing -- we've not been given proper -L bits for - # single-tree newlib and libgloss. - # - # This is what AC_TRY_COMPILE would do if it didn't delete the - # conftest files before we got a change to grep them first. - cat > conftest.$ac_ext << EOF + [permit yes|no|auto]) + + if test $enable_sjlj_exceptions = auto; then + # Botheration. Now we've got to detect the exception model. Link tests + # against libgcc.a are problematic since we've not been given proper -L + # bits for single-tree newlib and libgloss. + # + # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. + cat > conftest.$ac_ext << EOF [#]line __oline__ "configure" struct S { ~S(); }; void bar(); @@ -1388,27 +1668,34 @@ void foo() bar(); } EOF - old_CXXFLAGS="$CXXFLAGS" - CXXFLAGS=-S - if AC_TRY_EVAL(ac_compile); then - if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then - enable_sjlj_exceptions=yes - elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then - enable_sjlj_exceptions=no - fi - fi - CXXFLAGS="$old_CXXFLAGS" - rm -f conftest* - ]) - if test $enable_sjlj_exceptions = yes; then - AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1, - [Define if the compiler is configured for setjmp/longjmp exceptions.]) - ac_exception_model_name=sjlj - elif test x$enable_sjlj_exceptions = xno; then - ac_exception_model_name="call frame" - else - AC_MSG_ERROR([unable to detect exception model]) - fi + old_CXXFLAGS="$CXXFLAGS" + CXXFLAGS=-S + if AC_TRY_EVAL(ac_compile); then + if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then + enable_sjlj_exceptions=yes + elif grep _Unwind_Resume 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. + case $enable_sjlj_exceptions in + yes) + AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1, + [Define if the compiler is configured for setjmp/longjmp exceptions.]) + ac_exception_model_name=sjlj + ;; + no) + ac_exception_model_name="call frame" + ;; + *) + AC_MSG_ERROR([unable to detect exception model]) + ;; + esac AC_LANG_RESTORE AC_MSG_RESULT($ac_exception_model_name) ]) @@ -1427,7 +1714,7 @@ dnl Where DEFAULT is either 'yes' or 'no'. Passing `yes' tries to dnl choose a default style based on linker characteristics. Passing dnl 'no' disables versioning. dnl -AC_DEFUN(GLIBCXX_ENABLE_SYMVERS, [ +AC_DEFUN([GLIBCXX_ENABLE_SYMVERS], [ GLIBCXX_ENABLE(symvers,$1,[=STYLE], [enables symbol versioning of the shared library], @@ -1450,6 +1737,23 @@ if test $enable_symvers != no; then CFLAGS=' -lgcc_s' AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes, glibcxx_shared_libgcc=no) CFLAGS="$ac_save_CFLAGS" + if test $glibcxx_shared_libgcc = no; then + cat > conftest.c <&1 >/dev/null \ + | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'` +changequote([,])dnl + rm -f conftest.c conftest.so + if test x${glibcxx_libgcc_s_suffix+set} = xset; then + CFLAGS=" -lgcc_s$glibcxx_libgcc_s_suffix" + AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes) + CFLAGS="$ac_save_CFLAGS" + fi + fi AC_MSG_RESULT($glibcxx_shared_libgcc) fi @@ -1507,7 +1811,7 @@ esac AC_SUBST(SYMVER_MAP) AC_SUBST(port_specific_symbol_files) -AM_CONDITIONAL(GLIBCXX_BUILD_VERSIONED_SHLIB, test $enable_symvers != no) +GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_VERSIONED_SHLIB, test $enable_symvers != no) AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers) ]) @@ -1529,19 +1833,26 @@ dnl glibcxx_thread_h dnl dnl Defines: dnl HAVE_GTHR_DEFAULT -dnl _GLIBCXX_SUPPORTS_WEAK dnl -AC_DEFUN(GLIBCXX_ENABLE_THREADS, [ +AC_DEFUN([GLIBCXX_ENABLE_THREADS], [ AC_MSG_CHECKING([for thread model used by GCC]) - target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` + target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'` AC_MSG_RESULT([$target_thread_file]) if test $target_thread_file != single; then AC_DEFINE(HAVE_GTHR_DEFAULT) - AC_DEFINE(_GLIBCXX_SUPPORTS_WEAK, __GXX_WEAK__) fi glibcxx_thread_h=gthr-$target_thread_file.h + + dnl Check for __GTHREADS define. + gthread_file=${toplevel_srcdir}/gcc/${glibcxx_thread_h} + if grep __GTHREADS $gthread_file >/dev/null 2>&1 ; then + enable_thread=yes + else + enable_thread=no + fi + AC_SUBST(glibcxx_thread_h) ]) @@ -1555,7 +1866,7 @@ AC_DEFUN(GLIBCXX_ENABLE_THREADS, [ # Please note that the actual code is *not* freely available. # serial 1 -AC_DEFUN(AC_LC_MESSAGES, [ +AC_DEFUN([AC_LC_MESSAGES], [ AC_CHECK_HEADER(locale.h, [ AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES, [AC_TRY_LINK([#include ], [return LC_MESSAGES],