]> gcc.gnu.org Git - gcc.git/blob - libstdc++-v3/acinclude.m4
* tree.c (walk_tree): Set lineno.
[gcc.git] / libstdc++-v3 / acinclude.m4
1 dnl
2 dnl Initialize configure bits.
3 dnl
4 dnl Define OPTLEVEL='-O2' if new inlining code present.
5 dnl
6 dnl GLIBCPP_CONFIGURE
7 AC_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
40 AC_DEFUN(LIB_AC_PROG_CC,
41 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
42 dnl Fool anybody using AC_PROG_CC.
43 AC_PROVIDE([AC_PROG_CC])
44 AC_CHECK_PROG(CC, gcc, gcc)
45 if 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])
48 fi
49
50 AC_PROG_CC_GNU
51
52 if test $ac_cv_prog_gcc = yes; then
53 GCC=yes
54 dnl Check whether -g works, even if CFLAGS is set, in case the package
55 dnl plays around with CFLAGS (such as to build both debugging and
56 dnl 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
68 else
69 GCC=
70 test "${CFLAGS+set}" = set || CFLAGS="-g"
71 fi
72 ])
73
74 LIB_AC_PROG_CC
75
76 # Likewise for AC_PROG_CXX.
77 AC_DEFUN(LIB_AC_PROG_CXX,
78 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
79 dnl Fool anybody using AC_PROG_CXX.
80 AC_PROVIDE([AC_PROG_CXX])
81 AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
82 test -z "$CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
83
84 AC_PROG_CXX_GNU
85
86 if test $ac_cv_prog_gxx = yes; then
87 GXX=yes
88 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
89 dnl plays around with CXXFLAGS (such as to build both debugging and
90 dnl 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
102 else
103 GXX=
104 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
105 fi
106 ])
107
108 LIB_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.
114 AC_CANONICAL_BUILD
115
116 AC_CHECK_TOOL(AS, as)
117 AC_CHECK_TOOL(AR, ar)
118 AC_CHECK_TOOL(RANLIB, ranlib, :)
119
120 AC_PROG_INSTALL
121
122 AM_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.
131 if false; then
132 AC_EXEEXT
133 fi
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
139 glibcpp_cflags=
140 glibcpp_cxxflags=
141
142 . [$]{glibcpp_basedir}/configure.host
143
144 case [$]{glibcpp_basedir} in
145 /* | [A-Za-z]:[/\\]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
146 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
147 esac
148
149 GLIBCPP_CFLAGS="[$]{glibcpp_cflags}"
150 GLIBCPP_CXXFLAGS="[$]{glibcpp_cxxflags}"
151 AC_SUBST(GLIBCPP_CFLAGS)
152 AC_SUBST(GLIBCPP_CXXFLAGS)
153 ])
154
155
156 dnl
157 dnl Check to see if g++ can compile this library.
158 dnl
159 dnl Define OPTLEVEL='-O2' if new inlining code present.
160 dnl
161 dnl GLIBCPP_CHECK_COMPILER_VERSION
162 AC_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
191 dnl
192 dnl Check to see what builtin math functions are supported
193 dnl
194 dnl Define _GLIBCPP_HAS_BUILTIN_SINF if __builtin_sinf
195 dnl Define _GLIBCPP_HAS_BUILTIN_COSF if __builtin_cosf
196 dnl Define _GLIBCPP_HAS_BUILTIN_FABSF if __builtin_fabsf
197 dnl Define _GLIBCPP_HAS_BUILTIN_SQRTF if __builtin_sqrtf
198 dnl
199 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
200 AC_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
240 dnl
241
242 dnl Check to see what architecture we are compiling for. If it's
243 dnl supported, use special hand-crafted routines to provide thread
244 dnl primitives. Also, if architecture-specific flags are required for
245 dnl compilation, add them here.
246 dnl
247 dnl Depending on what is found, select configure/cpu/*/bits/atomicity.h
248 dnl If not found, select configure/cpu/generic/bits/atomicity.h
249 dnl
250 dnl GLIBCPP_CHECK_CPU
251 AC_DEFUN(GLIBCPP_CHECK_CPU, [
252 AC_MSG_CHECKING([for cpu primitives directory])
253 CPUFLAGS=
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"
266 CPUFLAGS='-mnew-mnemonics -Wa,-mppc -mpowerpc'
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)
280 AC_SUBST(CPUFLAGS)
281 ])
282
283
284 dnl
285 dnl Check to see what the underlying c library's interface to ctype looks
286 dnl like. Bits of locale rely on things like isspace, toupper, etc. This
287 dnl stuff makes sure the right bits from the clibrary get called.
288 dnl
289 dnl Depending on what is found, select various configure/*/bits/ctype_base.h
290 dnl Depending on what is found, select various configure/*/ctype.cc
291 dnl
292 dnl GLIBCPP_CHECK_CTYPE
293 AC_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
300 AC_MSG_CHECKING([for gnu-linux <ctype>])
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
314 dnl Test for <ctype> functionality -- solaris 2.6 and 2.7
315 if test $ctype_default = "yes"; then
316 AC_MSG_CHECKING([for solaris 2.6 or 2.7 <ctype>])
317 AC_TRY_COMPILE([#include <ctype.h>],
318 [int
319 foo (int a)
320 { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
321 + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
322 + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}], \
323 ctype_solaris=yes, ctype_solaris=no)
324 AC_MSG_RESULT($ctype_solaris)
325
326 if test $ctype_solaris = "yes"; then
327 AC_MSG_CHECKING([ for version])
328 AC_LANG_CPLUSPLUS
329 AC_TRY_COMPILE([#include <ctype.h>],
330 [typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;],\
331 ctype_solaris26=yes, ctype_solaris26=no)
332 AC_LANG_C
333 if test $ctype_solaris26 = "yes"; then
334 ctype_include_dir="config/solaris/solaris2.6"
335 AC_MSG_RESULT("solaris2.6")
336 ctype_default=no
337 else
338 ctype_include_dir="config/solaris/solaris2.7"
339 AC_MSG_RESULT("solaris2.7")
340 ctype_default=no
341 fi
342 fi
343 fi
344
345 dnl Test for <ctype> functionality -- solaris 2.5.1
346 if test $ctype_default = "yes"; then
347 AC_MSG_CHECKING([for solaris 2.5.1 <ctype>])
348 AC_TRY_COMPILE([#include <ctype.h>],
349 [int
350 foo (int a)
351 { return _U + _L + _N + _S + _P + _C + _X + _B \
352 + __ctype[a];}], \
353 ctype_solaris25=yes, ctype_solaris25=no)
354 AC_MSG_RESULT($ctype_solaris25)
355 if test $ctype_solaris25 = "yes"; then
356 ctype_include_dir="config/solaris/solaris2.5"
357 ctype_default=no
358 fi
359 fi
360
361 dnl Test for <ctype> functionality -- aix
362 if test $ctype_default = "yes"; then
363 AC_MSG_CHECKING([for aix <ctype>])
364 AC_TRY_COMPILE([#include <ctype.h>],
365 [int
366 foo (int a)
367 { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
368 + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
369 + _VALC('a') + _IS('c', 0);}], \
370 ctype_aix=yes, ctype_aix=no)
371 AC_MSG_RESULT($ctype_aix)
372 if test $ctype_aix = "yes"; then
373 ctype_include_dir="config/aix"
374 ctype_default=no
375 fi
376 fi
377
378 dnl Test for <ctype> functionality -- newlib
379 if test $ctype_default = "yes"; then
380 AC_MSG_CHECKING([for newlib <ctype>])
381 AC_TRY_COMPILE([#include <ctype.h>],
382 [int
383 foo (int a)
384 { return _U + _L + _N + _S + _P + _C + _X + _B \
385 + _ctype_[a];}], \
386 ctype_newlib=yes, ctype_newlib=no)
387 AC_MSG_RESULT($ctype_newlib)
388 if test $ctype_newlib = "yes"; then
389 ctype_include_dir="config/newlib"
390 ctype_default=no
391 fi
392 fi
393
394 if test $ctype_default = "yes"; then
395 ctype_include_dir="config/generic"
396 AC_MSG_WARN("Using default ctype headers.")
397 fi
398 AC_SUBST(ctype_include_dir)
399 ])
400 ])
401
402
403 dnl
404 dnl Check to see what the underlying c library or math library is like.
405 dnl
406 dnl Define HAVE_CARGF etc if "cargf" is found.
407 dnl
408 dnl GLIBCPP_CHECK_MATH_SUPPORT
409 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
410 AC_CHECK_LIB(m, sin, libm="-lm")
411 save_LIBS="$LIBS"
412 LIBS="$LIBS $libm"
413
414 dnl Check for complex versions of math functions of platform.
415 AC_CHECK_HEADERS([complex.h])
416 AC_REPLACE_MATHFUNCS(ccos ccosf ccosh ccoshf cexp cexpf c_log c_logf \
417 clog10 clog10f cpow cpowf csin csinf csinh csinhf csqrt csqrtf \
418 ctan ctanf ctanh ctanhf \
419 carg cargf nan hypot hypotf atan2f expf copysignf)
420
421 dnl We compile the long double complex functions only if the function
422 dnl provides the non-complex long double functions.
423 USE_LONG_DOUBLE=no
424 AC_CHECK_FUNC(copysignl,
425 USE_LONG_DOUBLE=yes
426 AC_REPLACE_MATHFUNCS(ccoshl ccosl cexpl cpowl csinhl csinl \
427 csqrtl ctanhl ctanl cargl hypotl signbitl c_logl clog10l))
428 AC_SUBST(USE_LONG_DOUBLE)
429
430 dnl Check to see if basic C math functions have faster float versions.
431 AC_CHECK_FUNCS(modf isnan isnanf isnanl isinf isinff isinfl copysign \
432 copysignl cosf coshf logf log10f powf sinf sinhf sqrtf tanf tanhf \
433 strtof strtold fabsf sincos sincosf sincosl finite finite fqfinite \
434 fpclass qfpclass)
435
436 #Some runtimes have these functions with a preceding underscore. Please
437 # keep this sync'd with the one above. And if you add any new symbol,
438 # please add the corresponding block in the @BOTTOM@ section of
439 # acconfig.h.
440 AC_CHECK_FUNCS(_modf _isnan _isnanf _isnanl _isinf _isinff _isinfl _copysign \
441 _copysignl _cosf _coshf _logf _log10f _powf _sinf _sinhf _sqrtf _tanf _tanhf \
442 _strtof _strtold _fabsf _sincos _sincosf _sincosl _finite _finitef _qfinite \
443 _fpclass _qfpclass)
444
445 LIBS="$save_LIBS"
446 ])
447
448
449 dnl
450 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
451 dnl
452 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
453 dnl Define _GLIBCPP_NEED_MBSTATE_T if mbstate_t is not in wchar.h
454 dnl Define _GLIBCPP_HAS_WCHAR_MIN_MAX if WCHAR_MIN, WCHAR_MAX in wchar.h
455 dnl
456 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
457 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
458 AC_CHECK_HEADER(wchar.h,[
459 dnl Test wchar.h for mbstate_t, which is needed for char_traits and others.
460 AC_MSG_CHECKING([for native mbstate_t])
461 AC_TRY_COMPILE([#include <wchar.h>],
462 [mbstate_t teststate;],
463 use_native_mbstatet=yes, use_native_mbstatet=no)
464 AC_MSG_RESULT($use_native_mbstatet)
465 if test $use_native_mbstatet = "no"; then
466 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
467 fi
468
469 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
470 dnl numeric_limits can instantiate type_traits<wchar_t>
471 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
472 AC_TRY_COMPILE([#include <wchar.h>],
473 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
474 has_wchar_minmax=yes, has_wchar_minmax=no)
475 AC_MSG_RESULT($has_wchar_minmax)
476 if test $has_wchar_minmax = "yes"; then
477 AC_DEFINE(_GLIBCPP_HAS_WCHAR_MIN_MAX)
478 fi
479
480 # Test wchar.h for WEOF, which is what we use to determine whether
481 # to specialize for wchar_t or not.
482 AC_MSG_CHECKING([for WEOF])
483 AC_TRY_COMPILE([
484 #include <wchar.h>
485 #include <stddef.h>],
486 [wint_t i = WEOF;],
487 has_weof=yes, has_weof=no)
488 AC_MSG_RESULT($has_weof)
489
490 dnl Tests for wide character functions.
491 AC_REPLACE_STRINGFUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset)
492 AC_SUBST(libinst_wstring_la)
493
494 AC_MSG_CHECKING([for wide character support])
495 if test $has_weof = "yes" && test $has_wchar_minmax = "yes"; then
496 libinst_wstring_la="libinst-wstring.la"
497 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
498 AC_MSG_RESULT(ok)
499 else
500 libinst_wstring_la=""
501 AC_MSG_RESULT("not specializing for wchar_t")
502 fi
503 ],[
504 AC_MSG_WARN([<wchar.h> not found])
505 AC_DEFINE(_GLIBCPP_NEED_MBSTATE_T)
506 ])
507 ])
508
509
510 dnl
511 dnl Check to see if this version of GNU C++ is afflicted by bugs in
512 dnl __complex__ float support.
513 dnl
514 dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
515 dnl
516 dnl GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT
517 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_FLOAT_SUPPORT, [
518 AC_REQUIRE([AC_PROG_CXX])
519 AC_MSG_CHECKING([for GNU C++ __complex__ float support])
520 AC_CACHE_VAL(glibcpp_cv_float_complex, [
521 AC_LANG_SAVE
522 AC_LANG_CPLUSPLUS
523 rm -f conftest.h
524 cat > conftest.h <<EOB
525 //
526 // Check for buggy __complex__ that causes ICE in most versions of egcs
527 // and gcc-2.95.x on certain platforms (eg., x86-win32).
528 //
529 // See http://egcs.cygnus.com/ml/gcc-bugs/1999-07/msg00845.html for
530 // more info on the bug itself.
531 //
532 struct
533 float_complex
534 {
535 __complex__ float m_value;
536 float_complex (float = 0.0f, float = 0.0f);
537 float_complex (__complex__ float val) : m_value (val) {}
538 float_complex foo (const float_complex &val)
539 { return float_complex (~val.m_value); }
540 };
541 EOB
542 AC_TRY_COMPILE([#include "conftest.h"], ,
543 glibcpp_cv_float_complex=ok,
544 glibcpp_cv_float_complex=buggy
545 )
546 AC_LANG_RESTORE
547 ])
548 AC_MSG_RESULT($glibcpp_cv_float_complex)
549 if test $glibcpp_cv_float_complex = buggy; then
550 AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
551 fi
552 ])
553
554
555 dnl
556 dnl
557 dnl Check to see if this version of GNU C++ is afflicted by bugs in
558 dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
559 dnl gcc-2.95.x when using the library, unless we define the default copy
560 dnl ctor in the specializations of complex<>.
561 dnl
562 dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
563 dnl
564 dnl GLIBCPP_CHECK_COMPLEX_SUPPORT
565 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_SUPPORT, [
566 AC_REQUIRE([AC_PROG_CXX])
567 AC_MSG_CHECKING([for GNU C++ __complex__ support])
568 AC_CACHE_VAL(glibcpp_cv_complex, [
569 AC_LANG_SAVE
570 AC_LANG_CPLUSPLUS
571 AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
572 dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
573 [ dcomplex x; f(x); ],
574 glibcpp_cv_complex=ok,
575 glibcpp_cv_complex=buggy
576 )
577 AC_LANG_RESTORE
578 ])
579 AC_MSG_RESULT($glibcpp_cv_complex)
580 if test $glibcpp_cv_complex = buggy; then
581 AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
582 fi
583 ])
584
585
586 dnl
587 dnl Check for certain special build configurations.
588 dnl
589 dnl GLIBCPP_ENABLE_DEBUG
590 dnl --enable-debug sets '-ggdb -O0'.
591 dnl --disable-debug sets '-g' and whatever optimization options the
592 dnl compiler can handle.
593 dnl + Perhaps --enable-maintainer-mode should automatically turn this on?
594 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
595 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
596 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
597 dnl defaults to `no'.
598 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
599 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
600 AC_ARG_ENABLE(debug,
601 changequote(<<, >>)dnl
602 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
603 changequote([, ])dnl
604 [case "$enableval" in
605 yes) enable_debug=yes ;;
606 no) enable_debug=no ;;
607 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
608 esac],
609 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
610 dnl Option parsed, now set things appropriately
611 case "$enable_debug" in
612 yes)
613 DEBUGFLAGS='-O0 -ggdb'
614 ;;
615 no)
616 DEBUGFLAGS='-g'
617 ;;
618 esac
619 AC_SUBST(DEBUGFLAGS)
620 ])
621
622
623 dnl
624 dnl Check for certain special build configurations.
625 dnl
626 dnl GLIBCPP_ENABLE_NAMESPACES
627 dnl --enable-namespaces sets '-fhonor-std' and defines _GLIBCPP_USE_NAMESPACES
628 dnl --disable-namespaces sets '-fno-honor-std' (the macro should be
629 dnl undefined by default in whatever.h.in).
630 dnl + Eventually, this will go away.
631 dnl + Usage: GLIBCPP_ENABLE_NAMESPACES[(DEFAULT)]
632 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
633 dnl defaults to `no'.
634 AC_DEFUN(GLIBCPP_ENABLE_NAMESPACES, [dnl
635 define([GLIBCPP_ENABLE_NAMESPACES_DEFAULT], ifelse($1, yes, yes, no))dnl
636 AC_ARG_ENABLE(namespaces,
637 changequote(<<, >>)dnl
638 << --enable-namespaces turns on 'std' [default=>>GLIBCPP_ENABLE_NAMESPACES_DEFAULT],
639 changequote([, ])dnl
640 [case "$enableval" in
641 yes) enable_namespaces=yes ;;
642 no) enable_namespaces=no ;;
643 *) AC_MSG_ERROR([Unknown argument to enable/disable namespaces]) ;;
644 esac],
645 enable_namespaces=GLIBCPP_ENABLE_NAMESPACES_DEFAULT)dnl
646 dnl Option parsed, now set things appropriately
647 case "$enable_namespaces" in
648 yes) NAMESPACES='-fhonor-std'
649 AC_DEFINE(_GLIBCPP_USE_NAMESPACES)
650 ;;
651 no) NAMESPACES='-fno-honor-std'
652 ;;
653 esac
654 AC_SUBST(NAMESPACES)
655 ])
656
657
658 dnl
659 dnl Check for instructions to automatically rebuild libgcc.a. Requires,
660 dnl of course, the location of the gcc objdir. Note that if --disable-
661 dnl namespaces is in effect, rebuilding libgcc.a is an expensive no-op.
662 dnl
663 dnl GLIBCPP_ENABLE_RELIBGCC
664 dnl --enable-libgcc-rebuild=/absolute/path/to/gcc/objdir sets GCC_OBJDIR
665 dnl (presumably in the top-level Makefile) to /absol.../objdir
666 dnl --disable-libgcc-rebuild will not touch libgcc.a at all (maybe print
667 dnl a warning if this is given along with --enable-namespaces), by
668 dnl setting GCC_OBJDIR to `no'.
669 dnl + Doing this by default is going to be interesting. What default
670 dnl "on" value can there be?
671 dnl + Usage: GLIBCPP_ENABLE_RELIBGCC[(DEFAULT)]
672 dnl The default path should be ../.. if bundled with GCC source.
673 dnl If ommitted, it defaults to `no'.
674 dnl
675 AC_DEFUN(GLIBCPP_ENABLE_RELIBGCC, [dnl
676 define([GLIBCPP_ENABLE_RELIBGCC_DEFAULT], ifelse($1,, no, $1))dnl
677 AC_ARG_ENABLE(libgcc-rebuild,
678 changequote(<<, >>)dnl
679 << --enable-libgcc-rebuild=DIR also rebuild libgcc.a; DIR is
680 the GCC objdir; see install.html>>,
681 changequote([, ])dnl
682 [case "$enableval" in
683 yes) AC_MSG_ERROR([--enable-libgcc-rebuild needs a pathname]) ;;
684 no) enable_libgcc_rebuild=no ;;
685 *) if test -d "$enableval" && test -d "${enableval}/gcc" && \
686 test -d "${enableval}/libiberty"
687 then
688 enable_libgcc_rebuild="$enableval"
689 else
690 AC_MSG_ERROR(["$enableval" does not appear to be the GCC objdir])
691 fi
692 ;;
693 esac],
694 enable_libgcc_rebuild=GLIBCPP_ENABLE_RELIBGCC_DEFAULT)dnl
695 GCC_OBJDIR="$enable_libgcc_rebuild"
696 AC_SUBST(GCC_OBJDIR)
697 ])
698
699
700 dnl
701 dnl Check for certain special build configurations.
702 dnl
703 dnl GLIBCPP_ENABLE_CSTDIO
704 dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
705 dnl
706 dnl default is libio
707 dnl
708 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
709 AC_MSG_CHECKING([for cstdio to use])
710 AC_ARG_ENABLE(cstdio,
711 [ --enable-cstdio enable GNU libio for target io package. (default)
712 --enable-cstdio=LIB use LIB target-speific io package.],
713 if test x$enable_cstdio = xno; then
714 enable_cstdio=libio
715 fi,
716 enable_cstdio=libio)
717
718 enable_cstdio_flag=$enable_cstdio
719
720 dnl Check if a valid thread package
721 case x${enable_cstdio_flag} in
722 xlibio | x | xno | xnone | xyes)
723 # default
724 CSTDIO_H=c_io_libio.h
725 CSTDIO_CC=c_io_libio.cc
726 AC_MSG_RESULT(libio)
727
728 # see if we are on a system with libio native (ie, linux)
729 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
730 if test $has_libio = "yes"; then
731 BUILD_LIBIO_INCLUDE=
732 need_libio=no
733 else
734 BUILD_LIBIO_INCLUDE='-I../libio'
735 need_libio=yes
736 fi
737 AC_SUBST(BUILD_LIBIO_INCLUDE)
738
739 # see if the _G_config.h header needs to be built.
740 # NB: This replaces the _G_CONFIG_H machinery in libio-v2
741 AC_CHECK_HEADER(_G_config.h, has_gconf_h=yes, has_gconf_h=no)
742 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO_CONFIG_H, test "$has_gconf_h" = no)
743 ;;
744 xwince)
745 CSTDIO_H=c_io_wince.h
746 CSTDIO_CC=c_io_wince.cc
747 AC_MSG_RESULT(wince)
748
749 need_libio=no
750 BUILD_LIBIO_INCLUDE=
751 AC_SUBST(BUILD_LIBIO_INCLUDE)
752 ;;
753 *)
754 echo "$enable_cstdio is an unknown io package" 1>&2
755 exit 1
756 ;;
757 esac
758 AC_SUBST(CSTDIO_H)
759 AC_SUBST(CSTDIO_CC)
760 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
761 ])
762
763
764 dnl
765 dnl Check for certain special build configurations.
766 dnl
767 dnl GLIBCPP_ENABLE_THREADS
768 dnl --enable-threads=posix sets config/threads-posix.h et. al.
769 dnl
770 dnl default is no threads
771 dnl
772 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
773 dnl Note this comes from the gcc/config.in and libjava/config.in
774 dnl Efforts should be made to keep this in sync.
775 AC_MSG_CHECKING([for threads package to use])
776 AC_ARG_ENABLE(threads,
777 [ --enable-threads enable thread usage for target GCC.
778 --enable-threads=LIB use LIB thread package for target GCC.],
779 if test x$enable_threads = xno; then
780 enable_threads=''
781 fi,
782 enable_threads='')
783
784 enable_threads_flag=$enable_threads
785
786 dnl Check if a valid thread package
787 case x${enable_threads_flag} in
788 x | xno | xnone)
789 # No threads
790 target_thread_file='single'
791 ;;
792 xyes)
793 # default
794 target_thread_file=''
795 ;;
796 xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
797 xsolaris | xwin32 | xdce | xvxworks)
798 target_thread_file=$enable_threads_flag
799 ;;
800 *)
801 echo "$enable_threads is an unknown thread package" 1>&2
802 exit 1
803 ;;
804 esac
805
806 dnl Check for thread package actually supported in libstdc++
807 case "$target_thread_file" in
808 no | none | single)
809 THREADS=none
810 ;;
811 posix | pthreads)
812 THREADS=posix
813 case "$host" in
814 *-*-linux*)
815 ;;
816 esac
817 ;;
818 decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
819 AC_MSG_ERROR(thread package $THREADS not yet supported)
820 ;;
821 *)
822 AC_MSG_ERROR($THREADS is an unknown thread package)
823 ;;
824 esac
825 AC_MSG_RESULT($THREADS)
826
827 THREADLIBS=
828 THREADINCS=
829 THREADDEPS=
830 THREADOBJS=
831 THREADH=
832 THREADSPEC=
833 case "$THREADS" in
834 posix)
835 AC_CHECK_HEADER(pthread.h, [have_pthread_h=yes], [have_pthread_h=])
836 THREADLIBS=-lpthread
837 THREADSPEC=-lpthread
838 dnl Not presently used
839 dnl THREADOBJS=threads-posix.lo
840 THREADH=threads-posix.h
841 ;;
842 none)
843 dnl Not presently used
844 dnl THREADOBJS=threads-no.lo
845 THREADH=threads-no.h
846 ;;
847 esac
848 AC_SUBST(THREADLIBS)
849 AC_SUBST(THREADINCS)
850 AC_SUBST(THREADDEPS)
851 AC_SUBST(THREADOBJS)
852 AC_SUBST(THREADSPEC)
853 ])
854
855
856 dnl
857 dnl Check for certain special build configurations.
858 dnl
859 dnl GLIBCPP_ENABLE_LONG_LONG
860 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
861 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
862 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
863 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
864 dnl defaults to `no'.
865 dnl
866 dnl GLIBCPP_ENABLE_LONG_LONG
867 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
868 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
869 AC_ARG_ENABLE(long-long,
870 changequote(<<, >>)dnl
871 <<--enable-long_long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
872 changequote([, ])dnl
873 [case "$enableval" in
874 yes) enable_long_long=yes ;;
875 no) enable_long_long=no ;;
876 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
877 esac],
878 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
879 dnl Option parsed, now set things appropriately
880 case "$enable_long_long" in
881 yes) AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
882 ;;
883 esac
884 ])
885
886
887
888
889
890
891
892
893
894
895
896
This page took 0.082142 seconds and 5 git commands to generate.