1 dnl aclocal.m4 generated automatically by aclocal 1.4
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
14 dnl Initialize configure bits.
16 dnl Define OPTLEVEL='-O2' if new inlining code present.
19 AC_DEFUN(GLIBCPP_CONFIGURE, [
20 dnl Default to --enable-multilib
21 AC_ARG_ENABLE(multilib,
22 [ --enable-multilib build hella library versions (default)],
23 [case "${enableval}" in
26 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
27 esac], [multilib=yes])dnl
29 dnl We may get other options which we dont document:
30 dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
31 if test "[$]{srcdir}" = "."; then
32 if test "[$]{with_target_subdir}" != "."; then
33 glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
35 glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
38 glibcpp_basedir="[$]{srcdir}/$1"
40 AC_SUBST(glibcpp_basedir)
42 AM_INIT_AUTOMAKE(libstdc++, 2.90.8)
44 # Never versions of autoconf add an underscore to these functions.
45 # Prevent future problems ...
46 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
47 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
48 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
49 ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
53 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
54 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
55 # are probably using a cross compiler, which will not be able to fully
56 # link an executable. This should really be fixed in autoconf
59 AC_DEFUN(LIB_AC_PROG_CC,
60 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
61 dnl Fool anybody using AC_PROG_CC.
62 AC_PROVIDE([AC_PROG_CC])
63 AC_CHECK_PROG(CC, gcc, gcc)
64 if test -z "$CC"; then
65 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
66 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
71 if test $ac_cv_prog_gcc = yes; then
73 dnl Check whether -g works, even if CFLAGS is set, in case the package
74 dnl plays around with CFLAGS (such as to build both debugging and
75 dnl normal versions of a library), tasteless as that idea is.
76 ac_test_CFLAGS="${CFLAGS+set}"
77 ac_save_CFLAGS="$CFLAGS"
80 if test "$ac_test_CFLAGS" = set; then
81 CFLAGS="$ac_save_CFLAGS"
82 elif test $ac_cv_prog_cc_g = yes; then
89 test "${CFLAGS+set}" = set || CFLAGS="-g"
95 # Can't just call these here as g++ requires libstc++ to be built....
98 # Likewise for AC_PROG_CXX.
99 AC_DEFUN(LIB_AC_PROG_CXX,
100 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
101 dnl Fool anybody using AC_PROG_CXX.
102 AC_PROVIDE([AC_PROG_CXX])
103 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
104 test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
108 if test $ac_cv_prog_gxx = yes; then
110 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
111 dnl plays around with CXXFLAGS (such as to build both debugging and
112 dnl normal versions of a library), tasteless as that idea is.
113 ac_test_CXXFLAGS="${CXXFLAGS+set}"
114 ac_save_CXXFLAGS="$CXXFLAGS"
117 if test "$ac_test_CXXFLAGS" = set; then
118 CXXFLAGS="$ac_save_CXXFLAGS"
119 elif test $ac_cv_prog_cxx_g = yes; then
126 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
132 AC_CHECK_TOOL(AS, as)
133 AC_CHECK_TOOL(AR, ar)
134 AC_CHECK_TOOL(RANLIB, ranlib, :)
140 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
141 # at least currently, we never actually build a program, so we never
142 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
143 # fails, because we are probably configuring with a cross compiler
144 # which cant create executables. So we include AC_EXEEXT to keep
145 # automake happy, but we dont execute it, since we dont care about
151 # configure.host sets the following important variables
152 # glibcpp_cflags - host specific C compiler flags
153 # glibcpp_cxxflags - host specific C++ compiler flags
157 . [$]{glibcpp_basedir}/configure.host
159 case [$]{glibcpp_basedir} in
160 /* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
161 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
164 GLIBCPP_CFLAGS="[$]{glibcpp_cflags}"
165 GLIBCPP_CXXFLAGS="[$]{glibcpp_cxxflags}"
166 AC_SUBST(GLIBCPP_CFLAGS)
167 AC_SUBST(GLIBCPP_CXXFLAGS)
172 dnl Check to see if g++ can compile this library, and if so, if any version-
173 dnl specific precautions need to be taken.
175 dnl GLIBCPP_CHECK_COMPILER_VERSION
176 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
177 # Sanity check that g++ is capable of dealing with v-3.
178 AC_MSG_CHECKING([for g++ that will successfully compile this code])
180 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
183 ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to gcc-2.95 or above]))
184 AC_MSG_RESULT($gpp_satisfactory)
189 dnl Test for newer compiler features, or features that are present in newer
190 dnl compiler version but not older compiler versions should be placed
193 dnl Define WFMT_FLAGS='-fdiagnostics-show-location=once' if possible
195 dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
196 dnl new inlining code or the new system_header pragma will die on -Werror.
197 dnl Leave it out by default and use maint-mode to use it.
199 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
200 dnl compiler supports it.
201 dnl GLIBCPP_CHECK_COMPILER_FEATURES
202 AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
203 # All these tests are for C++; save the language and the compiler flags.
204 # The CXXFLAGS thing is suspicious, but based on similar bits
205 # found in GLIBCPP_CONFIGURE.
208 ac_test_CXXFLAGS="${CXXFLAGS+set}"
209 ac_save_CXXFLAGS="$CXXFLAGS"
211 # Check for maintainer-mode bits.
212 if test x"$USE_MAINTAINER_MODE" = xno; then
218 # Check for more sophisticated diagnostic control.
219 AC_MSG_CHECKING([for g++ that supports -fdiagnostics-show-location=once])
220 CXXFLAGS='-Werror -fdiagnostics-show-location=once'
221 AC_TRY_COMPILE(, [int foo;
222 ], [ac_gabydiags=yes], [ac_gabydiags=no])
223 if test "$ac_test_CXXFLAGS" = set; then
224 CXXFLAGS="$ac_save_CXXFLAGS"
226 # this is the suspicious part
229 if test "$ac_gabydiags" = "yes"; then
230 WFMT_FLAGS='-fdiagnostics-show-location=once'
232 AC_MSG_RESULT($ac_gabydiags)
234 # Check for -ffunction-sections -fdata-sections
235 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
236 CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
237 AC_TRY_COMPILE(, [int foo;
238 ], [ac_fdsections=yes], [ac_fdsections=no])
239 if test "$ac_test_CXXFLAGS" = set; then
240 CXXFLAGS="$ac_save_CXXFLAGS"
242 # this is the suspicious part
245 if test "$ac_fdsections" = "yes"; then
246 SECTION_FLAGS='-ffunction-sections -fdata-sections'
248 AC_MSG_RESULT($ac_fdsections)
253 AC_SUBST(SECTION_FLAGS)
258 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
259 dnl the native linker is in use, all variables will be defined to something
260 dnl safe (like an empty string).
262 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
263 dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
265 dnl GLIBCPP_CHECK_LINKER_FEATURES
266 AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
267 # If we're not using GNU ld, then there's no point in even trying these
268 # tests. Check for that first. We should have already tested for gld
269 # by now (in libtool), but require it now just to be safe...
272 AC_REQUIRE([AC_PROG_LD])
275 if test "$ac_cv_prog_gnu_ld" = "broken"; then
276 # GNU ld it is! Joy and bunny rabbits!
278 # All these tests are for C++; save the language and the compiler flags.
279 # Need to do this so that g++ won't try to link in libstdc++
280 ac_test_CFLAGS="${CFLAGS+set}"
281 ac_save_CFLAGS="$CFLAGS"
282 CFLAGS='-x c++ -Wl,--gc-sections'
284 # Check for -Wl,--gc-sections
285 # XXX This test is broken at the moment, as symbols required for
286 # linking are now in libsupc++ (not built yet.....). In addition,
287 # this test has cored on solaris in the past. In addition,
288 # --gc-sections doesn't really work at the moment (keeps on discarding
289 # used sections, first .eh_frame and now some of the glibc sections for
290 # iconv). Bzzzzt. Thanks for playing, maybe next time.
291 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
299 ], [ac_sectionLDflags=yes],[ac_sectionLFflags=no], [ac_sectionLDflags=yes])
300 if test "$ac_test_CFLAGS" = set; then
301 CFLAGS="$ac_save_CFLAGS"
303 # this is the suspicious part
306 if test "$ac_sectionLDflags" = "yes"; then
307 SECTION_LDFLAGS='-Wl,--gc-sections'
309 AC_MSG_RESULT($ac_sectionLDflags)
312 # Set linker optimization flags.
313 if test "$ac_cv_prog_gnu_ld" = "yes"; then
314 OPT_LDFLAGS='-Wl,-O1'
317 AC_SUBST(SECTION_LDFLAGS)
318 AC_SUBST(OPT_LDFLAGS)
323 dnl Check to see if the (math function) argument passed is
324 dnl 1) declared when using the c++ compiler
325 dnl 2) has "C" linkage
327 dnl Define HAVE_CARGF etc if "cargf" is declared and links
329 dnl argument 1 is name of function to check
331 dnl ASSUMES argument is a math function with ONE parameter
333 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
334 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
335 AC_MSG_CHECKING([for $1 declaration])
336 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
339 AC_TRY_COMPILE([#include <math.h>],
341 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
344 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
345 if test x$glibcpp_cv_func_$1_use = x"yes"; then
352 dnl Check to see if the (math function) argument passed is
353 dnl 1) declared when using the c++ compiler
354 dnl 2) has "C" linkage
356 dnl Define HAVE_CARGF etc if "cargf" is declared and links
358 dnl argument 1 is name of function to check
360 dnl ASSUMES argument is a math function with TWO parameters
362 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
363 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
364 AC_MSG_CHECKING([for $1 declaration])
365 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
368 AC_TRY_COMPILE([#include <math.h>],
370 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
373 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
374 if test x$glibcpp_cv_func_$1_use = x"yes"; then
381 dnl Check to see if the (math function) argument passed is
382 dnl 1) declared when using the c++ compiler
383 dnl 2) has "C" linkage
385 dnl Define HAVE_CARGF etc if "cargf" is declared and links
387 dnl argument 1 is name of function to check
389 dnl ASSUMES argument is a math function with THREE parameters
391 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
392 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
393 AC_MSG_CHECKING([for $1 declaration])
394 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
397 AC_TRY_COMPILE([#include <math.h>],
399 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
402 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
403 if test x$glibcpp_cv_func_$1_use = x"yes"; then
410 dnl Check to see if the (stdlib function) argument passed is
411 dnl 1) declared when using the c++ compiler
412 dnl 2) has "C" linkage
414 dnl Define HAVE_STRTOLD if "strtold" is declared and links
415 dnl Define HAVE_STRTOF if "strtof" is declared and links
417 dnl argument 1 is name of function to check
419 dnl ASSUMES argument is a math function with TWO parameters
421 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
422 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
423 AC_MSG_CHECKING([for $1 declaration])
424 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
427 AC_TRY_COMPILE([#include <stdlib.h>],
429 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
432 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
433 if test x$glibcpp_cv_func_$1_use = x"yes"; then
440 dnl Because the builtins are picky picky picky about the arguments they take,
441 dnl do an explict linkage tests here.
442 dnl Check to see if the (math function) argument passed is
443 dnl 1) declared when using the c++ compiler
444 dnl 2) has "C" linkage
446 dnl Define HAVE_CARGF etc if "cargf" is declared and links
448 dnl argument 1 is name of function to check
450 dnl ASSUMES argument is a math function with ONE parameter
452 dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
453 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
454 AC_MSG_CHECKING([for $1 declaration])
455 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
458 AC_TRY_COMPILE([#include <math.h>],
460 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
463 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
464 if test x$glibcpp_cv_func_$1_use = x"yes"; then
465 AC_MSG_CHECKING([for $1 linkage])
466 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
467 AC_TRY_LINK([#include <math.h>],
469 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
471 AC_MSG_RESULT($glibcpp_cv_func_$1_link)
472 if test x$glibcpp_cv_func_$1_link = x"yes"; then
473 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
474 AC_DEFINE_UNQUOTED(${ac_tr_func})
481 dnl Check to see what builtin math functions are supported
483 dnl check for __builtin_abs
484 dnl check for __builtin_fabsf
485 dnl check for __builtin_fabs
486 dnl check for __builtin_fabl
487 dnl check for __builtin_labs
488 dnl check for __builtin_sqrtf
489 dnl check for __builtin_sqrtl
490 dnl check for __builtin_fsqrt
491 dnl check for __builtin_sinf
492 dnl check for __builtin_sin
493 dnl check for __builtin_sinl
494 dnl check for __builtin_cosf
495 dnl check for __builtin_cos
496 dnl check for __builtin_cosl
498 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
499 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
500 dnl Test for builtin math functions.
501 dnl These are made in gcc/c-common.c
502 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
503 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
504 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
505 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
506 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
508 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
509 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fsqrt)
510 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
512 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
513 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
514 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
516 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
517 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
518 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
520 dnl There is, without a doubt, a more elegant way to have these
521 dnl names exported so that they won't be stripped out of acconfig.h by
522 dnl autoheader. I leave this as an exercise to somebody less frustrated
523 dnl than I.... please email the libstdc++ list if you can figure out a
524 dnl more elegant approach (see autoconf/acgen.m4 and specifically
525 dnl AC_CHECK_FUNC for things to steal.)
527 if test x$dummyvar = x"yes"; then
528 AC_DEFINE(HAVE___BUILTIN_ABS)
529 AC_DEFINE(HAVE___BUILTIN_LABS)
530 AC_DEFINE(HAVE___BUILTIN_COS)
531 AC_DEFINE(HAVE___BUILTIN_COSF)
532 AC_DEFINE(HAVE___BUILTIN_COSL)
533 AC_DEFINE(HAVE___BUILTIN_FABS)
534 AC_DEFINE(HAVE___BUILTIN_FABSF)
535 AC_DEFINE(HAVE___BUILTIN_FABSL)
536 AC_DEFINE(HAVE___BUILTIN_SIN)
537 AC_DEFINE(HAVE___BUILTIN_SINF)
538 AC_DEFINE(HAVE___BUILTIN_SINL)
539 AC_DEFINE(HAVE___BUILTIN_FSQRT)
540 AC_DEFINE(HAVE___BUILTIN_SQRTF)
541 AC_DEFINE(HAVE___BUILTIN_SQRTL)
547 dnl Check to see what the underlying c library
548 dnl These checks need to do two things:
549 dnl 1) make sure the name is declared when using the c++ compiler
550 dnl 2) make sure the name has "C" linkage
551 dnl This might seem like overkill but experience has shown that it's not...
553 dnl Define HAVE_STRTOF etc if "strtof" is found.
554 dnl Define HAVE_STRTOLD etc if "strtold" is found.
556 dnl GLIBCPP_CHECK_STDLIB_SUPPORT
557 AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
558 ac_test_CXXFLAGS="${CXXFLAGS+set}"
559 ac_save_CXXFLAGS="$CXXFLAGS"
560 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
562 AC_CHECK_FUNCS(strtof)
563 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
565 CXXFLAGS="$ac_save_CXXFLAGS"
570 dnl Check to see what the underlying c library or math library is like.
571 dnl These checks need to do two things:
572 dnl 1) make sure the name is declared when using the c++ compiler
573 dnl 2) make sure the name has "C" linkage
574 dnl This might seem like overkill but experience has shown that it's not...
576 dnl Define HAVE_CARGF etc if "cargf" is found.
578 dnl GLIBCPP_CHECK_MATH_SUPPORT
579 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
580 ac_test_CXXFLAGS="${CXXFLAGS+set}"
581 ac_save_CXXFLAGS="$CXXFLAGS"
582 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
585 AC_CHECK_LIB(m, sin, libm="-lm")
589 dnl Check to see if certain C math functions exist.
590 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
591 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
592 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
593 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
594 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
595 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
596 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
598 dnl Check to see if basic C math functions have float versions.
599 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
600 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
601 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(acosf)
602 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(asinf)
603 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(atanf)
604 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
605 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(ceilf)
606 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(cosf)
607 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(coshf)
608 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expf)
609 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
610 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(floorf)
611 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
612 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
613 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
614 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
615 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
616 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
617 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
618 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinf)
619 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinhf)
620 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
621 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanf)
622 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanhf)
623 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
624 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
626 dnl Check to see if basic C math functions have long double versions.
627 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
628 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
629 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
630 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(acosl)
631 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(asinl)
632 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(atanl)
633 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
634 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(ceill)
635 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(cosl)
636 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(coshl)
637 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
638 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
639 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(floorl)
640 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
641 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
642 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
643 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
644 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
645 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
646 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
647 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinl)
648 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinhl)
649 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
650 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanl)
651 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanhl)
652 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
653 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
655 dnl Some runtimes have these functions with a preceding underscore. Please
656 dnl keep this sync'd with the one above. And if you add any new symbol,
657 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
658 dnl Check to see if certain C math functions exist.
659 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinf)
660 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnan)
661 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finite)
662 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_copysign)
663 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincos)
664 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fpclass)
665 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_qfpclass)
667 dnl Check to see if basic C math functions have float versions.
668 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnanf)
669 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinff)
670 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_acosf)
671 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_asinf)
672 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_atanf)
673 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_atan2f)
674 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_ceilf)
675 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_cosf)
676 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_coshf)
677 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_expf)
678 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fabsf)
679 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_floorf)
680 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_fmodf)
681 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_frexpf)
682 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_ldexpf)
683 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_logf)
684 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_log10f)
685 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_modff)
686 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_powf)
687 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinf)
688 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinhf)
689 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sqrtf)
690 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanf)
691 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanhf)
692 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincosf)
693 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finitef)
695 dnl Check to see if basic C math functions have long double versions.
696 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnanl)
697 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinfl)
698 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_copysignl)
699 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_acosl)
700 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_asinl)
701 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_atanl)
702 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_atan2l)
703 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_ceill)
704 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_cosl)
705 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_coshl)
706 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_expl)
707 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fabsl)
708 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_floorl)
709 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_fmodl)
710 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_frexpl)
711 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_ldexpl)
712 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_logl)
713 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_log10l)
714 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_modfl)
715 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_powl)
716 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinl)
717 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinhl)
718 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sqrtl)
719 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanl)
720 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanhl)
721 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincosl)
722 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finitel)
725 CXXFLAGS="$ac_save_CXXFLAGS"
730 dnl Check to see if there is native support for complex
732 dnl Don't compile bits in math/* if native support exits.
734 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "atan2l/copysignl" is found.
736 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
737 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
738 dnl Check for complex versions of math functions of platform.
739 AC_CHECK_HEADERS([complex.h])
740 AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf c_log c_logf \
741 clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt csqrtf \
742 ctan ctanf ctanh ctanhf carg cargf nan hypot hypotf atan2f expf copysignf)
744 dnl Compile the long double complex functions only if the function
745 dnl provides the non-complex long double functions that are needed.
746 dnl Currently this includes copysignl and atan2l, which should be
747 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
748 USE_COMPLEX_LONG_DOUBLE=no
749 if test x$ac_cv_func_atan2l = x"yes" \
750 && test x$ac_cv_func_copysignl = x"yes"; then
751 USE_COMPLEX_LONG_DOUBLE=yes
752 AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl cpowl csinhl csinl \
753 csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l)
756 AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
760 dnl Check to see what architecture we are compiling for. Also, if
761 dnl architecture-specific flags are required for compilation, add them here.
763 dnl GLIBCPP_CHECK_CPU
764 AC_DEFUN(GLIBCPP_CHECK_CPU, [
765 AC_MSG_CHECKING([for cpu config directory])
766 # Currently unused, but could be useful.
768 case "${target_cpu}" in
770 cpu_include_dir="config/cpu/alpha"
773 cpu_include_dir="config/cpu/arm"
776 cpu_include_dir="config/cpu/ia64"
779 cpu_include_dir="config/cpu/i386"
781 i486 | i586 | i686 | i786)
782 cpu_include_dir="config/cpu/i486"
785 cpu_include_dir="config/cpu/powerpc"
787 sparc64 | ultrasparc)
788 cpu_include_dir="config/cpu/sparc/sparc64"
791 cpu_include_dir="config/cpu/sparc/sparc32"
794 cpu_include_dir="config/cpu/generic"
797 AC_MSG_RESULT($cpu_include_dir)
801 dnl Check to see what OS we are compiling for. Also, if os-specific flags
802 dnl are required for compilation, add them here.
805 AC_DEFUN(GLIBCPP_CHECK_OS, [
806 AC_MSG_CHECKING([for os config directory])
807 # Currently unused, but could be useful.
809 case "${target_os}" in
811 os_include_dir="config/os/aix"
814 os_include_dir="config/os/bsd"
817 os_include_dir="config/os/gnu-linux"
820 os_include_dir="config/os/irix"
823 os_include_dir="config/os/solaris/solaris2.5"
826 os_include_dir="config/os/solaris/solaris2.6"
828 solaris2.7* | solaris2.8*)
829 os_include_dir="config/os/solaris/solaris2.7"
832 os_include_dir="config/os/generic"
835 AC_MSG_RESULT($os_include_dir)
836 AC_LINK_FILES($os_include_dir/bits/os_defines.h, bits/os_defines.h)
841 dnl Check to see what the underlying c library's interface to ctype looks
842 dnl like. Bits of locale rely on things like isspace, toupper, etc. This
843 dnl stuff makes sure the right bits from the clibrary get called.
845 dnl Depending on what is found, select various configure/*/bits/ctype_base.h
846 dnl Depending on what is found, select various configure/*/ctype.cc
848 dnl GLIBCPP_CHECK_CTYPE_SUPPORT
849 AC_DEFUN(GLIBCPP_CHECK_CTYPE_SUPPORT, [
850 AC_CHECK_HEADER(ctype.h, [
852 dnl If doesn't match any specified, go with defaults.
855 dnl Test for <ctype> functionality -- GNU/Linux
856 AC_MSG_CHECKING([<ctype> for GNU/Linux])
857 AC_TRY_COMPILE([#include <ctype.h>],
860 { return _ISspace + _ISprint + _IScntrl + _ISupper + _ISlower + _ISalpha \
861 + _ISdigit + _ISpunct + _ISxdigit + _ISalnum + _ISgraph \
862 + __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];}], \
863 ctype_linux=yes, ctype_linux=no)
864 AC_MSG_RESULT($ctype_linux)
865 if test $ctype_linux = "yes"; then
866 ctype_include_dir="config/os/gnu-linux"
870 dnl Test for <ctype> functionality -- FreeBSD 4.0
871 if test $ctype_default = "yes"; then
872 AC_MSG_CHECKING([<ctype> for FreeBSD 4.0])
873 AC_TRY_COMPILE([#include <ctype.h>],
876 { return _CTYPE_S + _CTYPE_R + _CTYPE_C + _CTYPE_U + _CTYPE_L + _CTYPE_A \
877 + _CTYPE_D + _CTYPE_P + _CTYPE_X + _CTYPE_G ;}], \
878 ctype_bsd=yes, ctype_bsd=no)
879 AC_MSG_RESULT($ctype_bsd)
880 if test $ctype_bsd = "yes"; then
881 ctype_include_dir="config/os/bsd"
886 dnl Test for <ctype> functionality -- FreeBSD 3.4
887 if test $ctype_default = "yes"; then
888 AC_MSG_CHECKING([<ctype> for FreeBSD 3.4])
889 AC_TRY_COMPILE([#include <ctype.h>],
892 { return _S + _R + _C + _U + _L + _A \
893 + _D + _P + _X + _G + __istype (a, 0);}], \
894 ctype_freebsd34=yes, ctype_freebsd34=no)
895 AC_MSG_RESULT($ctype_freebsd34)
896 if test $ctype_freebsd34 = "yes"; then
897 ctype_include_dir="config/os/bsd"
902 dnl Test for <ctype> functionality -- Solaris 2.6 and up
903 if test $ctype_default = "yes"; then
904 AC_MSG_CHECKING([<ctype> for Solaris 2.6,7,8])
905 AC_TRY_COMPILE([#include <ctype.h>],
908 { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
909 + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
910 + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}], \
911 ctype_solaris=yes, ctype_solaris=no)
912 AC_MSG_RESULT($ctype_solaris)
914 if test $ctype_solaris = "yes"; then
915 AC_MSG_CHECKING([ for version])
917 AC_TRY_COMPILE([#include <ctype.h>],
918 [typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;],\
919 ctype_solaris26=yes, ctype_solaris26=no)
921 if test $ctype_solaris26 = "yes"; then
922 ctype_include_dir="config/os/solaris/solaris2.6"
923 AC_MSG_RESULT([Solaris 2.6])
926 ctype_include_dir="config/os/solaris/solaris2.7"
927 AC_MSG_RESULT([Solaris 7,8])
933 dnl Test for <ctype> functionality -- Solaris 2.5.1
934 if test $ctype_default = "yes"; then
935 AC_MSG_CHECKING([<ctype> for Solaris 2.5.1])
936 AC_TRY_COMPILE([#include <ctype.h>],
939 { return _U + _L + _N + _S + _P + _C + _X + _B \
941 ctype_solaris25=yes, ctype_solaris25=no)
942 AC_MSG_RESULT($ctype_solaris25)
943 if test $ctype_solaris25 = "yes"; then
944 ctype_include_dir="config/os/solaris/solaris2.5"
949 dnl Test for <ctype> functionality -- AIX
950 if test $ctype_default = "yes"; then
951 AC_MSG_CHECKING([<ctype> for AIX])
952 AC_TRY_COMPILE([#include <ctype.h>],
955 { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
956 + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
957 + _VALC('a') + _IS('c', 0);}], \
958 ctype_aix=yes, ctype_aix=no)
959 AC_MSG_RESULT($ctype_aix)
960 if test $ctype_aix = "yes"; then
961 ctype_include_dir="config/os/aix"
966 dnl Test for <ctype> functionality -- newlib
967 if test $ctype_default = "yes"; then
968 AC_MSG_CHECKING([<ctype> for newlib])
969 AC_TRY_COMPILE([#include <ctype.h>],
972 { return _U + _L + _N + _S + _P + _C + _X + _B \
974 ctype_newlib=yes, ctype_newlib=no)
975 AC_MSG_RESULT($ctype_newlib)
976 if test $ctype_newlib = "yes"; then
977 ctype_include_dir="config/newlib"
982 if test $ctype_default = "yes"; then
983 ctype_include_dir="config/os/generic"
984 AC_MSG_WARN("Using default ctype headers.")
987 AC_LINK_FILES($ctype_include_dir/bits/ctype_base.h, bits/ctype_base.h)
988 AC_LINK_FILES($ctype_include_dir/bits/ctype_inline.h, bits/ctype_inline.h)
989 AC_LINK_FILES($ctype_include_dir/bits/ctype_noninline.h, \
990 bits/ctype_noninline.h)
996 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
997 dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
998 dnl must have been previously checked.)
1000 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
1001 dnl Define _GLIBCPP_NEED_MBSTATE_T if mbstate_t is not in wchar.h
1003 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
1004 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
1005 if test x$enable_c_mbchar != xno; then
1007 dnl Sanity check for existence of ISO C9X headers for extended encoding.
1008 AC_CHECK_HEADER(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
1009 AC_CHECK_HEADER(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
1011 dnl Only continue checking if the ISO C9X headers exist.
1012 if test x"$ac_has_wchar_h" = xyes && test x"$ac_has_wctype_h" = xyes; then
1014 dnl Test wchar.h for mbstate_t, which is needed for char_traits
1016 AC_MSG_CHECKING([for mbstate_t])
1017 AC_TRY_COMPILE([#include <wchar.h>],
1018 [mbstate_t teststate;],
1019 use_native_mbstatet=yes, use_native_mbstatet=no)
1020 AC_MSG_RESULT($use_native_mbstatet)
1021 if test x"$use_native_mbstatet" = xno; then
1022 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
1025 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
1026 dnl numeric_limits can instantiate type_traits<wchar_t>
1027 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
1028 AC_TRY_COMPILE([#include <wchar.h>],
1029 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
1030 has_wchar_minmax=yes, has_wchar_minmax=no)
1031 AC_MSG_RESULT($has_wchar_minmax)
1033 dnl Test wchar.h for WEOF, which is what we use to determine whether
1034 dnl to specialize for char_traits<wchar_t> or not.
1035 AC_MSG_CHECKING([for WEOF])
1038 #include <stddef.h>],
1040 has_weof=yes, has_weof=no)
1041 AC_MSG_RESULT($has_weof)
1043 dnl Tests for wide character functions used in char_traits<wchar_t>.
1044 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset \
1045 wcsrtombs mbsrtowcs, ac_wfuncs=yes, ac_wfuncs=no)
1047 AC_MSG_CHECKING([for ISO C9X wchar_t support])
1048 if test x"$has_weof" = xyes && test x"$has_wchar_minmax" = xyes \
1049 && test x"$ac_wfuncs" = xyes; then
1050 ac_isoC9X_wchar_t=yes
1052 ac_isoC9X_wchar_t=no
1054 AC_MSG_RESULT($ac_isoC9X_wchar_t)
1056 dnl Use iconv for wchar_t to char conversions. As such, check for
1057 dnl X/Open Portability Guide, version 2 features (XPG2).
1058 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
1059 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
1060 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
1061 ac_XPG2funcs=yes, ac_XPG2funcs=no)
1063 AC_MSG_CHECKING([for XPG2 wchar_t support])
1064 if test x"$ac_has_iconv_h" = xyes && test x"$ac_has_langinfo_h" = xyes \
1065 && test x"$ac_XPG2funcs" = xyes; then
1070 AC_MSG_RESULT($ac_XPG2_wchar_t)
1072 dnl At the moment, only enable wchar_t specializations if all the
1073 dnl above support is present.
1074 AC_MSG_CHECKING([for enabled wchar_t specializations])
1075 if test x"$ac_isoC9X_wchar_t" = xyes \
1076 && test x"$ac_XPG2_wchar_t" = xyes; then
1077 libinst_wstring_la="libinst-wstring.la"
1078 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
1079 AC_MSG_RESULT("yes")
1081 libinst_wstring_la=""
1084 AC_SUBST(libinst_wstring_la)
1087 AC_MSG_WARN([<wchar.h> not found])
1088 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
1092 dnl Wide characters disabled by the user. Maybe print a warning?
1099 dnl Check to see if this version of GNU C++ is afflicted by bugs in
1100 dnl __complex__ float support.
1102 dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
1104 dnl Check to see if this version of GNU C++ is afflicted by bugs in
1105 dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
1106 dnl gcc-2.95.x when using the library, unless we define the default copy
1107 dnl ctor in the specializations of complex<>.
1109 dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
1110 dnl GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT
1111 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT, [
1112 AC_REQUIRE([AC_PROG_CXX])
1114 AC_MSG_CHECKING([for GNU C++ __complex__ support])
1115 AC_CACHE_VAL(glibcpp_cv_complex, [
1118 AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
1119 dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
1120 [ dcomplex x; f(x); ],
1121 glibcpp_cv_complex=ok,
1122 glibcpp_cv_complex=buggy
1126 AC_MSG_RESULT($glibcpp_cv_complex)
1127 if test $glibcpp_cv_complex = buggy; then
1128 AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
1131 AC_MSG_CHECKING([for GNU C++ __complex__ float support])
1132 AC_CACHE_VAL(glibcpp_cv_float_complex, [
1136 cat > conftest.h <<EOB
1138 // Check for buggy __complex__ that causes ICE in most versions of egcs
1139 // and gcc-2.95.x on certain platforms (eg., x86-win32).
1141 // See http://egcs.cygnus.com/ml/gcc-bugs/1999-07/msg00845.html for
1142 // more info on the bug itself.
1147 __complex__ float m_value;
1148 float_complex (float = 0.0f, float = 0.0f);
1149 float_complex (__complex__ float val) : m_value (val) {}
1150 float_complex foo (const float_complex &val)
1151 { return float_complex (~val.m_value); }
1154 AC_TRY_COMPILE([#include "conftest.h"], ,
1155 glibcpp_cv_float_complex=ok,
1156 glibcpp_cv_float_complex=buggy
1160 AC_MSG_RESULT($glibcpp_cv_float_complex)
1161 if test $glibcpp_cv_float_complex = buggy; then
1162 AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
1168 dnl Check for special debugging mode; not for production use.
1170 dnl GLIBCPP_ENABLE_DEBUG
1171 dnl --enable-debug sets '-ggdb -O0'.
1172 dnl --disable-debug sets '-g' and whatever optimization options the
1173 dnl compiler can handle.
1174 dnl + --enable-maintainer-mode automatically defaults this to on.
1175 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
1176 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
1177 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1178 dnl defaults to `no'.
1179 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
1180 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
1181 AC_ARG_ENABLE(debug,
1182 changequote(<<, >>)dnl
1183 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
1184 changequote([, ])dnl
1185 [case "${enableval}" in
1186 yes) enable_debug=yes ;;
1187 no) enable_debug=no ;;
1188 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
1190 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
1192 dnl Option parsed, now set things appropriately
1193 case "${enable_debug}" in
1195 DEBUG_FLAGS='-O0 -ggdb'
1201 AC_SUBST(DEBUG_FLAGS)
1206 dnl Check for "unusual" flags to pass to the compiler while building.
1208 dnl GLIBCPP_ENABLE_CXX_FLAGS
1209 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1210 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1211 dnl Somehow this same set of flags must be passed when [re]building
1213 dnl --disable-cxx-flags passes nothing.
1214 dnl + See http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00131.html
1215 dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00284.html
1216 dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00035.html
1217 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
1218 dnl If "default flags" is an empty string (or "none"), the effect is
1219 dnl the same as --disable or --enable=no.
1220 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1221 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1222 AC_ARG_ENABLE(cxx-flags,
1223 changequote(<<, >>)dnl
1224 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
1225 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1226 changequote([, ])dnl
1227 [case "x$enableval" in
1229 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1231 enable_cxx_flags='' ;;
1233 enable_cxx_flags="$enableval" ;;
1235 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
1237 dnl Thinko on my part during design. This kludge is the workaround.
1238 if test "$enable_cxx_flags" = "none"; then
1239 enable_cxx_flags='';
1242 dnl Run through flags (either default or command-line) and set anything
1243 dnl extra (e.g., #defines) that must accompany particular g++ options.
1244 if test -n "$enable_cxx_flags"; then
1245 for f in $enable_cxx_flags; do
1249 *) # and we're trying to pass /what/ exactly?
1250 AC_MSG_ERROR([compiler flags start with a -]) ;;
1254 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1255 AC_SUBST(EXTRA_CXX_FLAGS)
1260 dnl Check for which I/O library to use: libio, or something specific.
1262 dnl GLIBCPP_ENABLE_CSTDIO
1263 dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
1265 dnl default is libio
1267 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1268 AC_MSG_CHECKING([for cstdio to use])
1269 AC_ARG_ENABLE(cstdio,
1270 [ --enable-cstdio enable GNU libio for target io package. (default)
1271 --enable-cstdio=LIB use LIB target-speific io package.],
1272 if test x$enable_cstdio = xno; then
1275 enable_cstdio=libio)
1277 enable_cstdio_flag=$enable_cstdio
1279 dnl Check if a valid I/O package
1280 case x${enable_cstdio_flag} in
1281 xlibio | x | xno | xnone | xyes)
1283 CSTDIO_H=config/c_io_libio.h
1284 CSTDIO_CC=config/c_io_libio.cc
1285 AC_MSG_RESULT(libio)
1287 # see if we are on a system with libio native (ie, linux)
1288 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1290 # Need to check and see what version of glibc is being used. If
1291 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1292 # compile most of libio for linux systems.
1293 if test x$has_libio = x"yes"; then
1296 AC_MSG_CHECKING([for glibc version >= 2.2])
1297 AC_EGREP_CPP([ok], [
1298 #include <features.h>
1299 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1302 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1303 AC_MSG_RESULT($glibc_satisfactory)
1307 # XXX at the moment, admit defeat and force the recompilation
1308 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
1309 glibc_satisfactory=no
1311 if test x$glibc_satisfactory = x"yes"; then
1316 # bkoz XXX need to add checks to enable this
1317 # pme XXX here's a first pass at such a check
1318 if test x$enable_c_mbchar != xno; then
1326 # Using libio, but <libio.h> doesn't exist on the target system. . .
1328 # bkoz XXX need to add checks to enable this
1329 # pme XXX here's a first pass at such a check
1330 if test x$enable_c_mbchar != xno; then
1339 CSTDIO_H=config/c_io_wince.h
1340 CSTDIO_CC=config/c_io_wince.cc
1341 AC_MSG_RESULT(wince)
1346 echo "$enable_cstdio is an unknown io package" 1>&2
1350 AC_LINK_FILES($CSTDIO_H, bits/c++io.h)
1351 AC_LINK_FILES($CSTDIO_CC, src/c++io.cc)
1353 # 2000-08-04 bkoz hack
1354 CCODECVT_C=config/c_io_libio_codecvt.c
1355 AC_LINK_FILES($CCODECVT_C, libio/c_codecvt.c)
1356 # 2000-08-04 bkoz hack
1358 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1359 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1364 dnl Check for which threading library to use.
1366 dnl GLIBCPP_ENABLE_THREADS
1367 dnl --enable-threads=posix sets config/threads-posix.h et. al.
1369 dnl Default is no threads, which also disables _IO_MTSAFE_IO in
1370 dnl libio. Any actual thread package will enable it.
1372 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1373 dnl Note this comes from the gcc/config.in and libjava/config.in
1374 dnl Efforts should be made to keep this in sync.
1375 AC_MSG_CHECKING([for threads package to use])
1376 AC_ARG_ENABLE(threads,
1377 [ --enable-threads enable thread usage for target GCC.
1378 --enable-threads=LIB use LIB thread package for target GCC.],
1379 if test x$enable_threads = xno; then
1384 enable_threads_flag=$enable_threads
1386 dnl Check if a valid thread package
1387 case x${enable_threads_flag} in
1390 target_thread_file='single'
1394 target_thread_file=''
1396 xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
1397 xsolaris | xwin32 | xdce | xvxworks)
1398 target_thread_file=$enable_threads_flag
1401 echo "$enable_threads is an unknown thread package" 1>&2
1406 dnl Check for thread package actually supported in libstdc++
1408 case "$target_thread_file" in
1410 THREADH=threads-no.h
1413 THREADH=threads-posix.h
1415 decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
1416 AC_MSG_ERROR(thread package $THREADS not yet supported)
1419 AC_MSG_ERROR($THREADS is an unknown thread package)
1422 AC_MSG_RESULT($THREADH)
1424 AC_LINK_FILES(config/$THREADH, bits/c++threads.h)
1425 if test $THREADH != threads-no.h; then
1426 AC_DEFINE(_GLIBCPP_USE_THREADS)
1431 dnl Enable atomic locking
1432 dnl GLIBCPP_ENABLE_ATOMICITY
1433 AC_DEFUN(GLIBCPP_ENABLE_ATOMICITY, [
1434 AC_MSG_CHECKING([for atomicity.h])
1436 *-*-linux* | sparc*-*-*)
1437 ATOMICITYH=$cpu_include_dir
1440 ATOMICITYH=$os_include_dir
1443 # bit of overkill on this text...
1444 AC_MSG_ERROR([Atomic locking requested, but $enable_threads is an unknown thread package and atomic operations are not present in the CPU])
1447 AC_MSG_RESULT($ATOMICITYH/bits/atomicity.h)
1448 AC_LINK_FILES($ATOMICITYH/bits/atomicity.h, bits/atomicity.h)
1453 dnl Check for template specializations for the 'long long' type extension.
1455 dnl GLIBCPP_ENABLE_LONG_LONG
1456 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1457 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1458 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1459 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1460 dnl defaults to `no'.
1461 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1463 dnl GLIBCPP_ENABLE_LONG_LONG
1464 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1465 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1467 AC_ARG_ENABLE(long-long,
1468 changequote(<<, >>)dnl
1469 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1470 changequote([, ])dnl
1471 [case "$enableval" in
1472 yes) enable_long_long=yes ;;
1473 no) enable_long_long=no ;;
1474 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1476 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1478 # Check for the existance of functions used if long long is enabled.
1479 AC_CHECK_FUNC(strtoll,,ac_strtoll=no)
1480 AC_CHECK_FUNC(strtoull,,ac_strtoull=no)
1482 AC_MSG_CHECKING([for enabled long long])
1483 if test x"$ac_strtoll" = xno || test x"$ac_strtoull" = xno; then
1484 enable_long_long=no;
1486 AC_MSG_RESULT($enable_long_long)
1488 dnl Option parsed, now set things appropriately
1489 if test x"$enable_long_long" = xyes; then
1490 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1496 dnl Check for whether or not to do shadowed C headers.
1498 dnl GLIBCPP_ENABLE_SHADOW
1499 dnl --enable-cshadow-headers [does stuff].
1500 dnl --disable-cshadow-headers [does not do stuff].
1501 dnl + This will eventually need to be on by default.
1502 dnl + Usage: GLIBCPP_ENABLE_SHADOW[(DEFAULT)]
1503 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1504 dnl defaults to `no'.
1505 AC_DEFUN(GLIBCPP_ENABLE_SHADOW, [dnl
1506 define([GLIBCPP_ENABLE_SHADOW_DEFAULT], ifelse($1, yes, yes, no))dnl
1507 AC_MSG_CHECKING([for enabled cshadow headers])
1508 AC_ARG_ENABLE(cshadow-headers,
1509 changequote(<<, >>)dnl
1510 << --enable-cshadow-headers construct "shadowed" C header files for
1511 g++ [default=>>GLIBCPP_ENABLE_SHADOW_DEFAULT],
1513 [case "$enableval" in
1514 yes) enable_cshadow_headers=yes
1516 no) enable_cshadow_headers=no
1518 *) AC_MSG_ERROR([Unknown argument to enable/disable shadowed C headers])
1521 enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)
1522 AC_MSG_RESULT($enable_cshadow_headers)
1524 dnl Option parsed, now set things appropriately
1525 dnl NB: these things may be duplicated in c++config.h as well.
1526 case "$enable_cshadow_headers" in
1528 CSHADOW_FLAGS="-fno-builtin"
1529 C_INCLUDE_DIR='${top_srcdir}/include/c_std'
1530 AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
1534 C_INCLUDE_DIR='${top_srcdir}/include/c'
1538 AC_SUBST(CSHADOW_FLAGS)
1539 AC_SUBST(C_INCLUDE_DIR)
1540 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cshadow_headers" = yes)
1545 dnl Check for wide character support. Has the same effect as the option
1546 dnl in gcc's configure, but in a form that autoconf can mess with.
1548 dnl GLIBCPP_ENABLE_C_MBCHAR
1549 dnl --enable-c-mbchar requests all the wchar_t stuff.
1550 dnl --disable-c-mbchar doesn't.
1551 dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1552 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1553 dnl defaults to `no'.
1554 AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1555 define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1556 AC_ARG_ENABLE(c-mbchar,
1557 changequote(<<, >>)dnl
1558 << --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1559 changequote([, ])dnl
1560 [case "$enableval" in
1561 yes) enable_c_mbchar=yes ;;
1562 no) enable_c_mbchar=no ;;
1563 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1565 enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1566 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1571 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1573 dnl GLIBCPP_INCLUDE_DIR
1575 dnl TOPLEVEL_INCLUDES
1576 dnl LIBMATH_INCLUDES
1577 dnl LIBSUPCXX_INCLUDES
1579 dnl CSHADOW_INCLUDES
1581 dnl GLIBCPP_EXPORT_INCLUDE
1582 AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1583 # Root level of the include sources.
1584 GLIBCPP_INCLUDE_DIR='$(top_srcdir)/include'
1586 # Can either use include/c or include/c_std to grab "C" headers. This
1587 # variable is set to the include directory currently in use.
1588 # set with C_INCLUDE_DIR in GLIBCPP_ENABLE_SHADOW
1590 # Passed down for cross compilers, canadian crosses.
1591 TOPLEVEL_INCLUDES='-I$(includedir)'
1593 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1595 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1597 #if GLIBCPP_NEED_LIBIO
1598 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1600 #LIBIO_INCLUDES='-I$(top_srcdir)/libio'
1603 #if GLIBCPP_USE_CSHADOW
1604 # CSHADOW_INCLUDES='-I$(GLIBCPP_INCLUDE_DIR)/std -I$(C_INCLUDE_DIR) \
1605 # -I$(top_blddir)/cshadow'
1607 CSHADOW_INCLUDES='-I$(GLIBCPP_INCLUDE_DIR)/std -I$(C_INCLUDE_DIR)'
1610 # Now, export this to all the little Makefiles....
1611 AC_SUBST(GLIBCPP_INCLUDE_DIR)
1612 AC_SUBST(TOPLEVEL_INCLUDES)
1613 AC_SUBST(LIBMATH_INCLUDES)
1614 AC_SUBST(LIBSUPCXX_INCLUDES)
1615 AC_SUBST(LIBIO_INCLUDES)
1616 AC_SUBST(CSHADOW_INCLUDES)
1621 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1623 AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1624 # Optimization flags that are probably a good idea for thrill-seekers. Just
1625 # uncomment the lines below and make, everything else is ready to go...
1626 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1628 AC_SUBST(OPTIMIZE_CXXFLAGS)
1630 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1631 AC_SUBST(WARN_FLAGS)
1635 # Check whether LC_MESSAGES is available in <locale.h>.
1636 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1638 # This file file be copied and used freely without restrictions. It can
1639 # be used in projects which are not available under the GNU Public License
1640 # but which still want to provide support for the GNU gettext functionality.
1641 # Please note that the actual code is *not* freely available.
1645 AC_DEFUN(AC_LC_MESSAGES,
1646 [if test $ac_cv_header_locale_h = yes; then
1647 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1648 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1649 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1650 if test $ac_cv_val_LC_MESSAGES = yes; then
1651 AC_DEFINE(HAVE_LC_MESSAGES)
1656 # Check for functions in math library.
1657 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1659 # This file can be copied and used freely without restrictions. It can
1660 # be used in projects which are not available under the GNU Public License
1661 # but which still want to provide support for the GNU gettext functionality.
1662 # Please note that the actual code is *not* freely available.
1666 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1667 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1668 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1669 AC_SUBST(LIBMATHOBJS)dnl
1673 # Check for string functions.
1674 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1676 # This file can be copied and used freely without restrictions. It can
1677 # be used in projects which are not available under the GNU Public License
1678 # but which still want to provide support for the GNU gettext functionality.
1679 # Please note that the actual code is *not* freely available.
1683 dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1684 AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1685 [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1686 AC_SUBST(LIBSTRINGOBJS)dnl
1690 dnl This macro searches for a GNU version of make. If a match is found, the
1691 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1692 dnl set to "#". This is useful for including a special features in a Makefile,
1693 dnl which cannot be handled by other versions of make. The variable
1694 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1695 dnl the empty string otherwise.
1697 dnl Here is an example of its use:
1699 dnl Makefile.in might contain:
1701 dnl # A failsafe way of putting a dependency rule into a makefile
1703 dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1705 dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1706 dnl @ifGNUmake@ include $(DEPEND)
1707 dnl @ifGNUmake@ endif
1709 dnl Then configure.in would normally contain:
1711 dnl CHECK_GNU_MAKE()
1712 dnl AC_OUTPUT(Makefile)
1714 dnl Then perhaps to cause gnu make to override any other make, we could do
1715 dnl something like this (note that GNU make always looks for GNUmakefile first):
1717 dnl if ! test x$_cv_gnu_make_command = x ; then
1718 dnl mv Makefile GNUmakefile
1719 dnl echo .DEFAULT: > Makefile ;
1720 dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1723 dnl Then, if any (well almost any) other make is called, and GNU make also
1724 dnl exists, then the other make wraps the GNU make.
1726 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1727 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
1729 dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1730 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1731 dnl #### conditional's subshell (" --version" is not a command), using a
1732 dnl #### different option to grep(1).
1735 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1736 _cv_gnu_make_command='' ;
1737 dnl Search all the common names for GNU make
1738 for a in "${MAKE:-make}" make gmake gnumake ; do
1739 if ( $a --version 2> /dev/null | grep -c GNU )
1741 _cv_gnu_make_command=$a ;
1746 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1747 dnl string, '#' otherwise
1748 if test "x$_cv_gnu_make_command" != "x" ; then
1756 sinclude(../libtool.m4)
1757 dnl The lines below arrange for aclocal not to bring an installed
1758 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1759 dnl add a definition of LIBTOOL to Makefile.in.
1760 ifelse(,,,[AC_SUBST(LIBTOOL)
1761 AC_DEFUN([AM_PROG_LIBTOOL])
1762 AC_DEFUN([AC_LIBTOOL_DLOPEN])
1763 AC_DEFUN([AC_PROG_LD])
1767 # Do all the work for Automake. This macro actually does too much --
1768 # some checks are only needed if your package does certain things.
1769 # But this isn't really a big deal.
1774 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
1776 AC_DEFUN(AM_INIT_AUTOMAKE,
1777 [AC_REQUIRE([AC_PROG_INSTALL])
1782 dnl test to see if srcdir already configured
1783 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
1784 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1787 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
1788 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
1789 AC_REQUIRE([AM_SANITY_CHECK])
1790 AC_REQUIRE([AC_ARG_PROGRAM])
1791 dnl FIXME This is truly gross.
1792 missing_dir=`cd $ac_aux_dir && pwd`
1793 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
1794 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
1795 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
1796 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
1797 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
1798 AC_REQUIRE([AC_PROG_MAKE_SET])])
1801 # Check to make sure that the build environment is sane.
1804 AC_DEFUN(AM_SANITY_CHECK,
1805 [AC_MSG_CHECKING([whether build environment is sane])
1808 echo timestamp > conftestfile
1809 # Do `set' in a subshell so we don't clobber the current shell's
1810 # arguments. Must try -L first in case configure is actually a
1811 # symlink; some systems play weird games with the mod time of symlinks
1812 # (eg FreeBSD returns the mod time of the symlink's containing
1815 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
1816 if test "[$]*" = "X"; then
1818 set X `ls -t $srcdir/configure conftestfile`
1820 if test "[$]*" != "X $srcdir/configure conftestfile" \
1821 && test "[$]*" != "X conftestfile $srcdir/configure"; then
1823 # If neither matched, then we have a broken ls. This can happen
1824 # if, for instance, CONFIG_SHELL is bash and it inherits a
1825 # broken ls alias from the environment. This has actually
1826 # happened. Such a system could not be considered "sane".
1827 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
1828 alias in your environment])
1831 test "[$]2" = conftestfile
1837 AC_MSG_ERROR([newly created file is older than distributed files!
1838 Check your system clock])
1841 AC_MSG_RESULT(yes)])
1843 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
1844 dnl The program must properly implement --version.
1845 AC_DEFUN(AM_MISSING_PROG,
1846 [AC_MSG_CHECKING(for working $2)
1847 # Run test in a subshell; some versions of sh will print an error if
1848 # an executable is not found, even if stderr is redirected.
1849 # Redirect stdin to placate older versions of autoconf. Sigh.
1850 if ($2 --version) < /dev/null > /dev/null 2>&1; then
1852 AC_MSG_RESULT(found)
1855 AC_MSG_RESULT(missing)
1859 # Add --enable-maintainer-mode option to configure.
1864 AC_DEFUN(AM_MAINTAINER_MODE,
1865 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1866 dnl maintainer-mode is disabled by default
1867 AC_ARG_ENABLE(maintainer-mode,
1868 [ --enable-maintainer-mode enable make rules and dependencies not useful
1869 (and sometimes confusing) to the casual installer],
1870 USE_MAINTAINER_MODE=$enableval,
1871 USE_MAINTAINER_MODE=no)
1872 AC_MSG_RESULT($USE_MAINTAINER_MODE)
1873 AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
1874 MAINT=$MAINTAINER_MODE_TRUE
1879 # Define a conditional.
1881 AC_DEFUN(AM_CONDITIONAL,
1892 # Like AC_CONFIG_HEADER, but automatically create stamp file.
1894 AC_DEFUN(AM_CONFIG_HEADER,
1896 AC_CONFIG_HEADER([$1])
1897 dnl When config.status generates a header, we must update the stamp-h file.
1898 dnl This file resides in the same directory as the config header
1899 dnl that is generated. We must strip everything past the first ":",
1900 dnl and everything past the last "/".
1901 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
1902 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
1903 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
1905 for am_file in <<$1>>; do
1906 case " <<$>>CONFIG_HEADERS " in
1907 *" <<$>>am_file "*<<)>>
1908 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
1911 am_indx=`expr "<<$>>am_indx" + 1`