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 GCC 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 dnl 2000-07-07-bkoz-hack-xxx
934 # ac_isoC9X_wchar_t=no
935 dnl 2000-07-07-bkoz-hack-xxx
937 AC_MSG_CHECKING([for enabled wchar_t specializations])
938 if test x"$ac_isoC9X_wchar_t" = xyes && test x"$ac_XPG2_wchar_t" = xyes; then
939 libinst_wstring_la="libinst-wstring.la"
940 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
943 libinst_wstring_la=""
946 AC_SUBST(libinst_wstring_la)
949 AC_MSG_WARN([<wchar.h> not found])
950 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
956 dnl Check to see if this version of GNU C++ is afflicted by bugs in
957 dnl __complex__ float support.
959 dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
961 dnl Check to see if this version of GNU C++ is afflicted by bugs in
962 dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
963 dnl gcc-2.95.x when using the library, unless we define the default copy
964 dnl ctor in the specializations of complex<>.
966 dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
967 dnl GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT
968 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT, [
969 AC_REQUIRE([AC_PROG_CXX])
971 AC_MSG_CHECKING([for GNU C++ __complex__ support])
972 AC_CACHE_VAL(glibcpp_cv_complex, [
975 AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
976 dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
977 [ dcomplex x; f(x); ],
978 glibcpp_cv_complex=ok,
979 glibcpp_cv_complex=buggy
983 AC_MSG_RESULT($glibcpp_cv_complex)
984 if test $glibcpp_cv_complex = buggy; then
985 AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
988 AC_MSG_CHECKING([for GNU C++ __complex__ float support])
989 AC_CACHE_VAL(glibcpp_cv_float_complex, [
993 cat > conftest.h <<EOB
995 // Check for buggy __complex__ that causes ICE in most versions of egcs
996 // and gcc-2.95.x on certain platforms (eg., x86-win32).
998 // See http://egcs.cygnus.com/ml/gcc-bugs/1999-07/msg00845.html for
999 // more info on the bug itself.
1004 __complex__ float m_value;
1005 float_complex (float = 0.0f, float = 0.0f);
1006 float_complex (__complex__ float val) : m_value (val) {}
1007 float_complex foo (const float_complex &val)
1008 { return float_complex (~val.m_value); }
1011 AC_TRY_COMPILE([#include "conftest.h"], ,
1012 glibcpp_cv_float_complex=ok,
1013 glibcpp_cv_float_complex=buggy
1017 AC_MSG_RESULT($glibcpp_cv_float_complex)
1018 if test $glibcpp_cv_float_complex = buggy; then
1019 AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
1025 dnl Check for special debugging mode; not for production use.
1027 dnl GLIBCPP_ENABLE_DEBUG
1028 dnl --enable-debug sets '-ggdb -O0'.
1029 dnl --disable-debug sets '-g' and whatever optimization options the
1030 dnl compiler can handle.
1031 dnl + Perhaps --enable-maintainer-mode should automatically turn this on?
1032 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
1033 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
1034 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1035 dnl defaults to `no'.
1036 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
1037 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
1038 AC_ARG_ENABLE(debug,
1039 changequote(<<, >>)dnl
1040 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
1041 changequote([, ])dnl
1042 [case "$enableval" in
1043 yes) enable_debug=yes ;;
1044 no) enable_debug=no ;;
1045 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
1047 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
1048 dnl Option parsed, now set things appropriately
1049 case "$enable_debug" in
1051 DEBUG_FLAGS='-O0 -ggdb'
1057 AC_SUBST(DEBUG_FLAGS)
1062 dnl Check for "unusual" flags to pass to the compiler while building.
1064 dnl GLIBCPP_ENABLE_CXX_FLAGS
1065 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1066 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1067 dnl Somehow this same set of flags must be passed when [re]building
1069 dnl --disable-cxx-flags passes nothing.
1070 dnl + See http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00131.html
1071 dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00284.html
1072 dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00035.html
1073 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
1074 dnl If "default flags" is an empty string (or "none"), the effect is
1075 dnl the same as --disable or --enable=no.
1076 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1077 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1078 AC_ARG_ENABLE(cxx-flags,
1079 changequote(<<, >>)dnl
1080 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
1081 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1082 changequote([, ])dnl
1083 [case "x$enableval" in
1084 xyes) AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1085 xno|x) enable_cxx_flags='' ;;
1086 *) enable_cxx_flags="$enableval" ;;
1088 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')dnl
1089 dnl Thinko on my part during design. This kludge is the workaround.
1090 if test "$enable_cxx_flags" = "none"; then enable_cxx_flags=''; fi
1091 dnl Run through flags (either default or command-line) and set anything
1092 dnl extra (e.g., #defines) that must accompany particular g++ options.
1093 if test -n "$enable_cxx_flags"; then
1094 for f in $enable_cxx_flags; do
1098 *) # and we're trying to pass /what/ exactly?
1099 AC_MSG_ERROR([compiler flags start with a -]) ;;
1103 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1104 AC_SUBST(EXTRA_CXX_FLAGS)
1109 dnl Check for instructions to automatically rebuild libgcc.a. Requires,
1110 dnl of course, the location of the gcc objdir. Note that if --disable-
1111 dnl namespaces is in effect, rebuilding libgcc.a is an expensive no-op.
1113 dnl GLIBCPP_ENABLE_RELIBGCC
1114 dnl --enable-libgcc-rebuild=/absolute/path/to/gcc/objdir sets GCC_OBJDIR
1115 dnl (presumably in the top-level Makefile) to /absol.../objdir
1116 dnl --disable-libgcc-rebuild will not touch libgcc.a at all (maybe print
1117 dnl a warning if this is given along with --enable-namespaces), by
1118 dnl setting GCC_OBJDIR to `no'.
1119 dnl + Doing this by default is going to be interesting. What default
1120 dnl "on" value can there be?
1121 dnl + Usage: GLIBCPP_ENABLE_RELIBGCC[(DEFAULT)]
1122 dnl The default path should be ../.. if bundled with GCC source.
1123 dnl If ommitted, it defaults to `no'.
1125 AC_DEFUN(GLIBCPP_ENABLE_RELIBGCC, [dnl
1126 define([GLIBCPP_ENABLE_RELIBGCC_DEFAULT], ifelse($1,, no, $1))dnl
1127 AC_ARG_ENABLE(libgcc-rebuild,
1128 changequote(<<, >>)dnl
1129 << --enable-libgcc-rebuild=DIR also rebuild libgcc.a; DIR is
1130 the GCC objdir; see install.html>>,
1131 changequote([, ])dnl
1132 [case "$enableval" in
1133 yes) AC_MSG_ERROR([--enable-libgcc-rebuild needs a pathname]) ;;
1134 no) enable_libgcc_rebuild=no ;;
1135 *) if test -d "$enableval" && test -d "${enableval}/gcc" && \
1136 test -d "${enableval}/libiberty"
1138 enable_libgcc_rebuild="$enableval"
1140 AC_MSG_ERROR(["$enableval" does not appear to be the GCC objdir])
1144 enable_libgcc_rebuild=GLIBCPP_ENABLE_RELIBGCC_DEFAULT)dnl
1145 GCC_OBJDIR="$enable_libgcc_rebuild"
1146 AC_SUBST(GCC_OBJDIR)
1151 dnl Check for which I/O library to use: libio, or something specific.
1153 dnl GLIBCPP_ENABLE_CSTDIO
1154 dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
1156 dnl default is libio
1158 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1159 AC_MSG_CHECKING([for cstdio to use])
1160 AC_ARG_ENABLE(cstdio,
1161 [ --enable-cstdio enable GNU libio for target io package. (default)
1162 --enable-cstdio=LIB use LIB target-speific io package.],
1163 if test x$enable_cstdio = xno; then
1166 enable_cstdio=libio)
1168 enable_cstdio_flag=$enable_cstdio
1170 dnl Check if a valid thread package
1171 case x${enable_cstdio_flag} in
1172 xlibio | x | xno | xnone | xyes)
1174 CSTDIO_H=config/c_io_libio.h
1175 CSTDIO_CC=config/c_io_libio.cc
1176 AC_MSG_RESULT(libio)
1178 # see if we are on a system with libio native (ie, linux)
1179 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1181 # Need to check and see what version of glibc is being used. If
1182 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1183 # compile most of libio for linux systems.
1184 if test x$has_libio = x"yes"; then
1187 AC_MSG_CHECKING([for glibc version >= 2.2])
1188 AC_EGREP_CPP([ok], [
1189 #include <features.h>
1190 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1193 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1194 AC_MSG_RESULT($glibc_satisfactory)
1198 if test x$glibc_satisfactory = x"yes"; then
1205 # bkoz XXX need to add checks to enable this
1209 # Using libio, but <libio.h> doesn't exist on the target system. . .
1213 # bkoz XXX need to add checks to enable this
1219 CSTDIO_H=config/c_io_wince.h
1220 CSTDIO_CC=config/c_io_wince.cc
1221 AC_MSG_RESULT(wince)
1226 echo "$enable_cstdio is an unknown io package" 1>&2
1230 AC_LINK_FILES($CSTDIO_H, bits/c++io.h)
1231 AC_LINK_FILES($CSTDIO_CC, src/c++io.cc)
1232 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1233 AM_CONDITIONAL(GLIBCPP_NEED_XTRA_LIBIO, test "$need_xtra_libio" = yes)
1234 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1239 dnl Check for which threading library to use.
1241 dnl GLIBCPP_ENABLE_THREADS
1242 dnl --enable-threads=posix sets config/threads-posix.h et. al.
1244 dnl default is no threads
1246 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1247 dnl Note this comes from the gcc/config.in and libjava/config.in
1248 dnl Efforts should be made to keep this in sync.
1249 AC_MSG_CHECKING([for threads package to use])
1250 AC_ARG_ENABLE(threads,
1251 [ --enable-threads enable thread usage for target GCC.
1252 --enable-threads=LIB use LIB thread package for target GCC.],
1253 if test x$enable_threads = xno; then
1258 enable_threads_flag=$enable_threads
1260 dnl Check if a valid thread package
1261 case x${enable_threads_flag} in
1264 target_thread_file='single'
1268 target_thread_file=''
1270 xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
1271 xsolaris | xwin32 | xdce | xvxworks)
1272 target_thread_file=$enable_threads_flag
1275 echo "$enable_threads is an unknown thread package" 1>&2
1280 dnl Check for thread package actually supported in libstdc++
1281 case "$target_thread_file" in
1292 decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
1293 AC_MSG_ERROR(thread package $THREADS not yet supported)
1296 AC_MSG_ERROR($THREADS is an unknown thread package)
1299 AC_MSG_RESULT($THREADS)
1309 AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
1310 THREADLIBS=-lpthread
1311 THREADSPEC=-lpthread
1312 dnl Not presently used
1313 dnl THREADOBJS=threads-posix.lo
1314 THREADH=threads-posix.h
1317 dnl Not presently used
1318 dnl THREADOBJS=threads-no.lo
1319 THREADH=threads-no.h
1322 AC_SUBST(THREADLIBS)
1323 AC_SUBST(THREADINCS)
1324 AC_SUBST(THREADDEPS)
1325 AC_SUBST(THREADOBJS)
1326 AC_SUBST(THREADSPEC)
1327 AC_LINK_FILES(config/$THREADH, bits/c++threads.h)
1332 dnl Check for template specializations for the 'long long' type extension.
1334 dnl GLIBCPP_ENABLE_LONG_LONG
1335 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1336 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1337 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1338 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1339 dnl defaults to `no'.
1340 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1342 dnl GLIBCPP_ENABLE_LONG_LONG
1343 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1344 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1346 AC_ARG_ENABLE(long-long,
1347 changequote(<<, >>)dnl
1348 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1349 changequote([, ])dnl
1350 [case "$enableval" in
1351 yes) enable_long_long=yes ;;
1352 no) enable_long_long=no ;;
1353 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1355 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1357 # Check for the existance of functions used if long long is enabled.
1358 AC_CHECK_FUNC(strtoll,,ac_strtoll=no)
1359 AC_CHECK_FUNC(strtoull,,ac_strtoull=no)
1361 AC_MSG_CHECKING([for enabled long long])
1362 if test x"$ac_strtoll" = xno || test x"$ac_strtoull" = xno; then
1363 enable_long_long=no;
1365 AC_MSG_RESULT($enable_long_long)
1367 dnl Option parsed, now set things appropriately
1368 case "$enable_long_long" in
1369 yes) AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1376 dnl Check for whether or not to do shadowed C headers.
1378 dnl GLIBCPP_ENABLE_SHADOW
1379 dnl --enable-cshadow-headers [does stuff].
1380 dnl --disable-cshadow-headers [does not do stuff].
1381 dnl + This will eventually need to be on by default.
1382 dnl + Usage: GLIBCPP_ENABLE_SHADOW[(DEFAULT)]
1383 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1384 dnl defaults to `no'.
1385 AC_DEFUN(GLIBCPP_ENABLE_SHADOW, [dnl
1386 define([GLIBCPP_ENABLE_SHADOW_DEFAULT], ifelse($1, yes, yes, no))dnl
1387 AC_MSG_CHECKING([for enabled cshadow headers])
1388 AC_ARG_ENABLE(cshadow-headers,
1389 changequote(<<, >>)dnl
1390 << --enable-cshadow-headers construct "shadowed" C header files for
1391 g++ [default=>>GLIBCPP_ENABLE_SHADOW_DEFAULT],
1392 changequote([, ])dnl
1393 [case "$enableval" in
1394 yes) enable_cshadow_headers=yes
1396 no) enable_cshadow_headers=no
1398 *) AC_MSG_ERROR([Unknown argument to enable/disable shadowed C headers])
1401 enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)dnl
1402 AC_MSG_RESULT($enable_cshadow_headers)
1403 dnl Option parsed, now set things appropriately
1404 dnl CSHADOWFLAGS is currently unused, but may be useful in the future.
1405 case "$enable_cshadow_headers" in
1414 AC_SUBST(CSHADOWFLAGS)
1415 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cshadow_headers" = yes)
1419 # Check whether LC_MESSAGES is available in <locale.h>.
1420 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1422 # This file file be copied and used freely without restrictions. It can
1423 # be used in projects which are not available under the GNU Public License
1424 # but which still want to provide support for the GNU gettext functionality.
1425 # Please note that the actual code is *not* freely available.
1429 AC_DEFUN(AC_LC_MESSAGES,
1430 [if test $ac_cv_header_locale_h = yes; then
1431 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1432 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1433 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1434 if test $ac_cv_val_LC_MESSAGES = yes; then
1435 AC_DEFINE(HAVE_LC_MESSAGES)
1440 # Check for functions in math library.
1441 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1443 # This file can be copied and used freely without restrictions. It can
1444 # be used in projects which are not available under the GNU Public License
1445 # but which still want to provide support for the GNU gettext functionality.
1446 # Please note that the actual code is *not* freely available.
1450 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1451 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1452 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1453 AC_SUBST(LIBMATHOBJS)dnl
1457 # Check for string functions.
1458 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1460 # This file can be copied and used freely without restrictions. It can
1461 # be used in projects which are not available under the GNU Public License
1462 # but which still want to provide support for the GNU gettext functionality.
1463 # Please note that the actual code is *not* freely available.
1467 dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1468 AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1469 [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1470 AC_SUBST(LIBSTRINGOBJS)dnl
1474 dnl This macro searches for a GNU version of make. If a match is found, the
1475 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1476 dnl set to "#". This is useful for including a special features in a Makefile,
1477 dnl which cannot be handled by other versions of make. The variable
1478 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1479 dnl the empty string otherwise.
1481 dnl Here is an example of its use:
1483 dnl Makefile.in might contain:
1485 dnl # A failsafe way of putting a dependency rule into a makefile
1487 dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1489 dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1490 dnl @ifGNUmake@ include $(DEPEND)
1491 dnl @ifGNUmake@ endif
1493 dnl Then configure.in would normally contain:
1495 dnl CHECK_GNU_MAKE()
1496 dnl AC_OUTPUT(Makefile)
1498 dnl Then perhaps to cause gnu make to override any other make, we could do
1499 dnl something like this (note that GNU make always looks for GNUmakefile first):
1501 dnl if ! test x$_cv_gnu_make_command = x ; then
1502 dnl mv Makefile GNUmakefile
1503 dnl echo .DEFAULT: > Makefile ;
1504 dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1507 dnl Then, if any (well almost any) other make is called, and GNU make also
1508 dnl exists, then the other make wraps the GNU make.
1510 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1511 dnl @version $Id: acinclude.m4,v 1.45 2000/07/21 20:59:23 gdr Exp $
1513 dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1514 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1515 dnl #### conditional's subshell (" --version" is not a command).
1518 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1519 _cv_gnu_make_command='' ;
1520 dnl Search all the common names for GNU make
1521 for a in "${MAKE:-make}" make gmake gnumake ; do
1522 if ( $a --version 2> /dev/null | grep -q GNU ) ; then
1523 _cv_gnu_make_command=$a ;
1528 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1529 dnl string, '#' otherwise
1530 if test "x$_cv_gnu_make_command" != "x" ; then