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 successfully 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
524 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
525 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
527 dnl Sanity check for existence of ISO C9X headers for extended encoding.
528 AC_CHECK_HEADER(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
529 AC_CHECK_HEADER(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
531 dnl Only continue checking if the ISO C9X headers exist.
532 if test x"$ac_has_wchar_h" = xyes && test x"$ac_has_wctype_h" = xyes; then
534 dnl Test wchar.h for mbstate_t, which is needed for char_traits and others.
535 AC_MSG_CHECKING([for mbstate_t])
536 AC_TRY_COMPILE([#include <wchar.h>],
537 [mbstate_t teststate;],
538 use_native_mbstatet=yes, use_native_mbstatet=no)
539 AC_MSG_RESULT($use_native_mbstatet)
540 if test x"$use_native_mbstatet" = xno; then
541 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
544 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
545 dnl numeric_limits can instantiate type_traits<wchar_t>
546 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
547 AC_TRY_COMPILE([#include <wchar.h>],
548 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
549 has_wchar_minmax=yes, has_wchar_minmax=no)
550 AC_MSG_RESULT($has_wchar_minmax)
552 dnl Test wchar.h for WEOF, which is what we use to determine whether
553 dnl to specialize for char_traits<wchar_t> or not.
554 AC_MSG_CHECKING([for WEOF])
557 #include <stddef.h>],
559 has_weof=yes, has_weof=no)
560 AC_MSG_RESULT($has_weof)
562 dnl Tests for wide character functions used in char_traits<wchar_t>.
563 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset, ac_wfuncs=yes, ac_wfuncs=no)
565 AC_MSG_CHECKING([for ISO C9X wchar_t support])
566 if test x"$has_weof" = xyes && test x"$has_wchar_minmax" = xyes && test x"$ac_wfuncs" = xyes; then
567 ac_isoC9X_wchar_t=yes
571 AC_MSG_RESULT($ac_isoC9X_wchar_t)
573 dnl Use iconv for wchar_t to char conversions. As such, check for
574 dnl X/Open Portability Guide, version 2 features (XPG2).
575 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
576 AC_CHECK_FUNCS(iconv_open iconv_close iconv, ac_XPG2funcs=yes, ac_XPG2funcs=no)
578 AC_MSG_CHECKING([for XPG2 wchar_t support])
579 if test x"$ac_has_iconv_h" = xyes && test x"$ac_XPG2funcs" = xyes; then
584 AC_MSG_RESULT($ac_XPG2_wchar_t)
586 dnl At the moment, only enable wchar_t specializations if all the
587 dnl above support is present.
588 AC_MSG_CHECKING([for enabled wchar_t specializations])
589 if test x"$ac_isoC9X_wchar_t" = xyes && test x"$ac_XPG2_wchar_t" = xyes; then
590 libinst_wstring_la="libinst-wstring.la"
591 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
594 libinst_wstring_la=""
597 AC_SUBST(libinst_wstring_la)
600 AC_MSG_WARN([<wchar.h> not found])
601 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
607 dnl Check to see if this version of GNU C++ is afflicted by bugs in
608 dnl __complex__ float support.
610 dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
612 dnl GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT
613 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT, [
614 AC_REQUIRE([AC_PROG_CXX])
615 AC_MSG_CHECKING([for GNU C++ __complex__ float support])
616 AC_CACHE_VAL(glibcpp_cv_float_complex, [
620 cat > conftest.h <<EOB
622 // Check for buggy __complex__ that causes ICE in most versions of egcs
623 // and gcc-2.95.x on certain platforms (eg., x86-win32).
625 // See http://egcs.cygnus.com/ml/gcc-bugs/1999-07/msg00845.html for
626 // more info on the bug itself.
631 __complex__ float m_value;
632 float_complex (float = 0.0f, float = 0.0f);
633 float_complex (__complex__ float val) : m_value (val) {}
634 float_complex foo (const float_complex &val)
635 { return float_complex (~val.m_value); }
638 AC_TRY_COMPILE([#include "conftest.h"], ,
639 glibcpp_cv_float_complex=ok,
640 glibcpp_cv_float_complex=buggy
644 AC_MSG_RESULT($glibcpp_cv_float_complex)
645 if test $glibcpp_cv_float_complex = buggy; then
646 AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
653 dnl Check to see if this version of GNU C++ is afflicted by bugs in
654 dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
655 dnl gcc-2.95.x when using the library, unless we define the default copy
656 dnl ctor in the specializations of complex<>.
658 dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
660 dnl GLIBCPP_CHECK_COMPLEX_SUPPORT
661 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_SUPPORT, [
662 AC_REQUIRE([AC_PROG_CXX])
663 AC_MSG_CHECKING([for GNU C++ __complex__ support])
664 AC_CACHE_VAL(glibcpp_cv_complex, [
667 AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
668 dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
669 [ dcomplex x; f(x); ],
670 glibcpp_cv_complex=ok,
671 glibcpp_cv_complex=buggy
675 AC_MSG_RESULT($glibcpp_cv_complex)
676 if test $glibcpp_cv_complex = buggy; then
677 AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
683 dnl Check for special debugging mode; not for production use.
685 dnl GLIBCPP_ENABLE_DEBUG
686 dnl --enable-debug sets '-ggdb -O0'.
687 dnl --disable-debug sets '-g' and whatever optimization options the
688 dnl compiler can handle.
689 dnl + Perhaps --enable-maintainer-mode should automatically turn this on?
690 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
691 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
692 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
693 dnl defaults to `no'.
694 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
695 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
697 changequote(<<, >>)dnl
698 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
700 [case "$enableval" in
701 yes) enable_debug=yes ;;
702 no) enable_debug=no ;;
703 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
705 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
706 dnl Option parsed, now set things appropriately
707 case "$enable_debug" in
709 DEBUGFLAGS='-O0 -ggdb'
720 dnl Check for "unusual" flags to pass to the compiler while building.
722 dnl GLIBCPP_ENABLE_CXX_FLAGS
723 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
724 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
725 dnl Somehow this same set of flags must be passed when [re]building
727 dnl --disable-cxx-flags passes nothing.
728 dnl + See http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00131.html
729 dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00284.html
730 dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00035.html
731 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
732 dnl If "default flags" is an empty string (or "none"), the effect is
733 dnl the same as --disable or --enable=no.
734 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
735 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
736 AC_ARG_ENABLE(cxx-flags,
737 changequote(<<, >>)dnl
738 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
739 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
741 [case "x$enableval" in
742 xyes) AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
743 xno|x) enable_cxx_flags='' ;;
744 *) enable_cxx_flags="$enableval" ;;
746 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')dnl
747 dnl Thinko on my part during design. This kludge is the workaround.
748 if test "$enable_cxx_flags" = "none"; then enable_cxx_flags=''; fi
749 dnl Run through flags (either default or command-line) and set anything
750 dnl extra (e.g., #defines) that must accompany particular g++ options.
751 if test -n "$enable_cxx_flags"; then
752 for f in $enable_cxx_flags; do
756 *) # and we're trying to pass /what/ exactly?
757 AC_MSG_ERROR([compiler flags start with a -]) ;;
761 EXTRA_CXX_FLAGS="$enable_cxx_flags"
762 AC_SUBST(EXTRA_CXX_FLAGS)
767 dnl Check for instructions to automatically rebuild libgcc.a. Requires,
768 dnl of course, the location of the gcc objdir. Note that if --disable-
769 dnl namespaces is in effect, rebuilding libgcc.a is an expensive no-op.
771 dnl GLIBCPP_ENABLE_RELIBGCC
772 dnl --enable-libgcc-rebuild=/absolute/path/to/gcc/objdir sets GCC_OBJDIR
773 dnl (presumably in the top-level Makefile) to /absol.../objdir
774 dnl --disable-libgcc-rebuild will not touch libgcc.a at all (maybe print
775 dnl a warning if this is given along with --enable-namespaces), by
776 dnl setting GCC_OBJDIR to `no'.
777 dnl + Doing this by default is going to be interesting. What default
778 dnl "on" value can there be?
779 dnl + Usage: GLIBCPP_ENABLE_RELIBGCC[(DEFAULT)]
780 dnl The default path should be ../.. if bundled with GCC source.
781 dnl If ommitted, it defaults to `no'.
783 AC_DEFUN(GLIBCPP_ENABLE_RELIBGCC, [dnl
784 define([GLIBCPP_ENABLE_RELIBGCC_DEFAULT], ifelse($1,, no, $1))dnl
785 AC_ARG_ENABLE(libgcc-rebuild,
786 changequote(<<, >>)dnl
787 << --enable-libgcc-rebuild=DIR also rebuild libgcc.a; DIR is
788 the GCC objdir; see install.html>>,
790 [case "$enableval" in
791 yes) AC_MSG_ERROR([--enable-libgcc-rebuild needs a pathname]) ;;
792 no) enable_libgcc_rebuild=no ;;
793 *) if test -d "$enableval" && test -d "${enableval}/gcc" && \
794 test -d "${enableval}/libiberty"
796 enable_libgcc_rebuild="$enableval"
798 AC_MSG_ERROR(["$enableval" does not appear to be the GCC objdir])
802 enable_libgcc_rebuild=GLIBCPP_ENABLE_RELIBGCC_DEFAULT)dnl
803 GCC_OBJDIR="$enable_libgcc_rebuild"
809 dnl Check for which I/O library to use: libio, or something specific.
811 dnl GLIBCPP_ENABLE_CSTDIO
812 dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
816 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
817 AC_MSG_CHECKING([for cstdio to use])
818 AC_ARG_ENABLE(cstdio,
819 [ --enable-cstdio enable GNU libio for target io package. (default)
820 --enable-cstdio=LIB use LIB target-speific io package.],
821 if test x$enable_cstdio = xno; then
826 enable_cstdio_flag=$enable_cstdio
828 dnl Check if a valid thread package
829 case x${enable_cstdio_flag} in
830 xlibio | x | xno | xnone | xyes)
832 CSTDIO_H=c_io_libio.h
833 CSTDIO_CC=c_io_libio.cc
836 # see if we are on a system with libio native (ie, linux)
837 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
838 if test $has_libio = "yes"; then
842 BUILD_LIBIO_INCLUDE='-I../libio'
845 AC_SUBST(BUILD_LIBIO_INCLUDE)
847 # see if the _G_config.h header needs to be built.
848 # NB: This replaces the _G_CONFIG_H machinery in libio-v2
849 AC_CHECK_HEADER(_G_config.h, has_gconf_h=yes, has_gconf_h=no)
850 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO_CONFIG_H, test "$has_gconf_h" = no)
853 CSTDIO_H=c_io_wince.h
854 CSTDIO_CC=c_io_wince.cc
859 AC_SUBST(BUILD_LIBIO_INCLUDE)
862 echo "$enable_cstdio is an unknown io package" 1>&2
868 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
873 dnl Check for which threading library to use.
875 dnl GLIBCPP_ENABLE_THREADS
876 dnl --enable-threads=posix sets config/threads-posix.h et. al.
878 dnl default is no threads
880 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
881 dnl Note this comes from the gcc/config.in and libjava/config.in
882 dnl Efforts should be made to keep this in sync.
883 AC_MSG_CHECKING([for threads package to use])
884 AC_ARG_ENABLE(threads,
885 [ --enable-threads enable thread usage for target GCC.
886 --enable-threads=LIB use LIB thread package for target GCC.],
887 if test x$enable_threads = xno; then
892 enable_threads_flag=$enable_threads
894 dnl Check if a valid thread package
895 case x${enable_threads_flag} in
898 target_thread_file='single'
902 target_thread_file=''
904 xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
905 xsolaris | xwin32 | xdce | xvxworks)
906 target_thread_file=$enable_threads_flag
909 echo "$enable_threads is an unknown thread package" 1>&2
914 dnl Check for thread package actually supported in libstdc++
915 case "$target_thread_file" in
926 decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
927 AC_MSG_ERROR(thread package $THREADS not yet supported)
930 AC_MSG_ERROR($THREADS is an unknown thread package)
933 AC_MSG_RESULT($THREADS)
943 AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
946 dnl Not presently used
947 dnl THREADOBJS=threads-posix.lo
948 THREADH=threads-posix.h
951 dnl Not presently used
952 dnl THREADOBJS=threads-no.lo
965 dnl Check for template specializations for the 'long long' type extension.
967 dnl GLIBCPP_ENABLE_LONG_LONG
968 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
969 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
970 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
971 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
972 dnl defaults to `no'.
973 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
975 dnl GLIBCPP_ENABLE_LONG_LONG
976 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
977 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
979 AC_ARG_ENABLE(long-long,
980 changequote(<<, >>)dnl
981 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
983 [case "$enableval" in
984 yes) enable_long_long=yes ;;
985 no) enable_long_long=no ;;
986 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
988 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
990 # Check for the existance of functions used if long long is enabled.
991 AC_CHECK_FUNC(strtoll,,ac_strtoll=no)
992 AC_CHECK_FUNC(strtoull,,ac_strtoull=no)
994 AC_MSG_CHECKING([for enabled long long])
995 if test x"$ac_strtoll" = xno || test x"$ac_strtoull" = xno; then
998 AC_MSG_RESULT($enable_long_long)
1000 dnl Option parsed, now set things appropriately
1001 case "$enable_long_long" in
1002 yes) AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1009 dnl Check for whether or not to do shadowed C headers.
1011 dnl GLIBCPP_ENABLE_SHADOW
1012 dnl --enable-cshadow-headers [does stuff].
1013 dnl --disable-cshadow-headers [does not do stuff].
1014 dnl + This will eventually need to be on by default.
1015 dnl + Usage: GLIBCPP_ENABLE_SHADOW[(DEFAULT)]
1016 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1017 dnl defaults to `no'.
1018 AC_DEFUN(GLIBCPP_ENABLE_SHADOW, [dnl
1019 define([GLIBCPP_ENABLE_SHADOW_DEFAULT], ifelse($1, yes, yes, no))dnl
1020 AC_MSG_CHECKING([for enabled cshadow headers])
1021 AC_ARG_ENABLE(cshadow-headers,
1022 changequote(<<, >>)dnl
1023 << --enable-cshadow-headers construct "shadowed" C header files for
1024 g++ [default=>>GLIBCPP_ENABLE_SHADOW_DEFAULT],
1025 changequote([, ])dnl
1026 [case "$enableval" in
1027 yes) enable_cshadow_headers=yes
1029 no) enable_cshadow_headers=no
1031 *) AC_MSG_ERROR([Unknown argument to enable/disable shadowed C headers])
1034 enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)dnl
1035 AC_MSG_RESULT($enable_cshadow_headers)
1036 dnl Option parsed, now set things appropriately
1037 case "$enable_cshadow_headers" in
1039 CSHADOWFLAGS="-D_ISOC9X_SOURCE"
1040 CSHADOW_INCLUDES=" -I$srcdir/shadow -I$blddir/cshadow"
1048 AC_SUBST(CSHADOWFLAGS)
1049 AC_SUBST(CSHADOW_INCLUDES)
1050 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cshadow_headers" = yes)
1054 # Check whether LC_MESSAGES is available in <locale.h>.
1055 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1057 # This file file be copied and used freely without restrictions. It can
1058 # be used in projects which are not available under the GNU Public License
1059 # but which still want to provide support for the GNU gettext functionality.
1060 # Please note that the actual code is *not* freely available.
1064 AC_DEFUN(AC_LC_MESSAGES,
1065 [if test $ac_cv_header_locale_h = yes; then
1066 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1067 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1068 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1069 if test $ac_cv_val_LC_MESSAGES = yes; then
1070 AC_DEFINE(HAVE_LC_MESSAGES)
1075 # Check for functions in math library.
1076 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1078 # This file can be copied and used freely without restrictions. It can
1079 # be used in projects which are not available under the GNU Public License
1080 # but which still want to provide support for the GNU gettext functionality.
1081 # Please note that the actual code is *not* freely available.
1085 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1086 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1087 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1088 AC_SUBST(LIBMATHOBJS)dnl
1092 # Check for string functions.
1093 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1095 # This file can be copied and used freely without restrictions. It can
1096 # be used in projects which are not available under the GNU Public License
1097 # but which still want to provide support for the GNU gettext functionality.
1098 # Please note that the actual code is *not* freely available.
1102 dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1103 AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1104 [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1105 AC_SUBST(LIBSTRINGOBJS)dnl