1 dnl aclocal.m4 generated automatically by aclocal 1.4-p5
3 dnl Copyright (C) 1994, 1995-8, 1999, 2001 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.
17 AC_DEFUN(GLIBCPP_CONFIGURE, [
18 dnl Default to --enable-multilib
19 AC_ARG_ENABLE(multilib,
20 [ --enable-multilib build hella library versions (default)],
21 [case "${enableval}" in
24 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
25 esac], [multilib=yes])dnl
27 # When building with srcdir == objdir, links to the source files will
28 # be created in directories within the target_subdir. We have to
29 # adjust toplevel_srcdir accordingly, so that configure finds
30 # install-sh and other auxiliary files that live in the top-level
32 if test "${srcdir}" = "."; then
33 if test -z "${with_target_subdir}"; then
36 if test "${with_target_subdir}" != "."; then
37 toprel="${with_multisrctop}../.."
39 toprel="${with_multisrctop}.."
45 AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
46 toplevel_srcdir=\${top_srcdir}/$toprel
47 AC_SUBST(toplevel_srcdir)
49 # Export build and source directories.
50 # These need to be absolute paths, yet at the same time need to
51 # canonicalize only relative paths, because then amd will not unmount
52 # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
53 glibcpp_builddir=`pwd`
55 [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
56 *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
58 AC_SUBST(glibcpp_builddir)
59 AC_SUBST(glibcpp_srcdir)
61 dnl This is here just to satisfy automake.
62 ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)])
65 # Will set LN_S to either 'ln -s' or 'ln'. With autoconf 2.50+, can also
66 # be 'cp -p' if linking isn't available.
67 #ac_cv_prog_LN_S='cp -p'
70 # We use these options to decide which functions to include.
71 AC_ARG_WITH(target-subdir,
72 [ --with-target-subdir=SUBDIR
73 configuring in a subdirectory])
74 AC_ARG_WITH(cross-host,
75 [ --with-cross-host=HOST configuring with a cross compiler])
77 glibcpp_basedir=$srcdir/$toprel/$1/libstdc++-v3
78 AC_SUBST(glibcpp_basedir)
80 # Never versions of autoconf add an underscore to these functions.
81 # Prevent future problems ...
82 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
83 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
84 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
85 ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
89 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
90 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
91 # are probably using a cross compiler, which will not be able to fully
92 # link an executable. This should really be fixed in autoconf
95 AC_DEFUN(LIB_AC_PROG_CC,
96 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
97 dnl Fool anybody using AC_PROG_CC.
98 AC_PROVIDE([AC_PROG_CC])
99 AC_CHECK_PROG(CC, gcc, gcc)
100 if test -z "$CC"; then
101 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
102 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
107 if test $ac_cv_prog_gcc = yes; then
109 dnl Check whether -g works, even if CFLAGS is set, in case the package
110 dnl plays around with CFLAGS (such as to build both debugging and
111 dnl normal versions of a library), tasteless as that idea is.
112 ac_test_CFLAGS="${CFLAGS+set}"
113 ac_save_CFLAGS="$CFLAGS"
116 if test "$ac_test_CFLAGS" = set; then
117 CFLAGS="$ac_save_CFLAGS"
118 elif test $ac_cv_prog_cc_g = yes; then
125 test "${CFLAGS+set}" = set || CFLAGS="-g"
131 # Can't just call these here as g++ requires libstc++ to be built....
134 # Likewise for AC_PROG_CXX.
135 AC_DEFUN(LIB_AC_PROG_CXX,
136 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
137 dnl Fool anybody using AC_PROG_CXX.
138 AC_PROVIDE([AC_PROG_CXX])
139 # Use glibcpp_CXX so that we do not cause CXX to be cached with the
140 # flags that come in CXX while configuring libstdc++. They're different
141 # from those used for all other target libraries. If CXX is set in
142 # the environment, respect that here.
144 AC_CHECK_PROGS(glibcpp_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
145 AC_SUBST(glibcpp_CXX)
147 test -z "$glibcpp_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
151 if test $ac_cv_prog_gxx = yes; then
153 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
154 dnl plays around with CXXFLAGS (such as to build both debugging and
155 dnl normal versions of a library), tasteless as that idea is.
156 ac_test_CXXFLAGS="${CXXFLAGS+set}"
157 ac_save_CXXFLAGS="$CXXFLAGS"
160 if test "$ac_test_CXXFLAGS" = set; then
161 CXXFLAGS="$ac_save_CXXFLAGS"
162 elif test $ac_cv_prog_cxx_g = yes; then
169 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
175 # For some reason, gettext needs this.
178 AC_CHECK_TOOL(AS, as)
179 AC_CHECK_TOOL(AR, ar)
180 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
185 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
186 # at least currently, we never actually build a program, so we never
187 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
188 # fails, because we are probably configuring with a cross compiler
189 # which can't create executables. So we include AC_EXEEXT to keep
190 # automake happy, but we don't execute it, since we don't care about
193 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
194 # to nothing, so nothing would remain between `then' and `fi' if it
195 # were not for the `:' below.
200 . [$]{glibcpp_basedir}/configure.host
202 case [$]{glibcpp_basedir} in
203 /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
204 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
207 # This does for the target what configure.host does for the host. In
208 # addition to possibly modifying the same flags, it also sets up symlinks.
216 dnl Check to see if g++ can compile this library, and if so, if any version-
217 dnl specific precautions need to be taken.
219 dnl GLIBCPP_CHECK_COMPILER_VERSION
220 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
221 if test ! -f stamp-sanity-compiler; then
222 AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3])
229 ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to GCC 3.0 or above]))
231 AC_MSG_RESULT($gpp_satisfactory)
232 touch stamp-sanity-compiler
238 dnl Tests for newer compiler features, or features that are present in newer
239 dnl compiler versions but not older compiler versions still in use, should
242 dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
243 dnl new inlining code or the new system_header pragma will die on -Werror.
244 dnl Leave it out by default and use maint-mode to use it.
246 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
247 dnl compiler supports it and the user has not requested debug mode.
249 dnl GLIBCPP_CHECK_COMPILER_FEATURES
250 AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
251 # All these tests are for C++; save the language and the compiler flags.
252 # The CXXFLAGS thing is suspicious, but based on similar bits previously
253 # found in GLIBCPP_CONFIGURE.
256 ac_test_CXXFLAGS="${CXXFLAGS+set}"
257 ac_save_CXXFLAGS="$CXXFLAGS"
259 # Check for maintainer-mode bits.
260 if test x"$USE_MAINTAINER_MODE" = xno; then
266 # Check for -ffunction-sections -fdata-sections
267 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
268 CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
269 AC_TRY_COMPILE(, [int foo;
270 ], [ac_fdsections=yes], [ac_fdsections=no])
271 if test "$ac_test_CXXFLAGS" = set; then
272 CXXFLAGS="$ac_save_CXXFLAGS"
274 # this is the suspicious part
277 if test x"$ac_fdsections" = x"yes" &&
278 test x"$enable_debug" = x"no"; then
279 SECTION_FLAGS='-ffunction-sections -fdata-sections'
281 AC_MSG_RESULT($ac_fdsections)
285 AC_SUBST(SECTION_FLAGS)
290 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
291 dnl the native linker is in use, all variables will be defined to something
292 dnl safe (like an empty string).
294 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
295 dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
296 dnl Define LD, with_gnu_ld, and (possibly) glibcpp_gnu_ld_version as
297 dnl side-effects of testing.
299 dnl GLIBCPP_CHECK_LINKER_FEATURES
300 AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
301 # If we're not using GNU ld, then there's no point in even trying these
302 # tests. Check for that first. We should have already tested for gld
303 # by now (in libtool), but require it now just to be safe...
304 test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
305 test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
306 AC_REQUIRE([AC_PROG_LD])
308 # The name set by libtool depends on the version of libtool. Shame on us
309 # for depending on an impl detail, but c'est la vie. Older versions used
310 # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
311 # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
312 # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
313 # set (hence we're using an older libtool), then set it.
314 if test x${with_gnu_ld+set} != xset; then
315 if test x${ac_cv_prog_gnu_ld+set} != xset; then
316 # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
319 with_gnu_ld=$ac_cv_prog_gnu_ld
323 # Start by getting the version number. I think the libtool test already
324 # does some of this, but throws away the result.
326 ldver=`$LD --version 2>/dev/null | head -1 | \
327 sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
329 glibcpp_gnu_ld_version=`echo $ldver | \
330 $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
333 if test "$with_gnu_ld" = "notbroken"; then
334 # GNU ld it is! Joy and bunny rabbits!
336 # All these tests are for C++; save the language and the compiler flags.
337 # Need to do this so that g++ won't try to link in libstdc++
338 ac_test_CFLAGS="${CFLAGS+set}"
339 ac_save_CFLAGS="$CFLAGS"
340 CFLAGS='-x c++ -Wl,--gc-sections'
342 # Check for -Wl,--gc-sections
343 # XXX This test is broken at the moment, as symbols required for
344 # linking are now in libsupc++ (not built yet.....). In addition,
345 # this test has cored on solaris in the past. In addition,
346 # --gc-sections doesn't really work at the moment (keeps on discarding
347 # used sections, first .eh_frame and now some of the glibc sections for
348 # iconv). Bzzzzt. Thanks for playing, maybe next time.
349 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
357 ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
358 if test "$ac_test_CFLAGS" = set; then
359 CFLAGS="$ac_save_CFLAGS"
361 # this is the suspicious part
364 if test "$ac_sectionLDflags" = "yes"; then
365 SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
367 AC_MSG_RESULT($ac_sectionLDflags)
370 # Set linker optimization flags.
371 if test x"$with_gnu_ld" = x"yes" && test x"$enable_debug" = x"no"; then
372 OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
375 AC_SUBST(SECTION_LDFLAGS)
376 AC_SUBST(OPT_LDFLAGS)
381 dnl Check to see if the (math function) argument passed is
382 dnl declared when using the c++ compiler
383 dnl ASSUMES argument is a math function with ONE parameter
385 dnl GLIBCPP_CHECK_MATH_DECL_1
386 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [
387 AC_MSG_CHECKING([for $1 declaration])
388 if test x${glibcpp_cv_func_$1_use+set} != xset; then
389 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
392 AC_TRY_COMPILE([#include <math.h>
398 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
402 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
406 dnl Check to see if the (math function) argument passed is
407 dnl 1) declared when using the c++ compiler
408 dnl 2) has "C" linkage
409 dnl 3) if not, see if 1) and 2) for argument prepended with '_'
411 dnl Define HAVE_CARGF etc if "cargf" is declared and links
413 dnl argument 1 is name of function to check
415 dnl ASSUMES argument is a math function with ONE parameter
417 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
418 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
419 GLIBCPP_CHECK_MATH_DECL_1($1)
420 if test x$glibcpp_cv_func_$1_use = x"yes"; then
423 GLIBCPP_CHECK_MATH_DECL_1(_$1)
424 if test x$glibcpp_cv_func__$1_use = x"yes"; then
432 dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
433 dnl of functions at once. It's an all-or-nothing check -- either
434 dnl HAVE_XYZ is defined for each of the functions, or for none of them.
435 dnl Doing it this way saves significant configure time.
436 AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [
437 AC_MSG_CHECKING([for $1 functions])
438 AC_CACHE_VAL(glibcpp_cv_func_$2_use, [
441 AC_TRY_COMPILE([#include <math.h>],
442 [ `for x in $3; do echo "$x (0);"; done` ],
443 [glibcpp_cv_func_$2_use=yes],
444 [glibcpp_cv_func_$2_use=no])
446 AC_MSG_RESULT($glibcpp_cv_func_$2_use)
447 if test x$glibcpp_cv_func_$2_use = x"yes"; then
453 dnl Check to see if the (math function) argument passed is
454 dnl declared when using the c++ compiler
455 dnl ASSUMES argument is a math function with TWO parameters
457 dnl GLIBCPP_CHECK_MATH_DECL_2
458 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [
459 AC_MSG_CHECKING([for $1 declaration])
460 if test x${glibcpp_cv_func_$1_use+set} != xset; then
461 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
464 AC_TRY_COMPILE([#include <math.h>],
466 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
470 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
474 dnl Check to see if the (math function) argument passed is
475 dnl 1) declared when using the c++ compiler
476 dnl 2) has "C" linkage
478 dnl Define HAVE_CARGF etc if "cargf" is declared and links
480 dnl argument 1 is name of function to check
482 dnl ASSUMES argument is a math function with TWO parameters
484 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
485 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
486 GLIBCPP_CHECK_MATH_DECL_2($1)
487 if test x$glibcpp_cv_func_$1_use = x"yes"; then
490 GLIBCPP_CHECK_MATH_DECL_2(_$1)
491 if test x$glibcpp_cv_func__$1_use = x"yes"; then
499 dnl Check to see if the (math function) argument passed is
500 dnl declared when using the c++ compiler
501 dnl ASSUMES argument is a math function with THREE parameters
503 dnl GLIBCPP_CHECK_MATH_DECL_3
504 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [
505 AC_MSG_CHECKING([for $1 declaration])
506 if test x${glibcpp_cv_func_$1_use+set} != xset; then
507 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
510 AC_TRY_COMPILE([#include <math.h>],
512 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
516 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
520 dnl Check to see if the (math function) argument passed is
521 dnl 1) declared when using the c++ compiler
522 dnl 2) has "C" linkage
524 dnl Define HAVE_CARGF etc if "cargf" is declared and links
526 dnl argument 1 is name of function to check
528 dnl ASSUMES argument is a math function with THREE parameters
530 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
531 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
532 GLIBCPP_CHECK_MATH_DECL_3($1)
533 if test x$glibcpp_cv_func_$1_use = x"yes"; then
536 GLIBCPP_CHECK_MATH_DECL_3(_$1)
537 if test x$glibcpp_cv_func__$1_use = x"yes"; then
545 dnl Check to see if the (stdlib function) argument passed is
546 dnl 1) declared when using the c++ compiler
547 dnl 2) has "C" linkage
549 dnl argument 1 is name of function to check
551 dnl ASSUMES argument is a math function with TWO parameters
553 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
554 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
555 AC_MSG_CHECKING([for $1 declaration])
556 if test x${glibcpp_cv_func_$1_use+set} != xset; then
557 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
560 AC_TRY_COMPILE([#include <stdlib.h>],
562 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
566 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
567 if test x$glibcpp_cv_func_$1_use = x"yes"; then
574 dnl Because the builtins are picky picky picky about the arguments they take,
575 dnl do an explict linkage tests here.
576 dnl Check to see if the (math function) argument passed is
577 dnl 1) declared when using the c++ compiler
578 dnl 2) has "C" linkage
580 dnl Define HAVE_CARGF etc if "cargf" is declared and links
582 dnl argument 1 is name of function to check
584 dnl ASSUMES argument is a math function with ONE parameter
586 dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
587 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
588 AC_MSG_CHECKING([for $1 declaration])
589 if test x${glibcpp_cv_func_$1_use+set} != xset; then
590 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
593 AC_TRY_COMPILE([#include <math.h>],
595 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
599 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
600 if test x$glibcpp_cv_func_$1_use = x"yes"; then
601 AC_MSG_CHECKING([for $1 linkage])
602 if test x${glibcpp_cv_func_$1_link+set} != xset; then
603 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
604 AC_TRY_LINK([#include <math.h>],
606 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
609 AC_MSG_RESULT($glibcpp_cv_func_$1_link)
610 if test x$glibcpp_cv_func_$1_link = x"yes"; then
611 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
612 AC_DEFINE_UNQUOTED(${ac_tr_func})
619 dnl Check to see what builtin math functions are supported
621 dnl check for __builtin_abs
622 dnl check for __builtin_fabsf
623 dnl check for __builtin_fabs
624 dnl check for __builtin_fabl
625 dnl check for __builtin_labs
626 dnl check for __builtin_sqrtf
627 dnl check for __builtin_sqrtl
628 dnl check for __builtin_sqrt
629 dnl check for __builtin_sinf
630 dnl check for __builtin_sin
631 dnl check for __builtin_sinl
632 dnl check for __builtin_cosf
633 dnl check for __builtin_cos
634 dnl check for __builtin_cosl
636 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
637 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
638 dnl Test for builtin math functions.
639 dnl These are made in gcc/c-common.c
640 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
641 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
642 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
643 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
644 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
646 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
647 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrt)
648 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
650 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
651 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
652 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
654 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
655 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
656 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
658 dnl There is, without a doubt, a more elegant way to have these
659 dnl names exported so that they won't be stripped out of acconfig.h by
660 dnl autoheader. I leave this as an exercise to somebody less frustrated
661 dnl than I.... please email the libstdc++ list if you can figure out a
662 dnl more elegant approach (see autoconf/acgen.m4 and specifically
663 dnl AC_CHECK_FUNC for things to steal.)
665 if test x$dummyvar = x"yes"; then
666 AC_DEFINE(HAVE___BUILTIN_ABS)
667 AC_DEFINE(HAVE___BUILTIN_LABS)
668 AC_DEFINE(HAVE___BUILTIN_COS)
669 AC_DEFINE(HAVE___BUILTIN_COSF)
670 AC_DEFINE(HAVE___BUILTIN_COSL)
671 AC_DEFINE(HAVE___BUILTIN_FABS)
672 AC_DEFINE(HAVE___BUILTIN_FABSF)
673 AC_DEFINE(HAVE___BUILTIN_FABSL)
674 AC_DEFINE(HAVE___BUILTIN_SIN)
675 AC_DEFINE(HAVE___BUILTIN_SINF)
676 AC_DEFINE(HAVE___BUILTIN_SINL)
677 AC_DEFINE(HAVE___BUILTIN_SQRT)
678 AC_DEFINE(HAVE___BUILTIN_SQRTF)
679 AC_DEFINE(HAVE___BUILTIN_SQRTL)
685 dnl Check to see what the underlying c library
686 dnl These checks need to do two things:
687 dnl 1) make sure the name is declared when using the c++ compiler
688 dnl 2) make sure the name has "C" linkage
689 dnl This might seem like overkill but experience has shown that it's not...
691 dnl Define HAVE_STRTOLD if "strtold" is declared and links
692 dnl Define HAVE_STRTOF if "strtof" is declared and links
693 dnl Define HAVE_DRAND48 if "drand48" is declared and links
695 dnl GLIBCPP_CHECK_STDLIB_SUPPORT
696 AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
697 ac_test_CXXFLAGS="${CXXFLAGS+set}"
698 ac_save_CXXFLAGS="$CXXFLAGS"
699 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
701 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
702 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof)
703 AC_CHECK_FUNCS(drand48)
705 CXXFLAGS="$ac_save_CXXFLAGS"
710 dnl Check to see what the underlying c library or math library is like.
711 dnl These checks need to do two things:
712 dnl 1) make sure the name is declared when using the c++ compiler
713 dnl 2) make sure the name has "C" linkage
714 dnl This might seem like overkill but experience has shown that it's not...
716 dnl Define HAVE_CARGF etc if "cargf" is found.
718 dnl GLIBCPP_CHECK_MATH_SUPPORT
719 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
720 ac_test_CXXFLAGS="${CXXFLAGS+set}"
721 ac_save_CXXFLAGS="$CXXFLAGS"
722 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
725 AC_CHECK_LIB(m, sin, libm="-lm")
729 dnl Check to see if certain C math functions exist.
730 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
731 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
732 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
733 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
734 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
735 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
736 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
737 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypot)
739 dnl Check to see if basic C math functions have float versions.
740 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig,
745 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
748 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
749 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
750 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
751 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
752 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
753 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
754 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf)
755 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
756 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
757 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
758 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
759 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
760 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
761 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
762 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
764 dnl Check to see if basic C math functions have long double versions.
765 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig,
770 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round,
773 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
774 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
775 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
776 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
777 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
778 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
779 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
780 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
781 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl)
782 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
783 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
784 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
785 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
786 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
787 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
788 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
789 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
791 dnl Some runtimes have these functions with a preceding underscore. Please
792 dnl keep this sync'd with the one above. And if you add any new symbol,
793 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
794 dnl Check to see if certain C math functions exist.
796 dnl Check to see if basic C math functions have float versions.
797 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
799 _acosf _asinf _atanf \
801 _coshf _sinhf _tanhf)
802 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
806 dnl Check to see if basic C math functions have long double versions.
807 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
809 _acosl _asinl _atanl \
811 _coshl _sinhl _tanhl)
812 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
817 CXXFLAGS="$ac_save_CXXFLAGS"
822 dnl Check to see if there is native support for complex
824 dnl Don't compile bits in math/* if native support exits.
826 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "copysignl" is found.
828 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
829 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
830 dnl Check for complex versions of math functions of platform.
831 AC_CHECK_LIB(m, main)
832 AC_REPLACE_MATHFUNCS(nan copysignf)
834 dnl Compile the long double complex functions only if the function
835 dnl provides the non-complex long double functions that are needed.
836 dnl Currently this includes copysignl, which should be
837 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
838 USE_COMPLEX_LONG_DOUBLE=no
839 if test x$ac_cv_func_copysignl = x"yes"; then
840 USE_COMPLEX_LONG_DOUBLE=yes
841 AC_REPLACE_MATHFUNCS(signbitl)
844 AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
848 dnl Check to see what architecture and operating system we are compiling
849 dnl for. Also, if architecture- or OS-specific flags are required for
850 dnl compilation, pick them up here.
852 dnl GLIBCPP_CHECK_TARGET
853 AC_DEFUN(GLIBCPP_CHECK_TARGET, [
854 . [$]{glibcpp_basedir}/configure.target
855 AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
856 AC_MSG_RESULT(OS config directory is $os_include_dir)
861 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
862 dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
863 dnl must have been previously checked.)
865 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
866 dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h
868 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
869 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
871 dnl Test wchar.h for mbstate_t, which is needed for char_traits and
872 dnl others even if wchar_t support is not on.
873 AC_MSG_CHECKING([for mbstate_t])
874 AC_TRY_COMPILE([#include <wchar.h>],
875 [mbstate_t teststate;],
876 have_mbstate_t=yes, have_mbstate_t=no)
877 AC_MSG_RESULT($have_mbstate_t)
878 if test x"$have_mbstate_t" = xyes; then
879 AC_DEFINE(HAVE_MBSTATE_T)
882 dnl Sanity check for existence of ISO C99 headers for extended encoding.
883 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
884 AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
886 dnl Only continue checking if the ISO C99 headers exist and support is on.
887 if test x"$ac_has_wchar_h" = xyes &&
888 test x"$ac_has_wctype_h" = xyes &&
889 test x"$enable_c_mbchar" != xno; then
891 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
892 dnl numeric_limits can instantiate type_traits<wchar_t>
893 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
894 AC_TRY_COMPILE([#include <wchar.h>],
895 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
896 has_wchar_minmax=yes, has_wchar_minmax=no)
897 AC_MSG_RESULT($has_wchar_minmax)
899 dnl Test wchar.h for WEOF, which is what we use to determine whether
900 dnl to specialize for char_traits<wchar_t> or not.
901 AC_MSG_CHECKING([for WEOF])
904 #include <stddef.h>],
906 has_weof=yes, has_weof=no)
907 AC_MSG_RESULT($has_weof)
909 dnl Tests for wide character functions used in char_traits<wchar_t>.
911 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset,, \
914 dnl Checks for names injected into std:: by the c_std headers.
915 AC_CHECK_FUNCS(btowc wctob fgetwc fgetwc fgetws fputwc fputws fwide \
916 fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
917 vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
918 mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
919 wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
920 wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \
923 AC_MSG_CHECKING([for ISO C99 wchar_t support])
924 if test x"$has_weof" = xyes &&
925 test x"$has_wchar_minmax" = xyes &&
926 test x"$ac_wfuncs" = xyes; then
927 ac_isoC99_wchar_t=yes
931 AC_MSG_RESULT($ac_isoC99_wchar_t)
933 dnl Use iconv for wchar_t to char conversions. As such, check for
934 dnl X/Open Portability Guide, version 2 features (XPG2).
935 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
936 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
938 dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
939 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
941 LIBS="$LIBS $libiconv"
943 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
944 ac_XPG2funcs=yes, ac_XPG2funcs=no)
948 AC_MSG_CHECKING([for XPG2 wchar_t support])
949 if test x"$ac_has_iconv_h" = xyes &&
950 test x"$ac_has_langinfo_h" = xyes &&
951 test x"$ac_XPG2funcs" = xyes; then
956 AC_MSG_RESULT($ac_XPG2_wchar_t)
958 dnl At the moment, only enable wchar_t specializations if all the
959 dnl above support is present.
960 AC_MSG_CHECKING([for enabled wchar_t specializations])
961 if test x"$ac_isoC99_wchar_t" = xyes &&
962 test x"$ac_XPG2_wchar_t" = xyes; then
963 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
969 dnl Wide characters disabled by the user.
970 AC_MSG_WARN([wchar_t support disabled.])
976 dnl Check for special debugging mode; not for production use.
978 dnl GLIBCPP_ENABLE_DEBUG
979 dnl --enable-debug sets '-ggdb3 -O0'.
980 dnl --disable-debug sets '-g' and whatever optimization options the
981 dnl compiler can handle.
982 dnl + --enable-maintainer-mode automatically defaults this to on.
983 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
984 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
985 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
986 dnl defaults to `no'.
987 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
988 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
990 changequote(<<, >>)dnl
991 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
993 [case "${enableval}" in
994 yes) enable_debug=yes ;;
995 no) enable_debug=no ;;
996 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
998 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
1000 dnl Option parsed, now set things appropriately
1001 case "${enable_debug}" in
1003 DEBUG_FLAGS='-O0 -ggdb3'
1009 AC_SUBST(DEBUG_FLAGS)
1014 dnl Check for "unusual" flags to pass to the compiler while building.
1016 dnl GLIBCPP_ENABLE_CXX_FLAGS
1017 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1018 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1019 dnl Somehow this same set of flags must be passed when [re]building
1021 dnl --disable-cxx-flags passes nothing.
1022 dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
1023 dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
1024 dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
1025 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
1026 dnl If "default flags" is an empty string (or "none"), the effect is
1027 dnl the same as --disable or --enable=no.
1028 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1029 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1030 AC_ARG_ENABLE(cxx-flags,
1031 changequote(<<, >>)dnl
1032 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
1033 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1034 changequote([, ])dnl
1035 [case "x$enableval" in
1037 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1039 enable_cxx_flags='' ;;
1041 enable_cxx_flags="$enableval" ;;
1043 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
1045 dnl Thinko on my part during design. This kludge is the workaround.
1046 if test "$enable_cxx_flags" = "none"; then
1047 enable_cxx_flags='';
1050 dnl Run through flags (either default or command-line) and set anything
1051 dnl extra (e.g., #defines) that must accompany particular g++ options.
1052 if test -n "$enable_cxx_flags"; then
1053 for f in $enable_cxx_flags; do
1057 *) # and we're trying to pass /what/ exactly?
1058 AC_MSG_ERROR([compiler flags start with a -]) ;;
1062 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1063 AC_SUBST(EXTRA_CXX_FLAGS)
1068 dnl Check for which locale library to use: gnu or generic.
1070 dnl GLIBCPP_ENABLE_CLOCALE
1071 dnl --enable-clocale=gnu sets config/locale/c_locale_gnu.cc and friends
1072 dnl --enable-clocale=generic sets config/locale/c_locale_generic.cc and friends
1074 dnl default is generic
1076 AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
1077 AC_MSG_CHECKING([for clocale to use])
1078 AC_ARG_ENABLE(clocale,
1079 [ --enable-clocale enable model for target locale package.
1080 --enable-clocale=MODEL use MODEL target-speific locale package. [default=generic]
1082 if test x$enable_clocale = xno; then
1087 enable_clocale_flag=$enable_clocale
1089 dnl Probe for locale support if no specific model is specified.
1090 dnl Default to "generic"
1091 if test x$enable_clocale_flag = xno; then
1092 case x${target_os} in
1094 AC_EGREP_CPP([_GLIBCPP_ok], [
1095 #include <features.h>
1096 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1099 ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
1101 # Test for bugs early in glibc-2.2.x series
1102 if test x$enable_clocale_flag = xgnu; then
1104 #define _GNU_SOURCE 1
1108 const char __one[] = "Äuglein Augmen";
1109 const char __two[] = "Äuglein";
1114 loc = __newlocale(1 << LC_ALL, "de_DE", 0);
1115 loc_dup = __duplocale(loc);
1116 i = __strcoll_l(__one, __two, loc);
1117 j = __strcoll_l(__one, __two, loc_dup);
1121 [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
1122 [enable_clocale_flag=generic])
1125 # ... at some point put __strxfrm_l tests in as well.
1128 enable_clocale_flag=generic
1133 dnl Set configure bits for specified locale package
1134 case x${enable_clocale_flag} in
1136 AC_MSG_RESULT(generic)
1138 # Don't use gettext.
1141 CLOCALE_H=config/locale/generic/c_locale.h
1142 CLOCALE_CC=config/locale/generic/c_locale.cc
1143 CCODECVT_H=config/locale/generic/codecvt_specializations.h
1144 CCOLLATE_CC=config/locale/generic/collate_members.cc
1145 CCTYPE_CC=config/locale/generic/ctype_members.cc
1146 CMESSAGES_H=config/locale/generic/messages_members.h
1147 CMESSAGES_CC=config/locale/generic/messages_members.cc
1148 CMONEY_CC=config/locale/generic/monetary_members.cc
1149 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1150 CTIME_CC=config/locale/generic/time_members.cc
1155 # Declare intention to use gettext, and add support for specific
1157 # For some reason, ALL_LINGUAS has to be before AM_GNU_GETTEXT
1159 # Don't call AM_GNU_GETTEXT here. Instead, assume glibc.
1160 # Need to deal with MSGFMT, USE_NLS, and glibcpp_[P,M]OFILES
1163 # Export the build objects.
1164 for ling in $ALL_LINGUAS; do \
1165 glibcpp_MOFILES="$glibcpp_MOFILES $ling.mo"; \
1166 glibcpp_POFILES="$glibcpp_POFILES $ling.po"; \
1168 AC_SUBST(glibcpp_MOFILES)
1169 AC_SUBST(glibcpp_POFILES)
1171 CLOCALE_H=config/locale/gnu/c_locale.h
1172 CLOCALE_CC=config/locale/gnu/c_locale.cc
1173 CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1174 CCOLLATE_CC=config/locale/gnu/collate_members.cc
1175 CCTYPE_CC=config/locale/gnu/ctype_members.cc
1176 CMESSAGES_H=config/locale/gnu/messages_members.h
1177 CMESSAGES_CC=config/locale/gnu/messages_members.cc
1178 CMONEY_CC=config/locale/gnu/monetary_members.cc
1179 CNUMERIC_CC=config/locale/gnu/numeric_members.cc
1180 CTIME_CC=config/locale/gnu/time_members.cc
1183 AC_MSG_RESULT(generic)
1185 # Don't use gettext.
1188 CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h
1189 CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc
1190 CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1191 CCOLLATE_CC=config/locale/generic/collate_members.cc
1192 CCTYPE_CC=config/locale/generic/ctype_members.cc
1193 CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h
1194 CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc
1195 CMONEY_CC=config/locale/generic/monetary_members.cc
1196 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1197 CTIME_CC=config/locale/generic/time_members.cc
1200 echo "$enable_clocale is an unknown locale package" 1>&2
1205 # This is where the testsuite looks for locale catalogs, using the
1206 # -DLOCALEDIR define during testsuite compilation.
1207 glibcpp_localedir=${glibcpp_builddir}/po/share/locale
1208 AC_SUBST(glibcpp_localedir)
1212 AC_SUBST(CCODECVT_H)
1213 AC_SUBST(CMESSAGES_H)
1214 AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
1215 AC_LINK_FILES($CCOLLATE_CC, src/collate.cc)
1216 AC_LINK_FILES($CCTYPE_CC, src/ctype.cc)
1217 AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
1218 AC_LINK_FILES($CMONEY_CC, src/monetary.cc)
1219 AC_LINK_FILES($CNUMERIC_CC, src/numeric.cc)
1220 AC_LINK_FILES($CTIME_CC, src/time.cc)
1225 dnl Check for which I/O library to use: libio, or something specific.
1227 dnl GLIBCPP_ENABLE_CSTDIO
1228 dnl --enable-cstdio=libio sets config/io/c_io_libio.h and friends
1230 dnl default is stdio
1232 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1233 AC_MSG_CHECKING([for cstdio to use])
1234 AC_ARG_ENABLE(cstdio,
1235 [ --enable-cstdio enable stdio for target io package.
1236 --enable-cstdio=LIB use LIB target-speific io package. [default=stdio]
1238 if test x$enable_cstdio = xno; then
1241 enable_cstdio=stdio)
1243 enable_cstdio_flag=$enable_cstdio
1245 dnl Check if a valid I/O package
1246 case x${enable_cstdio_flag} in
1248 CSTDIO_H=config/io/c_io_libio.h
1249 BASIC_FILE_H=config/io/basic_file_libio.h
1250 BASIC_FILE_CC=config/io/basic_file_libio.cc
1251 AC_MSG_RESULT(libio)
1253 # see if we are on a system with libio native (ie, linux)
1254 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1256 # Need to check and see what version of glibc is being used. If
1257 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1258 # compile most of libio for linux systems.
1259 if test x$has_libio = x"yes"; then
1262 AC_MSG_CHECKING([for glibc version >= 2.2])
1263 AC_EGREP_CPP([ok], [
1264 #include <features.h>
1265 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1268 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1269 AC_MSG_RESULT($glibc_satisfactory)
1273 # XXX at the moment, admit defeat and force the recompilation
1274 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
1275 glibc_satisfactory=no
1277 if test x$glibc_satisfactory = x"yes"; then
1282 # bkoz XXX need to add checks to enable this
1283 # pme XXX here's a first pass at such a check
1284 if test x$enable_c_mbchar != xno; then
1292 # Using libio, but <libio.h> doesn't exist on the target system. . .
1294 # bkoz XXX need to add checks to enable this
1295 # pme XXX here's a first pass at such a check
1296 if test x$enable_c_mbchar != xno; then
1303 xstdio | x | xno | xnone | xyes)
1305 CSTDIO_H=config/io/c_io_stdio.h
1306 BASIC_FILE_H=config/io/basic_file_stdio.h
1307 BASIC_FILE_CC=config/io/basic_file_stdio.cc
1308 AC_MSG_RESULT(stdio)
1310 # We're not using stdio.
1315 echo "$enable_cstdio is an unknown io package" 1>&2
1320 AC_SUBST(BASIC_FILE_H)
1321 AC_LINK_FILES($BASIC_FILE_CC, src/basic_file.cc)
1323 # 2000-08-04 bkoz hack
1324 CCODECVT_C=config/io/c_io_libio_codecvt.c
1325 AC_SUBST(CCODECVT_C)
1326 # 2000-08-04 bkoz hack
1328 AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO,
1329 test "$need_libio" = yes || test "$need_wlibio" = yes)
1330 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1331 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1332 if test "$need_libio" = yes || test "$need_wlibio" = yes; then
1333 libio_la=../libio/libio.la
1342 dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
1343 dnl We must stage the required headers so that they will be installed
1344 dnl with the library (unlike libgcc, the STL implementation is provided
1345 dnl solely within headers). Since we must not inject random user-space
1346 dnl macro names into user-provided C++ code, we first stage into <file>-in
1347 dnl and process to <file> with an output command. The reason for a two-
1348 dnl stage process here is to correctly handle $srcdir!=$objdir without
1349 dnl having to write complex code (the sed commands to clean the macro
1350 dnl namespace are complex and fragile enough as it is). We must also
1351 dnl add a relative path so that -I- is supported properly.
1353 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1354 AC_MSG_CHECKING([for thread model used by GCC])
1355 target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
1356 AC_MSG_RESULT([$target_thread_file])
1358 if test $target_thread_file != single; then
1359 AC_DEFINE(HAVE_GTHR_DEFAULT)
1360 AC_DEFINE(_GLIBCPP_SUPPORTS_WEAK, __GXX_WEAK__)
1363 glibcpp_thread_h=gthr-$target_thread_file.h
1364 AC_SUBST(glibcpp_thread_h)
1369 dnl Check for exception handling support. If an explicit enable/disable
1370 dnl sjlj exceptions is given, we don't have to detect. Otherwise the
1371 dnl target may or may not support call frame exceptions.
1373 dnl GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
1374 dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
1375 dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1377 dnl Define _GLIBCPP_SJLJ_EXCEPTIONS if the compiler is configured for it.
1379 AC_DEFUN(GLIBCPP_ENABLE_SJLJ_EXCEPTIONS, [
1380 AC_MSG_CHECKING([for exception model to use])
1383 AC_ARG_ENABLE(sjlj-exceptions,
1384 [ --enable-sjlj-exceptions force use of builtin_setjmp for exceptions],
1386 [dnl Botheration. Now we've got to detect the exception model.
1387 dnl Link tests against libgcc.a are problematic since -- at least
1388 dnl as of this writing -- we've not been given proper -L bits for
1389 dnl single-tree newlib and libgloss.
1391 dnl This is what AC_TRY_COMPILE would do if it didn't delete the
1392 dnl conftest files before we got a change to grep them first.
1393 cat > conftest.$ac_ext << EOF
1394 [#]line __oline__ "configure"
1403 old_CXXFLAGS="$CXXFLAGS"
1405 if AC_TRY_EVAL(ac_compile); then
1406 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
1407 enable_sjlj_exceptions=yes
1408 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
1409 enable_sjlj_exceptions=no
1412 CXXFLAGS="$old_CXXFLAGS"
1414 if test x$enable_sjlj_exceptions = xyes; then
1415 AC_DEFINE(_GLIBCPP_SJLJ_EXCEPTIONS, 1,
1416 [Define if the compiler is configured for setjmp/longjmp exceptions.])
1417 ac_exception_model_name=sjlj
1418 elif test x$enable_sjlj_exceptions = xno; then
1419 ac_exception_model_name="call frame"
1421 AC_MSG_ERROR([unable to detect exception model])
1424 AC_MSG_RESULT($ac_exception_model_name)
1429 dnl Check for ISO/IEC 9899:1999 "C99" support.
1431 dnl GLIBCPP_ENABLE_C99
1432 dnl --enable-c99 defines _GLIBCPP_USE_C99
1433 dnl --disable-c99 leaves _GLIBCPP_USE_C99 undefined
1434 dnl + Usage: GLIBCPP_ENABLE_C99[(DEFAULT)]
1435 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1436 dnl defaults to `no'.
1437 dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
1439 dnl GLIBCPP_ENABLE_C99
1440 AC_DEFUN(GLIBCPP_ENABLE_C99, [dnl
1441 define([GLIBCPP_ENABLE_C99_DEFAULT], ifelse($1, yes, yes, no))dnl
1444 changequote(<<, >>)dnl
1445 <<--enable-c99 turns on 'ISO/IEC 9899:1999 support' [default=>>GLIBCPP_ENABLE_C99_DEFAULT],
1446 changequote([, ])dnl
1447 [case "$enableval" in
1448 yes) enable_c99=yes ;;
1449 no) enable_c99=no ;;
1450 *) AC_MSG_ERROR([Unknown argument to enable/disable C99]) ;;
1452 enable_c99=GLIBCPP_ENABLE_C99_DEFAULT)dnl
1457 # Check for the existence of <math.h> functions used if C99 is enabled.
1459 AC_MSG_CHECKING([for ISO C99 support in <math.h>])
1460 AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no])
1461 AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no])
1462 AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no])
1463 AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no])
1464 AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no])
1465 AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no])
1466 AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no])
1467 AC_TRY_COMPILE([#include <math.h>],
1468 [isgreaterequal(0.0,0.0);],, [ac_c99_math=no])
1469 AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no])
1470 AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no])
1471 AC_TRY_COMPILE([#include <math.h>],
1472 [islessgreater(0.0,0.0);],, [ac_c99_math=no])
1473 AC_TRY_COMPILE([#include <math.h>],
1474 [isunordered(0.0,0.0);],, [ac_c99_math=no])
1475 AC_MSG_RESULT($ac_c99_math)
1477 # Check for the existence in <stdio.h> of vscanf, et. al.
1479 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
1480 AC_TRY_COMPILE([#include <stdio.h>],
1481 [snprintf("12", 0, "%i");],, [ac_c99_stdio=no])
1482 AC_TRY_COMPILE([#include <stdio.h>
1484 void foo(char* fmt, ...)
1485 {va_list args; va_start(args, fmt);
1486 vfscanf(stderr, "%i", args);}],
1487 [],, [ac_c99_stdio=no])
1488 AC_TRY_COMPILE([#include <stdio.h>
1490 void foo(char* fmt, ...)
1491 {va_list args; va_start(args, fmt);
1492 vscanf("%i", args);}],
1493 [],, [ac_c99_stdio=no])
1494 AC_TRY_COMPILE([#include <stdio.h>
1496 void foo(char* fmt, ...)
1497 {va_list args; va_start(args, fmt);
1498 vsnprintf(fmt, 0, "%i", args);}],
1499 [],, [ac_c99_stdio=no])
1500 AC_TRY_COMPILE([#include <stdio.h>
1502 void foo(char* fmt, ...)
1503 {va_list args; va_start(args, fmt);
1504 vsscanf(fmt, "%i", args);}],
1505 [],, [ac_c99_stdio=no])
1506 AC_MSG_RESULT($ac_c99_stdio)
1508 # Check for the existence in <stdlib.h> of lldiv_t, et. al.
1510 AC_MSG_CHECKING([for lldiv_t declaration])
1511 AC_CACHE_VAL(ac_c99_lldiv_t, [
1512 AC_TRY_COMPILE([#include <stdlib.h>],
1514 [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no])
1516 AC_MSG_RESULT($ac_c99_lldiv_t)
1518 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
1519 AC_TRY_COMPILE([#include <stdlib.h>],
1520 [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no])
1521 AC_TRY_COMPILE([#include <stdlib.h>],
1522 [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no])
1523 AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no])
1524 AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no])
1525 AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no])
1526 AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no])
1527 if test x"$ac_c99_lldiv_t" = x"no"; then
1530 AC_MSG_RESULT($ac_c99_stdlib)
1532 # Check for the existence of <wchar.h> functions used if C99 is enabled.
1533 # XXX the wchar.h checks should be rolled into the general C99 bits.
1535 AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>])
1536 AC_TRY_COMPILE([#include <wchar.h>],
1537 [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no])
1538 AC_TRY_COMPILE([#include <wchar.h>],
1539 [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no])
1540 AC_TRY_COMPILE([#include <wchar.h>],
1541 [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no])
1542 AC_MSG_RESULT($ac_c99_wchar)
1544 AC_MSG_CHECKING([for enabled ISO C99 support])
1545 if test x"$ac_c99_math" = x"no" ||
1546 test x"$ac_c99_stdio" = x"no" ||
1547 test x"$ac_c99_stdlib" = x"no" ||
1548 test x"$ac_c99_wchar" = x"no"; then
1551 AC_MSG_RESULT($enable_c99)
1553 # Option parsed, now set things appropriately
1554 if test x"$enable_c99" = x"yes"; then
1555 AC_DEFINE(_GLIBCPP_USE_C99)
1563 dnl Check for template specializations for the 'long long' type extension.
1564 dnl The result determines only whether 'long long' I/O is enabled; things
1565 dnl like numeric_limits<> specializations are always available.
1567 dnl GLIBCPP_ENABLE_LONG_LONG
1568 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1569 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1570 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1571 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1572 dnl defaults to `no'.
1573 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1575 dnl GLIBCPP_ENABLE_LONG_LONG
1576 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1577 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1579 AC_ARG_ENABLE(long-long,
1580 changequote(<<, >>)dnl
1581 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1582 changequote([, ])dnl
1583 [case "$enableval" in
1584 yes) enable_long_long=yes ;;
1585 no) enable_long_long=no ;;
1586 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1588 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1593 AC_MSG_CHECKING([for enabled long long I/O support])
1594 # iostreams require strtoll, strtoull to compile
1595 AC_TRY_COMPILE([#include <stdlib.h>],
1596 [char* tmp; strtoll("gnu", &tmp, 10);],,[enable_long_long=no])
1597 AC_TRY_COMPILE([#include <stdlib.h>],
1598 [char* tmp; strtoull("gnu", &tmp, 10);],,[enable_long_long=no])
1600 # Option parsed, now set things appropriately
1601 if test x"$enable_long_long" = xyes; then
1602 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1604 AC_MSG_RESULT($enable_long_long)
1611 dnl Check for what kind of C headers to use.
1613 dnl GLIBCPP_ENABLE_CHEADERS
1614 dnl --enable-cheaders= [does stuff].
1615 dnl --disable-cheaders [does not do anything, really].
1616 dnl + This will eventually need to be 'c_shadow' by default.
1617 dnl + Usage: GLIBCPP_ENABLE_CHEADERS[(DEFAULT)]
1618 dnl Where DEFAULT is either `c' or `c_std' or 'c_shadow'.
1619 dnl If ommitted, it defaults to `c_std'.
1620 AC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl
1621 define([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl
1622 AC_MSG_CHECKING([for c header strategy to use])
1623 AC_ARG_ENABLE(cheaders,
1624 changequote(<<, >>)dnl
1625 << --enable-cheaders construct "C" header files for g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT],
1627 [case "$enableval" in
1632 enable_cheaders=c_std
1635 enable_cheaders=c_shadow
1637 *) AC_MSG_ERROR([Unknown argument to enable/disable "C" headers])
1640 enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT)
1641 AC_MSG_RESULT($enable_cheaders)
1643 dnl Option parsed, now set things appropriately
1644 case "$enable_cheaders" in
1646 CSHADOW_FLAGS="-fno-builtin"
1647 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_shadow'
1648 AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
1652 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_std'
1656 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c'
1660 AC_SUBST(CSHADOW_FLAGS)
1661 AC_SUBST(C_INCLUDE_DIR)
1662 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cheaders" = c_shadow)
1667 dnl Check for wide character support. Has the same effect as the option
1668 dnl in gcc's configure, but in a form that autoconf can mess with.
1670 dnl GLIBCPP_ENABLE_C_MBCHAR
1671 dnl --enable-c-mbchar requests all the wchar_t stuff.
1672 dnl --disable-c-mbchar doesn't.
1673 dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1674 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1675 dnl defaults to `no'.
1676 AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1677 define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1678 AC_ARG_ENABLE(c-mbchar,
1679 changequote(<<, >>)dnl
1680 << --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1681 changequote([, ])dnl
1682 [case "$enableval" in
1683 yes) enable_c_mbchar=yes ;;
1684 no) enable_c_mbchar=no ;;
1685 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1687 enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1688 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1693 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1695 dnl TOPLEVEL_INCLUDES
1696 dnl LIBMATH_INCLUDES
1697 dnl LIBSUPCXX_INCLUDES
1699 dnl CSHADOW_INCLUDES
1701 dnl GLIBCPP_EXPORT_INCLUDES
1702 AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1703 # Root level of the build directory include sources.
1704 GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include"
1706 # Passed down for canadian crosses.
1707 if test x"$CANADIAN" = xyes; then
1708 TOPLEVEL_INCLUDES='-I$(includedir)'
1711 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1713 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1715 if test x"$need_libio" = xyes; then
1716 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1717 AC_SUBST(LIBIO_INCLUDES)
1720 # Now, export this to all the little Makefiles....
1721 AC_SUBST(GLIBCPP_INCLUDES)
1722 AC_SUBST(TOPLEVEL_INCLUDES)
1723 AC_SUBST(LIBMATH_INCLUDES)
1724 AC_SUBST(LIBSUPCXX_INCLUDES)
1729 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1731 AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1732 # Optimization flags that are probably a good idea for thrill-seekers. Just
1733 # uncomment the lines below and make, everything else is ready to go...
1734 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1736 AC_SUBST(OPTIMIZE_CXXFLAGS)
1738 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1739 AC_SUBST(WARN_FLAGS)
1743 dnl GLIBCPP_EXPORT_INSTALL_INFO
1744 dnl calculates gxx_install_dir
1745 dnl exports glibcpp_toolexecdir
1746 dnl exports glibcpp_toolexeclibdir
1747 dnl exports glibcpp_prefixdir
1749 dnl Assumes cross_compiling bits already done, and with_cross_host in
1752 dnl GLIBCPP_EXPORT_INSTALL_INFO
1753 AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
1754 # Assumes glibcpp_builddir, glibcpp_srcdir are alreay set up and
1755 # exported correctly in GLIBCPP_CONFIGURE.
1756 glibcpp_toolexecdir=no
1757 glibcpp_toolexeclibdir=no
1758 glibcpp_prefixdir=${prefix}
1760 AC_MSG_CHECKING([for interface version number])
1761 libstdcxx_interface=$INTERFACE
1762 AC_MSG_RESULT($libstdcxx_interface)
1764 # Process the option --with-gxx-include-dir=<path to include-files directory>
1765 AC_MSG_CHECKING([for --with-gxx-include-dir])
1766 AC_ARG_WITH(gxx-include-dir,
1767 [ --with-gxx-include-dir the installation directory for include files],
1768 [case "${withval}" in
1770 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
1777 gxx_include_dir=${withval}
1779 esac], [gxx_include_dir=no])
1780 AC_MSG_RESULT($gxx_include_dir)
1782 # Process the option "--enable-version-specific-runtime-libs"
1783 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
1784 AC_ARG_ENABLE(version-specific-runtime-libs,
1785 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
1786 [case "$enableval" in
1787 yes) version_specific_libs=yes ;;
1788 no) version_specific_libs=no ;;
1789 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
1791 version_specific_libs=no)dnl
1792 # Option set, now we can test it.
1793 AC_MSG_RESULT($version_specific_libs)
1795 if test $version_specific_libs = yes; then
1796 # Need the gcc compiler version to know where to install libraries
1797 # and header files if --enable-version-specific-runtime-libs option
1800 gcc_version_trigger=${srcdir}/../gcc/version.c
1801 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'`
1802 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
1803 gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/g++
1804 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1805 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
1809 # Default case for install directory for include files.
1810 if test $version_specific_libs = no &&
1811 test $gxx_include_dir = no; then
1812 gxx_include_dir='$(prefix)'/include/g++-${libstdcxx_interface}
1815 # Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
1816 # Install a library built with a cross compiler in tooldir, not libdir.
1817 if test x"$glibcpp_toolexecdir" = x"no"; then
1818 if test -n "$with_cross_host" &&
1819 test x"$with_cross_host" != x"no"; then
1820 glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
1821 glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)'
1823 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1824 glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)'
1828 AC_MSG_CHECKING([for install location])
1829 AC_MSG_RESULT($gxx_include_dir)
1831 AC_SUBST(glibcpp_prefixdir)
1832 AC_SUBST(gxx_include_dir)
1833 AC_SUBST(glibcpp_toolexecdir)
1834 AC_SUBST(glibcpp_toolexeclibdir)
1838 # Check for functions in math library.
1839 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1841 # This file can be copied and used freely without restrictions. It can
1842 # be used in projects which are not available under the GNU Public License
1843 # but which still want to provide support for the GNU gettext functionality.
1844 # Please note that the actual code is *not* freely available.
1848 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1849 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1850 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1851 AC_SUBST(LIBMATHOBJS)dnl
1856 dnl This macro searches for a GNU version of make. If a match is found, the
1857 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1858 dnl set to "#". This is useful for including a special features in a Makefile,
1859 dnl which cannot be handled by other versions of make. The variable
1860 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1861 dnl the empty string otherwise.
1863 dnl Here is an example of its use:
1865 dnl Makefile.in might contain:
1867 dnl # A failsafe way of putting a dependency rule into a makefile
1869 dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1871 dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1872 dnl @ifGNUmake@ include $(DEPEND)
1873 dnl @ifGNUmake@ endif
1875 dnl Then configure.in would normally contain:
1877 dnl CHECK_GNU_MAKE()
1878 dnl AC_OUTPUT(Makefile)
1880 dnl Then perhaps to cause gnu make to override any other make, we could do
1881 dnl something like this (note that GNU make always looks for GNUmakefile first):
1883 dnl if ! test x$_cv_gnu_make_command = x ; then
1884 dnl mv Makefile GNUmakefile
1885 dnl echo .DEFAULT: > Makefile ;
1886 dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1889 dnl Then, if any (well almost any) other make is called, and GNU make also
1890 dnl exists, then the other make wraps the GNU make.
1892 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1893 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
1895 dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1896 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1897 dnl #### conditional's subshell (" --version" is not a command), using a
1898 dnl #### different option to grep(1).
1900 dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not
1901 dnl #### ${MAKE:-make}).
1904 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1905 _cv_gnu_make_command='' ;
1906 dnl Search all the common names for GNU make
1907 for a in "${MAKE-make}" make gmake gnumake ; do
1908 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
1910 _cv_gnu_make_command=$a ;
1915 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1916 dnl string, '#' otherwise
1917 if test "x$_cv_gnu_make_command" != "x" ; then
1926 dnl Check for headers for, and arguments to, the setrlimit() function.
1927 dnl Used only in testsuite_hooks.h.
1928 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT_ancilliary, [
1929 AC_TRY_COMPILE([#include <sys/resource.h>
1931 ], [ int f = RLIMIT_$1 ; ],
1932 [glibcpp_mresult=1], [glibcpp_mresult=0])
1933 AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcpp_mresult,
1934 [Only used in build directory testsuite_hooks.h.])
1936 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT, [
1937 setrlimit_have_headers=yes
1938 AC_CHECK_HEADERS(sys/resource.h unistd.h,
1940 setrlimit_have_headers=no)
1941 # If don't have the headers, then we can't run the tests now, and we
1942 # won't be seeing any of these during testsuite compilation.
1943 if test $setrlimit_have_headers = yes; then
1944 # Can't do these in a loop, else the resulting syntax is wrong.
1945 GLIBCPP_CHECK_SETRLIMIT_ancilliary(DATA)
1946 GLIBCPP_CHECK_SETRLIMIT_ancilliary(RSS)
1947 GLIBCPP_CHECK_SETRLIMIT_ancilliary(VMEM)
1948 GLIBCPP_CHECK_SETRLIMIT_ancilliary(AS)
1950 # Check for rlimit, setrlimit.
1951 AC_CACHE_VAL(ac_setrlimit, [
1952 AC_TRY_COMPILE([#include <sys/resource.h>
1955 [ struct rlimit r; setrlimit(0, &r);],
1956 [ac_setrlimit=yes], [ac_setrlimit=no])
1960 AC_MSG_CHECKING([for testsuite memory limit support])
1961 if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then
1963 AC_DEFINE(_GLIBCPP_MEM_LIMITS)
1967 AC_MSG_RESULT($ac_mem_limits)
1972 dnl Does any necessary configuration of the testsuite directory. Generates
1973 dnl the testsuite_hooks.h header.
1975 dnl GLIBCPP_CONFIGURE_TESTSUITE [no args]
1976 AC_DEFUN(GLIBCPP_CONFIGURE_TESTSUITE, [
1977 GLIBCPP_CHECK_SETRLIMIT
1979 # Look for setenv, so that extended locale tests can be performed.
1980 AC_CHECK_FUNCS(setenv)
1984 sinclude(../libtool.m4)
1985 dnl The lines below arrange for aclocal not to bring an installed
1986 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1987 dnl add a definition of LIBTOOL to Makefile.in.
1988 ifelse(,,,[AC_SUBST(LIBTOOL)
1989 AC_DEFUN([AM_PROG_LIBTOOL])
1990 AC_DEFUN([AC_LIBTOOL_DLOPEN])
1991 AC_DEFUN([AC_PROG_LD])
1995 # Check whether LC_MESSAGES is available in <locale.h>.
1996 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1998 # This file file be copied and used freely without restrictions. It can
1999 # be used in projects which are not available under the GNU Public License
2000 # but which still want to provide support for the GNU gettext functionality.
2001 # Please note that the actual code is *not* freely available.
2005 AC_DEFUN(AC_LC_MESSAGES, [
2006 AC_CHECK_HEADER(locale.h, [
2007 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
2008 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2009 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
2010 if test $ac_cv_val_LC_MESSAGES = yes; then
2011 AC_DEFINE(HAVE_LC_MESSAGES)
2018 dnl Check for whether the Boost-derived checks should be turned on.
2020 dnl GLIBCPP_ENABLE_CONCEPT_CHECKS
2021 dnl --enable-concept-checks turns them on.
2022 dnl --disable-concept-checks leaves them off.
2023 dnl + Usage: GLIBCPP_ENABLE_CONCEPT_CHECKS[(DEFAULT)]
2024 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
2025 dnl defaults to `no'.
2026 AC_DEFUN(GLIBCPP_ENABLE_CONCEPT_CHECKS, [dnl
2027 define([GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT], ifelse($1, yes, yes, no))dnl
2028 AC_ARG_ENABLE(concept-checks,
2029 changequote(<<, >>)dnl
2030 << --enable-concept-checks use Boost-derived template checks [default=>>GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT],
2031 changequote([, ])dnl
2032 [case "$enableval" in
2033 yes) enable_concept_checks=yes ;;
2034 no) enable_concept_checks=no ;;
2035 *) AC_MSG_ERROR([Unknown argument to enable/disable concept checks]) ;;
2037 enable_concept_checks=GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT)dnl
2038 dnl Option parsed, now set things appropriately
2039 if test x"$enable_concept_checks" = xyes; then
2040 AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS)
2046 dnl Add version tags to symbols in shared library (or not), additionally
2047 dnl marking other symbols as private/local (or not).
2049 dnl GLIBCPP_ENABLE_SYMVERS
2050 dnl --enable-symvers=style adds a version script to the linker call when
2051 dnl creating the shared library. The choice of version script is
2052 dnl controlled by 'style'.
2053 dnl --disable-symvers does not.
2054 dnl + Usage: GLIBCPP_ENABLE_SYMVERS[(DEFAULT)]
2055 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
2056 dnl defaults to `no'. Passing `yes' tries to choose a default style
2057 dnl based on linker characteristics. Passing 'no' disables versioning.
2058 AC_DEFUN(GLIBCPP_ENABLE_SYMVERS, [dnl
2059 define([GLIBCPP_ENABLE_SYMVERS_DEFAULT], ifelse($1, yes, yes, no))dnl
2060 AC_ARG_ENABLE(symvers,
2061 changequote(<<, >>)dnl
2062 << --enable-symvers=style enables symbol versioning of the shared library [default=>>GLIBCPP_ENABLE_SYMVERS_DEFAULT],
2063 changequote([, ])dnl
2064 [case "$enableval" in
2065 yes) enable_symvers=yes ;;
2066 no) enable_symvers=no ;;
2067 # other names here, just as sanity checks
2068 #gnu|sun|etcetera) enable_symvers=$enableval ;;
2069 gnu) enable_symvers=$enableval ;;
2070 *) AC_MSG_ERROR([Unknown argument to enable/disable symvers]) ;;
2072 enable_symvers=GLIBCPP_ENABLE_SYMVERS_DEFAULT)dnl
2074 # If we never went through the GLIBCPP_CHECK_LINKER_FEATURES macro, then we
2075 # don't know enough about $LD to do tricks...
2076 if test x$enable_shared = xno ||
2078 test x$glibcpp_gnu_ld_version = x; then
2082 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
2083 AC_MSG_CHECKING([for shared libgcc])
2084 ac_save_CFLAGS="$CFLAGS"
2086 AC_TRY_LINK( , [return 0], glibcpp_shared_libgcc=yes, glibcpp_shared_libgcc=no)
2087 CFLAGS="$ac_save_CFLAGS"
2088 AC_MSG_RESULT($glibcpp_shared_libgcc)
2090 # For GNU ld, we need at least this version. It's 2.12 in the same format
2091 # as the tested-for version. See GLIBCPP_CHECK_LINKER_FEATURES for more.
2092 glibcpp_min_gnu_ld_version=21200
2094 # Check to see if unspecified "yes" value can win, given results
2096 if test $enable_symvers = yes ; then
2097 if test $with_gnu_ld = yes &&
2098 test $glibcpp_shared_libgcc = yes ;
2100 if test $glibcpp_gnu_ld_version -ge $glibcpp_min_gnu_ld_version ; then
2103 ac_test_CFLAGS="${CFLAGS+set}"
2104 ac_save_CFLAGS="$CFLAGS"
2105 CFLAGS='-shared -Wl,--version-script,conftest.map'
2108 echo 'FOO { global: f[a-z]o; local: *; };' > conftest.map
2110 AC_TRY_LINK([int foo;],, enable_symvers=gnu)
2111 if test "$ac_test_CFLAGS" = set; then
2112 CFLAGS="$ac_save_CFLAGS"
2114 # this is the suspicious part
2125 dnl Everything parsed; figure out what file to use.
2126 case $enable_symvers in
2128 LINKER_MAP=config/linker-map.dummy
2131 LINKER_MAP=config/linker-map.gnu
2135 AC_LINK_FILES($LINKER_MAP, src/linker.map)
2136 AM_CONDITIONAL(GLIBCPP_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
2137 AC_MSG_CHECKING([versioning on shared library symbols])
2138 AC_MSG_RESULT($enable_symvers)
2143 # This test replaces the one in autoconf.
2144 # Currently this macro should have the same name as the autoconf macro
2145 # because gettext's gettext.m4 (distributed in the automake package)
2146 # still uses it. Otherwise, the use in gettext.m4 makes autoheader
2147 # give these diagnostics:
2148 # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
2149 # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
2151 undefine([AC_ISC_POSIX])
2153 AC_DEFUN([AC_ISC_POSIX],
2155 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
2156 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
2160 # Add --enable-maintainer-mode option to configure.
2165 AC_DEFUN([AM_MAINTAINER_MODE],
2166 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
2167 dnl maintainer-mode is disabled by default
2168 AC_ARG_ENABLE(maintainer-mode,
2169 [ --enable-maintainer-mode enable make rules and dependencies not useful
2170 (and sometimes confusing) to the casual installer],
2171 USE_MAINTAINER_MODE=$enableval,
2172 USE_MAINTAINER_MODE=no)
2173 AC_MSG_RESULT($USE_MAINTAINER_MODE)
2174 AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
2175 MAINT=$MAINTAINER_MODE_TRUE
2180 # Define a conditional.
2182 AC_DEFUN([AM_CONDITIONAL],
2193 # Macro to add for using GNU gettext.
2194 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2196 # This file can be copied and used freely without restrictions. It can
2197 # be used in projects which are not available under the GNU Public License
2198 # but which still want to provide support for the GNU gettext functionality.
2199 # Please note that the actual code is *not* freely available.
2203 dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
2204 dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
2205 dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
2206 dnl depending on --{enable,disable}-{shared,static} and on the presence of
2207 dnl AM-DISABLE-SHARED). Otherwise, a static library
2208 dnl $(top_builddir)/intl/libintl.a will be created.
2209 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
2210 dnl implementations (in libc or libintl) without the ngettext() function
2211 dnl will be ignored.
2212 dnl LIBDIR is used to find the intl libraries. If empty,
2213 dnl the value `$(top_builddir)/intl/' is used.
2215 dnl The result of the configuration is one of three cases:
2216 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
2218 dnl Catalog format: GNU --> install in $(datadir)
2219 dnl Catalog extension: .mo after installation, .gmo in source tree
2220 dnl 2) GNU gettext has been found in the system's C library.
2221 dnl Catalog format: GNU --> install in $(datadir)
2222 dnl Catalog extension: .mo after installation, .gmo in source tree
2223 dnl 3) No internationalization, always use English msgid.
2224 dnl Catalog format: none
2225 dnl Catalog extension: none
2226 dnl The use of .gmo is historical (it was needed to avoid overwriting the
2227 dnl GNU format catalogs when building on a platform with an X/Open gettext),
2228 dnl but we keep it in order not to force irrelevant filename changes on the
2231 AC_DEFUN([AM_WITH_NLS],
2232 [AC_MSG_CHECKING([whether NLS is requested])
2233 dnl Default is enabled NLS
2235 [ --disable-nls do not use Native Language Support],
2236 USE_NLS=$enableval, USE_NLS=yes)
2237 AC_MSG_RESULT($USE_NLS)
2240 BUILD_INCLUDED_LIBINTL=no
2241 USE_INCLUDED_LIBINTL=no
2244 dnl If we use NLS figure out what method
2245 if test "$USE_NLS" = "yes"; then
2246 AC_DEFINE(ENABLE_NLS, 1,
2247 [Define to 1 if translation of program messages to the user's native language
2249 AC_MSG_CHECKING([whether included gettext is requested])
2250 AC_ARG_WITH(included-gettext,
2251 [ --with-included-gettext use the GNU gettext library included here],
2252 nls_cv_force_use_gnu_gettext=$withval,
2253 nls_cv_force_use_gnu_gettext=no)
2254 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
2256 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
2257 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
2258 dnl User does not insist on using GNU NLS library. Figure out what
2259 dnl to use. If GNU gettext is available we use this. Else we have
2260 dnl to fall back to GNU NLS library.
2263 dnl Add a version number to the cache macros.
2264 define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
2265 define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
2267 AC_CHECK_HEADER(libintl.h,
2268 [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
2269 [AC_TRY_LINK([#include <libintl.h>
2270 extern int _nl_msg_cat_cntr;],
2271 [bindtextdomain ("", "");
2272 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
2273 gt_cv_func_gnugettext_libc=yes,
2274 gt_cv_func_gnugettext_libc=no)])
2276 if test "$gt_cv_func_gnugettext_libc" != "yes"; then
2277 AC_CACHE_CHECK([for GNU gettext in libintl],
2278 gt_cv_func_gnugettext_libintl,
2279 [gt_save_LIBS="$LIBS"
2280 LIBS="$LIBS -lintl $LIBICONV"
2281 AC_TRY_LINK([#include <libintl.h>
2282 extern int _nl_msg_cat_cntr;],
2283 [bindtextdomain ("", "");
2284 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
2285 gt_cv_func_gnugettext_libintl=yes,
2286 gt_cv_func_gnugettext_libintl=no)
2287 LIBS="$gt_save_LIBS"])
2290 dnl If an already present or preinstalled GNU gettext() is found,
2291 dnl use it. But if this macro is used in GNU gettext, and GNU
2292 dnl gettext is already preinstalled in libintl, we update this
2293 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
2294 if test "$gt_cv_func_gnugettext_libc" = "yes" \
2295 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
2296 && test "$PACKAGE" != gettext; }; then
2297 AC_DEFINE(HAVE_GETTEXT, 1,
2298 [Define if the GNU gettext() function is already present or preinstalled.])
2300 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
2301 dnl If iconv() is in a separate libiconv library, then anyone
2302 dnl linking with libintl{.a,.so} also needs to link with
2304 INTLLIBS="-lintl $LIBICONV"
2307 gt_save_LIBS="$LIBS"
2308 LIBS="$LIBS $INTLLIBS"
2309 AC_CHECK_FUNCS(dcgettext)
2310 LIBS="$gt_save_LIBS"
2312 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2313 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
2314 if test "$MSGFMT" != "no"; then
2315 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2318 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2319 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2325 if test "$CATOBJEXT" = "NONE"; then
2326 dnl GNU gettext is not found in the C library.
2327 dnl Fall back on GNU gettext library.
2328 nls_cv_use_gnu_gettext=yes
2332 if test "$nls_cv_use_gnu_gettext" = "yes"; then
2333 dnl Mark actions used to generate GNU NLS library.
2334 INTLOBJS="\$(GETTOBJS)"
2335 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2336 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
2337 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2338 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2339 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2341 BUILD_INCLUDED_LIBINTL=yes
2342 USE_INCLUDED_LIBINTL=yes
2344 INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
2345 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
2348 dnl Test whether we really found GNU xgettext.
2349 if test "$XGETTEXT" != ":"; then
2350 dnl If it is no GNU xgettext we define it as : so that the
2351 dnl Makefiles still can work.
2352 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
2356 [found xgettext program is not GNU xgettext; ignore it])
2361 dnl We need to process the po/ directory.
2365 [for ac_file in $CONFIG_FILES; do
2366 # Support "outfile[:infile[:infile...]]"
2368 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
2370 # PO directories have a Makefile.in generated from Makefile.in.in.
2371 case "$ac_file" in */Makefile.in)
2372 # Adjust a relative srcdir.
2373 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
2374 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
2375 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
2376 case "$ac_given_srcdir" in
2377 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
2378 /*) top_srcdir="$ac_given_srcdir" ;;
2379 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
2381 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
2382 rm -f "$ac_dir/POTFILES"
2383 echo creating "$ac_dir/POTFILES"
2384 sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
2385 echo creating "$ac_dir/Makefile"
2386 sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
2393 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
2394 dnl to 'yes' because some of the testsuite requires it.
2395 if test "$PACKAGE" = gettext; then
2396 BUILD_INCLUDED_LIBINTL=yes
2399 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
2400 dnl because plural.y uses bison specific features. It requires at least
2401 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
2403 dnl bison is only needed for the maintainer (who touches plural.y). But in
2404 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
2405 dnl the rule in general Makefile. Now, some people carelessly touch the
2406 dnl files or have a broken "make" program, hence the plural.c rule will
2407 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
2408 dnl present or too old.
2409 AC_CHECK_PROGS([INTLBISON], [bison])
2410 if test -z "$INTLBISON"; then
2413 dnl Found it, now check the version.
2414 AC_MSG_CHECKING([version of bison])
2415 changequote(<<,>>)dnl
2416 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison .* \([0-9]*\.[0-9.]*\).*$/\1/p'`
2417 case $ac_prog_version in
2418 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
2419 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
2421 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
2422 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
2424 AC_MSG_RESULT([$ac_prog_version])
2426 if test $ac_verc_fail = yes; then
2430 dnl These rules are solely for the distribution goal. While doing this
2431 dnl we only have to keep exactly one list of the available catalogs
2432 dnl in configure.in.
2433 for lang in $ALL_LINGUAS; do
2434 GMOFILES="$GMOFILES $lang.gmo"
2435 POFILES="$POFILES $lang.po"
2438 dnl Make all variables we use known to autoconf.
2439 AC_SUBST(BUILD_INCLUDED_LIBINTL)
2440 AC_SUBST(USE_INCLUDED_LIBINTL)
2449 dnl For backward compatibility. Some configure.ins may be using this.
2451 nls_cv_header_libgt=
2453 dnl For backward compatibility. Some Makefiles may be using this.
2455 AC_SUBST(DATADIRNAME)
2457 dnl For backward compatibility. Some Makefiles may be using this.
2459 AC_SUBST(INSTOBJEXT)
2461 dnl For backward compatibility. Some Makefiles may be using this.
2466 dnl Usage: Just like AM_WITH_NLS, which see.
2467 AC_DEFUN([AM_GNU_GETTEXT],
2468 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2469 AC_REQUIRE([AC_PROG_CC])dnl
2470 AC_REQUIRE([AC_CANONICAL_HOST])dnl
2471 AC_REQUIRE([AC_PROG_RANLIB])dnl
2472 AC_REQUIRE([AC_ISC_POSIX])dnl
2473 AC_REQUIRE([AC_HEADER_STDC])dnl
2474 AC_REQUIRE([AC_C_CONST])dnl
2475 AC_REQUIRE([AC_C_INLINE])dnl
2476 AC_REQUIRE([AC_TYPE_OFF_T])dnl
2477 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2478 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2479 AC_REQUIRE([AC_FUNC_MMAP])dnl
2480 AC_REQUIRE([jm_GLIBC21])dnl
2482 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
2483 stdlib.h string.h unistd.h sys/param.h])
2484 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
2485 getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
2486 strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
2491 AM_WITH_NLS([$1],[$2],[$3])
2493 if test "x$CATOBJEXT" != "x"; then
2494 if test "x$ALL_LINGUAS" = "x"; then
2497 AC_MSG_CHECKING(for catalogs to be installed)
2499 for presentlang in $ALL_LINGUAS; do
2501 for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
2502 # Use the presentlang catalog if desiredlang is
2503 # a. equal to presentlang, or
2504 # b. a variant of presentlang (because in this case,
2505 # presentlang can be used as a fallback for messages
2506 # which are not translated in the desiredlang catalog).
2507 case "$desiredlang" in
2508 "$presentlang"*) useit=yes;;
2511 if test $useit = yes; then
2512 NEW_LINGUAS="$NEW_LINGUAS $presentlang"
2515 LINGUAS=$NEW_LINGUAS
2516 AC_MSG_RESULT($LINGUAS)
2519 dnl Construct list of names of catalog files to be constructed.
2520 if test -n "$LINGUAS"; then
2521 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
2525 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
2526 dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
2527 dnl Try to locate is.
2529 if test -n "$ac_aux_dir"; then
2530 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
2532 if test -z "$MKINSTALLDIRS"; then
2533 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
2535 AC_SUBST(MKINSTALLDIRS)
2537 dnl Enable libtool support if the surrounding package wishes it.
2538 INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
2539 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
2542 # Search path for a program which passes the given test.
2543 # Ulrich Drepper <drepper@cygnus.com>, 1996.
2545 # This file can be copied and used freely without restrictions. It can
2546 # be used in projects which are not available under the GNU Public License
2547 # but which still want to provide support for the GNU gettext functionality.
2548 # Please note that the actual code is *not* freely available.
2552 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2553 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2554 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
2555 [# Extract the first word of "$2", so it can be a program name with args.
2556 set dummy $2; ac_word=[$]2
2557 AC_MSG_CHECKING([for $ac_word])
2558 AC_CACHE_VAL(ac_cv_path_$1,
2561 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2564 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
2565 for ac_dir in ifelse([$5], , $PATH, [$5]); do
2566 test -z "$ac_dir" && ac_dir=.
2567 if test -f $ac_dir/$ac_word; then
2569 ac_cv_path_$1="$ac_dir/$ac_word"
2575 dnl If no 4th arg is given, leave the cache variable unset,
2576 dnl so AC_PATH_PROGS will keep looking.
2577 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2582 if test -n "[$]$1"; then
2583 AC_MSG_RESULT([$]$1)
2592 # Test for the GNU C Library, version 2.1 or newer.
2593 # From Bruno Haible.
2595 AC_DEFUN([jm_GLIBC21],
2597 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
2598 ac_cv_gnu_library_2_1,
2599 [AC_EGREP_CPP([Lucky GNU user],
2601 #include <features.h>
2602 #ifdef __GNU_LIBRARY__
2603 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
2608 ac_cv_gnu_library_2_1=yes,
2609 ac_cv_gnu_library_2_1=no)
2613 GLIBC21="$ac_cv_gnu_library_2_1"
2619 dnl From Bruno Haible.
2621 AC_DEFUN([AM_ICONV],
2623 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
2624 dnl those with the standalone portable GNU libiconv installed).
2626 AC_ARG_WITH([libiconv-prefix],
2627 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
2628 for dir in `echo "$withval" | tr : ' '`; do
2629 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
2630 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
2634 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
2635 am_cv_func_iconv="no, consider installing GNU libiconv"
2637 AC_TRY_LINK([#include <stdlib.h>
2638 #include <iconv.h>],
2639 [iconv_t cd = iconv_open("","");
2640 iconv(cd,NULL,NULL,NULL,NULL);
2642 am_cv_func_iconv=yes)
2643 if test "$am_cv_func_iconv" != yes; then
2644 am_save_LIBS="$LIBS"
2645 LIBS="$LIBS -liconv"
2646 AC_TRY_LINK([#include <stdlib.h>
2647 #include <iconv.h>],
2648 [iconv_t cd = iconv_open("","");
2649 iconv(cd,NULL,NULL,NULL,NULL);
2652 am_cv_func_iconv=yes)
2653 LIBS="$am_save_LIBS"
2656 if test "$am_cv_func_iconv" = yes; then
2657 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
2658 AC_MSG_CHECKING([for iconv declaration])
2659 AC_CACHE_VAL(am_cv_proto_iconv, [
2667 #if defined(__STDC__) || defined(__cplusplus)
2668 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
2672 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
2673 am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
2674 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
2675 AC_MSG_RESULT([$]{ac_t:-
2676 }[$]am_cv_proto_iconv)
2677 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
2678 [Define as const if the declaration of iconv() needs const.])
2681 if test "$am_cv_lib_iconv" = yes; then
2689 dnl From Bruno Haible.
2691 AC_DEFUN([AM_LANGINFO_CODESET],
2693 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
2694 [AC_TRY_LINK([#include <langinfo.h>],
2695 [char* cs = nl_langinfo(CODESET);],
2696 am_cv_langinfo_codeset=yes,
2697 am_cv_langinfo_codeset=no)
2699 if test $am_cv_langinfo_codeset = yes; then
2700 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
2701 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
2705 # Check whether LC_MESSAGES is available in <locale.h>.
2706 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2708 # This file can be copied and used freely without restrictions. It can
2709 # be used in projects which are not available under the GNU Public License
2710 # but which still want to provide support for the GNU gettext functionality.
2711 # Please note that the actual code is *not* freely available.
2715 AC_DEFUN([AM_LC_MESSAGES],
2716 [if test $ac_cv_header_locale_h = yes; then
2717 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2718 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2719 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2720 if test $am_cv_val_LC_MESSAGES = yes; then
2721 AC_DEFINE(HAVE_LC_MESSAGES, 1,
2722 [Define if your <locale.h> file defines LC_MESSAGES.])
2726 # Do all the work for Automake. This macro actually does too much --
2727 # some checks are only needed if your package does certain things.
2728 # But this isn't really a big deal.
2733 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
2735 AC_DEFUN([AM_INIT_AUTOMAKE],
2736 [AC_REQUIRE([AC_PROG_INSTALL])
2741 dnl test to see if srcdir already configured
2742 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
2743 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2746 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
2747 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
2748 AC_REQUIRE([AM_SANITY_CHECK])
2749 AC_REQUIRE([AC_ARG_PROGRAM])
2750 dnl FIXME This is truly gross.
2751 missing_dir=`cd $ac_aux_dir && pwd`
2752 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
2753 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
2754 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
2755 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
2756 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
2757 AC_REQUIRE([AC_PROG_MAKE_SET])])
2760 # Check to make sure that the build environment is sane.
2763 AC_DEFUN([AM_SANITY_CHECK],
2764 [AC_MSG_CHECKING([whether build environment is sane])
2767 echo timestamp > conftestfile
2768 # Do `set' in a subshell so we don't clobber the current shell's
2769 # arguments. Must try -L first in case configure is actually a
2770 # symlink; some systems play weird games with the mod time of symlinks
2771 # (eg FreeBSD returns the mod time of the symlink's containing
2774 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
2775 if test "[$]*" = "X"; then
2777 set X `ls -t $srcdir/configure conftestfile`
2779 if test "[$]*" != "X $srcdir/configure conftestfile" \
2780 && test "[$]*" != "X conftestfile $srcdir/configure"; then
2782 # If neither matched, then we have a broken ls. This can happen
2783 # if, for instance, CONFIG_SHELL is bash and it inherits a
2784 # broken ls alias from the environment. This has actually
2785 # happened. Such a system could not be considered "sane".
2786 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
2787 alias in your environment])
2790 test "[$]2" = conftestfile
2796 AC_MSG_ERROR([newly created file is older than distributed files!
2797 Check your system clock])
2800 AC_MSG_RESULT(yes)])
2802 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
2803 dnl The program must properly implement --version.
2804 AC_DEFUN([AM_MISSING_PROG],
2805 [AC_MSG_CHECKING(for working $2)
2806 # Run test in a subshell; some versions of sh will print an error if
2807 # an executable is not found, even if stderr is redirected.
2808 # Redirect stdin to placate older versions of autoconf. Sigh.
2809 if ($2 --version) < /dev/null > /dev/null 2>&1; then
2811 AC_MSG_RESULT(found)
2814 AC_MSG_RESULT(missing)
2818 # Like AC_CONFIG_HEADER, but automatically create stamp file.
2820 AC_DEFUN([AM_CONFIG_HEADER],
2822 AC_CONFIG_HEADER([$1])
2823 dnl When config.status generates a header, we must update the stamp-h file.
2824 dnl This file resides in the same directory as the config header
2825 dnl that is generated. We must strip everything past the first ":",
2826 dnl and everything past the last "/".
2827 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
2828 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
2829 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
2831 for am_file in <<$1>>; do
2832 case " <<$>>CONFIG_HEADERS " in
2833 *" <<$>>am_file "*<<)>>
2834 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
2837 am_indx=`expr "<<$>>am_indx" + 1`