acinclude.m4 revision 107606
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 #include <string.h> 1135 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) 1136 extern __typeof(newlocale) __newlocale; 1137 extern __typeof(duplocale) __duplocale; 1138 extern __typeof(strcoll_l) __strcoll_l; 1139 #endif 1140 int main() 1141 { 1142 const char __one[] = "�uglein Augmen"; 1143 const char __two[] = "�uglein"; 1144 int i; 1145 int j; 1146 __locale_t loc; 1147 __locale_t loc_dup; 1148 loc = __newlocale(1 << LC_ALL, "de_DE", 0); 1149 loc_dup = __duplocale(loc); 1150 i = __strcoll_l(__one, __two, loc); 1151 j = __strcoll_l(__one, __two, loc_dup); 1152 return 0; 1153 } 1154 ], 1155 [enable_clocale_flag=gnu],[enable_clocale_flag=generic], 1156 [enable_clocale_flag=generic]) 1157 fi 1158 1159 # ... at some point put __strxfrm_l tests in as well. 1160 ;; 1161 *) 1162 enable_clocale_flag=generic 1163 ;; 1164 esac 1165 fi 1166 1167 dnl Deal with gettext issues. 1168 AC_ARG_ENABLE(nls, 1169 [ --enable-nls use Native Language Support (default)], 1170 , enable_nls=yes) 1171 USE_NLS=no 1172 1173 dnl Set configure bits for specified locale package 1174 case x${enable_clocale_flag} in 1175 xgeneric) 1176 AC_MSG_RESULT(generic) 1177 1178 CLOCALE_H=config/locale/generic/c_locale.h 1179 CLOCALE_CC=config/locale/generic/c_locale.cc 1180 CCODECVT_H=config/locale/generic/codecvt_specializations.h 1181 CCODECVT_CC=config/locale/generic/codecvt_members.cc 1182 CCOLLATE_CC=config/locale/generic/collate_members.cc 1183 CCTYPE_CC=config/locale/generic/ctype_members.cc 1184 CMESSAGES_H=config/locale/generic/messages_members.h 1185 CMESSAGES_CC=config/locale/generic/messages_members.cc 1186 CMONEY_CC=config/locale/generic/monetary_members.cc 1187 CNUMERIC_CC=config/locale/generic/numeric_members.cc 1188 CTIME_CC=config/locale/generic/time_members.cc 1189 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h 1190 ;; 1191 xgnu) 1192 AC_MSG_RESULT(gnu) 1193 1194 # Declare intention to use gettext, and add support for specific 1195 # languages. 1196 # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT 1197 ALL_LINGUAS="de fr" 1198 1199 # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. 1200 AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) 1201 if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then 1202 USE_NLS=yes 1203 fi 1204 # Export the build objects. 1205 for ling in $ALL_LINGUAS; do \ 1206 glibcpp_MOFILES="$glibcpp_MOFILES $ling.mo"; \ 1207 glibcpp_POFILES="$glibcpp_POFILES $ling.po"; \ 1208 done 1209 AC_SUBST(glibcpp_MOFILES) 1210 AC_SUBST(glibcpp_POFILES) 1211 1212 CLOCALE_H=config/locale/gnu/c_locale.h 1213 CLOCALE_CC=config/locale/gnu/c_locale.cc 1214 CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h 1215 CCODECVT_CC=config/locale/gnu/codecvt_members.cc 1216 CCOLLATE_CC=config/locale/gnu/collate_members.cc 1217 CCTYPE_CC=config/locale/gnu/ctype_members.cc 1218 CMESSAGES_H=config/locale/gnu/messages_members.h 1219 CMESSAGES_CC=config/locale/gnu/messages_members.cc 1220 CMONEY_CC=config/locale/gnu/monetary_members.cc 1221 CNUMERIC_CC=config/locale/gnu/numeric_members.cc 1222 CTIME_CC=config/locale/gnu/time_members.cc 1223 CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h 1224 ;; 1225 xieee_1003.1-2001) 1226 AC_MSG_RESULT(generic) 1227 1228 CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h 1229 CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc 1230 CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h 1231 CCODECVT_CC=config/locale/generic/codecvt_members.cc 1232 CCOLLATE_CC=config/locale/generic/collate_members.cc 1233 CCTYPE_CC=config/locale/generic/ctype_members.cc 1234 CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h 1235 CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc 1236 CMONEY_CC=config/locale/generic/monetary_members.cc 1237 CNUMERIC_CC=config/locale/generic/numeric_members.cc 1238 CTIME_CC=config/locale/generic/time_members.cc 1239 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h 1240 ;; 1241 *) 1242 echo "$enable_clocale is an unknown locale package" 1>&2 1243 exit 1 1244 ;; 1245 esac 1246 1247 # This is where the testsuite looks for locale catalogs, using the 1248 # -DLOCALEDIR define during testsuite compilation. 1249 glibcpp_localedir=${glibcpp_builddir}/po/share/locale 1250 AC_SUBST(glibcpp_localedir) 1251 1252 # For the time being, transform ctype_noninline.h to ctype_members_char.cc 1253# CCTYPE_CHAR_CC=config/${os_include_dir}/ctype_noninline.h 1254 1255 AC_SUBST(USE_NLS) 1256 AC_SUBST(CLOCALE_H) 1257 AC_SUBST(CCODECVT_H) 1258 AC_SUBST(CMESSAGES_H) 1259 AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc) 1260 AC_LINK_FILES($CCODECVT_CC, src/codecvt_members.cc) 1261 AC_LINK_FILES($CCOLLATE_CC, src/collate_members.cc) 1262# AC_LINK_FILES($CCTYPE_CHAR_CC, src/ctype_members_char.cc) 1263 AC_LINK_FILES($CCTYPE_CC, src/ctype_members.cc) 1264 AC_LINK_FILES($CMESSAGES_CC, src/messages_members.cc) 1265 AC_LINK_FILES($CMONEY_CC, src/monetary_members.cc) 1266 AC_LINK_FILES($CNUMERIC_CC, src/numeric_members.cc) 1267 AC_LINK_FILES($CTIME_CC, src/time_members.cc) 1268 AC_LINK_FILES($CLOCALE_INTERNAL_H, src/c++locale_internal.h) 1269]) 1270 1271 1272dnl 1273dnl Check for which I/O library to use: libio, or something specific. 1274dnl 1275dnl GLIBCPP_ENABLE_CSTDIO 1276dnl --enable-cstdio=libio sets config/io/c_io_libio.h and friends 1277dnl 1278dnl default is stdio 1279dnl 1280AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [ 1281 AC_MSG_CHECKING([for cstdio to use]) 1282 AC_ARG_ENABLE(cstdio, 1283 [ --enable-cstdio enable stdio for target io package. 1284 --enable-cstdio=LIB use LIB target-speific io package. [default=stdio] 1285 ], 1286 if test x$enable_cstdio = xno; then 1287 enable_cstdio=stdio 1288 fi, 1289 enable_cstdio=stdio) 1290 1291 enable_cstdio_flag=$enable_cstdio 1292 1293 dnl Check if a valid I/O package 1294 case x${enable_cstdio_flag} in 1295 xlibio) 1296 CSTDIO_H=config/io/c_io_libio.h 1297 BASIC_FILE_H=config/io/basic_file_libio.h 1298 BASIC_FILE_CC=config/io/basic_file_libio.cc 1299 AC_MSG_RESULT(libio) 1300 1301 # see if we are on a system with libio native (ie, linux) 1302 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no) 1303 1304 # Need to check and see what version of glibc is being used. If 1305 # it's not glibc-2.2 or higher, then we'll need to go ahead and 1306 # compile most of libio for linux systems. 1307 if test x$has_libio = x"yes"; then 1308 case "$target" in 1309 *-*-linux*) 1310 AC_MSG_CHECKING([for glibc version >= 2.2]) 1311 AC_EGREP_CPP([ok], [ 1312 #include <features.h> 1313 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) 1314 ok 1315 #endif 1316 ], glibc_satisfactory=yes, glibc_satisfactory=no) 1317 AC_MSG_RESULT($glibc_satisfactory) 1318 ;; 1319 esac 1320 1321 # XXX at the moment, admit defeat and force the recompilation 1322 # XXX of glibc even on glibc-2.2 systems, because libio is not synched. 1323 glibc_satisfactory=no 1324 1325 if test x$glibc_satisfactory = x"yes"; then 1326 need_libio=no 1327 need_wlibio=no 1328 else 1329 need_libio=yes 1330 # bkoz XXX need to add checks to enable this 1331 # pme XXX here's a first pass at such a check 1332 if test x$enable_c_mbchar != xno; then 1333 need_wlibio=yes 1334 else 1335 need_wlibio=no 1336 fi 1337 fi 1338 1339 else 1340 # Using libio, but <libio.h> doesn't exist on the target system. . . 1341 need_libio=yes 1342 # bkoz XXX need to add checks to enable this 1343 # pme XXX here's a first pass at such a check 1344 if test x$enable_c_mbchar != xno; then 1345 need_wlibio=yes 1346 else 1347 need_wlibio=no 1348 fi 1349 fi 1350 ;; 1351 xstdio | x | xno | xnone | xyes) 1352 # default 1353 CSTDIO_H=config/io/c_io_stdio.h 1354 BASIC_FILE_H=config/io/basic_file_stdio.h 1355 BASIC_FILE_CC=config/io/basic_file_stdio.cc 1356 AC_MSG_RESULT(stdio) 1357 1358 # We're not using stdio. 1359 need_libio=no 1360 need_wlibio=no 1361 ;; 1362 *) 1363 echo "$enable_cstdio is an unknown io package" 1>&2 1364 exit 1 1365 ;; 1366 esac 1367 AC_SUBST(CSTDIO_H) 1368 AC_SUBST(BASIC_FILE_H) 1369 AC_LINK_FILES($BASIC_FILE_CC, src/basic_file.cc) 1370 1371 # 2000-08-04 bkoz hack 1372 CCODECVT_C=config/io/c_io_libio_codecvt.c 1373 AC_SUBST(CCODECVT_C) 1374 # 2000-08-04 bkoz hack 1375 1376 AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO, 1377 test "$need_libio" = yes || test "$need_wlibio" = yes) 1378 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes) 1379 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes) 1380 if test "$need_libio" = yes || test "$need_wlibio" = yes; then 1381 libio_la=../libio/libio.la 1382 else 1383 libio_la= 1384 fi 1385 AC_SUBST(libio_la) 1386]) 1387 1388 1389dnl 1390dnl Setup to use the gcc gthr.h thread-specific memory and mutex model. 1391dnl We must stage the required headers so that they will be installed 1392dnl with the library (unlike libgcc, the STL implementation is provided 1393dnl solely within headers). Since we must not inject random user-space 1394dnl macro names into user-provided C++ code, we first stage into <file>-in 1395dnl and process to <file> with an output command. The reason for a two- 1396dnl stage process here is to correctly handle $srcdir!=$objdir without 1397dnl having to write complex code (the sed commands to clean the macro 1398dnl namespace are complex and fragile enough as it is). We must also 1399dnl add a relative path so that -I- is supported properly. 1400dnl 1401AC_DEFUN(GLIBCPP_ENABLE_THREADS, [ 1402 AC_MSG_CHECKING([for thread model used by GCC]) 1403 target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'` 1404 AC_MSG_RESULT([$target_thread_file]) 1405 1406 if test $target_thread_file != single; then 1407 AC_DEFINE(HAVE_GTHR_DEFAULT) 1408 AC_DEFINE(_GLIBCPP_SUPPORTS_WEAK, __GXX_WEAK__) 1409 fi 1410 1411 glibcpp_thread_h=gthr-$target_thread_file.h 1412 AC_SUBST(glibcpp_thread_h) 1413]) 1414 1415 1416dnl 1417dnl Check for exception handling support. If an explicit enable/disable 1418dnl sjlj exceptions is given, we don't have to detect. Otherwise the 1419dnl target may or may not support call frame exceptions. 1420dnl 1421dnl GLIBCPP_ENABLE_SJLJ_EXCEPTIONS 1422dnl --enable-sjlj-exceptions forces the use of builtin setjmp. 1423dnl --disable-sjlj-exceptions forces the use of call frame unwinding. 1424dnl 1425dnl Define _GLIBCPP_SJLJ_EXCEPTIONS if the compiler is configured for it. 1426dnl 1427AC_DEFUN(GLIBCPP_ENABLE_SJLJ_EXCEPTIONS, [ 1428 AC_MSG_CHECKING([for exception model to use]) 1429 AC_LANG_SAVE 1430 AC_LANG_CPLUSPLUS 1431 AC_ARG_ENABLE(sjlj-exceptions, 1432 [ --enable-sjlj-exceptions force use of builtin_setjmp for exceptions], 1433 [:], 1434 [dnl Botheration. Now we've got to detect the exception model. 1435 dnl Link tests against libgcc.a are problematic since -- at least 1436 dnl as of this writing -- we've not been given proper -L bits for 1437 dnl single-tree newlib and libgloss. 1438 dnl 1439 dnl This is what AC_TRY_COMPILE would do if it didn't delete the 1440 dnl conftest files before we got a change to grep them first. 1441 cat > conftest.$ac_ext << EOF 1442[#]line __oline__ "configure" 1443struct S { ~S(); }; 1444void bar(); 1445void foo() 1446{ 1447 S s; 1448 bar(); 1449} 1450EOF 1451 old_CXXFLAGS="$CXXFLAGS" 1452 CXXFLAGS="-S -fexceptions" 1453 if AC_TRY_EVAL(ac_compile); then 1454 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then 1455 enable_sjlj_exceptions=yes 1456 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then 1457 enable_sjlj_exceptions=no 1458 fi 1459 fi 1460 CXXFLAGS="$old_CXXFLAGS" 1461 rm -f conftest*]) 1462 if test x$enable_sjlj_exceptions = xyes; then 1463 AC_DEFINE(_GLIBCPP_SJLJ_EXCEPTIONS, 1, 1464 [Define if the compiler is configured for setjmp/longjmp exceptions.]) 1465 ac_exception_model_name=sjlj 1466 elif test x$enable_sjlj_exceptions = xno; then 1467 ac_exception_model_name="call frame" 1468 else 1469 AC_MSG_ERROR([unable to detect exception model]) 1470 fi 1471 AC_LANG_RESTORE 1472 AC_MSG_RESULT($ac_exception_model_name) 1473]) 1474 1475 1476dnl 1477dnl Check for libunwind exception handling support. If enabled then 1478dnl we assume that the _Unwind_* functions that make up the Unwind ABI 1479dnl (_Unwind_RaiseException, _Unwind_Resume, etc.) are defined by 1480dnl libunwind instead of libgcc and that libstdc++ has a dependency 1481dnl on libunwind as well as libgcc. 1482dnl 1483dnl GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS 1484dnl --enable-libunwind-exceptions forces the use of libunwind. 1485dnl --disable-libunwind-exceptions assumes there is no libunwind. 1486dnl 1487dnl Define _GLIBCPP_LIBUNWIND_EXCEPTIONS if requested. 1488dnl 1489AC_DEFUN(GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS, [ 1490 AC_MSG_CHECKING([for use of libunwind]) 1491 AC_ARG_ENABLE(libunwind-exceptions, 1492 [ --enable-libunwind-exceptions force use of libunwind for exceptions], 1493 use_libunwind_exceptions=$enableval, 1494 use_libunwind_exceptions=no) 1495 AC_MSG_RESULT($use_libunwind_exceptions) 1496 dnl Option parsed, now set things appropriately 1497 if test x"$use_libunwind_exceptions" = xyes; then 1498 LIBUNWIND_FLAG="-lunwind" 1499 else 1500 LIBUNWIND_FLAG="" 1501 fi 1502 AC_SUBST(LIBUNWIND_FLAG) 1503]) 1504 1505dnl 1506dnl Check for ISO/IEC 9899:1999 "C99" support. 1507dnl 1508dnl GLIBCPP_ENABLE_C99 1509dnl --enable-c99 defines _GLIBCPP_USE_C99 1510dnl --disable-c99 leaves _GLIBCPP_USE_C99 undefined 1511dnl + Usage: GLIBCPP_ENABLE_C99[(DEFAULT)] 1512dnl Where DEFAULT is either `yes' or `no'. If omitted, it 1513dnl defaults to `no'. 1514dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'. 1515dnl 1516dnl GLIBCPP_ENABLE_C99 1517AC_DEFUN(GLIBCPP_ENABLE_C99, [dnl 1518 define([GLIBCPP_ENABLE_C99_DEFAULT], ifelse($1, yes, yes, no))dnl 1519 1520 AC_ARG_ENABLE(c99, 1521 changequote(<<, >>)dnl 1522 <<--enable-c99 turns on 'ISO/IEC 9899:1999 support' [default=>>GLIBCPP_ENABLE_C99_DEFAULT], 1523 changequote([, ])dnl 1524 [case "$enableval" in 1525 yes) enable_c99=yes ;; 1526 no) enable_c99=no ;; 1527 *) AC_MSG_ERROR([Unknown argument to enable/disable C99]) ;; 1528 esac], 1529 enable_c99=GLIBCPP_ENABLE_C99_DEFAULT)dnl 1530 1531 AC_LANG_SAVE 1532 AC_LANG_CPLUSPLUS 1533 1534 # Check for the existence of <math.h> functions used if C99 is enabled. 1535 ac_c99_math=yes; 1536 AC_MSG_CHECKING([for ISO C99 support in <math.h>]) 1537 AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no]) 1538 AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no]) 1539 AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no]) 1540 AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no]) 1541 AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no]) 1542 AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no]) 1543 AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no]) 1544 AC_TRY_COMPILE([#include <math.h>], 1545 [isgreaterequal(0.0,0.0);],, [ac_c99_math=no]) 1546 AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no]) 1547 AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no]) 1548 AC_TRY_COMPILE([#include <math.h>], 1549 [islessgreater(0.0,0.0);],, [ac_c99_math=no]) 1550 AC_TRY_COMPILE([#include <math.h>], 1551 [isunordered(0.0,0.0);],, [ac_c99_math=no]) 1552 AC_MSG_RESULT($ac_c99_math) 1553 1554 # Check for the existence in <stdio.h> of vscanf, et. al. 1555 ac_c99_stdio=yes; 1556 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>]) 1557 AC_TRY_COMPILE([#include <stdio.h>], 1558 [snprintf("12", 0, "%i");],, [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 vfscanf(stderr, "%i", args);}], 1564 [],, [ac_c99_stdio=no]) 1565 AC_TRY_COMPILE([#include <stdio.h> 1566 #include <stdarg.h> 1567 void foo(char* fmt, ...) 1568 {va_list args; va_start(args, fmt); 1569 vscanf("%i", args);}], 1570 [],, [ac_c99_stdio=no]) 1571 AC_TRY_COMPILE([#include <stdio.h> 1572 #include <stdarg.h> 1573 void foo(char* fmt, ...) 1574 {va_list args; va_start(args, fmt); 1575 vsnprintf(fmt, 0, "%i", args);}], 1576 [],, [ac_c99_stdio=no]) 1577 AC_TRY_COMPILE([#include <stdio.h> 1578 #include <stdarg.h> 1579 void foo(char* fmt, ...) 1580 {va_list args; va_start(args, fmt); 1581 vsscanf(fmt, "%i", args);}], 1582 [],, [ac_c99_stdio=no]) 1583 AC_MSG_RESULT($ac_c99_stdio) 1584 1585 # Check for the existence in <stdlib.h> of lldiv_t, et. al. 1586 ac_c99_stdlib=yes; 1587 AC_MSG_CHECKING([for lldiv_t declaration]) 1588 AC_CACHE_VAL(ac_c99_lldiv_t, [ 1589 AC_TRY_COMPILE([#include <stdlib.h>], 1590 [ lldiv_t mydivt;], 1591 [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no]) 1592 ]) 1593 AC_MSG_RESULT($ac_c99_lldiv_t) 1594 1595 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>]) 1596 AC_TRY_COMPILE([#include <stdlib.h>], 1597 [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no]) 1598 AC_TRY_COMPILE([#include <stdlib.h>], 1599 [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no]) 1600 AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no]) 1601 AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no]) 1602 AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no]) 1603 AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no]) 1604 if test x"$ac_c99_lldiv_t" = x"no"; then 1605 ac_c99_stdlib=no; 1606 fi; 1607 AC_MSG_RESULT($ac_c99_stdlib) 1608 1609 # Check for the existence of <wchar.h> functions used if C99 is enabled. 1610 # XXX the wchar.h checks should be rolled into the general C99 bits. 1611 ac_c99_wchar=yes; 1612 AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>]) 1613 AC_TRY_COMPILE([#include <wchar.h>], 1614 [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no]) 1615 AC_TRY_COMPILE([#include <wchar.h>], 1616 [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no]) 1617 AC_TRY_COMPILE([#include <wchar.h>], 1618 [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no]) 1619 AC_MSG_RESULT($ac_c99_wchar) 1620 1621 AC_MSG_CHECKING([for enabled ISO C99 support]) 1622 if test x"$ac_c99_math" = x"no" || 1623 test x"$ac_c99_stdio" = x"no" || 1624 test x"$ac_c99_stdlib" = x"no" || 1625 test x"$ac_c99_wchar" = x"no"; then 1626 enable_c99=no; 1627 fi; 1628 AC_MSG_RESULT($enable_c99) 1629 1630 # Option parsed, now set things appropriately 1631 if test x"$enable_c99" = x"yes"; then 1632 AC_DEFINE(_GLIBCPP_USE_C99) 1633 fi 1634 1635 AC_LANG_RESTORE 1636]) 1637 1638 1639dnl 1640dnl Check for template specializations for the 'long long' type extension. 1641dnl The result determines only whether 'long long' I/O is enabled; things 1642dnl like numeric_limits<> specializations are always available. 1643dnl 1644dnl GLIBCPP_ENABLE_LONG_LONG 1645dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG 1646dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined 1647dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)] 1648dnl Where DEFAULT is either `yes' or `no'. If omitted, it 1649dnl defaults to `no'. 1650dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'. 1651dnl 1652dnl GLIBCPP_ENABLE_LONG_LONG 1653AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl 1654 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl 1655 1656 AC_ARG_ENABLE(long-long, 1657 changequote(<<, >>)dnl 1658 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT], 1659 changequote([, ])dnl 1660 [case "$enableval" in 1661 yes) enable_long_long=yes ;; 1662 no) enable_long_long=no ;; 1663 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;; 1664 esac], 1665 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl 1666 1667 AC_LANG_SAVE 1668 AC_LANG_CPLUSPLUS 1669 1670 AC_MSG_CHECKING([for enabled long long I/O support]) 1671 # iostreams require strtoll, strtoull to compile 1672 AC_TRY_COMPILE([#include <stdlib.h>], 1673 [char* tmp; strtoll("gnu", &tmp, 10);],,[enable_long_long=no]) 1674 AC_TRY_COMPILE([#include <stdlib.h>], 1675 [char* tmp; strtoull("gnu", &tmp, 10);],,[enable_long_long=no]) 1676 1677 # Option parsed, now set things appropriately 1678 if test x"$enable_long_long" = xyes; then 1679 AC_DEFINE(_GLIBCPP_USE_LONG_LONG) 1680 fi 1681 AC_MSG_RESULT($enable_long_long) 1682 1683 AC_LANG_RESTORE 1684]) 1685 1686 1687dnl 1688dnl Check for what kind of C headers to use. 1689dnl 1690dnl GLIBCPP_ENABLE_CHEADERS 1691dnl --enable-cheaders= [does stuff]. 1692dnl --disable-cheaders [does not do anything, really]. 1693dnl + This will eventually need to be 'c_shadow' by default. 1694dnl + Usage: GLIBCPP_ENABLE_CHEADERS[(DEFAULT)] 1695dnl Where DEFAULT is either `c' or `c_std' or 'c_shadow'. 1696dnl If ommitted, it defaults to `c_std'. 1697AC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl 1698define([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl 1699AC_MSG_CHECKING([for c header strategy to use]) 1700AC_ARG_ENABLE(cheaders, 1701changequote(<<, >>)dnl 1702<< --enable-cheaders construct "C" header files for g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT], 1703changequote([, ]) 1704 [case "$enableval" in 1705 c) 1706 enable_cheaders=c 1707 ;; 1708 c_std) 1709 enable_cheaders=c_std 1710 ;; 1711 c_shadow) 1712 enable_cheaders=c_shadow 1713 ;; 1714 *) AC_MSG_ERROR([Unknown argument to enable/disable "C" headers]) 1715 ;; 1716 esac], 1717 enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT) 1718 AC_MSG_RESULT($enable_cheaders) 1719 1720 dnl Option parsed, now set things appropriately 1721 case "$enable_cheaders" in 1722 c_shadow) 1723 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_shadow' 1724 ;; 1725 c_std) 1726 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_std' 1727 ;; 1728 c) 1729 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c' 1730 ;; 1731 esac 1732 1733 AC_SUBST(C_INCLUDE_DIR) 1734 AM_CONDITIONAL(GLIBCPP_C_HEADERS_C, test "$enable_cheaders" = c) 1735 AM_CONDITIONAL(GLIBCPP_C_HEADERS_C_STD, test "$enable_cheaders" = c_std) 1736 AM_CONDITIONAL(GLIBCPP_C_HEADERS_COMPATIBILITY, test "$c_compatibility" = yes) 1737]) 1738 1739 1740dnl 1741dnl Check for wide character support. Has the same effect as the option 1742dnl in gcc's configure, but in a form that autoconf can mess with. 1743dnl 1744dnl GLIBCPP_ENABLE_C_MBCHAR 1745dnl --enable-c-mbchar requests all the wchar_t stuff. 1746dnl --disable-c-mbchar doesn't. 1747dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)] 1748dnl Where DEFAULT is either `yes' or `no'. If ommitted, it 1749dnl defaults to `no'. 1750AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl 1751define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl 1752AC_ARG_ENABLE(c-mbchar, 1753changequote(<<, >>)dnl 1754<< --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], 1755changequote([, ])dnl 1756[case "$enableval" in 1757 yes) enable_c_mbchar=yes ;; 1758 no) enable_c_mbchar=no ;; 1759 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;; 1760 esac], 1761enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl 1762dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no. 1763]) 1764 1765 1766dnl 1767dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's. 1768dnl 1769dnl TOPLEVEL_INCLUDES 1770dnl LIBMATH_INCLUDES 1771dnl LIBSUPCXX_INCLUDES 1772dnl LIBIO_INCLUDES 1773dnl CSHADOW_INCLUDES 1774dnl 1775dnl GLIBCPP_EXPORT_INCLUDES 1776AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [ 1777 # Root level of the build directory include sources. 1778 GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include" 1779 1780 # Passed down for canadian crosses. 1781 if test x"$CANADIAN" = xyes; then 1782 TOPLEVEL_INCLUDES='-I$(includedir)' 1783 fi 1784 1785 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath' 1786 1787 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++' 1788 1789 if test x"$need_libio" = xyes; then 1790 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio' 1791 AC_SUBST(LIBIO_INCLUDES) 1792 fi 1793 1794 # Now, export this to all the little Makefiles.... 1795 AC_SUBST(GLIBCPP_INCLUDES) 1796 AC_SUBST(TOPLEVEL_INCLUDES) 1797 AC_SUBST(LIBMATH_INCLUDES) 1798 AC_SUBST(LIBSUPCXX_INCLUDES) 1799]) 1800 1801 1802dnl 1803dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's. 1804dnl 1805AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [ 1806 # Optimization flags that are probably a good idea for thrill-seekers. Just 1807 # uncomment the lines below and make, everything else is ready to go... 1808 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc 1809 OPTIMIZE_CXXFLAGS= 1810 AC_SUBST(OPTIMIZE_CXXFLAGS) 1811 1812 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline' 1813 AC_SUBST(WARN_FLAGS) 1814]) 1815 1816dnl 1817dnl GLIBCPP_EXPORT_INSTALL_INFO 1818dnl calculates gxx_install_dir 1819dnl exports glibcpp_toolexecdir 1820dnl exports glibcpp_toolexeclibdir 1821dnl exports glibcpp_prefixdir 1822dnl 1823dnl Assumes cross_compiling bits already done, and with_cross_host in 1824dnl particular 1825dnl 1826dnl GLIBCPP_EXPORT_INSTALL_INFO 1827AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [ 1828# Assumes glibcpp_builddir, glibcpp_srcdir are alreay set up and 1829# exported correctly in GLIBCPP_CONFIGURE. 1830glibcpp_toolexecdir=no 1831glibcpp_toolexeclibdir=no 1832glibcpp_prefixdir=${prefix} 1833 1834# Process the option --with-gxx-include-dir=<path to include-files directory> 1835AC_MSG_CHECKING([for --with-gxx-include-dir]) 1836AC_ARG_WITH(gxx-include-dir, 1837[ --with-gxx-include-dir the installation directory for include files], 1838[case "${withval}" in 1839 yes) 1840 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir) 1841 gxx_include_dir=no 1842 ;; 1843 no) 1844 gxx_include_dir=no 1845 ;; 1846 *) 1847 gxx_include_dir=${withval} 1848 ;; 1849esac], [gxx_include_dir=no]) 1850AC_MSG_RESULT($gxx_include_dir) 1851 1852# Process the option "--enable-version-specific-runtime-libs" 1853AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) 1854AC_ARG_ENABLE(version-specific-runtime-libs, 1855[ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ], 1856[case "$enableval" in 1857 yes) version_specific_libs=yes ;; 1858 no) version_specific_libs=no ;; 1859 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; 1860 esac], 1861version_specific_libs=no)dnl 1862# Option set, now we can test it. 1863AC_MSG_RESULT($version_specific_libs) 1864 1865# Default case for install directory for include files. 1866if test $version_specific_libs = no && test $gxx_include_dir = no; then 1867 gxx_include_dir='$(prefix)'/include/c++/${gcc_version} 1868fi 1869 1870# Version-specific runtime libs processing. 1871if test $version_specific_libs = yes; then 1872 # Need the gcc compiler version to know where to install libraries 1873 # and header files if --enable-version-specific-runtime-libs option 1874 # is selected. 1875 if test x"$gxx_include_dir" = x"no"; then 1876 gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/c++ 1877 fi 1878 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)' 1879 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)' 1880fi 1881 1882# Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir 1883# Install a library built with a cross compiler in tooldir, not libdir. 1884if test x"$glibcpp_toolexecdir" = x"no"; then 1885 if test -n "$with_cross_host" && 1886 test x"$with_cross_host" != x"no"; then 1887 glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)' 1888 glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)' 1889 else 1890 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)' 1891 glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)' 1892 fi 1893fi 1894 1895AC_MSG_CHECKING([for install location]) 1896AC_MSG_RESULT($gxx_include_dir) 1897 1898AC_SUBST(glibcpp_prefixdir) 1899AC_SUBST(gxx_include_dir) 1900AC_SUBST(glibcpp_toolexecdir) 1901AC_SUBST(glibcpp_toolexeclibdir) 1902]) 1903 1904 1905# Check for functions in math library. 1906# Ulrich Drepper <drepper@cygnus.com>, 1998. 1907# 1908# This file can be copied and used freely without restrictions. It can 1909# be used in projects which are not available under the GNU Public License 1910# but which still want to provide support for the GNU gettext functionality. 1911# Please note that the actual code is *not* freely available. 1912 1913# serial 1 1914 1915dnl AC_REPLACE_MATHFUNCS(FUNCTION...) 1916AC_DEFUN(AC_REPLACE_MATHFUNCS, 1917[AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])]) 1918 1919 1920dnl This macro searches for a GNU version of make. If a match is found, the 1921dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is 1922dnl set to "#". This is useful for including a special features in a Makefile, 1923dnl which cannot be handled by other versions of make. The variable 1924dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists, 1925dnl the empty string otherwise. 1926dnl 1927dnl Here is an example of its use: 1928dnl 1929dnl Makefile.in might contain: 1930dnl 1931dnl # A failsafe way of putting a dependency rule into a makefile 1932dnl $(DEPEND): 1933dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND) 1934dnl 1935dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND))) 1936dnl @ifGNUmake@ include $(DEPEND) 1937dnl @ifGNUmake@ endif 1938dnl 1939dnl Then configure.in would normally contain: 1940dnl 1941dnl CHECK_GNU_MAKE() 1942dnl AC_OUTPUT(Makefile) 1943dnl 1944dnl Then perhaps to cause gnu make to override any other make, we could do 1945dnl something like this (note that GNU make always looks for GNUmakefile first): 1946dnl 1947dnl if ! test x$_cv_gnu_make_command = x ; then 1948dnl mv Makefile GNUmakefile 1949dnl echo .DEFAULT: > Makefile ; 1950dnl echo \ $_cv_gnu_make_command \$@ >> Makefile; 1951dnl fi 1952dnl 1953dnl Then, if any (well almost any) other make is called, and GNU make also 1954dnl exists, then the other make wraps the GNU make. 1955dnl 1956dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au> 1957dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme 1958dnl 1959dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending 1960dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the 1961dnl #### conditional's subshell (" --version" is not a command), using a 1962dnl #### different option to grep(1). 1963dnl #### -pme 1964dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not 1965dnl #### ${MAKE:-make}). 1966dnl #### -msokolov 1967AC_DEFUN( 1968 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command, 1969 _cv_gnu_make_command='' ; 1970dnl Search all the common names for GNU make 1971 for a in "${MAKE-make}" make gmake gnumake ; do 1972 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null ) 1973 then 1974 _cv_gnu_make_command=$a ; 1975 break; 1976 fi 1977 done ; 1978 ) ; 1979dnl If there was a GNU version, then set @ifGNUmake@ to the empty 1980dnl string, '#' otherwise 1981 if test "x$_cv_gnu_make_command" != "x" ; then 1982 ifGNUmake='' ; 1983 else 1984 ifGNUmake='#' ; 1985 fi 1986 AC_SUBST(ifGNUmake) 1987]) 1988 1989 1990dnl Check for headers for, and arguments to, the setrlimit() function. 1991dnl Used only in testsuite_hooks.h. 1992AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT_ancilliary, [ 1993 AC_TRY_COMPILE([#include <sys/resource.h> 1994 #include <unistd.h> 1995 ], [ int f = RLIMIT_$1 ; ], 1996 [glibcpp_mresult=1], [glibcpp_mresult=0]) 1997 AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcpp_mresult, 1998 [Only used in build directory testsuite_hooks.h.]) 1999]) 2000AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT, [ 2001 setrlimit_have_headers=yes 2002 AC_CHECK_HEADERS(sys/resource.h unistd.h, 2003 [], 2004 setrlimit_have_headers=no) 2005 # If don't have the headers, then we can't run the tests now, and we 2006 # won't be seeing any of these during testsuite compilation. 2007 if test $setrlimit_have_headers = yes; then 2008 # Can't do these in a loop, else the resulting syntax is wrong. 2009 GLIBCPP_CHECK_SETRLIMIT_ancilliary(DATA) 2010 GLIBCPP_CHECK_SETRLIMIT_ancilliary(RSS) 2011 GLIBCPP_CHECK_SETRLIMIT_ancilliary(VMEM) 2012 GLIBCPP_CHECK_SETRLIMIT_ancilliary(AS) 2013 2014 # Check for rlimit, setrlimit. 2015 AC_CACHE_VAL(ac_setrlimit, [ 2016 AC_TRY_COMPILE([#include <sys/resource.h> 2017 #include <unistd.h> 2018 ], 2019 [ struct rlimit r; setrlimit(0, &r);], 2020 [ac_setrlimit=yes], [ac_setrlimit=no]) 2021 ]) 2022 fi 2023 2024 AC_MSG_CHECKING([for testsuite memory limit support]) 2025 if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then 2026 ac_mem_limits=yes 2027 AC_DEFINE(_GLIBCPP_MEM_LIMITS) 2028 else 2029 ac_mem_limits=no 2030 fi 2031 AC_MSG_RESULT($ac_mem_limits) 2032]) 2033 2034 2035dnl 2036dnl Does any necessary configuration of the testsuite directory. Generates 2037dnl the testsuite_hooks.h header. 2038dnl 2039dnl GLIBCPP_CONFIGURE_TESTSUITE [no args] 2040AC_DEFUN(GLIBCPP_CONFIGURE_TESTSUITE, [ 2041 GLIBCPP_CHECK_SETRLIMIT 2042 2043 # Look for setenv, so that extended locale tests can be performed. 2044 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv) 2045 2046 # Export file names for ABI checking. 2047 baseline_file="${glibcpp_srcdir}/config/abi/${abi_baseline_triplet}/baseline_symbols.txt" 2048 AC_SUBST(baseline_file) 2049 2050 # Don't do ABI checking unless native. 2051 AM_CONDITIONAL(GLIBCPP_BUILD_ABI_CHECK, 2052 test x"$build" = x"$host" && test -z "$with_cross_host") 2053]) 2054 2055 2056sinclude(../libtool.m4) 2057dnl The lines below arrange for aclocal not to bring an installed 2058dnl libtool.m4 into aclocal.m4, while still arranging for automake to 2059dnl add a definition of LIBTOOL to Makefile.in. 2060ifelse(,,,[AC_SUBST(LIBTOOL) 2061AC_DEFUN([AM_PROG_LIBTOOL]) 2062AC_DEFUN([AC_LIBTOOL_DLOPEN]) 2063AC_DEFUN([AC_PROG_LD]) 2064]) 2065 2066 2067# Check whether LC_MESSAGES is available in <locale.h>. 2068# Ulrich Drepper <drepper@cygnus.com>, 1995. 2069# 2070# This file file be copied and used freely without restrictions. It can 2071# be used in projects which are not available under the GNU Public License 2072# but which still want to provide support for the GNU gettext functionality. 2073# Please note that the actual code is *not* freely available. 2074 2075# serial 1 2076 2077AC_DEFUN(AC_LC_MESSAGES, [ 2078 AC_CHECK_HEADER(locale.h, [ 2079 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES, 2080 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], 2081 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)]) 2082 if test $ac_cv_val_LC_MESSAGES = yes; then 2083 AC_DEFINE(HAVE_LC_MESSAGES) 2084 fi 2085 ]) 2086]) 2087 2088 2089dnl 2090dnl Check for whether the Boost-derived checks should be turned on. 2091dnl 2092dnl GLIBCPP_ENABLE_CONCEPT_CHECKS 2093dnl --enable-concept-checks turns them on. 2094dnl --disable-concept-checks leaves them off. 2095dnl + Usage: GLIBCPP_ENABLE_CONCEPT_CHECKS[(DEFAULT)] 2096dnl Where DEFAULT is either `yes' or `no'. If ommitted, it 2097dnl defaults to `no'. 2098AC_DEFUN(GLIBCPP_ENABLE_CONCEPT_CHECKS, [dnl 2099define([GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT], ifelse($1, yes, yes, no))dnl 2100AC_ARG_ENABLE(concept-checks, 2101changequote(<<, >>)dnl 2102<< --enable-concept-checks use Boost-derived template checks [default=>>GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT], 2103changequote([, ])dnl 2104[case "$enableval" in 2105 yes) enable_concept_checks=yes ;; 2106 no) enable_concept_checks=no ;; 2107 *) AC_MSG_ERROR([Unknown argument to enable/disable concept checks]) ;; 2108 esac], 2109enable_concept_checks=GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT)dnl 2110dnl Option parsed, now set things appropriately 2111if test x"$enable_concept_checks" = xyes; then 2112 AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS) 2113fi 2114]) 2115 2116 2117dnl 2118dnl Add version tags to symbols in shared library (or not), additionally 2119dnl marking other symbols as private/local (or not). 2120dnl 2121dnl GLIBCPP_ENABLE_SYMVERS 2122dnl --enable-symvers=style adds a version script to the linker call when 2123dnl creating the shared library. The choice of version script is 2124dnl controlled by 'style'. 2125dnl --disable-symvers does not. 2126dnl + Usage: GLIBCPP_ENABLE_SYMVERS[(DEFAULT)] 2127dnl Where DEFAULT is either `yes' or `no'. If ommitted, it 2128dnl defaults to `no'. Passing `yes' tries to choose a default style 2129dnl based on linker characteristics. Passing 'no' disables versioning. 2130AC_DEFUN(GLIBCPP_ENABLE_SYMVERS, [dnl 2131define([GLIBCPP_ENABLE_SYMVERS_DEFAULT], ifelse($1, yes, yes, no))dnl 2132AC_ARG_ENABLE(symvers, 2133changequote(<<, >>)dnl 2134<< --enable-symvers=style enables symbol versioning of the shared library [default=>>GLIBCPP_ENABLE_SYMVERS_DEFAULT], 2135changequote([, ])dnl 2136[case "$enableval" in 2137 yes) enable_symvers=yes ;; 2138 no) enable_symvers=no ;; 2139 # other names here, just as sanity checks 2140 #gnu|sun|etcetera) enable_symvers=$enableval ;; 2141 gnu) enable_symvers=$enableval ;; 2142 *) AC_MSG_ERROR([Unknown argument to enable/disable symvers]) ;; 2143 esac], 2144enable_symvers=GLIBCPP_ENABLE_SYMVERS_DEFAULT)dnl 2145 2146# If we never went through the GLIBCPP_CHECK_LINKER_FEATURES macro, then we 2147# don't know enough about $LD to do tricks... 2148if test x$enable_shared = xno || 2149 test "x$LD" = x || 2150 test x$glibcpp_gnu_ld_version = x; then 2151 enable_symvers=no 2152fi 2153 2154# Check to see if libgcc_s exists, indicating that shared libgcc is possible. 2155AC_MSG_CHECKING([for shared libgcc]) 2156ac_save_CFLAGS="$CFLAGS" 2157CFLAGS=' -lgcc_s' 2158AC_TRY_LINK( , [return 0], glibcpp_shared_libgcc=yes, glibcpp_shared_libgcc=no) 2159CFLAGS="$ac_save_CFLAGS" 2160AC_MSG_RESULT($glibcpp_shared_libgcc) 2161 2162# For GNU ld, we need at least this version. It's 2.12 in the same format 2163# as the tested-for version. See GLIBCPP_CHECK_LINKER_FEATURES for more. 2164glibcpp_min_gnu_ld_version=21200 2165 2166# Check to see if unspecified "yes" value can win, given results 2167# above. 2168if test $enable_symvers = yes ; then 2169 if test $with_gnu_ld = yes && 2170 test $glibcpp_shared_libgcc = yes ; 2171 then 2172 if test $glibcpp_gnu_ld_version -ge $glibcpp_min_gnu_ld_version ; then 2173 enable_symvers=gnu 2174 else 2175 ac_test_CFLAGS="${CFLAGS+set}" 2176 ac_save_CFLAGS="$CFLAGS" 2177 CFLAGS='-shared -Wl,--version-script,conftest.map' 2178 enable_symvers=no 2179 changequote(,) 2180 echo 'FOO { global: f[a-z]o; local: *; };' > conftest.map 2181 changequote([,]) 2182 AC_TRY_LINK([int foo;],, enable_symvers=gnu) 2183 if test "$ac_test_CFLAGS" = set; then 2184 CFLAGS="$ac_save_CFLAGS" 2185 else 2186 # this is the suspicious part 2187 CFLAGS='' 2188 fi 2189 rm -f conftest.map 2190 fi 2191 else 2192 # just fail for now 2193 enable_symvers=no 2194 fi 2195fi 2196 2197dnl Everything parsed; figure out what file to use. 2198case $enable_symvers in 2199 no) 2200 LINKER_MAP=config/linker-map.dummy 2201 ;; 2202 gnu) 2203 LINKER_MAP=config/linker-map.gnu 2204 AC_DEFINE(_GLIBCPP_SYMVER) 2205 ;; 2206esac 2207 2208AC_LINK_FILES($LINKER_MAP, src/linker.map) 2209AM_CONDITIONAL(GLIBCPP_BUILD_VERSIONED_SHLIB, test $enable_symvers != no) 2210AC_MSG_CHECKING([versioning on shared library symbols]) 2211AC_MSG_RESULT($enable_symvers) 2212]) 2213 2214