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