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