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