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