OSDN Git Service

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