OSDN Git Service

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