2 dnl Initialize configure bits.
4 dnl Define OPTLEVEL='-O2' if new inlining code present.
7 AC_DEFUN(GLIBCPP_CONFIGURE, [
8 dnl Default to --enable-multilib
9 AC_ARG_ENABLE(multilib,
10 [ --enable-multilib build hella library versions (default)],
11 [case "${enableval}" in
14 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
15 esac], [multilib=yes])dnl
17 glibcpp_basedir=$auxdir/$1/libstdc++-v3
18 AC_SUBST(glibcpp_basedir)
20 AM_INIT_AUTOMAKE(libstdc++, 2.90.8)
22 # Never versions of autoconf add an underscore to these functions.
23 # Prevent future problems ...
24 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
25 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
26 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
27 ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
31 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
32 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
33 # are probably using a cross compiler, which will not be able to fully
34 # link an executable. This should really be fixed in autoconf
37 AC_DEFUN(LIB_AC_PROG_CC,
38 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
39 dnl Fool anybody using AC_PROG_CC.
40 AC_PROVIDE([AC_PROG_CC])
41 AC_CHECK_PROG(CC, gcc, gcc)
42 if test -z "$CC"; then
43 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
44 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
49 if test $ac_cv_prog_gcc = yes; then
51 dnl Check whether -g works, even if CFLAGS is set, in case the package
52 dnl plays around with CFLAGS (such as to build both debugging and
53 dnl normal versions of a library), tasteless as that idea is.
54 ac_test_CFLAGS="${CFLAGS+set}"
55 ac_save_CFLAGS="$CFLAGS"
58 if test "$ac_test_CFLAGS" = set; then
59 CFLAGS="$ac_save_CFLAGS"
60 elif test $ac_cv_prog_cc_g = yes; then
67 test "${CFLAGS+set}" = set || CFLAGS="-g"
73 # Can't just call these here as g++ requires libstc++ to be built....
76 # Likewise for AC_PROG_CXX.
77 AC_DEFUN(LIB_AC_PROG_CXX,
78 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
79 dnl Fool anybody using AC_PROG_CXX.
80 AC_PROVIDE([AC_PROG_CXX])
81 # Use CXX_libstdcxx so that we do not cause CXX to be cached with the
82 # flags that come in CXX while configuring libstdc++. They're different
83 # from those used for all other target libraries. If CXX is set in
84 # the environment, respect that here.
86 AC_CHECK_PROGS(CXX_libstdcxx, $CCC c++ g++ gcc CC cxx cc++, gcc)
89 test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
93 if test $ac_cv_prog_gxx = yes; then
95 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
96 dnl plays around with CXXFLAGS (such as to build both debugging and
97 dnl normal versions of a library), tasteless as that idea is.
98 ac_test_CXXFLAGS="${CXXFLAGS+set}"
99 ac_save_CXXFLAGS="$CXXFLAGS"
102 if test "$ac_test_CXXFLAGS" = set; then
103 CXXFLAGS="$ac_save_CXXFLAGS"
104 elif test $ac_cv_prog_cxx_g = yes; then
111 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
117 AC_CHECK_TOOL(AS, as)
118 AC_CHECK_TOOL(AR, ar)
119 AC_CHECK_TOOL(RANLIB, ranlib, :)
125 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
126 # at least currently, we never actually build a program, so we never
127 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
128 # fails, because we are probably configuring with a cross compiler
129 # which cant create executables. So we include AC_EXEEXT to keep
130 # automake happy, but we dont execute it, since we dont care about
136 # configure.host sets the following important variables
137 # glibcpp_cflags - host specific C compiler flags
138 # glibcpp_cxxflags - host specific C++ compiler flags
142 . [$]{glibcpp_basedir}/configure.host
144 case [$]{glibcpp_basedir} in
145 /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
146 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
149 # This does for the target what configure.host does for the host. In
150 # addition to modifying the same flags, it also sets up symlinks.
153 GLIBCPP_CFLAGS="[$]{glibcpp_cflags}"
154 GLIBCPP_CXXFLAGS="[$]{glibcpp_cxxflags}"
155 AC_SUBST(GLIBCPP_CFLAGS)
156 AC_SUBST(GLIBCPP_CXXFLAGS)
161 dnl Check to see if g++ can compile this library, and if so, if any version-
162 dnl specific precautions need to be taken.
164 dnl GLIBCPP_CHECK_COMPILER_VERSION
165 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
166 if test ! -f stamp-sanity-compiler; then
167 AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3])
171 #if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
174 ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to gcc-2.95 or above]))
176 AC_MSG_RESULT($gpp_satisfactory)
177 touch stamp-sanity-compiler
183 dnl Test for newer compiler features, or features that are present in newer
184 dnl compiler version but not older compiler versions should be placed
187 dnl Define WFMT_FLAGS='-fdiagnostics-show-location=once' if possible
189 dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
190 dnl new inlining code or the new system_header pragma will die on -Werror.
191 dnl Leave it out by default and use maint-mode to use it.
193 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
194 dnl compiler supports it.
195 dnl GLIBCPP_CHECK_COMPILER_FEATURES
196 AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
197 # All these tests are for C++; save the language and the compiler flags.
198 # The CXXFLAGS thing is suspicious, but based on similar bits
199 # found in GLIBCPP_CONFIGURE.
202 ac_test_CXXFLAGS="${CXXFLAGS+set}"
203 ac_save_CXXFLAGS="$CXXFLAGS"
205 # Check for maintainer-mode bits.
206 if test x"$USE_MAINTAINER_MODE" = xno; then
212 # Check for more sophisticated diagnostic control.
213 AC_MSG_CHECKING([for g++ that supports -fdiagnostics-show-location=once])
214 CXXFLAGS='-Werror -fdiagnostics-show-location=once'
215 AC_TRY_COMPILE(, [int foo;
216 ], [ac_gabydiags=yes], [ac_gabydiags=no])
217 if test "$ac_test_CXXFLAGS" = set; then
218 CXXFLAGS="$ac_save_CXXFLAGS"
220 # this is the suspicious part
223 if test x"$ac_gabydiags" = x"yes"; then
224 WFMT_FLAGS='-fdiagnostics-show-location=once'
226 AC_MSG_RESULT($ac_gabydiags)
228 # Check for -ffunction-sections -fdata-sections
229 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
230 CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
231 AC_TRY_COMPILE(, [int foo;
232 ], [ac_fdsections=yes], [ac_fdsections=no])
233 if test "$ac_test_CXXFLAGS" = set; then
234 CXXFLAGS="$ac_save_CXXFLAGS"
236 # this is the suspicious part
239 if test x"$ac_fdsections" = x"yes" && test x"$enable_debug" = x"no"; then
240 SECTION_FLAGS='-ffunction-sections -fdata-sections'
242 AC_MSG_RESULT($ac_fdsections)
247 AC_SUBST(SECTION_FLAGS)
252 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
253 dnl the native linker is in use, all variables will be defined to something
254 dnl safe (like an empty string).
256 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
257 dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
259 dnl GLIBCPP_CHECK_LINKER_FEATURES
260 AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
261 # If we're not using GNU ld, then there's no point in even trying these
262 # tests. Check for that first. We should have already tested for gld
263 # by now (in libtool), but require it now just to be safe...
266 AC_REQUIRE([AC_PROG_LD])
269 if test "$ac_cv_prog_gnu_ld" = "notbroken"; then
270 # GNU ld it is! Joy and bunny rabbits!
272 # All these tests are for C++; save the language and the compiler flags.
273 # Need to do this so that g++ won't try to link in libstdc++
274 ac_test_CFLAGS="${CFLAGS+set}"
275 ac_save_CFLAGS="$CFLAGS"
276 CFLAGS='-x c++ -Wl,--gc-sections'
278 # Check for -Wl,--gc-sections
279 # XXX This test is broken at the moment, as symbols required for
280 # linking are now in libsupc++ (not built yet.....). In addition,
281 # this test has cored on solaris in the past. In addition,
282 # --gc-sections doesn't really work at the moment (keeps on discarding
283 # used sections, first .eh_frame and now some of the glibc sections for
284 # iconv). Bzzzzt. Thanks for playing, maybe next time.
285 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
293 ], [ac_sectionLDflags=yes],[ac_sectionLFflags=no], [ac_sectionLDflags=yes])
294 if test "$ac_test_CFLAGS" = set; then
295 CFLAGS="$ac_save_CFLAGS"
297 # this is the suspicious part
300 if test "$ac_sectionLDflags" = "yes"; then
301 SECTION_LDFLAGS='-Wl,--gc-sections'
303 AC_MSG_RESULT($ac_sectionLDflags)
306 # Set linker optimization flags.
307 if test x"$ac_cv_prog_gnu_ld" = x"yes" && test x"$enable_debug" = x"no"; then
308 OPT_LDFLAGS='-Wl,-O1'
311 AC_SUBST(SECTION_LDFLAGS)
312 AC_SUBST(OPT_LDFLAGS)
317 dnl Check to see if the (math function) argument passed is
318 dnl declared when using the c++ compiler
319 dnl ASSUMES argument is a math function with ONE parameter
321 dnl GLIBCPP_CHECK_MATH_DECL_1
322 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [
323 AC_MSG_CHECKING([for $1 declaration])
324 if test x${glibcpp_cv_func_$1_use+set} != xset; then
325 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
328 AC_TRY_COMPILE([#include <math.h>
334 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
338 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
342 dnl Check to see if the (math function) argument passed is
343 dnl 1) declared when using the c++ compiler
344 dnl 2) has "C" linkage
345 dnl 3) if not, see if 1) and 2) for argument prepended with '_'
347 dnl Define HAVE_CARGF etc if "cargf" is declared and links
349 dnl argument 1 is name of function to check
351 dnl ASSUMES argument is a math function with ONE parameter
353 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
354 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
355 GLIBCPP_CHECK_MATH_DECL_1($1)
356 if test x$glibcpp_cv_func_$1_use = x"yes"; then
359 GLIBCPP_CHECK_MATH_DECL_1(_$1)
360 if test x$glibcpp_cv_func__$1_use = x"yes"; then
368 dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
369 dnl of functions at once. It's an all-or-nothing check -- either
370 dnl HAVE_XYZ is defined for each of the functions, or for none of them.
371 dnl Doing it this way saves significant configure time.
372 AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [
373 AC_MSG_CHECKING([for $1 functions])
374 AC_CACHE_VAL(glibcpp_cv_func_$2_use, [
377 AC_TRY_COMPILE([#include <math.h>],
378 [ `for x in $3; do echo "$x (0);"; done` ],
379 [glibcpp_cv_func_$2_use=yes],
380 [glibcpp_cv_func_$2_use=no])
382 AC_MSG_RESULT($glibcpp_cv_func_$2_use)
383 if test x$glibcpp_cv_func_$2_use = x"yes"; then
389 dnl Check to see if the (math function) argument passed is
390 dnl declared when using the c++ compiler
391 dnl ASSUMES argument is a math function with ONE parameter
393 dnl GLIBCPP_CHECK_MATH_DECL_2
394 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [
395 AC_MSG_CHECKING([for $1 declaration])
396 if test x${glibcpp_cv_func_$1_use+set} != xset; then
397 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
400 AC_TRY_COMPILE([#include <math.h>],
402 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
406 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
410 dnl Check to see if the (math function) argument passed is
411 dnl 1) declared when using the c++ compiler
412 dnl 2) has "C" linkage
414 dnl Define HAVE_CARGF etc if "cargf" is declared and links
416 dnl argument 1 is name of function to check
418 dnl ASSUMES argument is a math function with TWO parameters
420 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
421 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
422 GLIBCPP_CHECK_MATH_DECL_2($1)
423 if test x$glibcpp_cv_func_$1_use = x"yes"; then
426 GLIBCPP_CHECK_MATH_DECL_2(_$1)
427 if test x$glibcpp_cv_func__$1_use = x"yes"; then
435 dnl Check to see if the (math function) argument passed is
436 dnl declared when using the c++ compiler
437 dnl ASSUMES argument is a math function with ONE parameter
439 dnl GLIBCPP_CHECK_MATH_DECL_3
440 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [
441 AC_MSG_CHECKING([for $1 declaration])
442 if test x${glibcpp_cv_func_$1_use+set} != xset; then
443 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
446 AC_TRY_COMPILE([#include <math.h>],
448 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
452 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
456 dnl Check to see if the (math function) argument passed is
457 dnl 1) declared when using the c++ compiler
458 dnl 2) has "C" linkage
460 dnl Define HAVE_CARGF etc if "cargf" is declared and links
462 dnl argument 1 is name of function to check
464 dnl ASSUMES argument is a math function with THREE parameters
466 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
467 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
468 GLIBCPP_CHECK_MATH_DECL_3($1)
469 if test x$glibcpp_cv_func_$1_use = x"yes"; then
472 GLIBCPP_CHECK_MATH_DECL_3(_$1)
473 if test x$glibcpp_cv_func__$1_use = x"yes"; then
481 dnl Check to see if the (stdlib function) argument passed is
482 dnl 1) declared when using the c++ compiler
483 dnl 2) has "C" linkage
485 dnl Define HAVE_STRTOLD if "strtold" is declared and links
486 dnl Define HAVE_STRTOF if "strtof" is declared and links
488 dnl argument 1 is name of function to check
490 dnl ASSUMES argument is a math function with TWO parameters
492 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
493 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
494 AC_MSG_CHECKING([for $1 declaration])
495 if test x${glibcpp_cv_func_$1_use+set} != xset; then
496 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
499 AC_TRY_COMPILE([#include <stdlib.h>],
501 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
505 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
506 if test x$glibcpp_cv_func_$1_use = x"yes"; then
513 dnl Because the builtins are picky picky picky about the arguments they take,
514 dnl do an explict linkage tests here.
515 dnl Check to see if the (math function) argument passed is
516 dnl 1) declared when using the c++ compiler
517 dnl 2) has "C" linkage
519 dnl Define HAVE_CARGF etc if "cargf" is declared and links
521 dnl argument 1 is name of function to check
523 dnl ASSUMES argument is a math function with ONE parameter
525 dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
526 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
527 AC_MSG_CHECKING([for $1 declaration])
528 if test x${glibcpp_cv_func_$1_use+set} != xset; then
529 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
532 AC_TRY_COMPILE([#include <math.h>],
534 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
538 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
539 if test x$glibcpp_cv_func_$1_use = x"yes"; then
540 AC_MSG_CHECKING([for $1 linkage])
541 if test x${glibcpp_cv_func_$1_link+set} != xset; then
542 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
543 AC_TRY_LINK([#include <math.h>],
545 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
548 AC_MSG_RESULT($glibcpp_cv_func_$1_link)
549 if test x$glibcpp_cv_func_$1_link = x"yes"; then
550 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
551 AC_DEFINE_UNQUOTED(${ac_tr_func})
558 dnl Check to see what builtin math functions are supported
560 dnl check for __builtin_abs
561 dnl check for __builtin_fabsf
562 dnl check for __builtin_fabs
563 dnl check for __builtin_fabl
564 dnl check for __builtin_labs
565 dnl check for __builtin_sqrtf
566 dnl check for __builtin_sqrtl
567 dnl check for __builtin_fsqrt
568 dnl check for __builtin_sinf
569 dnl check for __builtin_sin
570 dnl check for __builtin_sinl
571 dnl check for __builtin_cosf
572 dnl check for __builtin_cos
573 dnl check for __builtin_cosl
575 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
576 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
577 dnl Test for builtin math functions.
578 dnl These are made in gcc/c-common.c
579 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
580 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
581 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
582 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
583 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
585 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
586 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fsqrt)
587 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
589 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
590 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
591 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
593 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
594 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
595 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
597 dnl There is, without a doubt, a more elegant way to have these
598 dnl names exported so that they won't be stripped out of acconfig.h by
599 dnl autoheader. I leave this as an exercise to somebody less frustrated
600 dnl than I.... please email the libstdc++ list if you can figure out a
601 dnl more elegant approach (see autoconf/acgen.m4 and specifically
602 dnl AC_CHECK_FUNC for things to steal.)
604 if test x$dummyvar = x"yes"; then
605 AC_DEFINE(HAVE___BUILTIN_ABS)
606 AC_DEFINE(HAVE___BUILTIN_LABS)
607 AC_DEFINE(HAVE___BUILTIN_COS)
608 AC_DEFINE(HAVE___BUILTIN_COSF)
609 AC_DEFINE(HAVE___BUILTIN_COSL)
610 AC_DEFINE(HAVE___BUILTIN_FABS)
611 AC_DEFINE(HAVE___BUILTIN_FABSF)
612 AC_DEFINE(HAVE___BUILTIN_FABSL)
613 AC_DEFINE(HAVE___BUILTIN_SIN)
614 AC_DEFINE(HAVE___BUILTIN_SINF)
615 AC_DEFINE(HAVE___BUILTIN_SINL)
616 AC_DEFINE(HAVE___BUILTIN_FSQRT)
617 AC_DEFINE(HAVE___BUILTIN_SQRTF)
618 AC_DEFINE(HAVE___BUILTIN_SQRTL)
624 dnl Check to see what the underlying c library
625 dnl These checks need to do two things:
626 dnl 1) make sure the name is declared when using the c++ compiler
627 dnl 2) make sure the name has "C" linkage
628 dnl This might seem like overkill but experience has shown that it's not...
630 dnl Define HAVE_STRTOF etc if "strtof" is found.
631 dnl Define HAVE_STRTOLD etc if "strtold" is found.
633 dnl GLIBCPP_CHECK_STDLIB_SUPPORT
634 AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
635 ac_test_CXXFLAGS="${CXXFLAGS+set}"
636 ac_save_CXXFLAGS="$CXXFLAGS"
637 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
639 AC_CHECK_FUNCS(strtof)
640 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
642 CXXFLAGS="$ac_save_CXXFLAGS"
647 dnl Check to see what the underlying c library or math library is like.
648 dnl These checks need to do two things:
649 dnl 1) make sure the name is declared when using the c++ compiler
650 dnl 2) make sure the name has "C" linkage
651 dnl This might seem like overkill but experience has shown that it's not...
653 dnl Define HAVE_CARGF etc if "cargf" is found.
655 dnl GLIBCPP_CHECK_MATH_SUPPORT
656 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
657 ac_test_CXXFLAGS="${CXXFLAGS+set}"
658 ac_save_CXXFLAGS="$CXXFLAGS"
659 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
662 AC_CHECK_LIB(m, sin, libm="-lm")
666 dnl Check to see if certain C math functions exist.
667 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
668 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
669 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
670 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
671 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
672 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
673 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
675 dnl Check to see if basic C math functions have float versions.
676 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig,
681 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
684 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
685 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
686 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
687 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
688 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
689 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
690 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
691 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
692 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
693 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
694 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
695 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
696 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
698 dnl Check to see if basic C math functions have long double versions.
699 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig,
704 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round,
707 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
708 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
709 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
710 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
711 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
712 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
713 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
714 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
715 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
716 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
717 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
718 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
719 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
720 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
721 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
722 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
724 dnl Some runtimes have these functions with a preceding underscore. Please
725 dnl keep this sync'd with the one above. And if you add any new symbol,
726 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
727 dnl Check to see if certain C math functions exist.
729 dnl Check to see if basic C math functions have float versions.
730 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
732 _acosf _asinf _atanf \
734 _coshf _sinhf _tanhf)
735 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
739 dnl Check to see if basic C math functions have long double versions.
740 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
742 _acosl _asinl _atanl \
744 _coshl _sinhl _tanhl)
745 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
750 CXXFLAGS="$ac_save_CXXFLAGS"
755 dnl Check to see if there is native support for complex
757 dnl Don't compile bits in math/* if native support exits.
759 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "atan2l/copysignl" is found.
761 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
762 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
763 dnl Check for complex versions of math functions of platform.
764 AC_CHECK_LIB(m, main)
765 AC_REPLACE_MATHFUNCS(nan hypot hypotf atan2f expf copysignf)
767 dnl Compile the long double complex functions only if the function
768 dnl provides the non-complex long double functions that are needed.
769 dnl Currently this includes copysignl and atan2l, which should be
770 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
771 USE_COMPLEX_LONG_DOUBLE=no
772 if test x$ac_cv_func_atan2l = x"yes" \
773 && test x$ac_cv_func_copysignl = x"yes"; then
774 USE_COMPLEX_LONG_DOUBLE=yes
775 AC_REPLACE_MATHFUNCS(hypotl signbitl)
778 AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
782 dnl Check to see what architecture and operating system we are compiling
783 dnl for. Also, if architecture- or OS-specific flags are required for
784 dnl compilation, pick them up here.
786 dnl GLIBCPP_CHECK_TARGET
787 AC_DEFUN(GLIBCPP_CHECK_TARGET, [
788 . [$]{glibcpp_basedir}/configure.target
789 AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
790 AC_MSG_RESULT(OS config directory is $os_include_dir)
791 AC_LINK_FILES($os_include_dir/bits/os_defines.h, include/bits/os_defines.h)
796 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
797 dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
798 dnl must have been previously checked.)
800 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
801 dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h
803 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
804 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
806 dnl Test wchar.h for mbstate_t, which is needed for char_traits and
807 dnl others even if wchar_t support is not on.
808 AC_MSG_CHECKING([for mbstate_t])
809 AC_TRY_COMPILE([#include <wchar.h>],
810 [mbstate_t teststate;],
811 have_mbstate_t=yes, have_mbstate_t=no)
812 AC_MSG_RESULT($have_mbstate_t)
813 if test x"$have_mbstate_t" = xyes; then
814 AC_DEFINE(HAVE_MBSTATE_T)
817 dnl Sanity check for existence of ISO C99 headers for extended encoding.
818 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
819 AC_CHECK_HEADER(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
821 dnl Only continue checking if the ISO C99 headers exist and support is on.
822 if test x"$ac_has_wchar_h" = xyes && test x"$ac_has_wctype_h" = xyes \
823 && test x"$enable_c_mbchar" != xno; then
825 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
826 dnl numeric_limits can instantiate type_traits<wchar_t>
827 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
828 AC_TRY_COMPILE([#include <wchar.h>],
829 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
830 has_wchar_minmax=yes, has_wchar_minmax=no)
831 AC_MSG_RESULT($has_wchar_minmax)
833 dnl Test wchar.h for WEOF, which is what we use to determine whether
834 dnl to specialize for char_traits<wchar_t> or not.
835 AC_MSG_CHECKING([for WEOF])
838 #include <stddef.h>],
840 has_weof=yes, has_weof=no)
841 AC_MSG_RESULT($has_weof)
843 dnl Tests for wide character functions used in char_traits<wchar_t>.
844 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset \
845 wcsrtombs mbsrtowcs, ac_wfuncs=yes, ac_wfuncs=no)
847 AC_MSG_CHECKING([for ISO C99 wchar_t support])
848 if test x"$has_weof" = xyes && test x"$has_wchar_minmax" = xyes \
849 && test x"$ac_wfuncs" = xyes; then
850 ac_isoC99_wchar_t=yes
854 AC_MSG_RESULT($ac_isoC99_wchar_t)
856 dnl Use iconv for wchar_t to char conversions. As such, check for
857 dnl X/Open Portability Guide, version 2 features (XPG2).
858 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
859 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
861 dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
862 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
864 LIBS="$LIBS $libiconv"
866 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
867 ac_XPG2funcs=yes, ac_XPG2funcs=no)
871 AC_MSG_CHECKING([for XPG2 wchar_t support])
872 if test x"$ac_has_iconv_h" = xyes && test x"$ac_has_langinfo_h" = xyes \
873 && test x"$ac_XPG2funcs" = xyes; then
878 AC_MSG_RESULT($ac_XPG2_wchar_t)
880 dnl At the moment, only enable wchar_t specializations if all the
881 dnl above support is present.
882 AC_MSG_CHECKING([for enabled wchar_t specializations])
883 if test x"$ac_isoC99_wchar_t" = xyes \
884 && test x"$ac_XPG2_wchar_t" = xyes; then
885 libinst_wstring_la="libinst-wstring.la"
886 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
889 libinst_wstring_la=""
892 AC_SUBST(libinst_wstring_la)
895 dnl Wide characters disabled by the user.
896 AC_MSG_WARN([wchar_t support disabled.])
902 dnl Check to see if this version of GNU C++ is afflicted by bugs in
903 dnl __complex__ float support.
905 dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
907 dnl Check to see if this version of GNU C++ is afflicted by bugs in
908 dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
909 dnl gcc-2.95.x when using the library, unless we define the default copy
910 dnl ctor in the specializations of complex<>.
912 dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
913 dnl GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT
914 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT, [
915 AC_REQUIRE([AC_PROG_CXX])
917 AC_MSG_CHECKING([for GNU C++ __complex__ support])
918 AC_CACHE_VAL(glibcpp_cv_complex, [
921 AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
922 dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
923 [ dcomplex x; f(x); ],
924 glibcpp_cv_complex=ok,
925 glibcpp_cv_complex=buggy
929 AC_MSG_RESULT($glibcpp_cv_complex)
930 if test $glibcpp_cv_complex = buggy; then
931 AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
934 AC_MSG_CHECKING([for GNU C++ __complex__ float support])
935 AC_CACHE_VAL(glibcpp_cv_float_complex, [
939 cat > conftest.h <<EOB
941 // Check for buggy __complex__ that causes ICE in most versions of egcs
942 // and gcc-2.95.x on certain platforms (eg., x86-win32).
944 // See http://gcc.gnu.org/ml/gcc-bugs/1999-07n/msg00845.html for
945 // more info on the bug itself.
950 __complex__ float m_value;
951 float_complex (float = 0.0f, float = 0.0f);
952 float_complex (__complex__ float val) : m_value (val) {}
953 float_complex foo (const float_complex &val)
954 { return float_complex (~val.m_value); }
957 AC_TRY_COMPILE([#include "conftest.h"], ,
958 glibcpp_cv_float_complex=ok,
959 glibcpp_cv_float_complex=buggy
963 AC_MSG_RESULT($glibcpp_cv_float_complex)
964 if test $glibcpp_cv_float_complex = buggy; then
965 AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
971 dnl Check for special debugging mode; not for production use.
973 dnl GLIBCPP_ENABLE_DEBUG
974 dnl --enable-debug sets '-ggdb3 -O0'.
975 dnl --disable-debug sets '-g' and whatever optimization options the
976 dnl compiler can handle.
977 dnl + --enable-maintainer-mode automatically defaults this to on.
978 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
979 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
980 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
981 dnl defaults to `no'.
982 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
983 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
985 changequote(<<, >>)dnl
986 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
988 [case "${enableval}" in
989 yes) enable_debug=yes ;;
990 no) enable_debug=no ;;
991 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
993 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
995 dnl Option parsed, now set things appropriately
996 case "${enable_debug}" in
998 DEBUG_FLAGS='-O0 -ggdb3'
1004 AC_SUBST(DEBUG_FLAGS)
1009 dnl Check for "unusual" flags to pass to the compiler while building.
1011 dnl GLIBCPP_ENABLE_CXX_FLAGS
1012 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1013 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1014 dnl Somehow this same set of flags must be passed when [re]building
1016 dnl --disable-cxx-flags passes nothing.
1017 dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
1018 dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
1019 dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
1020 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
1021 dnl If "default flags" is an empty string (or "none"), the effect is
1022 dnl the same as --disable or --enable=no.
1023 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1024 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1025 AC_ARG_ENABLE(cxx-flags,
1026 changequote(<<, >>)dnl
1027 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
1028 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1029 changequote([, ])dnl
1030 [case "x$enableval" in
1032 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1034 enable_cxx_flags='' ;;
1036 enable_cxx_flags="$enableval" ;;
1038 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
1040 dnl Thinko on my part during design. This kludge is the workaround.
1041 if test "$enable_cxx_flags" = "none"; then
1042 enable_cxx_flags='';
1045 dnl Run through flags (either default or command-line) and set anything
1046 dnl extra (e.g., #defines) that must accompany particular g++ options.
1047 if test -n "$enable_cxx_flags"; then
1048 for f in $enable_cxx_flags; do
1052 *) # and we're trying to pass /what/ exactly?
1053 AC_MSG_ERROR([compiler flags start with a -]) ;;
1057 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1058 AC_SUBST(EXTRA_CXX_FLAGS)
1063 dnl Check for which locale library to use: gnu or generic.
1065 dnl GLIBCPP_ENABLE_CLOCALE
1066 dnl --enable-clocale=gnu sets config/c_locale_gnu.cc and friends
1067 dnl --enable-clocale=generic sets config/c_locale_generic.cc and friends
1069 dnl default is generic
1071 AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
1072 AC_MSG_CHECKING([for clocale to use])
1073 AC_ARG_ENABLE(clocale,
1074 [ --enable-clocale enable model for target locale package.
1075 --enable-clocale=MODEL use MODEL target-speific locale package. [default=generic]
1077 if test x$enable_clocale = xno; then
1078 enable_clocale=generic
1080 enable_clocale=generic)
1082 enable_clocale_flag=$enable_clocale
1084 dnl Check if a valid locale package
1085 case x${enable_clocale_flag} in
1087 CLOCALE_H=config/c_locale_gnu.h
1088 CLOCALE_CC=config/c_locale_gnu.cc
1092 CLOCALE_H=config/c_locale_generic.h
1093 CLOCALE_CC=config/c_locale_generic.cc
1094 AC_MSG_RESULT(generic)
1097 echo "$enable_clocale is an unknown locale package" 1>&2
1102 AC_LINK_FILES($CLOCALE_H, include/bits/c++locale.h)
1103 AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
1108 dnl Check for which I/O library to use: libio, or something specific.
1110 dnl GLIBCPP_ENABLE_CSTDIO
1111 dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
1113 dnl default is stdio
1115 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1116 AC_MSG_CHECKING([for cstdio to use])
1117 AC_ARG_ENABLE(cstdio,
1118 [ --enable-cstdio enable stdio for target io package.
1119 --enable-cstdio=LIB use LIB target-speific io package. [default=stdio]
1121 if test x$enable_cstdio = xno; then
1124 enable_cstdio=stdio)
1126 enable_cstdio_flag=$enable_cstdio
1128 dnl Check if a valid I/O package
1129 case x${enable_cstdio_flag} in
1131 CSTDIO_H=config/c_io_libio.h
1132 CSTDIO_CC=config/c_io_libio.cc
1133 AC_MSG_RESULT(libio)
1135 # see if we are on a system with libio native (ie, linux)
1136 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1138 # Need to check and see what version of glibc is being used. If
1139 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1140 # compile most of libio for linux systems.
1141 if test x$has_libio = x"yes"; then
1144 AC_MSG_CHECKING([for glibc version >= 2.2])
1145 AC_EGREP_CPP([ok], [
1146 #include <features.h>
1147 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1150 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1151 AC_MSG_RESULT($glibc_satisfactory)
1155 # XXX at the moment, admit defeat and force the recompilation
1156 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
1157 glibc_satisfactory=no
1159 if test x$glibc_satisfactory = x"yes"; then
1164 # bkoz XXX need to add checks to enable this
1165 # pme XXX here's a first pass at such a check
1166 if test x$enable_c_mbchar != xno; then
1174 # Using libio, but <libio.h> doesn't exist on the target system. . .
1176 # bkoz XXX need to add checks to enable this
1177 # pme XXX here's a first pass at such a check
1178 if test x$enable_c_mbchar != xno; then
1185 xstdio | x | xno | xnone | xyes)
1187 CSTDIO_H=config/c_io_stdio.h
1188 CSTDIO_CC=config/c_io_stdio.cc
1189 AC_MSG_RESULT(stdio)
1191 # We're not using stdio.
1194 # Wide characters are not supported with this package.
1198 echo "$enable_cstdio is an unknown io package" 1>&2
1202 AC_LINK_FILES($CSTDIO_H, include/bits/c++io.h)
1203 AC_LINK_FILES($CSTDIO_CC, src/c++io.cc)
1205 # 2000-08-04 bkoz hack
1206 CCODECVT_C=config/c_io_libio_codecvt.c
1207 AC_LINK_FILES($CCODECVT_C, libio/c_codecvt.c)
1208 # 2000-08-04 bkoz hack
1210 AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO,
1211 test "$need_libio" = yes || test "$need_wlibio" = yes)
1212 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1213 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1214 if test "$need_libio" = yes || test "$need_wlibio" = yes; then
1215 libio_la=../libio/libio.la
1224 dnl Check for which threading library to use.
1226 dnl GLIBCPP_ENABLE_THREADS
1227 dnl --enable-threads=posix sets config/threads-posix.h et. al.
1229 dnl Default is no threads, which also disables _IO_MTSAFE_IO in
1230 dnl libio. Any actual thread package will enable it.
1232 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1233 dnl Note this comes from the gcc/config.in and libjava/config.in
1234 dnl Efforts should be made to keep this in sync.
1235 AC_MSG_CHECKING([for threads package to use])
1236 AC_ARG_ENABLE(threads,
1237 [ --enable-threads enable thread usage for target GCC.
1238 --enable-threads=LIB use LIB thread package for target GCC. [default=no]
1240 if test x$enable_threads = xno; then
1245 enable_threads_flag=$enable_threads
1247 dnl Check if a valid thread package
1248 case x${enable_threads_flag} in
1251 target_thread_file='single'
1255 target_thread_file='posix'
1257 xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
1258 xsolaris | xwin32 | xdce | xvxworks)
1259 target_thread_file=$enable_threads_flag
1262 echo "$enable_threads is an unknown thread package" 1>&2
1267 dnl Check for thread package actually supported in libstdc++
1269 case "$target_thread_file" in
1271 THREADH=threads-no.h
1274 THREADH=threads-posix.h
1276 decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
1277 AC_MSG_ERROR(thread package $THREADS not yet supported)
1280 AC_MSG_ERROR($THREADS is an unsupported/unknown thread package)
1283 AC_MSG_RESULT($THREADH)
1285 AC_LINK_FILES(config/$THREADH, include/bits/c++threads.h)
1286 if test $THREADH != threads-no.h; then
1287 AC_DEFINE(_GLIBCPP_USE_THREADS)
1293 dnl Check for template specializations for the 'long long' type extension.
1295 dnl GLIBCPP_ENABLE_LONG_LONG
1296 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1297 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1298 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1299 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1300 dnl defaults to `no'.
1301 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1303 dnl GLIBCPP_ENABLE_LONG_LONG
1304 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1305 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1307 AC_ARG_ENABLE(long-long,
1308 changequote(<<, >>)dnl
1309 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1310 changequote([, ])dnl
1311 [case "$enableval" in
1312 yes) enable_long_long=yes ;;
1313 no) enable_long_long=no ;;
1314 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1316 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1318 # Allow use of os-dependent settings, so that macros that turn on
1319 # C99 capabilities can be defined and used in a consistent way.
1320 OS_INC_PATH=${srcdir}/$os_include_dir
1321 ac_test_CFLAGS="${CFLAGS+set}"
1322 ac_save_CFLAGS="$CFLAGS"
1323 CFLAGS="-I$OS_INC_PATH"
1325 # Check for the existence of functions used if long long is enabled.
1326 AC_CHECK_FUNC(strtoll,,ac_strtoll=no)
1327 AC_CHECK_FUNC(strtoull,,ac_strtoull=no)
1329 # Check for lldiv_t, et. al.
1330 AC_MSG_CHECKING([for lldiv_t declaration])
1331 AC_CACHE_VAL(glibcpp_lldiv_t_use, [
1332 AC_TRY_COMPILE([#include <bits/os_defines.h>
1333 #include <stdlib.h>],
1335 [glibcpp_lldiv_t_use=yes], [glibcpp_lldiv_t_use=no])
1337 AC_MSG_RESULT($glibcpp_lldiv_t_use)
1338 if test x$glibcpp_lldiv_t_use = x"yes"; then
1339 AC_DEFINE(HAVE_LLDIV_T)
1342 AC_MSG_CHECKING([for enabled long long])
1343 if test x"$ac_strtoll" = xno || test x"$ac_strtoull" = xno; then
1344 enable_long_long=no;
1346 AC_MSG_RESULT($enable_long_long)
1348 # Option parsed, now set things appropriately
1349 if test x"$enable_long_long" = xyes; then
1350 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1354 CFLAGS="$ac_save_CFLAGS"
1359 dnl Check for what kind of C headers to use.
1361 dnl GLIBCPP_ENABLE_CHEADERS
1362 dnl --enable-cheaders= [does stuff].
1363 dnl --disable-cheaders [does not do anything, really].
1364 dnl + This will eventually need to be 'c_shadow' by default.
1365 dnl + Usage: GLIBCPP_ENABLE_CHEADERS[(DEFAULT)]
1366 dnl Where DEFAULT is either `c' or `c_std' or 'c_shadow'.
1367 dnl If ommitted, it defaults to `c_std'.
1368 AC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl
1369 define([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl
1370 AC_MSG_CHECKING([for c header strategy to use])
1371 AC_ARG_ENABLE(cheaders,
1372 changequote(<<, >>)dnl
1373 << --enable-cheaders construct "C" header files for
1374 g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT],
1376 [case "$enableval" in
1381 enable_cheaders=c_std
1384 enable_cheaders=c_shadow
1386 *) AC_MSG_ERROR([Unknown argument to enable/disable "C" headers])
1389 enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT)
1390 AC_MSG_RESULT($enable_cheaders)
1392 dnl Option parsed, now set things appropriately
1393 case "$enable_cheaders" in
1395 CSHADOW_FLAGS="-fno-builtin"
1396 C_INCLUDE_DIR='${top_srcdir}/include/c_shadow'
1397 AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
1401 C_INCLUDE_DIR='${top_srcdir}/include/c_std'
1405 C_INCLUDE_DIR='${top_srcdir}/include/c'
1409 AC_SUBST(CSHADOW_FLAGS)
1410 AC_SUBST(C_INCLUDE_DIR)
1411 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cheaders" = c_shadow)
1416 dnl Check for wide character support. Has the same effect as the option
1417 dnl in gcc's configure, but in a form that autoconf can mess with.
1419 dnl GLIBCPP_ENABLE_C_MBCHAR
1420 dnl --enable-c-mbchar requests all the wchar_t stuff.
1421 dnl --disable-c-mbchar doesn't.
1422 dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1423 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1424 dnl defaults to `no'.
1425 AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1426 define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1427 AC_ARG_ENABLE(c-mbchar,
1428 changequote(<<, >>)dnl
1429 << --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1430 changequote([, ])dnl
1431 [case "$enableval" in
1432 yes) enable_c_mbchar=yes ;;
1433 no) enable_c_mbchar=no ;;
1434 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1436 enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1437 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1442 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1444 dnl GLIBCPP_INCLUDE_DIR
1446 dnl TOPLEVEL_INCLUDES
1447 dnl LIBMATH_INCLUDES
1448 dnl LIBSUPCXX_INCLUDES
1450 dnl CSHADOW_INCLUDES
1452 dnl GLIBCPP_EXPORT_INCLUDE
1453 AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1454 # Root level of the include sources.
1455 GLIBCPP_INCLUDE_DIR='$(top_srcdir)/include'
1457 # Can either use include/c or include/c_std to grab "C" headers. This
1458 # variable is set to the include directory currently in use.
1459 # set with C_INCLUDE_DIR in GLIBCPP_ENABLE_CHEADERS
1461 # Passed down for canadian crosses.
1462 if test x"$CANADIAN" = xyes; then
1463 TOPLEVEL_INCLUDES='-I$(includedir)'
1466 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1468 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1470 #if GLIBCPP_NEED_LIBIO
1471 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1473 #LIBIO_INCLUDES='-I$(top_srcdir)/libio'
1476 #if GLIBCPP_USE_CSHADOW
1477 # CSHADOW_INCLUDES='-I$(GLIBCPP_INCLUDE_DIR)/std -I$(C_INCLUDE_DIR) \
1478 # -I$(top_blddir)/cshadow'
1480 CSTD_INCLUDES='-I$(GLIBCPP_INCLUDE_DIR)/std -I$(C_INCLUDE_DIR)'
1483 # Now, export this to all the little Makefiles....
1484 AC_SUBST(GLIBCPP_INCLUDE_DIR)
1485 AC_SUBST(TOPLEVEL_INCLUDES)
1486 AC_SUBST(LIBMATH_INCLUDES)
1487 AC_SUBST(LIBSUPCXX_INCLUDES)
1488 AC_SUBST(LIBIO_INCLUDES)
1489 AC_SUBST(CSTD_INCLUDES)
1494 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1496 AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1497 # Optimization flags that are probably a good idea for thrill-seekers. Just
1498 # uncomment the lines below and make, everything else is ready to go...
1499 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1501 AC_SUBST(OPTIMIZE_CXXFLAGS)
1503 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1504 AC_SUBST(WARN_FLAGS)
1508 dnl GLIBCPP_EXPORT_INSTALL_INFO
1509 dnl calculates gxx_install_dir
1510 dnl exports glibcpp_toolexecdir
1511 dnl exports glibcpp_toolexeclibdir
1513 dnl Assumes cross_compiling bits already done, and with_cross_host in
1516 dnl GLIBCPP_EXPORT_INSTALL_INFO
1517 AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
1519 glibcpp_toolexecdir=no
1520 glibcpp_toolexeclibdir=no
1522 AC_MSG_CHECKING([for interface version number])
1523 libstdcxx_interface=$INTERFACE
1524 AC_MSG_RESULT($libstdcxx_interface)
1526 # Process the option --with-gxx-include-dir=<path to include-files directory>
1527 AC_MSG_CHECKING([for --with-gxx-include-dir])
1528 AC_ARG_WITH(gxx-include-dir,
1529 [ --with-gxx-include-dir the installation directory for include files],
1530 [case "${withval}" in
1532 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
1539 gxx_include_dir=${withval}
1541 esac], [gxx_include_dir=no])
1542 AC_MSG_RESULT($gxx_include_dir)
1544 # Process the option "--enable-version-specific-runtime-libs"
1545 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
1546 AC_ARG_ENABLE(version-specific-runtime-libs,
1547 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
1548 [ version_specific_libs=yes
1549 # Need the gcc compiler version to know where to install libraries
1550 # and header files if --enable-version-specific-runtime-libs option
1553 gcc_version_trigger=${srcdir}/../gcc/version.c
1554 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'`
1555 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
1556 gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/g++
1557 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1558 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}
1560 ],version_specific_libs=no)
1561 AC_MSG_RESULT($version_specific_libs)
1563 # Default case for install directory for include files.
1564 if test x"$version_specific_libs" = x"no" \
1565 && test x"$gxx_include_dir"=x"no"; then
1566 gxx_include_dir='$(prefix)'/include/g++-${libstdcxx_interface}
1569 # Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
1570 # Install a library built with a cross compiler in tooldir, not libdir.
1571 if test x"$glibcpp_toolexecdir" = x"no"; then
1572 if test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
1573 glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
1574 glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)'
1576 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1577 glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)'
1581 AC_MSG_CHECKING([for install location])
1582 AC_MSG_RESULT($gxx_include_dir)
1584 AC_SUBST(gxx_include_dir)
1585 AC_SUBST(glibcpp_toolexecdir)
1586 AC_SUBST(glibcpp_toolexeclibdir)
1590 # Check whether LC_MESSAGES is available in <locale.h>.
1591 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1593 # This file file be copied and used freely without restrictions. It can
1594 # be used in projects which are not available under the GNU Public License
1595 # but which still want to provide support for the GNU gettext functionality.
1596 # Please note that the actual code is *not* freely available.
1600 AC_DEFUN(AC_LC_MESSAGES, [
1601 AC_CHECK_HEADER(locale.h, [
1602 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1603 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1604 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1605 if test $ac_cv_val_LC_MESSAGES = yes; then
1606 AC_DEFINE(HAVE_LC_MESSAGES)
1612 # Check for functions in math library.
1613 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1615 # This file can be copied and used freely without restrictions. It can
1616 # be used in projects which are not available under the GNU Public License
1617 # but which still want to provide support for the GNU gettext functionality.
1618 # Please note that the actual code is *not* freely available.
1622 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1623 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1624 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1625 AC_SUBST(LIBMATHOBJS)dnl
1629 # Check for string functions.
1630 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1632 # This file can be copied and used freely without restrictions. It can
1633 # be used in projects which are not available under the GNU Public License
1634 # but which still want to provide support for the GNU gettext functionality.
1635 # Please note that the actual code is *not* freely available.
1639 dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1640 AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1641 [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1642 AC_SUBST(LIBSTRINGOBJS)dnl
1646 dnl This macro searches for a GNU version of make. If a match is found, the
1647 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1648 dnl set to "#". This is useful for including a special features in a Makefile,
1649 dnl which cannot be handled by other versions of make. The variable
1650 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1651 dnl the empty string otherwise.
1653 dnl Here is an example of its use:
1655 dnl Makefile.in might contain:
1657 dnl # A failsafe way of putting a dependency rule into a makefile
1659 dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1661 dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1662 dnl @ifGNUmake@ include $(DEPEND)
1663 dnl @ifGNUmake@ endif
1665 dnl Then configure.in would normally contain:
1667 dnl CHECK_GNU_MAKE()
1668 dnl AC_OUTPUT(Makefile)
1670 dnl Then perhaps to cause gnu make to override any other make, we could do
1671 dnl something like this (note that GNU make always looks for GNUmakefile first):
1673 dnl if ! test x$_cv_gnu_make_command = x ; then
1674 dnl mv Makefile GNUmakefile
1675 dnl echo .DEFAULT: > Makefile ;
1676 dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1679 dnl Then, if any (well almost any) other make is called, and GNU make also
1680 dnl exists, then the other make wraps the GNU make.
1682 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1683 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
1685 dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1686 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1687 dnl #### conditional's subshell (" --version" is not a command), using a
1688 dnl #### different option to grep(1).
1690 dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not
1691 dnl #### ${MAKE:-make}).
1694 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1695 _cv_gnu_make_command='' ;
1696 dnl Search all the common names for GNU make
1697 for a in "${MAKE-make}" make gmake gnumake ; do
1698 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
1700 _cv_gnu_make_command=$a ;
1705 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1706 dnl string, '#' otherwise
1707 if test "x$_cv_gnu_make_command" != "x" ; then
1715 sinclude(../libtool.m4)
1716 dnl The lines below arrange for aclocal not to bring an installed
1717 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1718 dnl add a definition of LIBTOOL to Makefile.in.
1719 ifelse(,,,[AC_SUBST(LIBTOOL)
1720 AC_DEFUN([AM_PROG_LIBTOOL])
1721 AC_DEFUN([AC_LIBTOOL_DLOPEN])
1722 AC_DEFUN([AC_PROG_LD])