* call.c (build_conditional_expr): Use VOID_TYPE_P.
[official-gcc.git] / libstdc++-v3 / acinclude.m4
blob17f0016e1cd2eb9a2b52bce7677355f64fb44ef2
1 dnl
2 dnl Initialize configure bits.
3 dnl
4 dnl Define OPTLEVEL='-O2' if new inlining code present.
5 dnl
6 dnl GLIBCPP_CONFIGURE
7 AC_DEFUN(GLIBCPP_CONFIGURE, [
8   dnl Default to --enable-multilib
9   AC_ARG_ENABLE(multilib,
10   [  --enable-multilib       build hella library versions (default)],
11   [case "${enableval}" in
12     yes) multilib=yes ;;
13     no)  multilib=no ;;
14     *)   AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
15    esac], [multilib=yes])dnl
17   dnl We may get other options which we dont document:
18   dnl --with-target-subdir, --with-multisrctop, --with-multisubdir
19   if test "[$]{srcdir}" = "."; then
20     if test "[$]{with_target_subdir}" != "."; then
21       glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}../$1"
22     else
23       glibcpp_basedir="[$]{srcdir}/[$]{with_multisrctop}$1"
24     fi
25   else
26     glibcpp_basedir="[$]{srcdir}/$1"
27   fi
28   AC_SUBST(glibcpp_basedir)
30   AC_CANONICAL_HOST
32   AM_INIT_AUTOMAKE(libstdc++, 2.90.8)
34 # FIXME: We temporarily define our own version of AC_PROG_CC.  This is
35 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS.  We
36 # are probably using a cross compiler, which will not be able to fully
37 # link an executable.  This should really be fixed in autoconf
38 # itself.
40 AC_DEFUN(LIB_AC_PROG_CC,
41 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
42 dnl Fool anybody using AC_PROG_CC.
43 AC_PROVIDE([AC_PROG_CC])
44 AC_CHECK_PROG(CC, gcc, gcc)
45 if test -z "$CC"; then
46   AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
47   test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
50 AC_PROG_CC_GNU
52 if test $ac_cv_prog_gcc = yes; then
53   GCC=yes
54 dnl Check whether -g works, even if CFLAGS is set, in case the package
55 dnl plays around with CFLAGS (such as to build both debugging and
56 dnl normal versions of a library), tasteless as that idea is.
57   ac_test_CFLAGS="${CFLAGS+set}"
58   ac_save_CFLAGS="$CFLAGS"
59   CFLAGS=
60   AC_PROG_CC_G
61   if test "$ac_test_CFLAGS" = set; then
62     CFLAGS="$ac_save_CFLAGS"
63   elif test $ac_cv_prog_cc_g = yes; then
64     CFLAGS="-g -O2"
65   else
66     CFLAGS="-O2"
67   fi
68 else
69   GCC=
70   test "${CFLAGS+set}" = set || CFLAGS="-g"
74 LIB_AC_PROG_CC
76 # Likewise for AC_PROG_CXX.
77 AC_DEFUN(LIB_AC_PROG_CXX,
78 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
79 dnl Fool anybody using AC_PROG_CXX.
80 AC_PROVIDE([AC_PROG_CXX])
81 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
82 test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
84 AC_PROG_CXX_GNU
86 if test $ac_cv_prog_gxx = yes; then
87   GXX=yes
88 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
89 dnl plays around with CXXFLAGS (such as to build both debugging and
90 dnl normal versions of a library), tasteless as that idea is.
91   ac_test_CXXFLAGS="${CXXFLAGS+set}"
92   ac_save_CXXFLAGS="$CXXFLAGS"
93   CXXFLAGS=
94   AC_PROG_CXX_G
95   if test "$ac_test_CXXFLAGS" = set; then
96     CXXFLAGS="$ac_save_CXXFLAGS"
97   elif test $ac_cv_prog_cxx_g = yes; then
98     CXXFLAGS="-g -O2"
99   else
100     CXXFLAGS="-O2"
101   fi
102 else
103   GXX=
104   test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
108 LIB_AC_PROG_CXX
110 # AC_CHECK_TOOL does AC_REQUIRE (AC_CANONICAL_BUILD).  If we dont
111 # run it explicitly here, it will be run implicitly before
112 # LIBGCJ_CONFIGURE, which doesn't work because that means that it will
113 # be run before AC_CANONICAL_HOST.
114 AC_CANONICAL_BUILD
116 AC_CHECK_TOOL(AS, as)
117 AC_CHECK_TOOL(AR, ar)
118 AC_CHECK_TOOL(RANLIB, ranlib, :)
120 AC_PROG_INSTALL
122 AM_MAINTAINER_MODE
124 # We need AC_EXEEXT to keep automake happy in cygnus mode.  However,
125 # at least currently, we never actually build a program, so we never
126 # need to use $(EXEEXT).  Moreover, the test for EXEEXT normally
127 # fails, because we are probably configuring with a cross compiler
128 # which cant create executables.  So we include AC_EXEEXT to keep
129 # automake happy, but we dont execute it, since we dont care about
130 # the result.
131 if false; then
132   AC_EXEEXT
135 # configure.host sets the following important variables
136 #       glibcpp_cflags    - host specific C compiler flags
137 #       glibcpp_cxxflags  - host specific C++ compiler flags
139 glibcpp_cflags=
140 glibcpp_cxxflags=
142 . [$]{glibcpp_basedir}/configure.host
144 case [$]{glibcpp_basedir} in
145 /* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
146 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
147 esac
149 GLIBCPP_CFLAGS="[$]{glibcpp_cflags}"
150 GLIBCPP_CXXFLAGS="[$]{glibcpp_cxxflags}"
151 AC_SUBST(GLIBCPP_CFLAGS)
152 AC_SUBST(GLIBCPP_CXXFLAGS)
157 dnl Check to see if g++ can compile this library, and if so, if any version-
158 dnl specific precautions need to be taken. 
159 dnl 
160 dnl GLIBCPP_CHECK_COMPILER_VERSION
161 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
163   # Sanity check that g++ is capable of dealing with v-3.
164   AC_MSG_CHECKING([for g++ that will successfully compile this code])
165   AC_EGREP_CPP([ok], [
166   #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) 
167     ok
168   #endif
169   ], gpp_satisfactory=yes, AC_MSG_ERROR("please upgrade to gcc-2.95 or above"))
170   AC_MSG_RESULT($gpp_satisfactory)
175 dnl Test for newer compiler features, or features that are present in newer
176 dnl compiler version but not older compiler versions should be placed
177 dnl here.
179 dnl Define WFMT_FLAGS='-fdiagnostics-show-location=once' if possible
180 dnl 
181 dnl Define WERROR='-Werror' if possible; g++'s that lack the new inlining
182 dnl code or the new system_header pragma will die.  
184 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
185 dnl compiler supports it.  
186 dnl GLIBCPP_CHECK_COMPILER_FEATURES
187 AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
188   # All these tests are for C++; save the language and the compiler flags.
189   # The CXXFLAGS thing is suspicious, but based on similar bits 
190   # found in GLIBCPP_CONFIGURE.
191   AC_LANG_SAVE
192   AC_LANG_CPLUSPLUS
193   ac_test_CXXFLAGS="${CXXFLAGS+set}"
194   ac_save_CXXFLAGS="$CXXFLAGS"
195   WERROR='-Werror'
197   # Check for pragma system_header.
198   AC_MSG_CHECKING([for g++ that supports pragma system_header])
199   CXXFLAGS='-Wunknown-pragmas -Werror'
200   AC_TRY_COMPILE([#pragma system_header], [int foo;
201   ], [ac_newpragma=yes], [ac_newpragma=no])
202   if test "$ac_test_CXXFLAGS" = set; then
203     CXXFLAGS="$ac_save_CXXFLAGS"
204   else
205     # this is the suspicious part
206     CXXFLAGS=''
207   fi
208   if test "$ac_newpragma" = "no"; then
209     WERROR="$WERROR -Wno-unknown-pragmas"
210   fi
211   AC_MSG_RESULT($ac_newpragma)
213   # Check for more sophisticated diagnostic control.
214   AC_MSG_CHECKING([for g++ that supports -fdiagnostics-show-location=once])
215   CXXFLAGS='-fdiagnostics-show-location=once'
216   AC_TRY_COMPILE(, [int foo;
217   ], [ac_gabydiags=yes], [ac_gabydiags=no])
218   if test "$ac_test_CXXFLAGS" = set; then
219     CXXFLAGS="$ac_save_CXXFLAGS"
220   else
221     # this is the suspicious part
222     CXXFLAGS=''
223   fi
224   if test "$ac_gabydiags" = "yes"; then
225     WFMT_FLAGS='-fdiagnostics-show-location=once'
226   fi
227   AC_MSG_RESULT($ac_gabydiags)
229   # Check for -ffunction-sections -fdata-sections
230   AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
231   CXXFLAGS='-ffunction-sections -fdata-sections'
232   AC_TRY_COMPILE(, [int foo;
233   ], [ac_fdsections=yes], [ac_fdsections=no])
234   if test "$ac_test_CXXFLAGS" = set; then
235     CXXFLAGS="$ac_save_CXXFLAGS"
236   else
237     # this is the suspicious part
238     CXXFLAGS=''
239   fi
240   if test "$ac_fdsections" = "yes"; then
241     SECTION_FLAGS='-ffunction-sections -fdata-sections'
242   fi
243   AC_MSG_RESULT($ac_fdsections)
245   AC_LANG_RESTORE
246   AC_SUBST(WERROR)
247   AC_SUBST(WFMT_FLAGS)
248   AC_SUBST(SECTION_FLAGS)
253 dnl Check to see if tricky linker opts can be used.
255 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible
256 dnl GLIBCPP_CHECK_LINKER_FEATURES
257 AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
258   # All these tests are for C++; save the language and the compiler flags.
259   # The CXXFLAGS thing is suspicious, but based on similar bits 
260   # found in GLIBCPP_CONFIGURE.
261   AC_LANG_SAVE
262   AC_LANG_CPLUSPLUS
264   # Check for -Wl,--gc-sections
265   AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
266   CXXFLAGS='-Wl,--gc-sections'
267   AC_TRY_COMPILE(, [
268    try
269      {
270        throw 1;
271      }
272    catch (...) {};
273   ], [ac_sectionLDflags=yes], [ac_sectionLFflags=no])
274   if test "$ac_test_CXXFLAGS" = set; then
275     CXXFLAGS="$ac_save_CXXFLAGS"
276   else
277     # this is the suspicious part
278     CXXFLAGS=''
279   fi
280   if test "$ac_sectionLDflags" = "yes"; then
281     SECTION_LDFLAGS='-Wl,--gc-sections'
282   fi
283   AC_MSG_RESULT($ac_sectionLDflags)
285   AC_LANG_RESTORE
286   AC_SUBST(SECTION_LDFLAGS)
291 dnl Check to see what builtin math functions are supported
293 dnl check for __builtin_acos
294 dnl check for __builtin_acosf
295 dnl check for __builtin_acosl
296 dnl check for __builtin_asin
297 dnl check for __builtin_asinf
298 dnl check for __builtin_asinl
299 dnl check for __builtin_atan
300 dnl check for __builtin_atanf
301 dnl check for __builtin_atanl
302 dnl check for __builtin_atan2
303 dnl check for __builtin_atan2f
304 dnl check for __builtin_atan2l
305 dnl check for __builtin_ceil
306 dnl check for __builtin_ceilf
307 dnl check for __builtin_ceill
308 dnl check for __builtin_cos
309 dnl check for __builtin_cosf
310 dnl check for __builtin_cosl
311 dnl check for __builtin_cosh
312 dnl check for __builtin_coshf
313 dnl check for __builtin_coshl
314 dnl check for __builtin_exp
315 dnl check for __builtin_expf
316 dnl check for __builtin_expl
317 dnl check for __builtin_fabs
318 dnl check for __builtin_fabsf
319 dnl check for __builtin_fabsl
320 dnl check for __builtin_floor
321 dnl check for __builtin_floorf
322 dnl check for __builtin_floorl
323 dnl check for __builtin_fmod
324 dnl check for __builtin_fmodf
325 dnl check for __builtin_fmodl
326 dnl check for __builtin_frexp
327 dnl check for __builtin_frexpf
328 dnl check for __builtin_frexpl
329 dnl check for __builtin_ldexp
330 dnl check for __builtin_ldexpf
331 dnl check for __builtin_ldexpl
332 dnl check for __builtin_log
333 dnl check for __builtin_logf
334 dnl check for __builtin_logl
335 dnl check for __builtin_log10
336 dnl check for __builtin_log10f
337 dnl check for __builtin_log10l
338 dnl check for __builtin_modf
339 dnl check for __builtin_modff
340 dnl check for __builtin_modfl
341 dnl check for __builtin_pow
342 dnl check for __builtin_powf
343 dnl check for __builtin_powl
344 dnl check for __builtin_sin
345 dnl check for __builtin_sinf
346 dnl check for __builtin_sinl
347 dnl check for __builtin_sinh
348 dnl check for __builtin_sinhf
349 dnl check for __builtin_sinhl
350 dnl check for __builtin_sqrt
351 dnl check for __builtin_sqrtf
352 dnl check for __builtin_sqrtl
353 dnl check for __builtin_tan
354 dnl check for __builtin_tanf
355 dnl check for __builtin_tanl
356 dnl check for __builtin_tanh
357 dnl check for __builtin_tanhf
358 dnl check for __builtin_tanhl
359 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
360 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
361   dnl Test for builtin math functions.
362   AC_LANG_SAVE
363   AC_LANG_CPLUSPLUS
364   AC_MSG_CHECKING([for __builtin_acos])
365   AC_TRY_COMPILE([#include <math.h>], 
366   [ __builtin_acos(0.0);], 
367   use_builtin_acos=yes, use_builtin_acos=no)
368   AC_MSG_RESULT($use_builtin_acos)
369   if test $use_builtin_acos = "yes"; then
370     AC_DEFINE(HAVE_BUILTIN_ACOS)
371   fi
372   AC_MSG_CHECKING([for __builtin_acosf])
373   AC_TRY_COMPILE([#include <math.h>], 
374   [ __builtin_acosf(0.0);], 
375   use_builtin_acosf=yes, use_builtin_acosf=no)
376   AC_MSG_RESULT($use_builtin_acosf)
377   if test $use_builtin_acosf = "yes"; then
378     AC_DEFINE(HAVE_BUILTIN_ACOSF)
379   fi
380   AC_MSG_CHECKING([for __builtin_acosl])
381   AC_TRY_COMPILE([#include <math.h>], 
382   [ __builtin_acosl(0.0);], 
383   use_builtin_acosl=yes, use_builtin_acosl=no)
384   AC_MSG_RESULT($use_builtin_acosl)
385   if test $use_builtin_acosl = "yes"; then
386     AC_DEFINE(HAVE_BUILTIN_ACOSL)
387   fi
388   AC_MSG_CHECKING([for __builtin_asin])
389   AC_TRY_COMPILE([#include <math.h>], 
390   [ __builtin_asin(0.0);], 
391   use_builtin_asin=yes, use_builtin_asin=no)
392   AC_MSG_RESULT($use_builtin_asin)
393   if test $use_builtin_asin = "yes"; then
394     AC_DEFINE(HAVE_BUILTIN_ASIN)
395   fi
396   AC_MSG_CHECKING([for __builtin_asinf])
397   AC_TRY_COMPILE([#include <math.h>], 
398   [ __builtin_asinf(0.0);], 
399   use_builtin_asinf=yes, use_builtin_asinf=no)
400   AC_MSG_RESULT($use_builtin_asinf)
401   if test $use_builtin_asinf = "yes"; then
402     AC_DEFINE(HAVE_BUILTIN_ASINF)
403   fi
404   AC_MSG_CHECKING([for __builtin_asinl])
405   AC_TRY_COMPILE([#include <math.h>], 
406   [ __builtin_asinl(0.0);], 
407   use_builtin_asinl=yes, use_builtin_asinl=no)
408   AC_MSG_RESULT($use_builtin_asinl)
409   if test $use_builtin_asinl = "yes"; then
410     AC_DEFINE(HAVE_BUILTIN_ASINL)
411   fi
412   AC_MSG_CHECKING([for __builtin_atan])
413   AC_TRY_COMPILE([#include <math.h>], 
414   [ __builtin_atan(0.0);], 
415   use_builtin_atan=yes, use_builtin_atan=no)
416   AC_MSG_RESULT($use_builtin_atan)
417   if test $use_builtin_atan = "yes"; then
418     AC_DEFINE(HAVE_BUILTIN_ATAN)
419   fi
420   AC_MSG_CHECKING([for __builtin_atanf])
421   AC_TRY_COMPILE([#include <math.h>], 
422   [ __builtin_atanf(0.0);], 
423   use_builtin_atanf=yes, use_builtin_atanf=no)
424   AC_MSG_RESULT($use_builtin_atanf)
425   if test $use_builtin_atanf = "yes"; then
426     AC_DEFINE(HAVE_BUILTIN_ATANF)
427   fi
428   AC_MSG_CHECKING([for __builtin_atanl])
429   AC_TRY_COMPILE([#include <math.h>], 
430   [ __builtin_atanl(0.0);], 
431   use_builtin_atanl=yes, use_builtin_atanl=no)
432   AC_MSG_RESULT($use_builtin_atanl)
433   if test $use_builtin_atanl = "yes"; then
434     AC_DEFINE(HAVE_BUILTIN_ATANL)
435   fi
436   AC_MSG_CHECKING([for __builtin_atan2])
437   AC_TRY_COMPILE([#include <math.h>], 
438   [ __builtin_atan2(0.0, 0.0);], 
439   use_builtin_atan2=yes, use_builtin_atan2=no)
440   AC_MSG_RESULT($use_builtin_atan2)
441   if test $use_builtin_atan2 = "yes"; then
442     AC_DEFINE(HAVE_BUILTIN_ATAN2)
443   fi
444   AC_MSG_CHECKING([for __builtin_atan2f])
445   AC_TRY_COMPILE([#include <math.h>], 
446   [ __builtin_atan2f(0.0, 0.0);], 
447   use_builtin_atan2f=yes, use_builtin_atan2f=no)
448   AC_MSG_RESULT($use_builtin_atan2f)
449   if test $use_builtin_atan2f = "yes"; then
450     AC_DEFINE(HAVE_BUILTIN_ATAN2F)
451   fi
452   AC_MSG_CHECKING([for __builtin_atan2l])
453   AC_TRY_COMPILE([#include <math.h>], 
454   [ __builtin_atan2l(0.0, 0.0);], 
455   use_builtin_atan2l=yes, use_builtin_atan2l=no)
456   AC_MSG_RESULT($use_builtin_atan2l)
457   if test $use_builtin_atan2l = "yes"; then
458     AC_DEFINE(HAVE_BUILTIN_ATAN2L)
459   fi
460   AC_MSG_CHECKING([for __builtin_ceil])
461   AC_TRY_COMPILE([#include <math.h>], 
462   [ __builtin_fceil(0.0);], 
463   use_builtin_ceil=yes, use_builtin_ceil=no)
464   AC_MSG_RESULT($use_builtin_ceil)
465   if test $use_builtin_ceil = "yes"; then
466     AC_DEFINE(HAVE_BUILTIN_CEIL)
467   fi
468   AC_MSG_CHECKING([for __builtin_ceilf])
469   AC_TRY_COMPILE([#include <math.h>], 
470   [ __builtin_ceilf(0.0);], 
471   use_builtin_ceilf=yes, use_builtin_ceilf=no)
472   AC_MSG_RESULT($use_builtin_ceilf)
473   if test $use_builtin_ceilf = "yes"; then
474     AC_DEFINE(HAVE_BUILTIN_CEILF)
475   fi
476   AC_MSG_CHECKING([for __builtin_ceill])
477   AC_TRY_COMPILE([#include <math.h>], 
478   [ __builtin_ceill(0.0);], 
479   use_builtin_ceill=yes, use_builtin_ceill=no)
480   AC_MSG_RESULT($use_builtin_ceill)
481   if test $use_builtin_ceill = "yes"; then
482     AC_DEFINE(HAVE_BUILTIN_CEILL)
483   fi
484   AC_MSG_CHECKING([for __builtin_cos])
485   AC_TRY_COMPILE([#include <math.h>], 
486   [ __builtin_cos(0.0);], 
487   use_builtin_cos=yes, use_builtin_cos=no)
488   AC_MSG_RESULT($use_builtin_cos)
489   if test $use_builtin_cos = "yes"; then
490     AC_DEFINE(HAVE_BUILTIN_COS)
491   fi
492   AC_MSG_CHECKING([for __builtin_cosf])
493   AC_TRY_COMPILE([#include <math.h>], 
494   [ __builtin_cosf(0.0);], 
495   use_builtin_cosf=yes, use_builtin_cosf=no)
496   AC_MSG_RESULT($use_builtin_cosf)
497   if test $use_builtin_cosf = "yes"; then
498     AC_DEFINE(HAVE_BUILTIN_COSF)
499   fi
500   AC_MSG_CHECKING([for __builtin_cosl])
501   AC_TRY_COMPILE([#include <math.h>], 
502   [ __builtin_cosl(0.0);], 
503   use_builtin_cosl=yes, use_builtin_cosl=no)
504   AC_MSG_RESULT($use_builtin_cosl)
505   if test $use_builtin_cosl = "yes"; then
506     AC_DEFINE(HAVE_BUILTIN_COSL)
507   fi
508   AC_MSG_CHECKING([for __builtin_cosh])
509   AC_TRY_COMPILE([#include <math.h>], 
510   [ __builtin_cosh(0.0);], 
511   use_builtin_cosh=yes, use_builtin_cosh=no)
512   AC_MSG_RESULT($use_builtin_cosh)
513   if test $use_builtin_cosh = "yes"; then
514     AC_DEFINE(HAVE_BUILTIN_COSH)
515   fi
516   AC_MSG_CHECKING([for __builtin_coshf])
517   AC_TRY_COMPILE([#include <math.h>], 
518   [ __builtin_coshf(0.0);], 
519   use_builtin_coshf=yes, use_builtin_coshf=no)
520   AC_MSG_RESULT($use_builtin_coshf)
521   if test $use_builtin_coshf = "yes"; then
522     AC_DEFINE(HAVE_BUILTIN_COSHF)
523   fi
524   AC_MSG_CHECKING([for __builtin_coshl])
525   AC_TRY_COMPILE([#include <math.h>], 
526   [ __builtin_coshl(0.0);], 
527   use_builtin_coshl=yes, use_builtin_coshl=no)
528   AC_MSG_RESULT($use_builtin_coshl)
529   if test $use_builtin_coshl = "yes"; then
530     AC_DEFINE(HAVE_BUILTIN_COSHL)
531   fi
532   AC_MSG_CHECKING([for __builtin_exp])
533   AC_TRY_COMPILE([#include <math.h>], 
534   [ __builtin_exp(0.0);], 
535   use_builtin_exp=yes, use_builtin_exp=no)
536   AC_MSG_RESULT($use_builtin_exp)
537   if test $use_builtin_exp = "yes"; then
538     AC_DEFINE(HAVE_BUILTIN_EXP)
539   fi
540   AC_MSG_CHECKING([for __builtin_expf])
541   AC_TRY_COMPILE([#include <math.h>], 
542   [ __builtin_expf(0.0);], 
543   use_builtin_expf=yes, use_builtin_expf=no)
544   AC_MSG_RESULT($use_builtin_expf)
545   if test $use_builtin_expf = "yes"; then
546     AC_DEFINE(HAVE_BUILTIN_EXPF)
547   fi
548   AC_MSG_CHECKING([for __builtin_expl])
549   AC_TRY_COMPILE([#include <math.h>], 
550   [ __builtin_expl(0.0);], 
551   use_builtin_expl=yes, use_builtin_expl=no)
552   AC_MSG_RESULT($use_builtin_expl)
553   if test $use_builtin_expl = "yes"; then
554     AC_DEFINE(HAVE_BUILTIN_EXPL)
555   fi
556   AC_MSG_CHECKING([for __builtin_fabs])
557   AC_TRY_COMPILE([#include <math.h>], 
558   [ __builtin_fabs(0.0);], 
559   use_builtin_fabs=yes, use_builtin_fabs=no)
560   AC_MSG_RESULT($use_builtin_fabs)
561   if test $use_builtin_fabs = "yes"; then
562     AC_DEFINE(HAVE_BUILTIN_FABS)
563   fi
564   AC_MSG_CHECKING([for __builtin_fabsf])
565   AC_TRY_COMPILE([#include <math.h>], 
566   [ __builtin_fabsf(0.0);], 
567   use_builtin_fabsf=yes, use_builtin_fabsf=no)
568   AC_MSG_RESULT($use_builtin_fabsf)
569   if test $use_builtin_fabsf = "yes"; then
570     AC_DEFINE(HAVE_BUILTIN_FABSF)
571   fi
572   AC_MSG_CHECKING([for __builtin_fabsl])
573   AC_TRY_COMPILE([#include <math.h>], 
574   [ __builtin_fabsl(0.0);], 
575   use_builtin_fabsl=yes, use_builtin_fabsl=no)
576   AC_MSG_RESULT($use_builtin_fabsl)
577   if test $use_builtin_fabsl = "yes"; then
578     AC_DEFINE(HAVE_BUILTIN_FABSL)
579   fi
580   AC_MSG_CHECKING([for __builtin_floor])
581   AC_TRY_COMPILE([#include <math.h>], 
582   [ __builtin_floor(0.0);], 
583   use_builtin_floor=yes, use_builtin_floor=no)
584   AC_MSG_RESULT($use_builtin_floor)
585   if test $use_builtin_floor = "yes"; then
586     AC_DEFINE(HAVE_BUILTIN_FLOOR)
587   fi
588   AC_MSG_CHECKING([for __builtin_floorf])
589   AC_TRY_COMPILE([#include <math.h>], 
590   [ __builtin_floorf(0.0);], 
591   use_builtin_floorf=yes, use_builtin_floorf=no)
592   AC_MSG_RESULT($use_builtin_floorf)
593   if test $use_builtin_floorf = "yes"; then
594     AC_DEFINE(HAVE_BUILTIN_FLOORF)
595   fi
596   AC_MSG_CHECKING([for __builtin_floorl])
597   AC_TRY_COMPILE([#include <math.h>], 
598   [ __builtin_floorl(0.0);], 
599   use_builtin_floorl=yes, use_builtin_floorl=no)
600   AC_MSG_RESULT($use_builtin_floorl)
601   if test $use_builtin_floorl = "yes"; then
602     AC_DEFINE(HAVE_BUILTIN_FLOORL)
603   fi
604   AC_MSG_CHECKING([for __builtin_fmod])
605   AC_TRY_COMPILE([#include <math.h>], 
606   [ __builtin_fmod(0.0, 0.0);], 
607   use_builtin_fmod=yes, use_builtin_fmod=no)
608   AC_MSG_RESULT($use_builtin_fmod)
609   if test $use_builtin_fmod = "yes"; then
610     AC_DEFINE(HAVE_BUILTIN_FMOD)
611   fi
612   AC_MSG_CHECKING([for __builtin_fmodf])
613   AC_TRY_COMPILE([#include <math.h>], 
614   [ __builtin_fmodf(0.0, 0.0);], 
615   use_builtin_fmodf=yes, use_builtin_fmodf=no)
616   AC_MSG_RESULT($use_builtin_fmodf)
617   if test $use_builtin_fmodf = "yes"; then
618     AC_DEFINE(HAVE_BUILTIN_FMODF)
619   fi
620   AC_MSG_CHECKING([for __builtin_fmodl])
621   AC_TRY_COMPILE([#include <math.h>], 
622   [ __builtin_fmodl(0.0, 0.0);], 
623   use_builtin_fmodl=yes, use_builtin_fmodl=no)
624   AC_MSG_RESULT($use_builtin_fmodl)
625   if test $use_builtin_fmodl = "yes"; then
626     AC_DEFINE(HAVE_BUILTIN_FMODL)
627   fi
628   AC_MSG_CHECKING([for __builtin_frexp])
629   AC_TRY_COMPILE([#include <math.h>], 
630   [ __builtin_frexp(0.0, 0);], 
631   use_builtin_frexp=yes, use_builtin_frexp=no)
632   AC_MSG_RESULT($use_builtin_frexp)
633   if test $use_builtin_frexp = "yes"; then
634     AC_DEFINE(HAVE_BUILTIN_FREXP)
635   fi
636   AC_MSG_CHECKING([for __builtin_frexpf])
637   AC_TRY_COMPILE([#include <math.h>], 
638   [ __builtin_frexpf(0.0, 0);], 
639   use_builtin_frexpf=yes, use_builtin_frexpf=no)
640   AC_MSG_RESULT($use_builtin_frexpf)
641   if test $use_builtin_frexpf = "yes"; then
642     AC_DEFINE(HAVE_BUILTIN_FREXPF)
643   fi
644   AC_MSG_CHECKING([for __builtin_frexpl])
645   AC_TRY_COMPILE([#include <math.h>], 
646   [ __builtin_frexpl(0.0, 0);], 
647   use_builtin_frexpl=yes, use_builtin_frexpl=no)
648   AC_MSG_RESULT($use_builtin_frexpl)
649   if test $use_builtin_frexpl = "yes"; then
650     AC_DEFINE(HAVE_BUILTIN_FREXPL)
651   fi
652   AC_MSG_CHECKING([for __builtin_ldexp])
653   AC_TRY_COMPILE([#include <math.h>], 
654   [ __builtin_ldexp(0.0, 0);], 
655   use_builtin_ldexp=yes, use_builtin_ldexp=no)
656   AC_MSG_RESULT($use_builtin_ldexp)
657   if test $use_builtin_ldexp = "yes"; then
658     AC_DEFINE(HAVE_BUILTIN_LDEXP)
659   fi
660   AC_MSG_CHECKING([for __builtin_ldexpf])
661   AC_TRY_COMPILE([#include <math.h>], 
662   [ __builtin_ldexpf(0.0, 0);], 
663   use_builtin_ldexpf=yes, use_builtin_ldexpf=no)
664   AC_MSG_RESULT($use_builtin_ldexpf)
665   if test $use_builtin_ldexpf = "yes"; then
666     AC_DEFINE(HAVE_BUILTIN_LDEXPF)
667   fi
668   AC_MSG_CHECKING([for __builtin_ldexpl])
669   AC_TRY_COMPILE([#include <math.h>], 
670   [ __builtin_ldexpl(0.0, 0);], 
671   use_builtin_ldexpl=yes, use_builtin_ldexpl=no)
672   AC_MSG_RESULT($use_builtin_ldexpl)
673   if test $use_builtin_ldexpl = "yes"; then
674     AC_DEFINE(HAVE_BUILTIN_LDEXPL)
675   fi
676   AC_MSG_CHECKING([for __builtin_log])
677   AC_TRY_COMPILE([#include <math.h>], 
678   [ __builtin_log(0.0);], 
679   use_builtin_log=yes, use_builtin_log=no)
680   AC_MSG_RESULT($use_builtin_log)
681   if test $use_builtin_log = "yes"; then
682     AC_DEFINE(HAVE_BUILTIN_LOG)
683   fi
684   AC_MSG_CHECKING([for __builtin_logf])
685   AC_TRY_COMPILE([#include <math.h>], 
686   [ __builtin_logf(0.0);], 
687   use_builtin_logf=yes, use_builtin_logf=no)
688   AC_MSG_RESULT($use_builtin_logf)
689   if test $use_builtin_logf = "yes"; then
690     AC_DEFINE(HAVE_BUILTIN_LOGF)
691   fi
692   AC_MSG_CHECKING([for __builtin_logl])
693   AC_TRY_COMPILE([#include <math.h>], 
694   [ __builtin_logl(0.0);], 
695   use_builtin_logl=yes, use_builtin_logl=no)
696   AC_MSG_RESULT($use_builtin_logl)
697   if test $use_builtin_logl = "yes"; then
698     AC_DEFINE(HAVE_BUILTIN_LOGL)
699   fi
700   AC_MSG_CHECKING([for __builtin_log10])
701   AC_TRY_COMPILE([#include <math.h>], 
702   [ __builtin_log10(0.0);], 
703   use_builtin_log10=yes, use_builtin_log10=no)
704   AC_MSG_RESULT($use_builtin_log10)
705   if test $use_builtin_log10 = "yes"; then
706     AC_DEFINE(HAVE_BUILTIN_LOG10)
707   fi
708   AC_MSG_CHECKING([for __builtin_log10f])
709   AC_TRY_COMPILE([#include <math.h>], 
710   [ __builtin_log10f(0.0);], 
711   use_builtin_log10f=yes, use_builtin_log10f=no)
712   AC_MSG_RESULT($use_builtin_log10f)
713   if test $use_builtin_log10f = "yes"; then
714     AC_DEFINE(HAVE_BUILTIN_LOG10F)
715   fi
716   AC_MSG_CHECKING([for __builtin_log10l])
717   AC_TRY_COMPILE([#include <math.h>], 
718   [ __builtin_log10l(0.0);], 
719   use_builtin_log10l=yes, use_builtin_log10l=no)
720   AC_MSG_RESULT($use_builtin_log10l)
721   if test $use_builtin_log10l = "yes"; then
722     AC_DEFINE(HAVE_BUILTIN_LOG10L)
723   fi
724   AC_MSG_CHECKING([for __builtin_modf])
725   AC_TRY_COMPILE([#include <math.h>], 
726   [ __builtin_modf(0.0, 0);], 
727   use_builtin_modf=yes, use_builtin_modf=no)
728   AC_MSG_RESULT($use_builtin_modf)
729   if test $use_builtin_modf = "yes"; then
730     AC_DEFINE(HAVE_BUILTIN_MODF)
731   fi
732   AC_MSG_CHECKING([for __builtin_modff])
733   AC_TRY_COMPILE([#include <math.h>], 
734   [ __builtin_modff(0.0, 0);], 
735   use_builtin_modff=yes, use_builtin_modff=no)
736   AC_MSG_RESULT($use_builtin_modff)
737   if test $use_builtin_modff = "yes"; then
738     AC_DEFINE(HAVE_BUILTIN_MODFF)
739   fi
740   AC_MSG_CHECKING([for __builtin_modfl])
741   AC_TRY_COMPILE([#include <math.h>], 
742   [ __builtin_modfl(0.0, 0);], 
743   use_builtin_modfl=yes, use_builtin_modfl=no)
744   AC_MSG_RESULT($use_builtin_modfl)
745   if test $use_builtin_modfl = "yes"; then
746     AC_DEFINE(HAVE_BUILTIN_MODFL)
747   fi
748   AC_MSG_CHECKING([for __builtin_pow])
749   AC_TRY_COMPILE([#include <math.h>], 
750   [ __builtin_pow(0.0, 0.0);], 
751   use_builtin_pow=yes, use_builtin_pow=no)
752   AC_MSG_RESULT($use_builtin_pow)
753   if test $use_builtin_pow = "yes"; then
754     AC_DEFINE(HAVE_BUILTIN_POW)
755   fi
756   AC_MSG_CHECKING([for __builtin_powf])
757   AC_TRY_COMPILE([#include <math.h>], 
758   [ __builtin_powf(0.0, 0.0);], 
759   use_builtin_powf=yes, use_builtin_powf=no)
760   AC_MSG_RESULT($use_builtin_powf)
761   if test $use_builtin_powf = "yes"; then
762     AC_DEFINE(HAVE_BUILTIN_POWF)
763   fi
764   AC_MSG_CHECKING([for __builtin_powl])
765   AC_TRY_COMPILE([#include <math.h>], 
766   [ __builtin_powl(0.0, 0.0);], 
767   use_builtin_powl=yes, use_builtin_powl=no)
768   AC_MSG_RESULT($use_builtin_powl)
769   if test $use_builtin_powl = "yes"; then
770     AC_DEFINE(HAVE_BUILTIN_POWL)
771   fi
772   AC_MSG_CHECKING([for __builtin_sin])
773   AC_TRY_COMPILE([#include <math.h>], 
774   [ __builtin_sin(0.0);], 
775   use_builtin_sin=yes, use_builtin_sin=no)
776   AC_MSG_RESULT($use_builtin_sin)
777   if test $use_builtin_sin = "yes"; then
778     AC_DEFINE(HAVE_BUILTIN_SIN)
779   fi
780   AC_MSG_CHECKING([for __builtin_sinf])
781   AC_TRY_COMPILE([#include <math.h>], 
782   [ __builtin_sinf(0.0);], 
783   use_builtin_sinf=yes, use_builtin_sinf=no)
784   AC_MSG_RESULT($use_builtin_sinf)
785   if test $use_builtin_sinf = "yes"; then
786     AC_DEFINE(HAVE_BUILTIN_SINF)
787   fi
788   AC_MSG_CHECKING([for __builtin_sinl])
789   AC_TRY_COMPILE([#include <math.h>], 
790   [ __builtin_sinl(0.0);], 
791   use_builtin_sinl=yes, use_builtin_sinl=no)
792   AC_MSG_RESULT($use_builtin_sinl)
793   if test $use_builtin_sinl = "yes"; then
794     AC_DEFINE(HAVE_BUILTIN_SINL)
795   fi
796   AC_MSG_CHECKING([for __builtin_sinh])
797   AC_TRY_COMPILE([#include <math.h>], 
798   [ __builtin_sinh(0.0);], 
799   use_builtin_sinh=yes, use_builtin_sinh=no)
800   AC_MSG_RESULT($use_builtin_sinh)
801   if test $use_builtin_sinh = "yes"; then
802     AC_DEFINE(HAVE_BUILTIN_SINH)
803   fi
804   AC_MSG_CHECKING([for __builtin_sinhf])
805   AC_TRY_COMPILE([#include <math.h>], 
806   [ __builtin_sinhf(0.0);], 
807   use_builtin_sinhf=yes, use_builtin_sinhf=no)
808   AC_MSG_RESULT($use_builtin_sinhf)
809   if test $use_builtin_sinhf = "yes"; then
810     AC_DEFINE(HAVE_BUILTIN_SINHF)
811   fi
812   AC_MSG_CHECKING([for __builtin_sinhl])
813   AC_TRY_COMPILE([#include <math.h>], 
814   [ __builtin_sinhl(0.0);], 
815   use_builtin_sinhl=yes, use_builtin_sinhl=no)
816   AC_MSG_RESULT($use_builtin_sinhl)
817   if test $use_builtin_sinhl = "yes"; then
818     AC_DEFINE(HAVE_BUILTIN_SINHL)
819   fi
820   AC_MSG_CHECKING([for __builtin_sqrt])
821   AC_TRY_COMPILE([#include <math.h>], 
822   [ __builtin_fsqrt(0.0);], 
823   use_builtin_sqrt=yes, use_builtin_sqrt=no)
824   AC_MSG_RESULT($use_builtin_sqrt)
825   if test $use_builtin_sqrt = "yes"; then
826     AC_DEFINE(HAVE_BUILTIN_SQRT)
827   fi
828   AC_MSG_CHECKING([for __builtin_sqrtf])
829   AC_TRY_COMPILE([#include <math.h>], 
830   [ __builtin_sqrtf(0.0);], 
831   use_builtin_sqrtf=yes, use_builtin_sqrtf=no)
832   AC_MSG_RESULT($use_builtin_sqrtf)
833   if test $use_builtin_sqrtf = "yes"; then
834     AC_DEFINE(HAVE_BUILTIN_SQRTF)
835   fi
836   AC_MSG_CHECKING([for __builtin_sqrtl])
837   AC_TRY_COMPILE([#include <math.h>], 
838   [ __builtin_sqrtl(0.0);], 
839   use_builtin_sqrtl=yes, use_builtin_sqrtl=no)
840   AC_MSG_RESULT($use_builtin_sqrtl)
841   if test $use_builtin_sqrtl = "yes"; then
842     AC_DEFINE(HAVE_BUILTIN_SQRTL)
843   fi
844   AC_MSG_CHECKING([for __builtin_tan])
845   AC_TRY_COMPILE([#include <math.h>], 
846   [ __builtin_tan(0.0);], 
847   use_builtin_tan=yes, use_builtin_tan=no)
848   AC_MSG_RESULT($use_builtin_tan)
849   if test $use_builtin_tan = "yes"; then
850     AC_DEFINE(HAVE_BUILTIN_TAN)
851   fi
852   AC_MSG_CHECKING([for __builtin_tanf])
853   AC_TRY_COMPILE([#include <math.h>], 
854   [ __builtin_tanf(0.0);], 
855   use_builtin_tanf=yes, use_builtin_tanf=no)
856   AC_MSG_RESULT($use_builtin_tanf)
857   if test $use_builtin_tanf = "yes"; then
858     AC_DEFINE(HAVE_BUILTIN_TANF)
859   fi
860   AC_MSG_CHECKING([for __builtin_tanl])
861   AC_TRY_COMPILE([#include <math.h>], 
862   [ __builtin_tanl(0.0);], 
863   use_builtin_tanl=yes, use_builtin_tanl=no)
864   AC_MSG_RESULT($use_builtin_tanl)
865   if test $use_builtin_tanl = "yes"; then
866     AC_DEFINE(HAVE_BUILTIN_TANL)
867   fi
868   AC_MSG_CHECKING([for __builtin_tanh])
869   AC_TRY_COMPILE([#include <math.h>], 
870   [ __builtin_tanh(0.0);], 
871   use_builtin_tanh=yes, use_builtin_tanh=no)
872   AC_MSG_RESULT($use_builtin_tanh)
873   if test $use_builtin_tanh = "yes"; then
874     AC_DEFINE(HAVE_BUILTIN_TANH)
875   fi
876   AC_MSG_CHECKING([for __builtin_tanhf])
877   AC_TRY_COMPILE([#include <math.h>], 
878   [ __builtin_tanhf(0.0);], 
879   use_builtin_tanhf=yes, use_builtin_tanhf=no)
880   AC_MSG_RESULT($use_builtin_tanhf)
881   if test $use_builtin_tanhf = "yes"; then
882     AC_DEFINE(HAVE_BUILTIN_TANHF)
883   fi
884   AC_MSG_CHECKING([for __builtin_tanhl])
885   AC_TRY_COMPILE([#include <math.h>], 
886   [ __builtin_tanhl(0.0);], 
887   use_builtin_tanhl=yes, use_builtin_tanhl=no)
888   AC_MSG_RESULT($use_builtin_tanhl)
889   if test $use_builtin_tanhl = "yes"; then
890     AC_DEFINE(HAVE_BUILTIN_TANHL)
891   fi
892   AC_LANG_RESTORE
897 dnl Check to see what the underlying c library or math library is like.
899 dnl Define HAVE_CARGF etc if "cargf" is found.
901 dnl GLIBCPP_CHECK_MATH_SUPPORT
902 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
903    dnl Work around bug on powerpc compiler
904   ac_test_CFLAGS="${CFLAGS+set}"
905   ac_save_CFLAGS="$CFLAGS"
906   CFLAGS='-Werror-implicit-function-declaration'
908   dnl Check libm
909   AC_CHECK_LIB(m, sin, libm="-lm")
910   save_LIBS="$LIBS"
911   LIBS="$LIBS $libm"
913   dnl Check to see if basic C math functions have float, long double versions.
914   AC_REPLACE_MATHFUNCS(cosf fabsf sinf sqrtf)
915   AC_CHECK_FUNCS(isnan isnanf isnanl isinf isinff isinfl copysign copysignl \
916   acosf acosl asinf asinl atanf atanl atan2f atan2l ceilf ceill cosl \
917   coshf coshl expf expl fabsl floorf floorl fmodf fmodl frexpf frexpl ldexpf \
918   ldexpl logf logl log10f log10l modff modfl powf powl sinl sinhf \
919   sinhl sqrtl tanf tanl tanhf tanhl strtof strtold sincos sincosf \
920   sincosl finite finitef finitel fqfinite fpclass qfpclass)
922 #Some runtimes have these functions with a preceding underscore. Please
923 # keep this sync'd with the one above. And if you add any new symbol,
924 # please add the corresponding block in the @BOTTOM@ section of
925 # acconfig.h.
927   AC_CHECK_FUNCS(_isnan _isnanf _isnanl _isinf _isinff _isinfl _copysign \
928   _copysignl _acosf _acosl _asinf _asinl _atanf _atanl _atan2f _atan2l \
929   _ceilf _ceill _cosf _cosl _coshf _coshl _expf _expl _fabsf _fabsl \
930   _floorf _floorl _fmodf _fmodl _frexpf _frexpl _ldexpf _ldexpl _logf _logl \
931   _log10f _log10l _modff _modfl _powf _powl _sinf _sinl _sinhf _sinhl \
932   _sqrtf _sqrtl _tanf _tanl _tanhf _tanhl _strtof _strtold _sincos _sincosf \
933   _sincosl _finite _finitef _finitel _fqfinite _fpclass _qfpclass)
935   LIBS="$save_LIBS"
936 #  CFLAGS="$ac_save_CFLAGS"
941 dnl Check to see if there is native support for complex 
943 dnl Don't compile bits in math/* if native support exits.
945 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "cargf" is found.
947 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
948 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
949   dnl Check for complex versions of math functions of platform.
950   AC_CHECK_HEADERS([complex.h])
951   AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf c_log c_logf \
952   clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt csqrtf \
953   ctan ctanf ctanh ctanhf \
954   carg cargf nan hypot hypotf atan2f expf copysignf)
956   dnl We compile the long double complex functions only if the function 
957   dnl provides the non-complex long double functions.
958   USE_LONG_DOUBLE=no
959   AC_CHECK_FUNC(copysignl,
960   USE_LONG_DOUBLE=yes
961   AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl cpowl csinhl csinl \
962   csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l))
963   AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
967 dnl Check to see what architecture we are compiling for. If it's
968 dnl supported, use special hand-crafted routines to provide thread
969 dnl primitives. Also, if architecture-specific flags are required for 
970 dnl compilation, add them here.
971 dnl 
972 dnl Depending on what is found, select configure/cpu/*/bits/atomicity.h 
973 dnl If not found, select configure/cpu/generic/bits/atomicity.h
975 dnl GLIBCPP_CHECK_CPU
976 AC_DEFUN(GLIBCPP_CHECK_CPU, [
977     AC_MSG_CHECKING([for cpu primitives directory])
978     CPU_FLAGS=                  
979     case "$target_cpu" in
980       alpha*)
981         cpu_include_dir="config/cpu/alpha"
982         ;;
983       arm*)
984         cpu_include_dir="config/cpu/arm"
985         ;;
986       i386)
987         cpu_include_dir="config/cpu/i386"
988         ;;
989       i486 | i586 | i686 | i786)
990         cpu_include_dir="config/cpu/i486"
991         ;;
992       powerpc | rs6000)
993         cpu_include_dir="config/cpu/powerpc"
994         CPU_FLAGS='-mcpu=powerpc'
995         ;;
996       sparc64 | ultrasparc)
997         cpu_include_dir="config/cpu/sparc/sparc64"
998         ;;
999       sparc*)
1000         cpu_include_dir="config/cpu/sparc/sparc32"
1001         ;;
1002       *)
1003         cpu_include_dir="config/cpu/generic"
1004         ;;
1005     esac
1006     AC_MSG_RESULT($cpu_include_dir)
1007     AC_SUBST(cpu_include_dir)
1008     AC_SUBST(CPU_FLAGS)
1013 dnl Check to see what the underlying c library's interface to ctype looks
1014 dnl like. Bits of locale rely on things like isspace, toupper, etc. This
1015 dnl stuff makes sure the right bits from the clibrary get called.
1016 dnl 
1017 dnl Depending on what is found, select various configure/*/bits/ctype_base.h 
1018 dnl Depending on what is found, select various configure/*/ctype.cc
1020 dnl GLIBCPP_CHECK_CTYPE
1021 AC_DEFUN(GLIBCPP_CHECK_CTYPE, [
1022   AC_CHECK_HEADER(ctype.h, [
1023     
1024     dnl If doesn't match any specified, go with defaults.
1025     ctype_default=yes
1027     dnl Test for <ctype> functionality -- gnu-linux
1028     AC_MSG_CHECKING([<ctype> for gnu-linux ])
1029     AC_TRY_COMPILE([#include <ctype.h>],
1030     [int
1031     foo (int a)
1032     { return _ISspace + _ISprint + _IScntrl + _ISupper + _ISlower + _ISalpha \
1033         + _ISdigit + _ISpunct + _ISxdigit + _ISalnum + _ISgraph \
1034         + __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];}], \
1035     ctype_linux=yes, ctype_linux=no)
1036     AC_MSG_RESULT($ctype_linux)
1037     if test $ctype_linux = "yes"; then
1038       ctype_include_dir="config/gnu-linux"
1039       ctype_default=no
1040     fi
1042     dnl Test for <ctype> functionality -- FreeBSD 4.0
1043     if test $ctype_default = "yes"; then
1044     AC_MSG_CHECKING([<ctype> for freebsd 4.0 ])
1045     AC_TRY_COMPILE([#include <ctype.h>],
1046     [int
1047     foo (int a)
1048     { return _CTYPE_S + _CTYPE_R + _CTYPE_C + _CTYPE_U + _CTYPE_L + _CTYPE_A \
1049         + _CTYPE_D + _CTYPE_P + _CTYPE_X + _CTYPE_G ;}], \
1050     ctype_bsd=yes, ctype_bsd=no)
1051     AC_MSG_RESULT($ctype_bsd)
1052     if test $ctype_bsd = "yes"; then
1053       ctype_include_dir="config/bsd"
1054       ctype_default=no
1055     fi
1056     fi
1058     dnl Test for <ctype> functionality -- FreeBSD 3.4
1059     if test $ctype_default = "yes"; then
1060     AC_MSG_CHECKING([<ctype> for freebsd 3.4 ])
1061     AC_TRY_COMPILE([#include <ctype.h>],
1062     [int
1063     foo (int a)
1064     { return _S + _R + _C + _U + _L + _A \
1065       + _D + _P + _X + _G + __istype (a, 0);}], \
1066     ctype_freebsd34=yes, ctype_freebsd34=no)
1067     AC_MSG_RESULT($ctype_freebsd34)
1068     if test $ctype_freebsd34 = "yes"; then
1069       ctype_include_dir="config/bsd"
1070       ctype_default=no
1071     fi
1072     fi
1074     dnl Test for <ctype> functionality -- solaris 2.6 and 2.7
1075     if test $ctype_default = "yes"; then
1076     AC_MSG_CHECKING([<ctype> for solaris 2.[6,7,8] ])
1077     AC_TRY_COMPILE([#include <ctype.h>],
1078     [int
1079     foo (int a)
1080     { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
1081         + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
1082         + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}], \
1083     ctype_solaris=yes, ctype_solaris=no)
1084     AC_MSG_RESULT($ctype_solaris)
1086     if test $ctype_solaris = "yes"; then
1087       AC_MSG_CHECKING([  for version])
1088       AC_LANG_CPLUSPLUS 
1089       AC_TRY_COMPILE([#include <ctype.h>],
1090       [typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;],\
1091       ctype_solaris26=yes, ctype_solaris26=no)
1092       AC_LANG_C
1093       if test $ctype_solaris26 = "yes"; then
1094         ctype_include_dir="config/solaris/solaris2.6"
1095         AC_MSG_RESULT("solaris2.6")
1096         ctype_default=no
1097       else
1098         ctype_include_dir="config/solaris/solaris2.7"
1099         AC_MSG_RESULT("solaris2.[7,8]")
1100         ctype_default=no
1101       fi
1102     fi
1103     fi  
1105     dnl Test for <ctype> functionality -- solaris 2.5.1
1106     if test $ctype_default = "yes"; then
1107     AC_MSG_CHECKING([<ctype> for solaris 2.5.1 ])
1108     AC_TRY_COMPILE([#include <ctype.h>],
1109     [int
1110     foo (int a)
1111     { return _U + _L + _N + _S + _P + _C + _X + _B \
1112         + __ctype[a];}], \
1113     ctype_solaris25=yes, ctype_solaris25=no)
1114     AC_MSG_RESULT($ctype_solaris25)
1115     if test $ctype_solaris25 = "yes"; then
1116       ctype_include_dir="config/solaris/solaris2.5"
1117       ctype_default=no
1118     fi
1119     fi
1121     dnl Test for <ctype> functionality -- aix
1122     if test $ctype_default = "yes"; then
1123     AC_MSG_CHECKING([<ctype> for aix ])
1124     AC_TRY_COMPILE([#include <ctype.h>],
1125     [int
1126     foo (int a)
1127     { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
1128         + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
1129         + _VALC('a') + _IS('c', 0);}], \
1130     ctype_aix=yes, ctype_aix=no)
1131     AC_MSG_RESULT($ctype_aix)
1132     if test $ctype_aix = "yes"; then
1133       ctype_include_dir="config/aix"
1134       ctype_default=no
1135     fi
1136     fi
1138     dnl Test for <ctype> functionality -- newlib
1139     if test $ctype_default = "yes"; then
1140     AC_MSG_CHECKING([<ctype> for newlib ])
1141     AC_TRY_COMPILE([#include <ctype.h>],
1142     [int
1143     foo (int a)
1144     { return _U + _L + _N + _S + _P + _C + _X + _B \
1145         + _ctype_[a];}], \
1146     ctype_newlib=yes, ctype_newlib=no)
1147     AC_MSG_RESULT($ctype_newlib)
1148     if test $ctype_newlib = "yes"; then
1149       ctype_include_dir="config/newlib"
1150       ctype_default=no
1151     fi
1152     fi
1154     if test $ctype_default = "yes"; then
1155       ctype_include_dir="config/generic"
1156       AC_MSG_WARN("Using default ctype headers.")
1157     fi
1158     AC_SUBST(ctype_include_dir)
1159   ])
1164 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
1166 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found 
1167 dnl Define _GLIBCPP_NEED_MBSTATE_T if mbstate_t is not in wchar.h
1169 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
1170 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
1172   dnl Sanity check for existence of ISO C9X headers for extended encoding.
1173   AC_CHECK_HEADER(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
1174   AC_CHECK_HEADER(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
1175         
1176   dnl Only continue checking if the ISO C9X headers exist.
1177   if test x"$ac_has_wchar_h" = xyes && test x"$ac_has_wctype_h" = xyes; then
1179     dnl Test wchar.h for mbstate_t, which is needed for char_traits and others.
1180     AC_MSG_CHECKING([for mbstate_t])
1181     AC_TRY_COMPILE([#include <wchar.h>],
1182     [mbstate_t teststate;], 
1183     use_native_mbstatet=yes, use_native_mbstatet=no)
1184     AC_MSG_RESULT($use_native_mbstatet)
1185     if test x"$use_native_mbstatet" = xno; then
1186       AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
1187     fi
1188   
1189     dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
1190     dnl numeric_limits can instantiate type_traits<wchar_t>
1191     AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
1192     AC_TRY_COMPILE([#include <wchar.h>],
1193     [int i = WCHAR_MIN; int j = WCHAR_MAX;], 
1194     has_wchar_minmax=yes, has_wchar_minmax=no)
1195     AC_MSG_RESULT($has_wchar_minmax)
1196   
1197     dnl Test wchar.h for WEOF, which is what we use to determine whether
1198     dnl to specialize for char_traits<wchar_t> or not.
1199     AC_MSG_CHECKING([for WEOF])
1200     AC_TRY_COMPILE([
1201       #include <wchar.h>
1202       #include <stddef.h>],
1203     [wint_t i = WEOF;],
1204     has_weof=yes, has_weof=no)
1205     AC_MSG_RESULT($has_weof)
1207     dnl Tests for wide character functions used in char_traits<wchar_t>.
1208     AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset, ac_wfuncs=yes, ac_wfuncs=no)
1210     AC_MSG_CHECKING([for ISO C9X wchar_t support])
1211     if test x"$has_weof" = xyes && test x"$has_wchar_minmax" = xyes && test x"$ac_wfuncs" = xyes; then
1212       ac_isoC9X_wchar_t=yes
1213     else
1214       ac_isoC9X_wchar_t=no
1215     fi
1216     AC_MSG_RESULT($ac_isoC9X_wchar_t)
1218     dnl Use iconv for wchar_t to char conversions. As such, check for 
1219     dnl X/Open Portability Guide, version 2 features (XPG2).
1220     AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
1221     AC_CHECK_FUNCS(iconv_open iconv_close iconv, ac_XPG2funcs=yes, ac_XPG2funcs=no)
1223     AC_MSG_CHECKING([for XPG2 wchar_t support])
1224     if test x"$ac_has_iconv_h" = xyes && test x"$ac_XPG2funcs" = xyes; then
1225       ac_XPG2_wchar_t=yes
1226     else
1227       ac_XPG2_wchar_t=no
1228     fi
1229     AC_MSG_RESULT($ac_XPG2_wchar_t)
1231     dnl At the moment, only enable wchar_t specializations if all the
1232     dnl above support is present.
1233     AC_MSG_CHECKING([for enabled wchar_t specializations])
1234     if test x"$ac_isoC9X_wchar_t" = xyes && test x"$ac_XPG2_wchar_t" = xyes; then
1235       libinst_wstring_la="libinst-wstring.la"
1236       AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
1237       AC_MSG_RESULT("yes")
1238     else
1239       libinst_wstring_la=""
1240       AC_MSG_RESULT("no")
1241     fi
1242     AC_SUBST(libinst_wstring_la)
1244   else
1245     AC_MSG_WARN([<wchar.h> not found])
1246     AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
1247   fi
1252 dnl Check to see if this version of GNU C++ is afflicted by bugs in
1253 dnl __complex__ float support.
1255 dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
1257 dnl Check to see if this version of GNU C++ is afflicted by bugs in 
1258 dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
1259 dnl gcc-2.95.x when using the library, unless we define the default copy
1260 dnl ctor in the specializations of complex<>. 
1261 dnl 
1262 dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
1263 dnl GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT
1264 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT, [
1265   AC_REQUIRE([AC_PROG_CXX])
1267   AC_MSG_CHECKING([for GNU C++ __complex__ support])
1268   AC_CACHE_VAL(glibcpp_cv_complex, [
1269     AC_LANG_SAVE
1270     AC_LANG_CPLUSPLUS
1271     AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
1272                     dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
1273                     [ dcomplex x; f(x); ],
1274       glibcpp_cv_complex=ok,
1275       glibcpp_cv_complex=buggy
1276     )
1277     AC_LANG_RESTORE
1278   ])
1279   AC_MSG_RESULT($glibcpp_cv_complex)
1280   if test $glibcpp_cv_complex = buggy; then
1281     AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
1282   fi
1284   AC_MSG_CHECKING([for GNU C++ __complex__ float support])
1285   AC_CACHE_VAL(glibcpp_cv_float_complex, [
1286     AC_LANG_SAVE
1287     AC_LANG_CPLUSPLUS
1288     rm -f conftest.h
1289     cat > conftest.h <<EOB
1290       //
1291       // Check for buggy __complex__ that causes ICE in most versions of egcs
1292       // and gcc-2.95.x on certain platforms (eg., x86-win32).
1293       //
1294       // See http://egcs.cygnus.com/ml/gcc-bugs/1999-07/msg00845.html for
1295       // more info on the bug itself.
1296       //
1297       struct
1298       float_complex
1299       {
1300        __complex__ float m_value;
1301        float_complex (float = 0.0f, float = 0.0f);
1302        float_complex (__complex__ float val) : m_value (val) {}
1303        float_complex foo (const float_complex &val)
1304          { return float_complex (~val.m_value); }
1305       };
1307     AC_TRY_COMPILE([#include "conftest.h"], ,
1308       glibcpp_cv_float_complex=ok,
1309       glibcpp_cv_float_complex=buggy
1310     )
1311     AC_LANG_RESTORE
1312   ])
1313   AC_MSG_RESULT($glibcpp_cv_float_complex)
1314   if test $glibcpp_cv_float_complex = buggy; then
1315     AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
1316   fi
1321 dnl Check for special debugging mode; not for production use.
1323 dnl GLIBCPP_ENABLE_DEBUG
1324 dnl --enable-debug sets '-ggdb -O0'.
1325 dnl --disable-debug sets '-g' and whatever optimization options the
1326 dnl     compiler can handle.
1327 dnl  +  Perhaps --enable-maintainer-mode should automatically turn this on?
1328 dnl  +  Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
1329 dnl  +  Usage:  GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
1330 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
1331 dnl       defaults to `no'.
1332 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
1333 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
1334 AC_ARG_ENABLE(debug,
1335 changequote(<<, >>)dnl
1336 <<  --enable-debug          extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
1337 changequote([, ])dnl
1338 [case "$enableval" in
1339  yes) enable_debug=yes ;;
1340  no)  enable_debug=no ;;
1341  *)   AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
1342  esac],
1343 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
1344 dnl Option parsed, now set things appropriately
1345 case "$enable_debug" in
1346     yes) 
1347         DEBUG_FLAGS='-O0 -ggdb'                 
1348         ;;
1349     no)   
1350         DEBUG_FLAGS='-g'
1351         ;;
1352 esac
1353 AC_SUBST(DEBUG_FLAGS)
1358 dnl Check for "unusual" flags to pass to the compiler while building.
1360 dnl GLIBCPP_ENABLE_CXX_FLAGS
1361 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1362 dnl     experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
1363 dnl     Somehow this same set of flags must be passed when [re]building
1364 dnl     libgcc.
1365 dnl --disable-cxx-flags passes nothing.
1366 dnl  +  See http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00131.html
1367 dnl         http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00284.html
1368 dnl         http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00035.html
1369 dnl  +  Usage:  GLIBCPP_ENABLE_CXX_FLAGS(default flags)
1370 dnl       If "default flags" is an empty string (or "none"), the effect is
1371 dnl       the same as --disable or --enable=no.
1372 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
1373 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
1374 AC_ARG_ENABLE(cxx-flags,
1375 changequote(<<, >>)dnl
1376 <<  --enable-cxx-flags=FLAGS      pass compiler FLAGS when building library;
1377                                 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
1378 changequote([, ])dnl
1379 [case "x$enableval" in
1380  xyes)   AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1381  xno|x)  enable_cxx_flags='' ;;
1382  *)      enable_cxx_flags="$enableval" ;;
1383  esac],
1384 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')dnl
1385 dnl Thinko on my part during design.  This kludge is the workaround.
1386 if test "$enable_cxx_flags" = "none"; then enable_cxx_flags=''; fi
1387 dnl Run through flags (either default or command-line) and set anything
1388 dnl extra (e.g., #defines) that must accompany particular g++ options.
1389 if test -n "$enable_cxx_flags"; then
1390     for f in $enable_cxx_flags; do
1391         case "$f" in
1392             -fhonor-std)  ;;
1393             -*)  ;;
1394             *)   # and we're trying to pass /what/ exactly?
1395                  AC_MSG_ERROR([compiler flags start with a -]) ;;
1396         esac
1397     done
1399 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1400 AC_SUBST(EXTRA_CXX_FLAGS)
1405 dnl Check for instructions to automatically rebuild libgcc.a.  Requires,
1406 dnl of course, the location of the gcc objdir.  Note that if --disable-
1407 dnl namespaces is in effect, rebuilding libgcc.a is an expensive no-op.
1409 dnl GLIBCPP_ENABLE_RELIBGCC
1410 dnl --enable-libgcc-rebuild=/absolute/path/to/gcc/objdir sets GCC_OBJDIR
1411 dnl     (presumably in the top-level Makefile) to /absol.../objdir
1412 dnl --disable-libgcc-rebuild will not touch libgcc.a at all (maybe print
1413 dnl     a warning if this is given along with --enable-namespaces), by
1414 dnl     setting GCC_OBJDIR to `no'.
1415 dnl  +  Doing this by default is going to be interesting.  What default
1416 dnl     "on" value can there be?
1417 dnl  +  Usage:  GLIBCPP_ENABLE_RELIBGCC[(DEFAULT)]
1418 dnl       The default path should be ../.. if bundled with GCC source.
1419 dnl       If ommitted, it defaults to `no'.
1421 AC_DEFUN(GLIBCPP_ENABLE_RELIBGCC, [dnl
1422 define([GLIBCPP_ENABLE_RELIBGCC_DEFAULT], ifelse($1,, no, $1))dnl
1423 AC_ARG_ENABLE(libgcc-rebuild,
1424 changequote(<<, >>)dnl
1425 <<  --enable-libgcc-rebuild=DIR     also rebuild libgcc.a; DIR is
1426                                   the GCC objdir; see install.html>>,
1427 changequote([, ])dnl
1428 [case "$enableval" in
1429  yes) AC_MSG_ERROR([--enable-libgcc-rebuild needs a pathname]) ;;
1430  no)  enable_libgcc_rebuild=no ;;
1431  *)   if test -d "$enableval" && test -d "${enableval}/gcc" && \
1432          test -d "${enableval}/libiberty"
1433       then
1434          enable_libgcc_rebuild="$enableval"
1435       else
1436          AC_MSG_ERROR(["$enableval" does not appear to be the GCC objdir])
1437       fi
1438       ;;
1439  esac],
1440 enable_libgcc_rebuild=GLIBCPP_ENABLE_RELIBGCC_DEFAULT)dnl
1441 GCC_OBJDIR="$enable_libgcc_rebuild"
1442 AC_SUBST(GCC_OBJDIR)
1447 dnl Check for which I/O library to use:  libio, or something specific.
1449 dnl GLIBCPP_ENABLE_CSTDIO
1450 dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
1451 dnl 
1452 dnl default is libio
1454 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1455   AC_MSG_CHECKING([for cstdio to use])
1456   AC_ARG_ENABLE(cstdio,
1457   [  --enable-cstdio         enable GNU libio for target io package. (default)
1458   --enable-cstdio=LIB     use LIB target-speific io package.], 
1459   if test x$enable_cstdio = xno; then
1460     enable_cstdio=libio
1461   fi,
1462      enable_cstdio=libio)
1464   enable_cstdio_flag=$enable_cstdio
1466   dnl Check if a valid thread package
1467   case x${enable_cstdio_flag} in
1468         xlibio | x | xno | xnone | xyes)
1469                 # default
1470                 CSTDIO_H=c_io_libio.h
1471                 CSTDIO_CC=c_io_libio.cc
1472                 AC_MSG_RESULT(libio)
1474                 # see if we are on a system with libio native (ie, linux)
1475                 AC_CHECK_HEADER(libio.h,  has_libio=yes, has_libio=no)
1476                 if test $has_libio = "yes"; then
1477                   BUILD_LIBIO_INCLUDE=
1478                   need_libio=no
1479                 else
1480                   BUILD_LIBIO_INCLUDE='-I../libio'
1481                   need_libio=yes
1482                 fi
1483                 AC_SUBST(BUILD_LIBIO_INCLUDE)
1485                 # see if the _G_config.h header needs to be built. 
1486                 # NB: This replaces the _G_CONFIG_H machinery in libio-v2
1487                 AC_CHECK_HEADER(_G_config.h,  has_gconf_h=yes, has_gconf_h=no)
1488                 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO_CONFIG_H, test "$has_gconf_h" = no)
1489                 ;;
1490         xwince)
1491                 CSTDIO_H=c_io_wince.h
1492                 CSTDIO_CC=c_io_wince.cc
1493                 AC_MSG_RESULT(wince)
1495                 need_libio=no
1496                 BUILD_LIBIO_INCLUDE=
1497                 AC_SUBST(BUILD_LIBIO_INCLUDE)
1498                 ;;
1499         *)
1500                 echo "$enable_cstdio is an unknown io package" 1>&2
1501                 exit 1
1502                 ;;
1503   esac
1504   AC_SUBST(CSTDIO_H)
1505   AC_SUBST(CSTDIO_CC)
1506   AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1511 dnl Check for which threading library to use.
1513 dnl GLIBCPP_ENABLE_THREADS
1514 dnl --enable-threads=posix sets config/threads-posix.h et. al.
1515 dnl 
1516 dnl default is no threads
1518 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1519   dnl Note this comes from the gcc/config.in and libjava/config.in
1520   dnl Efforts should be made to keep this in sync.
1521   AC_MSG_CHECKING([for threads package to use])
1522   AC_ARG_ENABLE(threads,
1523   [  --enable-threads        enable thread usage for target GCC.
1524   --enable-threads=LIB    use LIB thread package for target GCC.],
1525   if test x$enable_threads = xno; then
1526     enable_threads=''
1527   fi,
1528     enable_threads='')
1530   enable_threads_flag=$enable_threads
1532   dnl Check if a valid thread package
1533   case x${enable_threads_flag} in
1534         x | xno | xnone)
1535                 # No threads
1536                 target_thread_file='single'
1537                 ;;
1538         xyes)
1539                 # default
1540                 target_thread_file=''
1541                 ;;
1542         xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
1543         xsolaris | xwin32 | xdce | xvxworks)
1544                 target_thread_file=$enable_threads_flag
1545                 ;;
1546         *)
1547                 echo "$enable_threads is an unknown thread package" 1>&2
1548                 exit 1
1549                 ;;
1550   esac
1552   dnl Check for thread package actually supported in libstdc++ 
1553   case "$target_thread_file" in
1554     no | none | single)
1555       THREADS=none
1556       ;;
1557     posix | pthreads)
1558       THREADS=posix
1559       case "$host" in
1560         *-*-linux*)
1561         ;;
1562       esac
1563       ;;
1564     decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
1565       AC_MSG_ERROR(thread package $THREADS not yet supported)
1566       ;;
1567     *)
1568       AC_MSG_ERROR($THREADS is an unknown thread package)
1569       ;;
1570   esac
1571   AC_MSG_RESULT($THREADS)
1573   THREADLIBS=
1574   THREADINCS=
1575   THREADDEPS=
1576   THREADOBJS=
1577   THREADH=
1578   THREADSPEC=
1579   case "$THREADS" in
1580     posix)
1581       AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
1582       THREADLIBS=-lpthread
1583       THREADSPEC=-lpthread
1584       dnl Not presently used
1585       dnl THREADOBJS=threads-posix.lo
1586       THREADH=threads-posix.h
1587       ;;
1588     none)
1589       dnl Not presently used
1590       dnl THREADOBJS=threads-no.lo
1591       THREADH=threads-no.h
1592       ;;
1593   esac
1594   AC_SUBST(THREADLIBS)
1595   AC_SUBST(THREADINCS)
1596   AC_SUBST(THREADDEPS)
1597   AC_SUBST(THREADOBJS)
1598   AC_SUBST(THREADSPEC)
1603 dnl Check for template specializations for the 'long long' type extension.
1605 dnl GLIBCPP_ENABLE_LONG_LONG
1606 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1607 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1608 dnl  +  Usage:  GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1609 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
1610 dnl       defaults to `no'.
1611 dnl  +  If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1613 dnl GLIBCPP_ENABLE_LONG_LONG
1614 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1615   define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1617   AC_ARG_ENABLE(long-long,
1618   changequote(<<, >>)dnl
1619   <<--enable-long-long      turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1620   changequote([, ])dnl
1621   [case "$enableval" in
1622    yes) enable_long_long=yes ;;
1623    no)  enable_long_long=no ;;
1624    *)   AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1625    esac],
1626   enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1628   # Check for the existance of functions used if long long is enabled.
1629   AC_CHECK_FUNC(strtoll,,ac_strtoll=no)
1630   AC_CHECK_FUNC(strtoull,,ac_strtoull=no)
1632   AC_MSG_CHECKING([for enabled long long])
1633   if test x"$ac_strtoll" = xno || test x"$ac_strtoull" = xno; then 
1634     enable_long_long=no; 
1635   fi; 
1636   AC_MSG_RESULT($enable_long_long)
1638   dnl Option parsed, now set things appropriately
1639   case "$enable_long_long" in
1640     yes)  AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1641           ;;
1642   esac
1647 dnl Check for whether or not to do shadowed C headers.
1649 dnl GLIBCPP_ENABLE_SHADOW
1650 dnl --enable-cshadow-headers [does stuff].
1651 dnl --disable-cshadow-headers [does not do stuff].
1652 dnl  +  This will eventually need to be on by default.
1653 dnl  +  Usage:  GLIBCPP_ENABLE_SHADOW[(DEFAULT)]
1654 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
1655 dnl       defaults to `no'.
1656 AC_DEFUN(GLIBCPP_ENABLE_SHADOW, [dnl
1657 define([GLIBCPP_ENABLE_SHADOW_DEFAULT], ifelse($1, yes, yes, no))dnl
1658 AC_MSG_CHECKING([for enabled cshadow headers])
1659 AC_ARG_ENABLE(cshadow-headers,
1660 changequote(<<, >>)dnl
1661 <<  --enable-cshadow-headers construct "shadowed" C header files for
1662                            g++ [default=>>GLIBCPP_ENABLE_SHADOW_DEFAULT],
1663 changequote([, ])dnl
1664 [case "$enableval" in
1665  yes) enable_cshadow_headers=yes 
1666         ;;
1667  no)  enable_cshadow_headers=no 
1668         ;;
1669  *)   AC_MSG_ERROR([Unknown argument to enable/disable shadowed C headers]) 
1670         ;;
1671  esac],
1672 enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)dnl
1673 AC_MSG_RESULT($enable_cshadow_headers)
1674 dnl Option parsed, now set things appropriately
1675 case "$enable_cshadow_headers" in
1676     yes) 
1677         CSHADOWFLAGS="-D_GNU_SOURCE"
1678         CSHADOW_INCLUDES=" -I$srcdir/shadow -I$blddir/cshadow"
1679         ;;
1680     no)   
1681         CSHADOWFLAGS=""
1682         CSHADOW_INCLUDES=""
1683         ;;
1684 esac
1686 AC_SUBST(CSHADOWFLAGS)
1687 AC_SUBST(CSHADOW_INCLUDES)
1688 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cshadow_headers" = yes)
1692 # Check whether LC_MESSAGES is available in <locale.h>.
1693 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1695 # This file file be copied and used freely without restrictions.  It can
1696 # be used in projects which are not available under the GNU Public License
1697 # but which still want to provide support for the GNU gettext functionality.
1698 # Please note that the actual code is *not* freely available.
1700 # serial 1
1702 AC_DEFUN(AC_LC_MESSAGES,
1703   [if test $ac_cv_header_locale_h = yes; then
1704     AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1705       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1706        ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1707     if test $ac_cv_val_LC_MESSAGES = yes; then
1708       AC_DEFINE(HAVE_LC_MESSAGES)
1709     fi
1710   fi])
1713 # Check for functions in math library.
1714 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1716 # This file can be copied and used freely without restrictions.  It can
1717 # be used in projects which are not available under the GNU Public License
1718 # but which still want to provide support for the GNU gettext functionality.
1719 # Please note that the actual code is *not* freely available.
1721 # serial 1
1723 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1724 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1725 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1726 AC_SUBST(LIBMATHOBJS)dnl
1730 # Check for string functions.
1731 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1733 # This file can be copied and used freely without restrictions.  It can
1734 # be used in projects which are not available under the GNU Public License
1735 # but which still want to provide support for the GNU gettext functionality.
1736 # Please note that the actual code is *not* freely available.
1738 # serial 1
1740 dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1741 AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1742 [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1743 AC_SUBST(LIBSTRINGOBJS)dnl