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