acinclude.m4 revision 102782
1dnl 2dnl Initialize configure bits. 3dnl 4dnl GLIBCPP_TOPREL_CONFIGURE 5AC_DEFUN(GLIBCPP_TOPREL_CONFIGURE, [ 6 dnl Default to --enable-multilib (this is also passed by default 7 dnl from the ubercommon-top-level configure) 8 AC_ARG_ENABLE(multilib, 9 [ --enable-multilib build hella library versions (default)], 10 [case "${enableval}" in 11 yes) multilib=yes ;; 12 no) multilib=no ;; 13 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;; 14 esac], [multilib=yes])dnl 15 16 # When building with srcdir == objdir, links to the source files will 17 # be created in directories within the target_subdir. We have to 18 # adjust toplevel_srcdir accordingly, so that configure finds 19 # install-sh and other auxiliary files that live in the top-level 20 # source directory. 21 if test "${srcdir}" = "."; then 22 if test -z "${with_target_subdir}"; then 23 toprel=".." 24 else 25 if test "${with_target_subdir}" != "."; then 26 toprel="${with_multisrctop}../.." 27 else 28 toprel="${with_multisrctop}.." 29 fi 30 fi 31 else 32 toprel=".." 33 fi 34 AC_CONFIG_AUX_DIR(${srcdir}/$toprel) 35 toplevel_srcdir=\${top_srcdir}/$toprel 36 AC_SUBST(toplevel_srcdir) 37]) 38 39dnl 40dnl Initialize configure bits. 41dnl 42dnl GLIBCPP_CONFIGURE 43AC_DEFUN(GLIBCPP_CONFIGURE, [ 44 45#possibly test for the presence of the compiler sources here? 46 47 # Export build and source directories. 48 # These need to be absolute paths, yet at the same time need to 49 # canonicalize only relative paths, because then amd will not unmount 50 # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd. 51 glibcpp_builddir=`${PWDCMD-pwd}` 52 case $srcdir in 53 [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;; 54 *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;; 55 esac 56 AC_SUBST(glibcpp_builddir) 57 AC_SUBST(glibcpp_srcdir) 58 59 dnl This is here just to satisfy automake. 60 ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)]) 61 62 AC_PROG_AWK 63 # Will set LN_S to either 'ln -s' or 'ln'. With autoconf 2.5x, can also 64 # be 'cp -p' if linking isn't available. Uncomment the next line to 65 # force a particular method. 66 #ac_cv_prog_LN_S='cp -p' 67 AC_PROG_LN_S 68 69 # We use these options to decide which functions to include. 70 AC_ARG_WITH(target-subdir, 71 [ --with-target-subdir=SUBDIR 72 configuring in a subdirectory]) 73 AC_ARG_WITH(cross-host, 74 [ --with-cross-host=HOST configuring with a cross compiler]) 75 76 glibcpp_basedir=$srcdir/$toprel/$1/libstdc++-v3 77 AC_SUBST(glibcpp_basedir) 78 79 # Never versions of autoconf add an underscore to these functions. 80 # Prevent future problems ... 81 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))]) 82 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))]) 83 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))]) 84 ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))]) 85 86 # AC_PROG_CC 87 # FIXME: We temporarily define our own version of AC_PROG_CC. This is 88 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We 89 # are probably using a cross compiler, which will not be able to fully 90 # link an executable. This is addressed in later versions of autoconf. 91 92 AC_DEFUN(LIB_AC_PROG_CC, 93 [AC_BEFORE([$0], [AC_PROG_CPP])dnl 94 dnl Fool anybody using AC_PROG_CC. 95 AC_PROVIDE([AC_PROG_CC]) 96 AC_CHECK_PROG(CC, gcc, gcc) 97 if test -z "$CC"; then 98 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) 99 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) 100 fi 101 102 AC_PROG_CC_GNU 103 104 if test $ac_cv_prog_gcc = yes; then 105 GCC=yes 106 dnl Check whether -g works, even if CFLAGS is set, in case the package 107 dnl plays around with CFLAGS (such as to build both debugging and 108 dnl normal versions of a library), tasteless as that idea is. 109 ac_test_CFLAGS="${CFLAGS+set}" 110 ac_save_CFLAGS="$CFLAGS" 111 CFLAGS= 112 AC_PROG_CC_G 113 if test "$ac_test_CFLAGS" = set; then 114 CFLAGS="$ac_save_CFLAGS" 115 elif test $ac_cv_prog_cc_g = yes; then 116 CFLAGS="-g -O2" 117 else 118 CFLAGS="-O2" 119 fi 120 else 121 GCC= 122 test "${CFLAGS+set}" = set || CFLAGS="-g" 123 fi 124 ]) 125 126 LIB_AC_PROG_CC 127 128 # Likewise for AC_PROG_CXX. We can't just call it directly because g++ 129 # will try to link in libstdc++. 130 AC_DEFUN(LIB_AC_PROG_CXX, 131 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl 132 dnl Fool anybody using AC_PROG_CXX. 133 AC_PROVIDE([AC_PROG_CXX]) 134 # Use glibcpp_CXX so that we do not cause CXX to be cached with the 135 # flags that come in CXX while configuring libstdc++. They're different 136 # from those used for all other target libraries. If CXX is set in 137 # the environment, respect that here. 138 glibcpp_CXX=$CXX 139 AC_CHECK_PROGS(glibcpp_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc) 140 AC_SUBST(glibcpp_CXX) 141 CXX=$glibcpp_CXX 142 test -z "$glibcpp_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH]) 143 144 AC_PROG_CXX_GNU 145 146 if test $ac_cv_prog_gxx = yes; then 147 GXX=yes 148 dnl Check whether -g works, even if CXXFLAGS is set, in case the package 149 dnl plays around with CXXFLAGS (such as to build both debugging and 150 dnl normal versions of a library), tasteless as that idea is. 151 ac_test_CXXFLAGS="${CXXFLAGS+set}" 152 ac_save_CXXFLAGS="$CXXFLAGS" 153 CXXFLAGS= 154 AC_PROG_CXX_G 155 if test "$ac_test_CXXFLAGS" = set; then 156 CXXFLAGS="$ac_save_CXXFLAGS" 157 elif test $ac_cv_prog_cxx_g = yes; then 158 CXXFLAGS="-g -O2" 159 else 160 CXXFLAGS="-O2" 161 fi 162 else 163 GXX= 164 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g" 165 fi 166 ]) 167 168 LIB_AC_PROG_CXX 169 170 # For directory versioning (e.g., headers) and other variables. 171 AC_MSG_CHECKING([for GCC version number]) 172 gcc_version=`$glibcpp_CXX -dumpversion` 173 AC_MSG_RESULT($gcc_version) 174 175 # For some reason, gettext needs this. 176 AC_ISC_POSIX 177 178 AC_CHECK_TOOL(AS, as) 179 AC_CHECK_TOOL(AR, ar) 180 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error) 181 AC_PROG_INSTALL 182 183 AM_MAINTAINER_MODE 184 185 # We need AC_EXEEXT to keep automake happy in cygnus mode. However, 186 # at least currently, we never actually build a program, so we never 187 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally 188 # fails, because we are probably configuring with a cross compiler 189 # which can't create executables. So we include AC_EXEEXT to keep 190 # automake happy, but we don't execute it, since we don't care about 191 # the result. 192 if false; then 193 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands 194 # to nothing, so nothing would remain between `then' and `fi' if it 195 # were not for the `:' below. 196 : 197 AC_EXEEXT 198 fi 199 200 case [$]{glibcpp_basedir} in 201 /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;; 202 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;; 203 esac 204 205 # Find platform-specific directories containing configuration info. In 206 # addition to possibly modifying the same flags, it also sets up symlinks. 207 GLIBCPP_CHECK_TARGET 208]) 209 210 211dnl 212dnl Check to see if g++ can compile this library, and if so, if any version- 213dnl specific precautions need to be taken. 214dnl 215dnl GLIBCPP_CHECK_COMPILER_VERSION 216AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [ 217if test ! -f stamp-sanity-compiler; then 218 AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3]) 219 AC_LANG_SAVE 220 AC_LANG_CPLUSPLUS 221 AC_TRY_COMPILE(, [ 222 #if __GNUC__ < 3 223 not_ok 224 #endif 225 ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to GCC 3.0 or above])) 226 AC_LANG_RESTORE 227 AC_MSG_RESULT($gpp_satisfactory) 228 touch stamp-sanity-compiler 229fi 230]) 231 232 233dnl 234dnl Tests for newer compiler features, or features that are present in newer 235dnl compiler versions but not older compiler versions still in use, should 236dnl be placed here. 237dnl 238dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the 239dnl new inlining code or the new system_header pragma will die on -Werror. 240dnl Leave it out by default and use maint-mode to use it. 241dnl 242dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if 243dnl compiler supports it and the user has not requested debug mode. 244dnl 245dnl GLIBCPP_CHECK_COMPILER_FEATURES 246AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [ 247 # All these tests are for C++; save the language and the compiler flags. 248 # The CXXFLAGS thing is suspicious, but based on similar bits previously 249 # found in GLIBCPP_CONFIGURE. 250 AC_LANG_SAVE 251 AC_LANG_CPLUSPLUS 252 ac_test_CXXFLAGS="${CXXFLAGS+set}" 253 ac_save_CXXFLAGS="$CXXFLAGS" 254 255 # Check for maintainer-mode bits. 256 if test x"$USE_MAINTAINER_MODE" = xno; then 257 WERROR='' 258 else 259 WERROR='-Werror' 260 fi 261 262 # Check for -ffunction-sections -fdata-sections 263 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections]) 264 CXXFLAGS='-Werror -ffunction-sections -fdata-sections' 265 AC_TRY_COMPILE(, [int foo; 266 ], [ac_fdsections=yes], [ac_fdsections=no]) 267 if test "$ac_test_CXXFLAGS" = set; then 268 CXXFLAGS="$ac_save_CXXFLAGS" 269 else 270 # this is the suspicious part 271 CXXFLAGS='' 272 fi 273 if test x"$ac_fdsections" = x"yes" && 274 test x"$enable_debug" = x"no"; then 275 SECTION_FLAGS='-ffunction-sections -fdata-sections' 276 fi 277 AC_MSG_RESULT($ac_fdsections) 278 279 AC_LANG_RESTORE 280 AC_SUBST(WERROR) 281 AC_SUBST(SECTION_FLAGS) 282]) 283 284 285dnl 286dnl If GNU ld is in use, check to see if tricky linker opts can be used. If 287dnl the native linker is in use, all variables will be defined to something 288dnl safe (like an empty string). 289dnl 290dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible. 291dnl Define OPT_LDFLAGS='-Wl,-O1' if possible. 292dnl Define LD, with_gnu_ld, and (possibly) glibcpp_gnu_ld_version as 293dnl side-effects of testing. 294dnl 295dnl GLIBCPP_CHECK_LINKER_FEATURES 296AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [ 297 # If we're not using GNU ld, then there's no point in even trying these 298 # tests. Check for that first. We should have already tested for gld 299 # by now (in libtool), but require it now just to be safe... 300 test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS='' 301 test -z "$OPT_LDFLAGS" && OPT_LDFLAGS='' 302 AC_REQUIRE([AC_PROG_LD]) 303 304 # The name set by libtool depends on the version of libtool. Shame on us 305 # for depending on an impl detail, but c'est la vie. Older versions used 306 # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on 307 # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually 308 # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't 309 # set (hence we're using an older libtool), then set it. 310 if test x${with_gnu_ld+set} != xset; then 311 if test x${ac_cv_prog_gnu_ld+set} != xset; then 312 # We got through "ac_require(ac_prog_ld)" and still not set? Huh? 313 with_gnu_ld=no 314 else 315 with_gnu_ld=$ac_cv_prog_gnu_ld 316 fi 317 fi 318 319 # Start by getting the version number. I think the libtool test already 320 # does some of this, but throws away the result. 321 changequote(,) 322 ldver=`$LD --version 2>/dev/null | head -1 | \ 323 sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'` 324 changequote([,]) 325 glibcpp_gnu_ld_version=`echo $ldver | \ 326 $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'` 327 328 # Set --gc-sections. 329 if test "$with_gnu_ld" = "notbroken"; then 330 # GNU ld it is! Joy and bunny rabbits! 331 332 # All these tests are for C++; save the language and the compiler flags. 333 # Need to do this so that g++ won't try to link in libstdc++ 334 ac_test_CFLAGS="${CFLAGS+set}" 335 ac_save_CFLAGS="$CFLAGS" 336 CFLAGS='-x c++ -Wl,--gc-sections' 337 338 # Check for -Wl,--gc-sections 339 # XXX This test is broken at the moment, as symbols required for 340 # linking are now in libsupc++ (not built yet.....). In addition, 341 # this test has cored on solaris in the past. In addition, 342 # --gc-sections doesn't really work at the moment (keeps on discarding 343 # used sections, first .eh_frame and now some of the glibc sections for 344 # iconv). Bzzzzt. Thanks for playing, maybe next time. 345 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections]) 346 AC_TRY_RUN([ 347 int main(void) 348 { 349 try { throw 1; } 350 catch (...) { }; 351 return 0; 352 } 353 ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes]) 354 if test "$ac_test_CFLAGS" = set; then 355 CFLAGS="$ac_save_CFLAGS" 356 else 357 # this is the suspicious part 358 CFLAGS='' 359 fi 360 if test "$ac_sectionLDflags" = "yes"; then 361 SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" 362 fi 363 AC_MSG_RESULT($ac_sectionLDflags) 364 fi 365 366 # Set linker optimization flags. 367 if test x"$with_gnu_ld" = x"yes" && test x"$enable_debug" = x"no"; then 368 OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS" 369 fi 370 371 AC_SUBST(SECTION_LDFLAGS) 372 AC_SUBST(OPT_LDFLAGS) 373]) 374 375 376dnl 377dnl Check to see if the (math function) argument passed is 378dnl declared when using the c++ compiler 379dnl ASSUMES argument is a math function with ONE parameter 380dnl 381dnl GLIBCPP_CHECK_MATH_DECL_1 382AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [ 383 AC_MSG_CHECKING([for $1 declaration]) 384 if test x${glibcpp_cv_func_$1_use+set} != xset; then 385 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ 386 AC_LANG_SAVE 387 AC_LANG_CPLUSPLUS 388 AC_TRY_COMPILE([#include <math.h> 389 #ifdef HAVE_IEEEFP_H 390 #include <ieeefp.h> 391 #endif 392 ], 393 [ $1(0);], 394 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) 395 AC_LANG_RESTORE 396 ]) 397 fi 398 AC_MSG_RESULT($glibcpp_cv_func_$1_use) 399]) 400 401dnl 402dnl Check to see if the (math function) argument passed is 403dnl 1) declared when using the c++ compiler 404dnl 2) has "C" linkage 405dnl 3) if not, see if 1) and 2) for argument prepended with '_' 406dnl 407dnl Define HAVE_CARGF etc if "cargf" is declared and links 408dnl 409dnl argument 1 is name of function to check 410dnl 411dnl ASSUMES argument is a math function with ONE parameter 412dnl 413dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1 414AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [ 415 GLIBCPP_CHECK_MATH_DECL_1($1) 416 if test x$glibcpp_cv_func_$1_use = x"yes"; then 417 AC_CHECK_FUNCS($1) 418 else 419 GLIBCPP_CHECK_MATH_DECL_1(_$1) 420 if test x$glibcpp_cv_func__$1_use = x"yes"; then 421 AC_CHECK_FUNCS(_$1) 422 fi 423 fi 424]) 425 426 427dnl 428dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of 429dnl of functions at once. It's an all-or-nothing check -- either 430dnl HAVE_XYZ is defined for each of the functions, or for none of them. 431dnl Doing it this way saves significant configure time. 432AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [ 433 AC_MSG_CHECKING([for $1 functions]) 434 AC_CACHE_VAL(glibcpp_cv_func_$2_use, [ 435 AC_LANG_SAVE 436 AC_LANG_CPLUSPLUS 437 AC_TRY_COMPILE([#include <math.h>], 438 [ `for x in $3; do echo "$x (0);"; done` ], 439 [glibcpp_cv_func_$2_use=yes], 440 [glibcpp_cv_func_$2_use=no]) 441 AC_LANG_RESTORE]) 442 AC_MSG_RESULT($glibcpp_cv_func_$2_use) 443 if test x$glibcpp_cv_func_$2_use = x"yes"; then 444 AC_CHECK_FUNCS($3) 445 fi 446]) 447 448dnl 449dnl Check to see if the (math function) argument passed is 450dnl declared when using the c++ compiler 451dnl ASSUMES argument is a math function with TWO parameters 452dnl 453dnl GLIBCPP_CHECK_MATH_DECL_2 454AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [ 455 AC_MSG_CHECKING([for $1 declaration]) 456 if test x${glibcpp_cv_func_$1_use+set} != xset; then 457 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ 458 AC_LANG_SAVE 459 AC_LANG_CPLUSPLUS 460 AC_TRY_COMPILE([#include <math.h>], 461 [ $1(0, 0);], 462 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) 463 AC_LANG_RESTORE 464 ]) 465 fi 466 AC_MSG_RESULT($glibcpp_cv_func_$1_use) 467]) 468 469dnl 470dnl Check to see if the (math function) argument passed is 471dnl 1) declared when using the c++ compiler 472dnl 2) has "C" linkage 473dnl 474dnl Define HAVE_CARGF etc if "cargf" is declared and links 475dnl 476dnl argument 1 is name of function to check 477dnl 478dnl ASSUMES argument is a math function with TWO parameters 479dnl 480dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2 481AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [ 482 GLIBCPP_CHECK_MATH_DECL_2($1) 483 if test x$glibcpp_cv_func_$1_use = x"yes"; then 484 AC_CHECK_FUNCS($1) 485 else 486 GLIBCPP_CHECK_MATH_DECL_2(_$1) 487 if test x$glibcpp_cv_func__$1_use = x"yes"; then 488 AC_CHECK_FUNCS(_$1) 489 fi 490 fi 491]) 492 493 494dnl 495dnl Check to see if the (math function) argument passed is 496dnl declared when using the c++ compiler 497dnl ASSUMES argument is a math function with THREE parameters 498dnl 499dnl GLIBCPP_CHECK_MATH_DECL_3 500AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [ 501 AC_MSG_CHECKING([for $1 declaration]) 502 if test x${glibcpp_cv_func_$1_use+set} != xset; then 503 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ 504 AC_LANG_SAVE 505 AC_LANG_CPLUSPLUS 506 AC_TRY_COMPILE([#include <math.h>], 507 [ $1(0, 0, 0);], 508 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) 509 AC_LANG_RESTORE 510 ]) 511 fi 512 AC_MSG_RESULT($glibcpp_cv_func_$1_use) 513]) 514 515dnl 516dnl Check to see if the (math function) argument passed is 517dnl 1) declared when using the c++ compiler 518dnl 2) has "C" linkage 519dnl 520dnl Define HAVE_CARGF etc if "cargf" is declared and links 521dnl 522dnl argument 1 is name of function to check 523dnl 524dnl ASSUMES argument is a math function with THREE parameters 525dnl 526dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3 527AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [ 528 GLIBCPP_CHECK_MATH_DECL_3($1) 529 if test x$glibcpp_cv_func_$1_use = x"yes"; then 530 AC_CHECK_FUNCS($1) 531 else 532 GLIBCPP_CHECK_MATH_DECL_3(_$1) 533 if test x$glibcpp_cv_func__$1_use = x"yes"; then 534 AC_CHECK_FUNCS(_$1) 535 fi 536 fi 537]) 538 539 540dnl 541dnl Check to see if the (stdlib function) argument passed is 542dnl 1) declared when using the c++ compiler 543dnl 2) has "C" linkage 544dnl 545dnl argument 1 is name of function to check 546dnl 547dnl ASSUMES argument is a math function with TWO parameters 548dnl 549dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2 550AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [ 551 AC_MSG_CHECKING([for $1 declaration]) 552 if test x${glibcpp_cv_func_$1_use+set} != xset; then 553 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ 554 AC_LANG_SAVE 555 AC_LANG_CPLUSPLUS 556 AC_TRY_COMPILE([#include <stdlib.h>], 557 [ $1(0, 0);], 558 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) 559 AC_LANG_RESTORE 560 ]) 561 fi 562 AC_MSG_RESULT($glibcpp_cv_func_$1_use) 563 if test x$glibcpp_cv_func_$1_use = x"yes"; then 564 AC_CHECK_FUNCS($1) 565 fi 566]) 567 568 569dnl 570dnl Check to see if the (stdlib function) argument passed is 571dnl 1) declared when using the c++ compiler 572dnl 2) has "C" linkage 573dnl 574dnl argument 1 is name of function to check 575dnl 576dnl ASSUMES argument is a function with THREE parameters 577dnl 578dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3 579AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3, [ 580 AC_MSG_CHECKING([for $1 declaration]) 581 if test x${glibcpp_cv_func_$1_use+set} != xset; then 582 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ 583 AC_LANG_SAVE 584 AC_LANG_CPLUSPLUS 585 AC_TRY_COMPILE([#include <stdlib.h>], 586 [ $1(0, 0, 0);], 587 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) 588 AC_LANG_RESTORE 589 ]) 590 fi 591 AC_MSG_RESULT($glibcpp_cv_func_$1_use) 592 if test x$glibcpp_cv_func_$1_use = x"yes"; then 593 AC_CHECK_FUNCS($1) 594 fi 595]) 596 597 598dnl 599dnl Because the builtins are picky picky picky about the arguments they take, 600dnl do an explict linkage tests here. 601dnl Check to see if the (math function) argument passed is 602dnl 1) declared when using the c++ compiler 603dnl 2) has "C" linkage 604dnl 605dnl Define HAVE_CARGF etc if "cargf" is declared and links 606dnl 607dnl argument 1 is name of function to check 608dnl 609dnl ASSUMES argument is a math function with ONE parameter 610dnl 611dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1 612AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [ 613 AC_MSG_CHECKING([for $1 declaration]) 614 if test x${glibcpp_cv_func_$1_use+set} != xset; then 615 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ 616 AC_LANG_SAVE 617 AC_LANG_CPLUSPLUS 618 AC_TRY_COMPILE([#include <math.h>], 619 [ $1(0);], 620 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) 621 AC_LANG_RESTORE 622 ]) 623 fi 624 AC_MSG_RESULT($glibcpp_cv_func_$1_use) 625 if test x$glibcpp_cv_func_$1_use = x"yes"; then 626 AC_MSG_CHECKING([for $1 linkage]) 627 if test x${glibcpp_cv_func_$1_link+set} != xset; then 628 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [ 629 AC_TRY_LINK([#include <math.h>], 630 [ $1(0);], 631 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no]) 632 ]) 633 fi 634 AC_MSG_RESULT($glibcpp_cv_func_$1_link) 635 if test x$glibcpp_cv_func_$1_link = x"yes"; then 636 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` 637 AC_DEFINE_UNQUOTED(${ac_tr_func}) 638 fi 639 fi 640]) 641 642 643dnl 644dnl Check to see what builtin math functions are supported 645dnl 646dnl check for __builtin_abs 647dnl check for __builtin_fabsf 648dnl check for __builtin_fabs 649dnl check for __builtin_fabl 650dnl check for __builtin_labs 651dnl check for __builtin_sqrtf 652dnl check for __builtin_sqrtl 653dnl check for __builtin_sqrt 654dnl check for __builtin_sinf 655dnl check for __builtin_sin 656dnl check for __builtin_sinl 657dnl check for __builtin_cosf 658dnl check for __builtin_cos 659dnl check for __builtin_cosl 660dnl 661dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT 662AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [ 663 dnl Test for builtin math functions. 664 dnl These are made in gcc/c-common.c 665 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs) 666 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf) 667 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs) 668 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl) 669 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs) 670 671 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf) 672 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrt) 673 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl) 674 675 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf) 676 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin) 677 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl) 678 679 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf) 680 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos) 681 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl) 682 683 dnl There is, without a doubt, a more elegant way to have these 684 dnl names exported so that they won't be stripped out of acconfig.h by 685 dnl autoheader. I leave this as an exercise to somebody less frustrated 686 dnl than I.... please email the libstdc++ list if you can figure out a 687 dnl more elegant approach (see autoconf/acgen.m4 and specifically 688 dnl AC_CHECK_FUNC for things to steal.) 689 dummyvar=no 690 if test x$dummyvar = x"yes"; then 691 AC_DEFINE(HAVE___BUILTIN_ABS) 692 AC_DEFINE(HAVE___BUILTIN_LABS) 693 AC_DEFINE(HAVE___BUILTIN_COS) 694 AC_DEFINE(HAVE___BUILTIN_COSF) 695 AC_DEFINE(HAVE___BUILTIN_COSL) 696 AC_DEFINE(HAVE___BUILTIN_FABS) 697 AC_DEFINE(HAVE___BUILTIN_FABSF) 698 AC_DEFINE(HAVE___BUILTIN_FABSL) 699 AC_DEFINE(HAVE___BUILTIN_SIN) 700 AC_DEFINE(HAVE___BUILTIN_SINF) 701 AC_DEFINE(HAVE___BUILTIN_SINL) 702 AC_DEFINE(HAVE___BUILTIN_SQRT) 703 AC_DEFINE(HAVE___BUILTIN_SQRTF) 704 AC_DEFINE(HAVE___BUILTIN_SQRTL) 705 fi 706]) 707 708 709dnl 710dnl Check to see what the underlying c library 711dnl These checks need to do two things: 712dnl 1) make sure the name is declared when using the c++ compiler 713dnl 2) make sure the name has "C" linkage 714dnl This might seem like overkill but experience has shown that it's not... 715dnl 716dnl Define HAVE_STRTOLD if "strtold" is declared and links 717dnl Define HAVE_STRTOF if "strtof" is declared and links 718dnl Define HAVE_DRAND48 if "drand48" is declared and links 719dnl 720dnl GLIBCPP_CHECK_STDLIB_SUPPORT 721AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [ 722 ac_test_CXXFLAGS="${CXXFLAGS+set}" 723 ac_save_CXXFLAGS="$CXXFLAGS" 724 CXXFLAGS='-fno-builtins -D_GNU_SOURCE' 725 726 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold) 727 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof) 728 AC_CHECK_FUNCS(drand48) 729 730 CXXFLAGS="$ac_save_CXXFLAGS" 731]) 732 733 734dnl 735dnl Check to see what the underlying c library or math library is like. 736dnl These checks need to do two things: 737dnl 1) make sure the name is declared when using the c++ compiler 738dnl 2) make sure the name has "C" linkage 739dnl This might seem like overkill but experience has shown that it's not... 740dnl 741dnl Define HAVE_CARGF etc if "cargf" is found. 742dnl 743dnl GLIBCPP_CHECK_MATH_SUPPORT 744AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [ 745 ac_test_CXXFLAGS="${CXXFLAGS+set}" 746 ac_save_CXXFLAGS="$CXXFLAGS" 747 CXXFLAGS='-fno-builtins -D_GNU_SOURCE' 748 749 dnl Check libm 750 AC_CHECK_LIB(m, sin, libm="-lm") 751 ac_save_LIBS="$LIBS" 752 LIBS="$LIBS $libm" 753 754 dnl Check to see if certain C math functions exist. 755 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf) 756 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan) 757 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite) 758 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign) 759 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos) 760 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass) 761 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass) 762 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypot) 763 764 dnl Check to see if basic C math functions have float versions. 765 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig, 766 float_trig, 767 acosf asinf atanf \ 768 cosf sinf tanf \ 769 coshf sinhf tanhf) 770 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round, 771 float_round, 772 ceilf floorf) 773 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expf) 774 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf) 775 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff) 776 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f) 777 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf) 778 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf) 779 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf) 780 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf) 781 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf) 782 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf) 783 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f) 784 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff) 785 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf) 786 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf) 787 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf) 788 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef) 789 790 dnl Check to see if basic C math functions have long double versions. 791 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig, 792 long_double_trig, 793 acosl asinl atanl \ 794 cosl sinl tanl \ 795 coshl sinhl tanhl) 796 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round, 797 long_double_round, 798 ceill floorl) 799 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl) 800 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl) 801 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl) 802 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l) 803 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl) 804 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl) 805 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl) 806 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl) 807 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl) 808 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl) 809 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl) 810 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l) 811 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl) 812 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl) 813 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl) 814 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl) 815 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel) 816 817 dnl Some runtimes have these functions with a preceding underscore. Please 818 dnl keep this sync'd with the one above. And if you add any new symbol, 819 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h. 820 dnl Check to see if certain C math functions exist. 821 822 dnl Check to see if basic C math functions have float versions. 823 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig, 824 _float_trig, 825 _acosf _asinf _atanf \ 826 _cosf _sinf _tanf \ 827 _coshf _sinhf _tanhf) 828 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round, 829 _float_round, 830 _ceilf _floorf) 831 832 dnl Check to see if basic C math functions have long double versions. 833 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig, 834 _long_double_trig, 835 _acosl _asinl _atanl \ 836 _cosl _sinl _tanl \ 837 _coshl _sinhl _tanhl) 838 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round, 839 _long_double_round, 840 _ceill _floorl) 841 842 LIBS="$ac_save_LIBS" 843 CXXFLAGS="$ac_save_CXXFLAGS" 844]) 845 846 847dnl 848dnl Check to see if there is native support for complex 849dnl 850dnl Don't compile bits in math/* if native support exits. 851dnl 852dnl Define USE_COMPLEX_LONG_DOUBLE etc if "copysignl" is found. 853dnl 854dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT 855AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [ 856 dnl Check for complex versions of math functions of platform. 857 AC_CHECK_LIB(m, main) 858 AC_REPLACE_MATHFUNCS(nan copysignf) 859 860 dnl For __signbit to signbit conversions. 861 AC_CHECK_FUNCS([__signbit], , [LIBMATHOBJS="$LIBMATHOBJS signbit.lo"]) 862 AC_CHECK_FUNCS([__signbitf], , [LIBMATHOBJS="$LIBMATHOBJS signbitf.lo"]) 863 864 dnl Compile the long double complex functions only if the function 865 dnl provides the non-complex long double functions that are needed. 866 dnl Currently this includes copysignl, which should be 867 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above. 868 if test x$ac_cv_func_copysignl = x"yes"; then 869 AC_CHECK_FUNCS([__signbitl], , [LIBMATHOBJS="$LIBMATHOBJS signbitl.lo"]) 870 fi 871 872 AC_SUBST(LIBMATHOBJS) 873]) 874 875 876dnl Check to see what architecture and operating system we are compiling 877dnl for. Also, if architecture- or OS-specific flags are required for 878dnl compilation, pick them up here. 879dnl 880dnl GLIBCPP_CHECK_TARGET 881AC_DEFUN(GLIBCPP_CHECK_TARGET, [ 882 . [$]{glibcpp_basedir}/configure.target 883 AC_MSG_RESULT(CPU config directory is $cpu_include_dir) 884 AC_MSG_RESULT(OS config directory is $os_include_dir) 885]) 886 887 888dnl 889dnl Check to see if this target can enable the wchar_t parts of libstdc++. 890dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This 891dnl must have been previously checked.) 892dnl 893dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found 894dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h 895dnl 896dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT 897AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [ 898 899 dnl Test wchar.h for mbstate_t, which is needed for char_traits and 900 dnl others even if wchar_t support is not on. 901 AC_MSG_CHECKING([for mbstate_t]) 902 AC_TRY_COMPILE([#include <wchar.h>], 903 [mbstate_t teststate;], 904 have_mbstate_t=yes, have_mbstate_t=no) 905 AC_MSG_RESULT($have_mbstate_t) 906 if test x"$have_mbstate_t" = xyes; then 907 AC_DEFINE(HAVE_MBSTATE_T) 908 fi 909 910 dnl Sanity check for existence of ISO C99 headers for extended encoding. 911 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no) 912 AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no) 913 914 dnl Only continue checking if the ISO C99 headers exist and support is on. 915 if test x"$ac_has_wchar_h" = xyes && 916 test x"$ac_has_wctype_h" = xyes && 917 test x"$enable_c_mbchar" != xno; then 918 919 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before 920 dnl numeric_limits can instantiate type_traits<wchar_t> 921 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX]) 922 AC_TRY_COMPILE([#include <wchar.h>], 923 [int i = WCHAR_MIN; int j = WCHAR_MAX;], 924 has_wchar_minmax=yes, has_wchar_minmax=no) 925 AC_MSG_RESULT($has_wchar_minmax) 926 927 dnl Test wchar.h for WEOF, which is what we use to determine whether 928 dnl to specialize for char_traits<wchar_t> or not. 929 AC_MSG_CHECKING([for WEOF]) 930 AC_TRY_COMPILE([ 931 #include <wchar.h> 932 #include <stddef.h>], 933 [wint_t i = WEOF;], 934 has_weof=yes, has_weof=no) 935 AC_MSG_RESULT($has_weof) 936 937 dnl Tests for wide character functions used in char_traits<wchar_t>. 938 ac_wfuncs=yes 939 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset,, \ 940 ac_wfuncs=no) 941 942 dnl Checks for names injected into std:: by the c_std headers. 943 AC_CHECK_FUNCS(btowc wctob fgetwc fgetwc fgetws fputwc fputws fwide \ 944 fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \ 945 vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \ 946 mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \ 947 wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \ 948 wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \ 949 ac_wfuncs=no) 950 951 AC_MSG_CHECKING([for ISO C99 wchar_t support]) 952 if test x"$has_weof" = xyes && 953 test x"$has_wchar_minmax" = xyes && 954 test x"$ac_wfuncs" = xyes; then 955 ac_isoC99_wchar_t=yes 956 else 957 ac_isoC99_wchar_t=no 958 fi 959 AC_MSG_RESULT($ac_isoC99_wchar_t) 960 961 dnl Use iconv for wchar_t to char conversions. As such, check for 962 dnl X/Open Portability Guide, version 2 features (XPG2). 963 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no) 964 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no) 965 966 dnl Check for existence of libiconv.a providing XPG2 wchar_t support. 967 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv") 968 ac_save_LIBS="$LIBS" 969 LIBS="$LIBS $libiconv" 970 971 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \ 972 ac_XPG2funcs=yes, ac_XPG2funcs=no) 973 974 LIBS="$ac_save_LIBS" 975 976 AC_MSG_CHECKING([for XPG2 wchar_t support]) 977 if test x"$ac_has_iconv_h" = xyes && 978 test x"$ac_has_langinfo_h" = xyes && 979 test x"$ac_XPG2funcs" = xyes; then 980 ac_XPG2_wchar_t=yes 981 else 982 ac_XPG2_wchar_t=no 983 fi 984 AC_MSG_RESULT($ac_XPG2_wchar_t) 985 986 dnl At the moment, only enable wchar_t specializations if all the 987 dnl above support is present. 988 AC_MSG_CHECKING([for enabled wchar_t specializations]) 989 if test x"$ac_isoC99_wchar_t" = xyes && 990 test x"$ac_XPG2_wchar_t" = xyes; then 991 AC_DEFINE(_GLIBCPP_USE_WCHAR_T) 992 AC_MSG_RESULT("yes") 993 else 994 AC_MSG_RESULT("no") 995 fi 996 else 997 dnl Wide characters disabled by the user. 998 AC_MSG_WARN([wchar_t support disabled.]) 999 fi 1000]) 1001 1002 1003dnl 1004dnl Check for special debugging mode; not for production use. 1005dnl 1006dnl GLIBCPP_ENABLE_DEBUG 1007dnl --enable-debug sets '-ggdb3 -O0'. 1008dnl --disable-debug sets '-g' and whatever optimization options the 1009dnl compiler can handle. 1010dnl + --enable-maintainer-mode automatically defaults this to on. 1011dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...? 1012dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)] 1013dnl Where DEFAULT is either `yes' or `no'. If ommitted, it 1014dnl defaults to `no'. 1015AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl 1016define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl 1017AC_ARG_ENABLE(debug, 1018changequote(<<, >>)dnl 1019<< --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT], 1020changequote([, ])dnl 1021[case "${enableval}" in 1022 yes) enable_debug=yes ;; 1023 no) enable_debug=no ;; 1024 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;; 1025 esac], 1026enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl 1027 1028dnl Option parsed, now set things appropriately 1029case "${enable_debug}" in 1030 yes) 1031 DEBUG_FLAGS='-O0 -ggdb3' 1032 ;; 1033 no) 1034 DEBUG_FLAGS='-g' 1035 ;; 1036esac 1037AC_SUBST(DEBUG_FLAGS) 1038]) 1039 1040 1041dnl 1042dnl Check for "unusual" flags to pass to the compiler while building. 1043dnl 1044dnl GLIBCPP_ENABLE_CXX_FLAGS 1045dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing 1046dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc. 1047dnl Somehow this same set of flags must be passed when [re]building 1048dnl libgcc. 1049dnl --disable-cxx-flags passes nothing. 1050dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html 1051dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html 1052dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html 1053dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags) 1054dnl If "default flags" is an empty string (or "none"), the effect is 1055dnl the same as --disable or --enable=no. 1056AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl 1057define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl 1058AC_ARG_ENABLE(cxx-flags, 1059changequote(<<, >>)dnl 1060<< --enable-cxx-flags=FLAGS pass compiler FLAGS when building library; 1061 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], 1062changequote([, ])dnl 1063[case "x$enableval" in 1064 xyes) 1065 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;; 1066 xno|x) 1067 enable_cxx_flags='' ;; 1068 *) 1069 enable_cxx_flags="$enableval" ;; 1070 esac], 1071enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT') 1072 1073dnl Thinko on my part during design. This kludge is the workaround. 1074if test "$enable_cxx_flags" = "none"; then 1075 enable_cxx_flags=''; 1076fi 1077 1078dnl Run through flags (either default or command-line) and set anything 1079dnl extra (e.g., #defines) that must accompany particular g++ options. 1080if test -n "$enable_cxx_flags"; then 1081 for f in $enable_cxx_flags; do 1082 case "$f" in 1083 -fhonor-std) ;; 1084 -*) ;; 1085 *) # and we're trying to pass /what/ exactly? 1086 AC_MSG_ERROR([compiler flags start with a -]) ;; 1087 esac 1088 done 1089fi 1090EXTRA_CXX_FLAGS="$enable_cxx_flags" 1091AC_SUBST(EXTRA_CXX_FLAGS) 1092]) 1093 1094 1095dnl 1096dnl Check for which locale library to use: gnu or generic. 1097dnl 1098dnl GLIBCPP_ENABLE_CLOCALE 1099dnl --enable-clocale=gnu sets config/locale/c_locale_gnu.cc and friends 1100dnl --enable-clocale=generic sets config/locale/c_locale_generic.cc and friends 1101dnl 1102dnl default is generic 1103dnl 1104AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [ 1105 AC_MSG_CHECKING([for clocale to use]) 1106 AC_ARG_ENABLE(clocale, 1107 [ --enable-clocale enable model for target locale package. 1108 --enable-clocale=MODEL use MODEL target-speific locale package. [default=generic] 1109 ], 1110 if test x$enable_clocale = xno; then 1111 enable_clocale=no 1112 fi, 1113 enable_clocale=no) 1114 1115 enable_clocale_flag=$enable_clocale 1116 1117 dnl Probe for locale support if no specific model is specified. 1118 dnl Default to "generic" 1119 if test x$enable_clocale_flag = xno; then 1120 case x${target_os} in 1121 xlinux* | xgnu*) 1122 AC_EGREP_CPP([_GLIBCPP_ok], [ 1123 #include <features.h> 1124 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) 1125 _GLIBCPP_ok 1126 #endif 1127 ], enable_clocale_flag=gnu, enable_clocale_flag=generic) 1128 1129 # Test for bugs early in glibc-2.2.x series 1130 if test x$enable_clocale_flag = xgnu; then 1131 AC_TRY_RUN([ 1132 #define _GNU_SOURCE 1 1133 #include <locale.h> 1134 int main() 1135 { 1136 const char __one[] = "�uglein Augmen"; 1137 const char __two[] = "�uglein"; 1138 int i; 1139 int j; 1140 __locale_t loc; 1141 __locale_t loc_dup; 1142 loc = __newlocale(1 << LC_ALL, "de_DE", 0); 1143 loc_dup = __duplocale(loc); 1144 i = __strcoll_l(__one, __two, loc); 1145 j = __strcoll_l(__one, __two, loc_dup); 1146 return 0; 1147 } 1148 ], 1149 [enable_clocale_flag=gnu],[enable_clocale_flag=generic], 1150 [enable_clocale_flag=generic]) 1151 fi 1152 1153 # ... at some point put __strxfrm_l tests in as well. 1154 ;; 1155 *) 1156 enable_clocale_flag=generic 1157 ;; 1158 esac 1159 fi 1160 1161 dnl Deal with gettext issues. 1162 AC_ARG_ENABLE(nls, 1163 [ --enable-nls use Native Language Support (default)], 1164 , enable_nls=yes) 1165 USE_NLS=no 1166 1167 dnl Set configure bits for specified locale package 1168 case x${enable_clocale_flag} in 1169 xgeneric) 1170 AC_MSG_RESULT(generic) 1171 1172 CLOCALE_H=config/locale/generic/c_locale.h 1173 CLOCALE_CC=config/locale/generic/c_locale.cc 1174 CCODECVT_H=config/locale/generic/codecvt_specializations.h 1175 CCOLLATE_CC=config/locale/generic/collate_members.cc 1176 CCTYPE_CC=config/locale/generic/ctype_members.cc 1177 CMESSAGES_H=config/locale/generic/messages_members.h 1178 CMESSAGES_CC=config/locale/generic/messages_members.cc 1179 CMONEY_CC=config/locale/generic/monetary_members.cc 1180 CNUMERIC_CC=config/locale/generic/numeric_members.cc 1181 CTIME_CC=config/locale/generic/time_members.cc 1182 ;; 1183 xgnu) 1184 AC_MSG_RESULT(gnu) 1185 1186 # Declare intention to use gettext, and add support for specific 1187 # languages. 1188 # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT 1189 ALL_LINGUAS="de fr" 1190 1191 # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. 1192 AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) 1193 if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then 1194 USE_NLS=yes 1195 fi 1196 # Export the build objects. 1197 for ling in $ALL_LINGUAS; do \ 1198 glibcpp_MOFILES="$glibcpp_MOFILES $ling.mo"; \ 1199 glibcpp_POFILES="$glibcpp_POFILES $ling.po"; \ 1200 done 1201 AC_SUBST(glibcpp_MOFILES) 1202 AC_SUBST(glibcpp_POFILES) 1203 1204 CLOCALE_H=config/locale/gnu/c_locale.h 1205 CLOCALE_CC=config/locale/gnu/c_locale.cc 1206 CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h 1207 CCOLLATE_CC=config/locale/gnu/collate_members.cc 1208 CCTYPE_CC=config/locale/gnu/ctype_members.cc 1209 CMESSAGES_H=config/locale/gnu/messages_members.h 1210 CMESSAGES_CC=config/locale/gnu/messages_members.cc 1211 CMONEY_CC=config/locale/gnu/monetary_members.cc 1212 CNUMERIC_CC=config/locale/gnu/numeric_members.cc 1213 CTIME_CC=config/locale/gnu/time_members.cc 1214 ;; 1215 xieee_1003.1-2001) 1216 AC_MSG_RESULT(generic) 1217 1218 CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h 1219 CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc 1220 CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h 1221 CCOLLATE_CC=config/locale/generic/collate_members.cc 1222 CCTYPE_CC=config/locale/generic/ctype_members.cc 1223 CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h 1224 CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc 1225 CMONEY_CC=config/locale/generic/monetary_members.cc 1226 CNUMERIC_CC=config/locale/generic/numeric_members.cc 1227 CTIME_CC=config/locale/generic/time_members.cc 1228 ;; 1229 *) 1230 echo "$enable_clocale is an unknown locale package" 1>&2 1231 exit 1 1232 ;; 1233 esac 1234 1235 # This is where the testsuite looks for locale catalogs, using the 1236 # -DLOCALEDIR define during testsuite compilation. 1237 glibcpp_localedir=${glibcpp_builddir}/po/share/locale 1238 AC_SUBST(glibcpp_localedir) 1239 1240 AC_SUBST(USE_NLS) 1241 AC_SUBST(CLOCALE_H) 1242 AC_SUBST(CCODECVT_H) 1243 AC_SUBST(CMESSAGES_H) 1244 AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc) 1245 AC_LINK_FILES($CCOLLATE_CC, src/collate.cc) 1246 AC_LINK_FILES($CCTYPE_CC, src/ctype.cc) 1247 AC_LINK_FILES($CMESSAGES_CC, src/messages.cc) 1248 AC_LINK_FILES($CMONEY_CC, src/monetary.cc) 1249 AC_LINK_FILES($CNUMERIC_CC, src/numeric.cc) 1250 AC_LINK_FILES($CTIME_CC, src/time.cc) 1251]) 1252 1253 1254dnl 1255dnl Check for which I/O library to use: libio, or something specific. 1256dnl 1257dnl GLIBCPP_ENABLE_CSTDIO 1258dnl --enable-cstdio=libio sets config/io/c_io_libio.h and friends 1259dnl 1260dnl default is stdio 1261dnl 1262AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [ 1263 AC_MSG_CHECKING([for cstdio to use]) 1264 AC_ARG_ENABLE(cstdio, 1265 [ --enable-cstdio enable stdio for target io package. 1266 --enable-cstdio=LIB use LIB target-speific io package. [default=stdio] 1267 ], 1268 if test x$enable_cstdio = xno; then 1269 enable_cstdio=stdio 1270 fi, 1271 enable_cstdio=stdio) 1272 1273 enable_cstdio_flag=$enable_cstdio 1274 1275 dnl Check if a valid I/O package 1276 case x${enable_cstdio_flag} in 1277 xlibio) 1278 CSTDIO_H=config/io/c_io_libio.h 1279 BASIC_FILE_H=config/io/basic_file_libio.h 1280 BASIC_FILE_CC=config/io/basic_file_libio.cc 1281 AC_MSG_RESULT(libio) 1282 1283 # see if we are on a system with libio native (ie, linux) 1284 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no) 1285 1286 # Need to check and see what version of glibc is being used. If 1287 # it's not glibc-2.2 or higher, then we'll need to go ahead and 1288 # compile most of libio for linux systems. 1289 if test x$has_libio = x"yes"; then 1290 case "$target" in 1291 *-*-linux*) 1292 AC_MSG_CHECKING([for glibc version >= 2.2]) 1293 AC_EGREP_CPP([ok], [ 1294 #include <features.h> 1295 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) 1296 ok 1297 #endif 1298 ], glibc_satisfactory=yes, glibc_satisfactory=no) 1299 AC_MSG_RESULT($glibc_satisfactory) 1300 ;; 1301 esac 1302 1303 # XXX at the moment, admit defeat and force the recompilation 1304 # XXX of glibc even on glibc-2.2 systems, because libio is not synched. 1305 glibc_satisfactory=no 1306 1307 if test x$glibc_satisfactory = x"yes"; then 1308 need_libio=no 1309 need_wlibio=no 1310 else 1311 need_libio=yes 1312 # bkoz XXX need to add checks to enable this 1313 # pme XXX here's a first pass at such a check 1314 if test x$enable_c_mbchar != xno; then 1315 need_wlibio=yes 1316 else 1317 need_wlibio=no 1318 fi 1319 fi 1320 1321 else 1322 # Using libio, but <libio.h> doesn't exist on the target system. . . 1323 need_libio=yes 1324 # bkoz XXX need to add checks to enable this 1325 # pme XXX here's a first pass at such a check 1326 if test x$enable_c_mbchar != xno; then 1327 need_wlibio=yes 1328 else 1329 need_wlibio=no 1330 fi 1331 fi 1332 ;; 1333 xstdio | x | xno | xnone | xyes) 1334 # default 1335 CSTDIO_H=config/io/c_io_stdio.h 1336 BASIC_FILE_H=config/io/basic_file_stdio.h 1337 BASIC_FILE_CC=config/io/basic_file_stdio.cc 1338 AC_MSG_RESULT(stdio) 1339 1340 # We're not using stdio. 1341 need_libio=no 1342 need_wlibio=no 1343 ;; 1344 *) 1345 echo "$enable_cstdio is an unknown io package" 1>&2 1346 exit 1 1347 ;; 1348 esac 1349 AC_SUBST(CSTDIO_H) 1350 AC_SUBST(BASIC_FILE_H) 1351 AC_LINK_FILES($BASIC_FILE_CC, src/basic_file.cc) 1352 1353 # 2000-08-04 bkoz hack 1354 CCODECVT_C=config/io/c_io_libio_codecvt.c 1355 AC_SUBST(CCODECVT_C) 1356 # 2000-08-04 bkoz hack 1357 1358 AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO, 1359 test "$need_libio" = yes || test "$need_wlibio" = yes) 1360 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes) 1361 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes) 1362 if test "$need_libio" = yes || test "$need_wlibio" = yes; then 1363 libio_la=../libio/libio.la 1364 else 1365 libio_la= 1366 fi 1367 AC_SUBST(libio_la) 1368]) 1369 1370 1371dnl 1372dnl Setup to use the gcc gthr.h thread-specific memory and mutex model. 1373dnl We must stage the required headers so that they will be installed 1374dnl with the library (unlike libgcc, the STL implementation is provided 1375dnl solely within headers). Since we must not inject random user-space 1376dnl macro names into user-provided C++ code, we first stage into <file>-in 1377dnl and process to <file> with an output command. The reason for a two- 1378dnl stage process here is to correctly handle $srcdir!=$objdir without 1379dnl having to write complex code (the sed commands to clean the macro 1380dnl namespace are complex and fragile enough as it is). We must also 1381dnl add a relative path so that -I- is supported properly. 1382dnl 1383AC_DEFUN(GLIBCPP_ENABLE_THREADS, [ 1384 AC_MSG_CHECKING([for thread model used by GCC]) 1385 target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` 1386 AC_MSG_RESULT([$target_thread_file]) 1387 1388 if test $target_thread_file != single; then 1389 AC_DEFINE(HAVE_GTHR_DEFAULT) 1390 AC_DEFINE(_GLIBCPP_SUPPORTS_WEAK, __GXX_WEAK__) 1391 fi 1392 1393 glibcpp_thread_h=gthr-$target_thread_file.h 1394 AC_SUBST(glibcpp_thread_h) 1395]) 1396 1397 1398dnl 1399dnl Check for exception handling support. If an explicit enable/disable 1400dnl sjlj exceptions is given, we don't have to detect. Otherwise the 1401dnl target may or may not support call frame exceptions. 1402dnl 1403dnl GLIBCPP_ENABLE_SJLJ_EXCEPTIONS 1404dnl --enable-sjlj-exceptions forces the use of builtin setjmp. 1405dnl --disable-sjlj-exceptions forces the use of call frame unwinding. 1406dnl 1407dnl Define _GLIBCPP_SJLJ_EXCEPTIONS if the compiler is configured for it. 1408dnl 1409AC_DEFUN(GLIBCPP_ENABLE_SJLJ_EXCEPTIONS, [ 1410 AC_MSG_CHECKING([for exception model to use]) 1411 AC_LANG_SAVE 1412 AC_LANG_CPLUSPLUS 1413 AC_ARG_ENABLE(sjlj-exceptions, 1414 [ --enable-sjlj-exceptions force use of builtin_setjmp for exceptions], 1415 [:], 1416 [dnl Botheration. Now we've got to detect the exception model. 1417 dnl Link tests against libgcc.a are problematic since -- at least 1418 dnl as of this writing -- we've not been given proper -L bits for 1419 dnl single-tree newlib and libgloss. 1420 dnl 1421 dnl This is what AC_TRY_COMPILE would do if it didn't delete the 1422 dnl conftest files before we got a change to grep them first. 1423 cat > conftest.$ac_ext << EOF 1424[#]line __oline__ "configure" 1425struct S { ~S(); }; 1426void bar(); 1427void foo() 1428{ 1429 S s; 1430 bar(); 1431} 1432EOF 1433 old_CXXFLAGS="$CXXFLAGS" 1434 CXXFLAGS="-S -fexceptions" 1435 if AC_TRY_EVAL(ac_compile); then 1436 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then 1437 enable_sjlj_exceptions=yes 1438 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then 1439 enable_sjlj_exceptions=no 1440 fi 1441 fi 1442 CXXFLAGS="$old_CXXFLAGS" 1443 rm -f conftest*]) 1444 if test x$enable_sjlj_exceptions = xyes; then 1445 AC_DEFINE(_GLIBCPP_SJLJ_EXCEPTIONS, 1, 1446 [Define if the compiler is configured for setjmp/longjmp exceptions.]) 1447 ac_exception_model_name=sjlj 1448 elif test x$enable_sjlj_exceptions = xno; then 1449 ac_exception_model_name="call frame" 1450 else 1451 AC_MSG_ERROR([unable to detect exception model]) 1452 fi 1453 AC_LANG_RESTORE 1454 AC_MSG_RESULT($ac_exception_model_name) 1455]) 1456 1457 1458dnl 1459dnl Check for libunwind exception handling support. If enabled then 1460dnl we assume that the _Unwind_* functions that make up the Unwind ABI 1461dnl (_Unwind_RaiseException, _Unwind_Resume, etc.) are defined by 1462dnl libunwind instead of libgcc and that libstdc++ has a dependency 1463dnl on libunwind as well as libgcc. 1464dnl 1465dnl GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS 1466dnl --enable-libunwind-exceptions forces the use of libunwind. 1467dnl --disable-libunwind-exceptions assumes there is no libunwind. 1468dnl 1469dnl Define _GLIBCPP_LIBUNWIND_EXCEPTIONS if requested. 1470dnl 1471AC_DEFUN(GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS, [ 1472 AC_MSG_CHECKING([for use of libunwind]) 1473 AC_ARG_ENABLE(libunwind-exceptions, 1474 [ --enable-libunwind-exceptions force use of libunwind for exceptions], 1475 use_libunwind_exceptions=$enableval, 1476 use_libunwind_exceptions=no) 1477 AC_MSG_RESULT($use_libunwind_exceptions) 1478 dnl Option parsed, now set things appropriately 1479 if test x"$use_libunwind_exceptions" = xyes; then 1480 LIBUNWIND_FLAG="-lunwind" 1481 else 1482 LIBUNWIND_FLAG="" 1483 fi 1484 AC_SUBST(LIBUNWIND_FLAG) 1485]) 1486 1487dnl 1488dnl Check for ISO/IEC 9899:1999 "C99" support. 1489dnl 1490dnl GLIBCPP_ENABLE_C99 1491dnl --enable-c99 defines _GLIBCPP_USE_C99 1492dnl --disable-c99 leaves _GLIBCPP_USE_C99 undefined 1493dnl + Usage: GLIBCPP_ENABLE_C99[(DEFAULT)] 1494dnl Where DEFAULT is either `yes' or `no'. If omitted, it 1495dnl defaults to `no'. 1496dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'. 1497dnl 1498dnl GLIBCPP_ENABLE_C99 1499AC_DEFUN(GLIBCPP_ENABLE_C99, [dnl 1500 define([GLIBCPP_ENABLE_C99_DEFAULT], ifelse($1, yes, yes, no))dnl 1501 1502 AC_ARG_ENABLE(c99, 1503 changequote(<<, >>)dnl 1504 <<--enable-c99 turns on 'ISO/IEC 9899:1999 support' [default=>>GLIBCPP_ENABLE_C99_DEFAULT], 1505 changequote([, ])dnl 1506 [case "$enableval" in 1507 yes) enable_c99=yes ;; 1508 no) enable_c99=no ;; 1509 *) AC_MSG_ERROR([Unknown argument to enable/disable C99]) ;; 1510 esac], 1511 enable_c99=GLIBCPP_ENABLE_C99_DEFAULT)dnl 1512 1513 AC_LANG_SAVE 1514 AC_LANG_CPLUSPLUS 1515 1516 # Check for the existence of <math.h> functions used if C99 is enabled. 1517 ac_c99_math=yes; 1518 AC_MSG_CHECKING([for ISO C99 support in <math.h>]) 1519 AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no]) 1520 AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no]) 1521 AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no]) 1522 AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no]) 1523 AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no]) 1524 AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no]) 1525 AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no]) 1526 AC_TRY_COMPILE([#include <math.h>], 1527 [isgreaterequal(0.0,0.0);],, [ac_c99_math=no]) 1528 AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no]) 1529 AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no]) 1530 AC_TRY_COMPILE([#include <math.h>], 1531 [islessgreater(0.0,0.0);],, [ac_c99_math=no]) 1532 AC_TRY_COMPILE([#include <math.h>], 1533 [isunordered(0.0,0.0);],, [ac_c99_math=no]) 1534 AC_MSG_RESULT($ac_c99_math) 1535 1536 # Check for the existence in <stdio.h> of vscanf, et. al. 1537 ac_c99_stdio=yes; 1538 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>]) 1539 AC_TRY_COMPILE([#include <stdio.h>], 1540 [snprintf("12", 0, "%i");],, [ac_c99_stdio=no]) 1541 AC_TRY_COMPILE([#include <stdio.h> 1542 #include <stdarg.h> 1543 void foo(char* fmt, ...) 1544 {va_list args; va_start(args, fmt); 1545 vfscanf(stderr, "%i", args);}], 1546 [],, [ac_c99_stdio=no]) 1547 AC_TRY_COMPILE([#include <stdio.h> 1548 #include <stdarg.h> 1549 void foo(char* fmt, ...) 1550 {va_list args; va_start(args, fmt); 1551 vscanf("%i", args);}], 1552 [],, [ac_c99_stdio=no]) 1553 AC_TRY_COMPILE([#include <stdio.h> 1554 #include <stdarg.h> 1555 void foo(char* fmt, ...) 1556 {va_list args; va_start(args, fmt); 1557 vsnprintf(fmt, 0, "%i", args);}], 1558 [],, [ac_c99_stdio=no]) 1559 AC_TRY_COMPILE([#include <stdio.h> 1560 #include <stdarg.h> 1561 void foo(char* fmt, ...) 1562 {va_list args; va_start(args, fmt); 1563 vsscanf(fmt, "%i", args);}], 1564 [],, [ac_c99_stdio=no]) 1565 AC_MSG_RESULT($ac_c99_stdio) 1566 1567 # Check for the existence in <stdlib.h> of lldiv_t, et. al. 1568 ac_c99_stdlib=yes; 1569 AC_MSG_CHECKING([for lldiv_t declaration]) 1570 AC_CACHE_VAL(ac_c99_lldiv_t, [ 1571 AC_TRY_COMPILE([#include <stdlib.h>], 1572 [ lldiv_t mydivt;], 1573 [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no]) 1574 ]) 1575 AC_MSG_RESULT($ac_c99_lldiv_t) 1576 1577 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>]) 1578 AC_TRY_COMPILE([#include <stdlib.h>], 1579 [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no]) 1580 AC_TRY_COMPILE([#include <stdlib.h>], 1581 [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no]) 1582 AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no]) 1583 AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no]) 1584 AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no]) 1585 AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no]) 1586 if test x"$ac_c99_lldiv_t" = x"no"; then 1587 ac_c99_stdlib=no; 1588 fi; 1589 AC_MSG_RESULT($ac_c99_stdlib) 1590 1591 # Check for the existence of <wchar.h> functions used if C99 is enabled. 1592 # XXX the wchar.h checks should be rolled into the general C99 bits. 1593 ac_c99_wchar=yes; 1594 AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>]) 1595 AC_TRY_COMPILE([#include <wchar.h>], 1596 [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no]) 1597 AC_TRY_COMPILE([#include <wchar.h>], 1598 [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no]) 1599 AC_TRY_COMPILE([#include <wchar.h>], 1600 [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no]) 1601 AC_MSG_RESULT($ac_c99_wchar) 1602 1603 AC_MSG_CHECKING([for enabled ISO C99 support]) 1604 if test x"$ac_c99_math" = x"no" || 1605 test x"$ac_c99_stdio" = x"no" || 1606 test x"$ac_c99_stdlib" = x"no" || 1607 test x"$ac_c99_wchar" = x"no"; then 1608 enable_c99=no; 1609 fi; 1610 AC_MSG_RESULT($enable_c99) 1611 1612 # Option parsed, now set things appropriately 1613 if test x"$enable_c99" = x"yes"; then 1614 AC_DEFINE(_GLIBCPP_USE_C99) 1615 fi 1616 1617 AC_LANG_RESTORE 1618]) 1619 1620 1621dnl 1622dnl Check for template specializations for the 'long long' type extension. 1623dnl The result determines only whether 'long long' I/O is enabled; things 1624dnl like numeric_limits<> specializations are always available. 1625dnl 1626dnl GLIBCPP_ENABLE_LONG_LONG 1627dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG 1628dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined 1629dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)] 1630dnl Where DEFAULT is either `yes' or `no'. If omitted, it 1631dnl defaults to `no'. 1632dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'. 1633dnl 1634dnl GLIBCPP_ENABLE_LONG_LONG 1635AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl 1636 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl 1637 1638 AC_ARG_ENABLE(long-long, 1639 changequote(<<, >>)dnl 1640 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT], 1641 changequote([, ])dnl 1642 [case "$enableval" in 1643 yes) enable_long_long=yes ;; 1644 no) enable_long_long=no ;; 1645 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;; 1646 esac], 1647 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl 1648 1649 AC_LANG_SAVE 1650 AC_LANG_CPLUSPLUS 1651 1652 AC_MSG_CHECKING([for enabled long long I/O support]) 1653 # iostreams require strtoll, strtoull to compile 1654 AC_TRY_COMPILE([#include <stdlib.h>], 1655 [char* tmp; strtoll("gnu", &tmp, 10);],,[enable_long_long=no]) 1656 AC_TRY_COMPILE([#include <stdlib.h>], 1657 [char* tmp; strtoull("gnu", &tmp, 10);],,[enable_long_long=no]) 1658 1659 # Option parsed, now set things appropriately 1660 if test x"$enable_long_long" = xyes; then 1661 AC_DEFINE(_GLIBCPP_USE_LONG_LONG) 1662 fi 1663 AC_MSG_RESULT($enable_long_long) 1664 1665 AC_LANG_RESTORE 1666]) 1667 1668 1669dnl 1670dnl Check for what kind of C headers to use. 1671dnl 1672dnl GLIBCPP_ENABLE_CHEADERS 1673dnl --enable-cheaders= [does stuff]. 1674dnl --disable-cheaders [does not do anything, really]. 1675dnl + This will eventually need to be 'c_shadow' by default. 1676dnl + Usage: GLIBCPP_ENABLE_CHEADERS[(DEFAULT)] 1677dnl Where DEFAULT is either `c' or `c_std' or 'c_shadow'. 1678dnl If ommitted, it defaults to `c_std'. 1679AC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl 1680define([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl 1681AC_MSG_CHECKING([for c header strategy to use]) 1682AC_ARG_ENABLE(cheaders, 1683changequote(<<, >>)dnl 1684<< --enable-cheaders construct "C" header files for g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT], 1685changequote([, ]) 1686 [case "$enableval" in 1687 c) 1688 enable_cheaders=c 1689 ;; 1690 c_std) 1691 enable_cheaders=c_std 1692 ;; 1693 c_shadow) 1694 enable_cheaders=c_shadow 1695 ;; 1696 *) AC_MSG_ERROR([Unknown argument to enable/disable "C" headers]) 1697 ;; 1698 esac], 1699 enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT) 1700 AC_MSG_RESULT($enable_cheaders) 1701 1702 dnl Option parsed, now set things appropriately 1703 case "$enable_cheaders" in 1704 c_shadow) 1705 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_shadow' 1706 ;; 1707 c_std) 1708 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_std' 1709 ;; 1710 c) 1711 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c' 1712 ;; 1713 esac 1714 1715 AC_SUBST(C_INCLUDE_DIR) 1716 AM_CONDITIONAL(GLIBCPP_C_HEADERS_C, test "$enable_cheaders" = c) 1717 AM_CONDITIONAL(GLIBCPP_C_HEADERS_C_STD, test "$enable_cheaders" = c_std) 1718 AM_CONDITIONAL(GLIBCPP_C_HEADERS_COMPATIBILITY, test "$c_compatibility" = yes) 1719]) 1720 1721 1722dnl 1723dnl Check for wide character support. Has the same effect as the option 1724dnl in gcc's configure, but in a form that autoconf can mess with. 1725dnl 1726dnl GLIBCPP_ENABLE_C_MBCHAR 1727dnl --enable-c-mbchar requests all the wchar_t stuff. 1728dnl --disable-c-mbchar doesn't. 1729dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)] 1730dnl Where DEFAULT is either `yes' or `no'. If ommitted, it 1731dnl defaults to `no'. 1732AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl 1733define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl 1734AC_ARG_ENABLE(c-mbchar, 1735changequote(<<, >>)dnl 1736<< --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], 1737changequote([, ])dnl 1738[case "$enableval" in 1739 yes) enable_c_mbchar=yes ;; 1740 no) enable_c_mbchar=no ;; 1741 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;; 1742 esac], 1743enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl 1744dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no. 1745]) 1746 1747 1748dnl 1749dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's. 1750dnl 1751dnl TOPLEVEL_INCLUDES 1752dnl LIBMATH_INCLUDES 1753dnl LIBSUPCXX_INCLUDES 1754dnl LIBIO_INCLUDES 1755dnl CSHADOW_INCLUDES 1756dnl 1757dnl GLIBCPP_EXPORT_INCLUDES 1758AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [ 1759 # Root level of the build directory include sources. 1760 GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include" 1761 1762 # Passed down for canadian crosses. 1763 if test x"$CANADIAN" = xyes; then 1764 TOPLEVEL_INCLUDES='-I$(includedir)' 1765 fi 1766 1767 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath' 1768 1769 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++' 1770 1771 if test x"$need_libio" = xyes; then 1772 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio' 1773 AC_SUBST(LIBIO_INCLUDES) 1774 fi 1775 1776 # Now, export this to all the little Makefiles.... 1777 AC_SUBST(GLIBCPP_INCLUDES) 1778 AC_SUBST(TOPLEVEL_INCLUDES) 1779 AC_SUBST(LIBMATH_INCLUDES) 1780 AC_SUBST(LIBSUPCXX_INCLUDES) 1781]) 1782 1783 1784dnl 1785dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's. 1786dnl 1787AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [ 1788 # Optimization flags that are probably a good idea for thrill-seekers. Just 1789 # uncomment the lines below and make, everything else is ready to go... 1790 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc 1791 OPTIMIZE_CXXFLAGS= 1792 AC_SUBST(OPTIMIZE_CXXFLAGS) 1793 1794 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline' 1795 AC_SUBST(WARN_FLAGS) 1796]) 1797 1798dnl 1799dnl GLIBCPP_EXPORT_INSTALL_INFO 1800dnl calculates gxx_install_dir 1801dnl exports glibcpp_toolexecdir 1802dnl exports glibcpp_toolexeclibdir 1803dnl exports glibcpp_prefixdir 1804dnl 1805dnl Assumes cross_compiling bits already done, and with_cross_host in 1806dnl particular 1807dnl 1808dnl GLIBCPP_EXPORT_INSTALL_INFO 1809AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [ 1810# Assumes glibcpp_builddir, glibcpp_srcdir are alreay set up and 1811# exported correctly in GLIBCPP_CONFIGURE. 1812glibcpp_toolexecdir=no 1813glibcpp_toolexeclibdir=no 1814glibcpp_prefixdir=${prefix} 1815 1816# Process the option --with-gxx-include-dir=<path to include-files directory> 1817AC_MSG_CHECKING([for --with-gxx-include-dir]) 1818AC_ARG_WITH(gxx-include-dir, 1819[ --with-gxx-include-dir the installation directory for include files], 1820[case "${withval}" in 1821 yes) 1822 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir) 1823 gxx_include_dir=no 1824 ;; 1825 no) 1826 gxx_include_dir=no 1827 ;; 1828 *) 1829 gxx_include_dir=${withval} 1830 ;; 1831esac], [gxx_include_dir=no]) 1832AC_MSG_RESULT($gxx_include_dir) 1833 1834# Process the option "--enable-version-specific-runtime-libs" 1835AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) 1836AC_ARG_ENABLE(version-specific-runtime-libs, 1837[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ], 1838[case "$enableval" in 1839 yes) version_specific_libs=yes ;; 1840 no) version_specific_libs=no ;; 1841 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; 1842 esac], 1843version_specific_libs=no)dnl 1844# Option set, now we can test it. 1845AC_MSG_RESULT($version_specific_libs) 1846 1847# Default case for install directory for include files. 1848if test $version_specific_libs = no && test $gxx_include_dir = no; then 1849 gxx_include_dir='$(prefix)'/include/c++/${gcc_version} 1850fi 1851 1852# Version-specific runtime libs processing. 1853if test $version_specific_libs = yes; then 1854 # Need the gcc compiler version to know where to install libraries 1855 # and header files if --enable-version-specific-runtime-libs option 1856 # is selected. 1857 if test x"$gxx_include_dir" = x"no"; then 1858 gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/c++ 1859 fi 1860 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)' 1861 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)' 1862fi 1863 1864# Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir 1865# Install a library built with a cross compiler in tooldir, not libdir. 1866if test x"$glibcpp_toolexecdir" = x"no"; then 1867 if test -n "$with_cross_host" && 1868 test x"$with_cross_host" != x"no"; then 1869 glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)' 1870 glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)' 1871 else 1872 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)' 1873 glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)' 1874 fi 1875fi 1876 1877AC_MSG_CHECKING([for install location]) 1878AC_MSG_RESULT($gxx_include_dir) 1879 1880AC_SUBST(glibcpp_prefixdir) 1881AC_SUBST(gxx_include_dir) 1882AC_SUBST(glibcpp_toolexecdir) 1883AC_SUBST(glibcpp_toolexeclibdir) 1884]) 1885 1886 1887# Check for functions in math library. 1888# Ulrich Drepper <drepper@cygnus.com>, 1998. 1889# 1890# This file can be copied and used freely without restrictions. It can 1891# be used in projects which are not available under the GNU Public License 1892# but which still want to provide support for the GNU gettext functionality. 1893# Please note that the actual code is *not* freely available. 1894 1895# serial 1 1896 1897dnl AC_REPLACE_MATHFUNCS(FUNCTION...) 1898AC_DEFUN(AC_REPLACE_MATHFUNCS, 1899[AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])]) 1900 1901 1902dnl This macro searches for a GNU version of make. If a match is found, the 1903dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is 1904dnl set to "#". This is useful for including a special features in a Makefile, 1905dnl which cannot be handled by other versions of make. The variable 1906dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists, 1907dnl the empty string otherwise. 1908dnl 1909dnl Here is an example of its use: 1910dnl 1911dnl Makefile.in might contain: 1912dnl 1913dnl # A failsafe way of putting a dependency rule into a makefile 1914dnl $(DEPEND): 1915dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND) 1916dnl 1917dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND))) 1918dnl @ifGNUmake@ include $(DEPEND) 1919dnl @ifGNUmake@ endif 1920dnl 1921dnl Then configure.in would normally contain: 1922dnl 1923dnl CHECK_GNU_MAKE() 1924dnl AC_OUTPUT(Makefile) 1925dnl 1926dnl Then perhaps to cause gnu make to override any other make, we could do 1927dnl something like this (note that GNU make always looks for GNUmakefile first): 1928dnl 1929dnl if ! test x$_cv_gnu_make_command = x ; then 1930dnl mv Makefile GNUmakefile 1931dnl echo .DEFAULT: > Makefile ; 1932dnl echo \ $_cv_gnu_make_command \$@ >> Makefile; 1933dnl fi 1934dnl 1935dnl Then, if any (well almost any) other make is called, and GNU make also 1936dnl exists, then the other make wraps the GNU make. 1937dnl 1938dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au> 1939dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme 1940dnl 1941dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending 1942dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the 1943dnl #### conditional's subshell (" --version" is not a command), using a 1944dnl #### different option to grep(1). 1945dnl #### -pme 1946dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not 1947dnl #### ${MAKE:-make}). 1948dnl #### -msokolov 1949AC_DEFUN( 1950 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command, 1951 _cv_gnu_make_command='' ; 1952dnl Search all the common names for GNU make 1953 for a in "${MAKE-make}" make gmake gnumake ; do 1954 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null ) 1955 then 1956 _cv_gnu_make_command=$a ; 1957 break; 1958 fi 1959 done ; 1960 ) ; 1961dnl If there was a GNU version, then set @ifGNUmake@ to the empty 1962dnl string, '#' otherwise 1963 if test "x$_cv_gnu_make_command" != "x" ; then 1964 ifGNUmake='' ; 1965 else 1966 ifGNUmake='#' ; 1967 fi 1968 AC_SUBST(ifGNUmake) 1969]) 1970 1971 1972dnl Check for headers for, and arguments to, the setrlimit() function. 1973dnl Used only in testsuite_hooks.h. 1974AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT_ancilliary, [ 1975 AC_TRY_COMPILE([#include <sys/resource.h> 1976 #include <unistd.h> 1977 ], [ int f = RLIMIT_$1 ; ], 1978 [glibcpp_mresult=1], [glibcpp_mresult=0]) 1979 AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcpp_mresult, 1980 [Only used in build directory testsuite_hooks.h.]) 1981]) 1982AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT, [ 1983 setrlimit_have_headers=yes 1984 AC_CHECK_HEADERS(sys/resource.h unistd.h, 1985 [], 1986 setrlimit_have_headers=no) 1987 # If don't have the headers, then we can't run the tests now, and we 1988 # won't be seeing any of these during testsuite compilation. 1989 if test $setrlimit_have_headers = yes; then 1990 # Can't do these in a loop, else the resulting syntax is wrong. 1991 GLIBCPP_CHECK_SETRLIMIT_ancilliary(DATA) 1992 GLIBCPP_CHECK_SETRLIMIT_ancilliary(RSS) 1993 GLIBCPP_CHECK_SETRLIMIT_ancilliary(VMEM) 1994 GLIBCPP_CHECK_SETRLIMIT_ancilliary(AS) 1995 1996 # Check for rlimit, setrlimit. 1997 AC_CACHE_VAL(ac_setrlimit, [ 1998 AC_TRY_COMPILE([#include <sys/resource.h> 1999 #include <unistd.h> 2000 ], 2001 [ struct rlimit r; setrlimit(0, &r);], 2002 [ac_setrlimit=yes], [ac_setrlimit=no]) 2003 ]) 2004 fi 2005 2006 AC_MSG_CHECKING([for testsuite memory limit support]) 2007 if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then 2008 ac_mem_limits=yes 2009 AC_DEFINE(_GLIBCPP_MEM_LIMITS) 2010 else 2011 ac_mem_limits=no 2012 fi 2013 AC_MSG_RESULT($ac_mem_limits) 2014]) 2015 2016 2017dnl 2018dnl Does any necessary configuration of the testsuite directory. Generates 2019dnl the testsuite_hooks.h header. 2020dnl 2021dnl GLIBCPP_CONFIGURE_TESTSUITE [no args] 2022AC_DEFUN(GLIBCPP_CONFIGURE_TESTSUITE, [ 2023 GLIBCPP_CHECK_SETRLIMIT 2024 2025 # Look for setenv, so that extended locale tests can be performed. 2026 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv) 2027 2028 # Export file names for ABI checking. 2029 baseline_file="${glibcpp_srcdir}/config/abi/${abi_baseline_triplet}/baseline_symbols.txt" 2030 AC_SUBST(baseline_file) 2031 2032 # Don't do ABI checking unless native. 2033 AM_CONDITIONAL(GLIBCPP_BUILD_ABI_CHECK, 2034 test x"$build" = x"$host" && test -z "$with_cross_host") 2035]) 2036 2037 2038sinclude(../libtool.m4) 2039dnl The lines below arrange for aclocal not to bring an installed 2040dnl libtool.m4 into aclocal.m4, while still arranging for automake to 2041dnl add a definition of LIBTOOL to Makefile.in. 2042ifelse(,,,[AC_SUBST(LIBTOOL) 2043AC_DEFUN([AM_PROG_LIBTOOL]) 2044AC_DEFUN([AC_LIBTOOL_DLOPEN]) 2045AC_DEFUN([AC_PROG_LD]) 2046]) 2047 2048 2049# Check whether LC_MESSAGES is available in <locale.h>. 2050# Ulrich Drepper <drepper@cygnus.com>, 1995. 2051# 2052# This file file be copied and used freely without restrictions. It can 2053# be used in projects which are not available under the GNU Public License 2054# but which still want to provide support for the GNU gettext functionality. 2055# Please note that the actual code is *not* freely available. 2056 2057# serial 1 2058 2059AC_DEFUN(AC_LC_MESSAGES, [ 2060 AC_CHECK_HEADER(locale.h, [ 2061 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES, 2062 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], 2063 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)]) 2064 if test $ac_cv_val_LC_MESSAGES = yes; then 2065 AC_DEFINE(HAVE_LC_MESSAGES) 2066 fi 2067 ]) 2068]) 2069 2070 2071dnl 2072dnl Check for whether the Boost-derived checks should be turned on. 2073dnl 2074dnl GLIBCPP_ENABLE_CONCEPT_CHECKS 2075dnl --enable-concept-checks turns them on. 2076dnl --disable-concept-checks leaves them off. 2077dnl + Usage: GLIBCPP_ENABLE_CONCEPT_CHECKS[(DEFAULT)] 2078dnl Where DEFAULT is either `yes' or `no'. If ommitted, it 2079dnl defaults to `no'. 2080AC_DEFUN(GLIBCPP_ENABLE_CONCEPT_CHECKS, [dnl 2081define([GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT], ifelse($1, yes, yes, no))dnl 2082AC_ARG_ENABLE(concept-checks, 2083changequote(<<, >>)dnl 2084<< --enable-concept-checks use Boost-derived template checks [default=>>GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT], 2085changequote([, ])dnl 2086[case "$enableval" in 2087 yes) enable_concept_checks=yes ;; 2088 no) enable_concept_checks=no ;; 2089 *) AC_MSG_ERROR([Unknown argument to enable/disable concept checks]) ;; 2090 esac], 2091enable_concept_checks=GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT)dnl 2092dnl Option parsed, now set things appropriately 2093if test x"$enable_concept_checks" = xyes; then 2094 AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS) 2095fi 2096]) 2097 2098 2099dnl 2100dnl Add version tags to symbols in shared library (or not), additionally 2101dnl marking other symbols as private/local (or not). 2102dnl 2103dnl GLIBCPP_ENABLE_SYMVERS 2104dnl --enable-symvers=style adds a version script to the linker call when 2105dnl creating the shared library. The choice of version script is 2106dnl controlled by 'style'. 2107dnl --disable-symvers does not. 2108dnl + Usage: GLIBCPP_ENABLE_SYMVERS[(DEFAULT)] 2109dnl Where DEFAULT is either `yes' or `no'. If ommitted, it 2110dnl defaults to `no'. Passing `yes' tries to choose a default style 2111dnl based on linker characteristics. Passing 'no' disables versioning. 2112AC_DEFUN(GLIBCPP_ENABLE_SYMVERS, [dnl 2113define([GLIBCPP_ENABLE_SYMVERS_DEFAULT], ifelse($1, yes, yes, no))dnl 2114AC_ARG_ENABLE(symvers, 2115changequote(<<, >>)dnl 2116<< --enable-symvers=style enables symbol versioning of the shared library [default=>>GLIBCPP_ENABLE_SYMVERS_DEFAULT], 2117changequote([, ])dnl 2118[case "$enableval" in 2119 yes) enable_symvers=yes ;; 2120 no) enable_symvers=no ;; 2121 # other names here, just as sanity checks 2122 #gnu|sun|etcetera) enable_symvers=$enableval ;; 2123 gnu) enable_symvers=$enableval ;; 2124 *) AC_MSG_ERROR([Unknown argument to enable/disable symvers]) ;; 2125 esac], 2126enable_symvers=GLIBCPP_ENABLE_SYMVERS_DEFAULT)dnl 2127 2128# If we never went through the GLIBCPP_CHECK_LINKER_FEATURES macro, then we 2129# don't know enough about $LD to do tricks... 2130if test x$enable_shared = xno || 2131 test "x$LD" = x || 2132 test x$glibcpp_gnu_ld_version = x; then 2133 enable_symvers=no 2134fi 2135 2136# Check to see if libgcc_s exists, indicating that shared libgcc is possible. 2137AC_MSG_CHECKING([for shared libgcc]) 2138ac_save_CFLAGS="$CFLAGS" 2139CFLAGS=' -lgcc_s' 2140AC_TRY_LINK( , [return 0], glibcpp_shared_libgcc=yes, glibcpp_shared_libgcc=no) 2141CFLAGS="$ac_save_CFLAGS" 2142AC_MSG_RESULT($glibcpp_shared_libgcc) 2143 2144# For GNU ld, we need at least this version. It's 2.12 in the same format 2145# as the tested-for version. See GLIBCPP_CHECK_LINKER_FEATURES for more. 2146glibcpp_min_gnu_ld_version=21200 2147 2148# Check to see if unspecified "yes" value can win, given results 2149# above. 2150if test $enable_symvers = yes ; then 2151 if test $with_gnu_ld = yes && 2152 test $glibcpp_shared_libgcc = yes ; 2153 then 2154 if test $glibcpp_gnu_ld_version -ge $glibcpp_min_gnu_ld_version ; then 2155 enable_symvers=gnu 2156 else 2157 ac_test_CFLAGS="${CFLAGS+set}" 2158 ac_save_CFLAGS="$CFLAGS" 2159 CFLAGS='-shared -Wl,--version-script,conftest.map' 2160 enable_symvers=no 2161 changequote(,) 2162 echo 'FOO { global: f[a-z]o; local: *; };' > conftest.map 2163 changequote([,]) 2164 AC_TRY_LINK([int foo;],, enable_symvers=gnu) 2165 if test "$ac_test_CFLAGS" = set; then 2166 CFLAGS="$ac_save_CFLAGS" 2167 else 2168 # this is the suspicious part 2169 CFLAGS='' 2170 fi 2171 rm -f conftest.map 2172 fi 2173 else 2174 # just fail for now 2175 enable_symvers=no 2176 fi 2177fi 2178 2179dnl Everything parsed; figure out what file to use. 2180case $enable_symvers in 2181 no) 2182 LINKER_MAP=config/linker-map.dummy 2183 ;; 2184 gnu) 2185 LINKER_MAP=config/linker-map.gnu 2186 ;; 2187esac 2188 2189AC_LINK_FILES($LINKER_MAP, src/linker.map) 2190AM_CONDITIONAL(GLIBCPP_BUILD_VERSIONED_SHLIB, test $enable_symvers != no) 2191AC_MSG_CHECKING([versioning on shared library symbols]) 2192AC_MSG_RESULT($enable_symvers) 2193]) 2194 2195