OSDN Git Service

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