acinclude.m4 revision 169691
1132720Skan 297403Sobriendnl 3132720Skandnl GLIBCXX_CONDITIONAL (NAME, SHELL-TEST) 497403Sobriendnl 5132720Skandnl Exactly like AM_CONDITIONAL, but delays evaluation of the test until the 6132720Skandnl end of configure. This lets tested variables be reassigned, and the 7132720Skandnl conditional will depend on the final state of the variable. For a simple 8132720Skandnl example of why this is needed, see GLIBCXX_ENABLE_HOSTED. 9132720Skandnl 10132720Skanm4_define([_m4_divert(glibcxx_diversion)], 8000)dnl 11132720SkanAC_DEFUN([GLIBCXX_CONDITIONAL], [dnl 12132720Skan m4_divert_text([glibcxx_diversion],dnl 13132720Skan AM_CONDITIONAL([$1],[$2]) 14132720Skan )dnl 15132720Skan])dnl 16132720SkanAC_DEFUN([GLIBCXX_EVALUATE_CONDITIONALS], [m4_undivert([glibcxx_diversion])])dnl 1797403Sobrien 18132720Skan 19132720Skandnl 20132720Skandnl Check to see what architecture and operating system we are compiling 21132720Skandnl for. Also, if architecture- or OS-specific flags are required for 22132720Skandnl compilation, pick them up here. 23132720Skandnl 24132720SkanAC_DEFUN([GLIBCXX_CHECK_HOST], [ 25132720Skan . $glibcxx_srcdir/configure.host 26132720Skan AC_MSG_NOTICE([CPU config directory is $cpu_include_dir]) 27132720Skan AC_MSG_NOTICE([OS config directory is $os_include_dir]) 28132720Skan]) 29132720Skan 30132720Skandnl 31132720Skandnl Initialize the rest of the library configury. At this point we have 32132720Skandnl variables like $host. 33102782Skandnl 34132720Skandnl Sets: 35132720Skandnl SUBDIRS 36132720Skandnl Substs: 37132720Skandnl glibcxx_builddir (absolute path) 38132720Skandnl glibcxx_srcdir (absolute path) 39132720Skandnl toplevel_srcdir (absolute path) 40132720Skandnl with_cross_host 41132720Skandnl with_newlib 42132720Skandnl with_target_subdir 43132720Skandnl plus 44132720Skandnl - the variables in GLIBCXX_CHECK_HOST / configure.host 45132720Skandnl - default settings for all AM_CONFITIONAL test variables 46132720Skandnl - lots of tools, like CC and CXX 47132720Skandnl 48132720SkanAC_DEFUN([GLIBCXX_CONFIGURE], [ 49132720Skan # Keep these sync'd with the list in Makefile.am. The first provides an 50132720Skan # expandable list at autoconf time; the second provides an expandable list 51132720Skan # (i.e., shell variable) at configure time. 52132720Skan m4_define([glibcxx_SUBDIRS],[include libmath libsupc++ src po testsuite]) 53132720Skan SUBDIRS='glibcxx_SUBDIRS' 54132720Skan 5597403Sobrien # These need to be absolute paths, yet at the same time need to 5697403Sobrien # canonicalize only relative paths, because then amd will not unmount 5797403Sobrien # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd. 58132720Skan glibcxx_builddir=`${PWDCMD-pwd}` 5997403Sobrien case $srcdir in 60132720Skan [\\/$]* | ?:[\\/]*) glibcxx_srcdir=${srcdir} ;; 61132720Skan *) glibcxx_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;; 6297403Sobrien esac 63132720Skan toplevel_srcdir=${glibcxx_srcdir}/.. 64132720Skan AC_SUBST(glibcxx_builddir) 65132720Skan AC_SUBST(glibcxx_srcdir) 66132720Skan AC_SUBST(toplevel_srcdir) 6797403Sobrien 68132720Skan # We use these options to decide which functions to include. They are 69132720Skan # set from the top level. 70132720Skan AC_ARG_WITH([target-subdir], 71132720Skan AC_HELP_STRING([--with-target-subdir=SUBDIR], 72132720Skan [configuring in a subdirectory])) 7397403Sobrien 74132720Skan AC_ARG_WITH([cross-host], 75132720Skan AC_HELP_STRING([--with-cross-host=HOST], 76132720Skan [configuring with a cross compiler])) 7797403Sobrien 78132720Skan AC_ARG_WITH([newlib], 79132720Skan AC_HELP_STRING([--with-newlib], 80132720Skan [assume newlib as a system C library])) 8197403Sobrien 82132720Skan # We're almost certainly being configured before anything else which uses 83132720Skan # C++, so all of our AC_PROG_* discoveries will be cached. It's vital that 84132720Skan # we not cache the value of CXX that we "discover" here, because it's set 85132720Skan # to something unique for us and libjava. Other target libraries need to 86132720Skan # find CXX for themselves. We yank the rug out from under the normal AC_* 87132720Skan # process by sneakily renaming the cache variable. This also lets us debug 88132720Skan # the value of "our" CXX in postmortems. 89132720Skan # 90132720Skan # We must also force CXX to /not/ be a precious variable, otherwise the 91132720Skan # wrong (non-multilib-adjusted) value will be used in multilibs. This 92132720Skan # little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS. And as a side 93132720Skan # effect, CXXFLAGS is no longer automagically subst'd, so we have to do 94132720Skan # that ourselves. Un-preciousing AC_PROG_CC also affects CC and CFLAGS. 95132720Skan # 96132720Skan # -fno-builtin must be present here so that a non-conflicting form of 97132720Skan # std::exit can be guessed by AC_PROG_CXX, and used in later tests. 9897403Sobrien 99132720Skan m4_define([ac_cv_prog_CXX],[glibcxx_cv_prog_CXX]) 100132720Skan m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS]) 101132720Skan m4_define([_AC_ARG_VAR_PRECIOUS],[]) 102132720Skan save_CXXFLAGS="$CXXFLAGS" 103132720Skan CXXFLAGS="$CXXFLAGS -fno-builtin" 104132720Skan AC_PROG_CC 105132720Skan AC_PROG_CXX 106132720Skan CXXFLAGS="$save_CXXFLAGS" 107132720Skan m4_rename([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) 108132720Skan AC_SUBST(CFLAGS) 109132720Skan AC_SUBST(CXXFLAGS) 11097403Sobrien 111132720Skan # Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't 112132720Skan # available). Uncomment the next line to force a particular method. 113132720Skan AC_PROG_LN_S 114132720Skan #LN_S='cp -p' 11597403Sobrien 11697403Sobrien AC_CHECK_TOOL(AS, as) 11797403Sobrien AC_CHECK_TOOL(AR, ar) 11897403Sobrien AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error) 11997403Sobrien 12097403Sobrien AM_MAINTAINER_MODE 12197403Sobrien 122132720Skan # Set up safe default values for all subsequent AM_CONDITIONAL tests 123132720Skan # which are themselves conditionally expanded. 124132720Skan ## (Right now, this only matters for enable_wchar_t, but nothing prevents 125132720Skan ## other macros from doing the same. This should be automated.) -pme 126132720Skan need_libmath=no 12797403Sobrien 128169691Skan # Check for uClibc since Linux platforms use different configuration 129169691Skan # directories depending on the C library in use. 130169691Skan AC_EGREP_CPP([_using_uclibc], [ 131169691Skan #include <stdio.h> 132169691Skan #if __UCLIBC__ 133169691Skan _using_uclibc 134169691Skan #endif 135169691Skan ], uclibc=yes, uclibc=no) 136169691Skan 137132720Skan # Find platform-specific directories containing configuration info. 138132720Skan # Also possibly modify flags used elsewhere, as needed by the platform. 139132720Skan GLIBCXX_CHECK_HOST 14097403Sobrien]) 14197403Sobrien 14297403Sobrien 14397403Sobriendnl 14497403Sobriendnl Tests for newer compiler features, or features that are present in newer 14597403Sobriendnl compiler versions but not older compiler versions still in use, should 14697403Sobriendnl be placed here. 14797403Sobriendnl 148132720Skandnl Defines: 149132720Skandnl WERROR='-Werror' if requested and possible; g++'s that lack the 150132720Skandnl new inlining code or the new system_header pragma will die on -Werror. 151132720Skandnl Leave it out by default and use maint-mode to use it. 152132720Skandnl SECTION_FLAGS='-ffunction-sections -fdata-sections' if 153132720Skandnl compiler supports it and the user has not requested debug mode. 15497403Sobriendnl 155132720SkanAC_DEFUN([GLIBCXX_CHECK_COMPILER_FEATURES], [ 15697403Sobrien # All these tests are for C++; save the language and the compiler flags. 15797403Sobrien # The CXXFLAGS thing is suspicious, but based on similar bits previously 158132720Skan # found in GLIBCXX_CONFIGURE. 15997403Sobrien AC_LANG_SAVE 16097403Sobrien AC_LANG_CPLUSPLUS 16197403Sobrien ac_test_CXXFLAGS="${CXXFLAGS+set}" 16297403Sobrien ac_save_CXXFLAGS="$CXXFLAGS" 16397403Sobrien 16497403Sobrien # Check for maintainer-mode bits. 16597403Sobrien if test x"$USE_MAINTAINER_MODE" = xno; then 16697403Sobrien WERROR='' 16797403Sobrien else 16897403Sobrien WERROR='-Werror' 16997403Sobrien fi 17097403Sobrien 17197403Sobrien # Check for -ffunction-sections -fdata-sections 17297403Sobrien AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections]) 17397403Sobrien CXXFLAGS='-Werror -ffunction-sections -fdata-sections' 174132720Skan AC_TRY_COMPILE(, [int foo;], [ac_fdsections=yes], [ac_fdsections=no]) 17597403Sobrien if test "$ac_test_CXXFLAGS" = set; then 17697403Sobrien CXXFLAGS="$ac_save_CXXFLAGS" 17797403Sobrien else 17897403Sobrien # this is the suspicious part 17997403Sobrien CXXFLAGS='' 18097403Sobrien fi 181117397Skan if test x"$ac_fdsections" = x"yes"; then 18297403Sobrien SECTION_FLAGS='-ffunction-sections -fdata-sections' 18397403Sobrien fi 18497403Sobrien AC_MSG_RESULT($ac_fdsections) 18597403Sobrien 18697403Sobrien AC_LANG_RESTORE 18797403Sobrien AC_SUBST(WERROR) 18897403Sobrien AC_SUBST(SECTION_FLAGS) 18997403Sobrien]) 19097403Sobrien 19197403Sobrien 19297403Sobriendnl 19397403Sobriendnl If GNU ld is in use, check to see if tricky linker opts can be used. If 19497403Sobriendnl the native linker is in use, all variables will be defined to something 19597403Sobriendnl safe (like an empty string). 19697403Sobriendnl 197132720Skandnl Defines: 198132720Skandnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible 199169691Skandnl OPT_LDFLAGS='-Wl,-O1' and '-z,relro' if possible 200132720Skandnl LD (as a side effect of testing) 201132720Skandnl Sets: 202132720Skandnl with_gnu_ld 203132720Skandnl glibcxx_gnu_ld_version (possibly) 20497403Sobriendnl 205132720Skandnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will 206132720Skandnl set glibcxx_gnu_ld_version to 12345. Zeros cause problems. 207132720Skandnl 208132720SkanAC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [ 20997403Sobrien # If we're not using GNU ld, then there's no point in even trying these 21097403Sobrien # tests. Check for that first. We should have already tested for gld 21197403Sobrien # by now (in libtool), but require it now just to be safe... 21297403Sobrien test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS='' 21397403Sobrien test -z "$OPT_LDFLAGS" && OPT_LDFLAGS='' 21497403Sobrien AC_REQUIRE([AC_PROG_LD]) 215132720Skan AC_REQUIRE([AC_PROG_AWK]) 21697403Sobrien 21797403Sobrien # The name set by libtool depends on the version of libtool. Shame on us 21897403Sobrien # for depending on an impl detail, but c'est la vie. Older versions used 21997403Sobrien # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on 22097403Sobrien # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually 22197403Sobrien # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't 22297403Sobrien # set (hence we're using an older libtool), then set it. 22397403Sobrien if test x${with_gnu_ld+set} != xset; then 22497403Sobrien if test x${ac_cv_prog_gnu_ld+set} != xset; then 22597403Sobrien # We got through "ac_require(ac_prog_ld)" and still not set? Huh? 22697403Sobrien with_gnu_ld=no 22797403Sobrien else 22897403Sobrien with_gnu_ld=$ac_cv_prog_gnu_ld 22997403Sobrien fi 23097403Sobrien fi 23197403Sobrien 23297403Sobrien # Start by getting the version number. I think the libtool test already 23397403Sobrien # does some of this, but throws away the result. 234169691Skan if test x"$with_gnu_ld" = x"yes"; then 235169691Skan AC_MSG_CHECKING([for ld version]) 236169691Skan changequote(,) 237169691Skan ldver=`$LD --version 2>/dev/null | head -1 | \ 238169691Skan sed -e 's/GNU ld \(version \)\{0,1\}\(([^)]*) \)\{0,1\}\([0-9.][0-9.]*\).*/\3/'` 239169691Skan changequote([,]) 240169691Skan glibcxx_gnu_ld_version=`echo $ldver | \ 241169691Skan $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'` 242169691Skan AC_MSG_RESULT($glibcxx_gnu_ld_version) 243169691Skan fi 24497403Sobrien 24597403Sobrien # Set --gc-sections. 246169691Skan glibcxx_gcsections_min_ld=21602 247169691Skan if test x"$with_gnu_ld" = x"yes" && 248169691Skan test $glibcxx_gnu_ld_version -gt $glibcxx_gcsections_min_ld ; then 24997403Sobrien 250169691Skan # Sufficiently young GNU ld it is! Joy and bunny rabbits! 251169691Skan # NB: This flag only works reliably after 2.16.1. Configure tests 252169691Skan # for this are difficult, so hard wire a value that should work. 253169691Skan 254169691Skan # All these tests are for C++, but run with the "C" compiler driver. 255169691Skan # Need to do this so that g++ won't try to link in libstdc++/libsupc++. 25697403Sobrien ac_test_CFLAGS="${CFLAGS+set}" 25797403Sobrien ac_save_CFLAGS="$CFLAGS" 258169691Skan CFLAGS='-x c++ -Wl,--gc-sections' 25997403Sobrien 26097403Sobrien # Check for -Wl,--gc-sections 26197403Sobrien AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections]) 262169691Skan AC_TRY_LINK([ int one(void) { return 1; } 263169691Skan int two(void) { return 2; } 264169691Skan ], [ two(); ] , [ac_gcsections=yes], [ac_gcsections=no]) 265169691Skan if test "$ac_gcsections" = "yes"; then 266169691Skan rm -f conftest.c 267169691Skan touch conftest.c 268169691Skan if $CC -c conftest.c; then 269169691Skan if $LD --gc-sections -o conftest conftest.o 2>&1 | \ 270169691Skan grep "Warning: gc-sections option ignored" > /dev/null; then 271169691Skan ac_gcsections=no 272169691Skan fi 273169691Skan fi 274169691Skan rm -f conftest.c conftest.o conftest 275169691Skan fi 276169691Skan if test "$ac_gcsections" = "yes"; then 277169691Skan SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" 278169691Skan fi 279169691Skan AC_MSG_RESULT($ac_gcsections) 280169691Skan 28197403Sobrien if test "$ac_test_CFLAGS" = set; then 28297403Sobrien CFLAGS="$ac_save_CFLAGS" 28397403Sobrien else 28497403Sobrien # this is the suspicious part 28597403Sobrien CFLAGS='' 28697403Sobrien fi 287169691Skan fi 288169691Skan 289169691Skan # Set -z,relro. 290169691Skan # Note this is only for shared objects. 291169691Skan ac_ld_relro=no 292169691Skan if test x"$with_gnu_ld" = x"yes"; then 293169691Skan AC_MSG_CHECKING([for ld that supports -Wl,-z,relro]) 294169691Skan cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"` 295169691Skan if test -n "$cxx_z_relo"; then 296169691Skan OPT_LDFLAGS="-Wl,-z,relro" 297169691Skan ac_ld_relro=yes 29897403Sobrien fi 299169691Skan AC_MSG_RESULT($ac_ld_relro) 30097403Sobrien fi 30197403Sobrien 30297403Sobrien # Set linker optimization flags. 303117397Skan if test x"$with_gnu_ld" = x"yes"; then 30497403Sobrien OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS" 30597403Sobrien fi 30697403Sobrien 30797403Sobrien AC_SUBST(SECTION_LDFLAGS) 30897403Sobrien AC_SUBST(OPT_LDFLAGS) 30997403Sobrien]) 31097403Sobrien 31197403Sobrien 31297403Sobriendnl 313169691Skandnl Check to see if this target can enable the iconv specializations. 314169691Skandnl If --disable-c-mbchar was given, no wchar_t specialization is enabled. 315169691Skandnl (This must have been previously checked, along with the rest of C99 316169691Skandnl support.) By default, iconv support is disabled. 31797403Sobriendnl 318132720Skandnl Defines: 319169691Skandnl _GLIBCXX_USE_ICONV if all the bits are found. 320169691Skandnl Substs: 321169691Skandnl LIBICONV to a -l string containing the iconv library, if needed. 322132720Skandnl 323169691SkanAC_DEFUN([GLIBCXX_CHECK_ICONV_SUPPORT], [ 32497403Sobrien 325169691Skan enable_iconv=no 326132720Skan # Only continue checking if the ISO C99 headers exist and support is on. 327169691Skan if test x"$enable_wchar_t" = xyes; then 328132720Skan 329132720Skan # Use iconv for wchar_t to char conversions. As such, check for 330132720Skan # X/Open Portability Guide, version 2 features (XPG2). 331132720Skan AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no) 332132720Skan AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no) 333132720Skan 334132720Skan # Check for existence of libiconv.a providing XPG2 wchar_t support. 335169691Skan AC_CHECK_LIB(iconv, iconv, LIBICONV="-liconv") 336132720Skan ac_save_LIBS="$LIBS" 337169691Skan LIBS="$LIBS $LIBICONV" 338169691Skan AC_SUBST(LIBICONV) 339132720Skan 340132720Skan AC_CHECK_FUNCS([iconv_open iconv_close iconv nl_langinfo], 341132720Skan [ac_XPG2funcs=yes], [ac_XPG2funcs=no]) 342132720Skan 343132720Skan LIBS="$ac_save_LIBS" 344132720Skan 345132720Skan if test x"$ac_has_iconv_h" = xyes && 346132720Skan test x"$ac_has_langinfo_h" = xyes && 347132720Skan test x"$ac_XPG2funcs" = xyes; 348132720Skan then 349169691Skan AC_DEFINE([_GLIBCXX_USE_ICONV],1, 350169691Skan [Define if iconv and related functions exist and are usable.]) 351169691Skan enable_iconv=yes 352132720Skan fi 35397403Sobrien fi 354169691Skan AC_MSG_CHECKING([for enabled iconv specializations]) 355169691Skan AC_MSG_RESULT($enable_iconv) 35697403Sobrien]) 35797403Sobrien 35897403Sobrien 35997403Sobriendnl 360132720Skandnl Check for headers for, and arguments to, the setrlimit() function. 361132720Skandnl Used only in testsuite_hooks.h. Called from GLIBCXX_CONFIGURE_TESTSUITE. 362132720Skandnl 363132720Skandnl Defines: 364132720Skandnl _GLIBCXX_RES_LIMITS if we can set artificial resource limits 365132720Skandnl various HAVE_LIMIT_* for individual limit names 366132720Skandnl 367132720SkanAC_DEFUN([GLIBCXX_CHECK_SETRLIMIT_ancilliary], [ 368169691Skan AC_MSG_CHECKING([for RLIMIT_$1]) 369132720Skan AC_TRY_COMPILE( 370132720Skan [#include <unistd.h> 371132720Skan #include <sys/time.h> 372132720Skan #include <sys/resource.h> 373132720Skan ], 374132720Skan [ int f = RLIMIT_$1 ; ], 375132720Skan [glibcxx_mresult=1], [glibcxx_mresult=0]) 376132720Skan AC_DEFINE_UNQUOTED(HAVE_LIMIT_$1, $glibcxx_mresult, 377132720Skan [Only used in build directory testsuite_hooks.h.]) 378169691Skan if test $glibcxx_mresult = 1 ; then res=yes ; else res=no ; fi 379169691Skan AC_MSG_RESULT($res) 38097403Sobrien]) 38197403Sobrien 382132720SkanAC_DEFUN([GLIBCXX_CHECK_SETRLIMIT], [ 383132720Skan setrlimit_have_headers=yes 384132720Skan AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h, 385132720Skan [], 386132720Skan [setrlimit_have_headers=no]) 387132720Skan # If don't have the headers, then we can't run the tests now, and we 388132720Skan # won't be seeing any of these during testsuite compilation. 389132720Skan if test $setrlimit_have_headers = yes; then 390132720Skan # Can't do these in a loop, else the resulting syntax is wrong. 391132720Skan GLIBCXX_CHECK_SETRLIMIT_ancilliary(DATA) 392132720Skan GLIBCXX_CHECK_SETRLIMIT_ancilliary(RSS) 393132720Skan GLIBCXX_CHECK_SETRLIMIT_ancilliary(VMEM) 394132720Skan GLIBCXX_CHECK_SETRLIMIT_ancilliary(AS) 395132720Skan GLIBCXX_CHECK_SETRLIMIT_ancilliary(FSIZE) 396132720Skan 397132720Skan # Check for rlimit, setrlimit. 398132720Skan AC_CACHE_VAL(ac_setrlimit, [ 399132720Skan AC_TRY_COMPILE( 400132720Skan [#include <unistd.h> 401132720Skan #include <sys/time.h> 402132720Skan #include <sys/resource.h> 403132720Skan ], 404132720Skan [struct rlimit r; 405132720Skan setrlimit(0, &r);], 406132720Skan [ac_setrlimit=yes], [ac_setrlimit=no]) 40797403Sobrien ]) 40897403Sobrien fi 40997403Sobrien 410132720Skan AC_MSG_CHECKING([for testsuite resource limits support]) 411132720Skan if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then 412132720Skan ac_res_limits=yes 413169691Skan AC_DEFINE(_GLIBCXX_RES_LIMITS, 1, 414169691Skan [Define if using setrlimit to set resource limits during 415169691Skan "make check"]) 41697403Sobrien else 417132720Skan ac_res_limits=no 41897403Sobrien fi 419132720Skan AC_MSG_RESULT($ac_res_limits) 42097403Sobrien]) 42197403Sobrien 42297403Sobrien 42397403Sobriendnl 424132720Skandnl Check whether S_ISREG (Posix) or S_IFREG is available in <sys/stat.h>. 425132720Skandnl Define HAVE_S_ISREG / HAVE_S_IFREG appropriately. 42697403Sobriendnl 427132720SkanAC_DEFUN([GLIBCXX_CHECK_S_ISREG_OR_S_IFREG], [ 428169691Skan AC_MSG_CHECKING([for S_ISREG or S_IFREG]) 429132720Skan AC_CACHE_VAL(glibcxx_cv_S_ISREG, [ 430132720Skan AC_TRY_LINK( 431132720Skan [#include <sys/stat.h>], 432132720Skan [struct stat buffer; 433132720Skan fstat(0, &buffer); 434132720Skan S_ISREG(buffer.st_mode);], 435132720Skan [glibcxx_cv_S_ISREG=yes], 436132720Skan [glibcxx_cv_S_ISREG=no]) 437132720Skan ]) 438132720Skan AC_CACHE_VAL(glibcxx_cv_S_IFREG, [ 439132720Skan AC_TRY_LINK( 440132720Skan [#include <sys/stat.h>], 441132720Skan [struct stat buffer; 442132720Skan fstat(0, &buffer); 443132720Skan S_IFREG & buffer.st_mode;], 444132720Skan [glibcxx_cv_S_IFREG=yes], 445132720Skan [glibcxx_cv_S_IFREG=no]) 446132720Skan ]) 447169691Skan res=no 448132720Skan if test $glibcxx_cv_S_ISREG = yes; then 449169691Skan AC_DEFINE(HAVE_S_ISREG, 1, 450169691Skan [Define if S_IFREG is available in <sys/stat.h>.]) 451169691Skan res=S_ISREG 452132720Skan elif test $glibcxx_cv_S_IFREG = yes; then 453169691Skan AC_DEFINE(HAVE_S_IFREG, 1, 454169691Skan [Define if S_IFREG is available in <sys/stat.h>.]) 455169691Skan res=S_IFREG 45697403Sobrien fi 457169691Skan AC_MSG_RESULT($res) 45897403Sobrien]) 45997403Sobrien 460132720Skan 46197403Sobriendnl 462132720Skandnl Check whether poll is available in <poll.h>, and define HAVE_POLL. 46397403Sobriendnl 464132720SkanAC_DEFUN([GLIBCXX_CHECK_POLL], [ 465169691Skan AC_MSG_CHECKING([for poll]) 466132720Skan AC_CACHE_VAL(glibcxx_cv_POLL, [ 467132720Skan AC_TRY_LINK( 468132720Skan [#include <poll.h>], 469132720Skan [struct pollfd pfd[1]; 470132720Skan pfd[0].events = POLLIN; 471132720Skan poll(pfd, 1, 0);], 472132720Skan [glibcxx_cv_POLL=yes], 473132720Skan [glibcxx_cv_POLL=no]) 474132720Skan ]) 475132720Skan if test $glibcxx_cv_POLL = yes; then 476169691Skan AC_DEFINE(HAVE_POLL, 1, [Define if poll is available in <poll.h>.]) 47797403Sobrien fi 478169691Skan AC_MSG_RESULT($glibcxx_cv_POLL) 47997403Sobrien]) 48097403Sobrien 48197403Sobrien 48297403Sobriendnl 483132720Skandnl Check whether writev is available in <sys/uio.h>, and define HAVE_WRITEV. 48497403Sobriendnl 485132720SkanAC_DEFUN([GLIBCXX_CHECK_WRITEV], [ 486169691Skan AC_MSG_CHECKING([for writev]) 487132720Skan AC_CACHE_VAL(glibcxx_cv_WRITEV, [ 488132720Skan AC_TRY_LINK( 489132720Skan [#include <sys/uio.h>], 490132720Skan [struct iovec iov[2]; 491132720Skan writev(0, iov, 0);], 492132720Skan [glibcxx_cv_WRITEV=yes], 493132720Skan [glibcxx_cv_WRITEV=no]) 494132720Skan ]) 495132720Skan if test $glibcxx_cv_WRITEV = yes; then 496169691Skan AC_DEFINE(HAVE_WRITEV, 1, [Define if writev is available in <sys/uio.h>.]) 49797403Sobrien fi 498169691Skan AC_MSG_RESULT($glibcxx_cv_WRITEV) 49997403Sobrien]) 50097403Sobrien 50197403Sobrien 50297403Sobriendnl 503132720Skandnl Check whether int64_t is available in <stdint.h>, and define HAVE_INT64_T. 50497403Sobriendnl 505132720SkanAC_DEFUN([GLIBCXX_CHECK_INT64_T], [ 506169691Skan AC_MSG_CHECKING([for int64_t]) 507132720Skan AC_CACHE_VAL(glibcxx_cv_INT64_T, [ 508132720Skan AC_TRY_COMPILE( 509132720Skan [#include <stdint.h>], 510132720Skan [int64_t var;], 511132720Skan [glibcxx_cv_INT64_T=yes], 512132720Skan [glibcxx_cv_INT64_T=no]) 513132720Skan ]) 514132720Skan if test $glibcxx_cv_INT64_T = yes; then 515169691Skan AC_DEFINE(HAVE_INT64_T, 1, [Define if int64_t is available in <stdint.h>.]) 51697403Sobrien fi 517169691Skan AC_MSG_RESULT($glibcxx_cv_INT64_T) 51897403Sobrien]) 51997403Sobrien 520132720Skan 521110614Skandnl 522132720Skandnl Check whether LFS support is available. 523110614Skandnl 524132720SkanAC_DEFUN([GLIBCXX_CHECK_LFS], [ 525132720Skan AC_LANG_SAVE 526132720Skan AC_LANG_CPLUSPLUS 527132720Skan ac_save_CXXFLAGS="$CXXFLAGS" 528132720Skan CXXFLAGS="$CXXFLAGS -fno-exceptions" 529169691Skan AC_MSG_CHECKING([for LFS support]) 530132720Skan AC_CACHE_VAL(glibcxx_cv_LFS, [ 531132720Skan AC_TRY_LINK( 532132720Skan [#include <unistd.h> 533132720Skan #include <stdio.h> 534169691Skan #include <sys/stat.h> 535132720Skan ], 536132720Skan [FILE* fp; 537132720Skan fopen64("t", "w"); 538132720Skan fseeko64(fp, 0, SEEK_CUR); 539132720Skan ftello64(fp); 540169691Skan lseek64(1, 0, SEEK_CUR); 541169691Skan struct stat64 buf; 542169691Skan fstat64(1, &buf);], 543132720Skan [glibcxx_cv_LFS=yes], 544132720Skan [glibcxx_cv_LFS=no]) 545132720Skan ]) 546132720Skan if test $glibcxx_cv_LFS = yes; then 547169691Skan AC_DEFINE(_GLIBCXX_USE_LFS, 1, [Define if LFS support is available.]) 548110614Skan fi 549169691Skan AC_MSG_RESULT($glibcxx_cv_LFS) 550132720Skan CXXFLAGS="$ac_save_CXXFLAGS" 551132720Skan AC_LANG_RESTORE 552110614Skan]) 55397403Sobrien 554132720Skan 55597403Sobriendnl 556146897Skandnl Check for whether a fully dynamic basic_string implementation should 557146897Skandnl be turned on, that does not put empty objects in per-process static 558146897Skandnl memory (mostly useful together with shared memory allocators, see PR 559146897Skandnl libstdc++/16612 for details). 560146897Skandnl 561146897Skandnl --enable-fully-dynamic-string defines _GLIBCXX_FULLY_DYNAMIC_STRING 562146897Skandnl --disable-fully-dynamic-string leaves _GLIBCXX_FULLY_DYNAMIC_STRING undefined 563146897Skandnl + Usage: GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING[(DEFAULT)] 564146897Skandnl Where DEFAULT is either `yes' or `no'. 565146897Skandnl 566146897SkanAC_DEFUN([GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING], [ 567146897Skan GLIBCXX_ENABLE(fully-dynamic-string,$1,,[do not put empty strings in per-process static memory]) 568146897Skan if test $enable_fully_dynamic_string = yes; then 569169691Skan AC_DEFINE(_GLIBCXX_FULLY_DYNAMIC_STRING, 1, 570169691Skan [Define if a fully dynamic basic_string is wanted.]) 571146897Skan fi 572146897Skan]) 573146897Skan 574146897Skan 575146897Skandnl 576132720Skandnl Does any necessary configuration of the testsuite directory. Generates 577132720Skandnl the testsuite_hooks.h header. 57897403Sobriendnl 579132720Skandnl GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE must be done before this. 58097403Sobriendnl 581132720Skandnl Sets: 582169691Skandnl enable_abi_check 583169691Skandnl GLIBCXX_TEST_WCHAR_T 584169691Skandnl GLIBCXX_TEST_THREAD 585132720Skandnl Substs: 586132720Skandnl baseline_dir 58797403Sobriendnl 588132720SkanAC_DEFUN([GLIBCXX_CONFIGURE_TESTSUITE], [ 589169691Skan if $GLIBCXX_IS_NATIVE ; then 590132720Skan # Do checks for resource limit functions. 591132720Skan GLIBCXX_CHECK_SETRLIMIT 592132720Skan 593132720Skan # Look for setenv, so that extended locale tests can be performed. 594132720Skan GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv) 595169691Skan fi 596132720Skan 597169691Skan if $GLIBCXX_IS_NATIVE && test $is_hosted = yes && 598169691Skan test $enable_symvers != no; then 599169691Skan case "$host" in 600169691Skan *-*-cygwin*) 601169691Skan enable_abi_check=no ;; 602169691Skan *) 603169691Skan enable_abi_check=yes ;; 604169691Skan esac 605132720Skan else 606132720Skan # Only build this as native, since automake does not understand 607132720Skan # CXX_FOR_BUILD. 608132720Skan enable_abi_check=no 60997403Sobrien fi 610169691Skan 611132720Skan # Export file names for ABI checking. 612169691Skan baseline_dir="$glibcxx_srcdir/config/abi/post/${abi_baseline_pair}\$(MULTISUBDIR)" 613132720Skan AC_SUBST(baseline_dir) 61497403Sobrien]) 61597403Sobrien 61697403Sobrien 61797403Sobriendnl 618132720Skandnl Set up *_INCLUDES variables for all sundry Makefile.am's. 61997403Sobriendnl 620132720Skandnl Substs: 621132720Skandnl GLIBCXX_INCLUDES 622132720Skandnl TOPLEVEL_INCLUDES 62397403Sobriendnl 624132720SkanAC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [ 625132720Skan # Used for every C++ compile we perform. 626132720Skan GLIBCXX_INCLUDES="\ 627132720Skan-I$glibcxx_builddir/include/$host_alias \ 628132720Skan-I$glibcxx_builddir/include \ 629132720Skan-I$glibcxx_srcdir/libsupc++" 63097403Sobrien 631132720Skan # For Canadian crosses, pick this up too. 632132720Skan if test $CANADIAN = yes; then 633132720Skan GLIBCXX_INCLUDES="$GLIBCXX_INCLUDES -I\${includedir}" 634132720Skan fi 63597403Sobrien 636132720Skan # Stuff in the actual top level. Currently only used by libsupc++ to 637132720Skan # get unwind* headers from the gcc dir. 638132720Skan #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include' 639132720Skan TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc' 64097403Sobrien 641132720Skan # Now, export this to all the little Makefiles.... 642132720Skan AC_SUBST(GLIBCXX_INCLUDES) 643132720Skan AC_SUBST(TOPLEVEL_INCLUDES) 64497403Sobrien]) 64597403Sobrien 646132720Skan 64797403Sobriendnl 648132720Skandnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's. 649132720Skandnl (SECTION_FLAGS is done under CHECK_COMPILER_FEATURES.) 65097403Sobriendnl 651132720Skandnl Substs: 652132720Skandnl OPTIMIZE_CXXFLAGS 653132720Skandnl WARN_FLAGS 65497403Sobriendnl 655132720SkanAC_DEFUN([GLIBCXX_EXPORT_FLAGS], [ 656132720Skan # Optimization flags that are probably a good idea for thrill-seekers. Just 657132720Skan # uncomment the lines below and make, everything else is ready to go... 658132720Skan # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc 659132720Skan OPTIMIZE_CXXFLAGS= 660132720Skan AC_SUBST(OPTIMIZE_CXXFLAGS) 66197403Sobrien 662169691Skan WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual' 663132720Skan AC_SUBST(WARN_FLAGS) 66497403Sobrien]) 66597403Sobrien 666132720Skan 667110614Skandnl 668132720Skandnl All installation directory information is determined here. 669110614Skandnl 670132720Skandnl Substs: 671132720Skandnl gxx_install_dir 672132720Skandnl glibcxx_prefixdir 673132720Skandnl glibcxx_toolexecdir 674132720Skandnl glibcxx_toolexeclibdir 675110614Skandnl 676132720Skandnl Assumes cross_compiling bits already done, and with_cross_host in 677132720Skandnl particular. 67897403Sobriendnl 679169691Skandnl This logic must match gcc/configure.ac's setting of gcc_gxx_include_dir. 680169691Skandnl config/gxx-include-dir.m4 must be kept consistant with this as well. 681132720SkanAC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [ 682132720Skan glibcxx_toolexecdir=no 683132720Skan glibcxx_toolexeclibdir=no 684132720Skan glibcxx_prefixdir=$prefix 68597403Sobrien 686132720Skan AC_MSG_CHECKING([for gxx-include-dir]) 687132720Skan AC_ARG_WITH([gxx-include-dir], 688132720Skan AC_HELP_STRING([--with-gxx-include-dir=DIR], 689132720Skan [installation directory for include files]), 690132720Skan [case "$withval" in 691132720Skan yes) AC_MSG_ERROR([Missing directory for --with-gxx-include-dir]) ;; 692132720Skan no) gxx_include_dir=no ;; 693132720Skan *) gxx_include_dir=$withval ;; 694132720Skan esac], 695132720Skan [gxx_include_dir=no]) 696132720Skan AC_MSG_RESULT($gxx_include_dir) 69797403Sobrien 698132720Skan AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) 699132720Skan AC_ARG_ENABLE([version-specific-runtime-libs], 700132720Skan AC_HELP_STRING([--enable-version-specific-runtime-libs], 701132720Skan [Specify that runtime libraries should be installed in a compiler-specific directory]), 702132720Skan [case "$enableval" in 703132720Skan yes) version_specific_libs=yes ;; 704132720Skan no) version_specific_libs=no ;; 705132720Skan *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; 706132720Skan esac], 707132720Skan [version_specific_libs=no]) 708132720Skan AC_MSG_RESULT($version_specific_libs) 70997403Sobrien 710132720Skan # Default case for install directory for include files. 711132720Skan if test $version_specific_libs = no && test $gxx_include_dir = no; then 712169691Skan gxx_include_dir='include/c++/${gcc_version}' 713169691Skan if test -n "$with_cross_host" && 714169691Skan test x"$with_cross_host" != x"no"; then 715169691Skan gxx_include_dir='${prefix}/${target_alias}/'"$gxx_include_dir" 716169691Skan else 717169691Skan gxx_include_dir='${prefix}/'"$gxx_include_dir" 718169691Skan fi 719132720Skan fi 72097403Sobrien 721132720Skan # Version-specific runtime libs processing. 722132720Skan if test $version_specific_libs = yes; then 723132720Skan # Need the gcc compiler version to know where to install libraries 724132720Skan # and header files if --enable-version-specific-runtime-libs option 725132720Skan # is selected. FIXME: these variables are misnamed, there are 726132720Skan # no executables installed in _toolexecdir or _toolexeclibdir. 727132720Skan if test x"$gxx_include_dir" = x"no"; then 728169691Skan gxx_include_dir='${libdir}/gcc/${host_alias}/${gcc_version}/include/c++' 729132720Skan fi 730132720Skan glibcxx_toolexecdir='${libdir}/gcc/${host_alias}' 731169691Skan glibcxx_toolexeclibdir='${toolexecdir}/${gcc_version}$(MULTISUBDIR)' 732132720Skan fi 73397403Sobrien 734132720Skan # Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir 735132720Skan # Install a library built with a cross compiler in tooldir, not libdir. 736132720Skan if test x"$glibcxx_toolexecdir" = x"no"; then 737132720Skan if test -n "$with_cross_host" && 738132720Skan test x"$with_cross_host" != x"no"; then 739132720Skan glibcxx_toolexecdir='${exec_prefix}/${host_alias}' 740132720Skan glibcxx_toolexeclibdir='${toolexecdir}/lib' 741132720Skan else 742132720Skan glibcxx_toolexecdir='${libdir}/gcc/${host_alias}' 743132720Skan glibcxx_toolexeclibdir='${libdir}' 744132720Skan fi 745132720Skan multi_os_directory=`$CXX -print-multi-os-directory` 746132720Skan case $multi_os_directory in 747132720Skan .) ;; # Avoid trailing /. 748132720Skan *) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;; 749132720Skan esac 750132720Skan fi 75197403Sobrien 752132720Skan AC_MSG_CHECKING([for install location]) 753132720Skan AC_MSG_RESULT($gxx_include_dir) 75497403Sobrien 755132720Skan AC_SUBST(glibcxx_prefixdir) 756132720Skan AC_SUBST(gxx_include_dir) 757132720Skan AC_SUBST(glibcxx_toolexecdir) 758132720Skan AC_SUBST(glibcxx_toolexeclibdir) 75997403Sobrien]) 76097403Sobrien 76197403Sobrien 76297403Sobriendnl 763132720Skandnl GLIBCXX_ENABLE 764132720Skandnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING) 765132720Skandnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c) 766132720Skandnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER) 76797403Sobriendnl 768132720Skandnl See docs/html/17_intro/configury.html#enable for documentation. 76997403Sobriendnl 770132720Skanm4_define([GLIBCXX_ENABLE],[dnl 771132720Skanm4_define([_g_switch],[--enable-$1])dnl 772132720Skanm4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl 773132720Skan AC_ARG_ENABLE($1,_g_help, 774132720Skan m4_bmatch([$5], 775132720Skan [^permit ], 776132720Skan [[ 777132720Skan case "$enableval" in 778132720Skan m4_bpatsubst([$5],[permit ])) ;; 779132720Skan *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;; 780132720Skan dnl Idea for future: generate a URL pointing to 781132720Skan dnl "onlinedocs/configopts.html#whatever" 782132720Skan esac 783132720Skan ]], 784132720Skan [^$], 785132720Skan [[ 786132720Skan case "$enableval" in 787132720Skan yes|no) ;; 788132720Skan *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;; 789132720Skan esac 790132720Skan ]], 791132720Skan [[$5]]), 792132720Skan [enable_]m4_bpatsubst([$1],-,_)[=][$2]) 793132720Skanm4_undefine([_g_switch])dnl 794132720Skanm4_undefine([_g_help])dnl 79597403Sobrien]) 79697403Sobrien 79797403Sobrien 79897403Sobriendnl 799132720Skandnl Check for ISO/IEC 9899:1999 "C99" support. 80097403Sobriendnl 801132720Skandnl --enable-c99 defines _GLIBCXX_USE_C99 802132720Skandnl --disable-c99 leaves _GLIBCXX_USE_C99 undefined 803132720Skandnl + Usage: GLIBCXX_ENABLE_C99[(DEFAULT)] 804132720Skandnl Where DEFAULT is either `yes' or `no'. 805132720Skandnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'. 80697403Sobriendnl 807132720SkanAC_DEFUN([GLIBCXX_ENABLE_C99], [ 808132720Skan GLIBCXX_ENABLE(c99,$1,,[turns on ISO/IEC 9899:1999 support]) 80997403Sobrien 810169691Skan if test x"$enable_c99" = x"yes"; then 811169691Skan 812132720Skan AC_LANG_SAVE 813132720Skan AC_LANG_CPLUSPLUS 814132720Skan 815132720Skan # Check for the existence of <math.h> functions used if C99 is enabled. 816132720Skan AC_MSG_CHECKING([for ISO C99 support in <math.h>]) 817169691Skan AC_CACHE_VAL(ac_c99_math, [ 818132720Skan AC_TRY_COMPILE([#include <math.h>], 819169691Skan [fpclassify(0.0); 820169691Skan isfinite(0.0); 821169691Skan isinf(0.0); 822169691Skan isnan(0.0); 823169691Skan isnormal(0.0); 824169691Skan signbit(0.0); 825169691Skan isgreater(0.0,0.0); 826169691Skan isgreaterequal(0.0,0.0); 827169691Skan isless(0.0,0.0); 828169691Skan islessequal(0.0,0.0); 829169691Skan islessgreater(0.0,0.0); 830169691Skan islessgreater(0.0,0.0); 831169691Skan isunordered(0.0,0.0); 832169691Skan ],[ac_c99_math=yes], [ac_c99_math=no]) 833169691Skan ]) 834132720Skan AC_MSG_RESULT($ac_c99_math) 835132720Skan if test x"$ac_c99_math" = x"yes"; then 836169691Skan AC_DEFINE(_GLIBCXX_USE_C99_MATH, 1, 837169691Skan [Define if C99 functions or macros in <math.h> should be imported 838169691Skan in <cmath> in namespace std.]) 83997403Sobrien fi 84097403Sobrien 841169691Skan # Check for the existence of <complex.h> complex math functions. 842169691Skan # This is necessary even though libstdc++ uses the builtin versions 843169691Skan # of these functions, because if the builtin cannot be used, a reference 844169691Skan # to the library function is emitted. 845169691Skan AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no) 846169691Skan ac_c99_complex=no; 847169691Skan if test x"$ac_has_complex_h" = x"yes"; then 848169691Skan AC_MSG_CHECKING([for ISO C99 support in <complex.h>]) 849169691Skan AC_TRY_COMPILE([#include <complex.h>], 850169691Skan [typedef __complex__ float float_type; float_type tmpf; 851169691Skan cabsf(tmpf); 852169691Skan cargf(tmpf); 853169691Skan ccosf(tmpf); 854169691Skan ccoshf(tmpf); 855169691Skan cexpf(tmpf); 856169691Skan clogf(tmpf); 857169691Skan csinf(tmpf); 858169691Skan csinhf(tmpf); 859169691Skan csqrtf(tmpf); 860169691Skan ctanf(tmpf); 861169691Skan ctanhf(tmpf); 862169691Skan cpowf(tmpf, tmpf); 863169691Skan typedef __complex__ double double_type; double_type tmpd; 864169691Skan cabs(tmpd); 865169691Skan carg(tmpd); 866169691Skan ccos(tmpd); 867169691Skan ccosh(tmpd); 868169691Skan cexp(tmpd); 869169691Skan clog(tmpd); 870169691Skan csin(tmpd); 871169691Skan csinh(tmpd); 872169691Skan csqrt(tmpd); 873169691Skan ctan(tmpd); 874169691Skan ctanh(tmpd); 875169691Skan cpow(tmpd, tmpd); 876169691Skan typedef __complex__ long double ld_type; ld_type tmpld; 877169691Skan cabsl(tmpld); 878169691Skan cargl(tmpld); 879169691Skan ccosl(tmpld); 880169691Skan ccoshl(tmpld); 881169691Skan cexpl(tmpld); 882169691Skan clogl(tmpld); 883169691Skan csinl(tmpld); 884169691Skan csinhl(tmpld); 885169691Skan csqrtl(tmpld); 886169691Skan ctanl(tmpld); 887169691Skan ctanhl(tmpld); 888169691Skan cpowl(tmpld, tmpld); 889169691Skan ],[ac_c99_complex=yes], [ac_c99_complex=no]) 890169691Skan fi 891169691Skan AC_MSG_RESULT($ac_c99_complex) 892169691Skan if test x"$ac_c99_complex" = x"yes"; then 893169691Skan AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX, 1, 894169691Skan [Define if C99 functions in <complex.h> should be used in 895169691Skan <complex>. Using compiler builtins for these functions requires 896169691Skan corresponding C99 library functions to be present.]) 897169691Skan fi 898169691Skan 899132720Skan # Check for the existence in <stdio.h> of vscanf, et. al. 900132720Skan AC_MSG_CHECKING([for ISO C99 support in <stdio.h>]) 901169691Skan AC_CACHE_VAL(ac_c99_stdio, [ 902132720Skan AC_TRY_COMPILE([#include <stdio.h> 903169691Skan #include <stdarg.h> 904132720Skan void foo(char* fmt, ...) 905169691Skan { 906169691Skan va_list args; va_start(args, fmt); 907169691Skan vfscanf(stderr, "%i", args); 908169691Skan vscanf("%i", args); 909169691Skan vsnprintf(fmt, 0, "%i", args); 910169691Skan vsscanf(fmt, "%i", args); 911169691Skan }], 912169691Skan [snprintf("12", 0, "%i");], 913169691Skan [ac_c99_stdio=yes], [ac_c99_stdio=no]) 914169691Skan ]) 915132720Skan AC_MSG_RESULT($ac_c99_stdio) 91697403Sobrien 917132720Skan # Check for the existence in <stdlib.h> of lldiv_t, et. al. 918169691Skan AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>]) 919169691Skan AC_CACHE_VAL(ac_c99_stdlib, [ 920132720Skan AC_TRY_COMPILE([#include <stdlib.h>], 921169691Skan [char* tmp; 922169691Skan strtof("gnu", &tmp); 923169691Skan strtold("gnu", &tmp); 924169691Skan strtoll("gnu", &tmp, 10); 925169691Skan strtoull("gnu", &tmp, 10); 926169691Skan llabs(10); 927169691Skan lldiv(10,1); 928169691Skan atoll("10"); 929169691Skan _Exit(0); 930169691Skan lldiv_t mydivt;],[ac_c99_stdlib=yes], [ac_c99_stdlib=no]) 931132720Skan ]) 932132720Skan AC_MSG_RESULT($ac_c99_stdlib) 93397403Sobrien 934169691Skan # Check for the existence in <wchar.h> of wcstold, etc. 935169691Skan ac_c99_wchar=no; 936169691Skan if test x"$ac_has_wchar_h" = xyes && 937169691Skan test x"$ac_has_wctype_h" = xyes; then 938169691Skan AC_MSG_CHECKING([for ISO C99 support in <wchar.h>]) 939169691Skan AC_TRY_COMPILE([#include <wchar.h> 940169691Skan namespace test 941169691Skan { 942169691Skan using ::wcstold; 943169691Skan using ::wcstoll; 944169691Skan using ::wcstoull; 945169691Skan } 946169691Skan ],[],[ac_c99_wchar=yes], [ac_c99_wchar=no]) 94797403Sobrien 948169691Skan # Checks for wide character functions that may not be present. 949169691Skan # Injection of these is wrapped with guard macros. 950169691Skan # NB: only put functions here, instead of immediately above, if 951169691Skan # absolutely necessary. 952169691Skan AC_TRY_COMPILE([#include <wchar.h> 953169691Skan namespace test { using ::vfwscanf; } ], [], 954169691Skan [AC_DEFINE(HAVE_VFWSCANF,1, 955169691Skan [Defined if vfwscanf exists.])],[]) 956169691Skan 957169691Skan AC_TRY_COMPILE([#include <wchar.h> 958169691Skan namespace test { using ::vswscanf; } ], [], 959169691Skan [AC_DEFINE(HAVE_VSWSCANF,1, 960169691Skan [Defined if vswscanf exists.])],[]) 961169691Skan 962169691Skan AC_TRY_COMPILE([#include <wchar.h> 963169691Skan namespace test { using ::vwscanf; } ], [], 964169691Skan [AC_DEFINE(HAVE_VWSCANF,1,[Defined if vwscanf exists.])],[]) 965169691Skan 966169691Skan AC_TRY_COMPILE([#include <wchar.h> 967169691Skan namespace test { using ::wcstof; } ], [], 968169691Skan [AC_DEFINE(HAVE_WCSTOF,1,[Defined if wcstof exists.])],[]) 969169691Skan 970169691Skan AC_TRY_COMPILE([#include <wctype.h>], 971169691Skan [ wint_t t; int i = iswblank(t);], 972169691Skan [AC_DEFINE(HAVE_ISWBLANK,1, 973169691Skan [Defined if iswblank exists.])],[]) 974169691Skan 975169691Skan AC_MSG_RESULT($ac_c99_wchar) 976169691Skan fi 977169691Skan 978169691Skan # Option parsed, now set things appropriately. 979132720Skan if test x"$ac_c99_math" = x"no" || 980169691Skan test x"$ac_c99_complex" = x"no" || 981132720Skan test x"$ac_c99_stdio" = x"no" || 982132720Skan test x"$ac_c99_stdlib" = x"no" || 983132720Skan test x"$ac_c99_wchar" = x"no"; then 984132720Skan enable_c99=no; 985169691Skan else 986169691Skan AC_DEFINE(_GLIBCXX_USE_C99, 1, 987169691Skan [Define if C99 functions or macros from <wchar.h>, <math.h>, 988169691Skan <complex.h>, <stdio.h>, and <stdlib.h> can be used or exposed.]) 989169691Skan fi 990169691Skan 991169691Skan AC_LANG_RESTORE 992169691Skan fi 993169691Skan 994169691Skan AC_MSG_CHECKING([for fully enabled ISO C99 support]) 995132720Skan AC_MSG_RESULT($enable_c99) 996169691Skan]) 997132720Skan 998169691Skan 999169691Skandnl 1000169691Skandnl Check for ISO/IEC 9899:1999 "C99" support to ISO/IEC DTR 19768 "TR1" 1001169691Skandnl facilities in Chapter 8, "C compatibility". 1002169691Skandnl 1003169691SkanAC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ 1004169691Skan 1005169691Skan AC_LANG_SAVE 1006169691Skan AC_LANG_CPLUSPLUS 1007169691Skan 1008169691Skan # Check for the existence of <complex.h> complex math functions used 1009169691Skan # by tr1/complex. 1010169691Skan AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no) 1011169691Skan ac_c99_complex_tr1=no; 1012169691Skan if test x"$ac_has_complex_h" = x"yes"; then 1013169691Skan AC_MSG_CHECKING([for ISO C99 support to TR1 in <complex.h>]) 1014169691Skan AC_TRY_COMPILE([#include <complex.h>], 1015169691Skan [typedef __complex__ float float_type; float_type tmpf; 1016169691Skan cacosf(tmpf); 1017169691Skan casinf(tmpf); 1018169691Skan catanf(tmpf); 1019169691Skan cacoshf(tmpf); 1020169691Skan casinhf(tmpf); 1021169691Skan catanhf(tmpf); 1022169691Skan typedef __complex__ double double_type; double_type tmpd; 1023169691Skan cacos(tmpd); 1024169691Skan casin(tmpd); 1025169691Skan catan(tmpd); 1026169691Skan cacosh(tmpd); 1027169691Skan casinh(tmpd); 1028169691Skan catanh(tmpd); 1029169691Skan typedef __complex__ long double ld_type; ld_type tmpld; 1030169691Skan cacosl(tmpld); 1031169691Skan casinl(tmpld); 1032169691Skan catanl(tmpld); 1033169691Skan cacoshl(tmpld); 1034169691Skan casinhl(tmpld); 1035169691Skan catanhl(tmpld); 1036169691Skan ],[ac_c99_complex_tr1=yes], [ac_c99_complex_tr1=no]) 103797403Sobrien fi 1038169691Skan AC_MSG_RESULT($ac_c99_complex_tr1) 1039169691Skan if test x"$ac_c99_complex_tr1" = x"yes"; then 1040169691Skan AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX_TR1, 1, 1041169691Skan [Define if C99 functions in <complex.h> should be used in 1042169691Skan <tr1/complex>. Using compiler builtins for these functions 1043169691Skan requires corresponding C99 library functions to be present.]) 1044169691Skan fi 104597403Sobrien 1046169691Skan # Check for the existence of <ctype.h> functions. 1047169691Skan AC_MSG_CHECKING([for ISO C99 support to TR1 in <ctype.h>]) 1048169691Skan AC_CACHE_VAL(ac_c99_ctype_tr1, [ 1049169691Skan AC_TRY_COMPILE([#include <ctype.h>], 1050169691Skan [int ch; 1051169691Skan int ret; 1052169691Skan ret = isblank(ch); 1053169691Skan ],[ac_c99_ctype_tr1=yes], [ac_c99_ctype_tr1=no]) 1054169691Skan ]) 1055169691Skan AC_MSG_RESULT($ac_c99_ctype_tr1) 1056169691Skan if test x"$ac_c99_ctype_tr1" = x"yes"; then 1057169691Skan AC_DEFINE(_GLIBCXX_USE_C99_CTYPE_TR1, 1, 1058169691Skan [Define if C99 functions in <ctype.h> should be imported in 1059169691Skan <tr1/cctype> in namespace std::tr1.]) 1060132720Skan fi 106197403Sobrien 1062169691Skan # Check for the existence of <fenv.h> functions. 1063169691Skan AC_CHECK_HEADERS(fenv.h, ac_has_fenv_h=yes, ac_has_fenv_h=no) 1064169691Skan ac_c99_fenv_tr1=no; 1065169691Skan if test x"$ac_has_fenv_h" = x"yes"; then 1066169691Skan AC_MSG_CHECKING([for ISO C99 support to TR1 in <fenv.h>]) 1067169691Skan AC_TRY_COMPILE([#include <fenv.h>], 1068169691Skan [int except, mode; 1069169691Skan fexcept_t* pflag; 1070169691Skan fenv_t* penv; 1071169691Skan int ret; 1072169691Skan ret = feclearexcept(except); 1073169691Skan ret = fegetexceptflag(pflag, except); 1074169691Skan ret = feraiseexcept(except); 1075169691Skan ret = fesetexceptflag(pflag, except); 1076169691Skan ret = fetestexcept(except); 1077169691Skan ret = fegetround(); 1078169691Skan ret = fesetround(mode); 1079169691Skan ret = fegetenv(penv); 1080169691Skan ret = feholdexcept(penv); 1081169691Skan ret = fesetenv(penv); 1082169691Skan ret = feupdateenv(penv); 1083169691Skan ],[ac_c99_fenv_tr1=yes], [ac_c99_fenv_tr1=no]) 1084169691Skan fi 1085169691Skan AC_MSG_RESULT($ac_c99_fenv_tr1) 1086169691Skan if test x"$ac_c99_fenv_tr1" = x"yes"; then 1087169691Skan AC_DEFINE(_GLIBCXX_USE_C99_FENV_TR1, 1, 1088169691Skan [Define if C99 functions in <fenv.h> should be imported in 1089169691Skan <tr1/cfenv> in namespace std::tr1.]) 1090169691Skan fi 1091169691Skan 1092169691Skan # Check for the existence of <stdint.h> types. 1093169691Skan AC_MSG_CHECKING([for ISO C99 support to TR1 in <stdint.h>]) 1094169691Skan AC_CACHE_VAL(ac_c99_stdint_tr1, [ 1095169691Skan AC_TRY_COMPILE([#include <stdint.h>], 1096169691Skan [typedef int8_t my_int8_t; 1097169691Skan typedef int16_t my_int16_t; 1098169691Skan typedef int32_t my_int32_t; 1099169691Skan typedef int64_t my_int64_t; 1100169691Skan typedef int_fast8_t my_int_fast8_t; 1101169691Skan typedef int_fast16_t my_int_fast16_t; 1102169691Skan typedef int_fast32_t my_int_fast32_t; 1103169691Skan typedef int_fast64_t my_int_fast64_t; 1104169691Skan typedef int_least8_t my_int_least8_t; 1105169691Skan typedef int_least16_t my_int_least16_t; 1106169691Skan typedef int_least32_t my_int_least32_t; 1107169691Skan typedef int_least64_t my_int_least64_t; 1108169691Skan typedef intmax_t my_intmax_t; 1109169691Skan typedef intptr_t my_intptr_t; 1110169691Skan typedef uint8_t my_uint8_t; 1111169691Skan typedef uint16_t my_uint16_t; 1112169691Skan typedef uint32_t my_uint32_t; 1113169691Skan typedef uint64_t my_uint64_t; 1114169691Skan typedef uint_fast8_t my_uint_fast8_t; 1115169691Skan typedef uint_fast16_t my_uint_fast16_t; 1116169691Skan typedef uint_fast32_t my_uint_fast32_t; 1117169691Skan typedef uint_fast64_t my_uint_fast64_t; 1118169691Skan typedef uint_least8_t my_uint_least8_t; 1119169691Skan typedef uint_least16_t my_uint_least16_t; 1120169691Skan typedef uint_least32_t my_uint_least32_t; 1121169691Skan typedef uint_least64_t my_uint_least64_t; 1122169691Skan typedef uintmax_t my_uintmax_t; 1123169691Skan typedef uintptr_t my_uintptr_t; 1124169691Skan ],[ac_c99_stdint_tr1=yes], [ac_c99_stdint_tr1=no]) 1125169691Skan ]) 1126169691Skan AC_MSG_RESULT($ac_c99_stdint_tr1) 1127169691Skan if test x"$ac_c99_stdint_tr1" = x"yes"; then 1128169691Skan AC_DEFINE(_GLIBCXX_USE_C99_STDINT_TR1, 1, 1129169691Skan [Define if C99 types in <stdint.h> should be imported in 1130169691Skan <tr1/cstdint> in namespace std::tr1.]) 1131169691Skan fi 1132169691Skan 1133169691Skan # Check for the existence of <math.h> functions. 1134169691Skan AC_MSG_CHECKING([for ISO C99 support to TR1 in <math.h>]) 1135169691Skan AC_CACHE_VAL(ac_c99_math_tr1, [ 1136169691Skan AC_TRY_COMPILE([#include <math.h>], 1137169691Skan [typedef double_t my_double_t; 1138169691Skan typedef float_t my_float_t; 1139169691Skan acosh(0.0); 1140169691Skan acoshf(0.0f); 1141169691Skan acoshl(0.0l); 1142169691Skan asinh(0.0); 1143169691Skan asinhf(0.0f); 1144169691Skan asinhl(0.0l); 1145169691Skan atanh(0.0); 1146169691Skan atanhf(0.0f); 1147169691Skan atanhl(0.0l); 1148169691Skan cbrt(0.0); 1149169691Skan cbrtf(0.0f); 1150169691Skan cbrtl(0.0l); 1151169691Skan copysign(0.0, 0.0); 1152169691Skan copysignf(0.0f, 0.0f); 1153169691Skan copysignl(0.0l, 0.0l); 1154169691Skan erf(0.0); 1155169691Skan erff(0.0f); 1156169691Skan erfl(0.0l); 1157169691Skan erfc(0.0); 1158169691Skan erfcf(0.0f); 1159169691Skan erfcl(0.0l); 1160169691Skan exp2(0.0); 1161169691Skan exp2f(0.0f); 1162169691Skan exp2l(0.0l); 1163169691Skan expm1(0.0); 1164169691Skan expm1f(0.0f); 1165169691Skan expm1l(0.0l); 1166169691Skan fdim(0.0, 0.0); 1167169691Skan fdimf(0.0f, 0.0f); 1168169691Skan fdiml(0.0l, 0.0l); 1169169691Skan fma(0.0, 0.0, 0.0); 1170169691Skan fmaf(0.0f, 0.0f, 0.0f); 1171169691Skan fmal(0.0l, 0.0l, 0.0l); 1172169691Skan fmax(0.0, 0.0); 1173169691Skan fmaxf(0.0f, 0.0f); 1174169691Skan fmaxl(0.0l, 0.0l); 1175169691Skan fmin(0.0, 0.0); 1176169691Skan fminf(0.0f, 0.0f); 1177169691Skan fminl(0.0l, 0.0l); 1178169691Skan hypot(0.0, 0.0); 1179169691Skan hypotf(0.0f, 0.0f); 1180169691Skan hypotl(0.0l, 0.0l); 1181169691Skan ilogb(0.0); 1182169691Skan ilogbf(0.0f); 1183169691Skan ilogbl(0.0l); 1184169691Skan lgamma(0.0); 1185169691Skan lgammaf(0.0f); 1186169691Skan lgammal(0.0l); 1187169691Skan llrint(0.0); 1188169691Skan llrintf(0.0f); 1189169691Skan llrintl(0.0l); 1190169691Skan llround(0.0); 1191169691Skan llroundf(0.0f); 1192169691Skan llroundl(0.0l); 1193169691Skan log1p(0.0); 1194169691Skan log1pf(0.0f); 1195169691Skan log1pl(0.0l); 1196169691Skan log2(0.0); 1197169691Skan log2f(0.0f); 1198169691Skan log2l(0.0l); 1199169691Skan logb(0.0); 1200169691Skan logbf(0.0f); 1201169691Skan logbl(0.0l); 1202169691Skan lrint(0.0); 1203169691Skan lrintf(0.0f); 1204169691Skan lrintl(0.0l); 1205169691Skan lround(0.0); 1206169691Skan lroundf(0.0f); 1207169691Skan lroundl(0.0l); 1208169691Skan nan(0); 1209169691Skan nanf(0); 1210169691Skan nanl(0); 1211169691Skan nearbyint(0.0); 1212169691Skan nearbyintf(0.0f); 1213169691Skan nearbyintl(0.0l); 1214169691Skan nextafter(0.0, 0.0); 1215169691Skan nextafterf(0.0f, 0.0f); 1216169691Skan nextafterl(0.0l, 0.0l); 1217169691Skan nexttoward(0.0, 0.0); 1218169691Skan nexttowardf(0.0f, 0.0f); 1219169691Skan nexttowardl(0.0l, 0.0l); 1220169691Skan remainder(0.0, 0.0); 1221169691Skan remainderf(0.0f, 0.0f); 1222169691Skan remainderl(0.0l, 0.0l); 1223169691Skan remquo(0.0, 0.0, 0); 1224169691Skan remquo(0.0f, 0.0f, 0); 1225169691Skan remquo(0.0l, 0.0l, 0); 1226169691Skan rint(0.0); 1227169691Skan rintf(0.0f); 1228169691Skan rintl(0.0l); 1229169691Skan round(0.0); 1230169691Skan roundf(0.0f); 1231169691Skan roundl(0.0l); 1232169691Skan scalbln(0.0, 0l); 1233169691Skan scalblnf(0.0f, 0l); 1234169691Skan scalblnl(0.0l, 0l); 1235169691Skan scalbn(0.0, 0); 1236169691Skan scalbnf(0.0f, 0); 1237169691Skan scalbnl(0.0l, 0); 1238169691Skan tgamma(0.0); 1239169691Skan tgammaf(0.0f); 1240169691Skan tgammal(0.0l); 1241169691Skan trunc(0.0); 1242169691Skan truncf(0.0f); 1243169691Skan truncl(0.0l); 1244169691Skan ],[ac_c99_math_tr1=yes], [ac_c99_math_tr1=no]) 1245169691Skan ]) 1246169691Skan AC_MSG_RESULT($ac_c99_math_tr1) 1247169691Skan if test x"$ac_c99_math_tr1" = x"yes"; then 1248169691Skan AC_DEFINE(_GLIBCXX_USE_C99_MATH_TR1, 1, 1249169691Skan [Define if C99 functions or macros in <math.h> should be imported 1250169691Skan in <tr1/cmath> in namespace std::tr1.]) 1251169691Skan fi 1252169691Skan 1253169691Skan # Check for the existence of <inttypes.h> functions (NB: doesn't make 1254169691Skan # sense if the previous check fails, per C99, 7.8/1). 1255169691Skan ac_c99_inttypes_tr1=no; 1256169691Skan if test x"$ac_c99_stdint_tr1" = x"yes"; then 1257169691Skan AC_MSG_CHECKING([for ISO C99 support to TR1 in <inttypes.h>]) 1258169691Skan AC_TRY_COMPILE([#include <inttypes.h>], 1259169691Skan [intmax_t i, numer, denom, base; 1260169691Skan const char* s; 1261169691Skan char** endptr; 1262169691Skan intmax_t ret = imaxabs(i); 1263169691Skan imaxdiv_t dret = imaxdiv(numer, denom); 1264169691Skan ret = strtoimax(s, endptr, base); 1265169691Skan uintmax_t uret = strtoumax(s, endptr, base); 1266169691Skan ],[ac_c99_inttypes_tr1=yes], [ac_c99_inttypes_tr1=no]) 1267169691Skan fi 1268169691Skan AC_MSG_RESULT($ac_c99_inttypes_tr1) 1269169691Skan if test x"$ac_c99_inttypes_tr1" = x"yes"; then 1270169691Skan AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_TR1, 1, 1271169691Skan [Define if C99 functions in <inttypes.h> should be imported in 1272169691Skan <tr1/cinttypes> in namespace std::tr1.]) 1273169691Skan fi 1274169691Skan 1275169691Skan # Check for the existence of the <stdbool.h> header. 1276169691Skan AC_CHECK_HEADERS(stdbool.h) 1277169691Skan 1278132720Skan AC_LANG_RESTORE 1279117397Skan]) 128097403Sobrien 1281169691Skandnl 1282169691Skandnl Check whether "dev/random" and "dev/urandom" are available for the 1283169691Skandnl random_device of "TR1" (Chapter 5.1, "Random number generation"). 1284169691Skandnl 1285169691SkanAC_DEFUN([GLIBCXX_CHECK_RANDOM_TR1], [ 1286117397Skan 1287169691Skan AC_MSG_CHECKING([for "dev/random" and "dev/urandom" for TR1 random_device]) 1288169691Skan AC_CACHE_VAL(ac_random_tr1, [ 1289169691Skan AC_TRY_RUN([#include <stdio.h> 1290169691Skan int main() 1291169691Skan { 1292169691Skan return !(fopen("/dev/random", "r") 1293169691Skan && fopen("/dev/urandom", "r")); 1294169691Skan } 1295169691Skan ], 1296169691Skan [ac_random_tr1=yes], [ac_random_tr1=no], 1297169691Skan [ac_random_tr1=no]) 1298169691Skan ]) 1299169691Skan AC_MSG_RESULT($ac_random_tr1) 1300169691Skan if test x"$ac_random_tr1" = x"yes"; then 1301169691Skan AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1, 1, 1302169691Skan [Define if dev/random and dev/urandom are available for 1303169691Skan the random_device of TR1 (Chapter 5.1).]) 1304169691Skan fi 1305169691Skan 1306169691Skan]) 1307169691Skan 1308117397Skandnl 1309132720Skandnl Check for what type of C headers to use. 1310117397Skandnl 1311132720Skandnl --enable-cheaders= [does stuff]. 1312132720Skandnl --disable-cheaders [does not do anything, really]. 1313132720Skandnl + Usage: GLIBCXX_ENABLE_CHEADERS[(DEFAULT)] 1314132720Skandnl Where DEFAULT is either `c' or `c_std'. 1315117397Skandnl 1316132720SkanAC_DEFUN([GLIBCXX_ENABLE_CHEADERS], [ 1317132720Skan GLIBCXX_ENABLE(cheaders,$1,[=KIND], 1318132720Skan [construct "C" headers for g++], [permit c|c_std]) 1319132720Skan AC_MSG_NOTICE("C" header strategy set to $enable_cheaders) 1320117397Skan 1321132720Skan C_INCLUDE_DIR='${glibcxx_srcdir}/include/'$enable_cheaders 1322117397Skan 1323132720Skan AC_SUBST(C_INCLUDE_DIR) 1324132720Skan GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c) 1325132720Skan GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std) 1326132720Skan GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes) 132797403Sobrien]) 132897403Sobrien 132997403Sobrien 133097403Sobriendnl 1331132720Skandnl Check for which locale library to use. The choice is mapped to 1332132720Skandnl a subdirectory of config/locale. 133397403Sobriendnl 1334132720Skandnl Default is generic. 133597403Sobriendnl 1336132720SkanAC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [ 1337132720Skan AC_MSG_CHECKING([for C locale to use]) 1338132720Skan GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], 1339132720Skan [use MODEL for target locale package], 1340132720Skan [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) 1341132720Skan 1342132720Skan # If they didn't use this option switch, or if they specified --enable 1343132720Skan # with no specific model, we'll have to look for one. If they 1344132720Skan # specified --disable (???), do likewise. 1345132720Skan if test $enable_clocale = no || test $enable_clocale = yes; then 1346132720Skan enable_clocale=auto 1347132720Skan fi 134897403Sobrien 1349132720Skan # Either a known package, or "auto" 135097403Sobrien enable_clocale_flag=$enable_clocale 135197403Sobrien 1352132720Skan # Probe for locale support if no specific model is specified. 1353132720Skan # Default to "generic". 1354132720Skan if test $enable_clocale_flag = auto; then 1355169691Skan case ${target_os} in 1356169691Skan linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) 1357132720Skan AC_EGREP_CPP([_GLIBCXX_ok], [ 135897403Sobrien #include <features.h> 1359132720Skan #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) 1360132720Skan _GLIBCXX_ok 136197403Sobrien #endif 136297403Sobrien ], enable_clocale_flag=gnu, enable_clocale_flag=generic) 136397403Sobrien 1364132720Skan # Test for bugs early in glibc-2.2.x series 1365169691Skan if test $enable_clocale_flag = gnu; then 1366132720Skan AC_TRY_RUN([ 1367132720Skan #define _GNU_SOURCE 1 1368132720Skan #include <locale.h> 1369132720Skan #include <string.h> 1370132720Skan #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) 1371132720Skan extern __typeof(newlocale) __newlocale; 1372132720Skan extern __typeof(duplocale) __duplocale; 1373132720Skan extern __typeof(strcoll_l) __strcoll_l; 1374132720Skan #endif 1375132720Skan int main() 1376132720Skan { 1377132720Skan const char __one[] = "�uglein Augmen"; 1378132720Skan const char __two[] = "�uglein"; 1379132720Skan int i; 1380132720Skan int j; 1381132720Skan __locale_t loc; 1382132720Skan __locale_t loc_dup; 1383132720Skan loc = __newlocale(1 << LC_ALL, "de_DE", 0); 1384132720Skan loc_dup = __duplocale(loc); 1385132720Skan i = __strcoll_l(__one, __two, loc); 1386132720Skan j = __strcoll_l(__one, __two, loc_dup); 1387132720Skan return 0; 1388132720Skan } 1389132720Skan ], 1390132720Skan [enable_clocale_flag=gnu],[enable_clocale_flag=generic], 1391132720Skan [enable_clocale_flag=generic]) 1392132720Skan fi 139397403Sobrien 1394132720Skan # ... at some point put __strxfrm_l tests in as well. 139597403Sobrien ;; 1396169691Skan darwin* | freebsd*) 1397169691Skan enable_clocale_flag=darwin 1398169691Skan ;; 139997403Sobrien *) 1400132720Skan enable_clocale_flag=generic 1401132720Skan ;; 140297403Sobrien esac 140397403Sobrien fi 140497403Sobrien 1405132720Skan # Deal with gettext issues. Default to not using it (=no) until we detect 1406132720Skan # support for it later. Let the user turn it off via --e/d, but let that 1407132720Skan # default to on for easier handling. 1408132720Skan USE_NLS=no 140997403Sobrien AC_ARG_ENABLE(nls, 1410132720Skan AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]), 1411132720Skan [], 1412132720Skan [enable_nls=yes]) 141397403Sobrien 1414132720Skan # Set configure bits for specified locale package 1415132720Skan case ${enable_clocale_flag} in 1416132720Skan generic) 141797403Sobrien AC_MSG_RESULT(generic) 141897403Sobrien 141997403Sobrien CLOCALE_H=config/locale/generic/c_locale.h 142097403Sobrien CLOCALE_CC=config/locale/generic/c_locale.cc 1421103447Skan CCODECVT_CC=config/locale/generic/codecvt_members.cc 142297403Sobrien CCOLLATE_CC=config/locale/generic/collate_members.cc 142397403Sobrien CCTYPE_CC=config/locale/generic/ctype_members.cc 142497403Sobrien CMESSAGES_H=config/locale/generic/messages_members.h 142597403Sobrien CMESSAGES_CC=config/locale/generic/messages_members.cc 142697403Sobrien CMONEY_CC=config/locale/generic/monetary_members.cc 142797403Sobrien CNUMERIC_CC=config/locale/generic/numeric_members.cc 1428110614Skan CTIME_H=config/locale/generic/time_members.h 142997403Sobrien CTIME_CC=config/locale/generic/time_members.cc 1430103447Skan CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h 143197403Sobrien ;; 1432169691Skan darwin) 1433169691Skan AC_MSG_RESULT(darwin or freebsd) 1434169691Skan 1435169691Skan CLOCALE_H=config/locale/generic/c_locale.h 1436169691Skan CLOCALE_CC=config/locale/generic/c_locale.cc 1437169691Skan CCODECVT_CC=config/locale/generic/codecvt_members.cc 1438169691Skan CCOLLATE_CC=config/locale/generic/collate_members.cc 1439169691Skan CCTYPE_CC=config/locale/darwin/ctype_members.cc 1440169691Skan CMESSAGES_H=config/locale/generic/messages_members.h 1441169691Skan CMESSAGES_CC=config/locale/generic/messages_members.cc 1442169691Skan CMONEY_CC=config/locale/generic/monetary_members.cc 1443169691Skan CNUMERIC_CC=config/locale/generic/numeric_members.cc 1444169691Skan CTIME_H=config/locale/generic/time_members.h 1445169691Skan CTIME_CC=config/locale/generic/time_members.cc 1446169691Skan CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h 1447169691Skan ;; 1448169691Skan 1449132720Skan gnu) 145097403Sobrien AC_MSG_RESULT(gnu) 145197403Sobrien 145297403Sobrien # Declare intention to use gettext, and add support for specific 145397403Sobrien # languages. 1454102782Skan # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT 145597403Sobrien ALL_LINGUAS="de fr" 145697403Sobrien 1457102782Skan # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. 145897403Sobrien AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) 145997403Sobrien if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then 1460132720Skan USE_NLS=yes 146197403Sobrien fi 146297403Sobrien # Export the build objects. 146397403Sobrien for ling in $ALL_LINGUAS; do \ 1464132720Skan glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ 1465132720Skan glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ 146697403Sobrien done 1467132720Skan AC_SUBST(glibcxx_MOFILES) 1468132720Skan AC_SUBST(glibcxx_POFILES) 146997403Sobrien 147097403Sobrien CLOCALE_H=config/locale/gnu/c_locale.h 147197403Sobrien CLOCALE_CC=config/locale/gnu/c_locale.cc 1472103447Skan CCODECVT_CC=config/locale/gnu/codecvt_members.cc 147397403Sobrien CCOLLATE_CC=config/locale/gnu/collate_members.cc 147497403Sobrien CCTYPE_CC=config/locale/gnu/ctype_members.cc 147597403Sobrien CMESSAGES_H=config/locale/gnu/messages_members.h 147697403Sobrien CMESSAGES_CC=config/locale/gnu/messages_members.cc 147797403Sobrien CMONEY_CC=config/locale/gnu/monetary_members.cc 147897403Sobrien CNUMERIC_CC=config/locale/gnu/numeric_members.cc 1479110614Skan CTIME_H=config/locale/gnu/time_members.h 148097403Sobrien CTIME_CC=config/locale/gnu/time_members.cc 1481103447Skan CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h 148297403Sobrien ;; 1483132720Skan ieee_1003.1-2001) 1484132720Skan AC_MSG_RESULT(IEEE 1003.1) 148597403Sobrien 148697403Sobrien CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h 148797403Sobrien CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc 1488103447Skan CCODECVT_CC=config/locale/generic/codecvt_members.cc 148997403Sobrien CCOLLATE_CC=config/locale/generic/collate_members.cc 149097403Sobrien CCTYPE_CC=config/locale/generic/ctype_members.cc 149197403Sobrien CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h 149297403Sobrien CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc 149397403Sobrien CMONEY_CC=config/locale/generic/monetary_members.cc 149497403Sobrien CNUMERIC_CC=config/locale/generic/numeric_members.cc 1495110614Skan CTIME_H=config/locale/generic/time_members.h 149697403Sobrien CTIME_CC=config/locale/generic/time_members.cc 1497103447Skan CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h 149897403Sobrien ;; 149997403Sobrien esac 150097403Sobrien 150197403Sobrien # This is where the testsuite looks for locale catalogs, using the 150297403Sobrien # -DLOCALEDIR define during testsuite compilation. 1503132720Skan glibcxx_localedir=${glibcxx_builddir}/po/share/locale 1504132720Skan AC_SUBST(glibcxx_localedir) 150597403Sobrien 1506132720Skan # A standalone libintl (e.g., GNU libintl) may be in use. 1507132720Skan if test $USE_NLS = yes; then 1508132720Skan AC_CHECK_HEADERS([libintl.h], [], USE_NLS=no) 1509132720Skan AC_SEARCH_LIBS(gettext, intl, [], USE_NLS=no) 1510132720Skan fi 1511132720Skan if test $USE_NLS = yes; then 1512169691Skan AC_DEFINE(_GLIBCXX_USE_NLS, 1, 1513169691Skan [Define if NLS translations are to be used.]) 1514132720Skan fi 1515132720Skan 151697403Sobrien AC_SUBST(USE_NLS) 151797403Sobrien AC_SUBST(CLOCALE_H) 151897403Sobrien AC_SUBST(CMESSAGES_H) 1519117397Skan AC_SUBST(CCODECVT_CC) 1520117397Skan AC_SUBST(CCOLLATE_CC) 1521117397Skan AC_SUBST(CCTYPE_CC) 1522117397Skan AC_SUBST(CMESSAGES_CC) 1523117397Skan AC_SUBST(CMONEY_CC) 1524117397Skan AC_SUBST(CNUMERIC_CC) 1525110614Skan AC_SUBST(CTIME_H) 1526117397Skan AC_SUBST(CTIME_CC) 1527117397Skan AC_SUBST(CLOCALE_CC) 1528117397Skan AC_SUBST(CLOCALE_INTERNAL_H) 152997403Sobrien]) 153097403Sobrien 153197403Sobrien 153297403Sobriendnl 1533132720Skandnl Check for which std::allocator base class to use. The choice is 1534132720Skandnl mapped from a subdirectory of include/ext. 153597403Sobriendnl 1536132720Skandnl Default is new. 153797403Sobriendnl 1538132720SkanAC_DEFUN([GLIBCXX_ENABLE_ALLOCATOR], [ 1539169691Skan AC_MSG_CHECKING([for std::allocator base class]) 1540132720Skan GLIBCXX_ENABLE(libstdcxx-allocator,auto,[=KIND], 1541132720Skan [use KIND for target std::allocator base], 1542132720Skan [permit new|malloc|mt|bitmap|pool|yes|no|auto]) 1543169691Skan 1544132720Skan # If they didn't use this option switch, or if they specified --enable 1545132720Skan # with no specific model, we'll have to look for one. If they 1546132720Skan # specified --disable (???), do likewise. 1547169691Skan if test $enable_libstdcxx_allocator = no || 1548169691Skan test $enable_libstdcxx_allocator = yes; 1549169691Skan then 1550132720Skan enable_libstdcxx_allocator=auto 1551132720Skan fi 155297403Sobrien 1553169691Skan # Either a known package, or "auto". Auto implies the default choice 1554169691Skan # for a particular platform. 1555132720Skan enable_libstdcxx_allocator_flag=$enable_libstdcxx_allocator 155697403Sobrien 1557132720Skan # Probe for host-specific support if no specific model is specified. 1558132720Skan # Default to "new". 1559132720Skan if test $enable_libstdcxx_allocator_flag = auto; then 1560132720Skan case ${target_os} in 1561169691Skan linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) 1562169691Skan enable_libstdcxx_allocator_flag=new 1563169691Skan ;; 1564132720Skan *) 1565132720Skan enable_libstdcxx_allocator_flag=new 1566132720Skan ;; 1567132720Skan esac 1568132720Skan fi 1569132720Skan AC_MSG_RESULT($enable_libstdcxx_allocator_flag) 1570132720Skan 157197403Sobrien 1572132720Skan # Set configure bits for specified locale package 1573132720Skan case ${enable_libstdcxx_allocator_flag} in 1574132720Skan bitmap) 1575132720Skan ALLOCATOR_H=config/allocator/bitmap_allocator_base.h 1576132720Skan ALLOCATOR_NAME=__gnu_cxx::bitmap_allocator 157797403Sobrien ;; 1578132720Skan malloc) 1579132720Skan ALLOCATOR_H=config/allocator/malloc_allocator_base.h 1580132720Skan ALLOCATOR_NAME=__gnu_cxx::malloc_allocator 158197403Sobrien ;; 1582132720Skan mt) 1583132720Skan ALLOCATOR_H=config/allocator/mt_allocator_base.h 1584132720Skan ALLOCATOR_NAME=__gnu_cxx::__mt_alloc 158597403Sobrien ;; 1586132720Skan new) 1587132720Skan ALLOCATOR_H=config/allocator/new_allocator_base.h 1588132720Skan ALLOCATOR_NAME=__gnu_cxx::new_allocator 1589132720Skan ;; 1590132720Skan pool) 1591132720Skan ALLOCATOR_H=config/allocator/pool_allocator_base.h 1592132720Skan ALLOCATOR_NAME=__gnu_cxx::__pool_alloc 1593132720Skan ;; 159497403Sobrien esac 159597403Sobrien 1596132720Skan AC_SUBST(ALLOCATOR_H) 1597132720Skan AC_SUBST(ALLOCATOR_NAME) 159897403Sobrien]) 159997403Sobrien 160097403Sobrien 160197403Sobriendnl 1602132720Skandnl Check for whether the Boost-derived checks should be turned on. 160397403Sobriendnl 1604132720Skandnl --enable-concept-checks turns them on. 1605132720Skandnl --disable-concept-checks leaves them off. 1606132720Skandnl + Usage: GLIBCXX_ENABLE_CONCEPT_CHECKS[(DEFAULT)] 1607132720Skandnl Where DEFAULT is either `yes' or `no'. 1608132720Skandnl 1609132720SkanAC_DEFUN([GLIBCXX_ENABLE_CONCEPT_CHECKS], [ 1610132720Skan GLIBCXX_ENABLE(concept-checks,$1,,[use Boost-derived template checks]) 1611132720Skan if test $enable_concept_checks = yes; then 1612169691Skan AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS, 1, 1613169691Skan [Define to use concept checking code from the boost libraries.]) 161497403Sobrien fi 161597403Sobrien]) 161697403Sobrien 161797403Sobrien 161897403Sobriendnl 1619132720Skandnl Check for which I/O library to use: stdio, or something specific. 162097403Sobriendnl 1621132720Skandnl Default is stdio. 162297403Sobriendnl 1623132720SkanAC_DEFUN([GLIBCXX_ENABLE_CSTDIO], [ 1624132720Skan AC_MSG_CHECKING([for underlying I/O to use]) 1625132720Skan GLIBCXX_ENABLE(cstdio,stdio,[=PACKAGE], 1626132720Skan [use target-specific I/O package], [permit stdio]) 162797403Sobrien 1628132720Skan # Now that libio has been removed, you can have any color you want as long 1629132720Skan # as it's black. This is one big no-op until other packages are added, but 1630132720Skan # showing the framework never hurts. 1631132720Skan case ${enable_cstdio} in 1632132720Skan stdio) 1633132720Skan CSTDIO_H=config/io/c_io_stdio.h 1634132720Skan BASIC_FILE_H=config/io/basic_file_stdio.h 1635132720Skan BASIC_FILE_CC=config/io/basic_file_stdio.cc 1636132720Skan AC_MSG_RESULT(stdio) 1637132720Skan ;; 1638132720Skan esac 163997403Sobrien 1640132720Skan AC_SUBST(CSTDIO_H) 1641132720Skan AC_SUBST(BASIC_FILE_H) 1642132720Skan AC_SUBST(BASIC_FILE_CC) 164397403Sobrien]) 164497403Sobrien 164597403Sobrien 164697403Sobriendnl 1647132720Skandnl Check for "unusual" flags to pass to the compiler while building. 164897403Sobriendnl 1649132720Skandnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing 1650132720Skandnl experimental flags such as -fpch, -fIMI, -Dfloat=char, etc. 1651132720Skandnl --disable-cxx-flags passes nothing. 1652132720Skandnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html 1653132720Skandnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html 1654132720Skandnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html 1655132720Skandnl + Usage: GLIBCXX_ENABLE_CXX_FLAGS(default flags) 1656132720Skandnl If "default flags" is an empty string, the effect is the same 1657132720Skandnl as --disable or --enable=no. 165897403Sobriendnl 1659132720SkanAC_DEFUN([GLIBCXX_ENABLE_CXX_FLAGS], [dnl 1660132720Skan AC_MSG_CHECKING([for extra compiler flags for building]) 1661132720Skan GLIBCXX_ENABLE(cxx-flags,$1,[=FLAGS], 1662132720Skan [pass compiler FLAGS when building library], 1663132720Skan [case "x$enable_cxx_flags" in 1664132720Skan xno | x) enable_cxx_flags= ;; 1665132720Skan x-*) ;; 1666132720Skan *) AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;; 1667132720Skan esac]) 166897403Sobrien 1669132720Skan # Run through flags (either default or command-line) and set anything 1670132720Skan # extra (e.g., #defines) that must accompany particular g++ options. 1671132720Skan if test -n "$enable_cxx_flags"; then 1672132720Skan for f in $enable_cxx_flags; do 1673132720Skan case "$f" in 1674132720Skan -fhonor-std) ;; 1675132720Skan -*) ;; 1676132720Skan *) # and we're trying to pass /what/ exactly? 1677132720Skan AC_MSG_ERROR([compiler flags start with a -]) ;; 1678132720Skan esac 1679132720Skan done 168097403Sobrien fi 168197403Sobrien 1682132720Skan EXTRA_CXX_FLAGS="$enable_cxx_flags" 1683132720Skan AC_MSG_RESULT($EXTRA_CXX_FLAGS) 1684132720Skan AC_SUBST(EXTRA_CXX_FLAGS) 168597403Sobrien]) 168697403Sobrien 168797403Sobrien 168897403Sobriendnl 1689132720Skandnl Check to see if debugging libraries are to be built. 169097403Sobriendnl 1691132720Skandnl --enable-libstdcxx-debug 1692132720Skandnl builds a separate set of debugging libraries in addition to the 1693132720Skandnl normal (shared, static) libstdc++ binaries. 169497403Sobriendnl 1695132720Skandnl --disable-libstdcxx-debug 1696132720Skandnl builds only one (non-debug) version of libstdc++. 1697132720Skandnl 1698132720Skandnl --enable-libstdcxx-debug-flags=FLAGS 1699132720Skandnl iff --enable-debug == yes, then use FLAGS to build the debug library. 1700132720Skandnl 1701132720Skandnl + Usage: GLIBCXX_ENABLE_DEBUG[(DEFAULT)] 1702132720Skandnl Where DEFAULT is either `yes' or `no'. 1703132720Skandnl 1704132720SkanAC_DEFUN([GLIBCXX_ENABLE_DEBUG], [ 1705132720Skan AC_MSG_CHECKING([for additional debug build]) 1706132720Skan GLIBCXX_ENABLE(libstdcxx-debug,$1,,[build extra debug library]) 1707132720Skan AC_MSG_RESULT($enable_libstdcxx_debug) 1708132720Skan GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_DEBUG, test $enable_libstdcxx_debug = yes) 170997403Sobrien]) 171097403Sobrien 171197403Sobrien 171297403Sobriendnl 1713132720Skandnl Check for explicit debug flags. 171497403Sobriendnl 1715132720Skandnl --enable-libstdcxx-debug-flags='-O1' 1716132720Skandnl is a general method for passing flags to be used when 1717132720Skandnl building debug libraries with --enable-debug. 171897403Sobriendnl 1719132720Skandnl --disable-libstdcxx-debug-flags does nothing. 1720132720Skandnl + Usage: GLIBCXX_ENABLE_DEBUG_FLAGS(default flags) 1721132720Skandnl If "default flags" is an empty string, the effect is the same 1722132720Skandnl as --disable or --enable=no. 172397403Sobriendnl 1724132720SkanAC_DEFUN([GLIBCXX_ENABLE_DEBUG_FLAGS], [ 1725132720Skan GLIBCXX_ENABLE(libstdcxx-debug-flags,[$1],[=FLAGS], 1726132720Skan [pass compiler FLAGS when building debug library], 1727132720Skan [case "x$enable_libstdcxx_debug_flags" in 1728132720Skan xno | x) enable_libstdcxx_debug_flags= ;; 1729132720Skan x-*) ;; 1730132720Skan *) AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;; 1731132720Skan esac]) 173297403Sobrien 1733132720Skan # Option parsed, now set things appropriately 1734132720Skan DEBUG_FLAGS="$enable_libstdcxx_debug_flags" 1735132720Skan AC_SUBST(DEBUG_FLAGS) 173697403Sobrien 1737132720Skan AC_MSG_NOTICE([Debug build flags set to $DEBUG_FLAGS]) 173897403Sobrien]) 173997403Sobrien 174097403Sobrien 174197403Sobriendnl 1742132720Skandnl Check if the user only wants a freestanding library implementation. 174397403Sobriendnl 1744132720Skandnl --disable-hosted-libstdcxx will turn off most of the library build, 1745132720Skandnl installing only the headers required by [17.4.1.3] and the language 1746132720Skandnl support library. More than that will be built (to keep the Makefiles 1747132720Skandnl conveniently clean), but not installed. 174897403Sobriendnl 1749132720Skandnl Sets: 1750132720Skandnl is_hosted (yes/no) 175197403Sobriendnl 1752132720Skandnl Defines: 1753132720Skandnl _GLIBCXX_HOSTED (always defined, either to 1 or 0) 175497403Sobriendnl 1755132720SkanAC_DEFUN([GLIBCXX_ENABLE_HOSTED], [ 1756132720Skan AC_ARG_ENABLE([hosted-libstdcxx], 1757132720Skan AC_HELP_STRING([--disable-hosted-libstdcxx], 1758132720Skan [only build freestanding C++ runtime support]),, 1759169691Skan [case "$host" in 1760169691Skan arm*-*-symbianelf*) 1761169691Skan enable_hosted_libstdcxx=no 1762169691Skan ;; 1763169691Skan *) 1764169691Skan enable_hosted_libstdcxx=yes 1765169691Skan ;; 1766169691Skan esac]) 1767132720Skan if test "$enable_hosted_libstdcxx" = no; then 1768132720Skan AC_MSG_NOTICE([Only freestanding libraries will be built]) 1769132720Skan is_hosted=no 1770132720Skan hosted_define=0 1771132720Skan enable_abi_check=no 1772132720Skan enable_libstdcxx_pch=no 177397403Sobrien else 1774132720Skan is_hosted=yes 1775132720Skan hosted_define=1 177697403Sobrien fi 1777132720Skan GLIBCXX_CONDITIONAL(GLIBCXX_HOSTED, test $is_hosted = yes) 1778132720Skan AC_DEFINE_UNQUOTED(_GLIBCXX_HOSTED, $hosted_define, 1779132720Skan [Define to 1 if a full hosted library is built, or 0 if freestanding.]) 178097403Sobrien]) 178197403Sobrien 178297403Sobrien 1783132720Skandnl 1784169691Skandnl Check for template specializations for the 'long long' type. 1785132720Skandnl The result determines only whether 'long long' I/O is enabled; things 1786132720Skandnl like numeric_limits<> specializations are always available. 1787132720Skandnl 1788132720Skandnl --enable-long-long defines _GLIBCXX_USE_LONG_LONG 1789132720Skandnl --disable-long-long leaves _GLIBCXX_USE_LONG_LONG undefined 1790132720Skandnl + Usage: GLIBCXX_ENABLE_LONG_LONG[(DEFAULT)] 1791132720Skandnl Where DEFAULT is either `yes' or `no'. 1792132720Skandnl 1793132720SkanAC_DEFUN([GLIBCXX_ENABLE_LONG_LONG], [ 1794169691Skan GLIBCXX_ENABLE(long-long,$1,,[enable template specializations for 'long long']) 1795132720Skan if test $enable_long_long = yes; then 1796169691Skan AC_DEFINE(_GLIBCXX_USE_LONG_LONG, 1, 1797169691Skan [Define if code specialized for long long should be used.]) 179897403Sobrien fi 1799169691Skan AC_MSG_CHECKING([for enabled long long specializations]) 1800169691Skan AC_MSG_RESULT([$enable_long_long]) 180197403Sobrien]) 180297403Sobrien 180397403Sobrien 180497403Sobriendnl 1805169691Skandnl Check for template specializations for the 'wchar_t' type. 1806169691Skandnl 1807169691Skandnl --enable-wchar_t defines _GLIBCXX_USE_WCHAR_T 1808169691Skandnl --disable-wchar_t leaves _GLIBCXX_USE_WCHAR_T undefined 1809169691Skandnl + Usage: GLIBCXX_ENABLE_WCHAR_T[(DEFAULT)] 1810169691Skandnl Where DEFAULT is either `yes' or `no'. 1811169691Skandnl 1812169691Skandnl Necessary support must also be present. 1813169691Skandnl 1814169691SkanAC_DEFUN([GLIBCXX_ENABLE_WCHAR_T], [ 1815169691Skan GLIBCXX_ENABLE(wchar_t,$1,,[enable template specializations for 'wchar_t']) 1816169691Skan 1817169691Skan # Test wchar.h for mbstate_t, which is needed for char_traits and fpos. 1818169691Skan AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no) 1819169691Skan AC_MSG_CHECKING([for mbstate_t]) 1820169691Skan AC_TRY_COMPILE([#include <wchar.h>], 1821169691Skan [mbstate_t teststate;], 1822169691Skan have_mbstate_t=yes, have_mbstate_t=no) 1823169691Skan AC_MSG_RESULT($have_mbstate_t) 1824169691Skan if test x"$have_mbstate_t" = xyes; then 1825169691Skan AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.]) 1826169691Skan fi 1827169691Skan 1828169691Skan # Test it always, for use in GLIBCXX_ENABLE_C99, together with 1829169691Skan # ac_has_wchar_h. 1830169691Skan AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no) 1831169691Skan 1832169691Skan if test x"$enable_wchar_t" = x"yes"; then 1833169691Skan 1834169691Skan AC_LANG_SAVE 1835169691Skan AC_LANG_CPLUSPLUS 1836169691Skan 1837169691Skan if test x"$ac_has_wchar_h" = xyes && 1838169691Skan test x"$ac_has_wctype_h" = xyes; then 1839169691Skan AC_TRY_COMPILE([#include <wchar.h> 1840169691Skan #include <stddef.h> 1841169691Skan wint_t i; 1842169691Skan long l = WEOF; 1843169691Skan long j = WCHAR_MIN; 1844169691Skan long k = WCHAR_MAX; 1845169691Skan namespace test 1846169691Skan { 1847169691Skan using ::btowc; 1848169691Skan using ::fgetwc; 1849169691Skan using ::fgetws; 1850169691Skan using ::fputwc; 1851169691Skan using ::fputws; 1852169691Skan using ::fwide; 1853169691Skan using ::fwprintf; 1854169691Skan using ::fwscanf; 1855169691Skan using ::getwc; 1856169691Skan using ::getwchar; 1857169691Skan using ::mbrlen; 1858169691Skan using ::mbrtowc; 1859169691Skan using ::mbsinit; 1860169691Skan using ::mbsrtowcs; 1861169691Skan using ::putwc; 1862169691Skan using ::putwchar; 1863169691Skan using ::swprintf; 1864169691Skan using ::swscanf; 1865169691Skan using ::ungetwc; 1866169691Skan using ::vfwprintf; 1867169691Skan using ::vswprintf; 1868169691Skan using ::vwprintf; 1869169691Skan using ::wcrtomb; 1870169691Skan using ::wcscat; 1871169691Skan using ::wcschr; 1872169691Skan using ::wcscmp; 1873169691Skan using ::wcscoll; 1874169691Skan using ::wcscpy; 1875169691Skan using ::wcscspn; 1876169691Skan using ::wcsftime; 1877169691Skan using ::wcslen; 1878169691Skan using ::wcsncat; 1879169691Skan using ::wcsncmp; 1880169691Skan using ::wcsncpy; 1881169691Skan using ::wcspbrk; 1882169691Skan using ::wcsrchr; 1883169691Skan using ::wcsrtombs; 1884169691Skan using ::wcsspn; 1885169691Skan using ::wcsstr; 1886169691Skan using ::wcstod; 1887169691Skan using ::wcstok; 1888169691Skan using ::wcstol; 1889169691Skan using ::wcstoul; 1890169691Skan using ::wcsxfrm; 1891169691Skan using ::wctob; 1892169691Skan using ::wmemchr; 1893169691Skan using ::wmemcmp; 1894169691Skan using ::wmemcpy; 1895169691Skan using ::wmemmove; 1896169691Skan using ::wmemset; 1897169691Skan using ::wprintf; 1898169691Skan using ::wscanf; 1899169691Skan } 1900169691Skan ],[],[], [enable_wchar_t=no]) 1901169691Skan else 1902169691Skan enable_wchar_t=no 1903169691Skan fi 1904169691Skan 1905169691Skan AC_LANG_RESTORE 1906169691Skan fi 1907169691Skan 1908169691Skan if test x"$enable_wchar_t" = x"yes"; then 1909169691Skan AC_DEFINE(_GLIBCXX_USE_WCHAR_T, 1, 1910169691Skan [Define if code specialized for wchar_t should be used.]) 1911169691Skan fi 1912169691Skan 1913169691Skan AC_MSG_CHECKING([for enabled wchar_t specializations]) 1914169691Skan AC_MSG_RESULT([$enable_wchar_t]) 1915169691Skan]) 1916169691Skan 1917169691Skan 1918169691Skandnl 1919132720Skandnl Check to see if building and using a C++ precompiled header can be done. 192097403Sobriendnl 1921132720Skandnl --enable-libstdcxx-pch=yes 1922132720Skandnl default, this shows intent to use stdc++.h.gch If it looks like it 1923132720Skandnl may work, after some light-hearted attempts to puzzle out compiler 1924132720Skandnl support, flip bits on in include/Makefile.am 1925132720Skandnl 1926132720Skandnl --disable-libstdcxx-pch 1927132720Skandnl turns off attempts to use or build stdc++.h.gch. 1928132720Skandnl 1929132720Skandnl Substs: 1930132720Skandnl glibcxx_PCHFLAGS 1931132720Skandnl 1932132720SkanAC_DEFUN([GLIBCXX_ENABLE_PCH], [ 1933132720Skan GLIBCXX_ENABLE(libstdcxx-pch,$1,,[build pre-compiled libstdc++ headers]) 1934132720Skan if test $enable_libstdcxx_pch = yes; then 1935132720Skan AC_CACHE_CHECK([for compiler with PCH support], 1936132720Skan [glibcxx_cv_prog_CXX_pch], 1937132720Skan [ac_save_CXXFLAGS="$CXXFLAGS" 1938132720Skan CXXFLAGS="$CXXFLAGS -Werror -Winvalid-pch -Wno-deprecated" 1939132720Skan AC_LANG_SAVE 1940132720Skan AC_LANG_CPLUSPLUS 1941132720Skan echo '#include <math.h>' > conftest.h 1942132720Skan if $CXX $CXXFLAGS $CPPFLAGS -x c++-header conftest.h \ 1943132720Skan -o conftest.h.gch 1>&5 2>&1 && 1944132720Skan echo '#error "pch failed"' > conftest.h && 1945132720Skan echo '#include "conftest.h"' > conftest.cc && 1946132720Skan $CXX -c $CXXFLAGS $CPPFLAGS conftest.cc 1>&5 2>&1 ; 1947132720Skan then 1948132720Skan glibcxx_cv_prog_CXX_pch=yes 1949132720Skan else 1950132720Skan glibcxx_cv_prog_CXX_pch=no 1951132720Skan fi 1952132720Skan rm -f conftest* 1953132720Skan CXXFLAGS=$ac_save_CXXFLAGS 1954132720Skan AC_LANG_RESTORE 1955132720Skan ]) 1956132720Skan enable_libstdcxx_pch=$glibcxx_cv_prog_CXX_pch 1957117397Skan fi 1958102782Skan 1959169691Skan AC_MSG_CHECKING([for enabled PCH]) 1960169691Skan AC_MSG_RESULT([$enable_libstdcxx_pch]) 1961169691Skan 1962132720Skan GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes) 1963132720Skan if test $enable_libstdcxx_pch = yes; then 1964169691Skan glibcxx_PCHFLAGS="-include bits/stdtr1c++.h" 1965117397Skan else 1966132720Skan glibcxx_PCHFLAGS="" 1967117397Skan fi 1968132720Skan AC_SUBST(glibcxx_PCHFLAGS) 196997403Sobrien]) 197097403Sobrien 197197403Sobrien 1972117397Skandnl 1973169691Skandnl Check for atomic builtins. 1974169691Skandnl See: 1975169691Skandnl http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#Atomic-Builtins 1976169691Skandnl 1977169691Skandnl This checks to see if the host supports the compiler-generated 1978169691Skandnl builtins for atomic operations. Note, this is intended to be an 1979169691Skandnl all-or-nothing switch, so all the atomic operations that are used 1980169691Skandnl should be checked. 1981169691Skandnl 1982169691Skandnl Note: 1983169691Skandnl libgomp and libgfortran do this with a link test, instead of an asm test. 1984169691Skandnl see: CHECK_SYNC_FETCH_AND_ADD 1985169691Skandnl 1986169691Skandnl Defines: 1987169691Skandnl _GLIBCXX_ATOMIC_BUILTINS if the compiler on this target supports atomics. 1988169691Skandnl 1989169691SkanAC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ 1990169691Skan AC_MSG_CHECKING([for atomic builtins]) 1991169691Skan AC_LANG_SAVE 1992169691Skan AC_LANG_CPLUSPLUS 1993169691Skan 1994169691Skan # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. 1995169691Skan cat > conftest.$ac_ext << EOF 1996169691Skan[#]line __oline__ "configure" 1997169691Skanint main() 1998169691Skan{ 1999169691Skan // NB: _Atomic_word not necessarily int. 2000169691Skan typedef int atomic_type; 2001169691Skan atomic_type c1; 2002169691Skan atomic_type c2; 2003169691Skan const atomic_type c3(0); 2004169691Skan if (__sync_fetch_and_add(&c1, c2) == c3) 2005169691Skan { 2006169691Skan // Do something. 2007169691Skan } 2008169691Skan return 0; 2009169691Skan} 2010169691SkanEOF 2011169691Skan old_CXXFLAGS="$CXXFLAGS" 2012169691Skan CXXFLAGS=-S 2013169691Skan if AC_TRY_EVAL(ac_compile); then 2014169691Skan if grep __sync_fetch_and_add conftest.s >/dev/null 2>&1 ; then 2015169691Skan enable_atomic_builtins=no 2016169691Skan else 2017169691Skan AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS, 1, 2018169691Skan [Define if builtin atomic operations are supported on this host.]) 2019169691Skan enable_atomic_builtins=yes 2020169691Skan atomicity_dir=cpu/generic/atomicity_builtins 2021169691Skan fi 2022169691Skan fi 2023169691Skan CXXFLAGS="$old_CXXFLAGS" 2024169691Skan rm -f conftest* 2025169691Skan 2026169691Skan # Now, if still generic, set to mutex. 2027169691Skan if test $atomicity_dir = "cpu/generic" ; then 2028169691Skan atomicity_dir=cpu/generic/atomicity_mutex 2029169691Skan fi 2030169691Skan AC_LANG_RESTORE 2031169691Skan AC_MSG_RESULT($enable_atomic_builtins) 2032169691Skan]) 2033169691Skan 2034169691Skan 2035169691Skandnl 2036132720Skandnl Check for exception handling support. If an explicit enable/disable 2037132720Skandnl sjlj exceptions is given, we don't have to detect. Otherwise the 2038132720Skandnl target may or may not support call frame exceptions. 2039117397Skandnl 2040132720Skandnl --enable-sjlj-exceptions forces the use of builtin setjmp. 2041132720Skandnl --disable-sjlj-exceptions forces the use of call frame unwinding. 2042132720Skandnl Neither one forces an attempt at detection. 2043117397Skandnl 2044132720Skandnl Defines: 2045132720Skandnl _GLIBCXX_SJLJ_EXCEPTIONS if the compiler is configured for it 2046117397Skandnl 2047132720SkanAC_DEFUN([GLIBCXX_ENABLE_SJLJ_EXCEPTIONS], [ 2048132720Skan AC_MSG_CHECKING([for exception model to use]) 2049132720Skan AC_LANG_SAVE 2050132720Skan AC_LANG_CPLUSPLUS 2051132720Skan GLIBCXX_ENABLE(sjlj-exceptions,auto,, 2052132720Skan [force use of builtin_setjmp for exceptions], 2053132720Skan [permit yes|no|auto]) 2054117397Skan 2055132720Skan if test $enable_sjlj_exceptions = auto; then 2056132720Skan # Botheration. Now we've got to detect the exception model. Link tests 2057132720Skan # against libgcc.a are problematic since we've not been given proper -L 2058132720Skan # bits for single-tree newlib and libgloss. 2059132720Skan # 2060132720Skan # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. 2061132720Skan cat > conftest.$ac_ext << EOF 2062132720Skan[#]line __oline__ "configure" 2063132720Skanstruct S { ~S(); }; 2064132720Skanvoid bar(); 2065132720Skanvoid foo() 2066132720Skan{ 2067132720Skan S s; 2068132720Skan bar(); 2069132720Skan} 2070132720SkanEOF 2071132720Skan old_CXXFLAGS="$CXXFLAGS" 2072132720Skan CXXFLAGS=-S 2073132720Skan if AC_TRY_EVAL(ac_compile); then 2074132720Skan if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then 2075132720Skan enable_sjlj_exceptions=yes 2076132720Skan elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then 2077132720Skan enable_sjlj_exceptions=no 2078169691Skan elif grep __cxa_end_cleanup conftest.s >/dev/null 2>&1 ; then 2079169691Skan enable_sjlj_exceptions=no 2080132720Skan fi 2081132720Skan fi 2082132720Skan CXXFLAGS="$old_CXXFLAGS" 2083132720Skan rm -f conftest* 2084117397Skan fi 2085117397Skan 2086169691Skan # This is a tad weird, for hysterical raisins. We have to map 2087169691Skan # enable/disable to two different models. 2088132720Skan case $enable_sjlj_exceptions in 2089132720Skan yes) 2090132720Skan AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1, 2091132720Skan [Define if the compiler is configured for setjmp/longjmp exceptions.]) 2092132720Skan ac_exception_model_name=sjlj 2093132720Skan ;; 2094132720Skan no) 2095132720Skan ac_exception_model_name="call frame" 2096132720Skan ;; 2097132720Skan *) 2098132720Skan AC_MSG_ERROR([unable to detect exception model]) 2099132720Skan ;; 2100132720Skan esac 2101132720Skan AC_LANG_RESTORE 2102132720Skan AC_MSG_RESULT($ac_exception_model_name) 210397403Sobrien]) 210497403Sobrien 210597403Sobrien 210697403Sobriendnl 2107169691Skandnl Allow visibility attributes to be used on namespaces, objects, etc. 2108169691Skandnl 2109169691Skandnl --enable-visibility enables attempt to use visibility attributes. 2110169691Skandnl --disable-visibility turns off all use of visibility attributes. 2111169691Skandnl + Usage: GLIBCXX_ENABLE_VISIBILITY[(DEFAULT)] 2112169691Skandnl Where DEFAULT is 'yes'. 2113169691Skandnl 2114169691SkanAC_DEFUN([GLIBCXX_ENABLE_VISIBILITY], [ 2115169691SkanGLIBCXX_ENABLE(visibility,$1,,[enables visibility safe usage]) 2116169691Skan 2117169691Skanif test x$enable_visibility = xyes ; then 2118169691Skan dnl all hail libgfortran 2119169691Skan dnl Check whether the target supports hidden visibility. 2120169691Skan AC_CACHE_CHECK([whether the target supports hidden visibility], 2121169691Skan have_attribute_visibility, [ 2122169691Skan save_CFLAGS="$CFLAGS" 2123169691Skan CFLAGS="$CFLAGS -Werror" 2124169691Skan AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }], 2125169691Skan [], have_attribute_visibility=yes, 2126169691Skan have_attribute_visibility=no) 2127169691Skan CFLAGS="$save_CFLAGS"]) 2128169691Skan if test $have_attribute_visibility = no; then 2129169691Skan enable_visibility=no 2130169691Skan fi 2131169691Skanfi 2132169691Skan 2133169691SkanGLIBCXX_CONDITIONAL(ENABLE_VISIBILITY, test $enable_visibility = yes) 2134169691SkanAC_MSG_NOTICE([visibility supported: $enable_visibility]) 2135169691Skan]) 2136169691Skan 2137169691Skan 2138169691Skandnl 213997403Sobriendnl Add version tags to symbols in shared library (or not), additionally 214097403Sobriendnl marking other symbols as private/local (or not). 214197403Sobriendnl 214297403Sobriendnl --enable-symvers=style adds a version script to the linker call when 214397403Sobriendnl creating the shared library. The choice of version script is 214497403Sobriendnl controlled by 'style'. 214597403Sobriendnl --disable-symvers does not. 2146132720Skandnl + Usage: GLIBCXX_ENABLE_SYMVERS[(DEFAULT)] 2147132720Skandnl Where DEFAULT is either 'yes' or 'no'. Passing `yes' tries to 2148132720Skandnl choose a default style based on linker characteristics. Passing 2149132720Skandnl 'no' disables versioning. 2150132720Skandnl 2151132720SkanAC_DEFUN([GLIBCXX_ENABLE_SYMVERS], [ 215297403Sobrien 2153132720SkanGLIBCXX_ENABLE(symvers,$1,[=STYLE], 2154132720Skan [enables symbol versioning of the shared library], 2155169691Skan [permit yes|no|gnu|gnu-versioned-namespace|darwin|darwin-export]) 2156132720Skan 2157132720Skan# If we never went through the GLIBCXX_CHECK_LINKER_FEATURES macro, then we 2158132720Skan# don't know enough about $LD to do tricks... 2159132720SkanAC_REQUIRE([GLIBCXX_CHECK_LINKER_FEATURES]) 2160169691Skan 2161169691Skan# Turn a 'yes' into a suitable default. 2162169691Skanif test x$enable_symvers = xyes ; then 2163169691Skan if test $enable_shared = no || test "x$LD" = x || test x$gcc_no_link = xyes; then 2164169691Skan enable_symvers=no 2165169691Skan else 2166169691Skan if test $with_gnu_ld = yes ; then 2167169691Skan enable_symvers=gnu 2168169691Skan else 2169169691Skan case ${target_os} in 2170169691Skan darwin*) 2171169691Skan enable_symvers=darwin ;; 2172169691Skan *) 2173169691Skan enable_symvers=no ;; 2174169691Skan esac 2175169691Skan fi 2176169691Skan fi 217797403Sobrienfi 217897403Sobrien 2179169691Skan# Check to see if 'darwin' or 'darwin-export' can win. 2180169691Skanif test x$enable_symvers = xdarwin-export ; then 2181169691Skan enable_symvers=darwin 2182169691Skanfi 2183169691Skan 2184169691Skan# Check to see if 'gnu' can win. 2185169691Skanif test $enable_symvers = gnu || test $enable_symvers = gnu-versioned-namespace; then 2186169691Skan # Check to see if libgcc_s exists, indicating that shared libgcc is possible. 2187117397Skan AC_MSG_CHECKING([for shared libgcc]) 2188117397Skan ac_save_CFLAGS="$CFLAGS" 2189117397Skan CFLAGS=' -lgcc_s' 2190132720Skan AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes, glibcxx_shared_libgcc=no) 2191117397Skan CFLAGS="$ac_save_CFLAGS" 2192132720Skan if test $glibcxx_shared_libgcc = no; then 2193132720Skan cat > conftest.c <<EOF 2194132720Skanint main (void) { return 0; } 2195132720SkanEOF 2196132720Skanchangequote(,)dnl 2197132720Skan glibcxx_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \ 2198132720Skan -shared -shared-libgcc -o conftest.so \ 2199132720Skan conftest.c -v 2>&1 >/dev/null \ 2200132720Skan | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'` 2201132720Skanchangequote([,])dnl 2202132720Skan rm -f conftest.c conftest.so 2203132720Skan if test x${glibcxx_libgcc_s_suffix+set} = xset; then 2204132720Skan CFLAGS=" -lgcc_s$glibcxx_libgcc_s_suffix" 2205132720Skan AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes) 2206132720Skan CFLAGS="$ac_save_CFLAGS" 2207132720Skan fi 2208132720Skan fi 2209132720Skan AC_MSG_RESULT($glibcxx_shared_libgcc) 221097403Sobrien 2211169691Skan # For GNU ld, we need at least this version. The format is described in 2212169691Skan # GLIBCXX_CHECK_LINKER_FEATURES above. 2213169691Skan glibcxx_min_gnu_ld_version=21400 221497403Sobrien 2215169691Skan # If no shared libgcc, can't win. 2216169691Skan if test $glibcxx_shared_libgcc != yes; then 2217169691Skan AC_MSG_WARN([=== You have requested GNU symbol versioning, but]) 2218169691Skan AC_MSG_WARN([=== you are not building a shared libgcc_s.]) 2219169691Skan AC_MSG_WARN([=== Symbol versioning will be disabled.]) 2220169691Skan enable_symvers=no 2221169691Skan elif test $with_gnu_ld != yes ; then 222297403Sobrien # just fail for now 2223169691Skan AC_MSG_WARN([=== You have requested GNU symbol versioning, but]) 2224169691Skan AC_MSG_WARN([=== you are not using the GNU linker.]) 2225132720Skan AC_MSG_WARN([=== Symbol versioning will be disabled.]) 222697403Sobrien enable_symvers=no 2227169691Skan elif test $glibcxx_gnu_ld_version -lt $glibcxx_min_gnu_ld_version ; then 2228169691Skan # The right tools, the right setup, but too old. Fallbacks? 2229169691Skan AC_MSG_WARN(=== Linker version $glibcxx_gnu_ld_version is too old for) 2230169691Skan AC_MSG_WARN(=== full symbol versioning support in this release of GCC.) 2231169691Skan AC_MSG_WARN(=== You would need to upgrade your binutils to version) 2232169691Skan AC_MSG_WARN(=== $glibcxx_min_gnu_ld_version or later and rebuild GCC.) 2233169691Skan AC_MSG_WARN([=== Symbol versioning will be disabled.]) 2234169691Skan enable_symvers=no 223597403Sobrien fi 223697403Sobrienfi 223797403Sobrien 2238132720Skan# Everything parsed; figure out what file to use. 223997403Sobriencase $enable_symvers in 224097403Sobrien no) 2241169691Skan SYMVER_FILE=config/abi/pre/none.ver 2242132720Skan ;; 224397403Sobrien gnu) 2244169691Skan SYMVER_FILE=config/abi/pre/gnu.ver 2245169691Skan AC_DEFINE(_GLIBCXX_SYMVER_GNU, 1, 2246169691Skan [Define to use GNU versioning in the shared library.]) 2247132720Skan ;; 2248169691Skan gnu-versioned-namespace) 2249169691Skan SYMVER_FILE=config/abi/pre/gnu-versioned-namespace.ver 2250169691Skan AC_DEFINE(_GLIBCXX_SYMVER_GNU_NAMESPACE, 1, 2251169691Skan [Define to use GNU namespace versioning in the shared library.]) 2252169691Skan ;; 2253169691Skan darwin) 2254169691Skan SYMVER_FILE=config/abi/pre/gnu.ver 2255169691Skan AC_DEFINE(_GLIBCXX_SYMVER_DARWIN, 1, 2256169691Skan [Define to use darwin versioning in the shared library.]) 2257169691Skan ;; 225897403Sobrienesac 225997403Sobrien 2260169691Skanif test x$enable_symvers != xno ; then 2261169691Skan AC_DEFINE(_GLIBCXX_SYMVER, 1, 2262169691Skan [Define to use symbol versioning in the shared library.]) 2263169691Skanfi 2264169691Skan 2265169691SkanAC_SUBST(SYMVER_FILE) 2266132720SkanAC_SUBST(port_specific_symbol_files) 2267169691SkanGLIBCXX_CONDITIONAL(ENABLE_SYMVERS, test $enable_symvers != no) 2268169691SkanGLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU, test $enable_symvers = gnu) 2269169691SkanGLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU_NAMESPACE, test $enable_symvers = gnu-versioned-namespace) 2270169691SkanGLIBCXX_CONDITIONAL(ENABLE_SYMVERS_DARWIN, test $enable_symvers = darwin) 2271132720SkanAC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers) 2272169691Skan 2273169691Skan# Now, set up compatibility support, if any. 2274169691Skan# In addition, need this to deal with std::size_t mangling in 2275169691Skan# src/compatibility.cc. In a perfect world, could use 2276169691Skan# typeid(std::size_t).name()[0] to do direct substitution. 2277169691SkanAC_MSG_CHECKING([for size_t as unsigned int]) 2278169691Skanac_save_CFLAGS="$CFLAGS" 2279169691SkanCFLAGS="-Werror" 2280169691SkanAC_TRY_COMPILE(, [__SIZE_TYPE__* stp; unsigned int* uip; stp = uip;], 2281169691Skan [glibcxx_size_t_is_i=yes], [glibcxx_size_t_is_i=no]) 2282169691SkanCFLAGS=$ac_save_CFLAGS 2283169691Skanif test "$glibcxx_size_t_is_i" = yes; then 2284169691Skan AC_DEFINE(_GLIBCXX_SIZE_T_IS_UINT, 1, [Define if size_t is unsigned int.]) 2285169691Skanfi 2286169691SkanAC_MSG_RESULT([$glibcxx_size_t_is_i]) 2287169691Skan 2288169691SkanAC_MSG_CHECKING([for ptrdiff_t as int]) 2289169691Skanac_save_CFLAGS="$CFLAGS" 2290169691SkanCFLAGS="-Werror" 2291169691SkanAC_TRY_COMPILE(, [__PTRDIFF_TYPE__* ptp; int* ip; ptp = ip;], 2292169691Skan [glibcxx_ptrdiff_t_is_i=yes], [glibcxx_ptrdiff_t_is_i=no]) 2293169691SkanCFLAGS=$ac_save_CFLAGS 2294169691Skanif test "$glibcxx_ptrdiff_t_is_i" = yes; then 2295169691Skan AC_DEFINE(_GLIBCXX_PTRDIFF_T_IS_INT, 1, [Define if ptrdiff_t is int.]) 2296169691Skanfi 2297169691SkanAC_MSG_RESULT([$glibcxx_ptrdiff_t_is_i]) 229897403Sobrien]) 229997403Sobrien 2300132720Skan 2301132720Skandnl 2302132720Skandnl Setup to use the gcc gthr.h thread-specific memory and mutex model. 2303132720Skandnl We must stage the required headers so that they will be installed 2304132720Skandnl with the library (unlike libgcc, the STL implementation is provided 2305132720Skandnl solely within headers). Since we must not inject random user-space 2306132720Skandnl macro names into user-provided C++ code, we first stage into <file>-in 2307132720Skandnl and process to <file> with an output command. The reason for a two- 2308132720Skandnl stage process here is to correctly handle $srcdir!=$objdir without 2309132720Skandnl having to write complex code (the sed commands to clean the macro 2310132720Skandnl namespace are complex and fragile enough as it is). We must also 2311132720Skandnl add a relative path so that -I- is supported properly. 2312132720Skandnl 2313132720Skandnl Substs: 2314132720Skandnl glibcxx_thread_h 2315132720Skandnl 2316132720Skandnl Defines: 2317132720Skandnl HAVE_GTHR_DEFAULT 2318132720Skandnl 2319132720SkanAC_DEFUN([GLIBCXX_ENABLE_THREADS], [ 2320132720Skan AC_MSG_CHECKING([for thread model used by GCC]) 2321132720Skan target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'` 2322132720Skan AC_MSG_RESULT([$target_thread_file]) 2323132720Skan 2324132720Skan if test $target_thread_file != single; then 2325169691Skan AC_DEFINE(HAVE_GTHR_DEFAULT, 1, 2326169691Skan [Define if gthr-default.h exists 2327169691Skan (meaning that threading support is enabled).]) 2328132720Skan fi 2329132720Skan 2330132720Skan glibcxx_thread_h=gthr-$target_thread_file.h 2331169691Skan 2332169691Skan dnl Check for __GTHREADS define. 2333169691Skan gthread_file=${toplevel_srcdir}/gcc/${glibcxx_thread_h} 2334169691Skan if grep __GTHREADS $gthread_file >/dev/null 2>&1 ; then 2335169691Skan enable_thread=yes 2336169691Skan else 2337169691Skan enable_thread=no 2338169691Skan fi 2339169691Skan 2340132720Skan AC_SUBST(glibcxx_thread_h) 2341132720Skan]) 2342132720Skan 2343132720Skan 2344132720Skan# Check whether LC_MESSAGES is available in <locale.h>. 2345132720Skan# Ulrich Drepper <drepper@cygnus.com>, 1995. 2346132720Skan# 2347132720Skan# This file file be copied and used freely without restrictions. It can 2348132720Skan# be used in projects which are not available under the GNU Public License 2349132720Skan# but which still want to provide support for the GNU gettext functionality. 2350132720Skan# Please note that the actual code is *not* freely available. 2351132720Skan 2352132720Skan# serial 1 2353132720SkanAC_DEFUN([AC_LC_MESSAGES], [ 2354132720Skan AC_CHECK_HEADER(locale.h, [ 2355132720Skan AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES, 2356132720Skan [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], 2357132720Skan ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)]) 2358132720Skan if test $ac_cv_val_LC_MESSAGES = yes; then 2359169691Skan AC_DEFINE(HAVE_LC_MESSAGES, 1, 2360169691Skan [Define if LC_MESSAGES is available in <locale.h>.]) 2361132720Skan fi 2362132720Skan ]) 2363132720Skan]) 2364132720Skan 2365169691Skan# Macros from the top-level gcc directory. 2366169691Skanm4_include([../config/tls.m4]) 2367132720Skan 2368