2 dnl Initialize configure bits.
5 AC_DEFUN(GLIBCPP_CONFIGURE, [
6 dnl Default to --enable-multilib
7 AC_ARG_ENABLE(multilib,
8 [ --enable-multilib build hella library versions (default)],
9 [case "${enableval}" in
12 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
13 esac], [multilib=yes])dnl
15 glibcpp_basedir=$srcdir/$toprel/$1/libstdc++-v3
16 AC_SUBST(glibcpp_basedir)
18 AM_INIT_AUTOMAKE(libstdc++, 3.0.0)
20 # Never versions of autoconf add an underscore to these functions.
21 # Prevent future problems ...
22 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
23 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
24 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
25 ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
29 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
30 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
31 # are probably using a cross compiler, which will not be able to fully
32 # link an executable. This should really be fixed in autoconf
35 AC_DEFUN(LIB_AC_PROG_CC,
36 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
37 dnl Fool anybody using AC_PROG_CC.
38 AC_PROVIDE([AC_PROG_CC])
39 AC_CHECK_PROG(CC, gcc, gcc)
40 if test -z "$CC"; then
41 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
42 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
47 if test $ac_cv_prog_gcc = yes; then
49 dnl Check whether -g works, even if CFLAGS is set, in case the package
50 dnl plays around with CFLAGS (such as to build both debugging and
51 dnl normal versions of a library), tasteless as that idea is.
52 ac_test_CFLAGS="${CFLAGS+set}"
53 ac_save_CFLAGS="$CFLAGS"
56 if test "$ac_test_CFLAGS" = set; then
57 CFLAGS="$ac_save_CFLAGS"
58 elif test $ac_cv_prog_cc_g = yes; then
65 test "${CFLAGS+set}" = set || CFLAGS="-g"
71 # Can't just call these here as g++ requires libstc++ to be built....
74 # Likewise for AC_PROG_CXX.
75 AC_DEFUN(LIB_AC_PROG_CXX,
76 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
77 dnl Fool anybody using AC_PROG_CXX.
78 AC_PROVIDE([AC_PROG_CXX])
79 # Use glibcpp_CXX so that we do not cause CXX to be cached with the
80 # flags that come in CXX while configuring libstdc++. They're different
81 # from those used for all other target libraries. If CXX is set in
82 # the environment, respect that here.
84 AC_CHECK_PROGS(glibcpp_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
87 test -z "$glibcpp_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
91 if test $ac_cv_prog_gxx = yes; then
93 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
94 dnl plays around with CXXFLAGS (such as to build both debugging and
95 dnl normal versions of a library), tasteless as that idea is.
96 ac_test_CXXFLAGS="${CXXFLAGS+set}"
97 ac_save_CXXFLAGS="$CXXFLAGS"
100 if test "$ac_test_CXXFLAGS" = set; then
101 CXXFLAGS="$ac_save_CXXFLAGS"
102 elif test $ac_cv_prog_cxx_g = yes; then
109 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
115 AC_CHECK_TOOL(AS, as)
116 AC_CHECK_TOOL(AR, ar)
117 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
122 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
123 # at least currently, we never actually build a program, so we never
124 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
125 # fails, because we are probably configuring with a cross compiler
126 # which cant create executables. So we include AC_EXEEXT to keep
127 # automake happy, but we dont execute it, since we dont care about
130 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
131 # to nothing, so nothing would remain between `then' and `fi' if it
132 # were not for the `:' below.
137 . [$]{glibcpp_basedir}/configure.host
139 case [$]{glibcpp_basedir} in
140 /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
141 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
144 # This does for the target what configure.host does for the host. In
145 # addition to possibly modifying the same flags, it also sets up symlinks.
151 dnl Check to see if g++ can compile this library, and if so, if any version-
152 dnl specific precautions need to be taken.
154 dnl GLIBCPP_CHECK_COMPILER_VERSION
155 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
156 if test ! -f stamp-sanity-compiler; then
157 AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3])
164 ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to GCC 3.0 or above]))
166 AC_MSG_RESULT($gpp_satisfactory)
167 touch stamp-sanity-compiler
173 dnl Tests for newer compiler features, or features that are present in newer
174 dnl compiler versions but not older compiler versions still in use, should
177 dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
178 dnl new inlining code or the new system_header pragma will die on -Werror.
179 dnl Leave it out by default and use maint-mode to use it.
181 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
182 dnl compiler supports it and the user has not requested debug mode.
184 dnl GLIBCPP_CHECK_COMPILER_FEATURES
185 AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
186 # All these tests are for C++; save the language and the compiler flags.
187 # The CXXFLAGS thing is suspicious, but based on similar bits previously
188 # found in GLIBCPP_CONFIGURE.
191 ac_test_CXXFLAGS="${CXXFLAGS+set}"
192 ac_save_CXXFLAGS="$CXXFLAGS"
194 # Check for maintainer-mode bits.
195 if test x"$USE_MAINTAINER_MODE" = xno; then
201 # Check for -ffunction-sections -fdata-sections
202 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
203 CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
204 AC_TRY_COMPILE(, [int foo;
205 ], [ac_fdsections=yes], [ac_fdsections=no])
206 if test "$ac_test_CXXFLAGS" = set; then
207 CXXFLAGS="$ac_save_CXXFLAGS"
209 # this is the suspicious part
212 if test x"$ac_fdsections" = x"yes" && test x"$enable_debug" = x"no"; then
213 SECTION_FLAGS='-ffunction-sections -fdata-sections'
215 AC_MSG_RESULT($ac_fdsections)
219 AC_SUBST(SECTION_FLAGS)
224 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
225 dnl the native linker is in use, all variables will be defined to something
226 dnl safe (like an empty string).
228 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
229 dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
231 dnl GLIBCPP_CHECK_LINKER_FEATURES
232 AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
233 # If we're not using GNU ld, then there's no point in even trying these
234 # tests. Check for that first. We should have already tested for gld
235 # by now (in libtool), but require it now just to be safe...
238 AC_REQUIRE([AC_PROG_LD])
241 if test "$ac_cv_prog_gnu_ld" = "notbroken"; then
242 # GNU ld it is! Joy and bunny rabbits!
244 # All these tests are for C++; save the language and the compiler flags.
245 # Need to do this so that g++ won't try to link in libstdc++
246 ac_test_CFLAGS="${CFLAGS+set}"
247 ac_save_CFLAGS="$CFLAGS"
248 CFLAGS='-x c++ -Wl,--gc-sections'
250 # Check for -Wl,--gc-sections
251 # XXX This test is broken at the moment, as symbols required for
252 # linking are now in libsupc++ (not built yet.....). In addition,
253 # this test has cored on solaris in the past. In addition,
254 # --gc-sections doesn't really work at the moment (keeps on discarding
255 # used sections, first .eh_frame and now some of the glibc sections for
256 # iconv). Bzzzzt. Thanks for playing, maybe next time.
257 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
265 ], [ac_sectionLDflags=yes],[ac_sectionLFflags=no], [ac_sectionLDflags=yes])
266 if test "$ac_test_CFLAGS" = set; then
267 CFLAGS="$ac_save_CFLAGS"
269 # this is the suspicious part
272 if test "$ac_sectionLDflags" = "yes"; then
273 SECTION_LDFLAGS='-Wl,--gc-sections'
275 AC_MSG_RESULT($ac_sectionLDflags)
278 # Set linker optimization flags.
279 if test x"$ac_cv_prog_gnu_ld" = x"yes" && test x"$enable_debug" = x"no"; then
280 OPT_LDFLAGS='-Wl,-O1'
283 AC_SUBST(SECTION_LDFLAGS)
284 AC_SUBST(OPT_LDFLAGS)
289 dnl Check to see if the (math function) argument passed is
290 dnl declared when using the c++ compiler
291 dnl ASSUMES argument is a math function with ONE parameter
293 dnl GLIBCPP_CHECK_MATH_DECL_1
294 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [
295 AC_MSG_CHECKING([for $1 declaration])
296 if test x${glibcpp_cv_func_$1_use+set} != xset; then
297 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
300 AC_TRY_COMPILE([#include <math.h>
306 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
310 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
314 dnl Check to see if the (math function) argument passed is
315 dnl 1) declared when using the c++ compiler
316 dnl 2) has "C" linkage
317 dnl 3) if not, see if 1) and 2) for argument prepended with '_'
319 dnl Define HAVE_CARGF etc if "cargf" is declared and links
321 dnl argument 1 is name of function to check
323 dnl ASSUMES argument is a math function with ONE parameter
325 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
326 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
327 GLIBCPP_CHECK_MATH_DECL_1($1)
328 if test x$glibcpp_cv_func_$1_use = x"yes"; then
331 GLIBCPP_CHECK_MATH_DECL_1(_$1)
332 if test x$glibcpp_cv_func__$1_use = x"yes"; then
340 dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
341 dnl of functions at once. It's an all-or-nothing check -- either
342 dnl HAVE_XYZ is defined for each of the functions, or for none of them.
343 dnl Doing it this way saves significant configure time.
344 AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [
345 AC_MSG_CHECKING([for $1 functions])
346 AC_CACHE_VAL(glibcpp_cv_func_$2_use, [
349 AC_TRY_COMPILE([#include <math.h>],
350 [ `for x in $3; do echo "$x (0);"; done` ],
351 [glibcpp_cv_func_$2_use=yes],
352 [glibcpp_cv_func_$2_use=no])
354 AC_MSG_RESULT($glibcpp_cv_func_$2_use)
355 if test x$glibcpp_cv_func_$2_use = x"yes"; then
361 dnl Check to see if the (math function) argument passed is
362 dnl declared when using the c++ compiler
363 dnl ASSUMES argument is a math function with TWO parameters
365 dnl GLIBCPP_CHECK_MATH_DECL_2
366 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [
367 AC_MSG_CHECKING([for $1 declaration])
368 if test x${glibcpp_cv_func_$1_use+set} != xset; then
369 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
372 AC_TRY_COMPILE([#include <math.h>],
374 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
378 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
382 dnl Check to see if the (math function) argument passed is
383 dnl 1) declared when using the c++ compiler
384 dnl 2) has "C" linkage
386 dnl Define HAVE_CARGF etc if "cargf" is declared and links
388 dnl argument 1 is name of function to check
390 dnl ASSUMES argument is a math function with TWO parameters
392 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
393 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
394 GLIBCPP_CHECK_MATH_DECL_2($1)
395 if test x$glibcpp_cv_func_$1_use = x"yes"; then
398 GLIBCPP_CHECK_MATH_DECL_2(_$1)
399 if test x$glibcpp_cv_func__$1_use = x"yes"; then
407 dnl Check to see if the (math function) argument passed is
408 dnl declared when using the c++ compiler
409 dnl ASSUMES argument is a math function with THREE parameters
411 dnl GLIBCPP_CHECK_MATH_DECL_3
412 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [
413 AC_MSG_CHECKING([for $1 declaration])
414 if test x${glibcpp_cv_func_$1_use+set} != xset; then
415 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
418 AC_TRY_COMPILE([#include <math.h>],
420 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
424 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
428 dnl Check to see if the (math function) argument passed is
429 dnl 1) declared when using the c++ compiler
430 dnl 2) has "C" linkage
432 dnl Define HAVE_CARGF etc if "cargf" is declared and links
434 dnl argument 1 is name of function to check
436 dnl ASSUMES argument is a math function with THREE parameters
438 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
439 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
440 GLIBCPP_CHECK_MATH_DECL_3($1)
441 if test x$glibcpp_cv_func_$1_use = x"yes"; then
444 GLIBCPP_CHECK_MATH_DECL_3(_$1)
445 if test x$glibcpp_cv_func__$1_use = x"yes"; then
453 dnl Check to see if the (stdlib function) argument passed is
454 dnl 1) declared when using the c++ compiler
455 dnl 2) has "C" linkage
457 dnl argument 1 is name of function to check
459 dnl ASSUMES argument is a math function with TWO parameters
461 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
462 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
463 AC_MSG_CHECKING([for $1 declaration])
464 if test x${glibcpp_cv_func_$1_use+set} != xset; then
465 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
468 AC_TRY_COMPILE([#include <stdlib.h>],
470 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
474 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
475 if test x$glibcpp_cv_func_$1_use = x"yes"; then
482 dnl Because the builtins are picky picky picky about the arguments they take,
483 dnl do an explict linkage tests here.
484 dnl Check to see if the (math function) argument passed is
485 dnl 1) declared when using the c++ compiler
486 dnl 2) has "C" linkage
488 dnl Define HAVE_CARGF etc if "cargf" is declared and links
490 dnl argument 1 is name of function to check
492 dnl ASSUMES argument is a math function with ONE parameter
494 dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
495 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
496 AC_MSG_CHECKING([for $1 declaration])
497 if test x${glibcpp_cv_func_$1_use+set} != xset; then
498 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
501 AC_TRY_COMPILE([#include <math.h>],
503 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
507 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
508 if test x$glibcpp_cv_func_$1_use = x"yes"; then
509 AC_MSG_CHECKING([for $1 linkage])
510 if test x${glibcpp_cv_func_$1_link+set} != xset; then
511 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
512 AC_TRY_LINK([#include <math.h>],
514 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
517 AC_MSG_RESULT($glibcpp_cv_func_$1_link)
518 if test x$glibcpp_cv_func_$1_link = x"yes"; then
519 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
520 AC_DEFINE_UNQUOTED(${ac_tr_func})
527 dnl Check to see what builtin math functions are supported
529 dnl check for __builtin_abs
530 dnl check for __builtin_fabsf
531 dnl check for __builtin_fabs
532 dnl check for __builtin_fabl
533 dnl check for __builtin_labs
534 dnl check for __builtin_sqrtf
535 dnl check for __builtin_sqrtl
536 dnl check for __builtin_fsqrt
537 dnl check for __builtin_sinf
538 dnl check for __builtin_sin
539 dnl check for __builtin_sinl
540 dnl check for __builtin_cosf
541 dnl check for __builtin_cos
542 dnl check for __builtin_cosl
544 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
545 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
546 dnl Test for builtin math functions.
547 dnl These are made in gcc/c-common.c
548 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
549 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
550 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
551 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
552 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
554 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
555 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fsqrt)
556 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
558 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
559 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
560 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
562 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
563 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
564 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
566 dnl There is, without a doubt, a more elegant way to have these
567 dnl names exported so that they won't be stripped out of acconfig.h by
568 dnl autoheader. I leave this as an exercise to somebody less frustrated
569 dnl than I.... please email the libstdc++ list if you can figure out a
570 dnl more elegant approach (see autoconf/acgen.m4 and specifically
571 dnl AC_CHECK_FUNC for things to steal.)
573 if test x$dummyvar = x"yes"; then
574 AC_DEFINE(HAVE___BUILTIN_ABS)
575 AC_DEFINE(HAVE___BUILTIN_LABS)
576 AC_DEFINE(HAVE___BUILTIN_COS)
577 AC_DEFINE(HAVE___BUILTIN_COSF)
578 AC_DEFINE(HAVE___BUILTIN_COSL)
579 AC_DEFINE(HAVE___BUILTIN_FABS)
580 AC_DEFINE(HAVE___BUILTIN_FABSF)
581 AC_DEFINE(HAVE___BUILTIN_FABSL)
582 AC_DEFINE(HAVE___BUILTIN_SIN)
583 AC_DEFINE(HAVE___BUILTIN_SINF)
584 AC_DEFINE(HAVE___BUILTIN_SINL)
585 AC_DEFINE(HAVE___BUILTIN_FSQRT)
586 AC_DEFINE(HAVE___BUILTIN_SQRTF)
587 AC_DEFINE(HAVE___BUILTIN_SQRTL)
593 dnl Check to see what the underlying c library
594 dnl These checks need to do two things:
595 dnl 1) make sure the name is declared when using the c++ compiler
596 dnl 2) make sure the name has "C" linkage
597 dnl This might seem like overkill but experience has shown that it's not...
599 dnl Define HAVE_STRTOLD if "strtold" is declared and links
600 dnl Define HAVE_STRTOF if "strtof" is declared and links
601 dnl Define HAVE_DRAND48 if "drand48" is declared and links
603 dnl GLIBCPP_CHECK_STDLIB_SUPPORT
604 AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
605 ac_test_CXXFLAGS="${CXXFLAGS+set}"
606 ac_save_CXXFLAGS="$CXXFLAGS"
607 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
609 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
610 AC_CHECK_FUNCS(drand48)
612 CXXFLAGS="$ac_save_CXXFLAGS"
617 dnl Check to see what the underlying c library or math library is like.
618 dnl These checks need to do two things:
619 dnl 1) make sure the name is declared when using the c++ compiler
620 dnl 2) make sure the name has "C" linkage
621 dnl This might seem like overkill but experience has shown that it's not...
623 dnl Define HAVE_CARGF etc if "cargf" is found.
625 dnl GLIBCPP_CHECK_MATH_SUPPORT
626 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
627 ac_test_CXXFLAGS="${CXXFLAGS+set}"
628 ac_save_CXXFLAGS="$CXXFLAGS"
629 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
632 AC_CHECK_LIB(m, sin, libm="-lm")
636 dnl Check to see if certain C math functions exist.
637 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
638 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
639 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
640 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
641 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
642 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
643 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
644 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypot)
646 dnl Check to see if basic C math functions have float versions.
647 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig,
652 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
655 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
656 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
657 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
658 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
659 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
660 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
661 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf)
662 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
663 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
664 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
665 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
666 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
667 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
668 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
669 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
671 dnl Check to see if basic C math functions have long double versions.
672 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig,
677 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round,
680 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
681 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
682 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
683 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
684 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
685 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
686 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
687 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
688 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl)
689 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
690 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
691 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
692 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
693 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
694 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
695 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
696 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
698 dnl Some runtimes have these functions with a preceding underscore. Please
699 dnl keep this sync'd with the one above. And if you add any new symbol,
700 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
701 dnl Check to see if certain C math functions exist.
703 dnl Check to see if basic C math functions have float versions.
704 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
706 _acosf _asinf _atanf \
708 _coshf _sinhf _tanhf)
709 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
713 dnl Check to see if basic C math functions have long double versions.
714 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
716 _acosl _asinl _atanl \
718 _coshl _sinhl _tanhl)
719 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
724 CXXFLAGS="$ac_save_CXXFLAGS"
729 dnl Check to see if there is native support for complex
731 dnl Don't compile bits in math/* if native support exits.
733 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "copysignl" is found.
735 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
736 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
737 dnl Check for complex versions of math functions of platform.
738 AC_CHECK_LIB(m, main)
739 AC_REPLACE_MATHFUNCS(nan copysignf)
741 dnl Compile the long double complex functions only if the function
742 dnl provides the non-complex long double functions that are needed.
743 dnl Currently this includes copysignl, which should be
744 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
745 USE_COMPLEX_LONG_DOUBLE=no
746 if test x$ac_cv_func_copysignl = x"yes"; then
747 USE_COMPLEX_LONG_DOUBLE=yes
748 AC_REPLACE_MATHFUNCS(signbitl)
751 AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
755 dnl Check to see what architecture and operating system we are compiling
756 dnl for. Also, if architecture- or OS-specific flags are required for
757 dnl compilation, pick them up here.
759 dnl GLIBCPP_CHECK_TARGET
760 AC_DEFUN(GLIBCPP_CHECK_TARGET, [
761 . [$]{glibcpp_basedir}/configure.target
762 AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
763 AC_MSG_RESULT(OS config directory is $os_include_dir)
768 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
769 dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
770 dnl must have been previously checked.)
772 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
773 dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h
775 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
776 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
778 dnl Test wchar.h for mbstate_t, which is needed for char_traits and
779 dnl others even if wchar_t support is not on.
780 AC_MSG_CHECKING([for mbstate_t])
781 AC_TRY_COMPILE([#include <wchar.h>],
782 [mbstate_t teststate;],
783 have_mbstate_t=yes, have_mbstate_t=no)
784 AC_MSG_RESULT($have_mbstate_t)
785 if test x"$have_mbstate_t" = xyes; then
786 AC_DEFINE(HAVE_MBSTATE_T)
789 dnl Sanity check for existence of ISO C99 headers for extended encoding.
790 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
791 AC_CHECK_HEADER(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
793 dnl Only continue checking if the ISO C99 headers exist and support is on.
794 if test x"$ac_has_wchar_h" = xyes && test x"$ac_has_wctype_h" = xyes \
795 && test x"$enable_c_mbchar" != xno; then
797 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
798 dnl numeric_limits can instantiate type_traits<wchar_t>
799 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
800 AC_TRY_COMPILE([#include <wchar.h>],
801 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
802 has_wchar_minmax=yes, has_wchar_minmax=no)
803 AC_MSG_RESULT($has_wchar_minmax)
805 dnl Test wchar.h for WEOF, which is what we use to determine whether
806 dnl to specialize for char_traits<wchar_t> or not.
807 AC_MSG_CHECKING([for WEOF])
810 #include <stddef.h>],
812 has_weof=yes, has_weof=no)
813 AC_MSG_RESULT($has_weof)
815 dnl Tests for wide character functions used in char_traits<wchar_t>.
817 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset,, \
820 dnl Checks for names injected into std:: by the c_std headers.
821 AC_CHECK_FUNCS(btowc wctob fgetwc fgetwc fgetws fputwc fputws fwide \
822 fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
823 vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
824 mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
825 wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
826 wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \
829 AC_MSG_CHECKING([for ISO C99 wchar_t support])
830 if test x"$has_weof" = xyes && test x"$has_wchar_minmax" = xyes \
831 && test x"$ac_wfuncs" = xyes; then
832 ac_isoC99_wchar_t=yes
836 AC_MSG_RESULT($ac_isoC99_wchar_t)
838 dnl Use iconv for wchar_t to char conversions. As such, check for
839 dnl X/Open Portability Guide, version 2 features (XPG2).
840 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
841 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
843 dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
844 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
846 LIBS="$LIBS $libiconv"
848 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
849 ac_XPG2funcs=yes, ac_XPG2funcs=no)
853 AC_MSG_CHECKING([for XPG2 wchar_t support])
854 if test x"$ac_has_iconv_h" = xyes && test x"$ac_has_langinfo_h" = xyes \
855 && test x"$ac_XPG2funcs" = xyes; then
860 AC_MSG_RESULT($ac_XPG2_wchar_t)
862 dnl At the moment, only enable wchar_t specializations if all the
863 dnl above support is present.
864 AC_MSG_CHECKING([for enabled wchar_t specializations])
865 if test x"$ac_isoC99_wchar_t" = xyes \
866 && test x"$ac_XPG2_wchar_t" = xyes; then
867 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
873 dnl Wide characters disabled by the user.
874 AC_MSG_WARN([wchar_t support disabled.])
880 dnl Check for special debugging mode; not for production use.
882 dnl GLIBCPP_ENABLE_DEBUG
883 dnl --enable-debug sets '-ggdb3 -O0'.
884 dnl --disable-debug sets '-g' and whatever optimization options the
885 dnl compiler can handle.
886 dnl + --enable-maintainer-mode automatically defaults this to on.
887 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
888 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
889 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
890 dnl defaults to `no'.
891 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
892 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
894 changequote(<<, >>)dnl
895 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
897 [case "${enableval}" in
898 yes) enable_debug=yes ;;
899 no) enable_debug=no ;;
900 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
902 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
904 dnl Option parsed, now set things appropriately
905 case "${enable_debug}" in
907 DEBUG_FLAGS='-O0 -ggdb3'
913 AC_SUBST(DEBUG_FLAGS)
918 dnl Check for "unusual" flags to pass to the compiler while building.
920 dnl GLIBCPP_ENABLE_CXX_FLAGS
921 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
922 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
923 dnl Somehow this same set of flags must be passed when [re]building
925 dnl --disable-cxx-flags passes nothing.
926 dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
927 dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
928 dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
929 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
930 dnl If "default flags" is an empty string (or "none"), the effect is
931 dnl the same as --disable or --enable=no.
932 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
933 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
934 AC_ARG_ENABLE(cxx-flags,
935 changequote(<<, >>)dnl
936 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
937 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
939 [case "x$enableval" in
941 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
943 enable_cxx_flags='' ;;
945 enable_cxx_flags="$enableval" ;;
947 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
949 dnl Thinko on my part during design. This kludge is the workaround.
950 if test "$enable_cxx_flags" = "none"; then
954 dnl Run through flags (either default or command-line) and set anything
955 dnl extra (e.g., #defines) that must accompany particular g++ options.
956 if test -n "$enable_cxx_flags"; then
957 for f in $enable_cxx_flags; do
961 *) # and we're trying to pass /what/ exactly?
962 AC_MSG_ERROR([compiler flags start with a -]) ;;
966 EXTRA_CXX_FLAGS="$enable_cxx_flags"
967 AC_SUBST(EXTRA_CXX_FLAGS)
972 dnl Check for which locale library to use: gnu or generic.
974 dnl GLIBCPP_ENABLE_CLOCALE
975 dnl --enable-clocale=gnu sets config/c_locale_gnu.cc and friends
976 dnl --enable-clocale=generic sets config/c_locale_generic.cc and friends
978 dnl default is generic
980 AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
981 AC_MSG_CHECKING([for clocale to use])
982 AC_ARG_ENABLE(clocale,
983 [ --enable-clocale enable model for target locale package.
984 --enable-clocale=MODEL use MODEL target-speific locale package. [default=generic]
986 if test x$enable_clocale = xno; then
987 enable_clocale=generic
989 enable_clocale=generic)
991 enable_clocale_flag=$enable_clocale
993 dnl Check if a valid locale package
994 case x${enable_clocale_flag} in
996 CLOCALE_H=config/c_locale_gnu.h
997 CLOCALE_CC=config/c_locale_gnu.cc
1001 CLOCALE_H=config/c_locale_generic.h
1002 CLOCALE_CC=config/c_locale_generic.cc
1003 AC_MSG_RESULT(generic)
1006 echo "$enable_clocale is an unknown locale package" 1>&2
1012 AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
1017 dnl Check for which I/O library to use: libio, or something specific.
1019 dnl GLIBCPP_ENABLE_CSTDIO
1020 dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
1022 dnl default is stdio
1024 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1025 AC_MSG_CHECKING([for cstdio to use])
1026 AC_ARG_ENABLE(cstdio,
1027 [ --enable-cstdio enable stdio for target io package.
1028 --enable-cstdio=LIB use LIB target-speific io package. [default=stdio]
1030 if test x$enable_cstdio = xno; then
1033 enable_cstdio=stdio)
1035 enable_cstdio_flag=$enable_cstdio
1037 dnl Check if a valid I/O package
1038 case x${enable_cstdio_flag} in
1040 CSTDIO_H=config/c_io_libio.h
1041 BASIC_FILE_H=config/basic_file_libio.h
1042 BASIC_FILE_CC=config/basic_file_libio.cc
1043 AC_MSG_RESULT(libio)
1045 # see if we are on a system with libio native (ie, linux)
1046 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1048 # Need to check and see what version of glibc is being used. If
1049 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1050 # compile most of libio for linux systems.
1051 if test x$has_libio = x"yes"; then
1054 AC_MSG_CHECKING([for glibc version >= 2.2])
1055 AC_EGREP_CPP([ok], [
1056 #include <features.h>
1057 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1060 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1061 AC_MSG_RESULT($glibc_satisfactory)
1065 # XXX at the moment, admit defeat and force the recompilation
1066 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
1067 glibc_satisfactory=no
1069 if test x$glibc_satisfactory = x"yes"; then
1074 # bkoz XXX need to add checks to enable this
1075 # pme XXX here's a first pass at such a check
1076 if test x$enable_c_mbchar != xno; then
1084 # Using libio, but <libio.h> doesn't exist on the target system. . .
1086 # bkoz XXX need to add checks to enable this
1087 # pme XXX here's a first pass at such a check
1088 if test x$enable_c_mbchar != xno; then
1095 xstdio | x | xno | xnone | xyes)
1097 CSTDIO_H=config/c_io_stdio.h
1098 BASIC_FILE_H=config/basic_file_stdio.h
1099 BASIC_FILE_CC=config/basic_file_stdio.cc
1100 AC_MSG_RESULT(stdio)
1102 # We're not using stdio.
1107 echo "$enable_cstdio is an unknown io package" 1>&2
1112 AC_SUBST(BASIC_FILE_H)
1113 AC_LINK_FILES($BASIC_FILE_CC, src/basic_file.cc)
1115 # 2000-08-04 bkoz hack
1116 CCODECVT_C=config/c_io_libio_codecvt.c
1117 AC_SUBST(CCODECVT_C)
1118 # 2000-08-04 bkoz hack
1120 AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO,
1121 test "$need_libio" = yes || test "$need_wlibio" = yes)
1122 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1123 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1124 if test "$need_libio" = yes || test "$need_wlibio" = yes; then
1125 libio_la=../libio/libio.la
1134 dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
1135 dnl We must stage the required headers so that they will be installed
1136 dnl with the library (unlike libgcc, the STL implementation is provided
1137 dnl solely within headers). Since we must not inject random user-space
1138 dnl macro names into user-provided C++ code, we first stage into <file>-in
1139 dnl and process to <file> with an output command. The reason for a two-
1140 dnl stage process here is to correctly handle $srcdir!=$objdir without
1141 dnl having to write complex code (the sed commands to clean the macro
1142 dnl namespace are complex and fragile enough as it is). We must also
1143 dnl add a relative path so that -I- is supported properly.
1145 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1146 AC_MSG_CHECKING([for thread model used by GCC])
1147 target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
1148 AC_MSG_RESULT([$target_thread_file])
1150 if test $target_thread_file != single; then
1151 AC_DEFINE(HAVE_GTHR_DEFAULT)
1152 AC_DEFINE(_GLIBCPP_SUPPORTS_WEAK, __GXX_WEAK__)
1155 glibcpp_thread_h=gthr-$target_thread_file.h
1156 AC_SUBST(glibcpp_thread_h)
1161 dnl Check for exception handling support. If an explicit enable/disable
1162 dnl sjlj exceptions is given, we don't have to detect. Otherwise the
1163 dnl target may or may not support call frame exceptions.
1165 dnl GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
1166 dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
1167 dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1169 dnl Define _GLIBCPP_SJLJ_EXCEPTIONS if the compiler is configured for it.
1171 AC_DEFUN(GLIBCPP_ENABLE_SJLJ_EXCEPTIONS, [
1172 AC_MSG_CHECKING([for exception model to use])
1175 AC_ARG_ENABLE(sjlj-exceptions,
1176 [ --enable-sjlj-exceptions force use of builtin_setjmp for exceptions],
1178 [dnl Botheration. Now we've got to detect the exception model.
1179 dnl Link tests against libgcc.a are problematic since -- at least
1180 dnl as of this writing -- we've not been given proper -L bits for
1181 dnl single-tree newlib and libgloss.
1183 dnl This is what AC_TRY_COMPILE would do if it didn't delete the
1184 dnl conftest files before we got a change to grep them first.
1185 cat > conftest.$ac_ext << EOF
1186 [#]line __oline__ "configure"
1195 old_CXXFLAGS="$CXXFLAGS"
1197 if AC_TRY_EVAL(ac_compile); then
1198 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
1199 enable_sjlj_exceptions=yes
1200 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
1201 enable_sjlj_exceptions=no
1204 CXXFLAGS="$old_CXXFLAGS"
1206 if test x$enable_sjlj_exceptions = xyes; then
1207 AC_DEFINE(_GLIBCPP_SJLJ_EXCEPTIONS, 1,
1208 [Define if the compiler is configured for setjmp/longjmp exceptions.])
1209 ac_exception_model_name=sjlj
1210 elif test x$enable_sjlj_exceptions = xno; then
1211 ac_exception_model_name="call frame"
1213 AC_MSG_ERROR([unable to detect exception model])
1216 AC_MSG_RESULT($ac_exception_model_name)
1221 dnl Check for ISO/IEC 9899:1999 "C99" support.
1223 dnl GLIBCPP_ENABLE_C99
1224 dnl --enable-c99 defines _GLIBCPP_USE_C99
1225 dnl --disable-c99 leaves _GLIBCPP_USE_C99 undefined
1226 dnl + Usage: GLIBCPP_ENABLE_C99[(DEFAULT)]
1227 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1228 dnl defaults to `no'.
1229 dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
1231 dnl GLIBCPP_ENABLE_C99
1232 AC_DEFUN(GLIBCPP_ENABLE_C99, [dnl
1233 define([GLIBCPP_ENABLE_C99_DEFAULT], ifelse($1, yes, yes, no))dnl
1236 changequote(<<, >>)dnl
1237 <<--enable-c99 turns on 'ISO/IEC 9899:1999 support' [default=>>GLIBCPP_ENABLE_C99_DEFAULT],
1238 changequote([, ])dnl
1239 [case "$enableval" in
1240 yes) enable_c99=yes ;;
1241 no) enable_c99=no ;;
1242 *) AC_MSG_ERROR([Unknown argument to enable/disable C99]) ;;
1244 enable_c99=GLIBCPP_ENABLE_C99_DEFAULT)dnl
1249 # Check for the existence of <math.h> functions used if C99 is enabled.
1251 AC_MSG_CHECKING([for ISO C99 support in <math.h>])
1252 AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no])
1253 AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no])
1254 AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no])
1255 AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no])
1256 AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no])
1257 AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no])
1258 AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no])
1259 AC_TRY_COMPILE([#include <math.h>],
1260 [isgreaterequal(0.0,0.0);],, [ac_c99_math=no])
1261 AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no])
1262 AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no])
1263 AC_TRY_COMPILE([#include <math.h>],
1264 [islessgreater(0.0,0.0);],, [ac_c99_math=no])
1265 AC_TRY_COMPILE([#include <math.h>],
1266 [isunordered(0.0,0.0);],, [ac_c99_math=no])
1267 AC_MSG_RESULT($ac_c99_math)
1269 # Check for the existence in <stdio.h> of vscanf, et. al.
1271 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
1272 AC_TRY_COMPILE([#include <stdio.h>],
1273 [snprintf("12", 0, "%i");],, [ac_c99_stdio=no])
1274 AC_TRY_COMPILE([#include <stdio.h>
1276 void foo(char* fmt, ...)
1277 {va_list args; va_start(args, fmt);
1278 vfscanf(stderr, "%i", args);}],
1279 [],, [ac_c99_stdio=no])
1280 AC_TRY_COMPILE([#include <stdio.h>
1282 void foo(char* fmt, ...)
1283 {va_list args; va_start(args, fmt);
1284 vscanf("%i", args);}],
1285 [],, [ac_c99_stdio=no])
1286 AC_TRY_COMPILE([#include <stdio.h>
1288 void foo(char* fmt, ...)
1289 {va_list args; va_start(args, fmt);
1290 vsnprintf(fmt, 0, "%i", args);}],
1291 [],, [ac_c99_stdio=no])
1292 AC_TRY_COMPILE([#include <stdio.h>
1294 void foo(char* fmt, ...)
1295 {va_list args; va_start(args, fmt);
1296 vsscanf(fmt, "%i", args);}],
1297 [],, [ac_c99_stdio=no])
1298 AC_MSG_RESULT($ac_c99_stdio)
1300 # Check for the existence in <stdlib.h> of lldiv_t, et. al.
1302 AC_MSG_CHECKING([for lldiv_t declaration])
1303 AC_CACHE_VAL(ac_c99_lldiv_t, [
1304 AC_TRY_COMPILE([#include <stdlib.h>],
1306 [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no])
1308 AC_MSG_RESULT($ac_c99_lldiv_t)
1310 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
1311 AC_TRY_COMPILE([#include <stdlib.h>],
1312 [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no])
1313 AC_TRY_COMPILE([#include <stdlib.h>],
1314 [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no])
1315 AC_TRY_COMPILE([#include <stdlib.h>],
1316 [char* tmp; strtoll("gnu", &tmp, 10);],, [ac_c99_stdlib=no])
1317 AC_TRY_COMPILE([#include <stdlib.h>],
1318 [char* tmp; strtoull("gnu", &tmp, 10);],, [ac_c99_stdlib=no])
1319 AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no])
1320 AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no])
1321 AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no])
1322 AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no])
1323 if test x"$ac_c99_lldiv_t" = x"no"; then
1326 AC_MSG_RESULT($ac_c99_stdlib)
1328 # Check for the existence of <wchar.h> functions used if C99 is enabled.
1329 # XXX the wchar.h checks should be rolled into the general C99 bits.
1331 AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>])
1332 AC_TRY_COMPILE([#include <wchar.h>],
1333 [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no])
1334 AC_TRY_COMPILE([#include <wchar.h>],
1335 [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no])
1336 AC_TRY_COMPILE([#include <wchar.h>],
1337 [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no])
1338 AC_MSG_RESULT($ac_c99_wchar)
1340 AC_MSG_CHECKING([for enabled ISO C99 support])
1341 if test x"$ac_c99_math" = x"no" || test x"$ac_c99_stdio" = x"no" \
1342 || test x"$ac_c99_stdlib" = x"no" \
1343 || test x"$ac_c99_wchar" = x"no"; then
1346 AC_MSG_RESULT($enable_c99)
1348 # Option parsed, now set things appropriately
1349 if test x"$enable_c99" = x"yes"; then
1350 AC_DEFINE(_GLIBCPP_USE_C99)
1358 dnl Check for template specializations for the 'long long' type extension.
1359 dnl NB: Must check for C99 support before calling _GLIBCPP_ENABLE_LONG_LONG
1361 dnl GLIBCPP_ENABLE_LONG_LONG
1362 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1363 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1364 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1365 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1366 dnl defaults to `no'.
1367 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1369 dnl GLIBCPP_ENABLE_LONG_LONG
1370 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1371 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1373 AC_ARG_ENABLE(long-long,
1374 changequote(<<, >>)dnl
1375 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1376 changequote([, ])dnl
1377 [case "$enableval" in
1378 yes) enable_long_long=yes ;;
1379 no) enable_long_long=no ;;
1380 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1382 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1384 # iostreams require strtoll, strtoull to compile. If the
1385 # GLIBCPP_ENABLE_C99 tests found these, and if C99 support is enabled,
1386 # go ahead and allow long long to be used.
1387 if test x"$enable_c99" = x"no"; then
1388 enable_long_long=no;
1391 # Option parsed, now set things appropriately
1392 AC_MSG_CHECKING([for enabled long long support])
1393 if test x"$enable_long_long" = xyes; then
1394 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1396 AC_MSG_RESULT($enable_long_long)
1401 dnl Check for what kind of C headers to use.
1403 dnl GLIBCPP_ENABLE_CHEADERS
1404 dnl --enable-cheaders= [does stuff].
1405 dnl --disable-cheaders [does not do anything, really].
1406 dnl + This will eventually need to be 'c_shadow' by default.
1407 dnl + Usage: GLIBCPP_ENABLE_CHEADERS[(DEFAULT)]
1408 dnl Where DEFAULT is either `c' or `c_std' or 'c_shadow'.
1409 dnl If ommitted, it defaults to `c_std'.
1410 AC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl
1411 define([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl
1412 AC_MSG_CHECKING([for c header strategy to use])
1413 AC_ARG_ENABLE(cheaders,
1414 changequote(<<, >>)dnl
1415 << --enable-cheaders construct "C" header files for g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT],
1417 [case "$enableval" in
1422 enable_cheaders=c_std
1425 enable_cheaders=c_shadow
1427 *) AC_MSG_ERROR([Unknown argument to enable/disable "C" headers])
1430 enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT)
1431 AC_MSG_RESULT($enable_cheaders)
1433 dnl Option parsed, now set things appropriately
1434 case "$enable_cheaders" in
1436 CSHADOW_FLAGS="-fno-builtin"
1437 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_shadow'
1438 AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
1442 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_std'
1446 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c'
1450 AC_SUBST(CSHADOW_FLAGS)
1451 AC_SUBST(C_INCLUDE_DIR)
1452 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cheaders" = c_shadow)
1457 dnl Check for wide character support. Has the same effect as the option
1458 dnl in gcc's configure, but in a form that autoconf can mess with.
1460 dnl GLIBCPP_ENABLE_C_MBCHAR
1461 dnl --enable-c-mbchar requests all the wchar_t stuff.
1462 dnl --disable-c-mbchar doesn't.
1463 dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1464 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1465 dnl defaults to `no'.
1466 AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1467 define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1468 AC_ARG_ENABLE(c-mbchar,
1469 changequote(<<, >>)dnl
1470 << --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1471 changequote([, ])dnl
1472 [case "$enableval" in
1473 yes) enable_c_mbchar=yes ;;
1474 no) enable_c_mbchar=no ;;
1475 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1477 enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1478 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1483 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1485 dnl TOPLEVEL_INCLUDES
1486 dnl LIBMATH_INCLUDES
1487 dnl LIBSUPCXX_INCLUDES
1489 dnl CSHADOW_INCLUDES
1491 dnl GLIBCPP_EXPORT_INCLUDES
1492 AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1493 # Root level of the build directory include sources.
1494 GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include"
1496 # Passed down for canadian crosses.
1497 if test x"$CANADIAN" = xyes; then
1498 TOPLEVEL_INCLUDES='-I$(includedir)'
1501 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1503 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1505 if test x"$need_libio" = xyes; then
1506 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1507 AC_SUBST(LIBIO_INCLUDES)
1510 # Now, export this to all the little Makefiles....
1511 AC_SUBST(GLIBCPP_INCLUDES)
1512 AC_SUBST(TOPLEVEL_INCLUDES)
1513 AC_SUBST(LIBMATH_INCLUDES)
1514 AC_SUBST(LIBSUPCXX_INCLUDES)
1519 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1521 AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1522 # Optimization flags that are probably a good idea for thrill-seekers. Just
1523 # uncomment the lines below and make, everything else is ready to go...
1524 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1526 AC_SUBST(OPTIMIZE_CXXFLAGS)
1528 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1529 AC_SUBST(WARN_FLAGS)
1533 dnl GLIBCPP_EXPORT_INSTALL_INFO
1534 dnl calculates gxx_install_dir
1535 dnl exports glibcpp_toolexecdir
1536 dnl exports glibcpp_toolexeclibdir
1537 dnl exports glibcpp_builddir
1538 dnl exports glibcpp_srcdir
1539 dnl exports glibcpp_prefixdir
1541 dnl Assumes cross_compiling bits already done, and with_cross_host in
1544 dnl GLIBCPP_EXPORT_INSTALL_INFO
1545 AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
1547 glibcpp_toolexecdir=no
1548 glibcpp_toolexeclibdir=no
1550 # Export build and source directories.
1551 # These need to be absolute paths, yet at the same time need to
1552 # canonicalize only relative paths, because then amd will not unmount
1553 # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
1554 glibcpp_builddir=`pwd`
1556 [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
1557 *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
1559 glibcpp_prefixdir=${prefix}
1561 AC_MSG_CHECKING([for interface version number])
1562 libstdcxx_interface=$INTERFACE
1563 AC_MSG_RESULT($libstdcxx_interface)
1565 # Process the option --with-gxx-include-dir=<path to include-files directory>
1566 AC_MSG_CHECKING([for --with-gxx-include-dir])
1567 AC_ARG_WITH(gxx-include-dir,
1568 [ --with-gxx-include-dir the installation directory for include files],
1569 [case "${withval}" in
1571 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
1578 gxx_include_dir=${withval}
1580 esac], [gxx_include_dir=no])
1581 AC_MSG_RESULT($gxx_include_dir)
1583 # Process the option "--enable-version-specific-runtime-libs"
1584 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
1585 AC_ARG_ENABLE(version-specific-runtime-libs,
1586 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
1587 [case "$enableval" in
1588 yes) version_specific_libs=yes ;;
1589 no) version_specific_libs=no ;;
1590 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
1592 version_specific_libs=no)dnl
1593 # Option set, now we can test it.
1594 AC_MSG_RESULT($version_specific_libs)
1596 if test $version_specific_libs = yes; then
1597 # Need the gcc compiler version to know where to install libraries
1598 # and header files if --enable-version-specific-runtime-libs option
1601 gcc_version_trigger=${srcdir}/../gcc/version.c
1602 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'`
1603 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
1604 gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/g++
1605 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1606 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
1610 # Default case for install directory for include files.
1611 if test $version_specific_libs = no &&
1612 test $gxx_include_dir = no; then
1613 gxx_include_dir='$(prefix)'/include/g++-${libstdcxx_interface}
1616 # Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
1617 # Install a library built with a cross compiler in tooldir, not libdir.
1618 if test x"$glibcpp_toolexecdir" = x"no"; then
1619 if test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
1620 glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
1621 glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)'
1623 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1624 glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)'
1628 AC_MSG_CHECKING([for install location])
1629 AC_MSG_RESULT($gxx_include_dir)
1631 AC_SUBST(glibcpp_builddir)
1632 AC_SUBST(glibcpp_srcdir)
1633 AC_SUBST(glibcpp_prefixdir)
1634 AC_SUBST(gxx_include_dir)
1635 AC_SUBST(glibcpp_toolexecdir)
1636 AC_SUBST(glibcpp_toolexeclibdir)
1640 # Check whether LC_MESSAGES is available in <locale.h>.
1641 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1643 # This file file be copied and used freely without restrictions. It can
1644 # be used in projects which are not available under the GNU Public License
1645 # but which still want to provide support for the GNU gettext functionality.
1646 # Please note that the actual code is *not* freely available.
1650 AC_DEFUN(AC_LC_MESSAGES, [
1651 AC_CHECK_HEADER(locale.h, [
1652 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1653 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1654 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1655 if test $ac_cv_val_LC_MESSAGES = yes; then
1656 AC_DEFINE(HAVE_LC_MESSAGES)
1662 # Check for functions in math library.
1663 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1665 # This file can be copied and used freely without restrictions. It can
1666 # be used in projects which are not available under the GNU Public License
1667 # but which still want to provide support for the GNU gettext functionality.
1668 # Please note that the actual code is *not* freely available.
1672 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1673 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1674 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1675 AC_SUBST(LIBMATHOBJS)dnl
1679 # Check for string functions.
1680 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1682 # This file can be copied and used freely without restrictions. It can
1683 # be used in projects which are not available under the GNU Public License
1684 # but which still want to provide support for the GNU gettext functionality.
1685 # Please note that the actual code is *not* freely available.
1689 dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1690 AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1691 [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1692 AC_SUBST(LIBSTRINGOBJS)dnl
1696 dnl This macro searches for a GNU version of make. If a match is found, the
1697 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1698 dnl set to "#". This is useful for including a special features in a Makefile,
1699 dnl which cannot be handled by other versions of make. The variable
1700 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1701 dnl the empty string otherwise.
1703 dnl Here is an example of its use:
1705 dnl Makefile.in might contain:
1707 dnl # A failsafe way of putting a dependency rule into a makefile
1709 dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1711 dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1712 dnl @ifGNUmake@ include $(DEPEND)
1713 dnl @ifGNUmake@ endif
1715 dnl Then configure.in would normally contain:
1717 dnl CHECK_GNU_MAKE()
1718 dnl AC_OUTPUT(Makefile)
1720 dnl Then perhaps to cause gnu make to override any other make, we could do
1721 dnl something like this (note that GNU make always looks for GNUmakefile first):
1723 dnl if ! test x$_cv_gnu_make_command = x ; then
1724 dnl mv Makefile GNUmakefile
1725 dnl echo .DEFAULT: > Makefile ;
1726 dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1729 dnl Then, if any (well almost any) other make is called, and GNU make also
1730 dnl exists, then the other make wraps the GNU make.
1732 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1733 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
1735 dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1736 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1737 dnl #### conditional's subshell (" --version" is not a command), using a
1738 dnl #### different option to grep(1).
1740 dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not
1741 dnl #### ${MAKE:-make}).
1744 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1745 _cv_gnu_make_command='' ;
1746 dnl Search all the common names for GNU make
1747 for a in "${MAKE-make}" make gmake gnumake ; do
1748 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
1750 _cv_gnu_make_command=$a ;
1755 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1756 dnl string, '#' otherwise
1757 if test "x$_cv_gnu_make_command" != "x" ; then
1766 dnl Check for headers for, and arguments to, the setrlimit() function.
1767 dnl Used only in testsuite_hooks.h.
1768 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT_ancilliary, [
1769 AC_TRY_COMPILE([#include <sys/resource.h>
1771 ], [ int f = RLIMIT_$1 ; ],
1772 [glibcpp_mresult=1], [glibcpp_mresult=0])
1773 AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcpp_mresult,
1774 [Only used in build directory testsuite_hooks.h.])
1776 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT, [
1777 setrlimit_have_headers=yes
1778 AC_CHECK_HEADERS(sys/resource.h unistd.h,
1780 setrlimit_have_headers=no)
1781 # If don't have the headers, then we can't run the tests now, and we
1782 # won't be seeing any of these during testsuite compilation.
1783 if test $setrlimit_have_headers = yes; then
1784 # Can't do these in a loop, else the resulting syntax is wrong.
1785 GLIBCPP_CHECK_SETRLIMIT_ancilliary(DATA)
1786 GLIBCPP_CHECK_SETRLIMIT_ancilliary(RSS)
1787 GLIBCPP_CHECK_SETRLIMIT_ancilliary(VMEM)
1788 GLIBCPP_CHECK_SETRLIMIT_ancilliary(AS)
1790 # Check for rlimit, setrlimit.
1791 AC_CACHE_VAL(ac_setrlimit, [
1792 AC_TRY_COMPILE([#include <sys/resource.h>
1795 [ struct rlimit r; setrlimit(0, &r);],
1796 [ac_setrlimit=yes], [ac_setrlimit=no])
1800 AC_MSG_CHECKING([for testsuite memory limit support])
1801 if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then
1803 AC_DEFINE(_GLIBCPP_MEM_LIMITS)
1807 AC_MSG_RESULT($ac_mem_limits)
1812 dnl Does any necessary configuration of the testsuite directory. Generates
1813 dnl the testsuite_hooks.h header.
1815 dnl GLIBCPP_CONFIGURE_TESTSUITE [no args]
1816 AC_DEFUN(GLIBCPP_CONFIGURE_TESTSUITE, [
1817 GLIBCPP_CHECK_SETRLIMIT
1821 sinclude(../libtool.m4)
1822 dnl The lines below arrange for aclocal not to bring an installed
1823 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1824 dnl add a definition of LIBTOOL to Makefile.in.
1825 ifelse(,,,[AC_SUBST(LIBTOOL)
1826 AC_DEFUN([AM_PROG_LIBTOOL])
1827 AC_DEFUN([AC_LIBTOOL_DLOPEN])
1828 AC_DEFUN([AC_PROG_LD])