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 dnl We may get other options which we dont document:
18 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
19 if test "[$]{srcdir}" = "."; then
20 if test "[$]{with_target_subdir}" != "."; then
21 glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
23 glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
26 glibcpp_basedir="[$]{srcdir}/$1"
28 AC_SUBST(glibcpp_basedir)
32 AM_INIT_AUTOMAKE(libstdc++, 2.90.8)
34 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
35 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
36 # are probably using a cross compiler, which will not be able to fully
37 # link an executable. This should really be fixed in autoconf
40 AC_DEFUN(LIB_AC_PROG_CC,
41 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
42 dnl Fool anybody using AC_PROG_CC.
43 AC_PROVIDE([AC_PROG_CC])
44 AC_CHECK_PROG(CC, gcc, gcc)
45 if test -z "$CC"; then
46 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
47 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
52 if test $ac_cv_prog_gcc = yes; then
54 dnl Check whether -g works, even if CFLAGS is set, in case the package
55 dnl plays around with CFLAGS (such as to build both debugging and
56 dnl normal versions of a library), tasteless as that idea is.
57 ac_test_CFLAGS="${CFLAGS+set}"
58 ac_save_CFLAGS="$CFLAGS"
61 if test "$ac_test_CFLAGS" = set; then
62 CFLAGS="$ac_save_CFLAGS"
63 elif test $ac_cv_prog_cc_g = yes; then
70 test "${CFLAGS+set}" = set || CFLAGS="-g"
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 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
82 test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
86 if test $ac_cv_prog_gxx = yes; then
88 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
89 dnl plays around with CXXFLAGS (such as to build both debugging and
90 dnl normal versions of a library), tasteless as that idea is.
91 ac_test_CXXFLAGS="${CXXFLAGS+set}"
92 ac_save_CXXFLAGS="$CXXFLAGS"
95 if test "$ac_test_CXXFLAGS" = set; then
96 CXXFLAGS="$ac_save_CXXFLAGS"
97 elif test $ac_cv_prog_cxx_g = yes; then
104 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
110 # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD). If we dont
111 # run it explicitly here, it will be run implicitly before
112 # LIBGCJ_CONFIGURE, which doesn't work because that means that it will
113 # be run before AC_CANONICAL_HOST.
116 AC_CHECK_TOOL(AS, as)
117 AC_CHECK_TOOL(AR, ar)
118 AC_CHECK_TOOL(RANLIB, ranlib, :)
124 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
125 # at least currently, we never actually build a program, so we never
126 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
127 # fails, because we are probably configuring with a cross compiler
128 # which cant create executables. So we include AC_EXEEXT to keep
129 # automake happy, but we dont execute it, since we dont care about
135 # configure.host sets the following important variables
136 # glibcpp_cflags - host specific C compiler flags
137 # 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 GLIBCPP_CFLAGS="[$]{glibcpp_cflags}"
150 GLIBCPP_CXXFLAGS="[$]{glibcpp_cxxflags}"
151 AC_SUBST(GLIBCPP_CFLAGS)
152 AC_SUBST(GLIBCPP_CXXFLAGS)
157 dnl Check to see if g++ can compile this library, and if so, if any version-
158 dnl specific precautions need to be taken. In particular, test for
159 dnl newer compiler features, or features that are present in newer
160 dnl compiler version but not older compiler versions should be placed
163 dnl Define FMTFLAGS='-fdiagnostics-show-location=once' if possible
164 dnl Define WERROR='-Werror' if possible; g++'s that lack the new inlining
165 dnl code or the new system_header pragma will die. Other options dealing
166 dnl with warnings, errors, and compiler complaints may be folded into
167 dnl the WERROR variable.
169 dnl GLIBCPP_CHECK_COMPILER_VERSION
170 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
171 # All these tests are for C++; save the language and the compiler flags.
172 # The CXXFLAGS thing is suspicious, but based on similar bits
173 # found in GLIBCPP_CONFIGURE.
176 ac_test_CXXFLAGS="${CXXFLAGS+set}"
177 ac_save_CXXFLAGS="$CXXFLAGS"
180 # Sanity check that g++ is capable of dealing with v-3.
181 AC_MSG_CHECKING([for g++ that will successfullly compile this code])
183 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
186 ], gpp_satisfactory=yes, AC_MSG_ERROR("please upgrade to gcc-2.95 or above"))
187 AC_MSG_RESULT($gpp_satisfactory)
189 # Check for pragma system_header.
190 AC_MSG_CHECKING([for g++ that supports pragma system_header])
191 CXXFLAGS='-Wunknown-pragmas -Werror'
192 AC_TRY_COMPILE([#pragma system_header], [int foo;
193 ], [ac_newpragma=yes], [ac_newpragma=no])
194 if test "$ac_test_CXXFLAGS" = set; then
195 CXXFLAGS="$ac_save_CXXFLAGS"
197 # this is the suspicious part
200 if test "$ac_newpragma" = "no"; then
201 WERROR="$WERROR -Wno-unknown-pragmas"
203 AC_MSG_RESULT($ac_newpragma)
205 # Check for more sophisticated diagnostic control.
206 AC_MSG_CHECKING([for g++ that supports -fdiagnostics-show-location=once])
207 CXXFLAGS='-fdiagnostics-show-location=once'
208 AC_TRY_COMPILE(, [int foo;
209 ], [ac_gabydiags=yes], [ac_gabydiags=no])
210 if test "$ac_test_CXXFLAGS" = set; then
211 CXXFLAGS="$ac_save_CXXFLAGS"
213 # this is the suspicious part
216 if test "$ac_gabydiags" = "yes"; then
217 FMTFLAGS='-fdiagnostics-show-location=once'
219 AC_MSG_RESULT($ac_gabydiags)
228 dnl Check to see what builtin math functions are supported
230 dnl Define _GLIBCPP_HAS_BUILTIN_SINF if __builtin_sinf
231 dnl Define _GLIBCPP_HAS_BUILTIN_COSF if __builtin_cosf
232 dnl Define _GLIBCPP_HAS_BUILTIN_FABSF if __builtin_fabsf
233 dnl Define _GLIBCPP_HAS_BUILTIN_SQRTF if __builtin_sqrtf
235 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
236 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
237 dnl Test for builtin math functions.
238 AC_MSG_CHECKING([for __builtin_sinf])
239 AC_TRY_COMPILE([#include <math.h>],
240 [float foo(void) { __builtin_sinf(0.0); }],
241 use_builtin_sinf=yes, use_builtin_sinf=no)
242 AC_MSG_RESULT($use_builtin_sinf)
243 if test $use_builtin_sinf = "yes"; then
244 AC_DEFINE(_GLIBCPP_HAS_BUILTIN_SINF)
247 AC_MSG_CHECKING([for __builtin_cosf])
248 AC_TRY_COMPILE([#include <math.h>],
249 [float foo(void) { __builtin_cosf(0.0); }],
250 use_builtin_cosf=yes, use_builtin_cosf=no)
251 AC_MSG_RESULT($use_builtin_cosf)
252 if test $use_builtin_cosf = "yes"; then
253 AC_DEFINE(_GLIBCPP_HAS_BUILTIN_COSF)
256 AC_MSG_CHECKING([for __builtin_fabsf])
257 AC_TRY_COMPILE([#include <math.h>],
258 [float foo(void) { __builtin_fabsf(0.0); }],
259 use_builtin_fabsf=yes, use_builtin_fabsf=no)
260 AC_MSG_RESULT($use_builtin_fabsf)
261 if test $use_builtin_fabsf = "yes"; then
262 AC_DEFINE(_GLIBCPP_HAS_BUILTIN_FABSF)
265 AC_MSG_CHECKING([for __builtin_sqrtf])
266 AC_TRY_COMPILE([#include <math.h>],
267 [float foo(void) { __builtin_sqrtf(0.0); }],
268 use_builtin_sqrtf=yes, use_builtin_sqrtf=no)
269 AC_MSG_RESULT($use_builtin_sqrtf)
270 if test $use_builtin_sqrtf = "yes"; then
271 AC_DEFINE(_GLIBCPP_HAS_BUILTIN_SQRTF)
276 dnl Check to see what architecture we are compiling for. If it's
277 dnl supported, use special hand-crafted routines to provide thread
278 dnl primitives. Also, if architecture-specific flags are required for
279 dnl compilation, add them here.
281 dnl Depending on what is found, select configure/cpu/*/bits/atomicity.h
282 dnl If not found, select configure/cpu/generic/bits/atomicity.h
284 dnl GLIBCPP_CHECK_CPU
285 AC_DEFUN(GLIBCPP_CHECK_CPU, [
286 AC_MSG_CHECKING([for cpu primitives directory])
288 case "$target_cpu" in
290 cpu_include_dir="config/cpu/alpha"
293 cpu_include_dir="config/cpu/arm"
296 cpu_include_dir="config/cpu/i386"
298 i486 | i586 | i686 | i786)
299 cpu_include_dir="config/cpu/i486"
302 cpu_include_dir="config/cpu/powerpc"
303 CPUFLAGS='-mcpu=powerpc'
305 sparc64 | ultrasparc)
306 cpu_include_dir="config/cpu/sparc/sparc64"
309 cpu_include_dir="config/cpu/sparc/sparc32"
312 cpu_include_dir="config/cpu/generic"
315 AC_MSG_RESULT($cpu_include_dir)
316 AC_SUBST(cpu_include_dir)
322 dnl Check to see what the underlying c library's interface to ctype looks
323 dnl like. Bits of locale rely on things like isspace, toupper, etc. This
324 dnl stuff makes sure the right bits from the clibrary get called.
326 dnl Depending on what is found, select various configure/*/bits/ctype_base.h
327 dnl Depending on what is found, select various configure/*/ctype.cc
329 dnl GLIBCPP_CHECK_CTYPE
330 AC_DEFUN(GLIBCPP_CHECK_CTYPE, [
331 AC_CHECK_HEADER(ctype.h, [
333 dnl If doesn't match any specified, go with defaults.
336 dnl Test for <ctype> functionality -- gnu-linux
337 AC_MSG_CHECKING([<ctype> for gnu-linux ])
338 AC_TRY_COMPILE([#include <ctype.h>],
341 { return _ISspace + _ISprint + _IScntrl + _ISupper + _ISlower + _ISalpha \
342 + _ISdigit + _ISpunct + _ISxdigit + _ISalnum + _ISgraph \
343 + __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];}], \
344 ctype_linux=yes, ctype_linux=no)
345 AC_MSG_RESULT($ctype_linux)
346 if test $ctype_linux = "yes"; then
347 ctype_include_dir="config/gnu-linux"
351 dnl Test for <ctype> functionality -- FreeBSD 4.0
352 if test $ctype_default = "yes"; then
353 AC_MSG_CHECKING([<ctype> for freebsd 4.0 ])
354 AC_TRY_COMPILE([#include <ctype.h>],
357 { return _CTYPE_S + _CTYPE_R + _CTYPE_C + _CTYPE_U + _CTYPE_L + _CTYPE_A \
358 + _CTYPE_D + _CTYPE_P + _CTYPE_X + _CTYPE_G ;}], \
359 ctype_bsd=yes, ctype_bsd=no)
360 AC_MSG_RESULT($ctype_bsd)
361 if test $ctype_bsd = "yes"; then
362 ctype_include_dir="config/bsd"
367 dnl Test for <ctype> functionality -- FreeBSD 3.4
368 if test $ctype_default = "yes"; then
369 AC_MSG_CHECKING([<ctype> for freebsd 3.4 ])
370 AC_TRY_COMPILE([#include <ctype.h>],
373 { return _S + _R + _C + _U + _L + _A \
374 + _D + _P + _X + _G + __istype (a, 0);}], \
375 ctype_freebsd34=yes, ctype_freebsd34=no)
376 AC_MSG_RESULT($ctype_freebsd34)
377 if test $ctype_freebsd34 = "yes"; then
378 ctype_include_dir="config/bsd"
383 dnl Test for <ctype> functionality -- solaris 2.6 and 2.7
384 if test $ctype_default = "yes"; then
385 AC_MSG_CHECKING([<ctype> for solaris 2.[6,7,8] ])
386 AC_TRY_COMPILE([#include <ctype.h>],
389 { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
390 + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
391 + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}], \
392 ctype_solaris=yes, ctype_solaris=no)
393 AC_MSG_RESULT($ctype_solaris)
395 if test $ctype_solaris = "yes"; then
396 AC_MSG_CHECKING([ for version])
398 AC_TRY_COMPILE([#include <ctype.h>],
399 [typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;],\
400 ctype_solaris26=yes, ctype_solaris26=no)
402 if test $ctype_solaris26 = "yes"; then
403 ctype_include_dir="config/solaris/solaris2.6"
404 AC_MSG_RESULT("solaris2.6")
407 ctype_include_dir="config/solaris/solaris2.7"
408 AC_MSG_RESULT("solaris2.[7,8]")
414 dnl Test for <ctype> functionality -- solaris 2.5.1
415 if test $ctype_default = "yes"; then
416 AC_MSG_CHECKING([<ctype> for solaris 2.5.1 ])
417 AC_TRY_COMPILE([#include <ctype.h>],
420 { return _U + _L + _N + _S + _P + _C + _X + _B \
422 ctype_solaris25=yes, ctype_solaris25=no)
423 AC_MSG_RESULT($ctype_solaris25)
424 if test $ctype_solaris25 = "yes"; then
425 ctype_include_dir="config/solaris/solaris2.5"
430 dnl Test for <ctype> functionality -- aix
431 if test $ctype_default = "yes"; then
432 AC_MSG_CHECKING([<ctype> for aix ])
433 AC_TRY_COMPILE([#include <ctype.h>],
436 { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
437 + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
438 + _VALC('a') + _IS('c', 0);}], \
439 ctype_aix=yes, ctype_aix=no)
440 AC_MSG_RESULT($ctype_aix)
441 if test $ctype_aix = "yes"; then
442 ctype_include_dir="config/aix"
447 dnl Test for <ctype> functionality -- newlib
448 if test $ctype_default = "yes"; then
449 AC_MSG_CHECKING([<ctype> for newlib ])
450 AC_TRY_COMPILE([#include <ctype.h>],
453 { return _U + _L + _N + _S + _P + _C + _X + _B \
455 ctype_newlib=yes, ctype_newlib=no)
456 AC_MSG_RESULT($ctype_newlib)
457 if test $ctype_newlib = "yes"; then
458 ctype_include_dir="config/newlib"
463 if test $ctype_default = "yes"; then
464 ctype_include_dir="config/generic"
465 AC_MSG_WARN("Using default ctype headers.")
467 AC_SUBST(ctype_include_dir)
473 dnl Check to see what the underlying c library or math library is like.
475 dnl Define HAVE_CARGF etc if "cargf" is found.
477 dnl GLIBCPP_CHECK_MATH_SUPPORT
478 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
479 AC_CHECK_LIB(m, sin, libm="-lm")
483 dnl Check for complex versions of math functions of platform.
484 AC_CHECK_HEADERS([complex.h])
485 AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf c_log c_logf \
486 clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt csqrtf \
487 ctan ctanf ctanh ctanhf \
488 carg cargf nan hypot hypotf atan2f expf copysignf)
490 dnl We compile the long double complex functions only if the function
491 dnl provides the non-complex long double functions.
493 AC_CHECK_FUNC(copysignl,
495 AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl cpowl csinhl csinl \
496 csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l))
497 AC_SUBST(USE_LONG_DOUBLE)
499 dnl Check to see if basic C math functions have faster float versions.
500 AC_CHECK_FUNCS(modf isnan isnanf isnanl isinf isinff isinfl copysign \
501 copysignl cosf coshf logf log10f powf sinf sinhf sqrtf tanf tanhf \
502 strtof strtold fabsf sincos sincosf sincosl finite finite fqfinite \
505 #Some runtimes have these functions with a preceding underscore. Please
506 # keep this sync'd with the one above. And if you add any new symbol,
507 # please add the corresponding block in the @BOTTOM@ section of
509 AC_CHECK_FUNCS(_modf _isnan _isnanf _isnanl _isinf _isinff _isinfl _copysign \
510 _copysignl _cosf _coshf _logf _log10f _powf _sinf _sinhf _sqrtf _tanf _tanhf \
511 _strtof _strtold _fabsf _sincos _sincosf _sincosl _finite _finitef _qfinite \
519 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
521 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
522 dnl Define _GLIBCPP_NEED_MBSTATE_T if mbstate_t is not in wchar.h
523 dnl Define _GLIBCPP_HAS_WCHAR_MIN_MAX if WCHAR_MIN, WCHAR_MAX in wchar.h
525 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
526 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
527 AC_CHECK_HEADER(wchar.h,[
528 dnl Test wchar.h for mbstate_t, which is needed for char_traits and others.
529 AC_MSG_CHECKING([for native mbstate_t])
530 AC_TRY_COMPILE([#include <wchar.h>],
531 [mbstate_t teststate;],
532 use_native_mbstatet=yes, use_native_mbstatet=no)
533 AC_MSG_RESULT($use_native_mbstatet)
534 if test $use_native_mbstatet = "no"; then
535 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
538 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
539 dnl numeric_limits can instantiate type_traits<wchar_t>
540 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
541 AC_TRY_COMPILE([#include <wchar.h>],
542 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
543 has_wchar_minmax=yes, has_wchar_minmax=no)
544 AC_MSG_RESULT($has_wchar_minmax)
545 if test $has_wchar_minmax = "yes"; then
546 AC_DEFINE(_GLIBCPP_HAS_WCHAR_MIN_MAX)
549 # Test wchar.h for WEOF, which is what we use to determine whether
550 # to specialize for wchar_t or not.
551 AC_MSG_CHECKING([for WEOF])
554 #include <stddef.h>],
556 has_weof=yes, has_weof=no)
557 AC_MSG_RESULT($has_weof)
559 dnl Tests for wide character functions.
560 AC_REPLACE_STRINGFUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset)
561 AC_SUBST(libinst_wstring_la)
563 AC_MSG_CHECKING([for wide character support])
564 if test $has_weof = "yes" && test $has_wchar_minmax = "yes"; then
565 libinst_wstring_la="libinst-wstring.la"
566 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
569 libinst_wstring_la=""
570 AC_MSG_RESULT("not specializing for wchar_t")
573 AC_MSG_WARN([<wchar.h> not found])
574 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
580 dnl Check to see if this version of GNU C++ is afflicted by bugs in
581 dnl __complex__ float support.
583 dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
585 dnl GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT
586 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT, [
587 AC_REQUIRE([AC_PROG_CXX])
588 AC_MSG_CHECKING([for GNU C++ __complex__ float support])
589 AC_CACHE_VAL(glibcpp_cv_float_complex, [
593 cat > conftest.h <<EOB
595 // Check for buggy __complex__ that causes ICE in most versions of egcs
596 // and gcc-2.95.x on certain platforms (eg., x86-win32).
598 // See http://egcs.cygnus.com/ml/gcc-bugs/1999-07/msg00845.html for
599 // more info on the bug itself.
604 __complex__ float m_value;
605 float_complex (float = 0.0f, float = 0.0f);
606 float_complex (__complex__ float val) : m_value (val) {}
607 float_complex foo (const float_complex &val)
608 { return float_complex (~val.m_value); }
611 AC_TRY_COMPILE([#include "conftest.h"], ,
612 glibcpp_cv_float_complex=ok,
613 glibcpp_cv_float_complex=buggy
617 AC_MSG_RESULT($glibcpp_cv_float_complex)
618 if test $glibcpp_cv_float_complex = buggy; then
619 AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
626 dnl Check to see if this version of GNU C++ is afflicted by bugs in
627 dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
628 dnl gcc-2.95.x when using the library, unless we define the default copy
629 dnl ctor in the specializations of complex<>.
631 dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
633 dnl GLIBCPP_CHECK_COMPLEX_SUPPORT
634 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_SUPPORT, [
635 AC_REQUIRE([AC_PROG_CXX])
636 AC_MSG_CHECKING([for GNU C++ __complex__ support])
637 AC_CACHE_VAL(glibcpp_cv_complex, [
640 AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
641 dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
642 [ dcomplex x; f(x); ],
643 glibcpp_cv_complex=ok,
644 glibcpp_cv_complex=buggy
648 AC_MSG_RESULT($glibcpp_cv_complex)
649 if test $glibcpp_cv_complex = buggy; then
650 AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
656 dnl Check for special debugging mode; not for production use.
658 dnl GLIBCPP_ENABLE_DEBUG
659 dnl --enable-debug sets '-ggdb -O0'.
660 dnl --disable-debug sets '-g' and whatever optimization options the
661 dnl compiler can handle.
662 dnl + Perhaps --enable-maintainer-mode should automatically turn this on?
663 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
664 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
665 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
666 dnl defaults to `no'.
667 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
668 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
670 changequote(<<, >>)dnl
671 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
673 [case "$enableval" in
674 yes) enable_debug=yes ;;
675 no) enable_debug=no ;;
676 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
678 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
679 dnl Option parsed, now set things appropriately
680 case "$enable_debug" in
682 DEBUGFLAGS='-O0 -ggdb'
693 dnl Check for "unusual" flags to pass to the compiler while building.
695 dnl GLIBCPP_ENABLE_CXX_FLAGS
696 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
697 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
698 dnl Somehow this same set of flags must be passed when [re]building
700 dnl --disable-cxx-flags passes nothing.
701 dnl + See http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00131.html
702 dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00284.html
703 dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00035.html
704 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
705 dnl If "default flags" is an empty string (or "none"), the effect is
706 dnl the same as --disable or --enable=no.
707 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
708 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
709 AC_ARG_ENABLE(cxx-flags,
710 changequote(<<, >>)dnl
711 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
712 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
714 [case "x$enableval" in
715 xyes) AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
716 xno|x) enable_cxx_flags='' ;;
717 *) enable_cxx_flags="$enableval" ;;
719 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')dnl
720 dnl Thinko on my part during design. This kludge is the workaround.
721 if test "$enable_cxx_flags" = "none"; then enable_cxx_flags=''; fi
722 dnl Run through flags (either default or command-line) and set anything
723 dnl extra (e.g., #defines) that must accompany particular g++ options.
724 if test -n "$enable_cxx_flags"; then
725 for f in $enable_cxx_flags; do
729 *) # and we're trying to pass /what/ exactly?
730 AC_MSG_ERROR([compiler flags start with a -]) ;;
734 EXTRA_CXX_FLAGS="$enable_cxx_flags"
735 AC_SUBST(EXTRA_CXX_FLAGS)
740 dnl Check for instructions to automatically rebuild libgcc.a. Requires,
741 dnl of course, the location of the gcc objdir. Note that if --disable-
742 dnl namespaces is in effect, rebuilding libgcc.a is an expensive no-op.
744 dnl GLIBCPP_ENABLE_RELIBGCC
745 dnl --enable-libgcc-rebuild=/absolute/path/to/gcc/objdir sets GCC_OBJDIR
746 dnl (presumably in the top-level Makefile) to /absol.../objdir
747 dnl --disable-libgcc-rebuild will not touch libgcc.a at all (maybe print
748 dnl a warning if this is given along with --enable-namespaces), by
749 dnl setting GCC_OBJDIR to `no'.
750 dnl + Doing this by default is going to be interesting. What default
751 dnl "on" value can there be?
752 dnl + Usage: GLIBCPP_ENABLE_RELIBGCC[(DEFAULT)]
753 dnl The default path should be ../.. if bundled with GCC source.
754 dnl If ommitted, it defaults to `no'.
756 AC_DEFUN(GLIBCPP_ENABLE_RELIBGCC, [dnl
757 define([GLIBCPP_ENABLE_RELIBGCC_DEFAULT], ifelse($1,, no, $1))dnl
758 AC_ARG_ENABLE(libgcc-rebuild,
759 changequote(<<, >>)dnl
760 << --enable-libgcc-rebuild=DIR also rebuild libgcc.a; DIR is
761 the GCC objdir; see install.html>>,
763 [case "$enableval" in
764 yes) AC_MSG_ERROR([--enable-libgcc-rebuild needs a pathname]) ;;
765 no) enable_libgcc_rebuild=no ;;
766 *) if test -d "$enableval" && test -d "${enableval}/gcc" && \
767 test -d "${enableval}/libiberty"
769 enable_libgcc_rebuild="$enableval"
771 AC_MSG_ERROR(["$enableval" does not appear to be the GCC objdir])
775 enable_libgcc_rebuild=GLIBCPP_ENABLE_RELIBGCC_DEFAULT)dnl
776 GCC_OBJDIR="$enable_libgcc_rebuild"
782 dnl Check for which I/O library to use: libio, or something specific.
784 dnl GLIBCPP_ENABLE_CSTDIO
785 dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
789 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
790 AC_MSG_CHECKING([for cstdio to use])
791 AC_ARG_ENABLE(cstdio,
792 [ --enable-cstdio enable GNU libio for target io package. (default)
793 --enable-cstdio=LIB use LIB target-speific io package.],
794 if test x$enable_cstdio = xno; then
799 enable_cstdio_flag=$enable_cstdio
801 dnl Check if a valid thread package
802 case x${enable_cstdio_flag} in
803 xlibio | x | xno | xnone | xyes)
805 CSTDIO_H=c_io_libio.h
806 CSTDIO_CC=c_io_libio.cc
809 # see if we are on a system with libio native (ie, linux)
810 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
811 if test $has_libio = "yes"; then
815 BUILD_LIBIO_INCLUDE='-I../libio'
818 AC_SUBST(BUILD_LIBIO_INCLUDE)
820 # see if the _G_config.h header needs to be built.
821 # NB: This replaces the _G_CONFIG_H machinery in libio-v2
822 AC_CHECK_HEADER(_G_config.h, has_gconf_h=yes, has_gconf_h=no)
823 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO_CONFIG_H, test "$has_gconf_h" = no)
826 CSTDIO_H=c_io_wince.h
827 CSTDIO_CC=c_io_wince.cc
832 AC_SUBST(BUILD_LIBIO_INCLUDE)
835 echo "$enable_cstdio is an unknown io package" 1>&2
841 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
846 dnl Check for which threading library to use.
848 dnl GLIBCPP_ENABLE_THREADS
849 dnl --enable-threads=posix sets config/threads-posix.h et. al.
851 dnl default is no threads
853 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
854 dnl Note this comes from the gcc/config.in and libjava/config.in
855 dnl Efforts should be made to keep this in sync.
856 AC_MSG_CHECKING([for threads package to use])
857 AC_ARG_ENABLE(threads,
858 [ --enable-threads enable thread usage for target GCC.
859 --enable-threads=LIB use LIB thread package for target GCC.],
860 if test x$enable_threads = xno; then
865 enable_threads_flag=$enable_threads
867 dnl Check if a valid thread package
868 case x${enable_threads_flag} in
871 target_thread_file='single'
875 target_thread_file=''
877 xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
878 xsolaris | xwin32 | xdce | xvxworks)
879 target_thread_file=$enable_threads_flag
882 echo "$enable_threads is an unknown thread package" 1>&2
887 dnl Check for thread package actually supported in libstdc++
888 case "$target_thread_file" in
899 decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
900 AC_MSG_ERROR(thread package $THREADS not yet supported)
903 AC_MSG_ERROR($THREADS is an unknown thread package)
906 AC_MSG_RESULT($THREADS)
916 AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
919 dnl Not presently used
920 dnl THREADOBJS=threads-posix.lo
921 THREADH=threads-posix.h
924 dnl Not presently used
925 dnl THREADOBJS=threads-no.lo
938 dnl Check for template specializations for the 'long long' type extension.
940 dnl GLIBCPP_ENABLE_LONG_LONG
941 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
942 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
943 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
944 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
945 dnl defaults to `no'.
947 dnl GLIBCPP_ENABLE_LONG_LONG
948 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
949 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
950 AC_MSG_CHECKING([for enabled long long])
951 AC_ARG_ENABLE(long-long,
952 changequote(<<, >>)dnl
953 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
955 [case "$enableval" in
956 yes) enable_long_long=yes ;;
957 no) enable_long_long=no ;;
958 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
960 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
961 AC_MSG_RESULT($enable_long_long)
962 dnl Option parsed, now set things appropriately
963 case "$enable_long_long" in
964 yes) AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
971 dnl Check for whether or not to do shadowed C headers.
973 dnl GLIBCPP_ENABLE_SHADOW
974 dnl --enable-cshadow-headers [does stuff].
975 dnl --disable-cshadow-headers [does not do stuff].
976 dnl + This will eventually need to be on by default.
977 dnl + Usage: GLIBCPP_ENABLE_SHADOW[(DEFAULT)]
978 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
979 dnl defaults to `no'.
980 AC_DEFUN(GLIBCPP_ENABLE_SHADOW, [dnl
981 define([GLIBCPP_ENABLE_SHADOW_DEFAULT], ifelse($1, yes, yes, no))dnl
982 AC_MSG_CHECKING([for enabled cshadow headers])
983 AC_ARG_ENABLE(cshadow-headers,
984 changequote(<<, >>)dnl
985 << --enable-cshadow-headers construct "shadowed" C header files for
986 g++ [default=>>GLIBCPP_ENABLE_SHADOW_DEFAULT],
988 [case "$enableval" in
989 yes) enable_cshadow_headers=yes
991 no) enable_cshadow_headers=no
993 *) AC_MSG_ERROR([Unknown argument to enable/disable shadowed C headers])
996 enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)dnl
997 AC_MSG_RESULT($enable_cshadow_headers)
998 dnl Option parsed, now set things appropriately
999 case "$enable_cshadow_headers" in
1001 SHADOW_INCLUDES="-I$srcdir/shadow -I$blddir/cshadow"
1002 $srcdir/inclosure "-I $blddir/../../gcc/include/ -I /usr/include/ -G machine/ansi.h" | $srcdir/mkcshadow
1008 # SHADOW_INCLUDES is currently not used anywhere in the source
1009 AC_SUBST(SHADOW_INCLUDES)
1013 # Check whether LC_MESSAGES is available in <locale.h>.
1014 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1016 # This file file be copied and used freely without restrictions. It can
1017 # be used in projects which are not available under the GNU Public License
1018 # but which still want to provide support for the GNU gettext functionality.
1019 # Please note that the actual code is *not* freely available.
1023 AC_DEFUN(AC_LC_MESSAGES,
1024 [if test $ac_cv_header_locale_h = yes; then
1025 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1026 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1027 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1028 if test $ac_cv_val_LC_MESSAGES = yes; then
1029 AC_DEFINE(HAVE_LC_MESSAGES)
1034 # Check for functions in math library.
1035 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1037 # This file can be copied and used freely without restrictions. It can
1038 # be used in projects which are not available under the GNU Public License
1039 # but which still want to provide support for the GNU gettext functionality.
1040 # Please note that the actual code is *not* freely available.
1044 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1045 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1046 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1047 AC_SUBST(LIBMATHOBJS)dnl
1051 # Check for string functions.
1052 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1054 # This file can be copied and used freely without restrictions. It can
1055 # be used in projects which are not available under the GNU Public License
1056 # but which still want to provide support for the GNU gettext functionality.
1057 # Please note that the actual code is *not* freely available.
1061 dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1062 AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1063 [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1064 AC_SUBST(LIBSTRINGOBJS)dnl