Change java language number to 0x000b
[official-gcc.git] / libstdc++-v3 / aclocal.m4
blobc576511f4f5c197880f6e612680ac4ad2055e515
1 dnl aclocal.m4 generated automatically by aclocal 1.4
3 dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl This program is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
10 dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11 dnl PARTICULAR PURPOSE.
14 dnl
15 dnl Initialize configure bits.
16 dnl
17 dnl Define OPTLEVEL='-O2' if new inlining code present.
18 dnl
19 dnl GLIBCPP_CONFIGURE
20 AC_DEFUN(GLIBCPP_CONFIGURE, [
21   dnl Default to --enable-multilib
22   AC_ARG_ENABLE(multilib,
23   [  --enable-multilib       build hella library versions (default)],
24   [case "${enableval}" in
25     yes) multilib=yes ;;
26     no)  multilib=no ;;
27     *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
28    esac], [multilib=yes])dnl
30   dnl We may get other options which we dont document:
31   dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
32   if test "[$]{srcdir}" = "."; then
33     if test "[$]{with_target_subdir}" != "."; then
34       glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
35     else
36       glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
37     fi
38   else
39     glibcpp_basedir="[$]{srcdir}/$1"
40   fi
41   AC_SUBST(glibcpp_basedir)
43   AM_INIT_AUTOMAKE(libstdc++, 2.90.8)
45   # Never versions of autoconf add an underscore to these functions.
46   # Prevent future problems ...
47   ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
48   ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
49   ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
50   ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
52 #  AC_PROG_CC
54 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
55 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
56 # are probably using a cross compiler, which will not be able to fully
57 # link an executable.  This should really be fixed in autoconf
58 # itself.
60 AC_DEFUN(LIB_AC_PROG_CC,
61 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
62 dnl Fool anybody using AC_PROG_CC.
63 AC_PROVIDE([AC_PROG_CC])
64 AC_CHECK_PROG(CC, gcc, gcc)
65 if test -z "$CC"; then
66   AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
67   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
70 AC_PROG_CC_GNU
72 if test $ac_cv_prog_gcc = yes; then
73   GCC=yes
74 dnl Check whether -g works, even if CFLAGS is set, in case the package
75 dnl plays around with CFLAGS (such as to build both debugging and
76 dnl normal versions of a library), tasteless as that idea is.
77   ac_test_CFLAGS="${CFLAGS+set}"
78   ac_save_CFLAGS="$CFLAGS"
79   CFLAGS=
80   AC_PROG_CC_G
81   if test "$ac_test_CFLAGS" = set; then
82     CFLAGS="$ac_save_CFLAGS"
83   elif test $ac_cv_prog_cc_g = yes; then
84     CFLAGS="-g -O2"
85   else
86     CFLAGS="-O2"
87   fi
88 else
89   GCC=
90   test "${CFLAGS+set}" = set || CFLAGS="-g"
94 LIB_AC_PROG_CC
96 # Can't just call these here as g++ requires libstc++ to be built....
97 #  AC_PROG_CXX
99 # Likewise for AC_PROG_CXX.
100 AC_DEFUN(LIB_AC_PROG_CXX,
101 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
102 dnl Fool anybody using AC_PROG_CXX.
103 AC_PROVIDE([AC_PROG_CXX])
104 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
105 test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
107 AC_PROG_CXX_GNU
109 if test $ac_cv_prog_gxx = yes; then
110   GXX=yes
111 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
112 dnl plays around with CXXFLAGS (such as to build both debugging and
113 dnl normal versions of a library), tasteless as that idea is.
114   ac_test_CXXFLAGS="${CXXFLAGS+set}"
115   ac_save_CXXFLAGS="$CXXFLAGS"
116   CXXFLAGS=
117   AC_PROG_CXX_G
118   if test "$ac_test_CXXFLAGS" = set; then
119     CXXFLAGS="$ac_save_CXXFLAGS"
120   elif test $ac_cv_prog_cxx_g = yes; then
121     CXXFLAGS="-g -O2"
122   else
123     CXXFLAGS="-O2"
124   fi
125 else
126   GXX=
127   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
131 LIB_AC_PROG_CXX
133   AC_CHECK_TOOL(AS, as)
134   AC_CHECK_TOOL(AR, ar)
135   AC_CHECK_TOOL(RANLIB, ranlib, :)
137   AC_PROG_INSTALL
139   AM_MAINTAINER_MODE
141   # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
142   # at least currently, we never actually build a program, so we never
143   # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
144   # fails, because we are probably configuring with a cross compiler
145   # which cant create executables.  So we include AC_EXEEXT to keep
146   # automake happy, but we dont execute it, since we dont care about
147   # the result.
148   if false; then
149     AC_EXEEXT
150   fi
152   # configure.host sets the following important variables
153   #     glibcpp_cflags    - host specific C compiler flags
154   #     glibcpp_cxxflags  - host specific C++ compiler flags
155   glibcpp_cflags=
156   glibcpp_cxxflags=
158   . [$]{glibcpp_basedir}/configure.host
160   case [$]{glibcpp_basedir} in
161     /* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
162     *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
163   esac
165   GLIBCPP_CFLAGS="[$]{glibcpp_cflags}"
166   GLIBCPP_CXXFLAGS="[$]{glibcpp_cxxflags}"
167   AC_SUBST(GLIBCPP_CFLAGS)
168   AC_SUBST(GLIBCPP_CXXFLAGS)
173 dnl Check to see if g++ can compile this library, and if so, if any version-
174 dnl specific precautions need to be taken. 
175 dnl 
176 dnl GLIBCPP_CHECK_COMPILER_VERSION
177 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
178   # Sanity check that g++ is capable of dealing with v-3.
179   AC_MSG_CHECKING([for g++ that will successfully compile this code])
180   AC_EGREP_CPP([ok], [
181   #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) 
182     ok
183   #endif
184   ], gpp_satisfactory=yes, AC_MSG_ERROR("please upgrade to gcc-2.95 or above"))
185   AC_MSG_RESULT($gpp_satisfactory)
190 dnl Test for newer compiler features, or features that are present in newer
191 dnl compiler version but not older compiler versions should be placed
192 dnl here.
194 dnl Define WFMT_FLAGS='-fdiagnostics-show-location=once' if possible
195 dnl 
196 dnl Define WERROR='-Werror' if possible; g++'s that lack the new inlining
197 dnl code or the new system_header pragma will die.  
199 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
200 dnl compiler supports it.  
201 dnl GLIBCPP_CHECK_COMPILER_FEATURES
202 AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
203   # All these tests are for C++; save the language and the compiler flags.
204   # The CXXFLAGS thing is suspicious, but based on similar bits 
205   # found in GLIBCPP_CONFIGURE.
206   AC_LANG_SAVE
207   AC_LANG_CPLUSPLUS
208   ac_test_CXXFLAGS="${CXXFLAGS+set}"
209   ac_save_CXXFLAGS="$CXXFLAGS"
210   WERROR='-Werror'
212   # Check for pragma system_header.
213   AC_MSG_CHECKING([for g++ that supports pragma system_header])
214   CXXFLAGS='-Wunknown-pragmas -Werror'
215   AC_TRY_COMPILE([#pragma GCC system_header], [int foo;
216   ], [ac_newpragma=yes], [ac_newpragma=no])
217   if test "$ac_test_CXXFLAGS" = set; then
218     CXXFLAGS="$ac_save_CXXFLAGS"
219   else
220     # this is the suspicious part
221     CXXFLAGS=''
222   fi
223   if test "$ac_newpragma" = "no"; then
224     WERROR="$WERROR -Wno-unknown-pragmas"
225   fi
226   AC_MSG_RESULT($ac_newpragma)
228   # Check for more sophisticated diagnostic control.
229   AC_MSG_CHECKING([for g++ that supports -fdiagnostics-show-location=once])
230   CXXFLAGS='-fdiagnostics-show-location=once'
231   AC_TRY_COMPILE(, [int foo;
232   ], [ac_gabydiags=yes], [ac_gabydiags=no])
233   if test "$ac_test_CXXFLAGS" = set; then
234     CXXFLAGS="$ac_save_CXXFLAGS"
235   else
236     # this is the suspicious part
237     CXXFLAGS=''
238   fi
239   if test "$ac_gabydiags" = "yes"; then
240     WFMT_FLAGS='-fdiagnostics-show-location=once'
241   fi
242   AC_MSG_RESULT($ac_gabydiags)
244   # Check for -ffunction-sections -fdata-sections
245   AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
246   CXXFLAGS='-ffunction-sections -fdata-sections'
247   AC_TRY_COMPILE(, [int foo;
248   ], [ac_fdsections=yes], [ac_fdsections=no])
249   if test "$ac_test_CXXFLAGS" = set; then
250     CXXFLAGS="$ac_save_CXXFLAGS"
251   else
252     # this is the suspicious part
253     CXXFLAGS=''
254   fi
255   if test "$ac_fdsections" = "yes"; then
256     SECTION_FLAGS='-ffunction-sections -fdata-sections'
257   fi
258   AC_MSG_RESULT($ac_fdsections)
260   AC_LANG_RESTORE
261   AC_SUBST(WERROR)
262   AC_SUBST(WFMT_FLAGS)
263   AC_SUBST(SECTION_FLAGS)
268 dnl If GNU ld is in use, check to see if tricky linker opts can be used.  If
269 dnl the native linker is in use, all variables will be defined to something
270 dnl safe (like an empty string).
272 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
273 dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
275 dnl GLIBCPP_CHECK_LINKER_FEATURES
276 AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
277   # If we're not using GNU ld, then there's no point in even trying these
278   # tests.  Check for that first.  We should have already tested for gld
279   # by now (in libtool), but require it now just to be safe...
280   AC_REQUIRE([AC_PROG_LD])
281   if test "$ac_cv_prog_gnu_ld" = "no"; then
282     SECTION_LDFLAGS=''
283     OPT_LDFLAGS=''
285   else   # GNU ld it is!  Joy and bunny rabbits!
287     # All these tests are for C++; save the language and the compiler flags.
288     # Need to do this so that g++ won't try to link in libstdc++
289     ac_test_CFLAGS="${CFLAGS+set}"
290     ac_save_CFLAGS="$CFLAGS"
291     CFLAGS='-x c++  -Wl,--gc-sections'
293     # Check for -Wl,--gc-sections
294     AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
295     AC_TRY_RUN([
296      int main(void) 
297      {
298        try { throw 1; }
299        catch (...) { };
300        return 0;
301      }
302     ], [ac_sectionLDflags=yes], [ac_sectionLFflags=no], [ac_sectionLDflags=yes])
303     if test "$ac_test_CFLAGS" = set; then
304       CFLAGS="$ac_save_CFLAGS"
305     else
306       # this is the suspicious part
307       CFLAGS=''
308     fi
309     if test "$ac_sectionLDflags" = "yes"; then
310       SECTION_LDFLAGS='-Wl,--gc-sections'
311     fi
312     AC_MSG_RESULT($ac_sectionLDflags)
313     OPT_LDFLAGS='-Wl,-O1'
315   fi
316   AC_SUBST(SECTION_LDFLAGS)
317   AC_SUBST(OPT_LDFLAGS)
322 dnl Check to see if the (math function) argument passed is
323 dnl 1) declared when using the c++ compiler
324 dnl 2) has "C" linkage
326 dnl Define HAVE_CARGF etc if "cargf" is declared and links
328 dnl argument 1 is name of function to check
330 dnl ASSUMES argument is a math function with ONE parameter
332 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
333 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
334   AC_MSG_CHECKING([for $1 declaration])
335   AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
336     AC_LANG_SAVE
337     AC_LANG_CPLUSPLUS
338     AC_TRY_COMPILE([#include <math.h>], 
339                    [ $1(0);], 
340                    [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
341     AC_LANG_RESTORE
342   ])
343   AC_MSG_RESULT($glibcpp_cv_func_$1_use)
344   if test x$glibcpp_cv_func_$1_use = x"yes"; then
345     AC_CHECK_FUNCS($1)    
346   fi
351 dnl Check to see if the (math function) argument passed is
352 dnl 1) declared when using the c++ compiler
353 dnl 2) has "C" linkage
355 dnl Define HAVE_CARGF etc if "cargf" is declared and links
357 dnl argument 1 is name of function to check
359 dnl ASSUMES argument is a math function with TWO parameters
361 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
362 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
363   AC_MSG_CHECKING([for $1 declaration])
364   AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
365     AC_LANG_SAVE
366     AC_LANG_CPLUSPLUS
367     AC_TRY_COMPILE([#include <math.h>], 
368                    [ $1(0, 0);], 
369                    [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
370     AC_LANG_RESTORE
371   ])
372   AC_MSG_RESULT($glibcpp_cv_func_$1_use)
373   if test x$glibcpp_cv_func_$1_use = x"yes"; then
374     AC_CHECK_FUNCS($1)    
375   fi
380 dnl Check to see if the (math function) argument passed is
381 dnl 1) declared when using the c++ compiler
382 dnl 2) has "C" linkage
384 dnl Define HAVE_CARGF etc if "cargf" is declared and links
386 dnl argument 1 is name of function to check
388 dnl ASSUMES argument is a math function with THREE parameters
390 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
391 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
392   AC_MSG_CHECKING([for $1 declaration])
393   AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
394     AC_LANG_SAVE
395     AC_LANG_CPLUSPLUS
396     AC_TRY_COMPILE([#include <math.h>], 
397                    [ $1(0, 0, 0);], 
398                    [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
399     AC_LANG_RESTORE
400   ])
401   AC_MSG_RESULT($glibcpp_cv_func_$1_use)
402   if test x$glibcpp_cv_func_$1_use = x"yes"; then
403     AC_CHECK_FUNCS($1)    
404   fi
409 dnl Because the builtins are picky picky picky about the arguments they take, 
410 dnl do an explict linkage tests here.
411 dnl Check to see if the (math function) argument passed is
412 dnl 1) declared when using the c++ compiler
413 dnl 2) has "C" linkage
415 dnl Define HAVE_CARGF etc if "cargf" is declared and links
417 dnl argument 1 is name of function to check
419 dnl ASSUMES argument is a math function with ONE parameter
421 dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
422 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
423   AC_MSG_CHECKING([for $1 declaration])
424   AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
425     AC_LANG_SAVE
426     AC_LANG_CPLUSPLUS
427     AC_TRY_COMPILE([#include <math.h>], 
428                    [ $1(0);], 
429                    [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
430     AC_LANG_RESTORE
431   ])
432   AC_MSG_RESULT($glibcpp_cv_func_$1_use)
433   if test x$glibcpp_cv_func_$1_use = x"yes"; then
434     AC_MSG_CHECKING([for $1 linkage])
435     AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
436       AC_TRY_LINK([#include <math.h>], 
437                   [ $1(0);], 
438                   [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
439     ])
440     AC_MSG_RESULT($glibcpp_cv_func_$1_link)
441     if test x$glibcpp_cv_func_$1_link = x"yes"; then
442       ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
443       AC_DEFINE_UNQUOTED(${ac_tr_func})
444     fi
445   fi
450 dnl Check to see what builtin math functions are supported
452 dnl check for __builtin_abs
453 dnl check for __builtin_fabsf
454 dnl check for __builtin_fabs
455 dnl check for __builtin_fabl
456 dnl check for __builtin_labs
457 dnl check for __builtin_sqrtf
458 dnl check for __builtin_sqrtl
459 dnl check for __builtin_fsqrt
460 dnl check for __builtin_sinf
461 dnl check for __builtin_sin
462 dnl check for __builtin_sinl
463 dnl check for __builtin_cosf
464 dnl check for __builtin_cos
465 dnl check for __builtin_cosl
467 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
468 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
469   dnl Test for builtin math functions.
470   dnl These are made in gcc/c-common.c 
471   GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
472   GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
473   GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
474   GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
475   GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
477   GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
478   GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fsqrt)
479   GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
481   GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
482   GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
483   GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
485   GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
486   GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
487   GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
489   dnl There is, without a doubt, a more elegant way to have these
490   dnl names exported so that they won't be stripped out of acconfig.h by
491   dnl autoheader. I leave this as an exercise to somebody less frustrated
492   dnl than I.... please email the libstdc++ list if you can figure out a
493   dnl more elegant approach (see autoconf/acgen.m4 and specifically
494   dnl AC_CHECK_FUNC for things to steal.)
495   dummyvar=no
496   if test x$dummyvar = x"yes"; then
497     AC_DEFINE(HAVE___BUILTIN_ABS)
498     AC_DEFINE(HAVE___BUILTIN_LABS)
499     AC_DEFINE(HAVE___BUILTIN_COS)
500     AC_DEFINE(HAVE___BUILTIN_COSF)
501     AC_DEFINE(HAVE___BUILTIN_COSL)
502     AC_DEFINE(HAVE___BUILTIN_FABS)
503     AC_DEFINE(HAVE___BUILTIN_FABSF)
504     AC_DEFINE(HAVE___BUILTIN_FABSL)
505     AC_DEFINE(HAVE___BUILTIN_SIN)
506     AC_DEFINE(HAVE___BUILTIN_SINF)
507     AC_DEFINE(HAVE___BUILTIN_SINL)
508     AC_DEFINE(HAVE___BUILTIN_FSQRT)
509     AC_DEFINE(HAVE___BUILTIN_SQRTF)
510     AC_DEFINE(HAVE___BUILTIN_SQRTL)
511   fi
516 dnl Check to see what the underlying c library or math library is like.
517 dnl These checks need to do two things: 
518 dnl 1) make sure the name is declared when using the c++ compiler
519 dnl 2) make sure the name has "C" linkage
520 dnl This might seem like overkill but experience has shown that it's not...
522 dnl Define HAVE_CARGF etc if "cargf" is found.
524 dnl GLIBCPP_CHECK_MATH_SUPPORT
525 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
526   ac_test_CXXFLAGS="${CXXFLAGS+set}"
527   ac_save_CXXFLAGS="$CXXFLAGS"
528   CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
530   dnl Check libm
531   AC_CHECK_LIB(m, sin, libm="-lm")
532   ac_save_LIBS="$LIBS"
533   LIBS="$LIBS $libm"
535   dnl Although not math functions, needed and for some reason checked here.
536   AC_CHECK_FUNCS(strtof strtold)
538   dnl Check to see if certain C math functions exist.
539   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
540   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
541   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
542   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
543   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
544   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
545   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
547   dnl Check to see if basic C math functions have float versions.
548   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
549   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
550   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(acosf)
551   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(asinf)
552   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(atanf)
553   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
554   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(ceilf)
555   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(cosf)
556   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(coshf)
557   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expf)
558   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
559   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(floorf)
560   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
561   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
562   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
563   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
564   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
565   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
566   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
567   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinf)
568   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinhf)
569   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
570   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanf)
571   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanhf)
572   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
573   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
575   dnl Check to see if basic C math functions have long double versions.
576   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
577   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
578   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
579   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(acosl)
580   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(asinl)
581   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(atanl)
582   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
583   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(ceill)
584   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(cosl)
585   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(coshl)
586   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
587   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
588   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(floorl)
589   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
590   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
591   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
592   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
593   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
594   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
595   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
596   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinl)
597   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sinhl)
598   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
599   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanl)
600   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(tanhl)
601   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
602   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
604   dnl Some runtimes have these functions with a preceding underscore. Please
605   dnl keep this sync'd with the one above. And if you add any new symbol,
606   dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
607   dnl Check to see if certain C math functions exist.
608   dnl Check to see if certain C math functions exist.
609   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinf)
610   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnan)
611   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finite)
612   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_copysign)
613   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincos)
614   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fpclass)
615   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_qfpclass)
617   dnl Check to see if basic C math functions have float versions.
618   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnanf)
619   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinff)
620   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_acosf)
621   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_asinf)
622   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_atanf)
623   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_atan2f)
624   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_ceilf)
625   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_cosf)
626   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_coshf)
627   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_expf)
628   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fabsf)
629   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_floorf)
630   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_fmodf)
631   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_frexpf)
632   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_ldexpf)
633   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_logf)
634   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_log10f)
635   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_modff)
636   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_powf)
637   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinf)
638   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinhf)
639   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sqrtf)
640   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanf)
641   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanhf)
642   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincosf)
643   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finitef)
645   dnl Check to see if basic C math functions have long double versions.
646   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isnanl)
647   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_isinfl)
648   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_copysignl)
649   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_acosl)
650   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_asinl)
651   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_atanl)
652   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_atan2l)
653   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_ceill)
654   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_cosl)
655   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_coshl)
656   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_expl)
657   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_fabsl)
658   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_floorl)
659   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_fmodl)
660   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_frexpl)
661   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_ldexpl)
662   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_logl)
663   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_log10l)
664   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_modfl)
665   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(_powl)
666   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinl)
667   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sinhl)
668   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_sqrtl)
669   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanl)
670   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_tanhl)
671   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(_sincosl)
672   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(_finitel)
674   LIBS="$ac_save_LIBS"
675   CXXFLAGS="$ac_save_CXXFLAGS"
680 dnl Check to see if there is native support for complex 
682 dnl Don't compile bits in math/* if native support exits.
684 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "cargf" is found.
686 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
687 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
688   dnl Check for complex versions of math functions of platform.
689   AC_CHECK_HEADERS([complex.h])
690   AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf c_log c_logf \
691   clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt csqrtf \
692   ctan ctanf ctanh ctanhf carg cargf nan hypot hypotf atan2f expf copysignf)
694   dnl Compile the long double complex functions only if the function 
695   dnl provides the non-complex long double functions that are needed.
696   dnl Currently this includes copysignl and atan2l, which should be
697   dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
698   USE_COMPLEX_LONG_DOUBLE=no
699   if test x$ac_cv_func_atan2l = x"yes" \
700      && test x$ac_cv_func_copysignl = x"yes"; then
701     USE_COMPLEX_LONG_DOUBLE=yes
702     AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl cpowl csinhl csinl \
703     csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l)
704   fi
706   AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
710 dnl Check to see what architecture we are compiling for. If it's
711 dnl supported, use special hand-crafted routines to provide thread
712 dnl primitives. Also, if architecture-specific flags are required for 
713 dnl compilation, add them here.
714 dnl 
715 dnl Depending on what is found, select configure/cpu/*/bits/atomicity.h 
716 dnl If not found, select configure/cpu/generic/bits/atomicity.h
718 dnl GLIBCPP_CHECK_CPU
719 AC_DEFUN(GLIBCPP_CHECK_CPU, [
720     AC_MSG_CHECKING([for cpu primitives directory])
721     CPU_FLAGS=                  
722     case "${target_cpu}" in
723       alpha*)
724         cpu_include_dir="config/cpu/alpha"
725         ;;
726       arm*)
727         cpu_include_dir="config/cpu/arm"
728         ;;
729       i386)
730         cpu_include_dir="config/cpu/i386"
731         ;;
732       i486 | i586 | i686 | i786)
733         cpu_include_dir="config/cpu/i486"
734         ;;
735       powerpc | rs6000)
736         cpu_include_dir="config/cpu/powerpc"
737         CPU_FLAGS='-mcpu=powerpc'
738         ;;
739       sparc64 | ultrasparc)
740         cpu_include_dir="config/cpu/sparc/sparc64"
741         ;;
742       sparc*)
743         cpu_include_dir="config/cpu/sparc/sparc32"
744         ;;
745       *)
746         cpu_include_dir="config/cpu/generic"
747         ;;
748     esac
749     AC_MSG_RESULT($cpu_include_dir)
750     AC_SUBST(cpu_include_dir)
751     AC_SUBST(CPU_FLAGS)
756 dnl Check to see what the underlying c library's interface to ctype looks
757 dnl like. Bits of locale rely on things like isspace, toupper, etc. This
758 dnl stuff makes sure the right bits from the clibrary get called.
759 dnl 
760 dnl Depending on what is found, select various configure/*/bits/ctype_base.h 
761 dnl Depending on what is found, select various configure/*/ctype.cc
763 dnl GLIBCPP_CHECK_CTYPE
764 AC_DEFUN(GLIBCPP_CHECK_CTYPE, [
765   AC_CHECK_HEADER(ctype.h, [
766     
767     dnl If doesn't match any specified, go with defaults.
768     ctype_default=yes
770     dnl Test for <ctype> functionality -- gnu-linux
771     AC_MSG_CHECKING([<ctype> for gnu-linux ])
772     AC_TRY_COMPILE([#include <ctype.h>],
773     [int
774     foo (int a)
775     { return _ISspace + _ISprint + _IScntrl + _ISupper + _ISlower + _ISalpha \
776         + _ISdigit + _ISpunct + _ISxdigit + _ISalnum + _ISgraph \
777         + __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];}], \
778     ctype_linux=yes, ctype_linux=no)
779     AC_MSG_RESULT($ctype_linux)
780     if test $ctype_linux = "yes"; then
781       ctype_include_dir="config/gnu-linux"
782       ctype_default=no
783     fi
785     dnl Test for <ctype> functionality -- FreeBSD 4.0
786     if test $ctype_default = "yes"; then
787     AC_MSG_CHECKING([<ctype> for freebsd 4.0 ])
788     AC_TRY_COMPILE([#include <ctype.h>],
789     [int
790     foo (int a)
791     { return _CTYPE_S + _CTYPE_R + _CTYPE_C + _CTYPE_U + _CTYPE_L + _CTYPE_A \
792         + _CTYPE_D + _CTYPE_P + _CTYPE_X + _CTYPE_G ;}], \
793     ctype_bsd=yes, ctype_bsd=no)
794     AC_MSG_RESULT($ctype_bsd)
795     if test $ctype_bsd = "yes"; then
796       ctype_include_dir="config/bsd"
797       ctype_default=no
798     fi
799     fi
801     dnl Test for <ctype> functionality -- FreeBSD 3.4
802     if test $ctype_default = "yes"; then
803     AC_MSG_CHECKING([<ctype> for freebsd 3.4 ])
804     AC_TRY_COMPILE([#include <ctype.h>],
805     [int
806     foo (int a)
807     { return _S + _R + _C + _U + _L + _A \
808       + _D + _P + _X + _G + __istype (a, 0);}], \
809     ctype_freebsd34=yes, ctype_freebsd34=no)
810     AC_MSG_RESULT($ctype_freebsd34)
811     if test $ctype_freebsd34 = "yes"; then
812       ctype_include_dir="config/bsd"
813       ctype_default=no
814     fi
815     fi
817     dnl Test for <ctype> functionality -- solaris 2.6 and 2.7
818     if test $ctype_default = "yes"; then
819     AC_MSG_CHECKING([<ctype> for solaris 2.[6,7,8] ])
820     AC_TRY_COMPILE([#include <ctype.h>],
821     [int
822     foo (int a)
823     { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
824         + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
825         + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}], \
826     ctype_solaris=yes, ctype_solaris=no)
827     AC_MSG_RESULT($ctype_solaris)
829     if test $ctype_solaris = "yes"; then
830       AC_MSG_CHECKING([  for version])
831       AC_LANG_CPLUSPLUS 
832       AC_TRY_COMPILE([#include <ctype.h>],
833       [typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;],\
834       ctype_solaris26=yes, ctype_solaris26=no)
835       AC_LANG_C
836       if test $ctype_solaris26 = "yes"; then
837         ctype_include_dir="config/solaris/solaris2.6"
838         AC_MSG_RESULT("solaris2.6")
839         ctype_default=no
840       else
841         ctype_include_dir="config/solaris/solaris2.7"
842         AC_MSG_RESULT("solaris2.[7,8]")
843         ctype_default=no
844       fi
845     fi
846     fi  
848     dnl Test for <ctype> functionality -- solaris 2.5.1
849     if test $ctype_default = "yes"; then
850     AC_MSG_CHECKING([<ctype> for solaris 2.5.1 ])
851     AC_TRY_COMPILE([#include <ctype.h>],
852     [int
853     foo (int a)
854     { return _U + _L + _N + _S + _P + _C + _X + _B \
855         + __ctype[a];}], \
856     ctype_solaris25=yes, ctype_solaris25=no)
857     AC_MSG_RESULT($ctype_solaris25)
858     if test $ctype_solaris25 = "yes"; then
859       ctype_include_dir="config/solaris/solaris2.5"
860       ctype_default=no
861     fi
862     fi
864     dnl Test for <ctype> functionality -- aix
865     if test $ctype_default = "yes"; then
866     AC_MSG_CHECKING([<ctype> for aix ])
867     AC_TRY_COMPILE([#include <ctype.h>],
868     [int
869     foo (int a)
870     { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
871         + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
872         + _VALC('a') + _IS('c', 0);}], \
873     ctype_aix=yes, ctype_aix=no)
874     AC_MSG_RESULT($ctype_aix)
875     if test $ctype_aix = "yes"; then
876       ctype_include_dir="config/aix"
877       ctype_default=no
878     fi
879     fi
881     dnl Test for <ctype> functionality -- newlib
882     if test $ctype_default = "yes"; then
883     AC_MSG_CHECKING([<ctype> for newlib ])
884     AC_TRY_COMPILE([#include <ctype.h>],
885     [int
886     foo (int a)
887     { return _U + _L + _N + _S + _P + _C + _X + _B \
888         + _ctype_[a];}], \
889     ctype_newlib=yes, ctype_newlib=no)
890     AC_MSG_RESULT($ctype_newlib)
891     if test $ctype_newlib = "yes"; then
892       ctype_include_dir="config/newlib"
893       ctype_default=no
894     fi
895     fi
897     if test $ctype_default = "yes"; then
898       ctype_include_dir="config/generic"
899       AC_MSG_WARN("Using default ctype headers.")
900     fi
901     AC_SUBST(ctype_include_dir)
902   ])
907 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
909 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found 
910 dnl Define _GLIBCPP_NEED_MBSTATE_T if mbstate_t is not in wchar.h
912 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
913 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
915   dnl Sanity check for existence of ISO C9X headers for extended encoding.
916   AC_CHECK_HEADER(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
917   AC_CHECK_HEADER(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
918         
919   dnl Only continue checking if the ISO C9X headers exist.
920   if test x"$ac_has_wchar_h" = xyes && test x"$ac_has_wctype_h" = xyes; then
922     dnl Test wchar.h for mbstate_t, which is needed for char_traits and others.
923     AC_MSG_CHECKING([for mbstate_t])
924     AC_TRY_COMPILE([#include <wchar.h>],
925     [mbstate_t teststate;], 
926     use_native_mbstatet=yes, use_native_mbstatet=no)
927     AC_MSG_RESULT($use_native_mbstatet)
928     if test x"$use_native_mbstatet" = xno; then
929       AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
930     fi
931   
932     dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
933     dnl numeric_limits can instantiate type_traits<wchar_t>
934     AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
935     AC_TRY_COMPILE([#include <wchar.h>],
936     [int i = WCHAR_MIN; int j = WCHAR_MAX;], 
937     has_wchar_minmax=yes, has_wchar_minmax=no)
938     AC_MSG_RESULT($has_wchar_minmax)
939   
940     dnl Test wchar.h for WEOF, which is what we use to determine whether
941     dnl to specialize for char_traits<wchar_t> or not.
942     AC_MSG_CHECKING([for WEOF])
943     AC_TRY_COMPILE([
944       #include <wchar.h>
945       #include <stddef.h>],
946     [wint_t i = WEOF;],
947     has_weof=yes, has_weof=no)
948     AC_MSG_RESULT($has_weof)
950     dnl Tests for wide character functions used in char_traits<wchar_t>.
951     AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset, ac_wfuncs=yes, ac_wfuncs=no)
953     AC_MSG_CHECKING([for ISO C9X wchar_t support])
954     if test x"$has_weof" = xyes && test x"$has_wchar_minmax" = xyes && test x"$ac_wfuncs" = xyes; then
955       ac_isoC9X_wchar_t=yes
956     else
957       ac_isoC9X_wchar_t=no
958     fi
959     AC_MSG_RESULT($ac_isoC9X_wchar_t)
961     dnl Use iconv for wchar_t to char conversions. As such, check for 
962     dnl X/Open Portability Guide, version 2 features (XPG2).
963     AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
964     AC_CHECK_FUNCS(iconv_open iconv_close iconv, ac_XPG2funcs=yes, ac_XPG2funcs=no)
966     AC_MSG_CHECKING([for XPG2 wchar_t support])
967     if test x"$ac_has_iconv_h" = xyes && test x"$ac_XPG2funcs" = xyes; then
968       ac_XPG2_wchar_t=yes
969     else
970       ac_XPG2_wchar_t=no
971     fi
972     AC_MSG_RESULT($ac_XPG2_wchar_t)
974     dnl At the moment, only enable wchar_t specializations if all the
975     dnl above support is present.
976     dnl 2000-07-07-bkoz-hack-xxx
977 #    ac_isoC9X_wchar_t=no
978     dnl 2000-07-07-bkoz-hack-xxx
980     AC_MSG_CHECKING([for enabled wchar_t specializations])
981     if test x"$ac_isoC9X_wchar_t" = xyes && test x"$ac_XPG2_wchar_t" = xyes; then
982       libinst_wstring_la="libinst-wstring.la"
983       AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
984       AC_MSG_RESULT("yes")
985     else
986       libinst_wstring_la=""
987       AC_MSG_RESULT("no")
988     fi
989     AC_SUBST(libinst_wstring_la)
991   else
992     AC_MSG_WARN([<wchar.h> not found])
993     AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
994   fi
999 dnl Check to see if this version of GNU C++ is afflicted by bugs in
1000 dnl __complex__ float support.
1002 dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
1004 dnl Check to see if this version of GNU C++ is afflicted by bugs in 
1005 dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
1006 dnl gcc-2.95.x when using the library, unless we define the default copy
1007 dnl ctor in the specializations of complex<>. 
1008 dnl 
1009 dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
1010 dnl GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT
1011 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT, [
1012   AC_REQUIRE([AC_PROG_CXX])
1014   AC_MSG_CHECKING([for GNU C++ __complex__ support])
1015   AC_CACHE_VAL(glibcpp_cv_complex, [
1016     AC_LANG_SAVE
1017     AC_LANG_CPLUSPLUS
1018     AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
1019                     dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
1020                     [ dcomplex x; f(x); ],
1021       glibcpp_cv_complex=ok,
1022       glibcpp_cv_complex=buggy
1023     )
1024     AC_LANG_RESTORE
1025   ])
1026   AC_MSG_RESULT($glibcpp_cv_complex)
1027   if test $glibcpp_cv_complex = buggy; then
1028     AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
1029   fi
1031   AC_MSG_CHECKING([for GNU C++ __complex__ float support])
1032   AC_CACHE_VAL(glibcpp_cv_float_complex, [
1033     AC_LANG_SAVE
1034     AC_LANG_CPLUSPLUS
1035     rm -f conftest.h
1036     cat > conftest.h <<EOB
1037       //
1038       // Check for buggy __complex__ that causes ICE in most versions of egcs
1039       // and gcc-2.95.x on certain platforms (eg., x86-win32).
1040       //
1041       // See http://egcs.cygnus.com/ml/gcc-bugs/1999-07/msg00845.html for
1042       // more info on the bug itself.
1043       //
1044       struct
1045       float_complex
1046       {
1047        __complex__ float m_value;
1048        float_complex (float = 0.0f, float = 0.0f);
1049        float_complex (__complex__ float val) : m_value (val) {}
1050        float_complex foo (const float_complex &val)
1051          { return float_complex (~val.m_value); }
1052       };
1054     AC_TRY_COMPILE([#include "conftest.h"], ,
1055       glibcpp_cv_float_complex=ok,
1056       glibcpp_cv_float_complex=buggy
1057     )
1058     AC_LANG_RESTORE
1059   ])
1060   AC_MSG_RESULT($glibcpp_cv_float_complex)
1061   if test $glibcpp_cv_float_complex = buggy; then
1062     AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
1063   fi
1068 dnl Check for special debugging mode; not for production use.
1070 dnl GLIBCPP_ENABLE_DEBUG
1071 dnl --enable-debug sets '-ggdb -O0'.
1072 dnl --disable-debug sets '-g' and whatever optimization options the
1073 dnl     compiler can handle.
1074 dnl  +  Perhaps --enable-maintainer-mode should automatically turn this on?
1075 dnl  +  Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
1076 dnl  +  Usage:  GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
1077 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
1078 dnl       defaults to `no'.
1079 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
1080 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
1081 AC_ARG_ENABLE(debug,
1082 changequote(<<, >>)dnl
1083 <<  --enable-debug          extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
1084 changequote([, ])dnl
1085 [case "${enableval}" in
1086  yes) enable_debug=yes ;;
1087  no)  enable_debug=no ;;
1088  *)   AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
1089  esac],
1090 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
1092 dnl Option parsed, now set things appropriately
1093 case "${enable_debug}" in
1094     yes) 
1095         DEBUG_FLAGS='-O0 -ggdb'                 
1096         ;;
1097     no)   
1098         DEBUG_FLAGS='-g'
1099         ;;
1100 esac
1101 AC_SUBST(DEBUG_FLAGS)
1106 dnl Check for "unusual" flags to pass to the compiler while building.
1108 dnl GLIBCPP_ENABLE_CXX_FLAGS
1109 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1110 dnl     experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1111 dnl     Somehow this same set of flags must be passed when [re]building
1112 dnl     libgcc.
1113 dnl --disable-cxx-flags passes nothing.
1114 dnl  +  See http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00131.html
1115 dnl         http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00284.html
1116 dnl         http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00035.html
1117 dnl  +  Usage:  GLIBCPP_ENABLE_CXX_FLAGS(default flags)
1118 dnl       If "default flags" is an empty string (or "none"), the effect is
1119 dnl       the same as --disable or --enable=no.
1120 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1121 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1122 AC_ARG_ENABLE(cxx-flags,
1123 changequote(<<, >>)dnl
1124 <<  --enable-cxx-flags=FLAGS      pass compiler FLAGS when building library;
1125                                 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1126 changequote([, ])dnl
1127 [case "x$enableval" in
1128  xyes)   
1129         AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1130  xno|x)  
1131         enable_cxx_flags='' ;;
1132  *)      
1133         enable_cxx_flags="$enableval" ;;
1134  esac],
1135 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
1137 dnl Thinko on my part during design.  This kludge is the workaround.
1138 if test "$enable_cxx_flags" = "none"; then 
1139   enable_cxx_flags=''; 
1142 dnl Run through flags (either default or command-line) and set anything
1143 dnl extra (e.g., #defines) that must accompany particular g++ options.
1144 if test -n "$enable_cxx_flags"; then
1145     for f in $enable_cxx_flags; do
1146         case "$f" in
1147             -fhonor-std)  ;;
1148             -*)  ;;
1149             *)   # and we're trying to pass /what/ exactly?
1150                  AC_MSG_ERROR([compiler flags start with a -]) ;;
1151         esac
1152     done
1154 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1155 AC_SUBST(EXTRA_CXX_FLAGS)
1160 dnl Check for instructions to automatically rebuild libgcc.a.  Requires,
1161 dnl of course, the location of the gcc objdir.  Note that if --disable-
1162 dnl namespaces is in effect, rebuilding libgcc.a is an expensive no-op.
1164 dnl GLIBCPP_ENABLE_RELIBGCC
1165 dnl --enable-libgcc-rebuild=/absolute/path/to/gcc/objdir sets GCC_OBJDIR
1166 dnl     (presumably in the top-level Makefile) to /absol.../objdir
1167 dnl --disable-libgcc-rebuild will not touch libgcc.a at all (maybe print
1168 dnl     a warning if this is given along with --enable-namespaces), by
1169 dnl     setting GCC_OBJDIR to `no'.
1170 dnl  +  Doing this by default is going to be interesting.  What default
1171 dnl     "on" value can there be?
1172 dnl  +  Usage:  GLIBCPP_ENABLE_RELIBGCC[(DEFAULT)]
1173 dnl       The default path should be ../.. if bundled with GCC source.
1174 dnl       If ommitted, it defaults to `no'.
1176 AC_DEFUN(GLIBCPP_ENABLE_RELIBGCC, [dnl
1177 define([GLIBCPP_ENABLE_RELIBGCC_DEFAULT], ifelse($1,, no, $1))dnl
1178 AC_ARG_ENABLE(libgcc-rebuild,
1179 changequote(<<, >>)dnl
1180 <<  --enable-libgcc-rebuild=DIR     also rebuild libgcc.a; DIR is
1181                                   the GCC objdir; see install.html>>,
1182 changequote([, ])dnl
1183 [case "$enableval" in
1184  yes) AC_MSG_ERROR([--enable-libgcc-rebuild needs a pathname]) ;;
1185  no)  enable_libgcc_rebuild=no ;;
1186  *)   if test -d "$enableval" && test -d "${enableval}/gcc" && \
1187          test -d "${enableval}/libiberty"
1188       then
1189          enable_libgcc_rebuild="$enableval"
1190       else
1191          AC_MSG_ERROR(["$enableval" does not appear to be the GCC objdir])
1192       fi
1193       ;;
1194  esac],
1195 enable_libgcc_rebuild=GLIBCPP_ENABLE_RELIBGCC_DEFAULT)dnl
1196 GCC_OBJDIR="$enable_libgcc_rebuild"
1197 AC_SUBST(GCC_OBJDIR)
1202 dnl Check for which I/O library to use:  libio, or something specific.
1204 dnl GLIBCPP_ENABLE_CSTDIO
1205 dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
1206 dnl 
1207 dnl default is libio
1209 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1210   AC_MSG_CHECKING([for cstdio to use])
1211   AC_ARG_ENABLE(cstdio,
1212   [  --enable-cstdio         enable GNU libio for target io package. (default)
1213   --enable-cstdio=LIB     use LIB target-speific io package.], 
1214   if test x$enable_cstdio = xno; then
1215     enable_cstdio=libio
1216   fi,
1217      enable_cstdio=libio)
1219   enable_cstdio_flag=$enable_cstdio
1221   dnl Check if a valid thread package
1222   case x${enable_cstdio_flag} in
1223     xlibio | x | xno | xnone | xyes)
1224       # default
1225       CSTDIO_H=config/c_io_libio.h
1226       CSTDIO_CC=config/c_io_libio.cc
1227       AC_MSG_RESULT(libio)
1229       # see if we are on a system with libio native (ie, linux)
1230       AC_CHECK_HEADER(libio.h,  has_libio=yes, has_libio=no)
1232       # Need to check and see what version of glibc is being used. If
1233       # it's not glibc-2.2 or higher, then we'll need to go ahead and 
1234       # compile most of libio for linux systems.
1235       if test x$has_libio = x"yes"; then
1236         case "$target" in
1237           *-*-linux*)
1238             AC_MSG_CHECKING([for glibc version >= 2.2])
1239             AC_EGREP_CPP([ok], [
1240             #include <features.h>
1241             #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) 
1242                 ok
1243             #endif
1244             ], glibc_satisfactory=yes, glibc_satisfactory=no)
1245             AC_MSG_RESULT($glibc_satisfactory)
1246             ;;
1247         esac
1249         if test x$glibc_satisfactory = x"yes"; then
1250           need_libio=no
1251           need_xtra_libio=no
1252           need_wlibio=no        
1253         else
1254           need_libio=yes
1255           need_xtra_libio=yes
1256           # bkoz XXX need to add checks to enable this
1257           need_wlibio=yes
1258         fi
1260       # Using libio, but <libio.h> doesn't exist on the target system. . .
1261       else
1262         need_libio=yes
1263         need_xtra_libio=no
1264         # bkoz XXX need to add checks to enable this
1265         need_wlibio=no
1266       fi
1267       ;;
1269     xwince)
1270       CSTDIO_H=config/c_io_wince.h
1271       CSTDIO_CC=config/c_io_wince.cc
1272       AC_MSG_RESULT(wince)
1274       need_libio=no
1275       ;;
1276     *)
1277       echo "$enable_cstdio is an unknown io package" 1>&2
1278       exit 1
1279       ;;
1280   esac
1281   AC_LINK_FILES($CSTDIO_H, bits/c++io.h)
1282   AC_LINK_FILES($CSTDIO_CC, src/c++io.cc)
1283   AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1284   AM_CONDITIONAL(GLIBCPP_NEED_XTRA_LIBIO, test "$need_xtra_libio" = yes)
1285   AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1290 dnl Check for which threading library to use.
1292 dnl GLIBCPP_ENABLE_THREADS
1293 dnl --enable-threads=posix sets config/threads-posix.h et. al.
1294 dnl 
1295 dnl default is no threads
1297 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1298   dnl Note this comes from the gcc/config.in and libjava/config.in
1299   dnl Efforts should be made to keep this in sync.
1300   AC_MSG_CHECKING([for threads package to use])
1301   AC_ARG_ENABLE(threads,
1302   [  --enable-threads        enable thread usage for target GCC.
1303   --enable-threads=LIB    use LIB thread package for target GCC.],
1304   if test x$enable_threads = xno; then
1305     enable_threads=''
1306   fi,
1307     enable_threads='')
1309   enable_threads_flag=$enable_threads
1311   dnl Check if a valid thread package
1312   case x${enable_threads_flag} in
1313         x | xno | xnone)
1314                 # No threads
1315                 target_thread_file='single'
1316                 ;;
1317         xyes)
1318                 # default
1319                 target_thread_file=''
1320                 ;;
1321         xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
1322         xsolaris | xwin32 | xdce | xvxworks)
1323                 target_thread_file=$enable_threads_flag
1324                 ;;
1325         *)
1326                 echo "$enable_threads is an unknown thread package" 1>&2
1327                 exit 1
1328                 ;;
1329   esac
1331   dnl Check for thread package actually supported in libstdc++ 
1332   case "$target_thread_file" in
1333     no | none | single)
1334       THREADS=none
1335       ;;
1336     posix | pthreads)
1337       THREADS=posix
1338       case "$target" in
1339         *-*-linux*)
1340         ;;
1341       esac
1342       ;;
1343     decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
1344       AC_MSG_ERROR(thread package $THREADS not yet supported)
1345       ;;
1346     *)
1347       AC_MSG_ERROR($THREADS is an unknown thread package)
1348       ;;
1349   esac
1350   AC_MSG_RESULT($THREADS)
1352   THREADLIBS=
1353   THREADINCS=
1354   THREADDEPS=
1355   THREADOBJS=
1356   THREADH=
1357   THREADSPEC=
1358   case "$THREADS" in
1359     posix)
1360       AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
1361       THREADLIBS=-lpthread
1362       THREADSPEC=-lpthread
1363       dnl Not presently used
1364       dnl THREADOBJS=threads-posix.lo
1365       THREADH=threads-posix.h
1366       ;;
1367     none)
1368       dnl Not presently used
1369       dnl THREADOBJS=threads-no.lo
1370       THREADH=threads-no.h
1371       ;;
1372   esac
1373   AC_SUBST(THREADLIBS)
1374   AC_SUBST(THREADINCS)
1375   AC_SUBST(THREADDEPS)
1376   AC_SUBST(THREADOBJS)
1377   AC_SUBST(THREADSPEC)
1378   AC_LINK_FILES(config/$THREADH, bits/c++threads.h)
1383 dnl Check for template specializations for the 'long long' type extension.
1385 dnl GLIBCPP_ENABLE_LONG_LONG
1386 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1387 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1388 dnl  +  Usage:  GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1389 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
1390 dnl       defaults to `no'.
1391 dnl  +  If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1393 dnl GLIBCPP_ENABLE_LONG_LONG
1394 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1395   define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1397   AC_ARG_ENABLE(long-long,
1398   changequote(<<, >>)dnl
1399   <<--enable-long-long      turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1400   changequote([, ])dnl
1401   [case "$enableval" in
1402    yes) enable_long_long=yes ;;
1403    no)  enable_long_long=no ;;
1404    *)   AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1405    esac],
1406   enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1408   # Check for the existance of functions used if long long is enabled.
1409   AC_CHECK_FUNC(strtoll,,ac_strtoll=no)
1410   AC_CHECK_FUNC(strtoull,,ac_strtoull=no)
1412   AC_MSG_CHECKING([for enabled long long])
1413   if test x"$ac_strtoll" = xno || test x"$ac_strtoull" = xno; then 
1414     enable_long_long=no; 
1415   fi; 
1416   AC_MSG_RESULT($enable_long_long)
1418   dnl Option parsed, now set things appropriately
1419   case "$enable_long_long" in
1420     yes)  AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1421           ;;
1422   esac
1427 dnl Check for whether or not to do shadowed C headers.
1429 dnl GLIBCPP_ENABLE_SHADOW
1430 dnl --enable-cshadow-headers [does stuff].
1431 dnl --disable-cshadow-headers [does not do stuff].
1432 dnl  +  This will eventually need to be on by default.
1433 dnl  +  Usage:  GLIBCPP_ENABLE_SHADOW[(DEFAULT)]
1434 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
1435 dnl       defaults to `no'.
1436 AC_DEFUN(GLIBCPP_ENABLE_SHADOW, [dnl
1437 define([GLIBCPP_ENABLE_SHADOW_DEFAULT], ifelse($1, yes, yes, no))dnl
1438 AC_MSG_CHECKING([for enabled cshadow headers])
1439 AC_ARG_ENABLE(cshadow-headers,
1440 changequote(<<, >>)dnl
1441 <<  --enable-cshadow-headers construct "shadowed" C header files for
1442                            g++ [default=>>GLIBCPP_ENABLE_SHADOW_DEFAULT],
1443 changequote([, ])
1444   [case "$enableval" in
1445    yes) enable_cshadow_headers=yes 
1446         ;;
1447    no)  enable_cshadow_headers=no 
1448         ;;
1449    *)   AC_MSG_ERROR([Unknown argument to enable/disable shadowed C headers]) 
1450         ;;
1451   esac],
1452   enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)
1453   AC_MSG_RESULT($enable_cshadow_headers)
1455   dnl Option parsed, now set things appropriately
1456   dnl CSHADOWFLAGS is currently unused, but may be useful in the future.
1457   case "$enable_cshadow_headers" in
1458     yes) 
1459         CSHADOWFLAGS=""
1460         ;;
1461     no)   
1462         CSHADOWFLAGS=""
1463         ;;
1464   esac
1466   AC_SUBST(CSHADOWFLAGS)
1467   AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cshadow_headers" = yes)
1471 # Check whether LC_MESSAGES is available in <locale.h>.
1472 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1474 # This file file be copied and used freely without restrictions.  It can
1475 # be used in projects which are not available under the GNU Public License
1476 # but which still want to provide support for the GNU gettext functionality.
1477 # Please note that the actual code is *not* freely available.
1479 # serial 1
1481 AC_DEFUN(AC_LC_MESSAGES,
1482   [if test $ac_cv_header_locale_h = yes; then
1483     AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1484       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1485        ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1486     if test $ac_cv_val_LC_MESSAGES = yes; then
1487       AC_DEFINE(HAVE_LC_MESSAGES)
1488     fi
1489   fi])
1492 # Check for functions in math library.
1493 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1495 # This file can be copied and used freely without restrictions.  It can
1496 # be used in projects which are not available under the GNU Public License
1497 # but which still want to provide support for the GNU gettext functionality.
1498 # Please note that the actual code is *not* freely available.
1500 # serial 1
1502 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1503 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1504 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1505 AC_SUBST(LIBMATHOBJS)dnl
1509 # Check for string functions.
1510 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1512 # This file can be copied and used freely without restrictions.  It can
1513 # be used in projects which are not available under the GNU Public License
1514 # but which still want to provide support for the GNU gettext functionality.
1515 # Please note that the actual code is *not* freely available.
1517 # serial 1
1519 dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1520 AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1521 [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1522 AC_SUBST(LIBSTRINGOBJS)dnl
1526 dnl This macro searches for a GNU version of make.  If a match is found, the
1527 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1528 dnl set to "#". This is useful for  including a special features in a Makefile,
1529 dnl which cannot be handled by other versions of make.  The variable
1530 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1531 dnl the empty string otherwise.
1533 dnl Here is an example of its use:
1535 dnl Makefile.in might contain:
1537 dnl     # A failsafe way of putting a dependency rule into a makefile
1538 dnl     $(DEPEND):
1539 dnl             $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1541 dnl     @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1542 dnl     @ifGNUmake@ include $(DEPEND)
1543 dnl     @ifGNUmake@ endif
1545 dnl Then configure.in would normally contain:
1547 dnl     CHECK_GNU_MAKE()
1548 dnl     AC_OUTPUT(Makefile)
1550 dnl Then perhaps to cause gnu make to override any other make, we could do
1551 dnl something like this (note that GNU make always looks for GNUmakefile first):
1553 dnl     if  ! test x$_cv_gnu_make_command = x ; then
1554 dnl             mv Makefile GNUmakefile
1555 dnl             echo .DEFAULT: > Makefile ;
1556 dnl             echo \  $_cv_gnu_make_command \$@ >> Makefile;
1557 dnl     fi
1559 dnl Then, if any (well almost any) other make is called, and GNU make also
1560 dnl exists, then the other make wraps the GNU make.
1562 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1563 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
1565 dnl #### Changes for libstdc++-v3:  reformatting and linewrapping; prepending
1566 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1567 dnl #### conditional's subshell (" --version" is not a command).
1568 dnl #### -pme
1569 AC_DEFUN(
1570   GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1571           _cv_gnu_make_command='' ;
1572 dnl Search all the common names for GNU make
1573           for a in "${MAKE:-make}" make gmake gnumake ; do
1574                   if  ( $a --version 2> /dev/null | grep  -q GNU  ) ;  then
1575                           _cv_gnu_make_command=$a ;
1576                           break;
1577                   fi
1578           done ;
1579   ) ;
1580 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1581 dnl string, '#' otherwise
1582   if test  "x$_cv_gnu_make_command" != "x"  ; then
1583           ifGNUmake='' ;
1584   else
1585           ifGNUmake='#' ;
1586   fi
1587   AC_SUBST(ifGNUmake)
1590 sinclude(../libtool.m4)
1591 dnl The lines below arrange for aclocal not to bring an installed
1592 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1593 dnl add a definition of LIBTOOL to Makefile.in.
1594 ifelse(,,,[AC_SUBST(LIBTOOL)
1595 AC_DEFUN([AM_PROG_LIBTOOL])
1596 AC_DEFUN([AC_LIBTOOL_DLOPEN])
1597 AC_DEFUN([AC_PROG_LD])
1599 # Do all the work for Automake.  This macro actually does too much --
1600 # some checks are only needed if your package does certain things.
1601 # But this isn't really a big deal.
1603 # serial 1
1605 dnl Usage:
1606 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
1608 AC_DEFUN(AM_INIT_AUTOMAKE,
1609 [AC_REQUIRE([AC_PROG_INSTALL])
1610 PACKAGE=[$1]
1611 AC_SUBST(PACKAGE)
1612 VERSION=[$2]
1613 AC_SUBST(VERSION)
1614 dnl test to see if srcdir already configured
1615 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
1616   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1618 ifelse([$3],,
1619 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
1620 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
1621 AC_REQUIRE([AM_SANITY_CHECK])
1622 AC_REQUIRE([AC_ARG_PROGRAM])
1623 dnl FIXME This is truly gross.
1624 missing_dir=`cd $ac_aux_dir && pwd`
1625 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
1626 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
1627 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
1628 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
1629 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
1630 AC_REQUIRE([AC_PROG_MAKE_SET])])
1633 # Check to make sure that the build environment is sane.
1636 AC_DEFUN(AM_SANITY_CHECK,
1637 [AC_MSG_CHECKING([whether build environment is sane])
1638 # Just in case
1639 sleep 1
1640 echo timestamp > conftestfile
1641 # Do `set' in a subshell so we don't clobber the current shell's
1642 # arguments.  Must try -L first in case configure is actually a
1643 # symlink; some systems play weird games with the mod time of symlinks
1644 # (eg FreeBSD returns the mod time of the symlink's containing
1645 # directory).
1646 if (
1647    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
1648    if test "[$]*" = "X"; then
1649       # -L didn't work.
1650       set X `ls -t $srcdir/configure conftestfile`
1651    fi
1652    if test "[$]*" != "X $srcdir/configure conftestfile" \
1653       && test "[$]*" != "X conftestfile $srcdir/configure"; then
1655       # If neither matched, then we have a broken ls.  This can happen
1656       # if, for instance, CONFIG_SHELL is bash and it inherits a
1657       # broken ls alias from the environment.  This has actually
1658       # happened.  Such a system could not be considered "sane".
1659       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
1660 alias in your environment])
1661    fi
1663    test "[$]2" = conftestfile
1664    )
1665 then
1666    # Ok.
1667    :
1668 else
1669    AC_MSG_ERROR([newly created file is older than distributed files!
1670 Check your system clock])
1672 rm -f conftest*
1673 AC_MSG_RESULT(yes)])
1675 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
1676 dnl The program must properly implement --version.
1677 AC_DEFUN(AM_MISSING_PROG,
1678 [AC_MSG_CHECKING(for working $2)
1679 # Run test in a subshell; some versions of sh will print an error if
1680 # an executable is not found, even if stderr is redirected.
1681 # Redirect stdin to placate older versions of autoconf.  Sigh.
1682 if ($2 --version) < /dev/null > /dev/null 2>&1; then
1683    $1=$2
1684    AC_MSG_RESULT(found)
1685 else
1686    $1="$3/missing $2"
1687    AC_MSG_RESULT(missing)
1689 AC_SUBST($1)])
1691 # Add --enable-maintainer-mode option to configure.
1692 # From Jim Meyering
1694 # serial 1
1696 AC_DEFUN(AM_MAINTAINER_MODE,
1697 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1698   dnl maintainer-mode is disabled by default
1699   AC_ARG_ENABLE(maintainer-mode,
1700 [  --enable-maintainer-mode enable make rules and dependencies not useful
1701                           (and sometimes confusing) to the casual installer],
1702       USE_MAINTAINER_MODE=$enableval,
1703       USE_MAINTAINER_MODE=no)
1704   AC_MSG_RESULT($USE_MAINTAINER_MODE)
1705   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
1706   MAINT=$MAINTAINER_MODE_TRUE
1707   AC_SUBST(MAINT)dnl
1711 # Define a conditional.
1713 AC_DEFUN(AM_CONDITIONAL,
1714 [AC_SUBST($1_TRUE)
1715 AC_SUBST($1_FALSE)
1716 if $2; then
1717   $1_TRUE=
1718   $1_FALSE='#'
1719 else
1720   $1_TRUE='#'
1721   $1_FALSE=
1722 fi])
1724 # Like AC_CONFIG_HEADER, but automatically create stamp file.
1726 AC_DEFUN(AM_CONFIG_HEADER,
1727 [AC_PREREQ([2.12])
1728 AC_CONFIG_HEADER([$1])
1729 dnl When config.status generates a header, we must update the stamp-h file.
1730 dnl This file resides in the same directory as the config header
1731 dnl that is generated.  We must strip everything past the first ":",
1732 dnl and everything past the last "/".
1733 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
1734 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
1735 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
1736 <<am_indx=1
1737 for am_file in <<$1>>; do
1738   case " <<$>>CONFIG_HEADERS " in
1739   *" <<$>>am_file "*<<)>>
1740     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
1741     ;;
1742   esac
1743   am_indx=`expr "<<$>>am_indx" + 1`
1744 done<<>>dnl>>)
1745 changequote([,]))])