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 25497403Sobrien ac_test_CFLAGS="${CFLAGS+set}" 25597403Sobrien ac_save_CFLAGS="$CFLAGS" 256171827Skan CFLAGS='-Wl,--gc-sections' 25797403Sobrien 25897403Sobrien # Check for -Wl,--gc-sections 25997403Sobrien AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections]) 260169691Skan AC_TRY_LINK([ int one(void) { return 1; } 261169691Skan int two(void) { return 2; } 262169691Skan ], [ two(); ] , [ac_gcsections=yes], [ac_gcsections=no]) 263169691Skan if test "$ac_gcsections" = "yes"; then 264169691Skan rm -f conftest.c 265169691Skan touch conftest.c 266169691Skan if $CC -c conftest.c; then 267169691Skan if $LD --gc-sections -o conftest conftest.o 2>&1 | \ 268169691Skan grep "Warning: gc-sections option ignored" > /dev/null; then 269169691Skan ac_gcsections=no 270169691Skan fi 271169691Skan fi 272169691Skan rm -f conftest.c conftest.o conftest 273169691Skan fi 274169691Skan if test "$ac_gcsections" = "yes"; then 275169691Skan SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" 276169691Skan fi 277169691Skan AC_MSG_RESULT($ac_gcsections) 278169691Skan 27997403Sobrien if test "$ac_test_CFLAGS" = set; then 28097403Sobrien CFLAGS="$ac_save_CFLAGS" 28197403Sobrien else 28297403Sobrien # this is the suspicious part 28397403Sobrien CFLAGS='' 28497403Sobrien fi 285169691Skan fi 286169691Skan 287169691Skan # Set -z,relro. 288169691Skan # Note this is only for shared objects. 289169691Skan ac_ld_relro=no 290169691Skan if test x"$with_gnu_ld" = x"yes"; then 291169691Skan AC_MSG_CHECKING([for ld that supports -Wl,-z,relro]) 292169691Skan cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"` 293169691Skan if test -n "$cxx_z_relo"; then 294169691Skan OPT_LDFLAGS="-Wl,-z,relro" 295169691Skan ac_ld_relro=yes 29697403Sobrien fi 297169691Skan AC_MSG_RESULT($ac_ld_relro) 29897403Sobrien fi 29997403Sobrien 30097403Sobrien # Set linker optimization flags. 301117397Skan if test x"$with_gnu_ld" = x"yes"; then 30297403Sobrien OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS" 30397403Sobrien fi 30497403Sobrien 30597403Sobrien AC_SUBST(SECTION_LDFLAGS) 30697403Sobrien AC_SUBST(OPT_LDFLAGS) 30797403Sobrien]) 30897403Sobrien 30997403Sobrien 31097403Sobriendnl 311169691Skandnl Check to see if this target can enable the iconv specializations. 312169691Skandnl If --disable-c-mbchar was given, no wchar_t specialization is enabled. 313169691Skandnl (This must have been previously checked, along with the rest of C99 314169691Skandnl support.) By default, iconv support is disabled. 31597403Sobriendnl 316132720Skandnl Defines: 317169691Skandnl _GLIBCXX_USE_ICONV if all the bits are found. 318169691Skandnl Substs: 319169691Skandnl LIBICONV to a -l string containing the iconv library, if needed. 320132720Skandnl 321169691SkanAC_DEFUN([GLIBCXX_CHECK_ICONV_SUPPORT], [ 32297403Sobrien 323169691Skan enable_iconv=no 324132720Skan # Only continue checking if the ISO C99 headers exist and support is on. 325169691Skan if test x"$enable_wchar_t" = xyes; then 326132720Skan 327132720Skan # Use iconv for wchar_t to char conversions. As such, check for 328132720Skan # X/Open Portability Guide, version 2 features (XPG2). 329132720Skan AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no) 330132720Skan AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no) 331132720Skan 332132720Skan # Check for existence of libiconv.a providing XPG2 wchar_t support. 333169691Skan AC_CHECK_LIB(iconv, iconv, LIBICONV="-liconv") 334132720Skan ac_save_LIBS="$LIBS" 335169691Skan LIBS="$LIBS $LIBICONV" 336169691Skan AC_SUBST(LIBICONV) 337132720Skan 338132720Skan AC_CHECK_FUNCS([iconv_open iconv_close iconv nl_langinfo], 339132720Skan [ac_XPG2funcs=yes], [ac_XPG2funcs=no]) 340132720Skan 341132720Skan LIBS="$ac_save_LIBS" 342132720Skan 343132720Skan if test x"$ac_has_iconv_h" = xyes && 344132720Skan test x"$ac_has_langinfo_h" = xyes && 345132720Skan test x"$ac_XPG2funcs" = xyes; 346132720Skan then 347169691Skan AC_DEFINE([_GLIBCXX_USE_ICONV],1, 348169691Skan [Define if iconv and related functions exist and are usable.]) 349169691Skan enable_iconv=yes 350132720Skan fi 35197403Sobrien fi 352169691Skan AC_MSG_CHECKING([for enabled iconv specializations]) 353169691Skan AC_MSG_RESULT($enable_iconv) 35497403Sobrien]) 35597403Sobrien 35697403Sobrien 35797403Sobriendnl 358132720Skandnl Check for headers for, and arguments to, the setrlimit() function. 359132720Skandnl Used only in testsuite_hooks.h. Called from GLIBCXX_CONFIGURE_TESTSUITE. 360132720Skandnl 361132720Skandnl Defines: 362132720Skandnl _GLIBCXX_RES_LIMITS if we can set artificial resource limits 363132720Skandnl various HAVE_LIMIT_* for individual limit names 364132720Skandnl 365132720SkanAC_DEFUN([GLIBCXX_CHECK_SETRLIMIT_ancilliary], [ 366169691Skan AC_MSG_CHECKING([for RLIMIT_$1]) 367132720Skan AC_TRY_COMPILE( 368132720Skan [#include <unistd.h> 369132720Skan #include <sys/time.h> 370132720Skan #include <sys/resource.h> 371132720Skan ], 372132720Skan [ int f = RLIMIT_$1 ; ], 373132720Skan [glibcxx_mresult=1], [glibcxx_mresult=0]) 374132720Skan AC_DEFINE_UNQUOTED(HAVE_LIMIT_$1, $glibcxx_mresult, 375132720Skan [Only used in build directory testsuite_hooks.h.]) 376169691Skan if test $glibcxx_mresult = 1 ; then res=yes ; else res=no ; fi 377169691Skan AC_MSG_RESULT($res) 37897403Sobrien]) 37997403Sobrien 380132720SkanAC_DEFUN([GLIBCXX_CHECK_SETRLIMIT], [ 381132720Skan setrlimit_have_headers=yes 382132720Skan AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h, 383132720Skan [], 384132720Skan [setrlimit_have_headers=no]) 385132720Skan # If don't have the headers, then we can't run the tests now, and we 386132720Skan # won't be seeing any of these during testsuite compilation. 387132720Skan if test $setrlimit_have_headers = yes; then 388132720Skan # Can't do these in a loop, else the resulting syntax is wrong. 389132720Skan GLIBCXX_CHECK_SETRLIMIT_ancilliary(DATA) 390132720Skan GLIBCXX_CHECK_SETRLIMIT_ancilliary(RSS) 391132720Skan GLIBCXX_CHECK_SETRLIMIT_ancilliary(VMEM) 392132720Skan GLIBCXX_CHECK_SETRLIMIT_ancilliary(AS) 393132720Skan GLIBCXX_CHECK_SETRLIMIT_ancilliary(FSIZE) 394132720Skan 395132720Skan # Check for rlimit, setrlimit. 396132720Skan AC_CACHE_VAL(ac_setrlimit, [ 397132720Skan AC_TRY_COMPILE( 398132720Skan [#include <unistd.h> 399132720Skan #include <sys/time.h> 400132720Skan #include <sys/resource.h> 401132720Skan ], 402132720Skan [struct rlimit r; 403132720Skan setrlimit(0, &r);], 404132720Skan [ac_setrlimit=yes], [ac_setrlimit=no]) 40597403Sobrien ]) 40697403Sobrien fi 40797403Sobrien 408132720Skan AC_MSG_CHECKING([for testsuite resource limits support]) 409132720Skan if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then 410132720Skan ac_res_limits=yes 411169691Skan AC_DEFINE(_GLIBCXX_RES_LIMITS, 1, 412169691Skan [Define if using setrlimit to set resource limits during 413169691Skan "make check"]) 41497403Sobrien else 415132720Skan ac_res_limits=no 41697403Sobrien fi 417132720Skan AC_MSG_RESULT($ac_res_limits) 41897403Sobrien]) 41997403Sobrien 42097403Sobrien 42197403Sobriendnl 422132720Skandnl Check whether S_ISREG (Posix) or S_IFREG is available in <sys/stat.h>. 423132720Skandnl Define HAVE_S_ISREG / HAVE_S_IFREG appropriately. 42497403Sobriendnl 425132720SkanAC_DEFUN([GLIBCXX_CHECK_S_ISREG_OR_S_IFREG], [ 426169691Skan AC_MSG_CHECKING([for S_ISREG or S_IFREG]) 427132720Skan AC_CACHE_VAL(glibcxx_cv_S_ISREG, [ 428132720Skan AC_TRY_LINK( 429132720Skan [#include <sys/stat.h>], 430132720Skan [struct stat buffer; 431132720Skan fstat(0, &buffer); 432132720Skan S_ISREG(buffer.st_mode);], 433132720Skan [glibcxx_cv_S_ISREG=yes], 434132720Skan [glibcxx_cv_S_ISREG=no]) 435132720Skan ]) 436132720Skan AC_CACHE_VAL(glibcxx_cv_S_IFREG, [ 437132720Skan AC_TRY_LINK( 438132720Skan [#include <sys/stat.h>], 439132720Skan [struct stat buffer; 440132720Skan fstat(0, &buffer); 441132720Skan S_IFREG & buffer.st_mode;], 442132720Skan [glibcxx_cv_S_IFREG=yes], 443132720Skan [glibcxx_cv_S_IFREG=no]) 444132720Skan ]) 445169691Skan res=no 446132720Skan if test $glibcxx_cv_S_ISREG = yes; then 447169691Skan AC_DEFINE(HAVE_S_ISREG, 1, 448169691Skan [Define if S_IFREG is available in <sys/stat.h>.]) 449169691Skan res=S_ISREG 450132720Skan elif test $glibcxx_cv_S_IFREG = yes; then 451169691Skan AC_DEFINE(HAVE_S_IFREG, 1, 452169691Skan [Define if S_IFREG is available in <sys/stat.h>.]) 453169691Skan res=S_IFREG 45497403Sobrien fi 455169691Skan AC_MSG_RESULT($res) 45697403Sobrien]) 45797403Sobrien 458132720Skan 45997403Sobriendnl 460132720Skandnl Check whether poll is available in <poll.h>, and define HAVE_POLL. 46197403Sobriendnl 462132720SkanAC_DEFUN([GLIBCXX_CHECK_POLL], [ 463169691Skan AC_MSG_CHECKING([for poll]) 464132720Skan AC_CACHE_VAL(glibcxx_cv_POLL, [ 465132720Skan AC_TRY_LINK( 466132720Skan [#include <poll.h>], 467132720Skan [struct pollfd pfd[1]; 468132720Skan pfd[0].events = POLLIN; 469132720Skan poll(pfd, 1, 0);], 470132720Skan [glibcxx_cv_POLL=yes], 471132720Skan [glibcxx_cv_POLL=no]) 472132720Skan ]) 473132720Skan if test $glibcxx_cv_POLL = yes; then 474169691Skan AC_DEFINE(HAVE_POLL, 1, [Define if poll is available in <poll.h>.]) 47597403Sobrien fi 476169691Skan AC_MSG_RESULT($glibcxx_cv_POLL) 47797403Sobrien]) 47897403Sobrien 47997403Sobrien 48097403Sobriendnl 481132720Skandnl Check whether writev is available in <sys/uio.h>, and define HAVE_WRITEV. 48297403Sobriendnl 483132720SkanAC_DEFUN([GLIBCXX_CHECK_WRITEV], [ 484169691Skan AC_MSG_CHECKING([for writev]) 485132720Skan AC_CACHE_VAL(glibcxx_cv_WRITEV, [ 486132720Skan AC_TRY_LINK( 487132720Skan [#include <sys/uio.h>], 488132720Skan [struct iovec iov[2]; 489132720Skan writev(0, iov, 0);], 490132720Skan [glibcxx_cv_WRITEV=yes], 491132720Skan [glibcxx_cv_WRITEV=no]) 492132720Skan ]) 493132720Skan if test $glibcxx_cv_WRITEV = yes; then 494169691Skan AC_DEFINE(HAVE_WRITEV, 1, [Define if writev is available in <sys/uio.h>.]) 49597403Sobrien fi 496169691Skan AC_MSG_RESULT($glibcxx_cv_WRITEV) 49797403Sobrien]) 49897403Sobrien 49997403Sobrien 50097403Sobriendnl 501132720Skandnl Check whether int64_t is available in <stdint.h>, and define HAVE_INT64_T. 50297403Sobriendnl 503132720SkanAC_DEFUN([GLIBCXX_CHECK_INT64_T], [ 504169691Skan AC_MSG_CHECKING([for int64_t]) 505132720Skan AC_CACHE_VAL(glibcxx_cv_INT64_T, [ 506132720Skan AC_TRY_COMPILE( 507132720Skan [#include <stdint.h>], 508132720Skan [int64_t var;], 509132720Skan [glibcxx_cv_INT64_T=yes], 510132720Skan [glibcxx_cv_INT64_T=no]) 511132720Skan ]) 512132720Skan if test $glibcxx_cv_INT64_T = yes; then 513169691Skan AC_DEFINE(HAVE_INT64_T, 1, [Define if int64_t is available in <stdint.h>.]) 51497403Sobrien fi 515169691Skan AC_MSG_RESULT($glibcxx_cv_INT64_T) 51697403Sobrien]) 51797403Sobrien 518132720Skan 519110614Skandnl 520132720Skandnl Check whether LFS support is available. 521110614Skandnl 522132720SkanAC_DEFUN([GLIBCXX_CHECK_LFS], [ 523132720Skan AC_LANG_SAVE 524132720Skan AC_LANG_CPLUSPLUS 525132720Skan ac_save_CXXFLAGS="$CXXFLAGS" 526132720Skan CXXFLAGS="$CXXFLAGS -fno-exceptions" 527169691Skan AC_MSG_CHECKING([for LFS support]) 528132720Skan AC_CACHE_VAL(glibcxx_cv_LFS, [ 529132720Skan AC_TRY_LINK( 530132720Skan [#include <unistd.h> 531132720Skan #include <stdio.h> 532169691Skan #include <sys/stat.h> 533132720Skan ], 534132720Skan [FILE* fp; 535132720Skan fopen64("t", "w"); 536132720Skan fseeko64(fp, 0, SEEK_CUR); 537132720Skan ftello64(fp); 538169691Skan lseek64(1, 0, SEEK_CUR); 539169691Skan struct stat64 buf; 540169691Skan fstat64(1, &buf);], 541132720Skan [glibcxx_cv_LFS=yes], 542132720Skan [glibcxx_cv_LFS=no]) 543132720Skan ]) 544132720Skan if test $glibcxx_cv_LFS = yes; then 545169691Skan AC_DEFINE(_GLIBCXX_USE_LFS, 1, [Define if LFS support is available.]) 546110614Skan fi 547169691Skan AC_MSG_RESULT($glibcxx_cv_LFS) 548132720Skan CXXFLAGS="$ac_save_CXXFLAGS" 549132720Skan AC_LANG_RESTORE 550110614Skan]) 55197403Sobrien 552132720Skan 55397403Sobriendnl 554146897Skandnl Check for whether a fully dynamic basic_string implementation should 555146897Skandnl be turned on, that does not put empty objects in per-process static 556146897Skandnl memory (mostly useful together with shared memory allocators, see PR 557146897Skandnl libstdc++/16612 for details). 558146897Skandnl 559146897Skandnl --enable-fully-dynamic-string defines _GLIBCXX_FULLY_DYNAMIC_STRING 560146897Skandnl --disable-fully-dynamic-string leaves _GLIBCXX_FULLY_DYNAMIC_STRING undefined 561146897Skandnl + Usage: GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING[(DEFAULT)] 562146897Skandnl Where DEFAULT is either `yes' or `no'. 563146897Skandnl 564146897SkanAC_DEFUN([GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING], [ 565146897Skan GLIBCXX_ENABLE(fully-dynamic-string,$1,,[do not put empty strings in per-process static memory]) 566146897Skan if test $enable_fully_dynamic_string = yes; then 567169691Skan AC_DEFINE(_GLIBCXX_FULLY_DYNAMIC_STRING, 1, 568169691Skan [Define if a fully dynamic basic_string is wanted.]) 569146897Skan fi 570146897Skan]) 571146897Skan 572146897Skan 573146897Skandnl 574132720Skandnl Does any necessary configuration of the testsuite directory. Generates 575132720Skandnl the testsuite_hooks.h header. 57697403Sobriendnl 577132720Skandnl GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE must be done before this. 57897403Sobriendnl 579132720Skandnl Sets: 580169691Skandnl enable_abi_check 581169691Skandnl GLIBCXX_TEST_WCHAR_T 582169691Skandnl GLIBCXX_TEST_THREAD 583132720Skandnl Substs: 584132720Skandnl baseline_dir 58597403Sobriendnl 586132720SkanAC_DEFUN([GLIBCXX_CONFIGURE_TESTSUITE], [ 587169691Skan if $GLIBCXX_IS_NATIVE ; then 588132720Skan # Do checks for resource limit functions. 589132720Skan GLIBCXX_CHECK_SETRLIMIT 590132720Skan 591132720Skan # Look for setenv, so that extended locale tests can be performed. 592132720Skan GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv) 593169691Skan fi 594132720Skan 595169691Skan if $GLIBCXX_IS_NATIVE && test $is_hosted = yes && 596169691Skan test $enable_symvers != no; then 597169691Skan case "$host" in 598169691Skan *-*-cygwin*) 599169691Skan enable_abi_check=no ;; 600169691Skan *) 601169691Skan enable_abi_check=yes ;; 602169691Skan esac 603132720Skan else 604132720Skan # Only build this as native, since automake does not understand 605132720Skan # CXX_FOR_BUILD. 606132720Skan enable_abi_check=no 60797403Sobrien fi 608169691Skan 609132720Skan # Export file names for ABI checking. 610169691Skan baseline_dir="$glibcxx_srcdir/config/abi/post/${abi_baseline_pair}\$(MULTISUBDIR)" 611132720Skan AC_SUBST(baseline_dir) 61297403Sobrien]) 61397403Sobrien 61497403Sobrien 61597403Sobriendnl 616132720Skandnl Set up *_INCLUDES variables for all sundry Makefile.am's. 61797403Sobriendnl 618132720Skandnl Substs: 619132720Skandnl GLIBCXX_INCLUDES 620132720Skandnl TOPLEVEL_INCLUDES 62197403Sobriendnl 622132720SkanAC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [ 623132720Skan # Used for every C++ compile we perform. 624132720Skan GLIBCXX_INCLUDES="\ 625132720Skan-I$glibcxx_builddir/include/$host_alias \ 626132720Skan-I$glibcxx_builddir/include \ 627132720Skan-I$glibcxx_srcdir/libsupc++" 62897403Sobrien 629132720Skan # For Canadian crosses, pick this up too. 630132720Skan if test $CANADIAN = yes; then 631132720Skan GLIBCXX_INCLUDES="$GLIBCXX_INCLUDES -I\${includedir}" 632132720Skan fi 63397403Sobrien 634132720Skan # Stuff in the actual top level. Currently only used by libsupc++ to 635132720Skan # get unwind* headers from the gcc dir. 636132720Skan #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include' 637132720Skan TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc' 63897403Sobrien 639132720Skan # Now, export this to all the little Makefiles.... 640132720Skan AC_SUBST(GLIBCXX_INCLUDES) 641132720Skan AC_SUBST(TOPLEVEL_INCLUDES) 64297403Sobrien]) 64397403Sobrien 644132720Skan 64597403Sobriendnl 646132720Skandnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's. 647132720Skandnl (SECTION_FLAGS is done under CHECK_COMPILER_FEATURES.) 64897403Sobriendnl 649132720Skandnl Substs: 650132720Skandnl OPTIMIZE_CXXFLAGS 651132720Skandnl WARN_FLAGS 65297403Sobriendnl 653132720SkanAC_DEFUN([GLIBCXX_EXPORT_FLAGS], [ 654132720Skan # Optimization flags that are probably a good idea for thrill-seekers. Just 655132720Skan # uncomment the lines below and make, everything else is ready to go... 656132720Skan # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc 657132720Skan OPTIMIZE_CXXFLAGS= 658132720Skan AC_SUBST(OPTIMIZE_CXXFLAGS) 65997403Sobrien 660169691Skan WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual' 661132720Skan AC_SUBST(WARN_FLAGS) 66297403Sobrien]) 66397403Sobrien 664132720Skan 665110614Skandnl 666132720Skandnl All installation directory information is determined here. 667110614Skandnl 668132720Skandnl Substs: 669132720Skandnl gxx_install_dir 670132720Skandnl glibcxx_prefixdir 671132720Skandnl glibcxx_toolexecdir 672132720Skandnl glibcxx_toolexeclibdir 673110614Skandnl 674132720Skandnl Assumes cross_compiling bits already done, and with_cross_host in 675132720Skandnl particular. 67697403Sobriendnl 677169691Skandnl This logic must match gcc/configure.ac's setting of gcc_gxx_include_dir. 678169691Skandnl config/gxx-include-dir.m4 must be kept consistant with this as well. 679132720SkanAC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [ 680132720Skan glibcxx_toolexecdir=no 681132720Skan glibcxx_toolexeclibdir=no 682132720Skan glibcxx_prefixdir=$prefix 68397403Sobrien 684132720Skan AC_MSG_CHECKING([for gxx-include-dir]) 685132720Skan AC_ARG_WITH([gxx-include-dir], 686132720Skan AC_HELP_STRING([--with-gxx-include-dir=DIR], 687132720Skan [installation directory for include files]), 688132720Skan [case "$withval" in 689132720Skan yes) AC_MSG_ERROR([Missing directory for --with-gxx-include-dir]) ;; 690132720Skan no) gxx_include_dir=no ;; 691132720Skan *) gxx_include_dir=$withval ;; 692132720Skan esac], 693132720Skan [gxx_include_dir=no]) 694132720Skan AC_MSG_RESULT($gxx_include_dir) 69597403Sobrien 696132720Skan AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) 697132720Skan AC_ARG_ENABLE([version-specific-runtime-libs], 698132720Skan AC_HELP_STRING([--enable-version-specific-runtime-libs], 699132720Skan [Specify that runtime libraries should be installed in a compiler-specific directory]), 700132720Skan [case "$enableval" in 701132720Skan yes) version_specific_libs=yes ;; 702132720Skan no) version_specific_libs=no ;; 703132720Skan *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; 704132720Skan esac], 705132720Skan [version_specific_libs=no]) 706132720Skan AC_MSG_RESULT($version_specific_libs) 70797403Sobrien 708132720Skan # Default case for install directory for include files. 709132720Skan if test $version_specific_libs = no && test $gxx_include_dir = no; then 710169691Skan gxx_include_dir='include/c++/${gcc_version}' 711169691Skan if test -n "$with_cross_host" && 712169691Skan test x"$with_cross_host" != x"no"; then 713169691Skan gxx_include_dir='${prefix}/${target_alias}/'"$gxx_include_dir" 714169691Skan else 715169691Skan gxx_include_dir='${prefix}/'"$gxx_include_dir" 716169691Skan fi 717132720Skan fi 71897403Sobrien 719132720Skan # Version-specific runtime libs processing. 720132720Skan if test $version_specific_libs = yes; then 721132720Skan # Need the gcc compiler version to know where to install libraries 722132720Skan # and header files if --enable-version-specific-runtime-libs option 723132720Skan # is selected. FIXME: these variables are misnamed, there are 724132720Skan # no executables installed in _toolexecdir or _toolexeclibdir. 725132720Skan if test x"$gxx_include_dir" = x"no"; then 726169691Skan gxx_include_dir='${libdir}/gcc/${host_alias}/${gcc_version}/include/c++' 727132720Skan fi 728132720Skan glibcxx_toolexecdir='${libdir}/gcc/${host_alias}' 729169691Skan glibcxx_toolexeclibdir='${toolexecdir}/${gcc_version}$(MULTISUBDIR)' 730132720Skan fi 73197403Sobrien 732132720Skan # Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir 733132720Skan # Install a library built with a cross compiler in tooldir, not libdir. 734132720Skan if test x"$glibcxx_toolexecdir" = x"no"; then 735132720Skan if test -n "$with_cross_host" && 736132720Skan test x"$with_cross_host" != x"no"; then 737132720Skan glibcxx_toolexecdir='${exec_prefix}/${host_alias}' 738132720Skan glibcxx_toolexeclibdir='${toolexecdir}/lib' 739132720Skan else 740132720Skan glibcxx_toolexecdir='${libdir}/gcc/${host_alias}' 741132720Skan glibcxx_toolexeclibdir='${libdir}' 742132720Skan fi 743132720Skan multi_os_directory=`$CXX -print-multi-os-directory` 744132720Skan case $multi_os_directory in 745132720Skan .) ;; # Avoid trailing /. 746132720Skan *) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;; 747132720Skan esac 748132720Skan fi 74997403Sobrien 750132720Skan AC_MSG_CHECKING([for install location]) 751132720Skan AC_MSG_RESULT($gxx_include_dir) 75297403Sobrien 753132720Skan AC_SUBST(glibcxx_prefixdir) 754132720Skan AC_SUBST(gxx_include_dir) 755132720Skan AC_SUBST(glibcxx_toolexecdir) 756132720Skan AC_SUBST(glibcxx_toolexeclibdir) 75797403Sobrien]) 75897403Sobrien 75997403Sobrien 76097403Sobriendnl 761132720Skandnl GLIBCXX_ENABLE 762132720Skandnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING) 763132720Skandnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c) 764132720Skandnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER) 76597403Sobriendnl 766132720Skandnl See docs/html/17_intro/configury.html#enable for documentation. 76797403Sobriendnl 768132720Skanm4_define([GLIBCXX_ENABLE],[dnl 769132720Skanm4_define([_g_switch],[--enable-$1])dnl 770132720Skanm4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl 771132720Skan AC_ARG_ENABLE($1,_g_help, 772132720Skan m4_bmatch([$5], 773132720Skan [^permit ], 774132720Skan [[ 775132720Skan case "$enableval" in 776132720Skan m4_bpatsubst([$5],[permit ])) ;; 777132720Skan *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;; 778132720Skan dnl Idea for future: generate a URL pointing to 779132720Skan dnl "onlinedocs/configopts.html#whatever" 780132720Skan esac 781132720Skan ]], 782132720Skan [^$], 783132720Skan [[ 784132720Skan case "$enableval" in 785132720Skan yes|no) ;; 786132720Skan *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;; 787132720Skan esac 788132720Skan ]], 789132720Skan [[$5]]), 790132720Skan [enable_]m4_bpatsubst([$1],-,_)[=][$2]) 791132720Skanm4_undefine([_g_switch])dnl 792132720Skanm4_undefine([_g_help])dnl 79397403Sobrien]) 79497403Sobrien 79597403Sobrien 79697403Sobriendnl 797132720Skandnl Check for ISO/IEC 9899:1999 "C99" support. 79897403Sobriendnl 799132720Skandnl --enable-c99 defines _GLIBCXX_USE_C99 800132720Skandnl --disable-c99 leaves _GLIBCXX_USE_C99 undefined 801132720Skandnl + Usage: GLIBCXX_ENABLE_C99[(DEFAULT)] 802132720Skandnl Where DEFAULT is either `yes' or `no'. 803132720Skandnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'. 80497403Sobriendnl 805132720SkanAC_DEFUN([GLIBCXX_ENABLE_C99], [ 806132720Skan GLIBCXX_ENABLE(c99,$1,,[turns on ISO/IEC 9899:1999 support]) 80797403Sobrien 808169691Skan if test x"$enable_c99" = x"yes"; then 809169691Skan 810132720Skan AC_LANG_SAVE 811132720Skan AC_LANG_CPLUSPLUS 812132720Skan 813132720Skan # Check for the existence of <math.h> functions used if C99 is enabled. 814132720Skan AC_MSG_CHECKING([for ISO C99 support in <math.h>]) 815169691Skan AC_CACHE_VAL(ac_c99_math, [ 816132720Skan AC_TRY_COMPILE([#include <math.h>], 817169691Skan [fpclassify(0.0); 818169691Skan isfinite(0.0); 819169691Skan isinf(0.0); 820169691Skan isnan(0.0); 821169691Skan isnormal(0.0); 822169691Skan signbit(0.0); 823169691Skan isgreater(0.0,0.0); 824169691Skan isgreaterequal(0.0,0.0); 825169691Skan isless(0.0,0.0); 826169691Skan islessequal(0.0,0.0); 827169691Skan islessgreater(0.0,0.0); 828169691Skan islessgreater(0.0,0.0); 829169691Skan isunordered(0.0,0.0); 830169691Skan ],[ac_c99_math=yes], [ac_c99_math=no]) 831169691Skan ]) 832132720Skan AC_MSG_RESULT($ac_c99_math) 833132720Skan if test x"$ac_c99_math" = x"yes"; then 834169691Skan AC_DEFINE(_GLIBCXX_USE_C99_MATH, 1, 835169691Skan [Define if C99 functions or macros in <math.h> should be imported 836169691Skan in <cmath> in namespace std.]) 83797403Sobrien fi 83897403Sobrien 839169691Skan # Check for the existence of <complex.h> complex math functions. 840169691Skan # This is necessary even though libstdc++ uses the builtin versions 841169691Skan # of these functions, because if the builtin cannot be used, a reference 842169691Skan # to the library function is emitted. 843169691Skan AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no) 844169691Skan ac_c99_complex=no; 845169691Skan if test x"$ac_has_complex_h" = x"yes"; then 846169691Skan AC_MSG_CHECKING([for ISO C99 support in <complex.h>]) 847169691Skan AC_TRY_COMPILE([#include <complex.h>], 848169691Skan [typedef __complex__ float float_type; float_type tmpf; 849169691Skan cabsf(tmpf); 850169691Skan cargf(tmpf); 851169691Skan ccosf(tmpf); 852169691Skan ccoshf(tmpf); 853169691Skan cexpf(tmpf); 854169691Skan clogf(tmpf); 855169691Skan csinf(tmpf); 856169691Skan csinhf(tmpf); 857169691Skan csqrtf(tmpf); 858169691Skan ctanf(tmpf); 859169691Skan ctanhf(tmpf); 860169691Skan cpowf(tmpf, tmpf); 861169691Skan typedef __complex__ double double_type; double_type tmpd; 862169691Skan cabs(tmpd); 863169691Skan carg(tmpd); 864169691Skan ccos(tmpd); 865169691Skan ccosh(tmpd); 866169691Skan cexp(tmpd); 867169691Skan clog(tmpd); 868169691Skan csin(tmpd); 869169691Skan csinh(tmpd); 870169691Skan csqrt(tmpd); 871169691Skan ctan(tmpd); 872169691Skan ctanh(tmpd); 873169691Skan cpow(tmpd, tmpd); 874169691Skan typedef __complex__ long double ld_type; ld_type tmpld; 875169691Skan cabsl(tmpld); 876169691Skan cargl(tmpld); 877169691Skan ccosl(tmpld); 878169691Skan ccoshl(tmpld); 879169691Skan cexpl(tmpld); 880169691Skan clogl(tmpld); 881169691Skan csinl(tmpld); 882169691Skan csinhl(tmpld); 883169691Skan csqrtl(tmpld); 884169691Skan ctanl(tmpld); 885169691Skan ctanhl(tmpld); 886169691Skan cpowl(tmpld, tmpld); 887169691Skan ],[ac_c99_complex=yes], [ac_c99_complex=no]) 888169691Skan fi 889169691Skan AC_MSG_RESULT($ac_c99_complex) 890169691Skan if test x"$ac_c99_complex" = x"yes"; then 891169691Skan AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX, 1, 892169691Skan [Define if C99 functions in <complex.h> should be used in 893169691Skan <complex>. Using compiler builtins for these functions requires 894169691Skan corresponding C99 library functions to be present.]) 895169691Skan fi 896169691Skan 897132720Skan # Check for the existence in <stdio.h> of vscanf, et. al. 898132720Skan AC_MSG_CHECKING([for ISO C99 support in <stdio.h>]) 899169691Skan AC_CACHE_VAL(ac_c99_stdio, [ 900132720Skan AC_TRY_COMPILE([#include <stdio.h> 901169691Skan #include <stdarg.h> 902132720Skan void foo(char* fmt, ...) 903169691Skan { 904169691Skan va_list args; va_start(args, fmt); 905169691Skan vfscanf(stderr, "%i", args); 906169691Skan vscanf("%i", args); 907169691Skan vsnprintf(fmt, 0, "%i", args); 908169691Skan vsscanf(fmt, "%i", args); 909169691Skan }], 910169691Skan [snprintf("12", 0, "%i");], 911169691Skan [ac_c99_stdio=yes], [ac_c99_stdio=no]) 912169691Skan ]) 913132720Skan AC_MSG_RESULT($ac_c99_stdio) 91497403Sobrien 915132720Skan # Check for the existence in <stdlib.h> of lldiv_t, et. al. 916169691Skan AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>]) 917169691Skan AC_CACHE_VAL(ac_c99_stdlib, [ 918132720Skan AC_TRY_COMPILE([#include <stdlib.h>], 919169691Skan [char* tmp; 920169691Skan strtof("gnu", &tmp); 921169691Skan strtold("gnu", &tmp); 922169691Skan strtoll("gnu", &tmp, 10); 923169691Skan strtoull("gnu", &tmp, 10); 924169691Skan llabs(10); 925169691Skan lldiv(10,1); 926169691Skan atoll("10"); 927169691Skan _Exit(0); 928169691Skan lldiv_t mydivt;],[ac_c99_stdlib=yes], [ac_c99_stdlib=no]) 929132720Skan ]) 930132720Skan AC_MSG_RESULT($ac_c99_stdlib) 93197403Sobrien 932169691Skan # Check for the existence in <wchar.h> of wcstold, etc. 933169691Skan ac_c99_wchar=no; 934169691Skan if test x"$ac_has_wchar_h" = xyes && 935169691Skan test x"$ac_has_wctype_h" = xyes; then 936169691Skan AC_MSG_CHECKING([for ISO C99 support in <wchar.h>]) 937169691Skan AC_TRY_COMPILE([#include <wchar.h> 938169691Skan namespace test 939169691Skan { 940169691Skan using ::wcstold; 941169691Skan using ::wcstoll; 942169691Skan using ::wcstoull; 943169691Skan } 944169691Skan ],[],[ac_c99_wchar=yes], [ac_c99_wchar=no]) 94597403Sobrien 946169691Skan # Checks for wide character functions that may not be present. 947169691Skan # Injection of these is wrapped with guard macros. 948169691Skan # NB: only put functions here, instead of immediately above, if 949169691Skan # absolutely necessary. 950169691Skan AC_TRY_COMPILE([#include <wchar.h> 951169691Skan namespace test { using ::vfwscanf; } ], [], 952169691Skan [AC_DEFINE(HAVE_VFWSCANF,1, 953169691Skan [Defined if vfwscanf exists.])],[]) 954169691Skan 955169691Skan AC_TRY_COMPILE([#include <wchar.h> 956169691Skan namespace test { using ::vswscanf; } ], [], 957169691Skan [AC_DEFINE(HAVE_VSWSCANF,1, 958169691Skan [Defined if vswscanf exists.])],[]) 959169691Skan 960169691Skan AC_TRY_COMPILE([#include <wchar.h> 961169691Skan namespace test { using ::vwscanf; } ], [], 962169691Skan [AC_DEFINE(HAVE_VWSCANF,1,[Defined if vwscanf exists.])],[]) 963169691Skan 964169691Skan AC_TRY_COMPILE([#include <wchar.h> 965169691Skan namespace test { using ::wcstof; } ], [], 966169691Skan [AC_DEFINE(HAVE_WCSTOF,1,[Defined if wcstof exists.])],[]) 967169691Skan 968169691Skan AC_TRY_COMPILE([#include <wctype.h>], 969169691Skan [ wint_t t; int i = iswblank(t);], 970169691Skan [AC_DEFINE(HAVE_ISWBLANK,1, 971169691Skan [Defined if iswblank exists.])],[]) 972169691Skan 973169691Skan AC_MSG_RESULT($ac_c99_wchar) 974169691Skan fi 975169691Skan 976169691Skan # Option parsed, now set things appropriately. 977132720Skan if test x"$ac_c99_math" = x"no" || 978169691Skan test x"$ac_c99_complex" = x"no" || 979132720Skan test x"$ac_c99_stdio" = x"no" || 980132720Skan test x"$ac_c99_stdlib" = x"no" || 981132720Skan test x"$ac_c99_wchar" = x"no"; then 982132720Skan enable_c99=no; 983169691Skan else 984169691Skan AC_DEFINE(_GLIBCXX_USE_C99, 1, 985169691Skan [Define if C99 functions or macros from <wchar.h>, <math.h>, 986169691Skan <complex.h>, <stdio.h>, and <stdlib.h> can be used or exposed.]) 987169691Skan fi 988169691Skan 989169691Skan AC_LANG_RESTORE 990169691Skan fi 991169691Skan 992169691Skan AC_MSG_CHECKING([for fully enabled ISO C99 support]) 993132720Skan AC_MSG_RESULT($enable_c99) 994169691Skan]) 995132720Skan 996169691Skan 997169691Skandnl 998169691Skandnl Check for ISO/IEC 9899:1999 "C99" support to ISO/IEC DTR 19768 "TR1" 999169691Skandnl facilities in Chapter 8, "C compatibility". 1000169691Skandnl 1001169691SkanAC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ 1002169691Skan 1003169691Skan AC_LANG_SAVE 1004169691Skan AC_LANG_CPLUSPLUS 1005169691Skan 1006169691Skan # Check for the existence of <complex.h> complex math functions used 1007169691Skan # by tr1/complex. 1008169691Skan AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no) 1009169691Skan ac_c99_complex_tr1=no; 1010169691Skan if test x"$ac_has_complex_h" = x"yes"; then 1011169691Skan AC_MSG_CHECKING([for ISO C99 support to TR1 in <complex.h>]) 1012169691Skan AC_TRY_COMPILE([#include <complex.h>], 1013169691Skan [typedef __complex__ float float_type; float_type tmpf; 1014169691Skan cacosf(tmpf); 1015169691Skan casinf(tmpf); 1016169691Skan catanf(tmpf); 1017169691Skan cacoshf(tmpf); 1018169691Skan casinhf(tmpf); 1019169691Skan catanhf(tmpf); 1020169691Skan typedef __complex__ double double_type; double_type tmpd; 1021169691Skan cacos(tmpd); 1022169691Skan casin(tmpd); 1023169691Skan catan(tmpd); 1024169691Skan cacosh(tmpd); 1025169691Skan casinh(tmpd); 1026169691Skan catanh(tmpd); 1027169691Skan typedef __complex__ long double ld_type; ld_type tmpld; 1028169691Skan cacosl(tmpld); 1029169691Skan casinl(tmpld); 1030169691Skan catanl(tmpld); 1031169691Skan cacoshl(tmpld); 1032169691Skan casinhl(tmpld); 1033169691Skan catanhl(tmpld); 1034169691Skan ],[ac_c99_complex_tr1=yes], [ac_c99_complex_tr1=no]) 103597403Sobrien fi 1036169691Skan AC_MSG_RESULT($ac_c99_complex_tr1) 1037169691Skan if test x"$ac_c99_complex_tr1" = x"yes"; then 1038169691Skan AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX_TR1, 1, 1039169691Skan [Define if C99 functions in <complex.h> should be used in 1040169691Skan <tr1/complex>. Using compiler builtins for these functions 1041169691Skan requires corresponding C99 library functions to be present.]) 1042169691Skan fi 104397403Sobrien 1044169691Skan # Check for the existence of <ctype.h> functions. 1045169691Skan AC_MSG_CHECKING([for ISO C99 support to TR1 in <ctype.h>]) 1046169691Skan AC_CACHE_VAL(ac_c99_ctype_tr1, [ 1047169691Skan AC_TRY_COMPILE([#include <ctype.h>], 1048169691Skan [int ch; 1049169691Skan int ret; 1050169691Skan ret = isblank(ch); 1051169691Skan ],[ac_c99_ctype_tr1=yes], [ac_c99_ctype_tr1=no]) 1052169691Skan ]) 1053169691Skan AC_MSG_RESULT($ac_c99_ctype_tr1) 1054169691Skan if test x"$ac_c99_ctype_tr1" = x"yes"; then 1055169691Skan AC_DEFINE(_GLIBCXX_USE_C99_CTYPE_TR1, 1, 1056169691Skan [Define if C99 functions in <ctype.h> should be imported in 1057169691Skan <tr1/cctype> in namespace std::tr1.]) 1058132720Skan fi 105997403Sobrien 1060169691Skan # Check for the existence of <fenv.h> functions. 1061169691Skan AC_CHECK_HEADERS(fenv.h, ac_has_fenv_h=yes, ac_has_fenv_h=no) 1062169691Skan ac_c99_fenv_tr1=no; 1063169691Skan if test x"$ac_has_fenv_h" = x"yes"; then 1064169691Skan AC_MSG_CHECKING([for ISO C99 support to TR1 in <fenv.h>]) 1065169691Skan AC_TRY_COMPILE([#include <fenv.h>], 1066169691Skan [int except, mode; 1067169691Skan fexcept_t* pflag; 1068169691Skan fenv_t* penv; 1069169691Skan int ret; 1070169691Skan ret = feclearexcept(except); 1071169691Skan ret = fegetexceptflag(pflag, except); 1072169691Skan ret = feraiseexcept(except); 1073169691Skan ret = fesetexceptflag(pflag, except); 1074169691Skan ret = fetestexcept(except); 1075169691Skan ret = fegetround(); 1076169691Skan ret = fesetround(mode); 1077169691Skan ret = fegetenv(penv); 1078169691Skan ret = feholdexcept(penv); 1079169691Skan ret = fesetenv(penv); 1080169691Skan ret = feupdateenv(penv); 1081169691Skan ],[ac_c99_fenv_tr1=yes], [ac_c99_fenv_tr1=no]) 1082169691Skan fi 1083169691Skan AC_MSG_RESULT($ac_c99_fenv_tr1) 1084169691Skan if test x"$ac_c99_fenv_tr1" = x"yes"; then 1085169691Skan AC_DEFINE(_GLIBCXX_USE_C99_FENV_TR1, 1, 1086169691Skan [Define if C99 functions in <fenv.h> should be imported in 1087169691Skan <tr1/cfenv> in namespace std::tr1.]) 1088169691Skan fi 1089169691Skan 1090169691Skan # Check for the existence of <stdint.h> types. 1091169691Skan AC_MSG_CHECKING([for ISO C99 support to TR1 in <stdint.h>]) 1092169691Skan AC_CACHE_VAL(ac_c99_stdint_tr1, [ 1093169691Skan AC_TRY_COMPILE([#include <stdint.h>], 1094169691Skan [typedef int8_t my_int8_t; 1095169691Skan typedef int16_t my_int16_t; 1096169691Skan typedef int32_t my_int32_t; 1097169691Skan typedef int64_t my_int64_t; 1098169691Skan typedef int_fast8_t my_int_fast8_t; 1099169691Skan typedef int_fast16_t my_int_fast16_t; 1100169691Skan typedef int_fast32_t my_int_fast32_t; 1101169691Skan typedef int_fast64_t my_int_fast64_t; 1102169691Skan typedef int_least8_t my_int_least8_t; 1103169691Skan typedef int_least16_t my_int_least16_t; 1104169691Skan typedef int_least32_t my_int_least32_t; 1105169691Skan typedef int_least64_t my_int_least64_t; 1106169691Skan typedef intmax_t my_intmax_t; 1107169691Skan typedef intptr_t my_intptr_t; 1108169691Skan typedef uint8_t my_uint8_t; 1109169691Skan typedef uint16_t my_uint16_t; 1110169691Skan typedef uint32_t my_uint32_t; 1111169691Skan typedef uint64_t my_uint64_t; 1112169691Skan typedef uint_fast8_t my_uint_fast8_t; 1113169691Skan typedef uint_fast16_t my_uint_fast16_t; 1114169691Skan typedef uint_fast32_t my_uint_fast32_t; 1115169691Skan typedef uint_fast64_t my_uint_fast64_t; 1116169691Skan typedef uint_least8_t my_uint_least8_t; 1117169691Skan typedef uint_least16_t my_uint_least16_t; 1118169691Skan typedef uint_least32_t my_uint_least32_t; 1119169691Skan typedef uint_least64_t my_uint_least64_t; 1120169691Skan typedef uintmax_t my_uintmax_t; 1121169691Skan typedef uintptr_t my_uintptr_t; 1122169691Skan ],[ac_c99_stdint_tr1=yes], [ac_c99_stdint_tr1=no]) 1123169691Skan ]) 1124169691Skan AC_MSG_RESULT($ac_c99_stdint_tr1) 1125169691Skan if test x"$ac_c99_stdint_tr1" = x"yes"; then 1126169691Skan AC_DEFINE(_GLIBCXX_USE_C99_STDINT_TR1, 1, 1127169691Skan [Define if C99 types in <stdint.h> should be imported in 1128169691Skan <tr1/cstdint> in namespace std::tr1.]) 1129169691Skan fi 1130169691Skan 1131169691Skan # Check for the existence of <math.h> functions. 1132169691Skan AC_MSG_CHECKING([for ISO C99 support to TR1 in <math.h>]) 1133169691Skan AC_CACHE_VAL(ac_c99_math_tr1, [ 1134169691Skan AC_TRY_COMPILE([#include <math.h>], 1135169691Skan [typedef double_t my_double_t; 1136169691Skan typedef float_t my_float_t; 1137169691Skan acosh(0.0); 1138169691Skan acoshf(0.0f); 1139169691Skan acoshl(0.0l); 1140169691Skan asinh(0.0); 1141169691Skan asinhf(0.0f); 1142169691Skan asinhl(0.0l); 1143169691Skan atanh(0.0); 1144169691Skan atanhf(0.0f); 1145169691Skan atanhl(0.0l); 1146169691Skan cbrt(0.0); 1147169691Skan cbrtf(0.0f); 1148169691Skan cbrtl(0.0l); 1149169691Skan copysign(0.0, 0.0); 1150169691Skan copysignf(0.0f, 0.0f); 1151169691Skan copysignl(0.0l, 0.0l); 1152169691Skan erf(0.0); 1153169691Skan erff(0.0f); 1154169691Skan erfl(0.0l); 1155169691Skan erfc(0.0); 1156169691Skan erfcf(0.0f); 1157169691Skan erfcl(0.0l); 1158169691Skan exp2(0.0); 1159169691Skan exp2f(0.0f); 1160169691Skan exp2l(0.0l); 1161169691Skan expm1(0.0); 1162169691Skan expm1f(0.0f); 1163169691Skan expm1l(0.0l); 1164169691Skan fdim(0.0, 0.0); 1165169691Skan fdimf(0.0f, 0.0f); 1166169691Skan fdiml(0.0l, 0.0l); 1167169691Skan fma(0.0, 0.0, 0.0); 1168169691Skan fmaf(0.0f, 0.0f, 0.0f); 1169169691Skan fmal(0.0l, 0.0l, 0.0l); 1170169691Skan fmax(0.0, 0.0); 1171169691Skan fmaxf(0.0f, 0.0f); 1172169691Skan fmaxl(0.0l, 0.0l); 1173169691Skan fmin(0.0, 0.0); 1174169691Skan fminf(0.0f, 0.0f); 1175169691Skan fminl(0.0l, 0.0l); 1176169691Skan hypot(0.0, 0.0); 1177169691Skan hypotf(0.0f, 0.0f); 1178169691Skan hypotl(0.0l, 0.0l); 1179169691Skan ilogb(0.0); 1180169691Skan ilogbf(0.0f); 1181169691Skan ilogbl(0.0l); 1182169691Skan lgamma(0.0); 1183169691Skan lgammaf(0.0f); 1184169691Skan lgammal(0.0l); 1185169691Skan llrint(0.0); 1186169691Skan llrintf(0.0f); 1187169691Skan llrintl(0.0l); 1188169691Skan llround(0.0); 1189169691Skan llroundf(0.0f); 1190169691Skan llroundl(0.0l); 1191169691Skan log1p(0.0); 1192169691Skan log1pf(0.0f); 1193169691Skan log1pl(0.0l); 1194169691Skan log2(0.0); 1195169691Skan log2f(0.0f); 1196169691Skan log2l(0.0l); 1197169691Skan logb(0.0); 1198169691Skan logbf(0.0f); 1199169691Skan logbl(0.0l); 1200169691Skan lrint(0.0); 1201169691Skan lrintf(0.0f); 1202169691Skan lrintl(0.0l); 1203169691Skan lround(0.0); 1204169691Skan lroundf(0.0f); 1205169691Skan lroundl(0.0l); 1206169691Skan nan(0); 1207169691Skan nanf(0); 1208169691Skan nanl(0); 1209169691Skan nearbyint(0.0); 1210169691Skan nearbyintf(0.0f); 1211169691Skan nearbyintl(0.0l); 1212169691Skan nextafter(0.0, 0.0); 1213169691Skan nextafterf(0.0f, 0.0f); 1214169691Skan nextafterl(0.0l, 0.0l); 1215169691Skan nexttoward(0.0, 0.0); 1216169691Skan nexttowardf(0.0f, 0.0f); 1217169691Skan nexttowardl(0.0l, 0.0l); 1218169691Skan remainder(0.0, 0.0); 1219169691Skan remainderf(0.0f, 0.0f); 1220169691Skan remainderl(0.0l, 0.0l); 1221169691Skan remquo(0.0, 0.0, 0); 1222169691Skan remquo(0.0f, 0.0f, 0); 1223169691Skan remquo(0.0l, 0.0l, 0); 1224169691Skan rint(0.0); 1225169691Skan rintf(0.0f); 1226169691Skan rintl(0.0l); 1227169691Skan round(0.0); 1228169691Skan roundf(0.0f); 1229169691Skan roundl(0.0l); 1230169691Skan scalbln(0.0, 0l); 1231169691Skan scalblnf(0.0f, 0l); 1232169691Skan scalblnl(0.0l, 0l); 1233169691Skan scalbn(0.0, 0); 1234169691Skan scalbnf(0.0f, 0); 1235169691Skan scalbnl(0.0l, 0); 1236169691Skan tgamma(0.0); 1237169691Skan tgammaf(0.0f); 1238169691Skan tgammal(0.0l); 1239169691Skan trunc(0.0); 1240169691Skan truncf(0.0f); 1241169691Skan truncl(0.0l); 1242169691Skan ],[ac_c99_math_tr1=yes], [ac_c99_math_tr1=no]) 1243169691Skan ]) 1244169691Skan AC_MSG_RESULT($ac_c99_math_tr1) 1245169691Skan if test x"$ac_c99_math_tr1" = x"yes"; then 1246169691Skan AC_DEFINE(_GLIBCXX_USE_C99_MATH_TR1, 1, 1247169691Skan [Define if C99 functions or macros in <math.h> should be imported 1248169691Skan in <tr1/cmath> in namespace std::tr1.]) 1249169691Skan fi 1250169691Skan 1251169691Skan # Check for the existence of <inttypes.h> functions (NB: doesn't make 1252169691Skan # sense if the previous check fails, per C99, 7.8/1). 1253169691Skan ac_c99_inttypes_tr1=no; 1254169691Skan if test x"$ac_c99_stdint_tr1" = x"yes"; then 1255169691Skan AC_MSG_CHECKING([for ISO C99 support to TR1 in <inttypes.h>]) 1256169691Skan AC_TRY_COMPILE([#include <inttypes.h>], 1257169691Skan [intmax_t i, numer, denom, base; 1258169691Skan const char* s; 1259169691Skan char** endptr; 1260169691Skan intmax_t ret = imaxabs(i); 1261169691Skan imaxdiv_t dret = imaxdiv(numer, denom); 1262169691Skan ret = strtoimax(s, endptr, base); 1263169691Skan uintmax_t uret = strtoumax(s, endptr, base); 1264169691Skan ],[ac_c99_inttypes_tr1=yes], [ac_c99_inttypes_tr1=no]) 1265169691Skan fi 1266169691Skan AC_MSG_RESULT($ac_c99_inttypes_tr1) 1267169691Skan if test x"$ac_c99_inttypes_tr1" = x"yes"; then 1268169691Skan AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_TR1, 1, 1269169691Skan [Define if C99 functions in <inttypes.h> should be imported in 1270169691Skan <tr1/cinttypes> in namespace std::tr1.]) 1271169691Skan fi 1272169691Skan 1273169691Skan # Check for the existence of the <stdbool.h> header. 1274169691Skan AC_CHECK_HEADERS(stdbool.h) 1275169691Skan 1276132720Skan AC_LANG_RESTORE 1277117397Skan]) 127897403Sobrien 1279169691Skandnl 1280169691Skandnl Check whether "dev/random" and "dev/urandom" are available for the 1281169691Skandnl random_device of "TR1" (Chapter 5.1, "Random number generation"). 1282169691Skandnl 1283169691SkanAC_DEFUN([GLIBCXX_CHECK_RANDOM_TR1], [ 1284117397Skan 1285169691Skan AC_MSG_CHECKING([for "dev/random" and "dev/urandom" for TR1 random_device]) 1286169691Skan AC_CACHE_VAL(ac_random_tr1, [ 1287169691Skan AC_TRY_RUN([#include <stdio.h> 1288169691Skan int main() 1289169691Skan { 1290169691Skan return !(fopen("/dev/random", "r") 1291169691Skan && fopen("/dev/urandom", "r")); 1292169691Skan } 1293169691Skan ], 1294169691Skan [ac_random_tr1=yes], [ac_random_tr1=no], 1295169691Skan [ac_random_tr1=no]) 1296169691Skan ]) 1297169691Skan AC_MSG_RESULT($ac_random_tr1) 1298169691Skan if test x"$ac_random_tr1" = x"yes"; then 1299169691Skan AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1, 1, 1300169691Skan [Define if dev/random and dev/urandom are available for 1301169691Skan the random_device of TR1 (Chapter 5.1).]) 1302169691Skan fi 1303169691Skan 1304169691Skan]) 1305169691Skan 1306117397Skandnl 1307132720Skandnl Check for what type of C headers to use. 1308117397Skandnl 1309132720Skandnl --enable-cheaders= [does stuff]. 1310132720Skandnl --disable-cheaders [does not do anything, really]. 1311132720Skandnl + Usage: GLIBCXX_ENABLE_CHEADERS[(DEFAULT)] 1312132720Skandnl Where DEFAULT is either `c' or `c_std'. 1313117397Skandnl 1314132720SkanAC_DEFUN([GLIBCXX_ENABLE_CHEADERS], [ 1315132720Skan GLIBCXX_ENABLE(cheaders,$1,[=KIND], 1316132720Skan [construct "C" headers for g++], [permit c|c_std]) 1317132720Skan AC_MSG_NOTICE("C" header strategy set to $enable_cheaders) 1318117397Skan 1319132720Skan C_INCLUDE_DIR='${glibcxx_srcdir}/include/'$enable_cheaders 1320117397Skan 1321132720Skan AC_SUBST(C_INCLUDE_DIR) 1322132720Skan GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c) 1323132720Skan GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std) 1324132720Skan GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes) 132597403Sobrien]) 132697403Sobrien 132797403Sobrien 132897403Sobriendnl 1329132720Skandnl Check for which locale library to use. The choice is mapped to 1330132720Skandnl a subdirectory of config/locale. 133197403Sobriendnl 1332132720Skandnl Default is generic. 133397403Sobriendnl 1334132720SkanAC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [ 1335132720Skan GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], 1336132720Skan [use MODEL for target locale package], 1337132720Skan [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) 1338171827Skan 1339171827Skan # Deal with gettext issues. Default to not using it (=no) until we detect 1340171827Skan # support for it later. Let the user turn it off via --e/d, but let that 1341171827Skan # default to on for easier handling. 1342171827Skan USE_NLS=no 1343171827Skan AC_ARG_ENABLE(nls, 1344171827Skan AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]), 1345171827Skan [], 1346171827Skan [enable_nls=yes]) 1347132720Skan 1348171827Skan # Either a known packaage, or "auto" 1349132720Skan if test $enable_clocale = no || test $enable_clocale = yes; then 1350132720Skan enable_clocale=auto 1351132720Skan fi 135297403Sobrien enable_clocale_flag=$enable_clocale 135397403Sobrien 1354171827Skan # Probe for locale model to use if none specified. 1355132720Skan # Default to "generic". 1356132720Skan if test $enable_clocale_flag = auto; then 1357169691Skan case ${target_os} in 1358169691Skan linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) 1359171827Skan enable_clocale_flag=gnu 136097403Sobrien ;; 1361169691Skan darwin* | freebsd*) 1362169691Skan enable_clocale_flag=darwin 1363169691Skan ;; 136497403Sobrien *) 1365132720Skan enable_clocale_flag=generic 1366132720Skan ;; 136797403Sobrien esac 136897403Sobrien fi 136997403Sobrien 1370171827Skan # Sanity check model, and test for special functionality. 1371171827Skan if test $enable_clocale_flag = gnu; then 1372171827Skan AC_EGREP_CPP([_GLIBCXX_ok], [ 1373171827Skan #include <features.h> 1374171827Skan #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) 1375171827Skan _GLIBCXX_ok 1376171827Skan #endif 1377171827Skan ], enable_clocale_flag=gnu, enable_clocale_flag=generic) 137897403Sobrien 1379171827Skan if test $enable_clocale = auto; then 1380171827Skan # Test for bugs early in glibc-2.2.x series 1381171827Skan AC_TRY_RUN([ 1382171827Skan #define _GNU_SOURCE 1 1383171827Skan #include <locale.h> 1384171827Skan #include <string.h> 1385171827Skan #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) 1386171827Skan extern __typeof(newlocale) __newlocale; 1387171827Skan extern __typeof(duplocale) __duplocale; 1388171827Skan extern __typeof(strcoll_l) __strcoll_l; 1389171827Skan #endif 1390171827Skan int main() 1391171827Skan { 1392171827Skan const char __one[] = "�uglein Augmen"; 1393171827Skan const char __two[] = "�uglein"; 1394171827Skan int i; 1395171827Skan int j; 1396171827Skan __locale_t loc; 1397171827Skan __locale_t loc_dup; 1398171827Skan loc = __newlocale(1 << LC_ALL, "de_DE", 0); 1399171827Skan loc_dup = __duplocale(loc); 1400171827Skan i = __strcoll_l(__one, __two, loc); 1401171827Skan j = __strcoll_l(__one, __two, loc_dup); 1402171827Skan return 0; 1403171827Skan } 1404171827Skan ], 1405171827Skan [enable_clocale_flag=gnu],[enable_clocale_flag=generic], 1406171827Skan [enable_clocale_flag=generic]) 1407171827Skan fi 1408171827Skan 1409171827Skan # Set it to scream when it hurts. 1410171827Skan ac_save_CFLAGS="$CFLAGS" 1411171827Skan CFLAGS="-Wimplicit-function-declaration -Werror" 1412171827Skan 1413171827Skan # Use strxfrm_l if available. 1414171827Skan AC_TRY_COMPILE([#define _GNU_SOURCE 1 1415171827Skan #include <string.h> 1416171827Skan #include <locale.h>], 1417171827Skan [char s[128]; __locale_t loc; strxfrm_l(s, "C", 5, loc);], 1418171827Skan AC_DEFINE(HAVE_STRXFRM_L, 1, 1419171827Skan [Define if strxfrm_l is available in <string.h>.]),) 1420171827Skan 1421171827Skan # Use strerror_l if available. 1422171827Skan AC_TRY_COMPILE([#define _GNU_SOURCE 1 1423171827Skan #include <string.h> 1424171827Skan #include <locale.h>], 1425171827Skan [__locale_t loc; strerror_l(5, loc);], 1426171827Skan AC_DEFINE(HAVE_STRERROR_L, 1, 1427171827Skan [Define if strerror_l is available in <string.h>.]),) 1428171827Skan 1429171827Skan CFLAGS="$ac_save_CFLAGS" 1430171827Skan fi 1431171827Skan 1432171827Skan # Perhaps use strerror_r if available, and strerror_l isn't. 1433171827Skan ac_save_CFLAGS="$CFLAGS" 1434171827Skan CFLAGS="-Wimplicit-function-declaration -Werror" 1435171827Skan AC_TRY_COMPILE([#define _GNU_SOURCE 1 1436171827Skan #include <string.h> 1437171827Skan #include <locale.h>], 1438171827Skan [char s[128]; strerror_r(5, s, 128);], 1439171827Skan AC_DEFINE(HAVE_STRERROR_R, 1, 1440171827Skan [Define if strerror_r is available in <string.h>.]),) 1441171827Skan CFLAGS="$ac_save_CFLAGS" 1442171827Skan 1443132720Skan # Set configure bits for specified locale package 1444171827Skan AC_MSG_CHECKING([for C locale to use]) 1445132720Skan case ${enable_clocale_flag} in 1446132720Skan generic) 144797403Sobrien AC_MSG_RESULT(generic) 144897403Sobrien 144997403Sobrien CLOCALE_H=config/locale/generic/c_locale.h 145097403Sobrien CLOCALE_CC=config/locale/generic/c_locale.cc 1451103447Skan CCODECVT_CC=config/locale/generic/codecvt_members.cc 145297403Sobrien CCOLLATE_CC=config/locale/generic/collate_members.cc 145397403Sobrien CCTYPE_CC=config/locale/generic/ctype_members.cc 145497403Sobrien CMESSAGES_H=config/locale/generic/messages_members.h 145597403Sobrien CMESSAGES_CC=config/locale/generic/messages_members.cc 145697403Sobrien CMONEY_CC=config/locale/generic/monetary_members.cc 145797403Sobrien CNUMERIC_CC=config/locale/generic/numeric_members.cc 1458110614Skan CTIME_H=config/locale/generic/time_members.h 145997403Sobrien CTIME_CC=config/locale/generic/time_members.cc 1460103447Skan CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h 146197403Sobrien ;; 1462169691Skan darwin) 1463169691Skan AC_MSG_RESULT(darwin or freebsd) 1464169691Skan 1465169691Skan CLOCALE_H=config/locale/generic/c_locale.h 1466169691Skan CLOCALE_CC=config/locale/generic/c_locale.cc 1467169691Skan CCODECVT_CC=config/locale/generic/codecvt_members.cc 1468169691Skan CCOLLATE_CC=config/locale/generic/collate_members.cc 1469169691Skan CCTYPE_CC=config/locale/darwin/ctype_members.cc 1470169691Skan CMESSAGES_H=config/locale/generic/messages_members.h 1471169691Skan CMESSAGES_CC=config/locale/generic/messages_members.cc 1472169691Skan CMONEY_CC=config/locale/generic/monetary_members.cc 1473169691Skan CNUMERIC_CC=config/locale/generic/numeric_members.cc 1474169691Skan CTIME_H=config/locale/generic/time_members.h 1475169691Skan CTIME_CC=config/locale/generic/time_members.cc 1476169691Skan CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h 1477169691Skan ;; 1478169691Skan 1479132720Skan gnu) 148097403Sobrien AC_MSG_RESULT(gnu) 148197403Sobrien 148297403Sobrien # Declare intention to use gettext, and add support for specific 148397403Sobrien # languages. 1484102782Skan # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT 148597403Sobrien ALL_LINGUAS="de fr" 148697403Sobrien 1487102782Skan # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. 148897403Sobrien AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) 148997403Sobrien if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then 1490132720Skan USE_NLS=yes 149197403Sobrien fi 149297403Sobrien # Export the build objects. 149397403Sobrien for ling in $ALL_LINGUAS; do \ 1494132720Skan glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ 1495132720Skan glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ 149697403Sobrien done 1497132720Skan AC_SUBST(glibcxx_MOFILES) 1498132720Skan AC_SUBST(glibcxx_POFILES) 149997403Sobrien 150097403Sobrien CLOCALE_H=config/locale/gnu/c_locale.h 150197403Sobrien CLOCALE_CC=config/locale/gnu/c_locale.cc 1502103447Skan CCODECVT_CC=config/locale/gnu/codecvt_members.cc 150397403Sobrien CCOLLATE_CC=config/locale/gnu/collate_members.cc 150497403Sobrien CCTYPE_CC=config/locale/gnu/ctype_members.cc 150597403Sobrien CMESSAGES_H=config/locale/gnu/messages_members.h 150697403Sobrien CMESSAGES_CC=config/locale/gnu/messages_members.cc 150797403Sobrien CMONEY_CC=config/locale/gnu/monetary_members.cc 150897403Sobrien CNUMERIC_CC=config/locale/gnu/numeric_members.cc 1509110614Skan CTIME_H=config/locale/gnu/time_members.h 151097403Sobrien CTIME_CC=config/locale/gnu/time_members.cc 1511103447Skan CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h 151297403Sobrien ;; 1513132720Skan ieee_1003.1-2001) 1514132720Skan AC_MSG_RESULT(IEEE 1003.1) 151597403Sobrien 151697403Sobrien CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h 151797403Sobrien CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc 1518103447Skan CCODECVT_CC=config/locale/generic/codecvt_members.cc 151997403Sobrien CCOLLATE_CC=config/locale/generic/collate_members.cc 152097403Sobrien CCTYPE_CC=config/locale/generic/ctype_members.cc 152197403Sobrien CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h 152297403Sobrien CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc 152397403Sobrien CMONEY_CC=config/locale/generic/monetary_members.cc 152497403Sobrien CNUMERIC_CC=config/locale/generic/numeric_members.cc 1525110614Skan CTIME_H=config/locale/generic/time_members.h 152697403Sobrien CTIME_CC=config/locale/generic/time_members.cc 1527103447Skan CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h 152897403Sobrien ;; 152997403Sobrien esac 153097403Sobrien 153197403Sobrien # This is where the testsuite looks for locale catalogs, using the 153297403Sobrien # -DLOCALEDIR define during testsuite compilation. 1533132720Skan glibcxx_localedir=${glibcxx_builddir}/po/share/locale 1534132720Skan AC_SUBST(glibcxx_localedir) 153597403Sobrien 1536132720Skan # A standalone libintl (e.g., GNU libintl) may be in use. 1537132720Skan if test $USE_NLS = yes; then 1538132720Skan AC_CHECK_HEADERS([libintl.h], [], USE_NLS=no) 1539132720Skan AC_SEARCH_LIBS(gettext, intl, [], USE_NLS=no) 1540132720Skan fi 1541132720Skan if test $USE_NLS = yes; then 1542169691Skan AC_DEFINE(_GLIBCXX_USE_NLS, 1, 1543169691Skan [Define if NLS translations are to be used.]) 1544132720Skan fi 1545132720Skan 154697403Sobrien AC_SUBST(USE_NLS) 154797403Sobrien AC_SUBST(CLOCALE_H) 154897403Sobrien AC_SUBST(CMESSAGES_H) 1549117397Skan AC_SUBST(CCODECVT_CC) 1550117397Skan AC_SUBST(CCOLLATE_CC) 1551117397Skan AC_SUBST(CCTYPE_CC) 1552117397Skan AC_SUBST(CMESSAGES_CC) 1553117397Skan AC_SUBST(CMONEY_CC) 1554117397Skan AC_SUBST(CNUMERIC_CC) 1555110614Skan AC_SUBST(CTIME_H) 1556117397Skan AC_SUBST(CTIME_CC) 1557117397Skan AC_SUBST(CLOCALE_CC) 1558117397Skan AC_SUBST(CLOCALE_INTERNAL_H) 155997403Sobrien]) 156097403Sobrien 156197403Sobrien 156297403Sobriendnl 1563132720Skandnl Check for which std::allocator base class to use. The choice is 1564132720Skandnl mapped from a subdirectory of include/ext. 156597403Sobriendnl 1566132720Skandnl Default is new. 156797403Sobriendnl 1568132720SkanAC_DEFUN([GLIBCXX_ENABLE_ALLOCATOR], [ 1569169691Skan AC_MSG_CHECKING([for std::allocator base class]) 1570132720Skan GLIBCXX_ENABLE(libstdcxx-allocator,auto,[=KIND], 1571132720Skan [use KIND for target std::allocator base], 1572132720Skan [permit new|malloc|mt|bitmap|pool|yes|no|auto]) 1573169691Skan 1574132720Skan # If they didn't use this option switch, or if they specified --enable 1575132720Skan # with no specific model, we'll have to look for one. If they 1576132720Skan # specified --disable (???), do likewise. 1577169691Skan if test $enable_libstdcxx_allocator = no || 1578169691Skan test $enable_libstdcxx_allocator = yes; 1579169691Skan then 1580132720Skan enable_libstdcxx_allocator=auto 1581132720Skan fi 158297403Sobrien 1583169691Skan # Either a known package, or "auto". Auto implies the default choice 1584169691Skan # for a particular platform. 1585132720Skan enable_libstdcxx_allocator_flag=$enable_libstdcxx_allocator 158697403Sobrien 1587132720Skan # Probe for host-specific support if no specific model is specified. 1588132720Skan # Default to "new". 1589132720Skan if test $enable_libstdcxx_allocator_flag = auto; then 1590132720Skan case ${target_os} in 1591169691Skan linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) 1592169691Skan enable_libstdcxx_allocator_flag=new 1593169691Skan ;; 1594132720Skan *) 1595132720Skan enable_libstdcxx_allocator_flag=new 1596132720Skan ;; 1597132720Skan esac 1598132720Skan fi 1599132720Skan AC_MSG_RESULT($enable_libstdcxx_allocator_flag) 1600132720Skan 160197403Sobrien 1602132720Skan # Set configure bits for specified locale package 1603132720Skan case ${enable_libstdcxx_allocator_flag} in 1604132720Skan bitmap) 1605132720Skan ALLOCATOR_H=config/allocator/bitmap_allocator_base.h 1606132720Skan ALLOCATOR_NAME=__gnu_cxx::bitmap_allocator 160797403Sobrien ;; 1608132720Skan malloc) 1609132720Skan ALLOCATOR_H=config/allocator/malloc_allocator_base.h 1610132720Skan ALLOCATOR_NAME=__gnu_cxx::malloc_allocator 161197403Sobrien ;; 1612132720Skan mt) 1613132720Skan ALLOCATOR_H=config/allocator/mt_allocator_base.h 1614132720Skan ALLOCATOR_NAME=__gnu_cxx::__mt_alloc 161597403Sobrien ;; 1616132720Skan new) 1617132720Skan ALLOCATOR_H=config/allocator/new_allocator_base.h 1618132720Skan ALLOCATOR_NAME=__gnu_cxx::new_allocator 1619132720Skan ;; 1620132720Skan pool) 1621132720Skan ALLOCATOR_H=config/allocator/pool_allocator_base.h 1622132720Skan ALLOCATOR_NAME=__gnu_cxx::__pool_alloc 1623132720Skan ;; 162497403Sobrien esac 162597403Sobrien 1626132720Skan AC_SUBST(ALLOCATOR_H) 1627132720Skan AC_SUBST(ALLOCATOR_NAME) 162897403Sobrien]) 162997403Sobrien 163097403Sobrien 163197403Sobriendnl 1632132720Skandnl Check for whether the Boost-derived checks should be turned on. 163397403Sobriendnl 1634132720Skandnl --enable-concept-checks turns them on. 1635132720Skandnl --disable-concept-checks leaves them off. 1636132720Skandnl + Usage: GLIBCXX_ENABLE_CONCEPT_CHECKS[(DEFAULT)] 1637132720Skandnl Where DEFAULT is either `yes' or `no'. 1638132720Skandnl 1639132720SkanAC_DEFUN([GLIBCXX_ENABLE_CONCEPT_CHECKS], [ 1640132720Skan GLIBCXX_ENABLE(concept-checks,$1,,[use Boost-derived template checks]) 1641132720Skan if test $enable_concept_checks = yes; then 1642169691Skan AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS, 1, 1643169691Skan [Define to use concept checking code from the boost libraries.]) 164497403Sobrien fi 164597403Sobrien]) 164697403Sobrien 164797403Sobrien 164897403Sobriendnl 1649132720Skandnl Check for which I/O library to use: stdio, or something specific. 165097403Sobriendnl 1651132720Skandnl Default is stdio. 165297403Sobriendnl 1653132720SkanAC_DEFUN([GLIBCXX_ENABLE_CSTDIO], [ 1654132720Skan AC_MSG_CHECKING([for underlying I/O to use]) 1655132720Skan GLIBCXX_ENABLE(cstdio,stdio,[=PACKAGE], 1656132720Skan [use target-specific I/O package], [permit stdio]) 165797403Sobrien 1658132720Skan # Now that libio has been removed, you can have any color you want as long 1659132720Skan # as it's black. This is one big no-op until other packages are added, but 1660132720Skan # showing the framework never hurts. 1661132720Skan case ${enable_cstdio} in 1662132720Skan stdio) 1663132720Skan CSTDIO_H=config/io/c_io_stdio.h 1664132720Skan BASIC_FILE_H=config/io/basic_file_stdio.h 1665132720Skan BASIC_FILE_CC=config/io/basic_file_stdio.cc 1666132720Skan AC_MSG_RESULT(stdio) 1667132720Skan ;; 1668132720Skan esac 166997403Sobrien 1670132720Skan AC_SUBST(CSTDIO_H) 1671132720Skan AC_SUBST(BASIC_FILE_H) 1672132720Skan AC_SUBST(BASIC_FILE_CC) 167397403Sobrien]) 167497403Sobrien 167597403Sobrien 167697403Sobriendnl 1677132720Skandnl Check for "unusual" flags to pass to the compiler while building. 167897403Sobriendnl 1679132720Skandnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing 1680132720Skandnl experimental flags such as -fpch, -fIMI, -Dfloat=char, etc. 1681132720Skandnl --disable-cxx-flags passes nothing. 1682132720Skandnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html 1683132720Skandnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html 1684132720Skandnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html 1685132720Skandnl + Usage: GLIBCXX_ENABLE_CXX_FLAGS(default flags) 1686132720Skandnl If "default flags" is an empty string, the effect is the same 1687132720Skandnl as --disable or --enable=no. 168897403Sobriendnl 1689132720SkanAC_DEFUN([GLIBCXX_ENABLE_CXX_FLAGS], [dnl 1690132720Skan AC_MSG_CHECKING([for extra compiler flags for building]) 1691132720Skan GLIBCXX_ENABLE(cxx-flags,$1,[=FLAGS], 1692132720Skan [pass compiler FLAGS when building library], 1693132720Skan [case "x$enable_cxx_flags" in 1694132720Skan xno | x) enable_cxx_flags= ;; 1695132720Skan x-*) ;; 1696132720Skan *) AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;; 1697132720Skan esac]) 169897403Sobrien 1699132720Skan # Run through flags (either default or command-line) and set anything 1700132720Skan # extra (e.g., #defines) that must accompany particular g++ options. 1701132720Skan if test -n "$enable_cxx_flags"; then 1702132720Skan for f in $enable_cxx_flags; do 1703132720Skan case "$f" in 1704132720Skan -fhonor-std) ;; 1705132720Skan -*) ;; 1706132720Skan *) # and we're trying to pass /what/ exactly? 1707132720Skan AC_MSG_ERROR([compiler flags start with a -]) ;; 1708132720Skan esac 1709132720Skan done 171097403Sobrien fi 171197403Sobrien 1712132720Skan EXTRA_CXX_FLAGS="$enable_cxx_flags" 1713132720Skan AC_MSG_RESULT($EXTRA_CXX_FLAGS) 1714132720Skan AC_SUBST(EXTRA_CXX_FLAGS) 171597403Sobrien]) 171697403Sobrien 171797403Sobrien 171897403Sobriendnl 1719132720Skandnl Check to see if debugging libraries are to be built. 172097403Sobriendnl 1721132720Skandnl --enable-libstdcxx-debug 1722132720Skandnl builds a separate set of debugging libraries in addition to the 1723132720Skandnl normal (shared, static) libstdc++ binaries. 172497403Sobriendnl 1725132720Skandnl --disable-libstdcxx-debug 1726132720Skandnl builds only one (non-debug) version of libstdc++. 1727132720Skandnl 1728132720Skandnl --enable-libstdcxx-debug-flags=FLAGS 1729132720Skandnl iff --enable-debug == yes, then use FLAGS to build the debug library. 1730132720Skandnl 1731132720Skandnl + Usage: GLIBCXX_ENABLE_DEBUG[(DEFAULT)] 1732132720Skandnl Where DEFAULT is either `yes' or `no'. 1733132720Skandnl 1734132720SkanAC_DEFUN([GLIBCXX_ENABLE_DEBUG], [ 1735132720Skan AC_MSG_CHECKING([for additional debug build]) 1736132720Skan GLIBCXX_ENABLE(libstdcxx-debug,$1,,[build extra debug library]) 1737132720Skan AC_MSG_RESULT($enable_libstdcxx_debug) 1738132720Skan GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_DEBUG, test $enable_libstdcxx_debug = yes) 173997403Sobrien]) 174097403Sobrien 174197403Sobrien 174297403Sobriendnl 1743132720Skandnl Check for explicit debug flags. 174497403Sobriendnl 1745132720Skandnl --enable-libstdcxx-debug-flags='-O1' 1746132720Skandnl is a general method for passing flags to be used when 1747132720Skandnl building debug libraries with --enable-debug. 174897403Sobriendnl 1749132720Skandnl --disable-libstdcxx-debug-flags does nothing. 1750132720Skandnl + Usage: GLIBCXX_ENABLE_DEBUG_FLAGS(default flags) 1751132720Skandnl If "default flags" is an empty string, the effect is the same 1752132720Skandnl as --disable or --enable=no. 175397403Sobriendnl 1754132720SkanAC_DEFUN([GLIBCXX_ENABLE_DEBUG_FLAGS], [ 1755132720Skan GLIBCXX_ENABLE(libstdcxx-debug-flags,[$1],[=FLAGS], 1756132720Skan [pass compiler FLAGS when building debug library], 1757132720Skan [case "x$enable_libstdcxx_debug_flags" in 1758132720Skan xno | x) enable_libstdcxx_debug_flags= ;; 1759132720Skan x-*) ;; 1760132720Skan *) AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;; 1761132720Skan esac]) 176297403Sobrien 1763132720Skan # Option parsed, now set things appropriately 1764132720Skan DEBUG_FLAGS="$enable_libstdcxx_debug_flags" 1765132720Skan AC_SUBST(DEBUG_FLAGS) 176697403Sobrien 1767132720Skan AC_MSG_NOTICE([Debug build flags set to $DEBUG_FLAGS]) 176897403Sobrien]) 176997403Sobrien 177097403Sobrien 177197403Sobriendnl 1772132720Skandnl Check if the user only wants a freestanding library implementation. 177397403Sobriendnl 1774132720Skandnl --disable-hosted-libstdcxx will turn off most of the library build, 1775132720Skandnl installing only the headers required by [17.4.1.3] and the language 1776132720Skandnl support library. More than that will be built (to keep the Makefiles 1777132720Skandnl conveniently clean), but not installed. 177897403Sobriendnl 1779132720Skandnl Sets: 1780132720Skandnl is_hosted (yes/no) 178197403Sobriendnl 1782132720Skandnl Defines: 1783132720Skandnl _GLIBCXX_HOSTED (always defined, either to 1 or 0) 178497403Sobriendnl 1785132720SkanAC_DEFUN([GLIBCXX_ENABLE_HOSTED], [ 1786132720Skan AC_ARG_ENABLE([hosted-libstdcxx], 1787132720Skan AC_HELP_STRING([--disable-hosted-libstdcxx], 1788132720Skan [only build freestanding C++ runtime support]),, 1789169691Skan [case "$host" in 1790169691Skan arm*-*-symbianelf*) 1791169691Skan enable_hosted_libstdcxx=no 1792169691Skan ;; 1793169691Skan *) 1794169691Skan enable_hosted_libstdcxx=yes 1795169691Skan ;; 1796169691Skan esac]) 1797132720Skan if test "$enable_hosted_libstdcxx" = no; then 1798132720Skan AC_MSG_NOTICE([Only freestanding libraries will be built]) 1799132720Skan is_hosted=no 1800132720Skan hosted_define=0 1801132720Skan enable_abi_check=no 1802132720Skan enable_libstdcxx_pch=no 180397403Sobrien else 1804132720Skan is_hosted=yes 1805132720Skan hosted_define=1 180697403Sobrien fi 1807132720Skan GLIBCXX_CONDITIONAL(GLIBCXX_HOSTED, test $is_hosted = yes) 1808132720Skan AC_DEFINE_UNQUOTED(_GLIBCXX_HOSTED, $hosted_define, 1809132720Skan [Define to 1 if a full hosted library is built, or 0 if freestanding.]) 181097403Sobrien]) 181197403Sobrien 181297403Sobrien 1813132720Skandnl 1814169691Skandnl Check for template specializations for the 'long long' type. 1815132720Skandnl The result determines only whether 'long long' I/O is enabled; things 1816132720Skandnl like numeric_limits<> specializations are always available. 1817132720Skandnl 1818132720Skandnl --enable-long-long defines _GLIBCXX_USE_LONG_LONG 1819132720Skandnl --disable-long-long leaves _GLIBCXX_USE_LONG_LONG undefined 1820132720Skandnl + Usage: GLIBCXX_ENABLE_LONG_LONG[(DEFAULT)] 1821132720Skandnl Where DEFAULT is either `yes' or `no'. 1822132720Skandnl 1823132720SkanAC_DEFUN([GLIBCXX_ENABLE_LONG_LONG], [ 1824169691Skan GLIBCXX_ENABLE(long-long,$1,,[enable template specializations for 'long long']) 1825132720Skan if test $enable_long_long = yes; then 1826169691Skan AC_DEFINE(_GLIBCXX_USE_LONG_LONG, 1, 1827169691Skan [Define if code specialized for long long should be used.]) 182897403Sobrien fi 1829169691Skan AC_MSG_CHECKING([for enabled long long specializations]) 1830169691Skan AC_MSG_RESULT([$enable_long_long]) 183197403Sobrien]) 183297403Sobrien 183397403Sobrien 183497403Sobriendnl 1835169691Skandnl Check for template specializations for the 'wchar_t' type. 1836169691Skandnl 1837169691Skandnl --enable-wchar_t defines _GLIBCXX_USE_WCHAR_T 1838169691Skandnl --disable-wchar_t leaves _GLIBCXX_USE_WCHAR_T undefined 1839169691Skandnl + Usage: GLIBCXX_ENABLE_WCHAR_T[(DEFAULT)] 1840169691Skandnl Where DEFAULT is either `yes' or `no'. 1841169691Skandnl 1842169691Skandnl Necessary support must also be present. 1843169691Skandnl 1844169691SkanAC_DEFUN([GLIBCXX_ENABLE_WCHAR_T], [ 1845169691Skan GLIBCXX_ENABLE(wchar_t,$1,,[enable template specializations for 'wchar_t']) 1846169691Skan 1847169691Skan # Test wchar.h for mbstate_t, which is needed for char_traits and fpos. 1848169691Skan AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no) 1849169691Skan AC_MSG_CHECKING([for mbstate_t]) 1850169691Skan AC_TRY_COMPILE([#include <wchar.h>], 1851169691Skan [mbstate_t teststate;], 1852169691Skan have_mbstate_t=yes, have_mbstate_t=no) 1853169691Skan AC_MSG_RESULT($have_mbstate_t) 1854169691Skan if test x"$have_mbstate_t" = xyes; then 1855169691Skan AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.]) 1856169691Skan fi 1857169691Skan 1858169691Skan # Test it always, for use in GLIBCXX_ENABLE_C99, together with 1859169691Skan # ac_has_wchar_h. 1860169691Skan AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no) 1861169691Skan 1862169691Skan if test x"$enable_wchar_t" = x"yes"; then 1863169691Skan 1864169691Skan AC_LANG_SAVE 1865169691Skan AC_LANG_CPLUSPLUS 1866169691Skan 1867169691Skan if test x"$ac_has_wchar_h" = xyes && 1868169691Skan test x"$ac_has_wctype_h" = xyes; then 1869169691Skan AC_TRY_COMPILE([#include <wchar.h> 1870169691Skan #include <stddef.h> 1871169691Skan wint_t i; 1872169691Skan long l = WEOF; 1873169691Skan long j = WCHAR_MIN; 1874169691Skan long k = WCHAR_MAX; 1875169691Skan namespace test 1876169691Skan { 1877169691Skan using ::btowc; 1878169691Skan using ::fgetwc; 1879169691Skan using ::fgetws; 1880169691Skan using ::fputwc; 1881169691Skan using ::fputws; 1882169691Skan using ::fwide; 1883169691Skan using ::fwprintf; 1884169691Skan using ::fwscanf; 1885169691Skan using ::getwc; 1886169691Skan using ::getwchar; 1887169691Skan using ::mbrlen; 1888169691Skan using ::mbrtowc; 1889169691Skan using ::mbsinit; 1890169691Skan using ::mbsrtowcs; 1891169691Skan using ::putwc; 1892169691Skan using ::putwchar; 1893169691Skan using ::swprintf; 1894169691Skan using ::swscanf; 1895169691Skan using ::ungetwc; 1896169691Skan using ::vfwprintf; 1897169691Skan using ::vswprintf; 1898169691Skan using ::vwprintf; 1899169691Skan using ::wcrtomb; 1900169691Skan using ::wcscat; 1901169691Skan using ::wcschr; 1902169691Skan using ::wcscmp; 1903169691Skan using ::wcscoll; 1904169691Skan using ::wcscpy; 1905169691Skan using ::wcscspn; 1906169691Skan using ::wcsftime; 1907169691Skan using ::wcslen; 1908169691Skan using ::wcsncat; 1909169691Skan using ::wcsncmp; 1910169691Skan using ::wcsncpy; 1911169691Skan using ::wcspbrk; 1912169691Skan using ::wcsrchr; 1913169691Skan using ::wcsrtombs; 1914169691Skan using ::wcsspn; 1915169691Skan using ::wcsstr; 1916169691Skan using ::wcstod; 1917169691Skan using ::wcstok; 1918169691Skan using ::wcstol; 1919169691Skan using ::wcstoul; 1920169691Skan using ::wcsxfrm; 1921169691Skan using ::wctob; 1922169691Skan using ::wmemchr; 1923169691Skan using ::wmemcmp; 1924169691Skan using ::wmemcpy; 1925169691Skan using ::wmemmove; 1926169691Skan using ::wmemset; 1927169691Skan using ::wprintf; 1928169691Skan using ::wscanf; 1929169691Skan } 1930169691Skan ],[],[], [enable_wchar_t=no]) 1931169691Skan else 1932169691Skan enable_wchar_t=no 1933169691Skan fi 1934169691Skan 1935169691Skan AC_LANG_RESTORE 1936169691Skan fi 1937169691Skan 1938169691Skan if test x"$enable_wchar_t" = x"yes"; then 1939169691Skan AC_DEFINE(_GLIBCXX_USE_WCHAR_T, 1, 1940169691Skan [Define if code specialized for wchar_t should be used.]) 1941169691Skan fi 1942169691Skan 1943169691Skan AC_MSG_CHECKING([for enabled wchar_t specializations]) 1944169691Skan AC_MSG_RESULT([$enable_wchar_t]) 1945169691Skan]) 1946169691Skan 1947169691Skan 1948169691Skandnl 1949132720Skandnl Check to see if building and using a C++ precompiled header can be done. 195097403Sobriendnl 1951132720Skandnl --enable-libstdcxx-pch=yes 1952132720Skandnl default, this shows intent to use stdc++.h.gch If it looks like it 1953132720Skandnl may work, after some light-hearted attempts to puzzle out compiler 1954132720Skandnl support, flip bits on in include/Makefile.am 1955132720Skandnl 1956132720Skandnl --disable-libstdcxx-pch 1957132720Skandnl turns off attempts to use or build stdc++.h.gch. 1958132720Skandnl 1959132720Skandnl Substs: 1960132720Skandnl glibcxx_PCHFLAGS 1961132720Skandnl 1962132720SkanAC_DEFUN([GLIBCXX_ENABLE_PCH], [ 1963132720Skan GLIBCXX_ENABLE(libstdcxx-pch,$1,,[build pre-compiled libstdc++ headers]) 1964132720Skan if test $enable_libstdcxx_pch = yes; then 1965132720Skan AC_CACHE_CHECK([for compiler with PCH support], 1966132720Skan [glibcxx_cv_prog_CXX_pch], 1967132720Skan [ac_save_CXXFLAGS="$CXXFLAGS" 1968132720Skan CXXFLAGS="$CXXFLAGS -Werror -Winvalid-pch -Wno-deprecated" 1969132720Skan AC_LANG_SAVE 1970132720Skan AC_LANG_CPLUSPLUS 1971132720Skan echo '#include <math.h>' > conftest.h 1972132720Skan if $CXX $CXXFLAGS $CPPFLAGS -x c++-header conftest.h \ 1973132720Skan -o conftest.h.gch 1>&5 2>&1 && 1974132720Skan echo '#error "pch failed"' > conftest.h && 1975132720Skan echo '#include "conftest.h"' > conftest.cc && 1976132720Skan $CXX -c $CXXFLAGS $CPPFLAGS conftest.cc 1>&5 2>&1 ; 1977132720Skan then 1978132720Skan glibcxx_cv_prog_CXX_pch=yes 1979132720Skan else 1980132720Skan glibcxx_cv_prog_CXX_pch=no 1981132720Skan fi 1982132720Skan rm -f conftest* 1983132720Skan CXXFLAGS=$ac_save_CXXFLAGS 1984132720Skan AC_LANG_RESTORE 1985132720Skan ]) 1986132720Skan enable_libstdcxx_pch=$glibcxx_cv_prog_CXX_pch 1987117397Skan fi 1988102782Skan 1989169691Skan AC_MSG_CHECKING([for enabled PCH]) 1990169691Skan AC_MSG_RESULT([$enable_libstdcxx_pch]) 1991169691Skan 1992132720Skan GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes) 1993132720Skan if test $enable_libstdcxx_pch = yes; then 1994169691Skan glibcxx_PCHFLAGS="-include bits/stdtr1c++.h" 1995117397Skan else 1996132720Skan glibcxx_PCHFLAGS="" 1997117397Skan fi 1998132720Skan AC_SUBST(glibcxx_PCHFLAGS) 199997403Sobrien]) 200097403Sobrien 200197403Sobrien 2002117397Skandnl 2003169691Skandnl Check for atomic builtins. 2004169691Skandnl See: 2005169691Skandnl http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#Atomic-Builtins 2006169691Skandnl 2007169691Skandnl This checks to see if the host supports the compiler-generated 2008169691Skandnl builtins for atomic operations. Note, this is intended to be an 2009169691Skandnl all-or-nothing switch, so all the atomic operations that are used 2010169691Skandnl should be checked. 2011169691Skandnl 2012169691Skandnl Note: 2013169691Skandnl libgomp and libgfortran do this with a link test, instead of an asm test. 2014169691Skandnl see: CHECK_SYNC_FETCH_AND_ADD 2015169691Skandnl 2016169691Skandnl Defines: 2017169691Skandnl _GLIBCXX_ATOMIC_BUILTINS if the compiler on this target supports atomics. 2018169691Skandnl 2019169691SkanAC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ 2020169691Skan AC_MSG_CHECKING([for atomic builtins]) 2021169691Skan AC_LANG_SAVE 2022169691Skan AC_LANG_CPLUSPLUS 2023169691Skan 2024169691Skan # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. 2025169691Skan cat > conftest.$ac_ext << EOF 2026169691Skan[#]line __oline__ "configure" 2027169691Skanint main() 2028169691Skan{ 2029169691Skan // NB: _Atomic_word not necessarily int. 2030169691Skan typedef int atomic_type; 2031169691Skan atomic_type c1; 2032169691Skan atomic_type c2; 2033169691Skan const atomic_type c3(0); 2034169691Skan if (__sync_fetch_and_add(&c1, c2) == c3) 2035169691Skan { 2036169691Skan // Do something. 2037169691Skan } 2038169691Skan return 0; 2039169691Skan} 2040169691SkanEOF 2041169691Skan old_CXXFLAGS="$CXXFLAGS" 2042169691Skan CXXFLAGS=-S 2043169691Skan if AC_TRY_EVAL(ac_compile); then 2044169691Skan if grep __sync_fetch_and_add conftest.s >/dev/null 2>&1 ; then 2045169691Skan enable_atomic_builtins=no 2046169691Skan else 2047169691Skan AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS, 1, 2048169691Skan [Define if builtin atomic operations are supported on this host.]) 2049169691Skan enable_atomic_builtins=yes 2050169691Skan atomicity_dir=cpu/generic/atomicity_builtins 2051169691Skan fi 2052169691Skan fi 2053169691Skan CXXFLAGS="$old_CXXFLAGS" 2054169691Skan rm -f conftest* 2055169691Skan 2056169691Skan # Now, if still generic, set to mutex. 2057169691Skan if test $atomicity_dir = "cpu/generic" ; then 2058169691Skan atomicity_dir=cpu/generic/atomicity_mutex 2059169691Skan fi 2060169691Skan AC_LANG_RESTORE 2061169691Skan AC_MSG_RESULT($enable_atomic_builtins) 2062169691Skan]) 2063169691Skan 2064169691Skan 2065169691Skandnl 2066132720Skandnl Check for exception handling support. If an explicit enable/disable 2067132720Skandnl sjlj exceptions is given, we don't have to detect. Otherwise the 2068132720Skandnl target may or may not support call frame exceptions. 2069117397Skandnl 2070132720Skandnl --enable-sjlj-exceptions forces the use of builtin setjmp. 2071132720Skandnl --disable-sjlj-exceptions forces the use of call frame unwinding. 2072132720Skandnl Neither one forces an attempt at detection. 2073117397Skandnl 2074132720Skandnl Defines: 2075132720Skandnl _GLIBCXX_SJLJ_EXCEPTIONS if the compiler is configured for it 2076117397Skandnl 2077132720SkanAC_DEFUN([GLIBCXX_ENABLE_SJLJ_EXCEPTIONS], [ 2078132720Skan AC_MSG_CHECKING([for exception model to use]) 2079132720Skan AC_LANG_SAVE 2080132720Skan AC_LANG_CPLUSPLUS 2081132720Skan GLIBCXX_ENABLE(sjlj-exceptions,auto,, 2082132720Skan [force use of builtin_setjmp for exceptions], 2083132720Skan [permit yes|no|auto]) 2084117397Skan 2085132720Skan if test $enable_sjlj_exceptions = auto; then 2086132720Skan # Botheration. Now we've got to detect the exception model. Link tests 2087132720Skan # against libgcc.a are problematic since we've not been given proper -L 2088132720Skan # bits for single-tree newlib and libgloss. 2089132720Skan # 2090132720Skan # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style. 2091132720Skan cat > conftest.$ac_ext << EOF 2092132720Skan[#]line __oline__ "configure" 2093132720Skanstruct S { ~S(); }; 2094132720Skanvoid bar(); 2095132720Skanvoid foo() 2096132720Skan{ 2097132720Skan S s; 2098132720Skan bar(); 2099132720Skan} 2100132720SkanEOF 2101132720Skan old_CXXFLAGS="$CXXFLAGS" 2102132720Skan CXXFLAGS=-S 2103132720Skan if AC_TRY_EVAL(ac_compile); then 2104132720Skan if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then 2105132720Skan enable_sjlj_exceptions=yes 2106132720Skan elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then 2107132720Skan enable_sjlj_exceptions=no 2108169691Skan elif grep __cxa_end_cleanup conftest.s >/dev/null 2>&1 ; then 2109169691Skan enable_sjlj_exceptions=no 2110132720Skan fi 2111132720Skan fi 2112132720Skan CXXFLAGS="$old_CXXFLAGS" 2113132720Skan rm -f conftest* 2114117397Skan fi 2115117397Skan 2116169691Skan # This is a tad weird, for hysterical raisins. We have to map 2117169691Skan # enable/disable to two different models. 2118132720Skan case $enable_sjlj_exceptions in 2119132720Skan yes) 2120132720Skan AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1, 2121132720Skan [Define if the compiler is configured for setjmp/longjmp exceptions.]) 2122132720Skan ac_exception_model_name=sjlj 2123132720Skan ;; 2124132720Skan no) 2125132720Skan ac_exception_model_name="call frame" 2126132720Skan ;; 2127132720Skan *) 2128132720Skan AC_MSG_ERROR([unable to detect exception model]) 2129132720Skan ;; 2130132720Skan esac 2131132720Skan AC_LANG_RESTORE 2132132720Skan AC_MSG_RESULT($ac_exception_model_name) 213397403Sobrien]) 213497403Sobrien 213597403Sobrien 213697403Sobriendnl 2137169691Skandnl Allow visibility attributes to be used on namespaces, objects, etc. 2138169691Skandnl 2139169691Skandnl --enable-visibility enables attempt to use visibility attributes. 2140169691Skandnl --disable-visibility turns off all use of visibility attributes. 2141169691Skandnl + Usage: GLIBCXX_ENABLE_VISIBILITY[(DEFAULT)] 2142169691Skandnl Where DEFAULT is 'yes'. 2143169691Skandnl 2144169691SkanAC_DEFUN([GLIBCXX_ENABLE_VISIBILITY], [ 2145169691SkanGLIBCXX_ENABLE(visibility,$1,,[enables visibility safe usage]) 2146169691Skan 2147169691Skanif test x$enable_visibility = xyes ; then 2148169691Skan dnl all hail libgfortran 2149169691Skan dnl Check whether the target supports hidden visibility. 2150169691Skan AC_CACHE_CHECK([whether the target supports hidden visibility], 2151169691Skan have_attribute_visibility, [ 2152169691Skan save_CFLAGS="$CFLAGS" 2153169691Skan CFLAGS="$CFLAGS -Werror" 2154169691Skan AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }], 2155169691Skan [], have_attribute_visibility=yes, 2156169691Skan have_attribute_visibility=no) 2157169691Skan CFLAGS="$save_CFLAGS"]) 2158169691Skan if test $have_attribute_visibility = no; then 2159169691Skan enable_visibility=no 2160169691Skan fi 2161169691Skanfi 2162169691Skan 2163169691SkanGLIBCXX_CONDITIONAL(ENABLE_VISIBILITY, test $enable_visibility = yes) 2164169691SkanAC_MSG_NOTICE([visibility supported: $enable_visibility]) 2165169691Skan]) 2166169691Skan 2167169691Skan 2168169691Skandnl 216997403Sobriendnl Add version tags to symbols in shared library (or not), additionally 217097403Sobriendnl marking other symbols as private/local (or not). 217197403Sobriendnl 217297403Sobriendnl --enable-symvers=style adds a version script to the linker call when 217397403Sobriendnl creating the shared library. The choice of version script is 217497403Sobriendnl controlled by 'style'. 217597403Sobriendnl --disable-symvers does not. 2176132720Skandnl + Usage: GLIBCXX_ENABLE_SYMVERS[(DEFAULT)] 2177132720Skandnl Where DEFAULT is either 'yes' or 'no'. Passing `yes' tries to 2178132720Skandnl choose a default style based on linker characteristics. Passing 2179132720Skandnl 'no' disables versioning. 2180132720Skandnl 2181132720SkanAC_DEFUN([GLIBCXX_ENABLE_SYMVERS], [ 218297403Sobrien 2183132720SkanGLIBCXX_ENABLE(symvers,$1,[=STYLE], 2184132720Skan [enables symbol versioning of the shared library], 2185169691Skan [permit yes|no|gnu|gnu-versioned-namespace|darwin|darwin-export]) 2186132720Skan 2187132720Skan# If we never went through the GLIBCXX_CHECK_LINKER_FEATURES macro, then we 2188132720Skan# don't know enough about $LD to do tricks... 2189132720SkanAC_REQUIRE([GLIBCXX_CHECK_LINKER_FEATURES]) 2190169691Skan 2191169691Skan# Turn a 'yes' into a suitable default. 2192169691Skanif test x$enable_symvers = xyes ; then 2193169691Skan if test $enable_shared = no || test "x$LD" = x || test x$gcc_no_link = xyes; then 2194169691Skan enable_symvers=no 2195169691Skan else 2196169691Skan if test $with_gnu_ld = yes ; then 2197169691Skan enable_symvers=gnu 2198169691Skan else 2199169691Skan case ${target_os} in 2200169691Skan darwin*) 2201169691Skan enable_symvers=darwin ;; 2202169691Skan *) 2203169691Skan enable_symvers=no ;; 2204169691Skan esac 2205169691Skan fi 2206169691Skan fi 220797403Sobrienfi 220897403Sobrien 2209169691Skan# Check to see if 'darwin' or 'darwin-export' can win. 2210169691Skanif test x$enable_symvers = xdarwin-export ; then 2211169691Skan enable_symvers=darwin 2212169691Skanfi 2213169691Skan 2214169691Skan# Check to see if 'gnu' can win. 2215169691Skanif test $enable_symvers = gnu || test $enable_symvers = gnu-versioned-namespace; then 2216169691Skan # Check to see if libgcc_s exists, indicating that shared libgcc is possible. 2217117397Skan AC_MSG_CHECKING([for shared libgcc]) 2218117397Skan ac_save_CFLAGS="$CFLAGS" 2219117397Skan CFLAGS=' -lgcc_s' 2220132720Skan AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes, glibcxx_shared_libgcc=no) 2221117397Skan CFLAGS="$ac_save_CFLAGS" 2222132720Skan if test $glibcxx_shared_libgcc = no; then 2223132720Skan cat > conftest.c <<EOF 2224132720Skanint main (void) { return 0; } 2225132720SkanEOF 2226132720Skanchangequote(,)dnl 2227132720Skan glibcxx_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \ 2228132720Skan -shared -shared-libgcc -o conftest.so \ 2229132720Skan conftest.c -v 2>&1 >/dev/null \ 2230132720Skan | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'` 2231132720Skanchangequote([,])dnl 2232132720Skan rm -f conftest.c conftest.so 2233132720Skan if test x${glibcxx_libgcc_s_suffix+set} = xset; then 2234132720Skan CFLAGS=" -lgcc_s$glibcxx_libgcc_s_suffix" 2235132720Skan AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes) 2236132720Skan CFLAGS="$ac_save_CFLAGS" 2237132720Skan fi 2238132720Skan fi 2239132720Skan AC_MSG_RESULT($glibcxx_shared_libgcc) 224097403Sobrien 2241169691Skan # For GNU ld, we need at least this version. The format is described in 2242169691Skan # GLIBCXX_CHECK_LINKER_FEATURES above. 2243169691Skan glibcxx_min_gnu_ld_version=21400 224497403Sobrien 2245169691Skan # If no shared libgcc, can't win. 2246169691Skan if test $glibcxx_shared_libgcc != yes; then 2247169691Skan AC_MSG_WARN([=== You have requested GNU symbol versioning, but]) 2248169691Skan AC_MSG_WARN([=== you are not building a shared libgcc_s.]) 2249169691Skan AC_MSG_WARN([=== Symbol versioning will be disabled.]) 2250169691Skan enable_symvers=no 2251169691Skan elif test $with_gnu_ld != yes ; then 225297403Sobrien # just fail for now 2253169691Skan AC_MSG_WARN([=== You have requested GNU symbol versioning, but]) 2254169691Skan AC_MSG_WARN([=== you are not using the GNU linker.]) 2255132720Skan AC_MSG_WARN([=== Symbol versioning will be disabled.]) 225697403Sobrien enable_symvers=no 2257169691Skan elif test $glibcxx_gnu_ld_version -lt $glibcxx_min_gnu_ld_version ; then 2258169691Skan # The right tools, the right setup, but too old. Fallbacks? 2259169691Skan AC_MSG_WARN(=== Linker version $glibcxx_gnu_ld_version is too old for) 2260169691Skan AC_MSG_WARN(=== full symbol versioning support in this release of GCC.) 2261169691Skan AC_MSG_WARN(=== You would need to upgrade your binutils to version) 2262169691Skan AC_MSG_WARN(=== $glibcxx_min_gnu_ld_version or later and rebuild GCC.) 2263169691Skan AC_MSG_WARN([=== Symbol versioning will be disabled.]) 2264169691Skan enable_symvers=no 226597403Sobrien fi 226697403Sobrienfi 226797403Sobrien 2268132720Skan# Everything parsed; figure out what file to use. 226997403Sobriencase $enable_symvers in 227097403Sobrien no) 2271169691Skan SYMVER_FILE=config/abi/pre/none.ver 2272132720Skan ;; 227397403Sobrien gnu) 2274169691Skan SYMVER_FILE=config/abi/pre/gnu.ver 2275169691Skan AC_DEFINE(_GLIBCXX_SYMVER_GNU, 1, 2276169691Skan [Define to use GNU versioning in the shared library.]) 2277132720Skan ;; 2278169691Skan gnu-versioned-namespace) 2279169691Skan SYMVER_FILE=config/abi/pre/gnu-versioned-namespace.ver 2280169691Skan AC_DEFINE(_GLIBCXX_SYMVER_GNU_NAMESPACE, 1, 2281169691Skan [Define to use GNU namespace versioning in the shared library.]) 2282169691Skan ;; 2283169691Skan darwin) 2284169691Skan SYMVER_FILE=config/abi/pre/gnu.ver 2285169691Skan AC_DEFINE(_GLIBCXX_SYMVER_DARWIN, 1, 2286169691Skan [Define to use darwin versioning in the shared library.]) 2287169691Skan ;; 228897403Sobrienesac 228997403Sobrien 2290169691Skanif test x$enable_symvers != xno ; then 2291169691Skan AC_DEFINE(_GLIBCXX_SYMVER, 1, 2292169691Skan [Define to use symbol versioning in the shared library.]) 2293169691Skanfi 2294169691Skan 2295169691SkanAC_SUBST(SYMVER_FILE) 2296132720SkanAC_SUBST(port_specific_symbol_files) 2297169691SkanGLIBCXX_CONDITIONAL(ENABLE_SYMVERS, test $enable_symvers != no) 2298169691SkanGLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU, test $enable_symvers = gnu) 2299169691SkanGLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU_NAMESPACE, test $enable_symvers = gnu-versioned-namespace) 2300169691SkanGLIBCXX_CONDITIONAL(ENABLE_SYMVERS_DARWIN, test $enable_symvers = darwin) 2301132720SkanAC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers) 2302169691Skan 2303169691Skan# Now, set up compatibility support, if any. 2304169691Skan# In addition, need this to deal with std::size_t mangling in 2305169691Skan# src/compatibility.cc. In a perfect world, could use 2306169691Skan# typeid(std::size_t).name()[0] to do direct substitution. 2307169691SkanAC_MSG_CHECKING([for size_t as unsigned int]) 2308169691Skanac_save_CFLAGS="$CFLAGS" 2309169691SkanCFLAGS="-Werror" 2310169691SkanAC_TRY_COMPILE(, [__SIZE_TYPE__* stp; unsigned int* uip; stp = uip;], 2311169691Skan [glibcxx_size_t_is_i=yes], [glibcxx_size_t_is_i=no]) 2312169691SkanCFLAGS=$ac_save_CFLAGS 2313169691Skanif test "$glibcxx_size_t_is_i" = yes; then 2314169691Skan AC_DEFINE(_GLIBCXX_SIZE_T_IS_UINT, 1, [Define if size_t is unsigned int.]) 2315169691Skanfi 2316169691SkanAC_MSG_RESULT([$glibcxx_size_t_is_i]) 2317169691Skan 2318169691SkanAC_MSG_CHECKING([for ptrdiff_t as int]) 2319169691Skanac_save_CFLAGS="$CFLAGS" 2320169691SkanCFLAGS="-Werror" 2321169691SkanAC_TRY_COMPILE(, [__PTRDIFF_TYPE__* ptp; int* ip; ptp = ip;], 2322169691Skan [glibcxx_ptrdiff_t_is_i=yes], [glibcxx_ptrdiff_t_is_i=no]) 2323169691SkanCFLAGS=$ac_save_CFLAGS 2324169691Skanif test "$glibcxx_ptrdiff_t_is_i" = yes; then 2325169691Skan AC_DEFINE(_GLIBCXX_PTRDIFF_T_IS_INT, 1, [Define if ptrdiff_t is int.]) 2326169691Skanfi 2327169691SkanAC_MSG_RESULT([$glibcxx_ptrdiff_t_is_i]) 232897403Sobrien]) 232997403Sobrien 2330132720Skan 2331132720Skandnl 2332132720Skandnl Setup to use the gcc gthr.h thread-specific memory and mutex model. 2333132720Skandnl We must stage the required headers so that they will be installed 2334132720Skandnl with the library (unlike libgcc, the STL implementation is provided 2335132720Skandnl solely within headers). Since we must not inject random user-space 2336132720Skandnl macro names into user-provided C++ code, we first stage into <file>-in 2337132720Skandnl and process to <file> with an output command. The reason for a two- 2338132720Skandnl stage process here is to correctly handle $srcdir!=$objdir without 2339132720Skandnl having to write complex code (the sed commands to clean the macro 2340132720Skandnl namespace are complex and fragile enough as it is). We must also 2341132720Skandnl add a relative path so that -I- is supported properly. 2342132720Skandnl 2343132720Skandnl Substs: 2344132720Skandnl glibcxx_thread_h 2345132720Skandnl 2346132720Skandnl Defines: 2347132720Skandnl HAVE_GTHR_DEFAULT 2348132720Skandnl 2349132720SkanAC_DEFUN([GLIBCXX_ENABLE_THREADS], [ 2350132720Skan AC_MSG_CHECKING([for thread model used by GCC]) 2351132720Skan target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'` 2352132720Skan AC_MSG_RESULT([$target_thread_file]) 2353132720Skan 2354132720Skan if test $target_thread_file != single; then 2355169691Skan AC_DEFINE(HAVE_GTHR_DEFAULT, 1, 2356169691Skan [Define if gthr-default.h exists 2357169691Skan (meaning that threading support is enabled).]) 2358132720Skan fi 2359132720Skan 2360132720Skan glibcxx_thread_h=gthr-$target_thread_file.h 2361169691Skan 2362169691Skan dnl Check for __GTHREADS define. 2363169691Skan gthread_file=${toplevel_srcdir}/gcc/${glibcxx_thread_h} 2364169691Skan if grep __GTHREADS $gthread_file >/dev/null 2>&1 ; then 2365169691Skan enable_thread=yes 2366169691Skan else 2367169691Skan enable_thread=no 2368169691Skan fi 2369169691Skan 2370132720Skan AC_SUBST(glibcxx_thread_h) 2371132720Skan]) 2372132720Skan 2373132720Skan 2374132720Skan# Check whether LC_MESSAGES is available in <locale.h>. 2375132720Skan# Ulrich Drepper <drepper@cygnus.com>, 1995. 2376132720Skan# 2377132720Skan# This file file be copied and used freely without restrictions. It can 2378132720Skan# be used in projects which are not available under the GNU Public License 2379132720Skan# but which still want to provide support for the GNU gettext functionality. 2380132720Skan# Please note that the actual code is *not* freely available. 2381132720Skan 2382132720Skan# serial 1 2383132720SkanAC_DEFUN([AC_LC_MESSAGES], [ 2384132720Skan AC_CHECK_HEADER(locale.h, [ 2385132720Skan AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES, 2386132720Skan [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], 2387132720Skan ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)]) 2388132720Skan if test $ac_cv_val_LC_MESSAGES = yes; then 2389169691Skan AC_DEFINE(HAVE_LC_MESSAGES, 1, 2390169691Skan [Define if LC_MESSAGES is available in <locale.h>.]) 2391132720Skan fi 2392132720Skan ]) 2393132720Skan]) 2394132720Skan 2395169691Skan# Macros from the top-level gcc directory. 2396169691Skanm4_include([../config/tls.m4]) 2397132720Skan 2398