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.
160 dnl GLIBCPP_CHECK_COMPILER_VERSION
161 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
162 # Sanity check that g++ is capable of dealing with v-3.
163 AC_MSG_CHECKING([for g++ that will successfully compile this code])
165 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
168 ], gpp_satisfactory=yes, AC_MSG_ERROR("please upgrade to gcc-2.95 or above"))
169 AC_MSG_RESULT($gpp_satisfactory)
174 dnl Test for newer compiler features, or features that are present in newer
175 dnl compiler version but not older compiler versions should be placed
178 dnl Define WFMT_FLAGS='-fdiagnostics-show-location=once' if possible
180 dnl Define WERROR='-Werror' if possible; g++'s that lack the new inlining
181 dnl code or the new system_header pragma will die.
183 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
184 dnl compiler supports it.
185 dnl GLIBCPP_CHECK_COMPILER_FEATURES
186 AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
187 # All these tests are for C++; save the language and the compiler flags.
188 # The CXXFLAGS thing is suspicious, but based on similar bits
189 # found in GLIBCPP_CONFIGURE.
192 ac_test_CXXFLAGS="${CXXFLAGS+set}"
193 ac_save_CXXFLAGS="$CXXFLAGS"
196 # Check for pragma system_header.
197 AC_MSG_CHECKING([for g++ that supports pragma system_header])
198 CXXFLAGS='-Wunknown-pragmas -Werror'
199 AC_TRY_COMPILE([#pragma system_header], [int foo;
200 ], [ac_newpragma=yes], [ac_newpragma=no])
201 if test "$ac_test_CXXFLAGS" = set; then
202 CXXFLAGS="$ac_save_CXXFLAGS"
204 # this is the suspicious part
207 if test "$ac_newpragma" = "no"; then
208 WERROR="$WERROR -Wno-unknown-pragmas"
210 AC_MSG_RESULT($ac_newpragma)
212 # Check for more sophisticated diagnostic control.
213 AC_MSG_CHECKING([for g++ that supports -fdiagnostics-show-location=once])
214 CXXFLAGS='-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 "$ac_gabydiags" = "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='-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 "$ac_fdsections" = "yes"; then
240 SECTION_FLAGS='-ffunction-sections -fdata-sections'
242 AC_MSG_RESULT($ac_fdsections)
247 AC_SUBST(SECTION_FLAGS)
252 dnl Check to see if tricky linker opts can be used.
254 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible
255 dnl GLIBCPP_CHECK_LINKER_FEATURES
256 AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
257 # All these tests are for C++; save the language and the compiler flags.
258 # Need to do this so that g++ won't try to link in libstdc++
259 ac_test_CFLAGS="${CFLAGS+set}"
260 ac_save_CFLAGS="$CFLAGS"
261 CFLAGS='-x c++ -Wl,--gc-sections'
263 # Check for -Wl,--gc-sections
264 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
272 ], [ac_sectionLDflags=yes], [ac_sectionLFflags=no], [ac_sectionLDflags=yes])
273 if test "$ac_test_CFLAGS" = set; then
274 CFLAGS="$ac_save_CFLAGS"
276 # this is the suspicious part
279 if test "$ac_sectionLDflags" = "yes"; then
280 SECTION_LDFLAGS='-Wl,--gc-sections'
282 AC_MSG_RESULT($ac_sectionLDflags)
284 AC_SUBST(SECTION_LDFLAGS)
289 dnl Check to see if the (math function) argument passed is
290 dnl 1) declared when using the c++ compiler
291 dnl 2) has "C" linkage
293 dnl Define HAVE_CARGF etc if "cargf" is declared and links
295 dnl argument 1 is name of function to check
297 dnl ASSUMES argument is a math function with ONE parameter
299 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
300 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
303 AC_MSG_CHECKING([for $1 declaration])
304 AC_TRY_COMPILE([#include <math.h>],
306 [use_$1=yes], [use_$1=no])
307 AC_MSG_RESULT($use_$1)
309 if test x$use_$1 = x"yes"; then
316 dnl Check to see if the (math function) argument passed is
317 dnl 1) declared when using the c++ compiler
318 dnl 2) has "C" linkage
320 dnl Define HAVE_CARGF etc if "cargf" is declared and links
322 dnl argument 1 is name of function to check
324 dnl ASSUMES argument is a math function with TWO parameters
326 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
327 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
330 AC_MSG_CHECKING([for $1 declaration])
331 AC_TRY_COMPILE([#include <math.h>],
333 [use_$1=yes], [use_$1=no])
334 AC_MSG_RESULT($use_$1)
336 if test x$use_$1 = x"yes"; then
343 dnl Check to see if the (math function) argument passed is
344 dnl 1) declared when using the c++ compiler
345 dnl 2) has "C" linkage
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 THREE parameters
353 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
354 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
357 AC_MSG_CHECKING([for $1 declaration])
358 AC_TRY_COMPILE([#include <math.h>],
360 [use_$1=yes], [use_$1=no])
361 AC_MSG_RESULT($use_$1)
363 if test x$use_$1 = x"yes"; then
370 dnl Because the builtins are picky picky picky about the arguments they take,
371 dnl do an explict linkage tests here.
372 dnl Check to see if the (math function) argument passed is
373 dnl 1) declared when using the c++ compiler
374 dnl 2) has "C" linkage
376 dnl Define HAVE_CARGF etc if "cargf" is declared and links
378 dnl argument 1 is name of function to check
380 dnl ASSUMES argument is a math function with ONE parameter
382 dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
383 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
386 AC_MSG_CHECKING([for $1 declaration])
387 AC_TRY_COMPILE([#include <math.h>],
389 [use_$1=yes], [use_$1=no])
390 AC_MSG_RESULT($use_$1)
392 if test x$use_$1 = x"yes"; then
393 AC_MSG_CHECKING([for $1 linkage])
394 AC_TRY_LINK([#include <math.h>],
396 [link_$1=yes], [link_$1=no])
397 AC_MSG_RESULT($link_$1)
398 if test x$link_$1 = x"yes"; then
399 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
400 AC_DEFINE_UNQUOTED(${ac_tr_func})
407 dnl Check to see what builtin math functions are supported
409 dnl check for __builtin_abs
410 dnl check for __builtin_fabsf
411 dnl check for __builtin_fabs
412 dnl check for __builtin_fabl
413 dnl check for __builtin_labs
414 dnl check for __builtin_sqrtf
415 dnl check for __builtin_sqrtl
416 dnl check for __builtin_fsqrt
417 dnl check for __builtin_sinf
418 dnl check for __builtin_sin
419 dnl check for __builtin_sinl
420 dnl check for __builtin_cosf
421 dnl check for __builtin_cos
422 dnl check for __builtin_cosl
424 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
425 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
426 dnl Test for builtin math functions.
427 dnl These are made in gcc/c-common.c
428 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
429 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
430 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
431 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
432 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
434 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
435 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fsqrt)
436 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
438 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
439 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
440 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
442 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
443 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
444 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
446 dnl There is, without a doubt, a more elegant way to have these
447 dnl names exported so that they won't be stripped out of acconfig.h by
448 dnl autoheader. I leave this as an exercise to somebody less frustrated
449 dnl than I.... please email the libstdc++ list if you can figure out a
450 dnl more elegant approach (see autoconf/acgen.m4 and specifically
451 dnl AC_CHECK_FUNC for things to steal.)
453 if test x$dummyvar = x"yes"; then
454 AC_DEFINE(HAVE___BUILTIN_ABS)
455 AC_DEFINE(HAVE___BUILTIN_LABS)
456 AC_DEFINE(HAVE___BUILTIN_COS)
457 AC_DEFINE(HAVE___BUILTIN_COSF)
458 AC_DEFINE(HAVE___BUILTIN_COSL)
459 AC_DEFINE(HAVE___BUILTIN_FABS)
460 AC_DEFINE(HAVE___BUILTIN_FABSF)
461 AC_DEFINE(HAVE___BUILTIN_FABSL)
462 AC_DEFINE(HAVE___BUILTIN_SIN)
463 AC_DEFINE(HAVE___BUILTIN_SINF)
464 AC_DEFINE(HAVE___BUILTIN_SINL)
465 AC_DEFINE(HAVE___BUILTIN_FSQRT)
466 AC_DEFINE(HAVE___BUILTIN_SQRTF)
467 AC_DEFINE(HAVE___BUILTIN_SQRTL)
473 dnl Check to see what the underlying c library or math library is like.
474 dnl These checks need to do two things:
475 dnl 1) make sure the name is declared when using the c++ compiler
476 dnl 2) make sure the name has "C" linkage
477 dnl This might seem like overkill but experience has shown that it's not...
479 dnl Define HAVE_CARGF etc if "cargf" is found.
481 dnl GLIBCPP_CHECK_MATH_SUPPORT
482 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
483 ac_test_CXXFLAGS="${CXXFLAGS+set}"
484 ac_save_CXXFLAGS="$CXXFLAGS"
485 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
488 AC_CHECK_LIB(m, sin, libm="-lm")
492 dnl Although not math functions, needed and for some reason checked here.
493 AC_CHECK_FUNCS(strtof strtold)
495 dnl Check to see if certain C math functions exist.
496 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
497 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
498 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
499 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
500 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
501 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
502 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
504 dnl Check to see if basic C math functions have float versions.
505 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
506 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
507 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(acosf)
508 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(asinf)
509 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(atanf)
510 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
511 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(ceilf)
512 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(cosf)
513 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(coshf)
514 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expf)
515 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
516 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(floorf)
517 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
518 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
519 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
520 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
521 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
522 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
523 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
524 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinf)
525 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinhf)
526 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
527 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanf)
528 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanhf)
529 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
530 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
532 dnl Check to see if basic C math functions have long double versions.
533 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
534 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
535 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
536 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(acosl)
537 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(asinl)
538 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(atanl)
539 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
540 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(ceill)
541 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(cosl)
542 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(coshl)
543 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
544 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
545 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(floorl)
546 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
547 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
548 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
549 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
550 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
551 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
552 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
553 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinl)
554 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinhl)
555 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
556 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanl)
557 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanhl)
558 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
559 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
561 dnl Some runtimes have these functions with a preceding underscore. Please
562 dnl keep this sync'd with the one above. And if you add any new symbol,
563 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
564 dnl Check to see if certain C math functions exist.
565 dnl Check to see if certain C math functions exist.
566 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinf)
567 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnan)
568 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finite)
569 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_copysign)
570 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincos)
571 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fpclass)
572 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_qfpclass)
574 dnl Check to see if basic C math functions have float versions.
575 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnanf)
576 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinff)
577 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_acosf)
578 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_asinf)
579 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_atanf)
580 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_atan2f)
581 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_ceilf)
582 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_cosf)
583 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_coshf)
584 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_expf)
585 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fabsf)
586 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_floorf)
587 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_fmodf)
588 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_frexpf)
589 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_ldexpf)
590 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_logf)
591 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_log10f)
592 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_modff)
593 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_powf)
594 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinf)
595 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinhf)
596 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sqrtf)
597 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanf)
598 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanhf)
599 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincosf)
600 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finitef)
602 dnl Check to see if basic C math functions have long double versions.
603 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnanl)
604 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinfl)
605 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_copysignl)
606 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_acosl)
607 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_asinl)
608 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_atanl)
609 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_atan2l)
610 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_ceill)
611 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_cosl)
612 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_coshl)
613 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_expl)
614 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fabsl)
615 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_floorl)
616 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_fmodl)
617 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_frexpl)
618 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_ldexpl)
619 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_logl)
620 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_log10l)
621 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_modfl)
622 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_powl)
623 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinl)
624 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinhl)
625 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sqrtl)
626 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanl)
627 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanhl)
628 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincosl)
629 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finitel)
632 CXXFLAGS="$ac_save_CXXFLAGS"
637 dnl Check to see if there is native support for complex
639 dnl Don't compile bits in math/* if native support exits.
641 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "cargf" is found.
643 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
644 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
645 dnl Check for complex versions of math functions of platform.
646 AC_CHECK_HEADERS([complex.h])
647 AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf c_log c_logf \
648 clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt csqrtf \
649 ctan ctanf ctanh ctanhf carg cargf nan hypot hypotf atan2f expf copysignf)
651 dnl Compile the long double complex functions only if the function
652 dnl provides the non-complex long double functions that are needed.
653 dnl Currently this includes copysignl and atan2l, which should be
654 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
655 USE_COMPLEX_LONG_DOUBLE=no
656 if test x$ac_cv_func_atan2l = x"yes" \
657 && test x$ac_cv_func_copysignl = x"yes"; then
658 USE_COMPLEX_LONG_DOUBLE=yes
659 AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl cpowl csinhl csinl \
660 csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l)
663 AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
667 dnl Check to see what architecture we are compiling for. If it's
668 dnl supported, use special hand-crafted routines to provide thread
669 dnl primitives. Also, if architecture-specific flags are required for
670 dnl compilation, add them here.
672 dnl Depending on what is found, select configure/cpu/*/bits/atomicity.h
673 dnl If not found, select configure/cpu/generic/bits/atomicity.h
675 dnl GLIBCPP_CHECK_CPU
676 AC_DEFUN(GLIBCPP_CHECK_CPU, [
677 AC_MSG_CHECKING([for cpu primitives directory])
679 case "$target_cpu" in
681 cpu_include_dir="config/cpu/alpha"
684 cpu_include_dir="config/cpu/arm"
687 cpu_include_dir="config/cpu/i386"
689 i486 | i586 | i686 | i786)
690 cpu_include_dir="config/cpu/i486"
693 cpu_include_dir="config/cpu/powerpc"
694 CPU_FLAGS='-mcpu=powerpc'
696 sparc64 | ultrasparc)
697 cpu_include_dir="config/cpu/sparc/sparc64"
700 cpu_include_dir="config/cpu/sparc/sparc32"
703 cpu_include_dir="config/cpu/generic"
706 AC_MSG_RESULT($cpu_include_dir)
707 AC_SUBST(cpu_include_dir)
713 dnl Check to see what the underlying c library's interface to ctype looks
714 dnl like. Bits of locale rely on things like isspace, toupper, etc. This
715 dnl stuff makes sure the right bits from the clibrary get called.
717 dnl Depending on what is found, select various configure/*/bits/ctype_base.h
718 dnl Depending on what is found, select various configure/*/ctype.cc
720 dnl GLIBCPP_CHECK_CTYPE
721 AC_DEFUN(GLIBCPP_CHECK_CTYPE, [
722 AC_CHECK_HEADER(ctype.h, [
724 dnl If doesn't match any specified, go with defaults.
727 dnl Test for <ctype> functionality -- gnu-linux
728 AC_MSG_CHECKING([<ctype> for gnu-linux ])
729 AC_TRY_COMPILE([#include <ctype.h>],
732 { return _ISspace + _ISprint + _IScntrl + _ISupper + _ISlower + _ISalpha \
733 + _ISdigit + _ISpunct + _ISxdigit + _ISalnum + _ISgraph \
734 + __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];}], \
735 ctype_linux=yes, ctype_linux=no)
736 AC_MSG_RESULT($ctype_linux)
737 if test $ctype_linux = "yes"; then
738 ctype_include_dir="config/gnu-linux"
742 dnl Test for <ctype> functionality -- FreeBSD 4.0
743 if test $ctype_default = "yes"; then
744 AC_MSG_CHECKING([<ctype> for freebsd 4.0 ])
745 AC_TRY_COMPILE([#include <ctype.h>],
748 { return _CTYPE_S + _CTYPE_R + _CTYPE_C + _CTYPE_U + _CTYPE_L + _CTYPE_A \
749 + _CTYPE_D + _CTYPE_P + _CTYPE_X + _CTYPE_G ;}], \
750 ctype_bsd=yes, ctype_bsd=no)
751 AC_MSG_RESULT($ctype_bsd)
752 if test $ctype_bsd = "yes"; then
753 ctype_include_dir="config/bsd"
758 dnl Test for <ctype> functionality -- FreeBSD 3.4
759 if test $ctype_default = "yes"; then
760 AC_MSG_CHECKING([<ctype> for freebsd 3.4 ])
761 AC_TRY_COMPILE([#include <ctype.h>],
764 { return _S + _R + _C + _U + _L + _A \
765 + _D + _P + _X + _G + __istype (a, 0);}], \
766 ctype_freebsd34=yes, ctype_freebsd34=no)
767 AC_MSG_RESULT($ctype_freebsd34)
768 if test $ctype_freebsd34 = "yes"; then
769 ctype_include_dir="config/bsd"
774 dnl Test for <ctype> functionality -- solaris 2.6 and 2.7
775 if test $ctype_default = "yes"; then
776 AC_MSG_CHECKING([<ctype> for solaris 2.[6,7,8] ])
777 AC_TRY_COMPILE([#include <ctype.h>],
780 { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
781 + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
782 + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}], \
783 ctype_solaris=yes, ctype_solaris=no)
784 AC_MSG_RESULT($ctype_solaris)
786 if test $ctype_solaris = "yes"; then
787 AC_MSG_CHECKING([ for version])
789 AC_TRY_COMPILE([#include <ctype.h>],
790 [typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;],\
791 ctype_solaris26=yes, ctype_solaris26=no)
793 if test $ctype_solaris26 = "yes"; then
794 ctype_include_dir="config/solaris/solaris2.6"
795 AC_MSG_RESULT("solaris2.6")
798 ctype_include_dir="config/solaris/solaris2.7"
799 AC_MSG_RESULT("solaris2.[7,8]")
805 dnl Test for <ctype> functionality -- solaris 2.5.1
806 if test $ctype_default = "yes"; then
807 AC_MSG_CHECKING([<ctype> for solaris 2.5.1 ])
808 AC_TRY_COMPILE([#include <ctype.h>],
811 { return _U + _L + _N + _S + _P + _C + _X + _B \
813 ctype_solaris25=yes, ctype_solaris25=no)
814 AC_MSG_RESULT($ctype_solaris25)
815 if test $ctype_solaris25 = "yes"; then
816 ctype_include_dir="config/solaris/solaris2.5"
821 dnl Test for <ctype> functionality -- aix
822 if test $ctype_default = "yes"; then
823 AC_MSG_CHECKING([<ctype> for aix ])
824 AC_TRY_COMPILE([#include <ctype.h>],
827 { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
828 + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
829 + _VALC('a') + _IS('c', 0);}], \
830 ctype_aix=yes, ctype_aix=no)
831 AC_MSG_RESULT($ctype_aix)
832 if test $ctype_aix = "yes"; then
833 ctype_include_dir="config/aix"
838 dnl Test for <ctype> functionality -- newlib
839 if test $ctype_default = "yes"; then
840 AC_MSG_CHECKING([<ctype> for newlib ])
841 AC_TRY_COMPILE([#include <ctype.h>],
844 { return _U + _L + _N + _S + _P + _C + _X + _B \
846 ctype_newlib=yes, ctype_newlib=no)
847 AC_MSG_RESULT($ctype_newlib)
848 if test $ctype_newlib = "yes"; then
849 ctype_include_dir="config/newlib"
854 if test $ctype_default = "yes"; then
855 ctype_include_dir="config/generic"
856 AC_MSG_WARN("Using default ctype headers.")
858 AC_SUBST(ctype_include_dir)
864 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
866 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
867 dnl Define _GLIBCPP_NEED_MBSTATE_T if mbstate_t is not in wchar.h
869 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
870 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
872 dnl Sanity check for existence of ISO C9X headers for extended encoding.
873 AC_CHECK_HEADER(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
874 AC_CHECK_HEADER(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
876 dnl Only continue checking if the ISO C9X headers exist.
877 if test x"$ac_has_wchar_h" = xyes && test x"$ac_has_wctype_h" = xyes; then
879 dnl Test wchar.h for mbstate_t, which is needed for char_traits and others.
880 AC_MSG_CHECKING([for mbstate_t])
881 AC_TRY_COMPILE([#include <wchar.h>],
882 [mbstate_t teststate;],
883 use_native_mbstatet=yes, use_native_mbstatet=no)
884 AC_MSG_RESULT($use_native_mbstatet)
885 if test x"$use_native_mbstatet" = xno; then
886 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
889 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
890 dnl numeric_limits can instantiate type_traits<wchar_t>
891 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
892 AC_TRY_COMPILE([#include <wchar.h>],
893 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
894 has_wchar_minmax=yes, has_wchar_minmax=no)
895 AC_MSG_RESULT($has_wchar_minmax)
897 dnl Test wchar.h for WEOF, which is what we use to determine whether
898 dnl to specialize for char_traits<wchar_t> or not.
899 AC_MSG_CHECKING([for WEOF])
902 #include <stddef.h>],
904 has_weof=yes, has_weof=no)
905 AC_MSG_RESULT($has_weof)
907 dnl Tests for wide character functions used in char_traits<wchar_t>.
908 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset, ac_wfuncs=yes, ac_wfuncs=no)
910 AC_MSG_CHECKING([for ISO C9X wchar_t support])
911 if test x"$has_weof" = xyes && test x"$has_wchar_minmax" = xyes && test x"$ac_wfuncs" = xyes; then
912 ac_isoC9X_wchar_t=yes
916 AC_MSG_RESULT($ac_isoC9X_wchar_t)
918 dnl Use iconv for wchar_t to char conversions. As such, check for
919 dnl X/Open Portability Guide, version 2 features (XPG2).
920 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
921 AC_CHECK_FUNCS(iconv_open iconv_close iconv, ac_XPG2funcs=yes, ac_XPG2funcs=no)
923 AC_MSG_CHECKING([for XPG2 wchar_t support])
924 if test x"$ac_has_iconv_h" = xyes && test x"$ac_XPG2funcs" = xyes; then
929 AC_MSG_RESULT($ac_XPG2_wchar_t)
931 dnl At the moment, only enable wchar_t specializations if all the
932 dnl above support is present.
933 AC_MSG_CHECKING([for enabled wchar_t specializations])
934 if test x"$ac_isoC9X_wchar_t" = xyes && test x"$ac_XPG2_wchar_t" = xyes; then
935 libinst_wstring_la="libinst-wstring.la"
936 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
939 libinst_wstring_la=""
942 AC_SUBST(libinst_wstring_la)
945 AC_MSG_WARN([<wchar.h> not found])
946 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
952 dnl Check to see if this version of GNU C++ is afflicted by bugs in
953 dnl __complex__ float support.
955 dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
957 dnl Check to see if this version of GNU C++ is afflicted by bugs in
958 dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
959 dnl gcc-2.95.x when using the library, unless we define the default copy
960 dnl ctor in the specializations of complex<>.
962 dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
963 dnl GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT
964 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT, [
965 AC_REQUIRE([AC_PROG_CXX])
967 AC_MSG_CHECKING([for GNU C++ __complex__ support])
968 AC_CACHE_VAL(glibcpp_cv_complex, [
971 AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
972 dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
973 [ dcomplex x; f(x); ],
974 glibcpp_cv_complex=ok,
975 glibcpp_cv_complex=buggy
979 AC_MSG_RESULT($glibcpp_cv_complex)
980 if test $glibcpp_cv_complex = buggy; then
981 AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
984 AC_MSG_CHECKING([for GNU C++ __complex__ float support])
985 AC_CACHE_VAL(glibcpp_cv_float_complex, [
989 cat > conftest.h <<EOB
991 // Check for buggy __complex__ that causes ICE in most versions of egcs
992 // and gcc-2.95.x on certain platforms (eg., x86-win32).
994 // See http://egcs.cygnus.com/ml/gcc-bugs/1999-07/msg00845.html for
995 // more info on the bug itself.
1000 __complex__ float m_value;
1001 float_complex (float = 0.0f, float = 0.0f);
1002 float_complex (__complex__ float val) : m_value (val) {}
1003 float_complex foo (const float_complex &val)
1004 { return float_complex (~val.m_value); }
1007 AC_TRY_COMPILE([#include "conftest.h"], ,
1008 glibcpp_cv_float_complex=ok,
1009 glibcpp_cv_float_complex=buggy
1013 AC_MSG_RESULT($glibcpp_cv_float_complex)
1014 if test $glibcpp_cv_float_complex = buggy; then
1015 AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
1021 dnl Check for special debugging mode; not for production use.
1023 dnl GLIBCPP_ENABLE_DEBUG
1024 dnl --enable-debug sets '-ggdb -O0'.
1025 dnl --disable-debug sets '-g' and whatever optimization options the
1026 dnl compiler can handle.
1027 dnl + Perhaps --enable-maintainer-mode should automatically turn this on?
1028 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
1029 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
1030 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1031 dnl defaults to `no'.
1032 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
1033 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
1034 AC_ARG_ENABLE(debug,
1035 changequote(<<, >>)dnl
1036 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
1037 changequote([, ])dnl
1038 [case "$enableval" in
1039 yes) enable_debug=yes ;;
1040 no) enable_debug=no ;;
1041 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
1043 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
1044 dnl Option parsed, now set things appropriately
1045 case "$enable_debug" in
1047 DEBUG_FLAGS='-O0 -ggdb'
1053 AC_SUBST(DEBUG_FLAGS)
1058 dnl Check for "unusual" flags to pass to the compiler while building.
1060 dnl GLIBCPP_ENABLE_CXX_FLAGS
1061 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1062 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1063 dnl Somehow this same set of flags must be passed when [re]building
1065 dnl --disable-cxx-flags passes nothing.
1066 dnl + See http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00131.html
1067 dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00284.html
1068 dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00035.html
1069 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
1070 dnl If "default flags" is an empty string (or "none"), the effect is
1071 dnl the same as --disable or --enable=no.
1072 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1073 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1074 AC_ARG_ENABLE(cxx-flags,
1075 changequote(<<, >>)dnl
1076 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
1077 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1078 changequote([, ])dnl
1079 [case "x$enableval" in
1080 xyes) AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1081 xno|x) enable_cxx_flags='' ;;
1082 *) enable_cxx_flags="$enableval" ;;
1084 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')dnl
1085 dnl Thinko on my part during design. This kludge is the workaround.
1086 if test "$enable_cxx_flags" = "none"; then enable_cxx_flags=''; fi
1087 dnl Run through flags (either default or command-line) and set anything
1088 dnl extra (e.g., #defines) that must accompany particular g++ options.
1089 if test -n "$enable_cxx_flags"; then
1090 for f in $enable_cxx_flags; do
1094 *) # and we're trying to pass /what/ exactly?
1095 AC_MSG_ERROR([compiler flags start with a -]) ;;
1099 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1100 AC_SUBST(EXTRA_CXX_FLAGS)
1105 dnl Check for instructions to automatically rebuild libgcc.a. Requires,
1106 dnl of course, the location of the gcc objdir. Note that if --disable-
1107 dnl namespaces is in effect, rebuilding libgcc.a is an expensive no-op.
1109 dnl GLIBCPP_ENABLE_RELIBGCC
1110 dnl --enable-libgcc-rebuild=/absolute/path/to/gcc/objdir sets GCC_OBJDIR
1111 dnl (presumably in the top-level Makefile) to /absol.../objdir
1112 dnl --disable-libgcc-rebuild will not touch libgcc.a at all (maybe print
1113 dnl a warning if this is given along with --enable-namespaces), by
1114 dnl setting GCC_OBJDIR to `no'.
1115 dnl + Doing this by default is going to be interesting. What default
1116 dnl "on" value can there be?
1117 dnl + Usage: GLIBCPP_ENABLE_RELIBGCC[(DEFAULT)]
1118 dnl The default path should be ../.. if bundled with GCC source.
1119 dnl If ommitted, it defaults to `no'.
1121 AC_DEFUN(GLIBCPP_ENABLE_RELIBGCC, [dnl
1122 define([GLIBCPP_ENABLE_RELIBGCC_DEFAULT], ifelse($1,, no, $1))dnl
1123 AC_ARG_ENABLE(libgcc-rebuild,
1124 changequote(<<, >>)dnl
1125 << --enable-libgcc-rebuild=DIR also rebuild libgcc.a; DIR is
1126 the GCC objdir; see install.html>>,
1127 changequote([, ])dnl
1128 [case "$enableval" in
1129 yes) AC_MSG_ERROR([--enable-libgcc-rebuild needs a pathname]) ;;
1130 no) enable_libgcc_rebuild=no ;;
1131 *) if test -d "$enableval" && test -d "${enableval}/gcc" && \
1132 test -d "${enableval}/libiberty"
1134 enable_libgcc_rebuild="$enableval"
1136 AC_MSG_ERROR(["$enableval" does not appear to be the GCC objdir])
1140 enable_libgcc_rebuild=GLIBCPP_ENABLE_RELIBGCC_DEFAULT)dnl
1141 GCC_OBJDIR="$enable_libgcc_rebuild"
1142 AC_SUBST(GCC_OBJDIR)
1147 dnl Check for which I/O library to use: libio, or something specific.
1149 dnl GLIBCPP_ENABLE_CSTDIO
1150 dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
1152 dnl default is libio
1154 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1155 AC_MSG_CHECKING([for cstdio to use])
1156 AC_ARG_ENABLE(cstdio,
1157 [ --enable-cstdio enable GNU libio for target io package. (default)
1158 --enable-cstdio=LIB use LIB target-speific io package.],
1159 if test x$enable_cstdio = xno; then
1162 enable_cstdio=libio)
1164 enable_cstdio_flag=$enable_cstdio
1166 dnl Check if a valid thread package
1167 case x${enable_cstdio_flag} in
1168 xlibio | x | xno | xnone | xyes)
1170 CSTDIO_H=c_io_libio.h
1171 CSTDIO_CC=c_io_libio.cc
1172 AC_MSG_RESULT(libio)
1174 # see if we are on a system with libio native (ie, linux)
1175 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1176 if test $has_libio = "yes"; then
1177 BUILD_LIBIO_INCLUDE=
1180 BUILD_LIBIO_INCLUDE='-I../libio'
1183 AC_SUBST(BUILD_LIBIO_INCLUDE)
1185 # see if the _G_config.h header needs to be built.
1186 # NB: This replaces the _G_CONFIG_H machinery in libio-v2
1187 AC_CHECK_HEADER(_G_config.h, has_gconf_h=yes, has_gconf_h=no)
1188 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO_CONFIG_H, test "$has_gconf_h" = no)
1191 CSTDIO_H=c_io_wince.h
1192 CSTDIO_CC=c_io_wince.cc
1193 AC_MSG_RESULT(wince)
1196 BUILD_LIBIO_INCLUDE=
1197 AC_SUBST(BUILD_LIBIO_INCLUDE)
1200 echo "$enable_cstdio is an unknown io package" 1>&2
1206 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1211 dnl Check for which threading library to use.
1213 dnl GLIBCPP_ENABLE_THREADS
1214 dnl --enable-threads=posix sets config/threads-posix.h et. al.
1216 dnl default is no threads
1218 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1219 dnl Note this comes from the gcc/config.in and libjava/config.in
1220 dnl Efforts should be made to keep this in sync.
1221 AC_MSG_CHECKING([for threads package to use])
1222 AC_ARG_ENABLE(threads,
1223 [ --enable-threads enable thread usage for target GCC.
1224 --enable-threads=LIB use LIB thread package for target GCC.],
1225 if test x$enable_threads = xno; then
1230 enable_threads_flag=$enable_threads
1232 dnl Check if a valid thread package
1233 case x${enable_threads_flag} in
1236 target_thread_file='single'
1240 target_thread_file=''
1242 xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
1243 xsolaris | xwin32 | xdce | xvxworks)
1244 target_thread_file=$enable_threads_flag
1247 echo "$enable_threads is an unknown thread package" 1>&2
1252 dnl Check for thread package actually supported in libstdc++
1253 case "$target_thread_file" in
1264 decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
1265 AC_MSG_ERROR(thread package $THREADS not yet supported)
1268 AC_MSG_ERROR($THREADS is an unknown thread package)
1271 AC_MSG_RESULT($THREADS)
1281 AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
1282 THREADLIBS=-lpthread
1283 THREADSPEC=-lpthread
1284 dnl Not presently used
1285 dnl THREADOBJS=threads-posix.lo
1286 THREADH=threads-posix.h
1289 dnl Not presently used
1290 dnl THREADOBJS=threads-no.lo
1291 THREADH=threads-no.h
1294 AC_SUBST(THREADLIBS)
1295 AC_SUBST(THREADINCS)
1296 AC_SUBST(THREADDEPS)
1297 AC_SUBST(THREADOBJS)
1298 AC_SUBST(THREADSPEC)
1303 dnl Check for template specializations for the 'long long' type extension.
1305 dnl GLIBCPP_ENABLE_LONG_LONG
1306 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1307 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1308 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1309 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1310 dnl defaults to `no'.
1311 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1313 dnl GLIBCPP_ENABLE_LONG_LONG
1314 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1315 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1317 AC_ARG_ENABLE(long-long,
1318 changequote(<<, >>)dnl
1319 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1320 changequote([, ])dnl
1321 [case "$enableval" in
1322 yes) enable_long_long=yes ;;
1323 no) enable_long_long=no ;;
1324 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1326 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1328 # Check for the existance of functions used if long long is enabled.
1329 AC_CHECK_FUNC(strtoll,,ac_strtoll=no)
1330 AC_CHECK_FUNC(strtoull,,ac_strtoull=no)
1332 AC_MSG_CHECKING([for enabled long long])
1333 if test x"$ac_strtoll" = xno || test x"$ac_strtoull" = xno; then
1334 enable_long_long=no;
1336 AC_MSG_RESULT($enable_long_long)
1338 dnl Option parsed, now set things appropriately
1339 case "$enable_long_long" in
1340 yes) AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1347 dnl Check for whether or not to do shadowed C headers.
1349 dnl GLIBCPP_ENABLE_SHADOW
1350 dnl --enable-cshadow-headers [does stuff].
1351 dnl --disable-cshadow-headers [does not do stuff].
1352 dnl + This will eventually need to be on by default.
1353 dnl + Usage: GLIBCPP_ENABLE_SHADOW[(DEFAULT)]
1354 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1355 dnl defaults to `no'.
1356 AC_DEFUN(GLIBCPP_ENABLE_SHADOW, [dnl
1357 define([GLIBCPP_ENABLE_SHADOW_DEFAULT], ifelse($1, yes, yes, no))dnl
1358 AC_MSG_CHECKING([for enabled cshadow headers])
1359 AC_ARG_ENABLE(cshadow-headers,
1360 changequote(<<, >>)dnl
1361 << --enable-cshadow-headers construct "shadowed" C header files for
1362 g++ [default=>>GLIBCPP_ENABLE_SHADOW_DEFAULT],
1363 changequote([, ])dnl
1364 [case "$enableval" in
1365 yes) enable_cshadow_headers=yes
1367 no) enable_cshadow_headers=no
1369 *) AC_MSG_ERROR([Unknown argument to enable/disable shadowed C headers])
1372 enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)dnl
1373 AC_MSG_RESULT($enable_cshadow_headers)
1374 dnl Option parsed, now set things appropriately
1375 case "$enable_cshadow_headers" in
1377 CSHADOWFLAGS="-D_GNU_SOURCE"
1378 CSHADOW_INCLUDES=" -I$srcdir/shadow -I$blddir/cshadow"
1386 AC_SUBST(CSHADOWFLAGS)
1387 AC_SUBST(CSHADOW_INCLUDES)
1388 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cshadow_headers" = yes)
1392 # Check whether LC_MESSAGES is available in <locale.h>.
1393 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1395 # This file file be copied and used freely without restrictions. It can
1396 # be used in projects which are not available under the GNU Public License
1397 # but which still want to provide support for the GNU gettext functionality.
1398 # Please note that the actual code is *not* freely available.
1402 AC_DEFUN(AC_LC_MESSAGES,
1403 [if test $ac_cv_header_locale_h = yes; then
1404 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1405 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1406 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1407 if test $ac_cv_val_LC_MESSAGES = yes; then
1408 AC_DEFINE(HAVE_LC_MESSAGES)
1413 # Check for functions in math library.
1414 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1416 # This file can be copied and used freely without restrictions. It can
1417 # be used in projects which are not available under the GNU Public License
1418 # but which still want to provide support for the GNU gettext functionality.
1419 # Please note that the actual code is *not* freely available.
1423 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1424 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1425 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1426 AC_SUBST(LIBMATHOBJS)dnl
1430 # Check for string functions.
1431 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1433 # This file can be copied and used freely without restrictions. It can
1434 # be used in projects which are not available under the GNU Public License
1435 # but which still want to provide support for the GNU gettext functionality.
1436 # Please note that the actual code is *not* freely available.
1440 dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1441 AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1442 [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1443 AC_SUBST(LIBSTRINGOBJS)dnl