OSDN Git Service

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