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.5x, 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]))])
88 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
89 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
90 # are probably using a cross compiler, which will not be able to fully
91 # link an executable. This is addressed in later versions of autoconf.
93 AC_DEFUN(LIB_AC_PROG_CC,
94 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
95 dnl Fool anybody using AC_PROG_CC.
96 AC_PROVIDE([AC_PROG_CC])
97 AC_CHECK_PROG(CC, gcc, gcc)
98 if test -z "$CC"; then
99 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
100 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
105 if test $ac_cv_prog_gcc = yes; then
107 dnl Check whether -g works, even if CFLAGS is set, in case the package
108 dnl plays around with CFLAGS (such as to build both debugging and
109 dnl normal versions of a library), tasteless as that idea is.
110 ac_test_CFLAGS="${CFLAGS+set}"
111 ac_save_CFLAGS="$CFLAGS"
114 if test "$ac_test_CFLAGS" = set; then
115 CFLAGS="$ac_save_CFLAGS"
116 elif test $ac_cv_prog_cc_g = yes; then
123 test "${CFLAGS+set}" = set || CFLAGS="-g"
129 # Likewise for AC_PROG_CXX. We can't just call it directly because g++
130 # will try to link in libstdc++.
131 AC_DEFUN(LIB_AC_PROG_CXX,
132 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
133 dnl Fool anybody using AC_PROG_CXX.
134 AC_PROVIDE([AC_PROG_CXX])
135 # Use glibcpp_CXX so that we do not cause CXX to be cached with the
136 # flags that come in CXX while configuring libstdc++. They're different
137 # from those used for all other target libraries. If CXX is set in
138 # the environment, respect that here.
140 AC_CHECK_PROGS(glibcpp_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
141 AC_SUBST(glibcpp_CXX)
143 test -z "$glibcpp_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
147 if test $ac_cv_prog_gxx = yes; then
149 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
150 dnl plays around with CXXFLAGS (such as to build both debugging and
151 dnl normal versions of a library), tasteless as that idea is.
152 ac_test_CXXFLAGS="${CXXFLAGS+set}"
153 ac_save_CXXFLAGS="$CXXFLAGS"
156 if test "$ac_test_CXXFLAGS" = set; then
157 CXXFLAGS="$ac_save_CXXFLAGS"
158 elif test $ac_cv_prog_cxx_g = yes; then
165 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
171 # For some reason, gettext needs this.
174 AC_CHECK_TOOL(AS, as)
175 AC_CHECK_TOOL(AR, ar)
176 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
181 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
182 # at least currently, we never actually build a program, so we never
183 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
184 # fails, because we are probably configuring with a cross compiler
185 # which can't create executables. So we include AC_EXEEXT to keep
186 # automake happy, but we don't execute it, since we don't care about
189 # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands
190 # to nothing, so nothing would remain between `then' and `fi' if it
191 # were not for the `:' below.
196 . [$]{glibcpp_basedir}/configure.host
198 case [$]{glibcpp_basedir} in
199 /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
200 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
203 # This does for the target what configure.host does for the host. In
204 # addition to possibly modifying the same flags, it also sets up symlinks.
211 dnl Check to see if g++ can compile this library, and if so, if any version-
212 dnl specific precautions need to be taken.
214 dnl GLIBCPP_CHECK_COMPILER_VERSION
215 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
216 if test ! -f stamp-sanity-compiler; then
217 AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3])
224 ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to GCC 3.0 or above]))
226 AC_MSG_RESULT($gpp_satisfactory)
227 touch stamp-sanity-compiler
233 dnl Tests for newer compiler features, or features that are present in newer
234 dnl compiler versions but not older compiler versions still in use, should
237 dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
238 dnl new inlining code or the new system_header pragma will die on -Werror.
239 dnl Leave it out by default and use maint-mode to use it.
241 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
242 dnl compiler supports it and the user has not requested debug mode.
244 dnl GLIBCPP_CHECK_COMPILER_FEATURES
245 AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
246 # All these tests are for C++; save the language and the compiler flags.
247 # The CXXFLAGS thing is suspicious, but based on similar bits previously
248 # found in GLIBCPP_CONFIGURE.
251 ac_test_CXXFLAGS="${CXXFLAGS+set}"
252 ac_save_CXXFLAGS="$CXXFLAGS"
254 # Check for maintainer-mode bits.
255 if test x"$USE_MAINTAINER_MODE" = xno; then
261 # Check for -ffunction-sections -fdata-sections
262 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
263 CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
264 AC_TRY_COMPILE(, [int foo;
265 ], [ac_fdsections=yes], [ac_fdsections=no])
266 if test "$ac_test_CXXFLAGS" = set; then
267 CXXFLAGS="$ac_save_CXXFLAGS"
269 # this is the suspicious part
272 if test x"$ac_fdsections" = x"yes" &&
273 test x"$enable_debug" = x"no"; then
274 SECTION_FLAGS='-ffunction-sections -fdata-sections'
276 AC_MSG_RESULT($ac_fdsections)
280 AC_SUBST(SECTION_FLAGS)
285 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
286 dnl the native linker is in use, all variables will be defined to something
287 dnl safe (like an empty string).
289 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
290 dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
291 dnl Define LD, with_gnu_ld, and (possibly) glibcpp_gnu_ld_version as
292 dnl side-effects of testing.
294 dnl GLIBCPP_CHECK_LINKER_FEATURES
295 AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
296 # If we're not using GNU ld, then there's no point in even trying these
297 # tests. Check for that first. We should have already tested for gld
298 # by now (in libtool), but require it now just to be safe...
299 test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
300 test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
301 AC_REQUIRE([AC_PROG_LD])
303 # The name set by libtool depends on the version of libtool. Shame on us
304 # for depending on an impl detail, but c'est la vie. Older versions used
305 # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
306 # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
307 # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
308 # set (hence we're using an older libtool), then set it.
309 if test x${with_gnu_ld+set} != xset; then
310 if test x${ac_cv_prog_gnu_ld+set} != xset; then
311 # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
314 with_gnu_ld=$ac_cv_prog_gnu_ld
318 # Start by getting the version number. I think the libtool test already
319 # does some of this, but throws away the result.
321 ldver=`$LD --version 2>/dev/null | head -1 | \
322 sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
324 glibcpp_gnu_ld_version=`echo $ldver | \
325 $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
328 if test "$with_gnu_ld" = "notbroken"; then
329 # GNU ld it is! Joy and bunny rabbits!
331 # All these tests are for C++; save the language and the compiler flags.
332 # Need to do this so that g++ won't try to link in libstdc++
333 ac_test_CFLAGS="${CFLAGS+set}"
334 ac_save_CFLAGS="$CFLAGS"
335 CFLAGS='-x c++ -Wl,--gc-sections'
337 # Check for -Wl,--gc-sections
338 # XXX This test is broken at the moment, as symbols required for
339 # linking are now in libsupc++ (not built yet.....). In addition,
340 # this test has cored on solaris in the past. In addition,
341 # --gc-sections doesn't really work at the moment (keeps on discarding
342 # used sections, first .eh_frame and now some of the glibc sections for
343 # iconv). Bzzzzt. Thanks for playing, maybe next time.
344 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
352 ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
353 if test "$ac_test_CFLAGS" = set; then
354 CFLAGS="$ac_save_CFLAGS"
356 # this is the suspicious part
359 if test "$ac_sectionLDflags" = "yes"; then
360 SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
362 AC_MSG_RESULT($ac_sectionLDflags)
365 # Set linker optimization flags.
366 if test x"$with_gnu_ld" = x"yes" && test x"$enable_debug" = x"no"; then
367 OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
370 AC_SUBST(SECTION_LDFLAGS)
371 AC_SUBST(OPT_LDFLAGS)
376 dnl Check to see if the (math function) argument passed is
377 dnl declared when using the c++ compiler
378 dnl ASSUMES argument is a math function with ONE parameter
380 dnl GLIBCPP_CHECK_MATH_DECL_1
381 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [
382 AC_MSG_CHECKING([for $1 declaration])
383 if test x${glibcpp_cv_func_$1_use+set} != xset; then
384 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
387 AC_TRY_COMPILE([#include <math.h>
393 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
397 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
401 dnl Check to see if the (math function) argument passed is
402 dnl 1) declared when using the c++ compiler
403 dnl 2) has "C" linkage
404 dnl 3) if not, see if 1) and 2) for argument prepended with '_'
406 dnl Define HAVE_CARGF etc if "cargf" is declared and links
408 dnl argument 1 is name of function to check
410 dnl ASSUMES argument is a math function with ONE parameter
412 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
413 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
414 GLIBCPP_CHECK_MATH_DECL_1($1)
415 if test x$glibcpp_cv_func_$1_use = x"yes"; then
418 GLIBCPP_CHECK_MATH_DECL_1(_$1)
419 if test x$glibcpp_cv_func__$1_use = x"yes"; then
427 dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
428 dnl of functions at once. It's an all-or-nothing check -- either
429 dnl HAVE_XYZ is defined for each of the functions, or for none of them.
430 dnl Doing it this way saves significant configure time.
431 AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [
432 AC_MSG_CHECKING([for $1 functions])
433 AC_CACHE_VAL(glibcpp_cv_func_$2_use, [
436 AC_TRY_COMPILE([#include <math.h>],
437 [ `for x in $3; do echo "$x (0);"; done` ],
438 [glibcpp_cv_func_$2_use=yes],
439 [glibcpp_cv_func_$2_use=no])
441 AC_MSG_RESULT($glibcpp_cv_func_$2_use)
442 if test x$glibcpp_cv_func_$2_use = x"yes"; then
448 dnl Check to see if the (math function) argument passed is
449 dnl declared when using the c++ compiler
450 dnl ASSUMES argument is a math function with TWO parameters
452 dnl GLIBCPP_CHECK_MATH_DECL_2
453 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [
454 AC_MSG_CHECKING([for $1 declaration])
455 if test x${glibcpp_cv_func_$1_use+set} != xset; then
456 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
459 AC_TRY_COMPILE([#include <math.h>],
461 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
465 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
469 dnl Check to see if the (math function) argument passed is
470 dnl 1) declared when using the c++ compiler
471 dnl 2) has "C" linkage
473 dnl Define HAVE_CARGF etc if "cargf" is declared and links
475 dnl argument 1 is name of function to check
477 dnl ASSUMES argument is a math function with TWO parameters
479 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
480 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
481 GLIBCPP_CHECK_MATH_DECL_2($1)
482 if test x$glibcpp_cv_func_$1_use = x"yes"; then
485 GLIBCPP_CHECK_MATH_DECL_2(_$1)
486 if test x$glibcpp_cv_func__$1_use = x"yes"; then
494 dnl Check to see if the (math function) argument passed is
495 dnl declared when using the c++ compiler
496 dnl ASSUMES argument is a math function with THREE parameters
498 dnl GLIBCPP_CHECK_MATH_DECL_3
499 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [
500 AC_MSG_CHECKING([for $1 declaration])
501 if test x${glibcpp_cv_func_$1_use+set} != xset; then
502 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
505 AC_TRY_COMPILE([#include <math.h>],
507 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
511 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
515 dnl Check to see if the (math function) argument passed is
516 dnl 1) declared when using the c++ compiler
517 dnl 2) has "C" linkage
519 dnl Define HAVE_CARGF etc if "cargf" is declared and links
521 dnl argument 1 is name of function to check
523 dnl ASSUMES argument is a math function with THREE parameters
525 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
526 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
527 GLIBCPP_CHECK_MATH_DECL_3($1)
528 if test x$glibcpp_cv_func_$1_use = x"yes"; then
531 GLIBCPP_CHECK_MATH_DECL_3(_$1)
532 if test x$glibcpp_cv_func__$1_use = x"yes"; then
540 dnl Check to see if the (stdlib function) argument passed is
541 dnl 1) declared when using the c++ compiler
542 dnl 2) has "C" linkage
544 dnl argument 1 is name of function to check
546 dnl ASSUMES argument is a math function with TWO parameters
548 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
549 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
550 AC_MSG_CHECKING([for $1 declaration])
551 if test x${glibcpp_cv_func_$1_use+set} != xset; then
552 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
555 AC_TRY_COMPILE([#include <stdlib.h>],
557 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
561 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
562 if test x$glibcpp_cv_func_$1_use = x"yes"; then
569 dnl Check to see if the (stdlib function) argument passed is
570 dnl 1) declared when using the c++ compiler
571 dnl 2) has "C" linkage
573 dnl argument 1 is name of function to check
575 dnl ASSUMES argument is a function with THREE parameters
577 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3
578 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3, [
579 AC_MSG_CHECKING([for $1 declaration])
580 if test x${glibcpp_cv_func_$1_use+set} != xset; then
581 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
584 AC_TRY_COMPILE([#include <stdlib.h>],
586 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
590 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
591 if test x$glibcpp_cv_func_$1_use = x"yes"; then
598 dnl Because the builtins are picky picky picky about the arguments they take,
599 dnl do an explict linkage tests here.
600 dnl Check to see if the (math function) argument passed is
601 dnl 1) declared when using the c++ compiler
602 dnl 2) has "C" linkage
604 dnl Define HAVE_CARGF etc if "cargf" is declared and links
606 dnl argument 1 is name of function to check
608 dnl ASSUMES argument is a math function with ONE parameter
610 dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
611 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
612 AC_MSG_CHECKING([for $1 declaration])
613 if test x${glibcpp_cv_func_$1_use+set} != xset; then
614 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
617 AC_TRY_COMPILE([#include <math.h>],
619 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
623 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
624 if test x$glibcpp_cv_func_$1_use = x"yes"; then
625 AC_MSG_CHECKING([for $1 linkage])
626 if test x${glibcpp_cv_func_$1_link+set} != xset; then
627 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
628 AC_TRY_LINK([#include <math.h>],
630 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
633 AC_MSG_RESULT($glibcpp_cv_func_$1_link)
634 if test x$glibcpp_cv_func_$1_link = x"yes"; then
635 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
636 AC_DEFINE_UNQUOTED(${ac_tr_func})
643 dnl Check to see what builtin math functions are supported
645 dnl check for __builtin_abs
646 dnl check for __builtin_fabsf
647 dnl check for __builtin_fabs
648 dnl check for __builtin_fabl
649 dnl check for __builtin_labs
650 dnl check for __builtin_sqrtf
651 dnl check for __builtin_sqrtl
652 dnl check for __builtin_sqrt
653 dnl check for __builtin_sinf
654 dnl check for __builtin_sin
655 dnl check for __builtin_sinl
656 dnl check for __builtin_cosf
657 dnl check for __builtin_cos
658 dnl check for __builtin_cosl
660 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
661 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
662 dnl Test for builtin math functions.
663 dnl These are made in gcc/c-common.c
664 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
665 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
666 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
667 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
668 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
670 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
671 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrt)
672 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
674 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
675 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
676 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
678 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
679 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
680 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
682 dnl There is, without a doubt, a more elegant way to have these
683 dnl names exported so that they won't be stripped out of acconfig.h by
684 dnl autoheader. I leave this as an exercise to somebody less frustrated
685 dnl than I.... please email the libstdc++ list if you can figure out a
686 dnl more elegant approach (see autoconf/acgen.m4 and specifically
687 dnl AC_CHECK_FUNC for things to steal.)
689 if test x$dummyvar = x"yes"; then
690 AC_DEFINE(HAVE___BUILTIN_ABS)
691 AC_DEFINE(HAVE___BUILTIN_LABS)
692 AC_DEFINE(HAVE___BUILTIN_COS)
693 AC_DEFINE(HAVE___BUILTIN_COSF)
694 AC_DEFINE(HAVE___BUILTIN_COSL)
695 AC_DEFINE(HAVE___BUILTIN_FABS)
696 AC_DEFINE(HAVE___BUILTIN_FABSF)
697 AC_DEFINE(HAVE___BUILTIN_FABSL)
698 AC_DEFINE(HAVE___BUILTIN_SIN)
699 AC_DEFINE(HAVE___BUILTIN_SINF)
700 AC_DEFINE(HAVE___BUILTIN_SINL)
701 AC_DEFINE(HAVE___BUILTIN_SQRT)
702 AC_DEFINE(HAVE___BUILTIN_SQRTF)
703 AC_DEFINE(HAVE___BUILTIN_SQRTL)
709 dnl Check to see what the underlying c library
710 dnl These checks need to do two things:
711 dnl 1) make sure the name is declared when using the c++ compiler
712 dnl 2) make sure the name has "C" linkage
713 dnl This might seem like overkill but experience has shown that it's not...
715 dnl Define HAVE_STRTOLD if "strtold" is declared and links
716 dnl Define HAVE_STRTOF if "strtof" is declared and links
717 dnl Define HAVE_DRAND48 if "drand48" is declared and links
719 dnl GLIBCPP_CHECK_STDLIB_SUPPORT
720 AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
721 ac_test_CXXFLAGS="${CXXFLAGS+set}"
722 ac_save_CXXFLAGS="$CXXFLAGS"
723 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
725 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
726 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof)
727 AC_CHECK_FUNCS(drand48)
729 CXXFLAGS="$ac_save_CXXFLAGS"
734 dnl Check to see what the underlying c library or math library is like.
735 dnl These checks need to do two things:
736 dnl 1) make sure the name is declared when using the c++ compiler
737 dnl 2) make sure the name has "C" linkage
738 dnl This might seem like overkill but experience has shown that it's not...
740 dnl Define HAVE_CARGF etc if "cargf" is found.
742 dnl GLIBCPP_CHECK_MATH_SUPPORT
743 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
744 ac_test_CXXFLAGS="${CXXFLAGS+set}"
745 ac_save_CXXFLAGS="$CXXFLAGS"
746 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
749 AC_CHECK_LIB(m, sin, libm="-lm")
753 dnl Check to see if certain C math functions exist.
754 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
755 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
756 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
757 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
758 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
759 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
760 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
761 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypot)
763 dnl Check to see if basic C math functions have float versions.
764 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig,
769 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
772 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
773 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
774 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
775 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
776 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
777 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
778 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf)
779 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
780 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
781 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
782 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
783 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
784 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
785 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
786 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
788 dnl Check to see if basic C math functions have long double versions.
789 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig,
794 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round,
797 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
798 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
799 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
800 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
801 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
802 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
803 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
804 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
805 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl)
806 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
807 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
808 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
809 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
810 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
811 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
812 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
813 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
815 dnl Some runtimes have these functions with a preceding underscore. Please
816 dnl keep this sync'd with the one above. And if you add any new symbol,
817 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
818 dnl Check to see if certain C math functions exist.
820 dnl Check to see if basic C math functions have float versions.
821 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
823 _acosf _asinf _atanf \
825 _coshf _sinhf _tanhf)
826 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
830 dnl Check to see if basic C math functions have long double versions.
831 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
833 _acosl _asinl _atanl \
835 _coshl _sinhl _tanhl)
836 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
841 CXXFLAGS="$ac_save_CXXFLAGS"
846 dnl Check to see if there is native support for complex
848 dnl Don't compile bits in math/* if native support exits.
850 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "copysignl" is found.
852 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
853 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
854 dnl Check for complex versions of math functions of platform.
855 AC_CHECK_LIB(m, main)
856 AC_REPLACE_MATHFUNCS(nan copysignf)
858 dnl Compile the long double complex functions only if the function
859 dnl provides the non-complex long double functions that are needed.
860 dnl Currently this includes copysignl, which should be
861 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
862 USE_COMPLEX_LONG_DOUBLE=no
863 if test x$ac_cv_func_copysignl = x"yes"; then
864 USE_COMPLEX_LONG_DOUBLE=yes
865 AC_REPLACE_MATHFUNCS(signbitl)
868 AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
872 dnl Check to see what architecture and operating system we are compiling
873 dnl for. Also, if architecture- or OS-specific flags are required for
874 dnl compilation, pick them up here.
876 dnl GLIBCPP_CHECK_TARGET
877 AC_DEFUN(GLIBCPP_CHECK_TARGET, [
878 . [$]{glibcpp_basedir}/configure.target
879 AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
880 AC_MSG_RESULT(OS config directory is $os_include_dir)
885 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
886 dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
887 dnl must have been previously checked.)
889 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
890 dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h
892 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
893 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
895 dnl Test wchar.h for mbstate_t, which is needed for char_traits and
896 dnl others even if wchar_t support is not on.
897 AC_MSG_CHECKING([for mbstate_t])
898 AC_TRY_COMPILE([#include <wchar.h>],
899 [mbstate_t teststate;],
900 have_mbstate_t=yes, have_mbstate_t=no)
901 AC_MSG_RESULT($have_mbstate_t)
902 if test x"$have_mbstate_t" = xyes; then
903 AC_DEFINE(HAVE_MBSTATE_T)
906 dnl Sanity check for existence of ISO C99 headers for extended encoding.
907 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
908 AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
910 dnl Only continue checking if the ISO C99 headers exist and support is on.
911 if test x"$ac_has_wchar_h" = xyes &&
912 test x"$ac_has_wctype_h" = xyes &&
913 test x"$enable_c_mbchar" != xno; then
915 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
916 dnl numeric_limits can instantiate type_traits<wchar_t>
917 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
918 AC_TRY_COMPILE([#include <wchar.h>],
919 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
920 has_wchar_minmax=yes, has_wchar_minmax=no)
921 AC_MSG_RESULT($has_wchar_minmax)
923 dnl Test wchar.h for WEOF, which is what we use to determine whether
924 dnl to specialize for char_traits<wchar_t> or not.
925 AC_MSG_CHECKING([for WEOF])
928 #include <stddef.h>],
930 has_weof=yes, has_weof=no)
931 AC_MSG_RESULT($has_weof)
933 dnl Tests for wide character functions used in char_traits<wchar_t>.
935 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset,, \
938 dnl Checks for names injected into std:: by the c_std headers.
939 AC_CHECK_FUNCS(btowc wctob fgetwc fgetwc fgetws fputwc fputws fwide \
940 fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
941 vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
942 mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
943 wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
944 wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \
947 AC_MSG_CHECKING([for ISO C99 wchar_t support])
948 if test x"$has_weof" = xyes &&
949 test x"$has_wchar_minmax" = xyes &&
950 test x"$ac_wfuncs" = xyes; then
951 ac_isoC99_wchar_t=yes
955 AC_MSG_RESULT($ac_isoC99_wchar_t)
957 dnl Use iconv for wchar_t to char conversions. As such, check for
958 dnl X/Open Portability Guide, version 2 features (XPG2).
959 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
960 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
962 dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
963 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
965 LIBS="$LIBS $libiconv"
967 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
968 ac_XPG2funcs=yes, ac_XPG2funcs=no)
972 AC_MSG_CHECKING([for XPG2 wchar_t support])
973 if test x"$ac_has_iconv_h" = xyes &&
974 test x"$ac_has_langinfo_h" = xyes &&
975 test x"$ac_XPG2funcs" = xyes; then
980 AC_MSG_RESULT($ac_XPG2_wchar_t)
982 dnl At the moment, only enable wchar_t specializations if all the
983 dnl above support is present.
984 AC_MSG_CHECKING([for enabled wchar_t specializations])
985 if test x"$ac_isoC99_wchar_t" = xyes &&
986 test x"$ac_XPG2_wchar_t" = xyes; then
987 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
993 dnl Wide characters disabled by the user.
994 AC_MSG_WARN([wchar_t support disabled.])
1000 dnl Check for special debugging mode; not for production use.
1002 dnl GLIBCPP_ENABLE_DEBUG
1003 dnl --enable-debug sets '-ggdb3 -O0'.
1004 dnl --disable-debug sets '-g' and whatever optimization options the
1005 dnl compiler can handle.
1006 dnl + --enable-maintainer-mode automatically defaults this to on.
1007 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
1008 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
1009 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1010 dnl defaults to `no'.
1011 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
1012 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
1013 AC_ARG_ENABLE(debug,
1014 changequote(<<, >>)dnl
1015 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
1016 changequote([, ])dnl
1017 [case "${enableval}" in
1018 yes) enable_debug=yes ;;
1019 no) enable_debug=no ;;
1020 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
1022 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
1024 dnl Option parsed, now set things appropriately
1025 case "${enable_debug}" in
1027 DEBUG_FLAGS='-O0 -ggdb3'
1033 AC_SUBST(DEBUG_FLAGS)
1038 dnl Check for "unusual" flags to pass to the compiler while building.
1040 dnl GLIBCPP_ENABLE_CXX_FLAGS
1041 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1042 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1043 dnl Somehow this same set of flags must be passed when [re]building
1045 dnl --disable-cxx-flags passes nothing.
1046 dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
1047 dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
1048 dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
1049 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
1050 dnl If "default flags" is an empty string (or "none"), the effect is
1051 dnl the same as --disable or --enable=no.
1052 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1053 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1054 AC_ARG_ENABLE(cxx-flags,
1055 changequote(<<, >>)dnl
1056 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
1057 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1058 changequote([, ])dnl
1059 [case "x$enableval" in
1061 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1063 enable_cxx_flags='' ;;
1065 enable_cxx_flags="$enableval" ;;
1067 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
1069 dnl Thinko on my part during design. This kludge is the workaround.
1070 if test "$enable_cxx_flags" = "none"; then
1071 enable_cxx_flags='';
1074 dnl Run through flags (either default or command-line) and set anything
1075 dnl extra (e.g., #defines) that must accompany particular g++ options.
1076 if test -n "$enable_cxx_flags"; then
1077 for f in $enable_cxx_flags; do
1081 *) # and we're trying to pass /what/ exactly?
1082 AC_MSG_ERROR([compiler flags start with a -]) ;;
1086 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1087 AC_SUBST(EXTRA_CXX_FLAGS)
1092 dnl Check for which locale library to use: gnu or generic.
1094 dnl GLIBCPP_ENABLE_CLOCALE
1095 dnl --enable-clocale=gnu sets config/locale/c_locale_gnu.cc and friends
1096 dnl --enable-clocale=generic sets config/locale/c_locale_generic.cc and friends
1098 dnl default is generic
1100 AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
1101 AC_MSG_CHECKING([for clocale to use])
1102 AC_ARG_ENABLE(clocale,
1103 [ --enable-clocale enable model for target locale package.
1104 --enable-clocale=MODEL use MODEL target-speific locale package. [default=generic]
1106 if test x$enable_clocale = xno; then
1111 enable_clocale_flag=$enable_clocale
1113 dnl Probe for locale support if no specific model is specified.
1114 dnl Default to "generic"
1115 if test x$enable_clocale_flag = xno; then
1116 case x${target_os} in
1118 AC_EGREP_CPP([_GLIBCPP_ok], [
1119 #include <features.h>
1120 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1123 ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
1125 # Test for bugs early in glibc-2.2.x series
1126 if test x$enable_clocale_flag = xgnu; then
1128 #define _GNU_SOURCE 1
1132 const char __one[] = "Äuglein Augmen";
1133 const char __two[] = "Äuglein";
1138 loc = __newlocale(1 << LC_ALL, "de_DE", 0);
1139 loc_dup = __duplocale(loc);
1140 i = __strcoll_l(__one, __two, loc);
1141 j = __strcoll_l(__one, __two, loc_dup);
1145 [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
1146 [enable_clocale_flag=generic])
1149 # ... at some point put __strxfrm_l tests in as well.
1152 enable_clocale_flag=generic
1157 dnl Set configure bits for specified locale package
1158 case x${enable_clocale_flag} in
1160 AC_MSG_RESULT(generic)
1162 # Don't use gettext.
1165 CLOCALE_H=config/locale/generic/c_locale.h
1166 CLOCALE_CC=config/locale/generic/c_locale.cc
1167 CCODECVT_H=config/locale/generic/codecvt_specializations.h
1168 CCOLLATE_CC=config/locale/generic/collate_members.cc
1169 CCTYPE_CC=config/locale/generic/ctype_members.cc
1170 CMESSAGES_H=config/locale/generic/messages_members.h
1171 CMESSAGES_CC=config/locale/generic/messages_members.cc
1172 CMONEY_CC=config/locale/generic/monetary_members.cc
1173 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1174 CTIME_CC=config/locale/generic/time_members.cc
1179 # Declare intention to use gettext, and add support for specific
1181 # For some reason, ALL_LINGUAS has to be before AM_GNU_GETTEXT
1183 # Don't call AM_GNU_GETTEXT here. Instead, assume glibc.
1184 # Need to deal with MSGFMT, USE_NLS, and glibcpp_[P,M]OFILES
1187 # Export the build objects.
1188 for ling in $ALL_LINGUAS; do \
1189 glibcpp_MOFILES="$glibcpp_MOFILES $ling.mo"; \
1190 glibcpp_POFILES="$glibcpp_POFILES $ling.po"; \
1192 AC_SUBST(glibcpp_MOFILES)
1193 AC_SUBST(glibcpp_POFILES)
1195 CLOCALE_H=config/locale/gnu/c_locale.h
1196 CLOCALE_CC=config/locale/gnu/c_locale.cc
1197 CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1198 CCOLLATE_CC=config/locale/gnu/collate_members.cc
1199 CCTYPE_CC=config/locale/gnu/ctype_members.cc
1200 CMESSAGES_H=config/locale/gnu/messages_members.h
1201 CMESSAGES_CC=config/locale/gnu/messages_members.cc
1202 CMONEY_CC=config/locale/gnu/monetary_members.cc
1203 CNUMERIC_CC=config/locale/gnu/numeric_members.cc
1204 CTIME_CC=config/locale/gnu/time_members.cc
1207 AC_MSG_RESULT(generic)
1209 # Don't use gettext.
1212 CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h
1213 CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc
1214 CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1215 CCOLLATE_CC=config/locale/generic/collate_members.cc
1216 CCTYPE_CC=config/locale/generic/ctype_members.cc
1217 CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h
1218 CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc
1219 CMONEY_CC=config/locale/generic/monetary_members.cc
1220 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1221 CTIME_CC=config/locale/generic/time_members.cc
1224 echo "$enable_clocale is an unknown locale package" 1>&2
1229 # This is where the testsuite looks for locale catalogs, using the
1230 # -DLOCALEDIR define during testsuite compilation.
1231 glibcpp_localedir=${glibcpp_builddir}/po/share/locale
1232 AC_SUBST(glibcpp_localedir)
1236 AC_SUBST(CCODECVT_H)
1237 AC_SUBST(CMESSAGES_H)
1238 AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
1239 AC_LINK_FILES($CCOLLATE_CC, src/collate.cc)
1240 AC_LINK_FILES($CCTYPE_CC, src/ctype.cc)
1241 AC_LINK_FILES($CMESSAGES_CC, src/messages.cc)
1242 AC_LINK_FILES($CMONEY_CC, src/monetary.cc)
1243 AC_LINK_FILES($CNUMERIC_CC, src/numeric.cc)
1244 AC_LINK_FILES($CTIME_CC, src/time.cc)
1249 dnl Check for which I/O library to use: libio, or something specific.
1251 dnl GLIBCPP_ENABLE_CSTDIO
1252 dnl --enable-cstdio=libio sets config/io/c_io_libio.h and friends
1254 dnl default is stdio
1256 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1257 AC_MSG_CHECKING([for cstdio to use])
1258 AC_ARG_ENABLE(cstdio,
1259 [ --enable-cstdio enable stdio for target io package.
1260 --enable-cstdio=LIB use LIB target-speific io package. [default=stdio]
1262 if test x$enable_cstdio = xno; then
1265 enable_cstdio=stdio)
1267 enable_cstdio_flag=$enable_cstdio
1269 dnl Check if a valid I/O package
1270 case x${enable_cstdio_flag} in
1272 CSTDIO_H=config/io/c_io_libio.h
1273 BASIC_FILE_H=config/io/basic_file_libio.h
1274 BASIC_FILE_CC=config/io/basic_file_libio.cc
1275 AC_MSG_RESULT(libio)
1277 # see if we are on a system with libio native (ie, linux)
1278 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1280 # Need to check and see what version of glibc is being used. If
1281 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1282 # compile most of libio for linux systems.
1283 if test x$has_libio = x"yes"; then
1286 AC_MSG_CHECKING([for glibc version >= 2.2])
1287 AC_EGREP_CPP([ok], [
1288 #include <features.h>
1289 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1292 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1293 AC_MSG_RESULT($glibc_satisfactory)
1297 # XXX at the moment, admit defeat and force the recompilation
1298 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
1299 glibc_satisfactory=no
1301 if test x$glibc_satisfactory = x"yes"; then
1306 # bkoz XXX need to add checks to enable this
1307 # pme XXX here's a first pass at such a check
1308 if test x$enable_c_mbchar != xno; then
1316 # Using libio, but <libio.h> doesn't exist on the target system. . .
1318 # bkoz XXX need to add checks to enable this
1319 # pme XXX here's a first pass at such a check
1320 if test x$enable_c_mbchar != xno; then
1327 xstdio | x | xno | xnone | xyes)
1329 CSTDIO_H=config/io/c_io_stdio.h
1330 BASIC_FILE_H=config/io/basic_file_stdio.h
1331 BASIC_FILE_CC=config/io/basic_file_stdio.cc
1332 AC_MSG_RESULT(stdio)
1334 # We're not using stdio.
1339 echo "$enable_cstdio is an unknown io package" 1>&2
1344 AC_SUBST(BASIC_FILE_H)
1345 AC_LINK_FILES($BASIC_FILE_CC, src/basic_file.cc)
1347 # 2000-08-04 bkoz hack
1348 CCODECVT_C=config/io/c_io_libio_codecvt.c
1349 AC_SUBST(CCODECVT_C)
1350 # 2000-08-04 bkoz hack
1352 AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO,
1353 test "$need_libio" = yes || test "$need_wlibio" = yes)
1354 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1355 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1356 if test "$need_libio" = yes || test "$need_wlibio" = yes; then
1357 libio_la=../libio/libio.la
1366 dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
1367 dnl We must stage the required headers so that they will be installed
1368 dnl with the library (unlike libgcc, the STL implementation is provided
1369 dnl solely within headers). Since we must not inject random user-space
1370 dnl macro names into user-provided C++ code, we first stage into <file>-in
1371 dnl and process to <file> with an output command. The reason for a two-
1372 dnl stage process here is to correctly handle $srcdir!=$objdir without
1373 dnl having to write complex code (the sed commands to clean the macro
1374 dnl namespace are complex and fragile enough as it is). We must also
1375 dnl add a relative path so that -I- is supported properly.
1377 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1378 AC_MSG_CHECKING([for thread model used by GCC])
1379 target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
1380 AC_MSG_RESULT([$target_thread_file])
1382 if test $target_thread_file != single; then
1383 AC_DEFINE(HAVE_GTHR_DEFAULT)
1384 AC_DEFINE(_GLIBCPP_SUPPORTS_WEAK, __GXX_WEAK__)
1387 glibcpp_thread_h=gthr-$target_thread_file.h
1388 AC_SUBST(glibcpp_thread_h)
1393 dnl Check for exception handling support. If an explicit enable/disable
1394 dnl sjlj exceptions is given, we don't have to detect. Otherwise the
1395 dnl target may or may not support call frame exceptions.
1397 dnl GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
1398 dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
1399 dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1401 dnl Define _GLIBCPP_SJLJ_EXCEPTIONS if the compiler is configured for it.
1403 AC_DEFUN(GLIBCPP_ENABLE_SJLJ_EXCEPTIONS, [
1404 AC_MSG_CHECKING([for exception model to use])
1407 AC_ARG_ENABLE(sjlj-exceptions,
1408 [ --enable-sjlj-exceptions force use of builtin_setjmp for exceptions],
1410 [dnl Botheration. Now we've got to detect the exception model.
1411 dnl Link tests against libgcc.a are problematic since -- at least
1412 dnl as of this writing -- we've not been given proper -L bits for
1413 dnl single-tree newlib and libgloss.
1415 dnl This is what AC_TRY_COMPILE would do if it didn't delete the
1416 dnl conftest files before we got a change to grep them first.
1417 cat > conftest.$ac_ext << EOF
1418 [#]line __oline__ "configure"
1427 old_CXXFLAGS="$CXXFLAGS"
1429 if AC_TRY_EVAL(ac_compile); then
1430 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
1431 enable_sjlj_exceptions=yes
1432 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
1433 enable_sjlj_exceptions=no
1436 CXXFLAGS="$old_CXXFLAGS"
1438 if test x$enable_sjlj_exceptions = xyes; then
1439 AC_DEFINE(_GLIBCPP_SJLJ_EXCEPTIONS, 1,
1440 [Define if the compiler is configured for setjmp/longjmp exceptions.])
1441 ac_exception_model_name=sjlj
1442 elif test x$enable_sjlj_exceptions = xno; then
1443 ac_exception_model_name="call frame"
1445 AC_MSG_ERROR([unable to detect exception model])
1448 AC_MSG_RESULT($ac_exception_model_name)
1453 dnl Check for libunwind exception handling support. If enabled then
1454 dnl we assume that the _Unwind_* functions that make up the Unwind ABI
1455 dnl (_Unwind_RaiseException, _Unwind_Resume, etc.) are defined by
1456 dnl libunwind instead of libgcc and that libstdc++ has a dependency
1457 dnl on libunwind as well as libgcc.
1459 dnl GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS
1460 dnl --enable-libunwind-exceptions forces the use of libunwind.
1461 dnl --disable-libunwind-exceptions assumes there is no libunwind.
1463 dnl Define _GLIBCPP_LIBUNWIND_EXCEPTIONS if requested.
1465 AC_DEFUN(GLIBCPP_ENABLE_LIBUNWIND_EXCEPTIONS, [
1466 AC_MSG_CHECKING([for use of libunwind])
1467 AC_ARG_ENABLE(libunwind-exceptions,
1468 [ --enable-libunwind-exceptions force use of libunwind for exceptions],
1469 use_libunwind_exceptions=$enableval,
1470 use_libunwind_exceptions=no)
1471 AC_MSG_RESULT($use_libunwind_exceptions)
1472 dnl Option parsed, now set things appropriately
1473 if test x"$use_libunwind_exceptions" = xyes; then
1474 LIBUNWIND_FLAG="-lunwind"
1478 AC_SUBST(LIBUNWIND_FLAG)
1482 dnl Check for ISO/IEC 9899:1999 "C99" support.
1484 dnl GLIBCPP_ENABLE_C99
1485 dnl --enable-c99 defines _GLIBCPP_USE_C99
1486 dnl --disable-c99 leaves _GLIBCPP_USE_C99 undefined
1487 dnl + Usage: GLIBCPP_ENABLE_C99[(DEFAULT)]
1488 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1489 dnl defaults to `no'.
1490 dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
1492 dnl GLIBCPP_ENABLE_C99
1493 AC_DEFUN(GLIBCPP_ENABLE_C99, [dnl
1494 define([GLIBCPP_ENABLE_C99_DEFAULT], ifelse($1, yes, yes, no))dnl
1497 changequote(<<, >>)dnl
1498 <<--enable-c99 turns on 'ISO/IEC 9899:1999 support' [default=>>GLIBCPP_ENABLE_C99_DEFAULT],
1499 changequote([, ])dnl
1500 [case "$enableval" in
1501 yes) enable_c99=yes ;;
1502 no) enable_c99=no ;;
1503 *) AC_MSG_ERROR([Unknown argument to enable/disable C99]) ;;
1505 enable_c99=GLIBCPP_ENABLE_C99_DEFAULT)dnl
1510 # Check for the existence of <math.h> functions used if C99 is enabled.
1512 AC_MSG_CHECKING([for ISO C99 support in <math.h>])
1513 AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no])
1514 AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no])
1515 AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no])
1516 AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no])
1517 AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no])
1518 AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no])
1519 AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no])
1520 AC_TRY_COMPILE([#include <math.h>],
1521 [isgreaterequal(0.0,0.0);],, [ac_c99_math=no])
1522 AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no])
1523 AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no])
1524 AC_TRY_COMPILE([#include <math.h>],
1525 [islessgreater(0.0,0.0);],, [ac_c99_math=no])
1526 AC_TRY_COMPILE([#include <math.h>],
1527 [isunordered(0.0,0.0);],, [ac_c99_math=no])
1528 AC_MSG_RESULT($ac_c99_math)
1530 # Check for the existence in <stdio.h> of vscanf, et. al.
1532 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
1533 AC_TRY_COMPILE([#include <stdio.h>],
1534 [snprintf("12", 0, "%i");],, [ac_c99_stdio=no])
1535 AC_TRY_COMPILE([#include <stdio.h>
1537 void foo(char* fmt, ...)
1538 {va_list args; va_start(args, fmt);
1539 vfscanf(stderr, "%i", args);}],
1540 [],, [ac_c99_stdio=no])
1541 AC_TRY_COMPILE([#include <stdio.h>
1543 void foo(char* fmt, ...)
1544 {va_list args; va_start(args, fmt);
1545 vscanf("%i", args);}],
1546 [],, [ac_c99_stdio=no])
1547 AC_TRY_COMPILE([#include <stdio.h>
1549 void foo(char* fmt, ...)
1550 {va_list args; va_start(args, fmt);
1551 vsnprintf(fmt, 0, "%i", args);}],
1552 [],, [ac_c99_stdio=no])
1553 AC_TRY_COMPILE([#include <stdio.h>
1555 void foo(char* fmt, ...)
1556 {va_list args; va_start(args, fmt);
1557 vsscanf(fmt, "%i", args);}],
1558 [],, [ac_c99_stdio=no])
1559 AC_MSG_RESULT($ac_c99_stdio)
1561 # Check for the existence in <stdlib.h> of lldiv_t, et. al.
1563 AC_MSG_CHECKING([for lldiv_t declaration])
1564 AC_CACHE_VAL(ac_c99_lldiv_t, [
1565 AC_TRY_COMPILE([#include <stdlib.h>],
1567 [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no])
1569 AC_MSG_RESULT($ac_c99_lldiv_t)
1571 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
1572 AC_TRY_COMPILE([#include <stdlib.h>],
1573 [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no])
1574 AC_TRY_COMPILE([#include <stdlib.h>],
1575 [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no])
1576 AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no])
1577 AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no])
1578 AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no])
1579 AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no])
1580 if test x"$ac_c99_lldiv_t" = x"no"; then
1583 AC_MSG_RESULT($ac_c99_stdlib)
1585 # Check for the existence of <wchar.h> functions used if C99 is enabled.
1586 # XXX the wchar.h checks should be rolled into the general C99 bits.
1588 AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>])
1589 AC_TRY_COMPILE([#include <wchar.h>],
1590 [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no])
1591 AC_TRY_COMPILE([#include <wchar.h>],
1592 [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no])
1593 AC_TRY_COMPILE([#include <wchar.h>],
1594 [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no])
1595 AC_MSG_RESULT($ac_c99_wchar)
1597 AC_MSG_CHECKING([for enabled ISO C99 support])
1598 if test x"$ac_c99_math" = x"no" ||
1599 test x"$ac_c99_stdio" = x"no" ||
1600 test x"$ac_c99_stdlib" = x"no" ||
1601 test x"$ac_c99_wchar" = x"no"; then
1604 AC_MSG_RESULT($enable_c99)
1606 # Option parsed, now set things appropriately
1607 if test x"$enable_c99" = x"yes"; then
1608 AC_DEFINE(_GLIBCPP_USE_C99)
1616 dnl Check for template specializations for the 'long long' type extension.
1617 dnl The result determines only whether 'long long' I/O is enabled; things
1618 dnl like numeric_limits<> specializations are always available.
1620 dnl GLIBCPP_ENABLE_LONG_LONG
1621 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1622 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1623 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1624 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1625 dnl defaults to `no'.
1626 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1628 dnl GLIBCPP_ENABLE_LONG_LONG
1629 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1630 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1632 AC_ARG_ENABLE(long-long,
1633 changequote(<<, >>)dnl
1634 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1635 changequote([, ])dnl
1636 [case "$enableval" in
1637 yes) enable_long_long=yes ;;
1638 no) enable_long_long=no ;;
1639 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1641 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1646 AC_MSG_CHECKING([for enabled long long I/O support])
1647 # iostreams require strtoll, strtoull to compile
1648 AC_TRY_COMPILE([#include <stdlib.h>],
1649 [char* tmp; strtoll("gnu", &tmp, 10);],,[enable_long_long=no])
1650 AC_TRY_COMPILE([#include <stdlib.h>],
1651 [char* tmp; strtoull("gnu", &tmp, 10);],,[enable_long_long=no])
1653 # Option parsed, now set things appropriately
1654 if test x"$enable_long_long" = xyes; then
1655 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1657 AC_MSG_RESULT($enable_long_long)
1664 dnl Check for what kind of C headers to use.
1666 dnl GLIBCPP_ENABLE_CHEADERS
1667 dnl --enable-cheaders= [does stuff].
1668 dnl --disable-cheaders [does not do anything, really].
1669 dnl + This will eventually need to be 'c_shadow' by default.
1670 dnl + Usage: GLIBCPP_ENABLE_CHEADERS[(DEFAULT)]
1671 dnl Where DEFAULT is either `c' or `c_std' or 'c_shadow'.
1672 dnl If ommitted, it defaults to `c_std'.
1673 AC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl
1674 define([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl
1675 AC_MSG_CHECKING([for c header strategy to use])
1676 AC_ARG_ENABLE(cheaders,
1677 changequote(<<, >>)dnl
1678 << --enable-cheaders construct "C" header files for g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT],
1680 [case "$enableval" in
1685 enable_cheaders=c_std
1688 enable_cheaders=c_shadow
1690 *) AC_MSG_ERROR([Unknown argument to enable/disable "C" headers])
1693 enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT)
1694 AC_MSG_RESULT($enable_cheaders)
1696 dnl Option parsed, now set things appropriately
1697 case "$enable_cheaders" in
1699 CSHADOW_FLAGS="-fno-builtin"
1700 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_shadow'
1701 AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
1705 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_std'
1709 C_INCLUDE_DIR='${glibcpp_srcdir}/include/c'
1713 AC_SUBST(CSHADOW_FLAGS)
1714 AC_SUBST(C_INCLUDE_DIR)
1715 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cheaders" = c_shadow)
1720 dnl Check for wide character support. Has the same effect as the option
1721 dnl in gcc's configure, but in a form that autoconf can mess with.
1723 dnl GLIBCPP_ENABLE_C_MBCHAR
1724 dnl --enable-c-mbchar requests all the wchar_t stuff.
1725 dnl --disable-c-mbchar doesn't.
1726 dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1727 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1728 dnl defaults to `no'.
1729 AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1730 define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1731 AC_ARG_ENABLE(c-mbchar,
1732 changequote(<<, >>)dnl
1733 << --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1734 changequote([, ])dnl
1735 [case "$enableval" in
1736 yes) enable_c_mbchar=yes ;;
1737 no) enable_c_mbchar=no ;;
1738 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1740 enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1741 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1746 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1748 dnl TOPLEVEL_INCLUDES
1749 dnl LIBMATH_INCLUDES
1750 dnl LIBSUPCXX_INCLUDES
1752 dnl CSHADOW_INCLUDES
1754 dnl GLIBCPP_EXPORT_INCLUDES
1755 AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1756 # Root level of the build directory include sources.
1757 GLIBCPP_INCLUDES="-I${glibcpp_builddir}/include/${target_alias} -I${glibcpp_builddir}/include"
1759 # Passed down for canadian crosses.
1760 if test x"$CANADIAN" = xyes; then
1761 TOPLEVEL_INCLUDES='-I$(includedir)'
1764 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1766 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1768 if test x"$need_libio" = xyes; then
1769 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1770 AC_SUBST(LIBIO_INCLUDES)
1773 # Now, export this to all the little Makefiles....
1774 AC_SUBST(GLIBCPP_INCLUDES)
1775 AC_SUBST(TOPLEVEL_INCLUDES)
1776 AC_SUBST(LIBMATH_INCLUDES)
1777 AC_SUBST(LIBSUPCXX_INCLUDES)
1782 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1784 AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1785 # Optimization flags that are probably a good idea for thrill-seekers. Just
1786 # uncomment the lines below and make, everything else is ready to go...
1787 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1789 AC_SUBST(OPTIMIZE_CXXFLAGS)
1791 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1792 AC_SUBST(WARN_FLAGS)
1796 dnl GLIBCPP_EXPORT_INSTALL_INFO
1797 dnl calculates gxx_install_dir
1798 dnl exports glibcpp_toolexecdir
1799 dnl exports glibcpp_toolexeclibdir
1800 dnl exports glibcpp_prefixdir
1802 dnl Assumes cross_compiling bits already done, and with_cross_host in
1805 dnl GLIBCPP_EXPORT_INSTALL_INFO
1806 AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
1807 # Assumes glibcpp_builddir, glibcpp_srcdir are alreay set up and
1808 # exported correctly in GLIBCPP_CONFIGURE.
1809 glibcpp_toolexecdir=no
1810 glibcpp_toolexeclibdir=no
1811 glibcpp_prefixdir=${prefix}
1813 AC_MSG_CHECKING([for interface version number])
1814 libstdcxx_interface=$INTERFACE
1815 AC_MSG_RESULT($libstdcxx_interface)
1817 # Process the option --with-gxx-include-dir=<path to include-files directory>
1818 AC_MSG_CHECKING([for --with-gxx-include-dir])
1819 AC_ARG_WITH(gxx-include-dir,
1820 [ --with-gxx-include-dir the installation directory for include files],
1821 [case "${withval}" in
1823 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
1830 gxx_include_dir=${withval}
1832 esac], [gxx_include_dir=no])
1833 AC_MSG_RESULT($gxx_include_dir)
1835 # Process the option "--enable-version-specific-runtime-libs"
1836 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
1837 AC_ARG_ENABLE(version-specific-runtime-libs,
1838 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
1839 [case "$enableval" in
1840 yes) version_specific_libs=yes ;;
1841 no) version_specific_libs=no ;;
1842 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
1844 version_specific_libs=no)dnl
1845 # Option set, now we can test it.
1846 AC_MSG_RESULT($version_specific_libs)
1848 if test $version_specific_libs = yes; then
1849 # Need the gcc compiler version to know where to install libraries
1850 # and header files if --enable-version-specific-runtime-libs option
1853 gcc_version_trigger=${srcdir}/../gcc/version.c
1854 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'`
1855 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
1856 gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/g++
1857 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1858 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
1862 # Default case for install directory for include files.
1863 if test $version_specific_libs = no &&
1864 test $gxx_include_dir = no; then
1865 gxx_include_dir='$(prefix)'/include/g++-${libstdcxx_interface}
1868 # Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
1869 # Install a library built with a cross compiler in tooldir, not libdir.
1870 if test x"$glibcpp_toolexecdir" = x"no"; then
1871 if test -n "$with_cross_host" &&
1872 test x"$with_cross_host" != x"no"; then
1873 glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
1874 glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)'
1876 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1877 glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)'
1881 AC_MSG_CHECKING([for install location])
1882 AC_MSG_RESULT($gxx_include_dir)
1884 AC_SUBST(glibcpp_prefixdir)
1885 AC_SUBST(gxx_include_dir)
1886 AC_SUBST(glibcpp_toolexecdir)
1887 AC_SUBST(glibcpp_toolexeclibdir)
1891 # Check for functions in math library.
1892 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1894 # This file can be copied and used freely without restrictions. It can
1895 # be used in projects which are not available under the GNU Public License
1896 # but which still want to provide support for the GNU gettext functionality.
1897 # Please note that the actual code is *not* freely available.
1901 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1902 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1903 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1904 AC_SUBST(LIBMATHOBJS)dnl
1909 dnl This macro searches for a GNU version of make. If a match is found, the
1910 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1911 dnl set to "#". This is useful for including a special features in a Makefile,
1912 dnl which cannot be handled by other versions of make. The variable
1913 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1914 dnl the empty string otherwise.
1916 dnl Here is an example of its use:
1918 dnl Makefile.in might contain:
1920 dnl # A failsafe way of putting a dependency rule into a makefile
1922 dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1924 dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1925 dnl @ifGNUmake@ include $(DEPEND)
1926 dnl @ifGNUmake@ endif
1928 dnl Then configure.in would normally contain:
1930 dnl CHECK_GNU_MAKE()
1931 dnl AC_OUTPUT(Makefile)
1933 dnl Then perhaps to cause gnu make to override any other make, we could do
1934 dnl something like this (note that GNU make always looks for GNUmakefile first):
1936 dnl if ! test x$_cv_gnu_make_command = x ; then
1937 dnl mv Makefile GNUmakefile
1938 dnl echo .DEFAULT: > Makefile ;
1939 dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1942 dnl Then, if any (well almost any) other make is called, and GNU make also
1943 dnl exists, then the other make wraps the GNU make.
1945 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1946 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
1948 dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1949 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1950 dnl #### conditional's subshell (" --version" is not a command), using a
1951 dnl #### different option to grep(1).
1953 dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not
1954 dnl #### ${MAKE:-make}).
1957 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1958 _cv_gnu_make_command='' ;
1959 dnl Search all the common names for GNU make
1960 for a in "${MAKE-make}" make gmake gnumake ; do
1961 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
1963 _cv_gnu_make_command=$a ;
1968 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1969 dnl string, '#' otherwise
1970 if test "x$_cv_gnu_make_command" != "x" ; then
1979 dnl Check for headers for, and arguments to, the setrlimit() function.
1980 dnl Used only in testsuite_hooks.h.
1981 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT_ancilliary, [
1982 AC_TRY_COMPILE([#include <sys/resource.h>
1984 ], [ int f = RLIMIT_$1 ; ],
1985 [glibcpp_mresult=1], [glibcpp_mresult=0])
1986 AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcpp_mresult,
1987 [Only used in build directory testsuite_hooks.h.])
1989 AC_DEFUN(GLIBCPP_CHECK_SETRLIMIT, [
1990 setrlimit_have_headers=yes
1991 AC_CHECK_HEADERS(sys/resource.h unistd.h,
1993 setrlimit_have_headers=no)
1994 # If don't have the headers, then we can't run the tests now, and we
1995 # won't be seeing any of these during testsuite compilation.
1996 if test $setrlimit_have_headers = yes; then
1997 # Can't do these in a loop, else the resulting syntax is wrong.
1998 GLIBCPP_CHECK_SETRLIMIT_ancilliary(DATA)
1999 GLIBCPP_CHECK_SETRLIMIT_ancilliary(RSS)
2000 GLIBCPP_CHECK_SETRLIMIT_ancilliary(VMEM)
2001 GLIBCPP_CHECK_SETRLIMIT_ancilliary(AS)
2003 # Check for rlimit, setrlimit.
2004 AC_CACHE_VAL(ac_setrlimit, [
2005 AC_TRY_COMPILE([#include <sys/resource.h>
2008 [ struct rlimit r; setrlimit(0, &r);],
2009 [ac_setrlimit=yes], [ac_setrlimit=no])
2013 AC_MSG_CHECKING([for testsuite memory limit support])
2014 if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then
2016 AC_DEFINE(_GLIBCPP_MEM_LIMITS)
2020 AC_MSG_RESULT($ac_mem_limits)
2025 dnl Does any necessary configuration of the testsuite directory. Generates
2026 dnl the testsuite_hooks.h header.
2028 dnl GLIBCPP_CONFIGURE_TESTSUITE [no args]
2029 AC_DEFUN(GLIBCPP_CONFIGURE_TESTSUITE, [
2030 GLIBCPP_CHECK_SETRLIMIT
2032 # Look for setenv, so that extended locale tests can be performed.
2033 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv)
2037 sinclude(../libtool.m4)
2038 dnl The lines below arrange for aclocal not to bring an installed
2039 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
2040 dnl add a definition of LIBTOOL to Makefile.in.
2041 ifelse(,,,[AC_SUBST(LIBTOOL)
2042 AC_DEFUN([AM_PROG_LIBTOOL])
2043 AC_DEFUN([AC_LIBTOOL_DLOPEN])
2044 AC_DEFUN([AC_PROG_LD])
2048 # Check whether LC_MESSAGES is available in <locale.h>.
2049 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2051 # This file file be copied and used freely without restrictions. It can
2052 # be used in projects which are not available under the GNU Public License
2053 # but which still want to provide support for the GNU gettext functionality.
2054 # Please note that the actual code is *not* freely available.
2058 AC_DEFUN(AC_LC_MESSAGES, [
2059 AC_CHECK_HEADER(locale.h, [
2060 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
2061 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2062 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
2063 if test $ac_cv_val_LC_MESSAGES = yes; then
2064 AC_DEFINE(HAVE_LC_MESSAGES)
2071 dnl Check for whether the Boost-derived checks should be turned on.
2073 dnl GLIBCPP_ENABLE_CONCEPT_CHECKS
2074 dnl --enable-concept-checks turns them on.
2075 dnl --disable-concept-checks leaves them off.
2076 dnl + Usage: GLIBCPP_ENABLE_CONCEPT_CHECKS[(DEFAULT)]
2077 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
2078 dnl defaults to `no'.
2079 AC_DEFUN(GLIBCPP_ENABLE_CONCEPT_CHECKS, [dnl
2080 define([GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT], ifelse($1, yes, yes, no))dnl
2081 AC_ARG_ENABLE(concept-checks,
2082 changequote(<<, >>)dnl
2083 << --enable-concept-checks use Boost-derived template checks [default=>>GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT],
2084 changequote([, ])dnl
2085 [case "$enableval" in
2086 yes) enable_concept_checks=yes ;;
2087 no) enable_concept_checks=no ;;
2088 *) AC_MSG_ERROR([Unknown argument to enable/disable concept checks]) ;;
2090 enable_concept_checks=GLIBCPP_ENABLE_CONCEPT_CHECKS_DEFAULT)dnl
2091 dnl Option parsed, now set things appropriately
2092 if test x"$enable_concept_checks" = xyes; then
2093 AC_DEFINE(_GLIBCPP_CONCEPT_CHECKS)
2099 dnl Add version tags to symbols in shared library (or not), additionally
2100 dnl marking other symbols as private/local (or not).
2102 dnl GLIBCPP_ENABLE_SYMVERS
2103 dnl --enable-symvers=style adds a version script to the linker call when
2104 dnl creating the shared library. The choice of version script is
2105 dnl controlled by 'style'.
2106 dnl --disable-symvers does not.
2107 dnl + Usage: GLIBCPP_ENABLE_SYMVERS[(DEFAULT)]
2108 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
2109 dnl defaults to `no'. Passing `yes' tries to choose a default style
2110 dnl based on linker characteristics. Passing 'no' disables versioning.
2111 AC_DEFUN(GLIBCPP_ENABLE_SYMVERS, [dnl
2112 define([GLIBCPP_ENABLE_SYMVERS_DEFAULT], ifelse($1, yes, yes, no))dnl
2113 AC_ARG_ENABLE(symvers,
2114 changequote(<<, >>)dnl
2115 << --enable-symvers=style enables symbol versioning of the shared library [default=>>GLIBCPP_ENABLE_SYMVERS_DEFAULT],
2116 changequote([, ])dnl
2117 [case "$enableval" in
2118 yes) enable_symvers=yes ;;
2119 no) enable_symvers=no ;;
2120 # other names here, just as sanity checks
2121 #gnu|sun|etcetera) enable_symvers=$enableval ;;
2122 gnu) enable_symvers=$enableval ;;
2123 *) AC_MSG_ERROR([Unknown argument to enable/disable symvers]) ;;
2125 enable_symvers=GLIBCPP_ENABLE_SYMVERS_DEFAULT)dnl
2127 # If we never went through the GLIBCPP_CHECK_LINKER_FEATURES macro, then we
2128 # don't know enough about $LD to do tricks...
2129 if test x$enable_shared = xno ||
2131 test x$glibcpp_gnu_ld_version = x; then
2135 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
2136 AC_MSG_CHECKING([for shared libgcc])
2137 ac_save_CFLAGS="$CFLAGS"
2139 AC_TRY_LINK( , [return 0], glibcpp_shared_libgcc=yes, glibcpp_shared_libgcc=no)
2140 CFLAGS="$ac_save_CFLAGS"
2141 AC_MSG_RESULT($glibcpp_shared_libgcc)
2143 # For GNU ld, we need at least this version. It's 2.12 in the same format
2144 # as the tested-for version. See GLIBCPP_CHECK_LINKER_FEATURES for more.
2145 glibcpp_min_gnu_ld_version=21200
2147 # Check to see if unspecified "yes" value can win, given results
2149 if test $enable_symvers = yes ; then
2150 if test $with_gnu_ld = yes &&
2151 test $glibcpp_shared_libgcc = yes ;
2153 if test $glibcpp_gnu_ld_version -ge $glibcpp_min_gnu_ld_version ; then
2156 ac_test_CFLAGS="${CFLAGS+set}"
2157 ac_save_CFLAGS="$CFLAGS"
2158 CFLAGS='-shared -Wl,--version-script,conftest.map'
2161 echo 'FOO { global: f[a-z]o; local: *; };' > conftest.map
2163 AC_TRY_LINK([int foo;],, enable_symvers=gnu)
2164 if test "$ac_test_CFLAGS" = set; then
2165 CFLAGS="$ac_save_CFLAGS"
2167 # this is the suspicious part
2178 dnl Everything parsed; figure out what file to use.
2179 case $enable_symvers in
2181 LINKER_MAP=config/linker-map.dummy
2184 LINKER_MAP=config/linker-map.gnu
2188 AC_LINK_FILES($LINKER_MAP, src/linker.map)
2189 AM_CONDITIONAL(GLIBCPP_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
2190 AC_MSG_CHECKING([versioning on shared library symbols])
2191 AC_MSG_RESULT($enable_symvers)
2196 # This test replaces the one in autoconf.
2197 # Currently this macro should have the same name as the autoconf macro
2198 # because gettext's gettext.m4 (distributed in the automake package)
2199 # still uses it. Otherwise, the use in gettext.m4 makes autoheader
2200 # give these diagnostics:
2201 # configure.in:556: AC_TRY_COMPILE was called before AC_ISC_POSIX
2202 # configure.in:556: AC_TRY_RUN was called before AC_ISC_POSIX
2204 undefine([AC_ISC_POSIX])
2206 AC_DEFUN([AC_ISC_POSIX],
2208 dnl This test replaces the obsolescent AC_ISC_POSIX kludge.
2209 AC_CHECK_LIB(cposix, strerror, [LIBS="$LIBS -lcposix"])
2213 # Add --enable-maintainer-mode option to configure.
2218 AC_DEFUN([AM_MAINTAINER_MODE],
2219 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
2220 dnl maintainer-mode is disabled by default
2221 AC_ARG_ENABLE(maintainer-mode,
2222 [ --enable-maintainer-mode enable make rules and dependencies not useful
2223 (and sometimes confusing) to the casual installer],
2224 USE_MAINTAINER_MODE=$enableval,
2225 USE_MAINTAINER_MODE=no)
2226 AC_MSG_RESULT($USE_MAINTAINER_MODE)
2227 AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
2228 MAINT=$MAINTAINER_MODE_TRUE
2233 # Define a conditional.
2235 AC_DEFUN([AM_CONDITIONAL],
2246 # Macro to add for using GNU gettext.
2247 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2249 # This file can be copied and used freely without restrictions. It can
2250 # be used in projects which are not available under the GNU Public License
2251 # but which still want to provide support for the GNU gettext functionality.
2252 # Please note that the actual code is *not* freely available.
2256 dnl Usage: AM_WITH_NLS([TOOLSYMBOL], [NEEDSYMBOL], [LIBDIR]).
2257 dnl If TOOLSYMBOL is specified and is 'use-libtool', then a libtool library
2258 dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static,
2259 dnl depending on --{enable,disable}-{shared,static} and on the presence of
2260 dnl AM-DISABLE-SHARED). Otherwise, a static library
2261 dnl $(top_builddir)/intl/libintl.a will be created.
2262 dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext
2263 dnl implementations (in libc or libintl) without the ngettext() function
2264 dnl will be ignored.
2265 dnl LIBDIR is used to find the intl libraries. If empty,
2266 dnl the value `$(top_builddir)/intl/' is used.
2268 dnl The result of the configuration is one of three cases:
2269 dnl 1) GNU gettext, as included in the intl subdirectory, will be compiled
2271 dnl Catalog format: GNU --> install in $(datadir)
2272 dnl Catalog extension: .mo after installation, .gmo in source tree
2273 dnl 2) GNU gettext has been found in the system's C library.
2274 dnl Catalog format: GNU --> install in $(datadir)
2275 dnl Catalog extension: .mo after installation, .gmo in source tree
2276 dnl 3) No internationalization, always use English msgid.
2277 dnl Catalog format: none
2278 dnl Catalog extension: none
2279 dnl The use of .gmo is historical (it was needed to avoid overwriting the
2280 dnl GNU format catalogs when building on a platform with an X/Open gettext),
2281 dnl but we keep it in order not to force irrelevant filename changes on the
2284 AC_DEFUN([AM_WITH_NLS],
2285 [AC_MSG_CHECKING([whether NLS is requested])
2286 dnl Default is enabled NLS
2288 [ --disable-nls do not use Native Language Support],
2289 USE_NLS=$enableval, USE_NLS=yes)
2290 AC_MSG_RESULT($USE_NLS)
2293 BUILD_INCLUDED_LIBINTL=no
2294 USE_INCLUDED_LIBINTL=no
2297 dnl If we use NLS figure out what method
2298 if test "$USE_NLS" = "yes"; then
2299 AC_DEFINE(ENABLE_NLS, 1,
2300 [Define to 1 if translation of program messages to the user's native language
2302 AC_MSG_CHECKING([whether included gettext is requested])
2303 AC_ARG_WITH(included-gettext,
2304 [ --with-included-gettext use the GNU gettext library included here],
2305 nls_cv_force_use_gnu_gettext=$withval,
2306 nls_cv_force_use_gnu_gettext=no)
2307 AC_MSG_RESULT($nls_cv_force_use_gnu_gettext)
2309 nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
2310 if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
2311 dnl User does not insist on using GNU NLS library. Figure out what
2312 dnl to use. If GNU gettext is available we use this. Else we have
2313 dnl to fall back to GNU NLS library.
2316 dnl Add a version number to the cache macros.
2317 define(gt_cv_func_gnugettext_libc, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libc])
2318 define(gt_cv_func_gnugettext_libintl, [gt_cv_func_gnugettext]ifelse([$2], need-ngettext, 2, 1)[_libintl])
2320 AC_CHECK_HEADER(libintl.h,
2321 [AC_CACHE_CHECK([for GNU gettext in libc], gt_cv_func_gnugettext_libc,
2322 [AC_TRY_LINK([#include <libintl.h>
2323 extern int _nl_msg_cat_cntr;],
2324 [bindtextdomain ("", "");
2325 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
2326 gt_cv_func_gnugettext_libc=yes,
2327 gt_cv_func_gnugettext_libc=no)])
2329 if test "$gt_cv_func_gnugettext_libc" != "yes"; then
2330 AC_CACHE_CHECK([for GNU gettext in libintl],
2331 gt_cv_func_gnugettext_libintl,
2332 [gt_save_LIBS="$LIBS"
2333 LIBS="$LIBS -lintl $LIBICONV"
2334 AC_TRY_LINK([#include <libintl.h>
2335 extern int _nl_msg_cat_cntr;],
2336 [bindtextdomain ("", "");
2337 return (int) gettext ("")]ifelse([$2], need-ngettext, [ + (int) ngettext ("", "", 0)], [])[ + _nl_msg_cat_cntr],
2338 gt_cv_func_gnugettext_libintl=yes,
2339 gt_cv_func_gnugettext_libintl=no)
2340 LIBS="$gt_save_LIBS"])
2343 dnl If an already present or preinstalled GNU gettext() is found,
2344 dnl use it. But if this macro is used in GNU gettext, and GNU
2345 dnl gettext is already preinstalled in libintl, we update this
2346 dnl libintl. (Cf. the install rule in intl/Makefile.in.)
2347 if test "$gt_cv_func_gnugettext_libc" = "yes" \
2348 || { test "$gt_cv_func_gnugettext_libintl" = "yes" \
2349 && test "$PACKAGE" != gettext; }; then
2350 AC_DEFINE(HAVE_GETTEXT, 1,
2351 [Define if the GNU gettext() function is already present or preinstalled.])
2353 if test "$gt_cv_func_gnugettext_libintl" = "yes"; then
2354 dnl If iconv() is in a separate libiconv library, then anyone
2355 dnl linking with libintl{.a,.so} also needs to link with
2357 INTLLIBS="-lintl $LIBICONV"
2360 gt_save_LIBS="$LIBS"
2361 LIBS="$LIBS $INTLLIBS"
2362 AC_CHECK_FUNCS(dcgettext)
2363 LIBS="$gt_save_LIBS"
2365 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2366 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl
2367 if test "$MSGFMT" != "no"; then
2368 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2371 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2372 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2378 if test "$CATOBJEXT" = "NONE"; then
2379 dnl GNU gettext is not found in the C library.
2380 dnl Fall back on GNU gettext library.
2381 nls_cv_use_gnu_gettext=yes
2385 if test "$nls_cv_use_gnu_gettext" = "yes"; then
2386 dnl Mark actions used to generate GNU NLS library.
2387 INTLOBJS="\$(GETTOBJS)"
2388 AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt,
2389 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt)
2390 AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT)
2391 AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext,
2392 [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :)
2394 BUILD_INCLUDED_LIBINTL=yes
2395 USE_INCLUDED_LIBINTL=yes
2397 INTLLIBS="ifelse([$3],[],\$(top_builddir)/intl,[$3])/libintl.ifelse([$1], use-libtool, [l], [])a $LIBICONV"
2398 LIBS=`echo " $LIBS " | sed -e 's/ -lintl / /' -e 's/^ //' -e 's/ $//'`
2401 dnl Test whether we really found GNU xgettext.
2402 if test "$XGETTEXT" != ":"; then
2403 dnl If it is no GNU xgettext we define it as : so that the
2404 dnl Makefiles still can work.
2405 if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
2409 [found xgettext program is not GNU xgettext; ignore it])
2414 dnl We need to process the po/ directory.
2418 [for ac_file in $CONFIG_FILES; do
2419 # Support "outfile[:infile[:infile...]]"
2421 *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
2423 # PO directories have a Makefile.in generated from Makefile.in.in.
2424 case "$ac_file" in */Makefile.in)
2425 # Adjust a relative srcdir.
2426 ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'`
2427 ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`"
2428 ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'`
2429 case "$ac_given_srcdir" in
2430 .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;;
2431 /*) top_srcdir="$ac_given_srcdir" ;;
2432 *) top_srcdir="$ac_dots$ac_given_srcdir" ;;
2434 if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then
2435 rm -f "$ac_dir/POTFILES"
2436 echo creating "$ac_dir/POTFILES"
2437 sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," -e "\$s/\(.*\) \\\\/\1/" < "$ac_given_srcdir/$ac_dir/POTFILES.in" > "$ac_dir/POTFILES"
2438 echo creating "$ac_dir/Makefile"
2439 sed -e "/POTFILES =/r $ac_dir/POTFILES" "$ac_dir/Makefile.in" > "$ac_dir/Makefile"
2446 dnl If this is used in GNU gettext we have to set BUILD_INCLUDED_LIBINTL
2447 dnl to 'yes' because some of the testsuite requires it.
2448 if test "$PACKAGE" = gettext; then
2449 BUILD_INCLUDED_LIBINTL=yes
2452 dnl intl/plural.c is generated from intl/plural.y. It requires bison,
2453 dnl because plural.y uses bison specific features. It requires at least
2454 dnl bison-1.26 because earlier versions generate a plural.c that doesn't
2456 dnl bison is only needed for the maintainer (who touches plural.y). But in
2457 dnl order to avoid separate Makefiles or --enable-maintainer-mode, we put
2458 dnl the rule in general Makefile. Now, some people carelessly touch the
2459 dnl files or have a broken "make" program, hence the plural.c rule will
2460 dnl sometimes fire. To avoid an error, defines BISON to ":" if it is not
2461 dnl present or too old.
2462 AC_CHECK_PROGS([INTLBISON], [bison])
2463 if test -z "$INTLBISON"; then
2466 dnl Found it, now check the version.
2467 AC_MSG_CHECKING([version of bison])
2468 changequote(<<,>>)dnl
2469 ac_prog_version=`$INTLBISON --version 2>&1 | sed -n 's/^.*GNU Bison .* \([0-9]*\.[0-9.]*\).*$/\1/p'`
2470 case $ac_prog_version in
2471 '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
2472 1.2[6-9]* | 1.[3-9][0-9]* | [2-9].*)
2474 ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
2475 *) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
2477 AC_MSG_RESULT([$ac_prog_version])
2479 if test $ac_verc_fail = yes; then
2483 dnl These rules are solely for the distribution goal. While doing this
2484 dnl we only have to keep exactly one list of the available catalogs
2485 dnl in configure.in.
2486 for lang in $ALL_LINGUAS; do
2487 GMOFILES="$GMOFILES $lang.gmo"
2488 POFILES="$POFILES $lang.po"
2491 dnl Make all variables we use known to autoconf.
2492 AC_SUBST(BUILD_INCLUDED_LIBINTL)
2493 AC_SUBST(USE_INCLUDED_LIBINTL)
2502 dnl For backward compatibility. Some configure.ins may be using this.
2504 nls_cv_header_libgt=
2506 dnl For backward compatibility. Some Makefiles may be using this.
2508 AC_SUBST(DATADIRNAME)
2510 dnl For backward compatibility. Some Makefiles may be using this.
2512 AC_SUBST(INSTOBJEXT)
2514 dnl For backward compatibility. Some Makefiles may be using this.
2519 dnl Usage: Just like AM_WITH_NLS, which see.
2520 AC_DEFUN([AM_GNU_GETTEXT],
2521 [AC_REQUIRE([AC_PROG_MAKE_SET])dnl
2522 AC_REQUIRE([AC_PROG_CC])dnl
2523 AC_REQUIRE([AC_CANONICAL_HOST])dnl
2524 AC_REQUIRE([AC_PROG_RANLIB])dnl
2525 AC_REQUIRE([AC_ISC_POSIX])dnl
2526 AC_REQUIRE([AC_HEADER_STDC])dnl
2527 AC_REQUIRE([AC_C_CONST])dnl
2528 AC_REQUIRE([AC_C_INLINE])dnl
2529 AC_REQUIRE([AC_TYPE_OFF_T])dnl
2530 AC_REQUIRE([AC_TYPE_SIZE_T])dnl
2531 AC_REQUIRE([AC_FUNC_ALLOCA])dnl
2532 AC_REQUIRE([AC_FUNC_MMAP])dnl
2533 AC_REQUIRE([jm_GLIBC21])dnl
2535 AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h stddef.h \
2536 stdlib.h string.h unistd.h sys/param.h])
2537 AC_CHECK_FUNCS([feof_unlocked fgets_unlocked getcwd getegid geteuid \
2538 getgid getuid mempcpy munmap putenv setenv setlocale stpcpy strchr strcasecmp \
2539 strdup strtoul tsearch __argz_count __argz_stringify __argz_next])
2544 AM_WITH_NLS([$1],[$2],[$3])
2546 if test "x$CATOBJEXT" != "x"; then
2547 if test "x$ALL_LINGUAS" = "x"; then
2550 AC_MSG_CHECKING(for catalogs to be installed)
2552 for presentlang in $ALL_LINGUAS; do
2554 for desiredlang in ${LINGUAS-$ALL_LINGUAS}; do
2555 # Use the presentlang catalog if desiredlang is
2556 # a. equal to presentlang, or
2557 # b. a variant of presentlang (because in this case,
2558 # presentlang can be used as a fallback for messages
2559 # which are not translated in the desiredlang catalog).
2560 case "$desiredlang" in
2561 "$presentlang"*) useit=yes;;
2564 if test $useit = yes; then
2565 NEW_LINGUAS="$NEW_LINGUAS $presentlang"
2568 LINGUAS=$NEW_LINGUAS
2569 AC_MSG_RESULT($LINGUAS)
2572 dnl Construct list of names of catalog files to be constructed.
2573 if test -n "$LINGUAS"; then
2574 for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
2578 dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly
2579 dnl find the mkinstalldirs script in another subdir but $(top_srcdir).
2580 dnl Try to locate is.
2582 if test -n "$ac_aux_dir"; then
2583 MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
2585 if test -z "$MKINSTALLDIRS"; then
2586 MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
2588 AC_SUBST(MKINSTALLDIRS)
2590 dnl Enable libtool support if the surrounding package wishes it.
2591 INTL_LIBTOOL_SUFFIX_PREFIX=ifelse([$1], use-libtool, [l], [])
2592 AC_SUBST(INTL_LIBTOOL_SUFFIX_PREFIX)
2595 # Search path for a program which passes the given test.
2596 # Ulrich Drepper <drepper@cygnus.com>, 1996.
2598 # This file can be copied and used freely without restrictions. It can
2599 # be used in projects which are not available under the GNU Public License
2600 # but which still want to provide support for the GNU gettext functionality.
2601 # Please note that the actual code is *not* freely available.
2605 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
2606 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
2607 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
2608 [# Extract the first word of "$2", so it can be a program name with args.
2609 set dummy $2; ac_word=[$]2
2610 AC_MSG_CHECKING([for $ac_word])
2611 AC_CACHE_VAL(ac_cv_path_$1,
2614 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
2617 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
2618 for ac_dir in ifelse([$5], , $PATH, [$5]); do
2619 test -z "$ac_dir" && ac_dir=.
2620 if test -f $ac_dir/$ac_word; then
2622 ac_cv_path_$1="$ac_dir/$ac_word"
2628 dnl If no 4th arg is given, leave the cache variable unset,
2629 dnl so AC_PATH_PROGS will keep looking.
2630 ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
2635 if test -n "[$]$1"; then
2636 AC_MSG_RESULT([$]$1)
2645 # Test for the GNU C Library, version 2.1 or newer.
2646 # From Bruno Haible.
2648 AC_DEFUN([jm_GLIBC21],
2650 AC_CACHE_CHECK(whether we are using the GNU C Library 2.1 or newer,
2651 ac_cv_gnu_library_2_1,
2652 [AC_EGREP_CPP([Lucky GNU user],
2654 #include <features.h>
2655 #ifdef __GNU_LIBRARY__
2656 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || (__GLIBC__ > 2)
2661 ac_cv_gnu_library_2_1=yes,
2662 ac_cv_gnu_library_2_1=no)
2666 GLIBC21="$ac_cv_gnu_library_2_1"
2672 dnl From Bruno Haible.
2674 AC_DEFUN([AM_ICONV],
2676 dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
2677 dnl those with the standalone portable GNU libiconv installed).
2679 AC_ARG_WITH([libiconv-prefix],
2680 [ --with-libiconv-prefix=DIR search for libiconv in DIR/include and DIR/lib], [
2681 for dir in `echo "$withval" | tr : ' '`; do
2682 if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
2683 if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
2687 AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
2688 am_cv_func_iconv="no, consider installing GNU libiconv"
2690 AC_TRY_LINK([#include <stdlib.h>
2691 #include <iconv.h>],
2692 [iconv_t cd = iconv_open("","");
2693 iconv(cd,NULL,NULL,NULL,NULL);
2695 am_cv_func_iconv=yes)
2696 if test "$am_cv_func_iconv" != yes; then
2697 am_save_LIBS="$LIBS"
2698 LIBS="$LIBS -liconv"
2699 AC_TRY_LINK([#include <stdlib.h>
2700 #include <iconv.h>],
2701 [iconv_t cd = iconv_open("","");
2702 iconv(cd,NULL,NULL,NULL,NULL);
2705 am_cv_func_iconv=yes)
2706 LIBS="$am_save_LIBS"
2709 if test "$am_cv_func_iconv" = yes; then
2710 AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
2711 AC_MSG_CHECKING([for iconv declaration])
2712 AC_CACHE_VAL(am_cv_proto_iconv, [
2720 #if defined(__STDC__) || defined(__cplusplus)
2721 size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
2725 ], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
2726 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);"])
2727 am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
2728 AC_MSG_RESULT([$]{ac_t:-
2729 }[$]am_cv_proto_iconv)
2730 AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
2731 [Define as const if the declaration of iconv() needs const.])
2734 if test "$am_cv_lib_iconv" = yes; then
2742 dnl From Bruno Haible.
2744 AC_DEFUN([AM_LANGINFO_CODESET],
2746 AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset,
2747 [AC_TRY_LINK([#include <langinfo.h>],
2748 [char* cs = nl_langinfo(CODESET);],
2749 am_cv_langinfo_codeset=yes,
2750 am_cv_langinfo_codeset=no)
2752 if test $am_cv_langinfo_codeset = yes; then
2753 AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
2754 [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
2758 # Check whether LC_MESSAGES is available in <locale.h>.
2759 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2761 # This file can be copied and used freely without restrictions. It can
2762 # be used in projects which are not available under the GNU Public License
2763 # but which still want to provide support for the GNU gettext functionality.
2764 # Please note that the actual code is *not* freely available.
2768 AC_DEFUN([AM_LC_MESSAGES],
2769 [if test $ac_cv_header_locale_h = yes; then
2770 AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES,
2771 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2772 am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)])
2773 if test $am_cv_val_LC_MESSAGES = yes; then
2774 AC_DEFINE(HAVE_LC_MESSAGES, 1,
2775 [Define if your <locale.h> file defines LC_MESSAGES.])
2779 # Do all the work for Automake. This macro actually does too much --
2780 # some checks are only needed if your package does certain things.
2781 # But this isn't really a big deal.
2786 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
2788 AC_DEFUN([AM_INIT_AUTOMAKE],
2789 [AC_REQUIRE([AC_PROG_INSTALL])
2794 dnl test to see if srcdir already configured
2795 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
2796 AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
2799 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
2800 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
2801 AC_REQUIRE([AM_SANITY_CHECK])
2802 AC_REQUIRE([AC_ARG_PROGRAM])
2803 dnl FIXME This is truly gross.
2804 missing_dir=`cd $ac_aux_dir && pwd`
2805 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
2806 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
2807 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
2808 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
2809 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
2810 AC_REQUIRE([AC_PROG_MAKE_SET])])
2813 # Check to make sure that the build environment is sane.
2816 AC_DEFUN([AM_SANITY_CHECK],
2817 [AC_MSG_CHECKING([whether build environment is sane])
2820 echo timestamp > conftestfile
2821 # Do `set' in a subshell so we don't clobber the current shell's
2822 # arguments. Must try -L first in case configure is actually a
2823 # symlink; some systems play weird games with the mod time of symlinks
2824 # (eg FreeBSD returns the mod time of the symlink's containing
2827 set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
2828 if test "[$]*" = "X"; then
2830 set X `ls -t $srcdir/configure conftestfile`
2832 if test "[$]*" != "X $srcdir/configure conftestfile" \
2833 && test "[$]*" != "X conftestfile $srcdir/configure"; then
2835 # If neither matched, then we have a broken ls. This can happen
2836 # if, for instance, CONFIG_SHELL is bash and it inherits a
2837 # broken ls alias from the environment. This has actually
2838 # happened. Such a system could not be considered "sane".
2839 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
2840 alias in your environment])
2843 test "[$]2" = conftestfile
2849 AC_MSG_ERROR([newly created file is older than distributed files!
2850 Check your system clock])
2853 AC_MSG_RESULT(yes)])
2855 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
2856 dnl The program must properly implement --version.
2857 AC_DEFUN([AM_MISSING_PROG],
2858 [AC_MSG_CHECKING(for working $2)
2859 # Run test in a subshell; some versions of sh will print an error if
2860 # an executable is not found, even if stderr is redirected.
2861 # Redirect stdin to placate older versions of autoconf. Sigh.
2862 if ($2 --version) < /dev/null > /dev/null 2>&1; then
2864 AC_MSG_RESULT(found)
2867 AC_MSG_RESULT(missing)
2871 # Like AC_CONFIG_HEADER, but automatically create stamp file.
2873 AC_DEFUN([AM_CONFIG_HEADER],
2875 AC_CONFIG_HEADER([$1])
2876 dnl When config.status generates a header, we must update the stamp-h file.
2877 dnl This file resides in the same directory as the config header
2878 dnl that is generated. We must strip everything past the first ":",
2879 dnl and everything past the last "/".
2880 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
2881 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
2882 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
2884 for am_file in <<$1>>; do
2885 case " <<$>>CONFIG_HEADERS " in
2886 *" <<$>>am_file "*<<)>>
2887 echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
2890 am_indx=`expr "<<$>>am_indx" + 1`