]> gcc.gnu.org Git - gcc.git/blame - libstdc++-v3/acinclude.m4
new test case
[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
PE
157dnl Check to see if g++ can compile this library, and if so, if any version-
158dnl specific precautions need to be taken.
b2dad0e3
BK
159dnl
160dnl Define OPTLEVEL='-O2' if new inlining code present.
8bd636c5
PE
161dnl Define WERROR='-Werror' if possible; g++'s that lack the new inlining
162dnl code or the new system_header pragma will die.
b2dad0e3
BK
163dnl
164dnl GLIBCPP_CHECK_COMPILER_VERSION
165AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
166 AC_MSG_CHECKING([for g++ that will successfullly 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
11a6e9a7 174 WERROR='-Werror'
8bd636c5
PE
175 AC_MSG_CHECKING([for g++ that supports new system_header pragma])
176 AC_LANG_SAVE
177 AC_LANG_CPLUSPLUS
178 # the CXXFLAGS thing is suspicious, but based on similar
179 # bits in GLIBCPP_CONFIGURE
180 ac_test_CXXFLAGS="${CXXFLAGS+set}"
181 ac_save_CXXFLAGS="$CXXFLAGS"
182 CXXFLAGS='-Wunknown-pragmas -Werror'
183 AC_TRY_COMPILE([#pragma system_header], [int foo;
11a6e9a7 184 ], [ac_newpragma=yes], [ac_newpragma=no])
8bd636c5
PE
185 if test "$ac_test_CXXFLAGS" = set; then
186 CXXFLAGS="$ac_save_CXXFLAGS"
187 else
188 # this is the suspicious part
189 CXXFLAGS=''
190 fi
191 AC_LANG_RESTORE
11a6e9a7
PE
192 if test "$ac_newpragma" = "no"; then
193 WERROR="$WERROR -Wno-unknown-pragmas"
8bd636c5 194 fi
11a6e9a7 195 AC_MSG_RESULT($ac_newpragma)
8bd636c5 196
b2dad0e3
BK
197 AC_MSG_CHECKING([for g++ that supports new inlining mechanism])
198 AC_EGREP_CPP([ok], [
199 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 95)
200 ok
201 #endif
8bd636c5 202 ], [OPTLEVEL='-O2'], [OPTLEVEL=''])
b2dad0e3
BK
203 if test "$OPTLEVEL" = ""; then
204 AC_MSG_RESULT(no)
8bd636c5
PE
205 # something of a hack here
206 WERROR=''
b2dad0e3
BK
207 else
208 AC_MSG_RESULT(yes)
209 fi
8bd636c5 210
b2dad0e3 211 AC_SUBST(OPTLEVEL)
8bd636c5 212 AC_SUBST(WERROR)
b2dad0e3
BK
213])
214
215
216dnl
217dnl Check to see what builtin math functions are supported
218dnl
219dnl Define _GLIBCPP_HAS_BUILTIN_SINF if __builtin_sinf
220dnl Define _GLIBCPP_HAS_BUILTIN_COSF if __builtin_cosf
221dnl Define _GLIBCPP_HAS_BUILTIN_FABSF if __builtin_fabsf
222dnl Define _GLIBCPP_HAS_BUILTIN_SQRTF if __builtin_sqrtf
223dnl
224dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
225AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
226 dnl Test for builtin math functions.
227 AC_MSG_CHECKING([for __builtin_sinf])
228 AC_TRY_COMPILE([#include <math.h>],
229 [float foo(void) { __builtin_sinf(0.0); }],
230 use_builtin_sinf=yes, use_builtin_sinf=no)
231 AC_MSG_RESULT($use_builtin_sinf)
232 if test $use_builtin_sinf = "yes"; then
233 AC_DEFINE(_GLIBCPP_HAS_BUILTIN_SINF)
234 fi
235
236 AC_MSG_CHECKING([for __builtin_cosf])
237 AC_TRY_COMPILE([#include <math.h>],
238 [float foo(void) { __builtin_cosf(0.0); }],
239 use_builtin_cosf=yes, use_builtin_cosf=no)
240 AC_MSG_RESULT($use_builtin_cosf)
241 if test $use_builtin_cosf = "yes"; then
242 AC_DEFINE(_GLIBCPP_HAS_BUILTIN_COSF)
243 fi
244
245 AC_MSG_CHECKING([for __builtin_fabsf])
246 AC_TRY_COMPILE([#include <math.h>],
247 [float foo(void) { __builtin_fabsf(0.0); }],
248 use_builtin_fabsf=yes, use_builtin_fabsf=no)
249 AC_MSG_RESULT($use_builtin_fabsf)
250 if test $use_builtin_fabsf = "yes"; then
251 AC_DEFINE(_GLIBCPP_HAS_BUILTIN_FABSF)
252 fi
253
254 AC_MSG_CHECKING([for __builtin_sqrtf])
255 AC_TRY_COMPILE([#include <math.h>],
256 [float foo(void) { __builtin_sqrtf(0.0); }],
257 use_builtin_sqrtf=yes, use_builtin_sqrtf=no)
258 AC_MSG_RESULT($use_builtin_sqrtf)
259 if test $use_builtin_sqrtf = "yes"; then
260 AC_DEFINE(_GLIBCPP_HAS_BUILTIN_SQRTF)
261 fi
262])
263
264
b2dad0e3
BK
265dnl Check to see what architecture we are compiling for. If it's
266dnl supported, use special hand-crafted routines to provide thread
cde28f0d
BK
267dnl primitives. Also, if architecture-specific flags are required for
268dnl compilation, add them here.
b2dad0e3 269dnl
f3b004d8
BK
270dnl Depending on what is found, select configure/cpu/*/bits/atomicity.h
271dnl If not found, select configure/cpu/generic/bits/atomicity.h
b2dad0e3
BK
272dnl
273dnl GLIBCPP_CHECK_CPU
274AC_DEFUN(GLIBCPP_CHECK_CPU, [
275 AC_MSG_CHECKING([for cpu primitives directory])
cde28f0d 276 CPUFLAGS=
b2dad0e3
BK
277 case "$target_cpu" in
278 alpha*)
279 cpu_include_dir="config/cpu/alpha"
280 ;;
281 arm*)
282 cpu_include_dir="config/cpu/arm"
283 ;;
284 i486 | i586 | i686 | i786)
285 cpu_include_dir="config/cpu/i386"
286 ;;
287 powerpc | rs6000)
288 cpu_include_dir="config/cpu/powerpc"
7b267e3e 289 CPUFLAGS='-mcpu=powerpc'
b2dad0e3
BK
290 ;;
291 sparc64 | ultrasparc)
292 cpu_include_dir="config/cpu/sparc/sparc64"
293 ;;
294 sparc*)
295 cpu_include_dir="config/cpu/sparc/sparc32"
296 ;;
297 *)
298 cpu_include_dir="config/cpu/generic"
299 ;;
300 esac
301 AC_MSG_RESULT($cpu_include_dir)
302 AC_SUBST(cpu_include_dir)
cde28f0d 303 AC_SUBST(CPUFLAGS)
b2dad0e3
BK
304])
305
306
307dnl
308dnl Check to see what the underlying c library's interface to ctype looks
309dnl like. Bits of locale rely on things like isspace, toupper, etc. This
310dnl stuff makes sure the right bits from the clibrary get called.
311dnl
312dnl Depending on what is found, select various configure/*/bits/ctype_base.h
313dnl Depending on what is found, select various configure/*/ctype.cc
314dnl
315dnl GLIBCPP_CHECK_CTYPE
316AC_DEFUN(GLIBCPP_CHECK_CTYPE, [
317 AC_CHECK_HEADER(ctype.h, [
318
319 dnl If doesn't match any specified, go with defaults.
320 ctype_default=yes
321
322 dnl Test for <ctype> functionality -- gnu-linux
8445e42a 323 AC_MSG_CHECKING([<ctype> for gnu-linux ])
b2dad0e3
BK
324 AC_TRY_COMPILE([#include <ctype.h>],
325 [int
326 foo (int a)
327 { return _ISspace + _ISprint + _IScntrl + _ISupper + _ISlower + _ISalpha \
328 + _ISdigit + _ISpunct + _ISxdigit + _ISalnum + _ISgraph \
329 + __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];}], \
330 ctype_linux=yes, ctype_linux=no)
331 AC_MSG_RESULT($ctype_linux)
332 if test $ctype_linux = "yes"; then
333 ctype_include_dir="config/gnu-linux"
334 ctype_default=no
335 fi
336
6ad50467 337 dnl Test for <ctype> functionality -- FreeBSD 4.0
65dd21b7 338 if test $ctype_default = "yes"; then
6ad50467 339 AC_MSG_CHECKING([<ctype> for freebsd 4.0 ])
7b267e3e
BK
340 AC_TRY_COMPILE([#include <ctype.h>],
341 [int
342 foo (int a)
343 { return _CTYPE_S + _CTYPE_R + _CTYPE_C + _CTYPE_U + _CTYPE_L + _CTYPE_A \
344 + _CTYPE_D + _CTYPE_P + _CTYPE_X + _CTYPE_G ;}], \
345 ctype_bsd=yes, ctype_bsd=no)
346 AC_MSG_RESULT($ctype_bsd)
347 if test $ctype_bsd = "yes"; then
348 ctype_include_dir="config/bsd"
349 ctype_default=no
350 fi
65dd21b7 351 fi
7b267e3e 352
6ad50467 353 dnl Test for <ctype> functionality -- FreeBSD 3.4
65dd21b7 354 if test $ctype_default = "yes"; then
6ad50467
BK
355 AC_MSG_CHECKING([<ctype> for freebsd 3.4 ])
356 AC_TRY_COMPILE([#include <ctype.h>],
357 [int
358 foo (int a)
359 { return _S + _R + _C + _U + _L + _A \
360 + _D + _P + _X + _G + __istype (a, 0);}], \
361 ctype_freebsd34=yes, ctype_freebsd34=no)
362 AC_MSG_RESULT($ctype_freebsd34)
363 if test $ctype_freebsd34 = "yes"; then
364 ctype_include_dir="config/bsd"
365 ctype_default=no
366 fi
65dd21b7 367 fi
6ad50467 368
b2dad0e3
BK
369 dnl Test for <ctype> functionality -- solaris 2.6 and 2.7
370 if test $ctype_default = "yes"; then
8445e42a 371 AC_MSG_CHECKING([<ctype> for solaris 2.[6,7,8] ])
b2dad0e3
BK
372 AC_TRY_COMPILE([#include <ctype.h>],
373 [int
374 foo (int a)
375 { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
376 + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
377 + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}], \
378 ctype_solaris=yes, ctype_solaris=no)
379 AC_MSG_RESULT($ctype_solaris)
380
381 if test $ctype_solaris = "yes"; then
382 AC_MSG_CHECKING([ for version])
383 AC_LANG_CPLUSPLUS
384 AC_TRY_COMPILE([#include <ctype.h>],
385 [typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;],\
386 ctype_solaris26=yes, ctype_solaris26=no)
387 AC_LANG_C
388 if test $ctype_solaris26 = "yes"; then
389 ctype_include_dir="config/solaris/solaris2.6"
390 AC_MSG_RESULT("solaris2.6")
391 ctype_default=no
392 else
393 ctype_include_dir="config/solaris/solaris2.7"
32a4595e 394 AC_MSG_RESULT("solaris2.[7,8]")
b2dad0e3
BK
395 ctype_default=no
396 fi
397 fi
398 fi
399
400 dnl Test for <ctype> functionality -- solaris 2.5.1
401 if test $ctype_default = "yes"; then
8445e42a 402 AC_MSG_CHECKING([<ctype> for solaris 2.5.1 ])
b2dad0e3
BK
403 AC_TRY_COMPILE([#include <ctype.h>],
404 [int
405 foo (int a)
406 { return _U + _L + _N + _S + _P + _C + _X + _B \
407 + __ctype[a];}], \
408 ctype_solaris25=yes, ctype_solaris25=no)
409 AC_MSG_RESULT($ctype_solaris25)
410 if test $ctype_solaris25 = "yes"; then
411 ctype_include_dir="config/solaris/solaris2.5"
412 ctype_default=no
413 fi
414 fi
415
416 dnl Test for <ctype> functionality -- aix
417 if test $ctype_default = "yes"; then
8445e42a 418 AC_MSG_CHECKING([<ctype> for aix ])
b2dad0e3
BK
419 AC_TRY_COMPILE([#include <ctype.h>],
420 [int
421 foo (int a)
422 { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
423 + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
424 + _VALC('a') + _IS('c', 0);}], \
425 ctype_aix=yes, ctype_aix=no)
426 AC_MSG_RESULT($ctype_aix)
427 if test $ctype_aix = "yes"; then
428 ctype_include_dir="config/aix"
429 ctype_default=no
430 fi
431 fi
432
433 dnl Test for <ctype> functionality -- newlib
434 if test $ctype_default = "yes"; then
8445e42a 435 AC_MSG_CHECKING([<ctype> for newlib ])
b2dad0e3
BK
436 AC_TRY_COMPILE([#include <ctype.h>],
437 [int
438 foo (int a)
439 { return _U + _L + _N + _S + _P + _C + _X + _B \
440 + _ctype_[a];}], \
441 ctype_newlib=yes, ctype_newlib=no)
442 AC_MSG_RESULT($ctype_newlib)
443 if test $ctype_newlib = "yes"; then
444 ctype_include_dir="config/newlib"
445 ctype_default=no
446 fi
447 fi
448
449 if test $ctype_default = "yes"; then
450 ctype_include_dir="config/generic"
451 AC_MSG_WARN("Using default ctype headers.")
452 fi
453 AC_SUBST(ctype_include_dir)
454 ])
455])
456
457
458dnl
459dnl Check to see what the underlying c library or math library is like.
460dnl
461dnl Define HAVE_CARGF etc if "cargf" is found.
462dnl
463dnl GLIBCPP_CHECK_MATH_SUPPORT
464AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
465 AC_CHECK_LIB(m, sin, libm="-lm")
466 save_LIBS="$LIBS"
467 LIBS="$LIBS $libm"
468
469 dnl Check for complex versions of math functions of platform.
470 AC_CHECK_HEADERS([complex.h])
471 AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf c_log c_logf \
472 clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt csqrtf \
473 ctan ctanf ctanh ctanhf \
474 carg cargf nan hypot hypotf atan2f expf copysignf)
475
476 dnl We compile the long double complex functions only if the function
f3b004d8 477 dnl provides the non-complex long double functions.
b2dad0e3 478 USE_LONG_DOUBLE=no
f3b004d8 479 AC_CHECK_FUNC(copysignl,
b2dad0e3
BK
480 USE_LONG_DOUBLE=yes
481 AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl cpowl csinhl csinl \
482 csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l))
483 AC_SUBST(USE_LONG_DOUBLE)
484
485 dnl Check to see if basic C math functions have faster float versions.
486 AC_CHECK_FUNCS(modf isnan isnanf isnanl isinf isinff isinfl copysign \
487 copysignl cosf coshf logf log10f powf sinf sinhf sqrtf tanf tanhf \
488 strtof strtold fabsf sincos sincosf sincosl finite finite fqfinite \
489 fpclass qfpclass)
490
491#Some runtimes have these functions with a preceding underscore. Please
492# keep this sync'd with the one above. And if you add any new symbol,
493# please add the corresponding block in the @BOTTOM@ section of
494# acconfig.h.
495AC_CHECK_FUNCS(_modf _isnan _isnanf _isnanl _isinf _isinff _isinfl _copysign \
496_copysignl _cosf _coshf _logf _log10f _powf _sinf _sinhf _sqrtf _tanf _tanhf \
497_strtof _strtold _fabsf _sincos _sincosf _sincosl _finite _finitef _qfinite \
498_fpclass _qfpclass)
499
500LIBS="$save_LIBS"
501])
502
503
504dnl
505dnl Check to see if this target can enable the wchar_t parts of libstdc++.
506dnl
507dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
508dnl Define _GLIBCPP_NEED_MBSTATE_T if mbstate_t is not in wchar.h
509dnl Define _GLIBCPP_HAS_WCHAR_MIN_MAX if WCHAR_MIN, WCHAR_MAX in wchar.h
510dnl
511dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
512AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
513 AC_CHECK_HEADER(wchar.h,[
514 dnl Test wchar.h for mbstate_t, which is needed for char_traits and others.
515 AC_MSG_CHECKING([for native mbstate_t])
516 AC_TRY_COMPILE([#include <wchar.h>],
517 [mbstate_t teststate;],
518 use_native_mbstatet=yes, use_native_mbstatet=no)
519 AC_MSG_RESULT($use_native_mbstatet)
520 if test $use_native_mbstatet = "no"; then
521 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
522 fi
523
524 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
525 dnl numeric_limits can instantiate type_traits<wchar_t>
526 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
527 AC_TRY_COMPILE([#include <wchar.h>],
528 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
529 has_wchar_minmax=yes, has_wchar_minmax=no)
530 AC_MSG_RESULT($has_wchar_minmax)
531 if test $has_wchar_minmax = "yes"; then
532 AC_DEFINE(_GLIBCPP_HAS_WCHAR_MIN_MAX)
533 fi
534
535 # Test wchar.h for WEOF, which is what we use to determine whether
536 # to specialize for wchar_t or not.
537 AC_MSG_CHECKING([for WEOF])
538 AC_TRY_COMPILE([
539 #include <wchar.h>
540 #include <stddef.h>],
541 [wint_t i = WEOF;],
542 has_weof=yes, has_weof=no)
543 AC_MSG_RESULT($has_weof)
544
545 dnl Tests for wide character functions.
546 AC_REPLACE_STRINGFUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset)
5d89258a 547 AC_SUBST(libinst_wstring_la)
b2dad0e3
BK
548
549 AC_MSG_CHECKING([for wide character support])
550 if test $has_weof = "yes" && test $has_wchar_minmax = "yes"; then
5d89258a 551 libinst_wstring_la="libinst-wstring.la"
b2dad0e3
BK
552 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
553 AC_MSG_RESULT(ok)
554 else
5d89258a 555 libinst_wstring_la=""
b2dad0e3
BK
556 AC_MSG_RESULT("not specializing for wchar_t")
557 fi
558 ],[
559 AC_MSG_WARN([<wchar.h> not found])
560 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
561 ])
562])
563
564
565dnl
566dnl Check to see if this version of GNU C++ is afflicted by bugs in
567dnl __complex__ float support.
568dnl
569dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
570dnl
571dnl GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT
572AC_DEFUN(GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT, [
573 AC_REQUIRE([AC_PROG_CXX])
574 AC_MSG_CHECKING([for GNU C++ __complex__ float support])
575 AC_CACHE_VAL(glibcpp_cv_float_complex, [
576 AC_LANG_SAVE
577 AC_LANG_CPLUSPLUS
578 rm -f conftest.h
579 cat > conftest.h <<EOB
580 //
581 // Check for buggy __complex__ that causes ICE in most versions of egcs
582 // and gcc-2.95.x on certain platforms (eg., x86-win32).
583 //
584 // See http://egcs.cygnus.com/ml/gcc-bugs/1999-07/msg00845.html for
585 // more info on the bug itself.
586 //
587 struct
588 float_complex
589 {
590 __complex__ float m_value;
591 float_complex (float = 0.0f, float = 0.0f);
592 float_complex (__complex__ float val) : m_value (val) {}
593 float_complex foo (const float_complex &val)
594 { return float_complex (~val.m_value); }
595 };
596EOB
597 AC_TRY_COMPILE([#include "conftest.h"], ,
598 glibcpp_cv_float_complex=ok,
599 glibcpp_cv_float_complex=buggy
600 )
601 AC_LANG_RESTORE
602 ])
603 AC_MSG_RESULT($glibcpp_cv_float_complex)
604 if test $glibcpp_cv_float_complex = buggy; then
605 AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
606 fi
607])
608
609
610dnl
611dnl
612dnl Check to see if this version of GNU C++ is afflicted by bugs in
613dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
614dnl gcc-2.95.x when using the library, unless we define the default copy
615dnl ctor in the specializations of complex<>.
616dnl
617dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
618dnl
619dnl GLIBCPP_CHECK_COMPLEX_SUPPORT
620AC_DEFUN(GLIBCPP_CHECK_COMPLEX_SUPPORT, [
621 AC_REQUIRE([AC_PROG_CXX])
622 AC_MSG_CHECKING([for GNU C++ __complex__ support])
623 AC_CACHE_VAL(glibcpp_cv_complex, [
624 AC_LANG_SAVE
625 AC_LANG_CPLUSPLUS
626 AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
627 dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
628 [ dcomplex x; f(x); ],
629 glibcpp_cv_complex=ok,
630 glibcpp_cv_complex=buggy
631 )
632 AC_LANG_RESTORE
633 ])
634 AC_MSG_RESULT($glibcpp_cv_complex)
635 if test $glibcpp_cv_complex = buggy; then
636 AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
637 fi
638])
639
640
641dnl
8bd636c5 642dnl Check for special debugging mode; not for production use.
b2dad0e3
BK
643dnl
644dnl GLIBCPP_ENABLE_DEBUG
645dnl --enable-debug sets '-ggdb -O0'.
646dnl --disable-debug sets '-g' and whatever optimization options the
647dnl compiler can handle.
648dnl + Perhaps --enable-maintainer-mode should automatically turn this on?
649dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
650dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
651dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
652dnl defaults to `no'.
653AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
654define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
655AC_ARG_ENABLE(debug,
656changequote(<<, >>)dnl
657<< --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
658changequote([, ])dnl
659[case "$enableval" in
660 yes) enable_debug=yes ;;
661 no) enable_debug=no ;;
662 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
663 esac],
664enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
665dnl Option parsed, now set things appropriately
666case "$enable_debug" in
cde28f0d
BK
667 yes)
668 DEBUGFLAGS='-O0 -ggdb'
669 ;;
f3b004d8
BK
670 no)
671 DEBUGFLAGS='-g'
672 ;;
b2dad0e3
BK
673esac
674AC_SUBST(DEBUGFLAGS)
675])
676
677
dcfa0bc8
PE
678dnl
679dnl Check for "unusual" flags to pass to the compiler while building.
680dnl
681dnl GLIBCPP_ENABLE_CXX_FLAGS
682dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
683dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
684dnl Somehow this same set of flags must be passed when [re]building
685dnl libgcc.
686dnl --disable-cxx-flags passes nothing.
32a4595e
PE
687dnl + See http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00131.html
688dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q2/msg00284.html
689dnl http://sourceware.cygnus.com/ml/libstdc++/2000-q1/msg00035.html
dcfa0bc8 690dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
32a4595e
PE
691dnl If "default flags" is an empty string (or "none"), the effect is
692dnl the same as --disable or --enable=no.
dcfa0bc8
PE
693AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
694define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
695AC_ARG_ENABLE(cxx-flags,
696changequote(<<, >>)dnl
697<< --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
698 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
699changequote([, ])dnl
700[case "x$enableval" in
701 xyes) AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
32a4595e 702 xno|x) enable_cxx_flags='' ;;
dcfa0bc8
PE
703 *) enable_cxx_flags="$enableval" ;;
704 esac],
705enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')dnl
32a4595e
PE
706dnl Thinko on my part during design. This kludge is the workaround.
707if test "$enable_cxx_flags" = "none"; then enable_cxx_flags=''; fi
708dnl Run through flags (either default or command-line) and set anything
709dnl extra (e.g., #defines) that must accompany particular g++ options.
dcfa0bc8
PE
710if test -n "$enable_cxx_flags"; then
711 for f in $enable_cxx_flags; do
712 case "$f" in
991a40fc 713 -fhonor-std) ;;
dcfa0bc8
PE
714 -*) ;;
715 *) # and we're trying to pass /what/ exactly?
716 AC_MSG_ERROR([compiler flags start with a -]) ;;
717 esac
718 done
719fi
720EXTRA_CXX_FLAGS="$enable_cxx_flags"
721AC_SUBST(EXTRA_CXX_FLAGS)
722])
723
724
b2dad0e3
BK
725dnl
726dnl Check for instructions to automatically rebuild libgcc.a. Requires,
727dnl of course, the location of the gcc objdir. Note that if --disable-
728dnl namespaces is in effect, rebuilding libgcc.a is an expensive no-op.
729dnl
730dnl GLIBCPP_ENABLE_RELIBGCC
731dnl --enable-libgcc-rebuild=/absolute/path/to/gcc/objdir sets GCC_OBJDIR
732dnl (presumably in the top-level Makefile) to /absol.../objdir
733dnl --disable-libgcc-rebuild will not touch libgcc.a at all (maybe print
734dnl a warning if this is given along with --enable-namespaces), by
735dnl setting GCC_OBJDIR to `no'.
736dnl + Doing this by default is going to be interesting. What default
737dnl "on" value can there be?
738dnl + Usage: GLIBCPP_ENABLE_RELIBGCC[(DEFAULT)]
739dnl The default path should be ../.. if bundled with GCC source.
740dnl If ommitted, it defaults to `no'.
741dnl
742AC_DEFUN(GLIBCPP_ENABLE_RELIBGCC, [dnl
743define([GLIBCPP_ENABLE_RELIBGCC_DEFAULT], ifelse($1,, no, $1))dnl
744AC_ARG_ENABLE(libgcc-rebuild,
745changequote(<<, >>)dnl
746<< --enable-libgcc-rebuild=DIR also rebuild libgcc.a; DIR is
747 the GCC objdir; see install.html>>,
748changequote([, ])dnl
749[case "$enableval" in
750 yes) AC_MSG_ERROR([--enable-libgcc-rebuild needs a pathname]) ;;
751 no) enable_libgcc_rebuild=no ;;
752 *) if test -d "$enableval" && test -d "${enableval}/gcc" && \
753 test -d "${enableval}/libiberty"
754 then
755 enable_libgcc_rebuild="$enableval"
756 else
757 AC_MSG_ERROR(["$enableval" does not appear to be the GCC objdir])
758 fi
759 ;;
760 esac],
761enable_libgcc_rebuild=GLIBCPP_ENABLE_RELIBGCC_DEFAULT)dnl
762GCC_OBJDIR="$enable_libgcc_rebuild"
763AC_SUBST(GCC_OBJDIR)
764])
765
766
767dnl
8bd636c5 768dnl Check for which I/O library to use: libio, or something specific.
b2dad0e3
BK
769dnl
770dnl GLIBCPP_ENABLE_CSTDIO
771dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
772dnl
773dnl default is libio
774dnl
775AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
776 AC_MSG_CHECKING([for cstdio to use])
777 AC_ARG_ENABLE(cstdio,
778 [ --enable-cstdio enable GNU libio for target io package. (default)
779 --enable-cstdio=LIB use LIB target-speific io package.],
780 if test x$enable_cstdio = xno; then
781 enable_cstdio=libio
782 fi,
783 enable_cstdio=libio)
784
785 enable_cstdio_flag=$enable_cstdio
786
787 dnl Check if a valid thread package
788 case x${enable_cstdio_flag} in
789 xlibio | x | xno | xnone | xyes)
790 # default
791 CSTDIO_H=c_io_libio.h
792 CSTDIO_CC=c_io_libio.cc
793 AC_MSG_RESULT(libio)
794
795 # see if we are on a system with libio native (ie, linux)
796 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
797 if test $has_libio = "yes"; then
798 BUILD_LIBIO_INCLUDE=
799 need_libio=no
800 else
801 BUILD_LIBIO_INCLUDE='-I../libio'
802 need_libio=yes
803 fi
804 AC_SUBST(BUILD_LIBIO_INCLUDE)
f3b004d8
BK
805
806 # see if the _G_config.h header needs to be built.
807 # NB: This replaces the _G_CONFIG_H machinery in libio-v2
808 AC_CHECK_HEADER(_G_config.h, has_gconf_h=yes, has_gconf_h=no)
809 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO_CONFIG_H, test "$has_gconf_h" = no)
b2dad0e3
BK
810 ;;
811 xwince)
812 CSTDIO_H=c_io_wince.h
813 CSTDIO_CC=c_io_wince.cc
814 AC_MSG_RESULT(wince)
815
816 need_libio=no
817 BUILD_LIBIO_INCLUDE=
818 AC_SUBST(BUILD_LIBIO_INCLUDE)
819 ;;
820 *)
821 echo "$enable_cstdio is an unknown io package" 1>&2
822 exit 1
823 ;;
824 esac
825 AC_SUBST(CSTDIO_H)
826 AC_SUBST(CSTDIO_CC)
827 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
828])
829
830
831dnl
8bd636c5 832dnl Check for which threading library to use.
b2dad0e3
BK
833dnl
834dnl GLIBCPP_ENABLE_THREADS
835dnl --enable-threads=posix sets config/threads-posix.h et. al.
836dnl
837dnl default is no threads
838dnl
839AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
840 dnl Note this comes from the gcc/config.in and libjava/config.in
841 dnl Efforts should be made to keep this in sync.
842 AC_MSG_CHECKING([for threads package to use])
843 AC_ARG_ENABLE(threads,
844 [ --enable-threads enable thread usage for target GCC.
845 --enable-threads=LIB use LIB thread package for target GCC.],
846 if test x$enable_threads = xno; then
847 enable_threads=''
848 fi,
849 enable_threads='')
850
851 enable_threads_flag=$enable_threads
852
853 dnl Check if a valid thread package
854 case x${enable_threads_flag} in
855 x | xno | xnone)
856 # No threads
857 target_thread_file='single'
858 ;;
859 xyes)
860 # default
861 target_thread_file=''
862 ;;
863 xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
864 xsolaris | xwin32 | xdce | xvxworks)
865 target_thread_file=$enable_threads_flag
866 ;;
867 *)
868 echo "$enable_threads is an unknown thread package" 1>&2
869 exit 1
870 ;;
871 esac
872
873 dnl Check for thread package actually supported in libstdc++
874 case "$target_thread_file" in
875 no | none | single)
876 THREADS=none
877 ;;
878 posix | pthreads)
879 THREADS=posix
880 case "$host" in
881 *-*-linux*)
882 ;;
883 esac
884 ;;
885 decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
886 AC_MSG_ERROR(thread package $THREADS not yet supported)
887 ;;
888 *)
889 AC_MSG_ERROR($THREADS is an unknown thread package)
890 ;;
891 esac
892 AC_MSG_RESULT($THREADS)
893
894 THREADLIBS=
895 THREADINCS=
896 THREADDEPS=
897 THREADOBJS=
898 THREADH=
899 THREADSPEC=
900 case "$THREADS" in
901 posix)
902 AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
903 THREADLIBS=-lpthread
904 THREADSPEC=-lpthread
905 dnl Not presently used
906 dnl THREADOBJS=threads-posix.lo
907 THREADH=threads-posix.h
908 ;;
909 none)
910 dnl Not presently used
911 dnl THREADOBJS=threads-no.lo
912 THREADH=threads-no.h
913 ;;
914 esac
915 AC_SUBST(THREADLIBS)
916 AC_SUBST(THREADINCS)
917 AC_SUBST(THREADDEPS)
918 AC_SUBST(THREADOBJS)
919 AC_SUBST(THREADSPEC)
920])
921
922
923dnl
8bd636c5 924dnl Check for template specializations for the 'long long' type extension.
b2dad0e3
BK
925dnl
926dnl GLIBCPP_ENABLE_LONG_LONG
927dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
928dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
929dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
930dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
931dnl defaults to `no'.
932dnl
933dnl GLIBCPP_ENABLE_LONG_LONG
934AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
935 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
d0d88ce3 936 AC_MSG_CHECKING([for enabled long long])
b2dad0e3
BK
937 AC_ARG_ENABLE(long-long,
938 changequote(<<, >>)dnl
d0d88ce3 939 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
b2dad0e3
BK
940 changequote([, ])dnl
941 [case "$enableval" in
942 yes) enable_long_long=yes ;;
943 no) enable_long_long=no ;;
944 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
945 esac],
946 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
d0d88ce3 947 AC_MSG_RESULT($enable_long_long)
b2dad0e3
BK
948 dnl Option parsed, now set things appropriately
949 case "$enable_long_long" in
950 yes) AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
951 ;;
952 esac
953])
954
955
99246c90 956dnl
8bd636c5 957dnl Check for whether or not to do shadowed C headers.
99246c90
PE
958dnl
959dnl GLIBCPP_ENABLE_SHADOW
d0d88ce3
BK
960dnl --enable-cshadow-headers [does stuff].
961dnl --disable-cshadow-headers [does not do stuff].
99246c90
PE
962dnl + This will eventually need to be on by default.
963dnl + Usage: GLIBCPP_ENABLE_SHADOW[(DEFAULT)]
964dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
965dnl defaults to `no'.
966AC_DEFUN(GLIBCPP_ENABLE_SHADOW, [dnl
967define([GLIBCPP_ENABLE_SHADOW_DEFAULT], ifelse($1, yes, yes, no))dnl
d0d88ce3
BK
968AC_MSG_CHECKING([for enabled cshadow headers])
969AC_ARG_ENABLE(cshadow-headers,
99246c90 970changequote(<<, >>)dnl
d0d88ce3
BK
971<< --enable-cshadow-headers construct "shadowed" C header files for
972 g++ [default=>>GLIBCPP_ENABLE_SHADOW_DEFAULT],
99246c90
PE
973changequote([, ])dnl
974[case "$enableval" in
d0d88ce3
BK
975 yes) enable_cshadow_headers=yes
976 ;;
977 no) enable_cshadow_headers=no
978 ;;
979 *) AC_MSG_ERROR([Unknown argument to enable/disable shadowed C headers])
980 ;;
99246c90 981 esac],
d0d88ce3
BK
982enable_cshadow_headers=GLIBCPP_ENABLE_SHADOW_DEFAULT)dnl
983AC_MSG_RESULT($enable_cshadow_headers)
99246c90 984dnl Option parsed, now set things appropriately
d0d88ce3 985case "$enable_cshadow_headers" in
99246c90 986 yes)
d0d88ce3 987 SHADOW_INCLUDES="-I$srcdir/shadow -I$blddir/cshadow"
8bd636c5 988 $srcdir/inclosure "-I $blddir/../../gcc/include/ -I /usr/include/ -G machine/ansi.h" | $srcdir/mkcshadow
99246c90
PE
989 ;;
990 no)
991 SHADOW_INCLUDES=''
992 ;;
993esac
032cc955 994# SHADOW_INCLUDES is currently not used anywhere in the source
99246c90
PE
995AC_SUBST(SHADOW_INCLUDES)
996])
b2dad0e3
BK
997
998
This page took 0.152333 seconds and 5 git commands to generate.