acinclude.m4 (GLIBCC_ENABLE_SYMVERS): Tweak comments.
[official-gcc.git] / libstdc++-v3 / acinclude.m4
blob953c46090b44ace96b29ee1ec2b17b51a76dfca5
1 dnl
2 dnl Initialize basic configure bits, set toplevel_srcdir for Makefiles.
3 dnl
4 dnl GLIBCXX_TOPREL_CONFIGURE
5 AC_DEFUN(GLIBCXX_TOPREL_CONFIGURE, [
6   dnl Default to --enable-multilib (this is also passed by default
7   dnl from the ubercommon-top-level configure)
8   AC_ARG_ENABLE(multilib,
9   [  --enable-multilib       build hella library versions (default)],
10   [case "${enableval}" in
11     yes) multilib=yes ;;
12     no)  multilib=no ;;
13     *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
14    esac], [multilib=yes])dnl
16   # When building with srcdir == objdir, links to the source files will
17   # be created in directories within the target_subdir.  We have to
18   # adjust toplevel_srcdir accordingly, so that configure finds
19   # install-sh and other auxiliary files that live in the top-level
20   # source directory.
21   if test "${srcdir}" = "."; then
22     if test -z "${with_target_subdir}"; then
23       toprel=".."
24     else
25       if test "${with_target_subdir}" != "."; then
26         toprel="${with_multisrctop}../.."
27       else
28         toprel="${with_multisrctop}.."
29       fi
30     fi
31   else
32     toprel=".."
33   fi
34   AC_CONFIG_AUX_DIR(${srcdir}/$toprel)
35   toplevel_srcdir=\${top_srcdir}/$toprel
36   AC_SUBST(toplevel_srcdir)
39 dnl
40 dnl Initialize the rest of the library configury.
41 dnl
42 dnl GLIBCXX_CONFIGURE
43 AC_DEFUN(GLIBCXX_CONFIGURE, [
44   # Export build and source directories.
45   # These need to be absolute paths, yet at the same time need to
46   # canonicalize only relative paths, because then amd will not unmount
47   # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
48   glibcxx_builddir=`${PWDCMD-pwd}`
49   case $srcdir in
50   [\\/$]* | ?:[\\/]*) glibcxx_srcdir=${srcdir} ;;
51   *) glibcxx_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
52   esac
53   AC_SUBST(glibcxx_builddir)
54   AC_SUBST(glibcxx_srcdir)
56   dnl This is here just to satisfy automake.
57   ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)])
59   AC_PROG_AWK
60   # Will set LN_S to either 'ln -s' or 'ln'.  With autoconf 2.5x, can also
61   # be 'cp -p' if linking isn't available.  Uncomment the next line to
62   # force a particular method.
63   #ac_cv_prog_LN_S='cp -p'
64   AC_PROG_LN_S
66   # We use these options to decide which functions to include.
67   AC_ARG_WITH(target-subdir,
68   [  --with-target-subdir=SUBDIR
69                           configuring in a subdirectory])
70   AC_ARG_WITH(cross-host,
71   [  --with-cross-host=HOST  configuring with a cross compiler])
73   AC_ARG_WITH(newlib,
74   [  --with-newlib                    Configuring with newlib])
76   glibcxx_basedir=$srcdir/$toprel/$1/libstdc++-v3
77   AC_SUBST(glibcxx_basedir)
79   # Never versions of autoconf add an underscore to these functions.
80   # Prevent future problems ...
81   ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
82   ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
83   ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
84   ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
86   # AC_PROG_CC
87   # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
88   # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
89   # are probably using a cross compiler, which will not be able to fully
90   # link an executable.  This is addressed in later versions of autoconf.
92   AC_DEFUN(LIB_AC_PROG_CC,
93   [AC_BEFORE([$0], [AC_PROG_CPP])dnl
94   dnl Fool anybody using AC_PROG_CC.
95   AC_PROVIDE([AC_PROG_CC])
96   AC_CHECK_PROG(CC, gcc, gcc)
97   if test -z "$CC"; then
98     AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
99     test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
100   fi
102   AC_PROG_CC_GNU
104   if test $ac_cv_prog_gcc = yes; then
105     GCC=yes
106   dnl Check whether -g works, even if CFLAGS is set, in case the package
107   dnl plays around with CFLAGS (such as to build both debugging and
108   dnl normal versions of a library), tasteless as that idea is.
109     ac_test_CFLAGS="${CFLAGS+set}"
110     ac_save_CFLAGS="$CFLAGS"
111     CFLAGS=
112     AC_PROG_CC_G
113     if test "$ac_test_CFLAGS" = set; then
114       CFLAGS="$ac_save_CFLAGS"
115     elif test $ac_cv_prog_cc_g = yes; then
116       CFLAGS="-g -O2"
117     else
118       CFLAGS="-O2"
119     fi
120   else
121     GCC=
122     test "${CFLAGS+set}" = set || CFLAGS="-g"
123   fi
124   ])
126   LIB_AC_PROG_CC
128   # Likewise for AC_PROG_CXX.  We can't just call it directly because g++
129   # will try to link in libstdc++.
130   AC_DEFUN(LIB_AC_PROG_CXX,
131   [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
132   dnl Fool anybody using AC_PROG_CXX.
133   AC_PROVIDE([AC_PROG_CXX])
134   # Use glibcxx_CXX so that we do not cause CXX to be cached with the
135   # flags that come in CXX while configuring libstdc++.  They're different
136   # from those used for all other target libraries.  If CXX is set in
137   # the environment, respect that here.
138   glibcxx_CXX=$CXX
139   AC_CHECK_PROGS(glibcxx_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
140   AC_SUBST(glibcxx_CXX)
141   CXX=$glibcxx_CXX
142   test -z "$glibcxx_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
144   AC_PROG_CXX_GNU
146   if test $ac_cv_prog_gxx = yes; then
147     GXX=yes
148     dnl Check whether -g works, even if CXXFLAGS is set, in case the package
149     dnl plays around with CXXFLAGS (such as to build both debugging and
150     dnl normal versions of a library), tasteless as that idea is.
151     ac_test_CXXFLAGS="${CXXFLAGS+set}"
152     ac_save_CXXFLAGS="$CXXFLAGS"
153     CXXFLAGS=
154     AC_PROG_CXX_G
155     if test "$ac_test_CXXFLAGS" = set; then
156       CXXFLAGS="$ac_save_CXXFLAGS"
157     elif test $ac_cv_prog_cxx_g = yes; then
158       CXXFLAGS="-g -O2"
159     else
160       CXXFLAGS="-O2"
161     fi
162   else
163     GXX=
164     test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
165   fi
166   ])
168   LIB_AC_PROG_CXX
170   # For directory versioning (e.g., headers) and other variables.
171   AC_MSG_CHECKING([for GCC version number])
172   gcc_version=`$glibcxx_CXX -dumpversion`
173   AC_MSG_RESULT($gcc_version)
175   # For some reason, gettext needs this.
176   AC_ISC_POSIX
178   AC_CHECK_TOOL(AS, as)
179   AC_CHECK_TOOL(AR, ar)
180   AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
181   AC_PROG_INSTALL
183   AM_MAINTAINER_MODE
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
191   # the result.
192   if false; then
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.
196     :
197     AC_EXEEXT
198   fi
200   case [$]{glibcxx_basedir} in
201     /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcxx_basedir} ;;
202     *) glibcxx_flagbasedir='[$](top_builddir)/'[$]{glibcxx_basedir} ;;
203   esac
205   # Set up safe default values for all subsequent AM_CONDITIONAL tests.
206   need_libmath=no
207   enable_wchar_t=no
208   #enable_debug=no
209   #glibcxx_pch_comp=no
210   #enable_cheaders=c
211   #c_compatibility=no
212   #enable_abi_check=no
213   #enable_symvers=no
215   # Find platform-specific directories containing configuration info.  In
216   # addition to possibly modifying the same flags, it also sets up symlinks.
217   GLIBCXX_CHECK_HOST
222 dnl Check to see if g++ can compile this library, and if so, if any version-
223 dnl specific precautions need to be taken.
225 dnl GLIBCXX_CHECK_COMPILER_VERSION
226 AC_DEFUN(GLIBCXX_CHECK_COMPILER_VERSION, [
227 if test ! -f stamp-sanity-compiler; then
228   AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3])
229   AC_LANG_SAVE
230   AC_LANG_CPLUSPLUS
231   AC_TRY_COMPILE(, [
232   #if __GNUC__ < 3
233     not_ok
234   #endif
235   ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to GCC 3.0 or above]))
236   AC_LANG_RESTORE
237   AC_MSG_RESULT($gpp_satisfactory)
238   touch stamp-sanity-compiler
244 dnl Tests for newer compiler features, or features that are present in newer
245 dnl compiler versions but not older compiler versions still in use, should
246 dnl be placed here.
248 dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
249 dnl new inlining code or the new system_header pragma will die on -Werror.
250 dnl Leave it out by default and use maint-mode to use it.
252 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
253 dnl compiler supports it and the user has not requested debug mode.
255 dnl GLIBCXX_CHECK_COMPILER_FEATURES
256 AC_DEFUN(GLIBCXX_CHECK_COMPILER_FEATURES, [
257   # All these tests are for C++; save the language and the compiler flags.
258   # The CXXFLAGS thing is suspicious, but based on similar bits previously
259   # found in GLIBCXX_CONFIGURE.
260   AC_LANG_SAVE
261   AC_LANG_CPLUSPLUS
262   ac_test_CXXFLAGS="${CXXFLAGS+set}"
263   ac_save_CXXFLAGS="$CXXFLAGS"
265   # Check for maintainer-mode bits.
266   if test x"$USE_MAINTAINER_MODE" = xno; then
267     WERROR=''
268   else
269     WERROR='-Werror'
270   fi
272   # Check for -ffunction-sections -fdata-sections
273   AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
274   CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
275   AC_TRY_COMPILE(, [int foo;
276   ], [ac_fdsections=yes], [ac_fdsections=no])
277   if test "$ac_test_CXXFLAGS" = set; then
278     CXXFLAGS="$ac_save_CXXFLAGS"
279   else
280     # this is the suspicious part
281     CXXFLAGS=''
282   fi
283   if test x"$ac_fdsections" = x"yes"; then
284     SECTION_FLAGS='-ffunction-sections -fdata-sections'
285   fi
286   AC_MSG_RESULT($ac_fdsections)
288   AC_LANG_RESTORE
289   AC_SUBST(WERROR)
290   AC_SUBST(SECTION_FLAGS)
295 dnl If GNU ld is in use, check to see if tricky linker opts can be used.  If
296 dnl the native linker is in use, all variables will be defined to something
297 dnl safe (like an empty string).
299 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
300 dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
301 dnl Define LD, with_gnu_ld, and (possibly) glibcxx_gnu_ld_version as
302 dnl side-effects of testing.  The last will be a single integer, e.g.,
303 dnl version 1.23.45.0.67.89 will set glibcxx_gnu_ld_version to 12345.
305 dnl GLIBCXX_CHECK_LINKER_FEATURES
306 AC_DEFUN(GLIBCXX_CHECK_LINKER_FEATURES, [
307   # If we're not using GNU ld, then there's no point in even trying these
308   # tests.  Check for that first.  We should have already tested for gld
309   # by now (in libtool), but require it now just to be safe...
310   test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
311   test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
312   AC_REQUIRE([AC_PROG_LD])
314   # The name set by libtool depends on the version of libtool.  Shame on us
315   # for depending on an impl detail, but c'est la vie.  Older versions used
316   # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
317   # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
318   # makes sense).  We'll test with_gnu_ld everywhere else, so if that isn't
319   # set (hence we're using an older libtool), then set it.
320   if test x${with_gnu_ld+set} != xset; then
321     if test x${ac_cv_prog_gnu_ld+set} != xset; then
322       # We got through "ac_require(ac_prog_ld)" and still not set?  Huh?
323       with_gnu_ld=no
324     else
325       with_gnu_ld=$ac_cv_prog_gnu_ld
326     fi
327   fi
329   # Start by getting the version number.  I think the libtool test already
330   # does some of this, but throws away the result.
331   changequote(,)
332   ldver=`$LD --version 2>/dev/null | head -1 | \
333          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
334   changequote([,])
335   glibcxx_gnu_ld_version=`echo $ldver | \
336          $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
338   # Set --gc-sections.
339   if test "$with_gnu_ld" = "notbroken"; then
340     # GNU ld it is!  Joy and bunny rabbits!
342     # All these tests are for C++; save the language and the compiler flags.
343     # Need to do this so that g++ won't try to link in libstdc++
344     ac_test_CFLAGS="${CFLAGS+set}"
345     ac_save_CFLAGS="$CFLAGS"
346     CFLAGS='-x c++  -Wl,--gc-sections'
348     # Check for -Wl,--gc-sections
349     # XXX This test is broken at the moment, as symbols required for
350     # linking are now in libsupc++ (not built yet.....). In addition,
351     # this test has cored on solaris in the past. In addition,
352     # --gc-sections doesn't really work at the moment (keeps on discarding
353     # used sections, first .eh_frame and now some of the glibc sections for
354     # iconv). Bzzzzt. Thanks for playing, maybe next time.
355     AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
356     AC_TRY_RUN([
357      int main(void)
358      {
359        try { throw 1; }
360        catch (...) { };
361        return 0;
362      }
363     ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
364     if test "$ac_test_CFLAGS" = set; then
365       CFLAGS="$ac_save_CFLAGS"
366     else
367       # this is the suspicious part
368       CFLAGS=''
369     fi
370     if test "$ac_sectionLDflags" = "yes"; then
371       SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
372     fi
373     AC_MSG_RESULT($ac_sectionLDflags)
374   fi
376   # Set linker optimization flags.
377   if test x"$with_gnu_ld" = x"yes"; then
378     OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
379   fi
381   AC_SUBST(SECTION_LDFLAGS)
382   AC_SUBST(OPT_LDFLAGS)
387 dnl Check to see if the (math function) argument passed is
388 dnl declared when using the c++ compiler
389 dnl ASSUMES argument is a math function with ONE parameter
391 dnl GLIBCXX_CHECK_MATH_DECL_1
392 AC_DEFUN(GLIBCXX_CHECK_MATH_DECL_1, [
393   AC_MSG_CHECKING([for $1 declaration])
394   if test x${glibcxx_cv_func_$1_use+set} != xset; then
395     AC_CACHE_VAL(glibcxx_cv_func_$1_use, [
396       AC_LANG_SAVE
397       AC_LANG_CPLUSPLUS
398       AC_TRY_COMPILE([#include <math.h>
399                       #ifdef HAVE_IEEEFP_H
400                       #include <ieeefp.h>
401                       #endif
402                      ],
403                      [ $1(0);],
404                      [glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no])
405       AC_LANG_RESTORE
406     ])
407   fi
408   AC_MSG_RESULT($glibcxx_cv_func_$1_use)
412 dnl Check to see if the (math function) argument passed is
413 dnl 1) declared when using the c++ compiler
414 dnl 2) has "C" linkage
415 dnl 3) if not, see if 1) and 2) for argument prepended with '_'
417 dnl Define HAVE_CARGF etc if "cargf" is declared and links
419 dnl argument 1 is name of function to check
421 dnl ASSUMES argument is a math function with ONE parameter
423 dnl GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1
424 AC_DEFUN(GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1, [
425   GLIBCXX_CHECK_MATH_DECL_1($1)
426   if test x$glibcxx_cv_func_$1_use = x"yes"; then
427     AC_CHECK_FUNCS($1)
428   else
429     GLIBCXX_CHECK_MATH_DECL_1(_$1)
430     if test x$glibcxx_cv_func__$1_use = x"yes"; then
431       AC_CHECK_FUNCS(_$1)
432     fi
433   fi
438 dnl Like GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
439 dnl of functions at once.  It's an all-or-nothing check -- either
440 dnl HAVE_XYZ is defined for each of the functions, or for none of them.
441 dnl Doing it this way saves significant configure time.
442 AC_DEFUN(GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1, [
443   AC_MSG_CHECKING([for $1 functions])
444   AC_CACHE_VAL(glibcxx_cv_func_$2_use, [
445     AC_LANG_SAVE
446     AC_LANG_CPLUSPLUS
447     AC_TRY_COMPILE([#include <math.h>],
448                    [ `for x in $3; do echo "$x (0);"; done` ],
449                    [glibcxx_cv_func_$2_use=yes],
450                    [glibcxx_cv_func_$2_use=no])
451     AC_LANG_RESTORE])
452   AC_MSG_RESULT($glibcxx_cv_func_$2_use)
453   if test x$glibcxx_cv_func_$2_use = x"yes"; then
454     AC_CHECK_FUNCS($3)
455   fi
459 dnl Check to see if the (math function) argument passed is
460 dnl declared when using the c++ compiler
461 dnl ASSUMES argument is a math function with TWO parameters
463 dnl GLIBCXX_CHECK_MATH_DECL_2
464 AC_DEFUN(GLIBCXX_CHECK_MATH_DECL_2, [
465   AC_MSG_CHECKING([for $1 declaration])
466   if test x${glibcxx_cv_func_$1_use+set} != xset; then
467     AC_CACHE_VAL(glibcxx_cv_func_$1_use, [
468       AC_LANG_SAVE
469       AC_LANG_CPLUSPLUS
470       AC_TRY_COMPILE([#include <math.h>],
471                      [ $1(0, 0);],
472                      [glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no])
473       AC_LANG_RESTORE
474     ])
475   fi
476   AC_MSG_RESULT($glibcxx_cv_func_$1_use)
480 dnl Check to see if the (math function) argument passed is
481 dnl 1) declared when using the c++ compiler
482 dnl 2) has "C" linkage
484 dnl Define HAVE_CARGF etc if "cargf" is declared and links
486 dnl argument 1 is name of function to check
488 dnl ASSUMES argument is a math function with TWO parameters
490 dnl GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2
491 AC_DEFUN(GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2, [
492   GLIBCXX_CHECK_MATH_DECL_2($1)
493   if test x$glibcxx_cv_func_$1_use = x"yes"; then
494     AC_CHECK_FUNCS($1)
495   else
496     GLIBCXX_CHECK_MATH_DECL_2(_$1)
497     if test x$glibcxx_cv_func__$1_use = x"yes"; then
498       AC_CHECK_FUNCS(_$1)
499     fi
500   fi
505 dnl Check to see if the (math function) argument passed is
506 dnl declared when using the c++ compiler
507 dnl ASSUMES argument is a math function with THREE parameters
509 dnl GLIBCXX_CHECK_MATH_DECL_3
510 AC_DEFUN(GLIBCXX_CHECK_MATH_DECL_3, [
511   AC_MSG_CHECKING([for $1 declaration])
512   if test x${glibcxx_cv_func_$1_use+set} != xset; then
513     AC_CACHE_VAL(glibcxx_cv_func_$1_use, [
514       AC_LANG_SAVE
515       AC_LANG_CPLUSPLUS
516       AC_TRY_COMPILE([#include <math.h>],
517                      [ $1(0, 0, 0);],
518                      [glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no])
519       AC_LANG_RESTORE
520     ])
521   fi
522   AC_MSG_RESULT($glibcxx_cv_func_$1_use)
526 dnl Check to see if the (math function) argument passed is
527 dnl 1) declared when using the c++ compiler
528 dnl 2) has "C" linkage
530 dnl Define HAVE_CARGF etc if "cargf" is declared and links
532 dnl argument 1 is name of function to check
534 dnl ASSUMES argument is a math function with THREE parameters
536 dnl GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_3
537 AC_DEFUN(GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_3, [
538   GLIBCXX_CHECK_MATH_DECL_3($1)
539   if test x$glibcxx_cv_func_$1_use = x"yes"; then
540     AC_CHECK_FUNCS($1)
541   else
542     GLIBCXX_CHECK_MATH_DECL_3(_$1)
543     if test x$glibcxx_cv_func__$1_use = x"yes"; then
544       AC_CHECK_FUNCS(_$1)
545     fi
546   fi
551 dnl Check to see if the (stdlib function) argument passed is
552 dnl 1) declared when using the c++ compiler
553 dnl 2) has "C" linkage
555 dnl argument 1 is name of function to check
557 dnl ASSUMES argument is a math function with TWO parameters
559 dnl GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2
560 AC_DEFUN(GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
561   AC_MSG_CHECKING([for $1 declaration])
562   if test x${glibcxx_cv_func_$1_use+set} != xset; then
563     AC_CACHE_VAL(glibcxx_cv_func_$1_use, [
564       AC_LANG_SAVE
565       AC_LANG_CPLUSPLUS
566       AC_TRY_COMPILE([#include <stdlib.h>],
567                      [ $1(0, 0);],
568                      [glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no])
569       AC_LANG_RESTORE
570     ])
571   fi
572   AC_MSG_RESULT($glibcxx_cv_func_$1_use)
573   if test x$glibcxx_cv_func_$1_use = x"yes"; then
574     AC_CHECK_FUNCS($1)
575   fi
580 dnl Check to see if the (stdlib function) argument passed is
581 dnl 1) declared when using the c++ compiler
582 dnl 2) has "C" linkage
584 dnl argument 1 is name of function to check
586 dnl ASSUMES argument is a function with THREE parameters
588 dnl GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3
589 AC_DEFUN(GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3, [
590   AC_MSG_CHECKING([for $1 declaration])
591   if test x${glibcxx_cv_func_$1_use+set} != xset; then
592     AC_CACHE_VAL(glibcxx_cv_func_$1_use, [
593       AC_LANG_SAVE
594       AC_LANG_CPLUSPLUS
595       AC_TRY_COMPILE([#include <stdlib.h>],
596                      [ $1(0, 0, 0);],
597                      [glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no])
598       AC_LANG_RESTORE
599     ])
600   fi
601   AC_MSG_RESULT($glibcxx_cv_func_$1_use)
602   if test x$glibcxx_cv_func_$1_use = x"yes"; then
603     AC_CHECK_FUNCS($1)
604   fi
608 dnl Because the builtins are picky picky picky about the arguments they take,
609 dnl do an explict linkage tests here.
610 dnl Check to see if the (math function) argument passed is
611 dnl 1) declared when using the c++ compiler
612 dnl 2) has "C" linkage
614 dnl Define HAVE_CARGF etc if "cargf" is declared and links
616 dnl argument 1 is name of function to check
618 dnl ASSUMES argument is a math function with ONE parameter
620 dnl GLIBCXX_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
621 AC_DEFUN(GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
622   AC_MSG_CHECKING([for $1 declaration])
623   if test x${glibcxx_cv_func_$1_use+set} != xset; then
624     AC_CACHE_VAL(glibcxx_cv_func_$1_use, [
625       AC_LANG_SAVE
626       AC_LANG_CPLUSPLUS
627       AC_TRY_COMPILE([#include <math.h>],
628                      [ $1(0);],
629                      [glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no])
630       AC_LANG_RESTORE
631     ])
632   fi
633   AC_MSG_RESULT($glibcxx_cv_func_$1_use)
634   if test x$glibcxx_cv_func_$1_use = x"yes"; then
635     AC_MSG_CHECKING([for $1 linkage])
636     if test x${glibcxx_cv_func_$1_link+set} != xset; then
637       AC_CACHE_VAL(glibcxx_cv_func_$1_link, [
638         AC_TRY_LINK([#include <math.h>],
639                     [ $1(0);],
640                     [glibcxx_cv_func_$1_link=yes], [glibcxx_cv_func_$1_link=no])
641       ])
642     fi
643     AC_MSG_RESULT($glibcxx_cv_func_$1_link)
644     if test x$glibcxx_cv_func_$1_link = x"yes"; then
645       ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
646       AC_DEFINE_UNQUOTED(${ac_tr_func})
647     fi
648   fi
653 dnl Check to see what builtin math functions are supported
655 dnl check for __builtin_abs
656 dnl check for __builtin_fabsf
657 dnl check for __builtin_fabs
658 dnl check for __builtin_fabl
659 dnl check for __builtin_labs
660 dnl check for __builtin_sqrtf
661 dnl check for __builtin_sqrtl
662 dnl check for __builtin_sqrt
663 dnl check for __builtin_sinf
664 dnl check for __builtin_sin
665 dnl check for __builtin_sinl
666 dnl check for __builtin_cosf
667 dnl check for __builtin_cos
668 dnl check for __builtin_cosl
670 dnl GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT
671 AC_DEFUN(GLIBCXX_CHECK_BUILTIN_MATH_SUPPORT, [
672   dnl Test for builtin math functions.
673   dnl These are made in gcc/c-common.c
674   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
675   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
676   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
677   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
678   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
680   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
681   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrt)
682   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
684   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
685   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
686   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
688   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
689   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
690   GLIBCXX_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
692   dnl There is, without a doubt, a more elegant way to have these
693   dnl names exported so that they won't be stripped out of acconfig.h by
694   dnl autoheader. I leave this as an exercise to somebody less frustrated
695   dnl than I.... please email the libstdc++ list if you can figure out a
696   dnl more elegant approach (see autoconf/acgen.m4 and specifically
697   dnl AC_CHECK_FUNC for things to steal.)
698   dummyvar=no
699   if test x$dummyvar = x"yes"; then
700     AC_DEFINE(HAVE___BUILTIN_ABS)
701     AC_DEFINE(HAVE___BUILTIN_LABS)
702     AC_DEFINE(HAVE___BUILTIN_COS)
703     AC_DEFINE(HAVE___BUILTIN_COSF)
704     AC_DEFINE(HAVE___BUILTIN_COSL)
705     AC_DEFINE(HAVE___BUILTIN_FABS)
706     AC_DEFINE(HAVE___BUILTIN_FABSF)
707     AC_DEFINE(HAVE___BUILTIN_FABSL)
708     AC_DEFINE(HAVE___BUILTIN_SIN)
709     AC_DEFINE(HAVE___BUILTIN_SINF)
710     AC_DEFINE(HAVE___BUILTIN_SINL)
711     AC_DEFINE(HAVE___BUILTIN_SQRT)
712     AC_DEFINE(HAVE___BUILTIN_SQRTF)
713     AC_DEFINE(HAVE___BUILTIN_SQRTL)
714   fi
718 dnl Check to see what the underlying c library is like
719 dnl These checks need to do two things:
720 dnl 1) make sure the name is declared when using the c++ compiler
721 dnl 2) make sure the name has "C" linkage
722 dnl This might seem like overkill but experience has shown that it's not...
724 dnl Define HAVE_STRTOLD if "strtold" is declared and links
725 dnl Define HAVE_STRTOF if "strtof" is declared and links
726 dnl Define HAVE_DRAND48 if "drand48" is declared and links
728 dnl GLIBCXX_CHECK_STDLIB_SUPPORT
729 AC_DEFUN(GLIBCXX_CHECK_STDLIB_SUPPORT, [
730   ac_test_CXXFLAGS="${CXXFLAGS+set}"
731   ac_save_CXXFLAGS="$CXXFLAGS"
732   CXXFLAGS='-fno-builtin -D_GNU_SOURCE'
734   GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
735   GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof)
736   AC_CHECK_FUNCS(drand48)
738   CXXFLAGS="$ac_save_CXXFLAGS"
742 dnl Check to see what the underlying c library or math library is like.
743 dnl These checks need to do two things:
744 dnl 1) make sure the name is declared when using the c++ compiler
745 dnl 2) make sure the name has "C" linkage
746 dnl This might seem like overkill but experience has shown that it's not...
748 dnl Define HAVE_CARGF etc if "cargf" is found.
750 dnl GLIBCXX_CHECK_MATH_SUPPORT
751 AC_DEFUN(GLIBCXX_CHECK_MATH_SUPPORT, [
752   ac_test_CXXFLAGS="${CXXFLAGS+set}"
753   ac_save_CXXFLAGS="$CXXFLAGS"
754   CXXFLAGS='-fno-builtin -D_GNU_SOURCE'
756   dnl Check libm
757   AC_CHECK_LIB(m, sin, libm="-lm")
758   ac_save_LIBS="$LIBS"
759   LIBS="$LIBS $libm"
761   dnl Check to see if certain C math functions exist.
762   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
763   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
764   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
765   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
766   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
767   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
768   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
769   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(hypot)
771   dnl Check to see if basic C math functions have float versions.
772   GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig,
773                                           float_trig,
774                                           acosf asinf atanf \
775                                           cosf sinf tanf \
776                                           coshf sinhf tanhf)
777   GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
778                                           float_round,
779                                           ceilf floorf)
780   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(expf)
781   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
782   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
783   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
784   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
785   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
786   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
787   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf)
788   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
789   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
790   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
791   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
792   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
793   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
794   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
795   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
797   dnl Check to see if basic C math functions have long double versions.
798   GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig,
799                                           long_double_trig,
800                                           acosl asinl atanl \
801                                           cosl sinl tanl \
802                                           coshl sinhl tanhl)
803   GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round,
804                                           long_double_round,
805                                           ceill floorl)
806   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
807   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
808   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
809   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
810   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
811   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
812   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
813   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
814   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl)
815   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
816   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
817   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
818   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
819   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
820   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
821   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
822   GLIBCXX_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
824   dnl Some runtimes have these functions with a preceding underscore. Please
825   dnl keep this sync'd with the one above. And if you add any new symbol,
826   dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
827   dnl Check to see if certain C math functions exist.
829   dnl Check to see if basic C math functions have float versions.
830   GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
831                                           _float_trig,
832                                           _acosf _asinf _atanf \
833                                           _cosf _sinf _tanf \
834                                           _coshf _sinhf _tanhf)
835   GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
836                                           _float_round,
837                                           _ceilf _floorf)
839   dnl Check to see if basic C math functions have long double versions.
840   GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
841                                           _long_double_trig,
842                                           _acosl _asinl _atanl \
843                                           _cosl _sinl _tanl \
844                                           _coshl _sinhl _tanhl)
845   GLIBCXX_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
846                                           _long_double_round,
847                                           _ceill _floorl)
849   LIBS="$ac_save_LIBS"
850   CXXFLAGS="$ac_save_CXXFLAGS"
855 dnl Check to see if there is native support for complex
857 dnl Don't compile bits in math/* if native support exits.
859 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "copysignl" is found.
861 dnl GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
862 AC_DEFUN(GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT, [
863   dnl Check for complex versions of math functions of platform.  This will
864   dnl always pass if libm is available, and fail if it isn't.  If it is
865   dnl available, we assume we'll need it later, so add it to LIBS.
866   AC_CHECK_LIB(m, main)
867   AC_REPLACE_MATHFUNCS(nan copysignf)
869   dnl For __signbit to signbit conversions.
870   AC_CHECK_FUNCS([__signbit], , [LIBMATHOBJS="$LIBMATHOBJS signbit.lo"])
871   AC_CHECK_FUNCS([__signbitf], , [LIBMATHOBJS="$LIBMATHOBJS signbitf.lo"])
873   dnl Compile the long double complex functions only if the function
874   dnl provides the non-complex long double functions that are needed.
875   dnl Currently this includes copysignl, which should be
876   dnl cached from the GLIBCXX_CHECK_MATH_SUPPORT macro, above.
877   if test x$ac_cv_func_copysignl = x"yes"; then
878     AC_CHECK_FUNCS([__signbitl], , [LIBMATHOBJS="$LIBMATHOBJS signbitl.lo"])
879   fi
881   if test -n "$LIBMATHOBJS"; then
882     need_libmath=yes
883   fi
884   AC_SUBST(LIBMATHOBJS)
888 dnl Check to see what architecture and operating system we are compiling
889 dnl for.  Also, if architecture- or OS-specific flags are required for
890 dnl compilation, pick them up here.
892 dnl GLIBCXX_CHECK_HOST
893 AC_DEFUN(GLIBCXX_CHECK_HOST, [
894   . [$]{glibcxx_basedir}/configure.host
895   AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
896   AC_MSG_RESULT(OS config directory is $os_include_dir)
901 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
902 dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled.  (This
903 dnl must have been previously checked.)
905 dnl Define _GLIBCXX_USE_WCHAR_T if all the bits are found
906 dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h
908 dnl GLIBCXX_CHECK_WCHAR_T_SUPPORT
909 AC_DEFUN(GLIBCXX_CHECK_WCHAR_T_SUPPORT, [
910   dnl Wide characters disabled by default.
912   dnl Test wchar.h for mbstate_t, which is needed for char_traits and
913   dnl others even if wchar_t support is not on.
914   AC_MSG_CHECKING([for mbstate_t])
915   AC_TRY_COMPILE([#include <wchar.h>],
916   [mbstate_t teststate;],
917   have_mbstate_t=yes, have_mbstate_t=no)
918   AC_MSG_RESULT($have_mbstate_t)
919   if test x"$have_mbstate_t" = xyes; then
920     AC_DEFINE(HAVE_MBSTATE_T)
921   fi
923   dnl Sanity check for existence of ISO C99 headers for extended encoding.
924   AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
925   AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
927   dnl Only continue checking if the ISO C99 headers exist and support is on.
928   if test x"$ac_has_wchar_h" = xyes &&
929      test x"$ac_has_wctype_h" = xyes &&
930      test x"$enable_c_mbchar" != xno; then
932     dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
933     dnl numeric_limits can instantiate type_traits<wchar_t>
934     AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
935     AC_TRY_COMPILE([#include <wchar.h>],
936     [int i = WCHAR_MIN; int j = WCHAR_MAX;],
937     has_wchar_minmax=yes, has_wchar_minmax=no)
938     AC_MSG_RESULT($has_wchar_minmax)
940     dnl Test wchar.h for WEOF, which is what we use to determine whether
941     dnl to specialize for char_traits<wchar_t> or not.
942     AC_MSG_CHECKING([for WEOF])
943     AC_TRY_COMPILE([
944       #include <wchar.h>
945       #include <stddef.h>],
946     [wint_t i = WEOF;],
947     has_weof=yes, has_weof=no)
948     AC_MSG_RESULT($has_weof)
950     dnl Tests for wide character functions used in char_traits<wchar_t>.
951     ac_wfuncs=yes
952     AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset,, \
953     ac_wfuncs=no)
955     dnl Checks for names injected into std:: by the c_std headers.
956     AC_CHECK_FUNCS(btowc wctob fgetwc fgetws fputwc fputws fwide \
957     fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
958     vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
959     mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
960     wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
961     wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \
962     ac_wfuncs=no)
964     AC_MSG_CHECKING([for ISO C99 wchar_t support])
965     if test x"$has_weof" = xyes &&
966        test x"$has_wchar_minmax" = xyes &&
967        test x"$ac_wfuncs" = xyes; then
968       ac_isoC99_wchar_t=yes
969     else
970       ac_isoC99_wchar_t=no
971     fi
972     AC_MSG_RESULT($ac_isoC99_wchar_t)
974     dnl Use iconv for wchar_t to char conversions. As such, check for
975     dnl X/Open Portability Guide, version 2 features (XPG2).
976     AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
977     AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
979     dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
980     AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
981     ac_save_LIBS="$LIBS"
982     LIBS="$LIBS $libiconv"
984     AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
985     ac_XPG2funcs=yes, ac_XPG2funcs=no)
987     LIBS="$ac_save_LIBS"
989     AC_MSG_CHECKING([for XPG2 wchar_t support])
990     if test x"$ac_has_iconv_h" = xyes &&
991        test x"$ac_has_langinfo_h" = xyes &&
992        test x"$ac_XPG2funcs" = xyes; then
993       ac_XPG2_wchar_t=yes
994     else
995       ac_XPG2_wchar_t=no
996     fi
997     AC_MSG_RESULT($ac_XPG2_wchar_t)
999     dnl At the moment, only enable wchar_t specializations if all the
1000     dnl above support is present.
1001     if test x"$ac_isoC99_wchar_t" = xyes && 
1002         test x"$ac_XPG2_wchar_t" = xyes; then
1003       AC_DEFINE(_GLIBCXX_USE_WCHAR_T)
1004       enable_wchar_t=yes
1005     fi
1006   fi
1007   AC_MSG_CHECKING([for enabled wchar_t specializations])
1008   AC_MSG_RESULT($enable_wchar_t)        
1013 dnl Check to see if debugging libraries are to be built.
1015 dnl GLIBCXX_ENABLE_DEBUG
1017 dnl --enable-libstdcxx-debug
1018 dnl builds a separate set of debugging libraries in addition to the
1019 dnl normal (shared, static) libstdc++ binaries.
1021 dnl --disable-libstdcxx-debug
1022 dnl builds only one (non-debug) version of libstdc++.
1024 dnl --enable-libstdcxx-debug-flags=FLAGS
1025 dnl iff --enable-debug == yes, then use FLAGS to build the debug library.
1027 dnl  +  Usage:  GLIBCXX_ENABLE_DEBUG[(DEFAULT)]
1028 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
1029 dnl       defaults to `no'.
1030 AC_DEFUN(GLIBCXX_ENABLE_DEBUG, [dnl
1031 define([GLIBCXX_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
1032 AC_ARG_ENABLE(libstdcxx_debug,
1033 changequote(<<, >>)dnl
1034 <<  --enable-libstdcxx-debug          build extra debug library [default=>>GLIBCXX_ENABLE_DEBUG_DEFAULT],
1035 changequote([, ])dnl
1036 [case "${enableval}" in
1037  yes) enable_libstdcxx_debug=yes ;;
1038  no)  enable_libstdcxx_debug=no ;;
1039  *)   AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
1040  esac],
1041 enable_libstdcxx_debug=GLIBCXX_ENABLE_DEBUG_DEFAULT)dnl
1042 AC_MSG_CHECKING([for additional debug build])
1043 AC_MSG_RESULT($enable_libstdcxx_debug)
1044 AM_CONDITIONAL(GLIBCXX_BUILD_DEBUG, test "$enable_libstdcxx_debug" = yes)
1048 dnl Check for explicit debug flags.
1050 dnl GLIBCXX_ENABLE_DEBUG_FLAGS
1052 dnl --enable-libstdcxx-debug-flags='-O1'
1053 dnl is a general method for passing flags to be used when
1054 dnl building debug libraries with --enable-debug.
1056 dnl --disable-libstdcxx-debug-flags does nothing.
1057 dnl  +  Usage:  GLIBCXX_ENABLE_DEBUG_FLAGS(default flags)
1058 dnl       If "default flags" is an empty string (or "none"), the effect is
1059 dnl       the same as --disable or --enable=no.
1060 AC_DEFUN(GLIBCXX_ENABLE_DEBUG_FLAGS, [dnl
1061 define([GLIBCXX_ENABLE_DEBUG_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1062 AC_ARG_ENABLE(libstdcxx_debug_flags,
1063 changequote(<<, >>)dnl
1064 <<  --enable-libstdcxx-debug-flags=FLAGS    pass compiler FLAGS when building 
1065                                             debug library;
1066                                 [default=>>GLIBCXX_ENABLE_DEBUG_FLAGS_DEFAULT],
1067 changequote([, ])dnl
1068 [case "${enableval}" in
1069  none)  ;;
1070  -*) enable_libstdcxx_debug_flags="${enableval}" ;;
1071  *)   AC_MSG_ERROR([Unknown argument to extra debugging flags]) ;;
1072  esac],
1073 enable_libstdcxx_debug_flags=GLIBCXX_ENABLE_DEBUG_FLAGS_DEFAULT)dnl
1075 dnl Option parsed, now set things appropriately
1076 case x"$enable_libstdcxx_debug" in
1077     xyes)
1078         case "$enable_libstdcxx_debug_flags" in
1079           none)
1080             DEBUG_FLAGS="-g3 -O0";;
1081           -*) #valid input
1082             DEBUG_FLAGS="${enableval}"
1083         esac
1084         ;;
1085     xno)
1086         DEBUG_FLAGS=""
1087         ;;
1088 esac
1089 AC_SUBST(DEBUG_FLAGS)
1091 AC_MSG_CHECKING([for debug build flags])
1092 AC_MSG_RESULT($DEBUG_FLAGS)
1097 dnl Check for "unusual" flags to pass to the compiler while building.
1099 dnl GLIBCXX_ENABLE_CXX_FLAGS
1100 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1101 dnl     experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1102 dnl     Somehow this same set of flags must be passed when [re]building
1103 dnl     libgcc.
1104 dnl --disable-cxx-flags passes nothing.
1105 dnl  +  See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
1106 dnl         http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
1107 dnl         http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
1108 dnl  +  Usage:  GLIBCXX_ENABLE_CXX_FLAGS(default flags)
1109 dnl       If "default flags" is an empty string (or "none"), the effect is
1110 dnl       the same as --disable or --enable=no.
1111 AC_DEFUN(GLIBCXX_ENABLE_CXX_FLAGS, [dnl
1112 define([GLIBCXX_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1113 AC_MSG_CHECKING([for extra compiler flags for building])
1114 AC_ARG_ENABLE(cxx_flags,
1115 changequote(<<, >>)dnl
1116 <<  --enable-cxx-flags=FLAGS     pass compiler FLAGS when building library;
1117                                   [default=>>GLIBCXX_ENABLE_CXX_FLAGS_DEFAULT],
1118 changequote([, ])dnl
1119 [case "x$enable_cxx_flags" in
1120   xyes)
1121     AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1122   xno | xnone | x)
1123     enable_cxx_flags='' ;;
1124   *)
1125     enable_cxx_flags="$enableval" ;;
1126 esac],
1127 enable_cxx_flags=GLIBCXX_ENABLE_CXX_FLAGS_DEFAULT)
1129 dnl Run through flags (either default or command-line) and set anything
1130 dnl extra (e.g., #defines) that must accompany particular g++ options.
1131 if test -n "$enable_cxx_flags"; then
1132   for f in $enable_cxx_flags; do
1133     case "$f" in
1134       -fhonor-std)  ;;
1135       -*)  ;;
1136       *)   # and we're trying to pass /what/ exactly?
1137            AC_MSG_ERROR([compiler flags start with a -]) ;;
1138     esac
1139   done
1141 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1142 AC_MSG_RESULT($EXTRA_CXX_FLAGS)
1143 AC_SUBST(EXTRA_CXX_FLAGS)
1148 dnl Check for which locale library to use:  gnu or generic.
1150 dnl GLIBCXX_ENABLE_CLOCALE
1151 dnl --enable-clocale=gnu sets config/locale/c_locale_gnu.cc and friends
1152 dnl --enable-clocale=generic sets config/locale/c_locale_generic.cc and friends
1154 dnl default is generic
1156 AC_DEFUN(GLIBCXX_ENABLE_CLOCALE, [
1157   AC_MSG_CHECKING([for clocale to use])
1158   AC_ARG_ENABLE(clocale,
1159   [  --enable-clocale        enable model for target locale package.
1160   --enable-clocale=MODEL  use MODEL target-speific locale package. [default=generic]
1161   ],
1162   if test x$enable_clocale = xno; then
1163      enable_clocale=no
1164   fi,
1165      enable_clocale=no)
1167   enable_clocale_flag=$enable_clocale
1169   dnl Probe for locale support if no specific model is specified.
1170   dnl Default to "generic"
1171   if test x$enable_clocale_flag = xno; then
1172     case x${target_os} in
1173       xlinux* | xgnu*)
1174         AC_EGREP_CPP([_GLIBCXX_ok], [
1175         #include <features.h>
1176         #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1177           _GLIBCXX_ok
1178         #endif
1179         ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
1181         # Test for bugs early in glibc-2.2.x series
1182         if test x$enable_clocale_flag = xgnu; then
1183           AC_TRY_RUN([
1184           #define _GNU_SOURCE 1
1185           #include <locale.h>
1186           #include <string.h>
1187           #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
1188           extern __typeof(newlocale) __newlocale;
1189           extern __typeof(duplocale) __duplocale;
1190           extern __typeof(strcoll_l) __strcoll_l;
1191           #endif
1192           int main()
1193           {
1194             const char __one[] = "Äuglein Augmen";
1195             const char __two[] = "Äuglein";
1196             int i;
1197             int j;
1198             __locale_t  loc;
1199             __locale_t  loc_dup;
1200             loc = __newlocale(1 << LC_ALL, "de_DE", 0);
1201             loc_dup = __duplocale(loc);
1202             i = __strcoll_l(__one, __two, loc);
1203             j = __strcoll_l(__one, __two, loc_dup);
1204             return 0;
1205           }
1206           ],
1207           [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
1208           [enable_clocale_flag=generic])
1209         fi
1211         # ... at some point put __strxfrm_l tests in as well.
1212         ;;
1213       *)
1214         enable_clocale_flag=generic
1215         ;;
1216     esac
1217   fi
1219   dnl Deal with gettext issues.
1220   AC_ARG_ENABLE(nls,
1221   [  --enable-nls            use Native Language Support (default)],
1222   , enable_nls=yes)
1223   USE_NLS=no
1225   dnl Set configure bits for specified locale package
1226   case x${enable_clocale_flag} in
1227     xgeneric)
1228       AC_MSG_RESULT(generic)
1230       CLOCALE_H=config/locale/generic/c_locale.h
1231       CLOCALE_CC=config/locale/generic/c_locale.cc
1232       CCODECVT_H=config/locale/generic/codecvt_specializations.h
1233       CCODECVT_CC=config/locale/generic/codecvt_members.cc
1234       CCOLLATE_CC=config/locale/generic/collate_members.cc
1235       CCTYPE_CC=config/locale/generic/ctype_members.cc
1236       CMESSAGES_H=config/locale/generic/messages_members.h
1237       CMESSAGES_CC=config/locale/generic/messages_members.cc
1238       CMONEY_CC=config/locale/generic/monetary_members.cc
1239       CNUMERIC_CC=config/locale/generic/numeric_members.cc
1240       CTIME_H=config/locale/generic/time_members.h
1241       CTIME_CC=config/locale/generic/time_members.cc
1242       CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
1243       ;;
1244     xgnu)
1245       AC_MSG_RESULT(gnu)
1247       # Declare intention to use gettext, and add support for specific
1248       # languages.
1249       # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
1250       ALL_LINGUAS="de fr"
1252       # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
1253       AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
1254       if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
1255         USE_NLS=yes
1256       fi
1257       # Export the build objects.
1258       for ling in $ALL_LINGUAS; do \
1259         glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
1260         glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
1261       done
1262       AC_SUBST(glibcxx_MOFILES)
1263       AC_SUBST(glibcxx_POFILES)
1265       CLOCALE_H=config/locale/gnu/c_locale.h
1266       CLOCALE_CC=config/locale/gnu/c_locale.cc
1267       CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1268       CCODECVT_CC=config/locale/gnu/codecvt_members.cc
1269       CCOLLATE_CC=config/locale/gnu/collate_members.cc
1270       CCTYPE_CC=config/locale/gnu/ctype_members.cc
1271       CMESSAGES_H=config/locale/gnu/messages_members.h
1272       CMESSAGES_CC=config/locale/gnu/messages_members.cc
1273       CMONEY_CC=config/locale/gnu/monetary_members.cc
1274       CNUMERIC_CC=config/locale/gnu/numeric_members.cc
1275       CTIME_H=config/locale/gnu/time_members.h
1276       CTIME_CC=config/locale/gnu/time_members.cc
1277       CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h
1278       ;;
1279     xieee_1003.1-2001)
1280       AC_MSG_RESULT(IEEE 1003.1)
1282       CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h
1283       CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc
1284       CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1285       CCODECVT_CC=config/locale/generic/codecvt_members.cc
1286       CCOLLATE_CC=config/locale/generic/collate_members.cc
1287       CCTYPE_CC=config/locale/generic/ctype_members.cc
1288       CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h
1289       CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc
1290       CMONEY_CC=config/locale/generic/monetary_members.cc
1291       CNUMERIC_CC=config/locale/generic/numeric_members.cc
1292       CTIME_H=config/locale/generic/time_members.h
1293       CTIME_CC=config/locale/generic/time_members.cc
1294       CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
1295       ;;
1296     *)
1297       echo "$enable_clocale is an unknown locale package" 1>&2
1298       exit 1
1299       ;;
1300   esac
1302   # This is where the testsuite looks for locale catalogs, using the
1303   # -DLOCALEDIR define during testsuite compilation.
1304   glibcxx_localedir=${glibcxx_builddir}/po/share/locale
1305   AC_SUBST(glibcxx_localedir)
1307   # A standalone libintl (e.g., GNU libintl) may be in use.
1308   if test $USE_NLS = yes; then
1309     AC_CHECK_HEADERS([libintl.h], [], USE_NLS=no)
1310     AC_SEARCH_LIBS(gettext, intl, [], USE_NLS=no)
1311   fi
1312   if test $USE_NLS = yes; then
1313     AC_DEFINE(_GLIBCXX_USE_NLS)
1314   fi
1316   AC_SUBST(USE_NLS)
1317   AC_SUBST(CLOCALE_H)
1318   AC_SUBST(CCODECVT_H)
1319   AC_SUBST(CMESSAGES_H)
1320   AC_SUBST(CCODECVT_CC)
1321   AC_SUBST(CCOLLATE_CC)
1322   AC_SUBST(CCTYPE_CC)
1323   AC_SUBST(CMESSAGES_CC)
1324   AC_SUBST(CMONEY_CC)
1325   AC_SUBST(CNUMERIC_CC)
1326   AC_SUBST(CTIME_H)
1327   AC_SUBST(CTIME_CC)
1328   AC_SUBST(CLOCALE_CC)
1329   AC_SUBST(CLOCALE_INTERNAL_H)
1334 dnl Check for which I/O library to use:  stdio, or something specific.
1336 dnl GLIBCXX_ENABLE_CSTDIO
1338 dnl default is stdio
1340 AC_DEFUN(GLIBCXX_ENABLE_CSTDIO, [
1341   AC_MSG_CHECKING([for cstdio to use])
1342   AC_ARG_ENABLE(cstdio,
1343   [  --enable-cstdio         enable stdio for target io package.
1344   --enable-cstdio=LIB     use LIB target-specific io package. [default=stdio]
1345   ],
1346   if test x$enable_cstdio = xno; then
1347      enable_cstdio=stdio
1348   fi,
1349      enable_cstdio=stdio)
1351   enable_cstdio_flag=$enable_cstdio
1353   dnl Check if a valid I/O package
1354   case x${enable_cstdio_flag} in
1355     xstdio | x | xno | xnone | xyes)
1356       # default
1357       CSTDIO_H=config/io/c_io_stdio.h
1358       BASIC_FILE_H=config/io/basic_file_stdio.h
1359       BASIC_FILE_CC=config/io/basic_file_stdio.cc
1360       AC_MSG_RESULT(stdio)
1361       ;;
1362     *)
1363       echo "$enable_cstdio is an unknown io package" 1>&2
1364       exit 1
1365       ;;
1366   esac
1368   dnl Set directory for fpos.h
1369   FPOS_H=$fpos_include_dir
1371   AC_SUBST(CSTDIO_H)
1372   AC_SUBST(FPOS_H)
1373   AC_SUBST(BASIC_FILE_H)
1374   AC_SUBST(BASIC_FILE_CC)
1379 dnl Check to see if building and using a C++ precompiled header can be done.
1381 dnl GLIBCXX_ENABLE_PCH
1383 dnl --enable-libstdcxx-pch=yes
1384 dnl default, this shows intent to use stdc++.h.gch If it looks like it
1385 dnl may work, after some light-hearted attempts to puzzle out compiler
1386 dnl support, flip bits on in include/Makefile.am
1388 dnl --disable-libstdcxx-pch
1389 dnl turns off attempts to use or build stdc++.h.gch.
1391 AC_DEFUN(GLIBCXX_ENABLE_PCH, [dnl
1392 define([GLIBCXX_ENABLE_PCH_DEFAULT], ifelse($1,,, $1))dnl
1393 AC_ARG_ENABLE(libstdcxx_pch,
1394 changequote(<<, >>)dnl
1395 <<  --enable-libstdcxx-pch     build pre-compiled libstdc++ includes [default=>>GLIBCXX_ENABLE_PCH_DEFAULT],
1396 changequote([, ])dnl
1397 [case "${enableval}" in
1398  yes) enable_libstdcxx_pch=yes ;;
1399  no)  enable_libstdcxx_pch=no ;;
1400  *)   AC_MSG_ERROR([Unknown argument to enable/disable PCH]) ;;
1401  esac],
1402 enable_libstdcxx_pch=GLIBCXX_ENABLE_PCH_DEFAULT)dnl
1404   if test x$enable_libstdcxx_pch = xyes; then
1405     ac_test_CXXFLAGS="${CXXFLAGS+set}"
1406     ac_save_CXXFLAGS="$CXXFLAGS"
1407     CXXFLAGS='-Werror -Winvalid-pch -Wno-deprecated -x c++-header'
1409     AC_MSG_CHECKING([for compiler that seems to compile .gch files])
1410     if test x${pch_comp+set} != xset; then
1411       AC_CACHE_VAL(pch_comp, [
1412         AC_LANG_SAVE
1413         AC_LANG_CPLUSPLUS
1414         AC_TRY_COMPILE([#include <math.h>], ,
1415                        [pch_comp=yes], [pch_comp=no])
1416         AC_LANG_RESTORE
1417       ])
1418     fi
1419     AC_MSG_RESULT([$pch_comp])
1421     CXXFLAGS="$ac_save_CXXFLAGS"
1422   fi
1424   if test x"$enable_libstdcxx_pch" = xyes && test x"$pch_comp" = xno; then
1425     enable_pch=no
1426   fi
1428   AC_MSG_CHECKING([for enabled PCH])
1429   AC_MSG_RESULT([$enable_libstdcxx_pch])
1431   AM_CONDITIONAL(GLIBCXX_BUILD_PCH, test "$enable_libstdcxx_pch" = yes)
1432   if test "$enable_libstdcxx_pch" = yes; then
1433         glibcxx_PCHFLAGS="-include bits/stdc++.h"
1434   else
1435         glibcxx_PCHFLAGS=""
1436   fi
1437   AC_SUBST(glibcxx_PCHFLAGS)
1441 dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
1442 dnl We must stage the required headers so that they will be installed
1443 dnl with the library (unlike libgcc, the STL implementation is provided
1444 dnl solely within headers).  Since we must not inject random user-space
1445 dnl macro names into user-provided C++ code, we first stage into <file>-in
1446 dnl and process to <file> with an output command.  The reason for a two-
1447 dnl stage process here is to correctly handle $srcdir!=$objdir without
1448 dnl having to write complex code (the sed commands to clean the macro
1449 dnl namespace are complex and fragile enough as it is).  We must also
1450 dnl add a relative path so that -I- is supported properly.
1452 AC_DEFUN(GLIBCXX_ENABLE_THREADS, [
1453   AC_MSG_CHECKING([for thread model used by GCC])
1454   target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
1455   AC_MSG_RESULT([$target_thread_file])
1457   if test $target_thread_file != single; then
1458     AC_DEFINE(HAVE_GTHR_DEFAULT)
1459     AC_DEFINE(_GLIBCXX_SUPPORTS_WEAK, __GXX_WEAK__)
1460   fi
1462   glibcxx_thread_h=gthr-$target_thread_file.h
1463   AC_SUBST(glibcxx_thread_h)
1468 dnl Check for exception handling support.  If an explicit enable/disable
1469 dnl sjlj exceptions is given, we don't have to detect.  Otherwise the
1470 dnl target may or may not support call frame exceptions.
1472 dnl GLIBCXX_ENABLE_SJLJ_EXCEPTIONS
1473 dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
1474 dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1476 dnl Define _GLIBCXX_SJLJ_EXCEPTIONS if the compiler is configured for it.
1478 AC_DEFUN(GLIBCXX_ENABLE_SJLJ_EXCEPTIONS, [
1479   AC_MSG_CHECKING([for exception model to use])
1480   AC_LANG_SAVE
1481   AC_LANG_CPLUSPLUS
1482   AC_ARG_ENABLE(sjlj-exceptions,
1483   [  --enable-sjlj-exceptions  force use of builtin_setjmp for exceptions],
1484   [:],
1485   [dnl Botheration.  Now we've got to detect the exception model.
1486    dnl Link tests against libgcc.a are problematic since -- at least
1487    dnl as of this writing -- we've not been given proper -L bits for
1488    dnl single-tree newlib and libgloss.
1489    dnl
1490    dnl This is what AC_TRY_COMPILE would do if it didn't delete the
1491    dnl conftest files before we got a change to grep them first.
1492    cat > conftest.$ac_ext << EOF
1493 [#]line __oline__ "configure"
1494 struct S { ~S(); };
1495 void bar();
1496 void foo()
1498   S s;
1499   bar();
1502    old_CXXFLAGS="$CXXFLAGS"
1503    CXXFLAGS=-S
1504    if AC_TRY_EVAL(ac_compile); then
1505      if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
1506        enable_sjlj_exceptions=yes
1507      elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
1508        enable_sjlj_exceptions=no
1509      fi
1510    fi
1511    CXXFLAGS="$old_CXXFLAGS"
1512    rm -f conftest*])
1513    if test x$enable_sjlj_exceptions = xyes; then
1514      AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1,
1515         [Define if the compiler is configured for setjmp/longjmp exceptions.])
1516      ac_exception_model_name=sjlj
1517    elif test x$enable_sjlj_exceptions = xno; then
1518      ac_exception_model_name="call frame"
1519    else
1520      AC_MSG_ERROR([unable to detect exception model])
1521    fi
1522    AC_LANG_RESTORE
1523    AC_MSG_RESULT($ac_exception_model_name)
1528 dnl Check for libunwind exception handling support. If enabled then
1529 dnl we assume that the _Unwind_* functions that make up the Unwind ABI
1530 dnl (_Unwind_RaiseException, _Unwind_Resume, etc.) are defined by
1531 dnl libunwind instead of libgcc and that libstdc++ has a dependency
1532 dnl on libunwind as well as libgcc.
1534 dnl GLIBCXX_ENABLE_LIBUNWIND_EXCEPTIONS
1535 dnl --enable-libunwind-exceptions forces the use of libunwind.
1536 dnl --disable-libunwind-exceptions assumes there is no libunwind.
1538 dnl Define _GLIBCXX_LIBUNWIND_EXCEPTIONS if requested.
1540 AC_DEFUN(GLIBCXX_ENABLE_LIBUNWIND_EXCEPTIONS, [
1541   AC_MSG_CHECKING([for use of libunwind])
1542   AC_ARG_ENABLE(libunwind-exceptions,
1543   [  --enable-libunwind-exceptions  force use of libunwind for exceptions],
1544   use_libunwind_exceptions=$enableval,
1545   use_libunwind_exceptions=no)
1546   AC_MSG_RESULT($use_libunwind_exceptions)
1547   dnl Option parsed, now set things appropriately
1548   if test x"$use_libunwind_exceptions" = xyes; then
1549     LIBUNWIND_FLAG="-lunwind"
1550   else
1551     LIBUNWIND_FLAG=""
1552   fi
1553   AC_SUBST(LIBUNWIND_FLAG)
1557 dnl Check for ISO/IEC 9899:1999 "C99" support.
1559 dnl GLIBCXX_ENABLE_C99
1560 dnl --enable-c99 defines _GLIBCXX_USE_C99
1561 dnl --disable-c99 leaves _GLIBCXX_USE_C99 undefined
1562 dnl  +  Usage:  GLIBCXX_ENABLE_C99[(DEFAULT)]
1563 dnl       Where DEFAULT is either `yes' or `no'.  If omitted, it
1564 dnl       defaults to `no'.
1565 dnl  +  If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
1567 dnl GLIBCXX_ENABLE_C99
1568 AC_DEFUN(GLIBCXX_ENABLE_C99, [dnl
1569   define([GLIBCXX_ENABLE_C99_DEFAULT], ifelse($1, yes, yes, no))dnl
1571   AC_ARG_ENABLE(c99,
1572   changequote(<<, >>)dnl
1573   <<--enable-c99            turns on 'ISO/IEC 9899:1999 support' [default=>>GLIBCXX_ENABLE_C99_DEFAULT],
1574   changequote([, ])dnl
1575   [case "$enableval" in
1576    yes) enable_c99=yes ;;
1577    no)  enable_c99=no ;;
1578    *)   AC_MSG_ERROR([Unknown argument to enable/disable C99]) ;;
1579    esac],
1580   enable_c99=GLIBCXX_ENABLE_C99_DEFAULT)dnl
1582   AC_LANG_SAVE
1583   AC_LANG_CPLUSPLUS
1585   # Check for the existence of <math.h> functions used if C99 is enabled.
1586   ac_c99_math=yes;
1587   AC_MSG_CHECKING([for ISO C99 support in <math.h>])
1588   AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no])
1589   AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no])
1590   AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no])
1591   AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no])
1592   AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no])
1593   AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no])
1594   AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no])
1595   AC_TRY_COMPILE([#include <math.h>],
1596                  [isgreaterequal(0.0,0.0);],, [ac_c99_math=no])
1597   AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no])
1598   AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no])
1599   AC_TRY_COMPILE([#include <math.h>],
1600                  [islessgreater(0.0,0.0);],, [ac_c99_math=no])
1601   AC_TRY_COMPILE([#include <math.h>],
1602                  [isunordered(0.0,0.0);],, [ac_c99_math=no])
1603   AC_MSG_RESULT($ac_c99_math)
1605   # Check for the existence in <stdio.h> of vscanf, et. al.
1606   ac_c99_stdio=yes;
1607   AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
1608   AC_TRY_COMPILE([#include <stdio.h>],
1609                  [snprintf("12", 0, "%i");],, [ac_c99_stdio=no])
1610   AC_TRY_COMPILE([#include <stdio.h>
1611                   #include <stdarg.h>
1612                   void foo(char* fmt, ...)
1613                   {va_list args; va_start(args, fmt);
1614                   vfscanf(stderr, "%i", args);}],
1615                   [],, [ac_c99_stdio=no])
1616   AC_TRY_COMPILE([#include <stdio.h>
1617                   #include <stdarg.h>
1618                   void foo(char* fmt, ...)
1619                   {va_list args; va_start(args, fmt);
1620                   vscanf("%i", args);}],
1621                   [],, [ac_c99_stdio=no])
1622   AC_TRY_COMPILE([#include <stdio.h>
1623                   #include <stdarg.h>
1624                   void foo(char* fmt, ...)
1625                   {va_list args; va_start(args, fmt);
1626                   vsnprintf(fmt, 0, "%i", args);}],
1627                   [],, [ac_c99_stdio=no])
1628   AC_TRY_COMPILE([#include <stdio.h>
1629                   #include <stdarg.h>
1630                   void foo(char* fmt, ...)
1631                   {va_list args; va_start(args, fmt);
1632                   vsscanf(fmt, "%i", args);}],
1633                   [],, [ac_c99_stdio=no])
1634   AC_MSG_RESULT($ac_c99_stdio)
1636   # Check for the existence in <stdlib.h> of lldiv_t, et. al.
1637   ac_c99_stdlib=yes;
1638   AC_MSG_CHECKING([for lldiv_t declaration])
1639   AC_CACHE_VAL(ac_c99_lldiv_t, [
1640   AC_TRY_COMPILE([#include <stdlib.h>],
1641                    [ lldiv_t mydivt;],
1642                    [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no])
1643   ])
1644   AC_MSG_RESULT($ac_c99_lldiv_t)
1646   AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
1647   AC_TRY_COMPILE([#include <stdlib.h>],
1648                  [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no])
1649   AC_TRY_COMPILE([#include <stdlib.h>],
1650                  [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no])
1651   AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no])
1652   AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no])
1653   AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no])
1654   AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no])
1655   if test x"$ac_c99_lldiv_t" = x"no"; then
1656     ac_c99_stdlib=no;
1657   fi;
1658   AC_MSG_RESULT($ac_c99_stdlib)
1660   # Check for the existence of <wchar.h> functions used if C99 is enabled.
1661   # XXX the wchar.h checks should be rolled into the general C99 bits.
1662   ac_c99_wchar=yes;
1663   AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>])
1664   AC_TRY_COMPILE([#include <wchar.h>],
1665                  [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no])
1666   AC_TRY_COMPILE([#include <wchar.h>],
1667                  [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no])
1668   AC_TRY_COMPILE([#include <wchar.h>],
1669                  [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no])
1670   AC_MSG_RESULT($ac_c99_wchar)
1672   AC_MSG_CHECKING([for enabled ISO C99 support])
1673   if test x"$ac_c99_math" = x"no" ||
1674      test x"$ac_c99_stdio" = x"no" ||
1675      test x"$ac_c99_stdlib" = x"no" ||
1676      test x"$ac_c99_wchar" = x"no"; then
1677     enable_c99=no;
1678   fi;
1679   AC_MSG_RESULT($enable_c99)
1681   # Option parsed, now set things appropriately
1682   if test x"$enable_c99" = x"yes"; then
1683     AC_DEFINE(_GLIBCXX_USE_C99)
1684   fi
1686   AC_LANG_RESTORE
1691 dnl Check for template specializations for the 'long long' type extension.
1692 dnl The result determines only whether 'long long' I/O is enabled; things
1693 dnl like numeric_limits<> specializations are always available.
1695 dnl GLIBCXX_ENABLE_LONG_LONG
1696 dnl --enable-long-long defines _GLIBCXX_USE_LONG_LONG
1697 dnl --disable-long-long leaves _GLIBCXX_USE_LONG_LONG undefined
1698 dnl  +  Usage:  GLIBCXX_ENABLE_LONG_LONG[(DEFAULT)]
1699 dnl       Where DEFAULT is either `yes' or `no'.  If omitted, it
1700 dnl       defaults to `no'.
1701 dnl  +  If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1703 dnl GLIBCXX_ENABLE_LONG_LONG
1704 AC_DEFUN(GLIBCXX_ENABLE_LONG_LONG, [dnl
1705   define([GLIBCXX_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1707   AC_ARG_ENABLE(long-long,
1708   changequote(<<, >>)dnl
1709   <<--enable-long-long      turns on 'long long' [default=>>GLIBCXX_ENABLE_LONG_LONG_DEFAULT],
1710   changequote([, ])dnl
1711   [case "$enableval" in
1712    yes) enable_long_long=yes ;;
1713    no)  enable_long_long=no ;;
1714    *)   AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1715    esac],
1716   enable_long_long=GLIBCXX_ENABLE_LONG_LONG_DEFAULT)dnl
1718   AC_LANG_SAVE
1719   AC_LANG_CPLUSPLUS
1721   AC_MSG_CHECKING([for enabled long long I/O support])
1722   # iostreams require strtoll, strtoull to compile
1723   AC_TRY_COMPILE([#include <stdlib.h>],
1724                  [char* tmp; strtoll("gnu", &tmp, 10);],,[enable_long_long=no])
1725   AC_TRY_COMPILE([#include <stdlib.h>],
1726                  [char* tmp; strtoull("gnu", &tmp, 10);],,[enable_long_long=no])
1728   # Option parsed, now set things appropriately
1729   if test x"$enable_long_long" = xyes; then
1730     AC_DEFINE(_GLIBCXX_USE_LONG_LONG)
1731   fi
1732   AC_MSG_RESULT($enable_long_long)
1734   AC_LANG_RESTORE
1739 dnl Check for what type of C headers to use.
1741 dnl GLIBCXX_ENABLE_CHEADERS
1742 dnl --enable-cheaders= [does stuff].
1743 dnl --disable-cheaders [does not do anything, really].
1744 dnl  +  Usage:  GLIBCXX_ENABLE_CHEADERS[(DEFAULT)]
1745 dnl       Where DEFAULT is either `c' or `c_std'.
1746 dnl       If ommitted, it defaults to `c_std'.
1747 AC_DEFUN(GLIBCXX_ENABLE_CHEADERS, [dnl
1748 define([GLIBCXX_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl
1749 AC_MSG_CHECKING([for c header strategy to use])
1750 AC_ARG_ENABLE(cheaders,
1751 changequote(<<, >>)dnl
1752 <<  --enable-cheaders=MODEL       construct "C" header files for g++ [default=>>GLIBCXX_ENABLE_CHEADERS_DEFAULT],
1753 changequote([, ])
1754   [case "$enableval" in
1755    c)
1756         enable_cheaders=c
1757         ;;
1758    c_std)
1759         enable_cheaders=c_std
1760         ;;
1761    *)   AC_MSG_ERROR([Unknown argument to enable/disable "C" headers])
1762         ;;
1763   esac],
1764   enable_cheaders=GLIBCXX_ENABLE_CHEADERS_DEFAULT)
1765   AC_MSG_RESULT($enable_cheaders)
1767   dnl Option parsed, now set things appropriately
1768   case "$enable_cheaders" in
1769     c_std)
1770         C_INCLUDE_DIR='${glibcxx_srcdir}/include/c_std'
1771         ;;
1772     c)
1773         C_INCLUDE_DIR='${glibcxx_srcdir}/include/c'
1774         ;;
1775   esac
1777   AC_SUBST(C_INCLUDE_DIR)
1778   AM_CONDITIONAL(GLIBCXX_C_HEADERS_C, test "$enable_cheaders" = c)
1779   AM_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test "$enable_cheaders" = c_std)
1780   AM_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test "$c_compatibility" = yes)
1785 dnl Check for wide character support.  Has the same effect as the option
1786 dnl in gcc's configure, but in a form that autoconf can mess with.
1788 dnl GLIBCXX_ENABLE_C_MBCHAR
1789 dnl --enable-c-mbchar requests all the wchar_t stuff.
1790 dnl --disable-c-mbchar doesn't.
1791 dnl  +  Usage:  GLIBCXX_ENABLE_C_MBCHAR[(DEFAULT)]
1792 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
1793 dnl       defaults to `no'.
1794 AC_DEFUN(GLIBCXX_ENABLE_C_MBCHAR, [dnl
1795 define([GLIBCXX_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1796 AC_ARG_ENABLE(c-mbchar,
1797 changequote(<<, >>)dnl
1798 <<  --enable-c-mbchar       enable multibyte (wide) characters [default=>>GLIBCXX_ENABLE_C_MBCHAR_DEFAULT],
1799 changequote([, ])dnl
1800 [case "$enableval" in
1801  yes) enable_c_mbchar=yes ;;
1802  no)  enable_c_mbchar=no ;;
1803  *)   AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1804  esac],
1805 enable_c_mbchar=GLIBCXX_ENABLE_C_MBCHAR_DEFAULT)dnl
1806 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1811 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1813 dnl TOPLEVEL_INCLUDES
1814 dnl LIBMATH_INCLUDES
1815 dnl LIBSUPCXX_INCLUDES
1817 dnl GLIBCXX_EXPORT_INCLUDES
1818 AC_DEFUN(GLIBCXX_EXPORT_INCLUDES, [
1819   # Root level of the build directory include sources.
1820   GLIBCXX_INCLUDES="-I${glibcxx_builddir}/include/${target_alias} -I${glibcxx_builddir}/include"
1822   # Passed down for canadian crosses.
1823   if test x"$CANADIAN" = xyes; then
1824     TOPLEVEL_INCLUDES='-I$(includedir)'
1825   fi
1827   LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1829   LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1831   # Now, export this to all the little Makefiles....
1832   AC_SUBST(GLIBCXX_INCLUDES)
1833   AC_SUBST(TOPLEVEL_INCLUDES)
1834   AC_SUBST(LIBMATH_INCLUDES)
1835   AC_SUBST(LIBSUPCXX_INCLUDES)
1840 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1842 AC_DEFUN(GLIBCXX_EXPORT_FLAGS, [
1843   # Optimization flags that are probably a good idea for thrill-seekers. Just
1844   # uncomment the lines below and make, everything else is ready to go...
1845   # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1846   OPTIMIZE_CXXFLAGS=
1847   AC_SUBST(OPTIMIZE_CXXFLAGS)
1849   WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings'
1850   AC_SUBST(WARN_FLAGS)
1854 dnl  GLIBCXX_EXPORT_INSTALL_INFO
1855 dnl  calculates gxx_install_dir
1856 dnl  exports glibcxx_toolexecdir
1857 dnl  exports glibcxx_toolexeclibdir
1858 dnl  exports glibcxx_prefixdir
1860 dnl Assumes cross_compiling bits already done, and with_cross_host in
1861 dnl particular
1863 dnl GLIBCXX_EXPORT_INSTALL_INFO
1864 AC_DEFUN(GLIBCXX_EXPORT_INSTALL_INFO, [
1865 # Assumes glibcxx_builddir, glibcxx_srcdir are alreay set up and
1866 # exported correctly in GLIBCXX_CONFIGURE.
1867 glibcxx_toolexecdir=no
1868 glibcxx_toolexeclibdir=no
1869 glibcxx_prefixdir=${prefix}
1871 # Process the option --with-gxx-include-dir=<path to include-files directory>
1872 AC_MSG_CHECKING([for --with-gxx-include-dir])
1873 AC_ARG_WITH(gxx-include-dir,
1874 [  --with-gxx-include-dir  the installation directory for include files],
1875 [case "${withval}" in
1876   yes)
1877     AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
1878     gxx_include_dir=no
1879     ;;
1880   no)
1881     gxx_include_dir=no
1882     ;;
1883   *)
1884     gxx_include_dir=${withval}
1885     ;;
1886 esac], [gxx_include_dir=no])
1887 AC_MSG_RESULT($gxx_include_dir)
1889 # Process the option "--enable-version-specific-runtime-libs"
1890 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
1891 AC_ARG_ENABLE(version-specific-runtime-libs,
1892 [  --enable-version-specific-runtime-libs    Specify that runtime libraries should be installed in a compiler-specific directory ],
1893 [case "$enableval" in
1894  yes) version_specific_libs=yes ;;
1895  no)  version_specific_libs=no ;;
1896  *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
1897  esac],
1898 version_specific_libs=no)dnl
1899 # Option set, now we can test it.
1900 AC_MSG_RESULT($version_specific_libs)
1902 # Default case for install directory for include files.
1903 if test $version_specific_libs = no && test $gxx_include_dir = no; then
1904   gxx_include_dir='$(prefix)'/include/c++/${gcc_version}
1907 # Version-specific runtime libs processing.
1908 if test $version_specific_libs = yes; then
1909   # Need the gcc compiler version to know where to install libraries
1910   # and header files if --enable-version-specific-runtime-libs option
1911   # is selected.
1912   if test x"$gxx_include_dir" = x"no"; then
1913     gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/c++
1914   fi
1915   glibcxx_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1916   glibcxx_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
1919 # Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir
1920 # Install a library built with a cross compiler in tooldir, not libdir.
1921 if test x"$glibcxx_toolexecdir" = x"no"; then
1922   if test -n "$with_cross_host" &&
1923      test x"$with_cross_host" != x"no"; then
1924     glibcxx_toolexecdir='$(exec_prefix)/$(target_alias)'
1925     glibcxx_toolexeclibdir='$(toolexecdir)/lib'
1926   else
1927     glibcxx_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1928     glibcxx_toolexeclibdir='$(libdir)'
1929   fi
1930   multi_os_directory=`$CC -print-multi-os-directory`
1931   case $multi_os_directory in
1932   .) ;; # Avoid trailing /.
1933   *) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;;
1934   esac
1937 AC_MSG_CHECKING([for install location])
1938 AC_MSG_RESULT($gxx_include_dir)
1940 AC_SUBST(glibcxx_prefixdir)
1941 AC_SUBST(gxx_include_dir)
1942 AC_SUBST(glibcxx_toolexecdir)
1943 AC_SUBST(glibcxx_toolexeclibdir)
1947 # Check for functions in math library.
1948 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1950 # This file can be copied and used freely without restrictions.  It can
1951 # be used in projects which are not available under the GNU Public License
1952 # but which still want to provide support for the GNU gettext functionality.
1953 # Please note that the actual code is *not* freely available.
1955 # serial 1
1957 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1958 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1959 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])])
1962 dnl This macro searches for a GNU version of make.  If a match is found, the
1963 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1964 dnl set to "#". This is useful for  including a special features in a Makefile,
1965 dnl which cannot be handled by other versions of make.  The variable
1966 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1967 dnl the empty string otherwise.
1969 dnl Here is an example of its use:
1971 dnl Makefile.in might contain:
1973 dnl     # A failsafe way of putting a dependency rule into a makefile
1974 dnl     $(DEPEND):
1975 dnl             $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1977 dnl     @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1978 dnl     @ifGNUmake@ include $(DEPEND)
1979 dnl     @ifGNUmake@ endif
1981 dnl Then configure.in would normally contain:
1983 dnl     CHECK_GNU_MAKE()
1984 dnl     AC_OUTPUT(Makefile)
1986 dnl Then perhaps to cause gnu make to override any other make, we could do
1987 dnl something like this (note that GNU make always looks for GNUmakefile first):
1989 dnl     if  ! test x$_cv_gnu_make_command = x ; then
1990 dnl             mv Makefile GNUmakefile
1991 dnl             echo .DEFAULT: > Makefile ;
1992 dnl             echo \  $_cv_gnu_make_command \$@ >> Makefile;
1993 dnl     fi
1995 dnl Then, if any (well almost any) other make is called, and GNU make also
1996 dnl exists, then the other make wraps the GNU make.
1998 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1999 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
2001 dnl #### Changes for libstdc++-v3:  reformatting and linewrapping; prepending
2002 dnl #### GLIBCXX_ to the macro name; adding the :-make fallback in the
2003 dnl #### conditional's subshell (" --version" is not a command), using a
2004 dnl #### different option to grep(1).
2005 dnl #### -pme
2006 dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not
2007 dnl #### ${MAKE:-make}).
2008 dnl #### -msokolov
2009 AC_DEFUN(
2010   GLIBCXX_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
2011           _cv_gnu_make_command='' ;
2012 dnl Search all the common names for GNU make
2013           for a in "${MAKE-make}" make gmake gnumake ; do
2014                   if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
2015                   then
2016                           _cv_gnu_make_command=$a ;
2017                           break;
2018                   fi
2019           done ;
2020   ) ;
2021 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
2022 dnl string, '#' otherwise
2023   if test  "x$_cv_gnu_make_command" != "x"  ; then
2024           ifGNUmake='' ;
2025   else
2026           ifGNUmake='#' ;
2027   fi
2028   AC_SUBST(ifGNUmake)
2032 dnl Check for headers for, and arguments to, the setrlimit() function.
2033 dnl Used only in testsuite_hooks.h.
2034 AC_DEFUN(GLIBCXX_CHECK_SETRLIMIT_ancilliary, [
2035   AC_TRY_COMPILE([#include <unistd.h>
2036                   #include <sys/time.h>
2037                   #include <sys/resource.h>
2038                  ], [ int f = RLIMIT_$1 ; ],
2039                  [glibcxx_mresult=1], [glibcxx_mresult=0])
2040   AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcxx_mresult,
2041                      [Only used in build directory testsuite_hooks.h.])
2043 AC_DEFUN(GLIBCXX_CHECK_SETRLIMIT, [
2044   setrlimit_have_headers=yes
2045   AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h,
2046                    [],
2047                    setrlimit_have_headers=no)
2048   # If don't have the headers, then we can't run the tests now, and we
2049   # won't be seeing any of these during testsuite compilation.
2050   if test $setrlimit_have_headers = yes; then
2051     # Can't do these in a loop, else the resulting syntax is wrong.
2052     GLIBCXX_CHECK_SETRLIMIT_ancilliary(DATA)
2053     GLIBCXX_CHECK_SETRLIMIT_ancilliary(RSS)
2054     GLIBCXX_CHECK_SETRLIMIT_ancilliary(VMEM)
2055     GLIBCXX_CHECK_SETRLIMIT_ancilliary(AS)
2057     # Check for rlimit, setrlimit.
2058     AC_CACHE_VAL(ac_setrlimit, [
2059       AC_TRY_COMPILE([#include <unistd.h>
2060                   #include <sys/time.h>
2061                   #include <sys/resource.h>
2062                      ],
2063                      [ struct rlimit r; setrlimit(0, &r);],
2064                      [ac_setrlimit=yes], [ac_setrlimit=no])
2065     ])
2066   fi
2068   AC_MSG_CHECKING([for testsuite memory limit support])
2069   if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then
2070     ac_mem_limits=yes
2071     AC_DEFINE(_GLIBCXX_MEM_LIMITS)
2072   else
2073     ac_mem_limits=no
2074   fi
2075   AC_MSG_RESULT($ac_mem_limits)
2080 dnl Does any necessary configuration of the testsuite directory.  Generates
2081 dnl the testsuite_hooks.h header.
2083 dnl GLIBCXX_CONFIGURE_TESTSUITE  [no args]
2084 AC_DEFUN(GLIBCXX_CONFIGURE_TESTSUITE, [
2086   if test  x"$GLIBCXX_IS_CROSS_COMPILING" = xfalse; then
2087     # Do checks for memory limit functions.
2088     GLIBCXX_CHECK_SETRLIMIT
2090     # Look for setenv, so that extended locale tests can be performed.
2091     GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv)
2092   fi
2094   # Export file names for ABI checking.
2095   baseline_dir="${glibcxx_srcdir}/config/abi/${abi_baseline_pair}\$(MULTISUBDIR)"
2096   AC_SUBST(baseline_dir)
2098   # Determine if checking the ABI is desirable.
2099   if test x$enable_symvers = xno; then
2100     enable_abi_check=no
2101   else
2102     case "$host" in
2103       *-*-cygwin*) 
2104         enable_abi_check=no ;;
2105       *) 
2106         enable_abi_check=yes ;;
2107     esac
2108   fi
2110   AM_CONDITIONAL(GLIBCXX_TEST_WCHAR_T, test "$enable_wchar_t" = yes)    
2111   AM_CONDITIONAL(GLIBCXX_TEST_ABI, test "$enable_abi_check" = yes)
2115 sinclude(../libtool.m4)
2116 dnl The lines below arrange for aclocal not to bring an installed
2117 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
2118 dnl add a definition of LIBTOOL to Makefile.in.
2119 ifelse(,,,[AC_SUBST(LIBTOOL)
2120 AC_DEFUN([AM_PROG_LIBTOOL])
2121 AC_DEFUN([AC_LIBTOOL_DLOPEN])
2122 AC_DEFUN([AC_PROG_LD])
2126 dnl Check whether S_ISREG (Posix) or S_IFREG is available in <sys/stat.h>.
2129 AC_DEFUN(GLIBCXX_CHECK_S_ISREG_OR_S_IFREG, [
2130   AC_CACHE_VAL(glibcxx_cv_S_ISREG, [
2131     AC_TRY_LINK([#include <sys/stat.h>],
2132                 [struct stat buffer; fstat(0, &buffer); S_ISREG(buffer.st_mode); ],
2133                 [glibcxx_cv_S_ISREG=yes],
2134                 [glibcxx_cv_S_ISREG=no])
2135   ])
2136   AC_CACHE_VAL(glibcxx_cv_S_IFREG, [
2137     AC_TRY_LINK([#include <sys/stat.h>],
2138                 [struct stat buffer; fstat(0, &buffer); S_IFREG & buffer.st_mode; ],
2139                 [glibcxx_cv_S_IFREG=yes],
2140                 [glibcxx_cv_S_IFREG=no])
2141   ])
2142   if test x$glibcxx_cv_S_ISREG = xyes; then
2143     AC_DEFINE(HAVE_S_ISREG)
2144   elif test x$glibcxx_cv_S_IFREG = xyes; then
2145     AC_DEFINE(HAVE_S_IFREG)
2146   fi
2150 dnl Check whether poll is available in <poll.h>.
2153 AC_DEFUN(GLIBCXX_CHECK_POLL, [
2154   AC_CACHE_VAL(glibcxx_cv_POLL, [
2155     AC_TRY_COMPILE([#include <poll.h>],
2156                 [struct pollfd pfd[1]; pfd[0].events = POLLIN; poll(pfd, 1, 0); ],
2157                 [glibcxx_cv_POLL=yes],
2158                 [glibcxx_cv_POLL=no])
2159   ])
2160   if test x$glibcxx_cv_POLL = xyes; then
2161     AC_DEFINE(HAVE_POLL)
2162   fi
2165 # Check whether LC_MESSAGES is available in <locale.h>.
2166 # Ulrich Drepper <drepper@cygnus.com>, 1995.
2168 # This file file be copied and used freely without restrictions.  It can
2169 # be used in projects which are not available under the GNU Public License
2170 # but which still want to provide support for the GNU gettext functionality.
2171 # Please note that the actual code is *not* freely available.
2173 # serial 1
2175 AC_DEFUN(AC_LC_MESSAGES, [
2176   AC_CHECK_HEADER(locale.h, [
2177     AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
2178       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
2179        ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
2180     if test $ac_cv_val_LC_MESSAGES = yes; then
2181       AC_DEFINE(HAVE_LC_MESSAGES)
2182     fi
2183   ])
2188 dnl Check for whether the Boost-derived checks should be turned on.
2190 dnl GLIBCXX_ENABLE_CONCEPT_CHECKS
2191 dnl --enable-concept-checks turns them on.
2192 dnl --disable-concept-checks leaves them off.
2193 dnl  +  Usage:  GLIBCXX_ENABLE_CONCEPT_CHECKS[(DEFAULT)]
2194 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
2195 dnl       defaults to `no'.
2196 AC_DEFUN(GLIBCXX_ENABLE_CONCEPT_CHECKS, [dnl
2197 define([GLIBCXX_ENABLE_CONCEPT_CHECKS_DEFAULT], ifelse($1, yes, yes, no))dnl
2198 AC_ARG_ENABLE(concept-checks,
2199 changequote(<<, >>)dnl
2200 <<  --enable-concept-checks use Boost-derived template checks [default=>>GLIBCXX_ENABLE_CONCEPT_CHECKS_DEFAULT],
2201 changequote([, ])dnl
2202 [case "$enableval" in
2203  yes) enable_concept_checks=yes ;;
2204  no)  enable_concept_checks=no ;;
2205  *)   AC_MSG_ERROR([Unknown argument to enable/disable concept checks]) ;;
2206  esac],
2207 enable_concept_checks=GLIBCXX_ENABLE_CONCEPT_CHECKS_DEFAULT)dnl
2208 dnl Option parsed, now set things appropriately
2209 if test x"$enable_concept_checks" = xyes; then
2210   AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS)
2216 dnl Add version tags to symbols in shared library (or not), additionally
2217 dnl marking other symbols as private/local (or not).
2219 dnl GLIBCXX_ENABLE_SYMVERS
2220 dnl --enable-symvers=style adds a version script to the linker call when
2221 dnl       creating the shared library.  The choice of version script is
2222 dnl       controlled by 'style'.
2223 dnl --disable-symvers does not.
2224 dnl  +  Usage:  GLIBCXX_ENABLE_SYMVERS[(DEFAULT)]
2225 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
2226 dnl       defaults to `no'.  Passing `yes' tries to choose a default style
2227 dnl       based on linker characteristics.  Passing 'no' disables versioning.
2228 AC_DEFUN(GLIBCXX_ENABLE_SYMVERS, [dnl
2229 define([GLIBCXX_ENABLE_SYMVERS_DEFAULT], ifelse($1, yes, yes, no))dnl
2230 AC_ARG_ENABLE(symvers,
2231 changequote(<<, >>)dnl
2232 <<  --enable-symvers=style  enables symbol versioning of the shared library [default=>>GLIBCXX_ENABLE_SYMVERS_DEFAULT],
2233 changequote([, ])dnl
2234 [case "$enableval" in
2235  yes) enable_symvers=yes ;;
2236  no)  enable_symvers=no ;;
2237  # other names here, just as sanity checks
2238  #gnu|sun|etcetera) enable_symvers=$enableval ;;
2239  gnu) enable_symvers=$enableval ;;
2240  *)   AC_MSG_ERROR([Unknown argument to enable/disable symvers]) ;;
2241  esac],
2242 enable_symvers=GLIBCXX_ENABLE_SYMVERS_DEFAULT)dnl
2244 # If we never went through the GLIBCXX_CHECK_LINKER_FEATURES macro, then we
2245 # don't know enough about $LD to do tricks...
2246 if test x$enable_shared = xno ||
2247         test "x$LD" = x ||
2248         test x$glibcxx_gnu_ld_version = x; then
2249   enable_symvers=no
2252 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
2253 if test $enable_symvers != no; then
2254   AC_MSG_CHECKING([for shared libgcc])
2255   ac_save_CFLAGS="$CFLAGS"
2256   CFLAGS=' -lgcc_s'
2257   AC_TRY_LINK(, [return 0], glibcxx_shared_libgcc=yes, glibcxx_shared_libgcc=no)
2258   CFLAGS="$ac_save_CFLAGS"
2259   AC_MSG_RESULT($glibcxx_shared_libgcc)
2262 # For GNU ld, we need at least this version.  The format is described in
2263 # GLIBCXX_CHECK_LINKER_FEATURES above.
2264 glibcxx_min_gnu_ld_version=21400
2266 # Check to see if unspecified "yes" value can win, given results above.
2267 # Change "yes" into either "no" or a style name.
2268 if test $enable_symvers = yes ; then
2269   if test $with_gnu_ld = yes &&
2270      test $glibcxx_shared_libgcc = yes ;
2271   then
2272     if test $glibcxx_gnu_ld_version -ge $glibcxx_min_gnu_ld_version ; then
2273       enable_symvers=gnu
2274     else
2275       # The right tools, the right setup, but too old.  Fallbacks?
2276       AC_MSG_WARN(=== Linker version $glibcxx_gnu_ld_version is too old for)
2277       AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
2278       AC_MSG_WARN(=== You would need to upgrade your binutils to version)
2279       AC_MSG_WARN(=== $glibcxx_min_gnu_ld_version or later and rebuild GCC.)
2280       AC_MSG_WARN([=== Symbol versioning will be disabled.])
2281       enable_symvers=no
2282     fi
2283   else
2284     # just fail for now
2285     AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
2286     AC_MSG_WARN([=== either you are not using a supported linker, or you are])
2287     AC_MSG_WARN([=== not building a shared libgcc_s (which is required).])
2288     AC_MSG_WARN([=== Symbol versioning will be disabled.])
2289     enable_symvers=no
2290   fi
2293 dnl Everything parsed; figure out what file to use.
2294 case $enable_symvers in
2295   no)
2296       SYMVER_MAP=config/linker-map.dummy
2297       ;;
2298   gnu)
2299       SYMVER_MAP=config/linker-map.gnu
2300       AC_DEFINE(_GLIBCXX_SYMVER)
2301       ;;
2302 esac
2304 AC_SUBST(SYMVER_MAP)
2305 AC_SUBST(port_specific_symbol_files)
2306 AM_CONDITIONAL(GLIBCXX_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
2307 AC_MSG_CHECKING([versioning on shared library symbols])
2308 AC_MSG_RESULT($enable_symvers)