OSDN Git Service

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