3 dnl GLIBCXX_CONDITIONAL (NAME, SHELL-TEST)
5 dnl Exactly like AM_CONDITIONAL, but delays evaluation of the test until the
6 dnl end of configure. This lets tested variables be reassigned, and the
7 dnl conditional will depend on the final state of the variable. For a simple
8 dnl example of why this is needed, see GLIBCXX_ENABLE_HOSTED.
10 m4_define([_m4_divert(glibcxx_diversion)], 8000)dnl
11 AC_DEFUN([GLIBCXX_CONDITIONAL], [dnl
12 m4_divert_text([glibcxx_diversion],dnl
13 AM_CONDITIONAL([$1],[$2])
16 AC_DEFUN([GLIBCXX_EVALUATE_CONDITIONALS], [m4_undivert([glibcxx_diversion])])dnl
20 dnl Check to see what architecture and operating system we are compiling
21 dnl for. Also, if architecture- or OS-specific flags are required for
22 dnl compilation, pick them up here.
24 AC_DEFUN([GLIBCXX_CHECK_HOST], [
25 . $glibcxx_srcdir/configure.host
26 AC_MSG_NOTICE([CPU config directory is $cpu_include_dir])
27 AC_MSG_NOTICE([OS config directory is $os_include_dir])
31 dnl Initialize the rest of the library configury. At this point we have
32 dnl variables like $host.
37 dnl glibcxx_builddir (absolute path)
38 dnl glibcxx_srcdir (absolute path)
39 dnl toplevel_srcdir (absolute path)
42 dnl with_target_subdir
44 dnl - the variables in GLIBCXX_CHECK_HOST / configure.host
45 dnl - default settings for all AM_CONFITIONAL test variables
46 dnl - lots of tools, like CC and CXX
48 AC_DEFUN([GLIBCXX_CONFIGURE], [
49 # Keep these sync'd with the list in Makefile.am. The first provides an
50 # expandable list at autoconf time; the second provides an expandable list
51 # (i.e., shell variable) at configure time.
52 m4_define([glibcxx_SUBDIRS],[include libsupc++ python src doc po testsuite])
53 SUBDIRS='glibcxx_SUBDIRS'
55 # These need to be absolute paths, yet at the same time need to
56 # canonicalize only relative paths, because then amd will not unmount
57 # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
58 glibcxx_builddir=`${PWDCMD-pwd}`
60 [\\/$]* | ?:[\\/]*) glibcxx_srcdir=${srcdir} ;;
61 *) glibcxx_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
63 toplevel_srcdir=${glibcxx_srcdir}/..
64 AC_SUBST(glibcxx_builddir)
65 AC_SUBST(glibcxx_srcdir)
66 AC_SUBST(toplevel_srcdir)
68 # We use these options to decide which functions to include. They are
69 # set from the top level.
70 AC_ARG_WITH([target-subdir],
71 AC_HELP_STRING([--with-target-subdir=SUBDIR],
72 [configuring in a subdirectory]))
74 AC_ARG_WITH([cross-host],
75 AC_HELP_STRING([--with-cross-host=HOST],
76 [configuring with a cross compiler]))
79 AC_HELP_STRING([--with-newlib],
80 [assume newlib as a system C library]))
82 # Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't
83 # available). Uncomment the next line to force a particular method.
89 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
93 # Set up safe default values for all subsequent AM_CONDITIONAL tests
94 # which are themselves conditionally expanded.
95 ## (Right now, this only matters for enable_wchar_t, but nothing prevents
96 ## other macros from doing the same. This should be automated.) -pme
98 # Check for C library flavor since Linux platforms use different configuration
99 # directories depending on the C library in use.
100 AC_EGREP_CPP([_using_uclibc], [
105 ], uclibc=yes, uclibc=no)
107 AC_EGREP_CPP([_using_bionic], [
112 ], bionic=yes, bionic=no)
114 # Find platform-specific directories containing configuration info.
115 # Also possibly modify flags used elsewhere, as needed by the platform.
121 dnl Tests for newer compiler features, or features that are present in newer
122 dnl compiler versions but not older compiler versions still in use, should
126 dnl WERROR='-Werror' if requested and possible; g++'s that lack the
127 dnl new inlining code or the new system_header pragma will die on -Werror.
128 dnl Leave it out by default and use maint-mode to use it.
129 dnl SECTION_FLAGS='-ffunction-sections -fdata-sections' if
130 dnl compiler supports it and the user has not requested debug mode.
132 AC_DEFUN([GLIBCXX_CHECK_COMPILER_FEATURES], [
133 # All these tests are for C++; save the language and the compiler flags.
134 # The CXXFLAGS thing is suspicious, but based on similar bits previously
135 # found in GLIBCXX_CONFIGURE.
138 ac_test_CXXFLAGS="${CXXFLAGS+set}"
139 ac_save_CXXFLAGS="$CXXFLAGS"
141 # Check for maintainer-mode bits.
142 if test x"$USE_MAINTAINER_MODE" = xno; then
148 # Check for -ffunction-sections -fdata-sections
149 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
150 CXXFLAGS='-g -Werror -ffunction-sections -fdata-sections'
151 AC_TRY_COMPILE([int foo; void bar() { };],, [ac_fdsections=yes], [ac_fdsections=no])
152 if test "$ac_test_CXXFLAGS" = set; then
153 CXXFLAGS="$ac_save_CXXFLAGS"
155 # this is the suspicious part
158 if test x"$ac_fdsections" = x"yes"; then
159 SECTION_FLAGS='-ffunction-sections -fdata-sections'
161 AC_MSG_RESULT($ac_fdsections)
165 AC_SUBST(SECTION_FLAGS)
170 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
171 dnl the native linker is in use, all variables will be defined to something
172 dnl safe (like an empty string).
175 dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible
176 dnl OPT_LDFLAGS='-Wl,-O1' and '-z,relro' if possible
177 dnl LD (as a side effect of testing)
180 dnl glibcxx_ld_is_gold (set to "no" or "yes")
181 dnl glibcxx_gnu_ld_version (possibly)
183 dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
184 dnl set glibcxx_gnu_ld_version to 12345. Zeros cause problems.
186 AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [
187 # If we're not using GNU ld, then there's no point in even trying these
188 # tests. Check for that first. We should have already tested for gld
189 # by now (in libtool), but require it now just to be safe...
190 test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
191 test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
192 AC_REQUIRE([AC_PROG_LD])
193 AC_REQUIRE([AC_PROG_AWK])
195 # The name set by libtool depends on the version of libtool. Shame on us
196 # for depending on an impl detail, but c'est la vie. Older versions used
197 # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
198 # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
199 # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
200 # set (hence we're using an older libtool), then set it.
201 if test x${with_gnu_ld+set} != xset; then
202 if test x${ac_cv_prog_gnu_ld+set} != xset; then
203 # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
206 with_gnu_ld=$ac_cv_prog_gnu_ld
210 # Start by getting the version number. I think the libtool test already
211 # does some of this, but throws away the result.
212 glibcxx_ld_is_gold=no
213 if test x"$with_gnu_ld" = x"yes"; then
214 AC_MSG_CHECKING([for ld version])
216 if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; then
217 glibcxx_ld_is_gold=yes
219 ldver=`$LD --version 2>/dev/null |
220 sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
222 glibcxx_gnu_ld_version=`echo $ldver | \
223 $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
224 AC_MSG_RESULT($glibcxx_gnu_ld_version)
228 glibcxx_have_gc_sections=no
229 if test "$glibcxx_ld_is_gold" = "yes"; then
230 if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then
231 glibcxx_have_gc_sections=yes
234 glibcxx_gcsections_min_ld=21602
235 if test x"$with_gnu_ld" = x"yes" &&
236 test $glibcxx_gnu_ld_version -gt $glibcxx_gcsections_min_ld ; then
237 glibcxx_have_gc_sections=yes
240 if test "$glibcxx_have_gc_sections" = "yes"; then
241 # Sufficiently young GNU ld it is! Joy and bunny rabbits!
242 # NB: This flag only works reliably after 2.16.1. Configure tests
243 # for this are difficult, so hard wire a value that should work.
245 ac_test_CFLAGS="${CFLAGS+set}"
246 ac_save_CFLAGS="$CFLAGS"
247 CFLAGS='-Wl,--gc-sections'
249 # Check for -Wl,--gc-sections
250 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
251 AC_TRY_LINK([ int one(void) { return 1; }
252 int two(void) { return 2; }
253 ], [ two(); ] , [ac_gcsections=yes], [ac_gcsections=no])
254 if test "$ac_gcsections" = "yes"; then
257 if $CC -c conftest.c; then
258 if $LD --gc-sections -o conftest conftest.o 2>&1 | \
259 grep "Warning: gc-sections option ignored" > /dev/null; then
263 rm -f conftest.c conftest.o conftest
265 if test "$ac_gcsections" = "yes"; then
266 SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
268 AC_MSG_RESULT($ac_gcsections)
270 if test "$ac_test_CFLAGS" = set; then
271 CFLAGS="$ac_save_CFLAGS"
273 # this is the suspicious part
279 # Note this is only for shared objects.
281 if test x"$with_gnu_ld" = x"yes"; then
282 AC_MSG_CHECKING([for ld that supports -Wl,-z,relro])
283 cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"`
284 if test -n "$cxx_z_relo"; then
285 OPT_LDFLAGS="-Wl,-z,relro"
288 AC_MSG_RESULT($ac_ld_relro)
291 # Set linker optimization flags.
292 if test x"$with_gnu_ld" = x"yes"; then
293 OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
296 AC_SUBST(SECTION_LDFLAGS)
297 AC_SUBST(OPT_LDFLAGS)
302 dnl Check for headers for, and arguments to, the setrlimit() function.
303 dnl Used only in testsuite_hooks.h. Called from GLIBCXX_CONFIGURE_TESTSUITE.
306 dnl _GLIBCXX_RES_LIMITS if we can set artificial resource limits
307 dnl various HAVE_LIMIT_* for individual limit names
309 AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT_ancilliary], [
310 AC_MSG_CHECKING([for RLIMIT_$1])
313 #include <sys/time.h>
314 #include <sys/resource.h>
316 [ int f = RLIMIT_$1 ; ],
317 [glibcxx_mresult=1], [glibcxx_mresult=0])
318 AC_DEFINE_UNQUOTED(HAVE_LIMIT_$1, $glibcxx_mresult,
319 [Only used in build directory testsuite_hooks.h.])
320 if test $glibcxx_mresult = 1 ; then res=yes ; else res=no ; fi
324 AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT], [
325 setrlimit_have_headers=yes
326 AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h,
328 [setrlimit_have_headers=no])
329 # If don't have the headers, then we can't run the tests now, and we
330 # won't be seeing any of these during testsuite compilation.
331 if test $setrlimit_have_headers = yes; then
332 # Can't do these in a loop, else the resulting syntax is wrong.
333 GLIBCXX_CHECK_SETRLIMIT_ancilliary(DATA)
334 GLIBCXX_CHECK_SETRLIMIT_ancilliary(RSS)
335 GLIBCXX_CHECK_SETRLIMIT_ancilliary(VMEM)
336 GLIBCXX_CHECK_SETRLIMIT_ancilliary(AS)
337 GLIBCXX_CHECK_SETRLIMIT_ancilliary(FSIZE)
339 # Check for rlimit, setrlimit.
340 AC_CACHE_VAL(glibcxx_cv_setrlimit, [
343 #include <sys/time.h>
344 #include <sys/resource.h>
348 [glibcxx_cv_setrlimit=yes], [glibcxx_cv_setrlimit=no])
352 AC_MSG_CHECKING([for testsuite resource limits support])
353 if test $setrlimit_have_headers = yes && test $glibcxx_cv_setrlimit = yes; then
355 AC_DEFINE(_GLIBCXX_RES_LIMITS, 1,
356 [Define if using setrlimit to set resource limits during
361 AC_MSG_RESULT($ac_res_limits)
366 dnl Check whether S_ISREG (Posix) or S_IFREG is available in <sys/stat.h>.
367 dnl Define HAVE_S_ISREG / HAVE_S_IFREG appropriately.
369 AC_DEFUN([GLIBCXX_CHECK_S_ISREG_OR_S_IFREG], [
373 ac_save_CXXFLAGS="$CXXFLAGS"
374 CXXFLAGS="$CXXFLAGS -fno-exceptions"
376 AC_MSG_CHECKING([for S_ISREG or S_IFREG])
377 AC_CACHE_VAL(glibcxx_cv_S_ISREG, [
378 GCC_TRY_COMPILE_OR_LINK(
379 [#include <sys/stat.h>],
382 S_ISREG(buffer.st_mode);],
383 [glibcxx_cv_S_ISREG=yes],
384 [glibcxx_cv_S_ISREG=no])
386 AC_CACHE_VAL(glibcxx_cv_S_IFREG, [
387 GCC_TRY_COMPILE_OR_LINK(
388 [#include <sys/stat.h>],
391 S_IFREG & buffer.st_mode;],
392 [glibcxx_cv_S_IFREG=yes],
393 [glibcxx_cv_S_IFREG=no])
396 if test $glibcxx_cv_S_ISREG = yes; then
397 AC_DEFINE(HAVE_S_ISREG, 1,
398 [Define if S_IFREG is available in <sys/stat.h>.])
400 elif test $glibcxx_cv_S_IFREG = yes; then
401 AC_DEFINE(HAVE_S_IFREG, 1,
402 [Define if S_IFREG is available in <sys/stat.h>.])
407 CXXFLAGS="$ac_save_CXXFLAGS"
413 dnl Check whether poll is available in <poll.h>, and define HAVE_POLL.
415 AC_DEFUN([GLIBCXX_CHECK_POLL], [
419 ac_save_CXXFLAGS="$CXXFLAGS"
420 CXXFLAGS="$CXXFLAGS -fno-exceptions"
422 AC_MSG_CHECKING([for poll])
423 AC_CACHE_VAL(glibcxx_cv_POLL, [
424 GCC_TRY_COMPILE_OR_LINK(
426 [struct pollfd pfd[1];
427 pfd[0].events = POLLIN;
429 [glibcxx_cv_POLL=yes],
430 [glibcxx_cv_POLL=no])
432 if test $glibcxx_cv_POLL = yes; then
433 AC_DEFINE(HAVE_POLL, 1, [Define if poll is available in <poll.h>.])
435 AC_MSG_RESULT($glibcxx_cv_POLL)
437 CXXFLAGS="$ac_save_CXXFLAGS"
443 dnl Check whether writev is available in <sys/uio.h>, and define HAVE_WRITEV.
445 AC_DEFUN([GLIBCXX_CHECK_WRITEV], [
449 ac_save_CXXFLAGS="$CXXFLAGS"
450 CXXFLAGS="$CXXFLAGS -fno-exceptions"
452 AC_MSG_CHECKING([for writev])
453 AC_CACHE_VAL(glibcxx_cv_WRITEV, [
454 GCC_TRY_COMPILE_OR_LINK(
455 [#include <sys/uio.h>],
456 [struct iovec iov[2];
458 [glibcxx_cv_WRITEV=yes],
459 [glibcxx_cv_WRITEV=no])
461 if test $glibcxx_cv_WRITEV = yes; then
462 AC_DEFINE(HAVE_WRITEV, 1, [Define if writev is available in <sys/uio.h>.])
464 AC_MSG_RESULT($glibcxx_cv_WRITEV)
466 CXXFLAGS="$ac_save_CXXFLAGS"
472 dnl Check whether int64_t is available in <stdint.h>, and define HAVE_INT64_T.
473 dnl Also check whether int64_t is actually a typedef to long or long long.
475 AC_DEFUN([GLIBCXX_CHECK_INT64_T], [
480 AC_MSG_CHECKING([for int64_t])
481 AC_CACHE_VAL(glibcxx_cv_INT64_T, [
483 [#include <stdint.h>],
485 [glibcxx_cv_INT64_T=yes],
486 [glibcxx_cv_INT64_T=no])
489 if test $glibcxx_cv_INT64_T = yes; then
490 AC_DEFINE(HAVE_INT64_T, 1, [Define if int64_t is available in <stdint.h>.])
491 AC_MSG_RESULT($glibcxx_cv_INT64_T)
493 AC_MSG_CHECKING([for int64_t as long])
494 AC_CACHE_VAL(glibcxx_cv_int64_t_long, [
497 template<typename, typename> struct same { enum { value = -1 }; };
498 template<typename Tp> struct same<Tp, Tp> { enum { value = 1 }; };
499 int array[same<int64_t, long>::value];], [],
500 [glibcxx_cv_int64_t_long=yes], [glibcxx_cv_int64_t_long=no])
503 if test $glibcxx_cv_int64_t_long = yes; then
504 AC_DEFINE(HAVE_INT64_T_LONG, 1, [Define if int64_t is a long.])
505 AC_MSG_RESULT($glibcxx_cv_int64_t_long)
508 AC_MSG_CHECKING([for int64_t as long long])
509 AC_CACHE_VAL(glibcxx_cv_int64_t_long_long, [
512 template<typename, typename> struct same { enum { value = -1 }; };
513 template<typename Tp> struct same<Tp, Tp> { enum { value = 1 }; };
514 int array[same<int64_t, long long>::value];], [],
515 [glibcxx_cv_int64_t_long_long=yes], [glibcxx_cv_int64_t_long_long=no])
518 if test $glibcxx_cv_int64_t_long_long = yes; then
519 AC_DEFINE(HAVE_INT64_T_LONG_LONG, 1, [Define if int64_t is a long long.])
520 AC_MSG_RESULT($glibcxx_cv_int64_t_long_long)
529 dnl Check whether LFS support is available.
531 AC_DEFUN([GLIBCXX_CHECK_LFS], [
534 ac_save_CXXFLAGS="$CXXFLAGS"
535 CXXFLAGS="$CXXFLAGS -fno-exceptions"
536 AC_MSG_CHECKING([for LFS support])
537 AC_CACHE_VAL(glibcxx_cv_LFS, [
538 GCC_TRY_COMPILE_OR_LINK(
541 #include <sys/stat.h>
545 fseeko64(fp, 0, SEEK_CUR);
547 lseek64(1, 0, SEEK_CUR);
550 [glibcxx_cv_LFS=yes],
553 if test $glibcxx_cv_LFS = yes; then
554 AC_DEFINE(_GLIBCXX_USE_LFS, 1, [Define if LFS support is available.])
556 AC_MSG_RESULT($glibcxx_cv_LFS)
557 CXXFLAGS="$ac_save_CXXFLAGS"
563 dnl Check for whether a fully dynamic basic_string implementation should
564 dnl be turned on, that does not put empty objects in per-process static
565 dnl memory (mostly useful together with shared memory allocators, see PR
566 dnl libstdc++/16612 for details).
568 dnl --enable-fully-dynamic-string defines _GLIBCXX_FULLY_DYNAMIC_STRING
569 dnl --disable-fully-dynamic-string leaves _GLIBCXX_FULLY_DYNAMIC_STRING undefined
570 dnl + Usage: GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING[(DEFAULT)]
571 dnl Where DEFAULT is either `yes' or `no'.
573 AC_DEFUN([GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING], [
574 GLIBCXX_ENABLE(fully-dynamic-string,$1,,[do not put empty strings in per-process static memory])
575 if test $enable_fully_dynamic_string = yes; then
576 AC_DEFINE(_GLIBCXX_FULLY_DYNAMIC_STRING, 1,
577 [Define if a fully dynamic basic_string is wanted.])
583 dnl Does any necessary configuration of the testsuite directory. Generates
584 dnl the testsuite_hooks.h header.
586 dnl GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE must be done before this.
590 dnl GLIBCXX_TEST_WCHAR_T
591 dnl GLIBCXX_TEST_THREAD
595 AC_DEFUN([GLIBCXX_CONFIGURE_TESTSUITE], [
596 if $GLIBCXX_IS_NATIVE ; then
597 # Do checks for resource limit functions.
598 GLIBCXX_CHECK_SETRLIMIT
600 # Look for setenv, so that extended locale tests can be performed.
601 GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv)
604 if $GLIBCXX_IS_NATIVE && test $is_hosted = yes &&
605 test $enable_symvers != no; then
608 enable_abi_check=no ;;
610 enable_abi_check=yes ;;
613 # Only build this as native, since automake does not understand
618 # Export file names for ABI checking.
619 baseline_dir="$glibcxx_srcdir/config/abi/post/${abi_baseline_pair}"
620 AC_SUBST(baseline_dir)
625 dnl Set up *_INCLUDES variables for all sundry Makefile.am's.
629 dnl TOPLEVEL_INCLUDES
631 AC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [
632 # Used for every C++ compile we perform.
634 -I$glibcxx_builddir/include/$host_alias \
635 -I$glibcxx_builddir/include \
636 -I$glibcxx_srcdir/libsupc++"
638 # For Canadian crosses, pick this up too.
639 if test $CANADIAN = yes; then
640 GLIBCXX_INCLUDES="$GLIBCXX_INCLUDES -I\${includedir}"
643 # Stuff in the actual top level. Currently only used by libsupc++ to
644 # get unwind* headers from the gcc dir.
645 #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include'
646 TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc'
648 # Now, export this to all the little Makefiles....
649 AC_SUBST(GLIBCXX_INCLUDES)
650 AC_SUBST(TOPLEVEL_INCLUDES)
655 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
656 dnl (SECTION_FLAGS is done under CHECK_COMPILER_FEATURES.)
659 dnl OPTIMIZE_CXXFLAGS
662 AC_DEFUN([GLIBCXX_EXPORT_FLAGS], [
663 # Optimization flags that are probably a good idea for thrill-seekers. Just
664 # uncomment the lines below and make, everything else is ready to go...
665 # Alternatively OPTIMIZE_CXXFLAGS can be set in configure.host.
666 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
667 AC_SUBST(OPTIMIZE_CXXFLAGS)
669 WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
675 dnl All installation directory information is determined here.
679 dnl glibcxx_prefixdir
680 dnl glibcxx_toolexecdir
681 dnl glibcxx_toolexeclibdir
683 dnl Assumes cross_compiling bits already done, and with_cross_host in
686 dnl This logic must match gcc/configure.ac's setting of gcc_gxx_include_dir.
687 dnl config/gxx-include-dir.m4 must be kept consistant with this as well.
688 AC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [
689 glibcxx_toolexecdir=no
690 glibcxx_toolexeclibdir=no
691 glibcxx_prefixdir=$prefix
693 AC_MSG_CHECKING([for gxx-include-dir])
694 AC_ARG_WITH([gxx-include-dir],
695 AC_HELP_STRING([--with-gxx-include-dir=DIR],
696 [installation directory for include files]),
698 yes) AC_MSG_ERROR([Missing directory for --with-gxx-include-dir]) ;;
699 no) gxx_include_dir=no ;;
700 *) gxx_include_dir=$withval ;;
702 [gxx_include_dir=no])
703 AC_MSG_RESULT($gxx_include_dir)
705 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
706 AC_ARG_ENABLE([version-specific-runtime-libs],
707 AC_HELP_STRING([--enable-version-specific-runtime-libs],
708 [Specify that runtime libraries should be installed in a compiler-specific directory]),
709 [case "$enableval" in
710 yes) version_specific_libs=yes ;;
711 no) version_specific_libs=no ;;
712 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
714 [version_specific_libs=no])
715 AC_MSG_RESULT($version_specific_libs)
717 # Default case for install directory for include files.
718 if test $version_specific_libs = no && test $gxx_include_dir = no; then
719 gxx_include_dir='include/c++/${gcc_version}'
720 if test -n "$with_cross_host" &&
721 test x"$with_cross_host" != x"no"; then
722 gxx_include_dir='${prefix}/${target_alias}/'"$gxx_include_dir"
724 gxx_include_dir='${prefix}/'"$gxx_include_dir"
728 # Version-specific runtime libs processing.
729 if test $version_specific_libs = yes; then
730 # Need the gcc compiler version to know where to install libraries
731 # and header files if --enable-version-specific-runtime-libs option
732 # is selected. FIXME: these variables are misnamed, there are
733 # no executables installed in _toolexecdir or _toolexeclibdir.
734 if test x"$gxx_include_dir" = x"no"; then
735 gxx_include_dir='${libdir}/gcc/${host_alias}/${gcc_version}/include/c++'
737 glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
738 glibcxx_toolexeclibdir='${toolexecdir}/${gcc_version}$(MULTISUBDIR)'
741 # Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir
742 # Install a library built with a cross compiler in tooldir, not libdir.
743 if test x"$glibcxx_toolexecdir" = x"no"; then
744 if test -n "$with_cross_host" &&
745 test x"$with_cross_host" != x"no"; then
746 glibcxx_toolexecdir='${exec_prefix}/${host_alias}'
747 glibcxx_toolexeclibdir='${toolexecdir}/lib'
749 glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
750 glibcxx_toolexeclibdir='${libdir}'
752 multi_os_directory=`$CXX -print-multi-os-directory`
753 case $multi_os_directory in
754 .) ;; # Avoid trailing /.
755 *) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;;
759 AC_MSG_CHECKING([for install location])
760 AC_MSG_RESULT($gxx_include_dir)
762 AC_SUBST(glibcxx_prefixdir)
763 AC_SUBST(gxx_include_dir)
764 AC_SUBST(glibcxx_toolexecdir)
765 AC_SUBST(glibcxx_toolexeclibdir)
771 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
772 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
773 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
775 dnl See docs/html/17_intro/configury.html#enable for documentation.
777 m4_define([GLIBCXX_ENABLE],[dnl
778 m4_define([_g_switch],[--enable-$1])dnl
779 m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
780 AC_ARG_ENABLE($1,_g_help,
785 m4_bpatsubst([$5],[permit ])) ;;
786 *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
787 dnl Idea for future: generate a URL pointing to
788 dnl "onlinedocs/configopts.html#whatever"
795 *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
799 [enable_]m4_bpatsubst([$1],-,_)[=][$2])
800 m4_undefine([_g_switch])dnl
801 m4_undefine([_g_help])dnl
806 dnl Check for ISO/IEC 9899:1999 "C99" support.
808 dnl --enable-c99 defines _GLIBCXX_USE_C99
809 dnl --disable-c99 leaves _GLIBCXX_USE_C99 undefined
810 dnl + Usage: GLIBCXX_ENABLE_C99[(DEFAULT)]
811 dnl Where DEFAULT is either `yes' or `no'.
812 dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
814 AC_DEFUN([GLIBCXX_ENABLE_C99], [
815 GLIBCXX_ENABLE(c99,$1,,[turns on ISO/IEC 9899:1999 support])
817 if test x"$enable_c99" = x"yes"; then
822 # Use -std=c++98 because the default (-std=gnu++98) leaves __STRICT_ANSI__
823 # undefined and fake C99 facilities - like pre-standard snprintf - may be
824 # spuriously enabled.
825 # Long term, -std=c++0x could be even better, could manage to explicitely
826 # request C99 facilities to the underlying C headers.
827 ac_save_CXXFLAGS="$CXXFLAGS"
828 CXXFLAGS="$CXXFLAGS -std=c++98"
830 ac_save_gcc_no_link="$gcc_no_link"
832 if test x$gcc_no_link != xyes; then
833 # Use -fno-exceptions to that the C driver can link these tests without
834 # hitting undefined references to personality routines.
835 CXXFLAGS="$CXXFLAGS -fno-exceptions"
836 AC_CHECK_LIB(m, sin, [
839 # Use the default compile-only tests in GCC_TRY_COMPILE_OR_LINK
844 # Check for the existence of <math.h> functions used if C99 is enabled.
845 AC_MSG_CHECKING([for ISO C99 support in <math.h>])
846 AC_CACHE_VAL(glibcxx_cv_c99_math, [
847 GCC_TRY_COMPILE_OR_LINK(
849 volatile double d1, d2;
857 i = isgreater(d1, d2);
858 i = isgreaterequal(d1, d2);
860 i = islessequal(d1, d2);
861 i = islessgreater(d1, d2);
862 i = islessgreater(d1, d2);
863 i = isunordered(d1, d2);
864 ],[glibcxx_cv_c99_math=yes], [glibcxx_cv_c99_math=no])
866 AC_MSG_RESULT($glibcxx_cv_c99_math)
867 if test x"$glibcxx_cv_c99_math" = x"yes"; then
868 AC_DEFINE(_GLIBCXX_USE_C99_MATH, 1,
869 [Define if C99 functions or macros in <math.h> should be imported
870 in <cmath> in namespace std.])
873 # Check for the existence of <complex.h> complex math functions.
874 # This is necessary even though libstdc++ uses the builtin versions
875 # of these functions, because if the builtin cannot be used, a reference
876 # to the library function is emitted.
877 AC_CHECK_HEADERS(tgmath.h, ac_has_tgmath_h=yes, ac_has_tgmath_h=no)
878 AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no)
879 glibcxx_cv_c99_complex=no;
880 if test x"$ac_has_complex_h" = x"yes"; then
881 AC_MSG_CHECKING([for ISO C99 support in <complex.h>])
882 GCC_TRY_COMPILE_OR_LINK(
883 [#include <complex.h>
884 typedef __complex__ float float_type;
885 typedef __complex__ double double_type;
886 typedef __complex__ long double ld_type;
887 volatile float_type tmpf;
888 volatile double_type tmpd;
889 volatile ld_type tmpld;
892 volatile long double ld;],
904 tmpf = cpowf(tmpf, tmpf);
917 tmpd = cpow(tmpd, tmpd);
921 tmpld = ccosl(tmpld);
922 tmpld = ccoshl(tmpld);
923 tmpld = cexpl(tmpld);
924 tmpld = clogl(tmpld);
925 tmpld = csinl(tmpld);
926 tmpld = csinhl(tmpld);
927 tmpld = csqrtl(tmpld);
928 tmpld = ctanl(tmpld);
929 tmpld = ctanhl(tmpld);
930 tmpld = cpowl(tmpld, tmpld);
931 tmpld = cprojl(tmpld);
932 ],[glibcxx_cv_c99_complex=yes], [glibcxx_cv_c99_complex=no])
934 AC_MSG_RESULT($glibcxx_cv_c99_complex)
935 if test x"$glibcxx_cv_c99_complex" = x"yes"; then
936 AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX, 1,
937 [Define if C99 functions in <complex.h> should be used in
938 <complex>. Using compiler builtins for these functions requires
939 corresponding C99 library functions to be present.])
942 # Check for the existence in <stdio.h> of vscanf, et. al.
943 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
944 AC_CACHE_VAL(glibcxx_cv_c99_stdio, [
945 GCC_TRY_COMPILE_OR_LINK(
948 void foo(char* fmt, ...)
950 va_list args; va_start(args, fmt);
951 vfscanf(stderr, "%i", args);
953 vsnprintf(fmt, 0, "%i", args);
954 vsscanf(fmt, "%i", args);
956 [snprintf("12", 0, "%i");],
957 [glibcxx_cv_c99_stdio=yes], [glibcxx_cv_c99_stdio=no])
959 AC_MSG_RESULT($glibcxx_cv_c99_stdio)
961 # Check for the existence in <stdlib.h> of lldiv_t, et. al.
962 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
963 AC_CACHE_VAL(glibcxx_cv_c99_stdlib, [
964 GCC_TRY_COMPILE_OR_LINK(
967 volatile long double ld;
968 volatile unsigned long long ll;
971 f = strtof("gnu", &tmp);
972 ld = strtold("gnu", &tmp);
973 ll = strtoll("gnu", &tmp, 10);
974 ll = strtoull("gnu", &tmp, 10);
976 mydivt = lldiv(10,1);
981 ],[glibcxx_cv_c99_stdlib=yes], [glibcxx_cv_c99_stdlib=no])
983 AC_MSG_RESULT($glibcxx_cv_c99_stdlib)
985 # Check for the existence in <wchar.h> of wcstold, etc.
986 glibcxx_cv_c99_wchar=no;
987 if test x"$ac_has_wchar_h" = xyes &&
988 test x"$ac_has_wctype_h" = xyes; then
989 AC_MSG_CHECKING([for ISO C99 support in <wchar.h>])
990 AC_TRY_COMPILE([#include <wchar.h>
997 ],[],[glibcxx_cv_c99_wchar=yes], [glibcxx_cv_c99_wchar=no])
999 # Checks for wide character functions that may not be present.
1000 # Injection of these is wrapped with guard macros.
1001 # NB: only put functions here, instead of immediately above, if
1002 # absolutely necessary.
1003 AC_TRY_COMPILE([#include <wchar.h>
1004 namespace test { using ::vfwscanf; } ], [],
1005 [AC_DEFINE(HAVE_VFWSCANF,1,
1006 [Defined if vfwscanf exists.])],[])
1008 AC_TRY_COMPILE([#include <wchar.h>
1009 namespace test { using ::vswscanf; } ], [],
1010 [AC_DEFINE(HAVE_VSWSCANF,1,
1011 [Defined if vswscanf exists.])],[])
1013 AC_TRY_COMPILE([#include <wchar.h>
1014 namespace test { using ::vwscanf; } ], [],
1015 [AC_DEFINE(HAVE_VWSCANF,1,[Defined if vwscanf exists.])],[])
1017 AC_TRY_COMPILE([#include <wchar.h>
1018 namespace test { using ::wcstof; } ], [],
1019 [AC_DEFINE(HAVE_WCSTOF,1,[Defined if wcstof exists.])],[])
1021 AC_TRY_COMPILE([#include <wctype.h>],
1022 [ wint_t t; int i = iswblank(t);],
1023 [AC_DEFINE(HAVE_ISWBLANK,1,
1024 [Defined if iswblank exists.])],[])
1026 AC_MSG_RESULT($glibcxx_cv_c99_wchar)
1029 # Option parsed, now set things appropriately.
1030 if test x"$glibcxx_cv_c99_math" = x"no" ||
1031 test x"$glibcxx_cv_c99_complex" = x"no" ||
1032 test x"$glibcxx_cv_c99_stdio" = x"no" ||
1033 test x"$glibcxx_cv_c99_stdlib" = x"no" ||
1034 test x"$glibcxx_cv_c99_wchar" = x"no"; then
1037 AC_DEFINE(_GLIBCXX_USE_C99, 1,
1038 [Define if C99 functions or macros from <wchar.h>, <math.h>,
1039 <complex.h>, <stdio.h>, and <stdlib.h> can be used or exposed.])
1042 gcc_no_link="$ac_save_gcc_no_link"
1043 LIBS="$ac_save_LIBS"
1044 CXXFLAGS="$ac_save_CXXFLAGS"
1048 AC_MSG_CHECKING([for fully enabled ISO C99 support])
1049 AC_MSG_RESULT($enable_c99)
1054 dnl Check for clock_gettime, nanosleep and sched_yield, used in the
1055 dnl implementation of 20.8.5 [time.clock], and 30.2.2 [thread.thread.this]
1056 dnl in the current C++0x working draft.
1058 dnl --enable-libstdcxx-time
1059 dnl --enable-libstdcxx-time=yes
1060 dnl checks for the availability of monotonic and realtime clocks,
1061 dnl nanosleep and sched_yield in libc and libposix4 and, in case, links
1063 dnl --enable-libstdcxx-time=rt
1064 dnl also searches (and, in case, links) librt. Note that this is
1065 dnl not always desirable because, in glibc, for example, in turn it
1066 dnl triggers the linking of libpthread too, which activates locking,
1067 dnl a large overhead for single-thread programs.
1068 dnl --enable-libstdcxx-time=no
1069 dnl --disable-libstdcxx-time
1070 dnl disables the checks completely
1072 AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
1074 AC_MSG_CHECKING([for clock_gettime, nanosleep and sched_yield])
1075 GLIBCXX_ENABLE(libstdcxx-time,$1,[=KIND],
1076 [use KIND for check type],
1081 ac_save_CXXFLAGS="$CXXFLAGS"
1082 CXXFLAGS="$CXXFLAGS -fno-exceptions"
1083 ac_save_LIBS="$LIBS"
1085 ac_has_clock_monotonic=no
1086 ac_has_clock_realtime=no
1087 AC_MSG_RESULT($enable_libstdcxx_time)
1089 if test x"$enable_libstdcxx_time" != x"no"; then
1091 if test x"$enable_libstdcxx_time" = x"rt"; then
1092 AC_SEARCH_LIBS(clock_gettime, [rt posix4])
1093 AC_SEARCH_LIBS(nanosleep, [rt posix4])
1095 AC_SEARCH_LIBS(clock_gettime, [posix4])
1096 AC_SEARCH_LIBS(nanosleep, [posix4])
1099 case "$ac_cv_search_clock_gettime" in
1100 -l*) GLIBCXX_LIBS=$ac_cv_search_clock_gettime
1103 case "$ac_cv_search_nanosleep" in
1104 -l*) GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_nanosleep"
1108 AC_SEARCH_LIBS(sched_yield, [rt posix4])
1110 case "$ac_cv_search_sched_yield" in
1112 GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield"
1113 AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
1114 [ Defined if sched_yield is available. ])
1117 if test x"$enable_libstdcxx_time" = x"rt"; then
1118 GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield"
1119 AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
1120 [ Defined if sched_yield is available. ])
1124 AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
1125 [ Defined if sched_yield is available. ])
1129 AC_CHECK_HEADERS(unistd.h, ac_has_unistd_h=yes, ac_has_unistd_h=no)
1131 if test x"$ac_has_unistd_h" = x"yes"; then
1132 AC_MSG_CHECKING([for monotonic clock])
1134 [#include <unistd.h>
1137 [#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
1140 clock_gettime(CLOCK_MONOTONIC, &tp);
1141 ], [ac_has_clock_monotonic=yes], [ac_has_clock_monotonic=no])
1143 AC_MSG_RESULT($ac_has_clock_monotonic)
1145 AC_MSG_CHECKING([for realtime clock])
1147 [#include <unistd.h>
1150 [#if _POSIX_TIMERS > 0
1153 clock_gettime(CLOCK_REALTIME, &tp);
1154 ], [ac_has_clock_realtime=yes], [ac_has_clock_realtime=no])
1156 AC_MSG_RESULT($ac_has_clock_realtime)
1158 AC_MSG_CHECKING([for nanosleep])
1160 [#include <unistd.h>
1163 [#if _POSIX_TIMERS > 0
1167 ], [ac_has_nanosleep=yes], [ac_has_nanosleep=no])
1169 AC_MSG_RESULT($ac_has_nanosleep)
1173 if test x"$ac_has_clock_monotonic" = x"yes"; then
1174 AC_DEFINE(_GLIBCXX_USE_CLOCK_MONOTONIC, 1,
1175 [ Defined if clock_gettime has monotonic clock support. ])
1178 if test x"$ac_has_clock_realtime" = x"yes"; then
1179 AC_DEFINE(_GLIBCXX_USE_CLOCK_REALTIME, 1,
1180 [ Defined if clock_gettime has realtime clock support. ])
1183 if test x"$ac_has_nanosleep" = x"yes"; then
1184 AC_DEFINE(_GLIBCXX_USE_NANOSLEEP, 1,
1185 [ Defined if nanosleep is available. ])
1188 AC_SUBST(GLIBCXX_LIBS)
1190 CXXFLAGS="$ac_save_CXXFLAGS"
1191 LIBS="$ac_save_LIBS"
1196 dnl Check for gettimeofday, used in the implementation of 20.8.5
1197 dnl [time.clock] in the current C++0x working draft.
1199 AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [
1201 AC_MSG_CHECKING([for gettimeofday])
1205 ac_save_CXXFLAGS="$CXXFLAGS"
1206 CXXFLAGS="$CXXFLAGS -fno-exceptions"
1208 ac_has_gettimeofday=no;
1209 AC_CHECK_HEADERS(sys/time.h, ac_has_sys_time_h=yes, ac_has_sys_time_h=no)
1210 if test x"$ac_has_sys_time_h" = x"yes"; then
1211 AC_MSG_CHECKING([for gettimeofday])
1212 GCC_TRY_COMPILE_OR_LINK([#include <sys/time.h>],
1213 [timeval tv; gettimeofday(&tv, 0);],
1214 [ac_has_gettimeofday=yes], [ac_has_gettimeofday=no])
1216 AC_MSG_RESULT($ac_has_gettimeofday)
1219 if test x"$ac_has_gettimeofday" = x"yes"; then
1220 AC_DEFINE(_GLIBCXX_USE_GETTIMEOFDAY, 1,
1221 [ Defined if gettimeofday is available. ])
1224 CXXFLAGS="$ac_save_CXXFLAGS"
1229 dnl Check for ISO/IEC 9899:1999 "C99" support to ISO/IEC DTR 19768 "TR1"
1230 dnl facilities in Chapter 8, "C compatibility".
1232 AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
1237 # Use -std=c++98 because the default (-std=gnu++98) leaves __STRICT_ANSI__
1238 # undefined and fake C99 facilities may be spuriously enabled.
1239 ac_save_CXXFLAGS="$CXXFLAGS"
1240 CXXFLAGS="$CXXFLAGS -std=c++98"
1242 # Check for the existence of <complex.h> complex math functions used
1244 AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no)
1245 ac_c99_complex_tr1=no;
1246 if test x"$ac_has_complex_h" = x"yes"; then
1247 AC_MSG_CHECKING([for ISO C99 support to TR1 in <complex.h>])
1248 AC_TRY_COMPILE([#include <complex.h>],
1249 [typedef __complex__ float float_type; float_type tmpf;
1256 typedef __complex__ double double_type; double_type tmpd;
1263 typedef __complex__ long double ld_type; ld_type tmpld;
1270 ],[ac_c99_complex_tr1=yes], [ac_c99_complex_tr1=no])
1272 AC_MSG_RESULT($ac_c99_complex_tr1)
1273 if test x"$ac_c99_complex_tr1" = x"yes"; then
1274 AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX_TR1, 1,
1275 [Define if C99 functions in <complex.h> should be used in
1276 <tr1/complex>. Using compiler builtins for these functions
1277 requires corresponding C99 library functions to be present.])
1280 # Check for the existence of <ctype.h> functions.
1281 AC_MSG_CHECKING([for ISO C99 support to TR1 in <ctype.h>])
1282 AC_CACHE_VAL(glibcxx_cv_c99_ctype_tr1, [
1283 AC_TRY_COMPILE([#include <ctype.h>],
1287 ],[glibcxx_cv_c99_ctype_tr1=yes],
1288 [glibcxx_cv_c99_ctype_tr1=no])
1290 AC_MSG_RESULT($glibcxx_cv_c99_ctype_tr1)
1291 if test x"$glibcxx_cv_c99_ctype_tr1" = x"yes"; then
1292 AC_DEFINE(_GLIBCXX_USE_C99_CTYPE_TR1, 1,
1293 [Define if C99 functions in <ctype.h> should be imported in
1294 <tr1/cctype> in namespace std::tr1.])
1297 # Check for the existence of <fenv.h> functions.
1298 AC_CHECK_HEADERS(fenv.h, ac_has_fenv_h=yes, ac_has_fenv_h=no)
1300 if test x"$ac_has_fenv_h" = x"yes"; then
1301 AC_MSG_CHECKING([for ISO C99 support to TR1 in <fenv.h>])
1302 AC_TRY_COMPILE([#include <fenv.h>],
1307 ret = feclearexcept(except);
1308 ret = fegetexceptflag(pflag, except);
1309 ret = feraiseexcept(except);
1310 ret = fesetexceptflag(pflag, except);
1311 ret = fetestexcept(except);
1313 ret = fesetround(mode);
1314 ret = fegetenv(penv);
1315 ret = feholdexcept(penv);
1316 ret = fesetenv(penv);
1317 ret = feupdateenv(penv);
1318 ],[ac_c99_fenv_tr1=yes], [ac_c99_fenv_tr1=no])
1320 AC_MSG_RESULT($ac_c99_fenv_tr1)
1321 if test x"$ac_c99_fenv_tr1" = x"yes"; then
1322 AC_DEFINE(_GLIBCXX_USE_C99_FENV_TR1, 1,
1323 [Define if C99 functions in <fenv.h> should be imported in
1324 <tr1/cfenv> in namespace std::tr1.])
1327 # Check for the existence of <stdint.h> types.
1328 AC_MSG_CHECKING([for ISO C99 support to TR1 in <stdint.h>])
1329 AC_CACHE_VAL(glibcxx_cv_c99_stdint_tr1, [
1330 AC_TRY_COMPILE([#define __STDC_LIMIT_MACROS
1331 #define __STDC_CONSTANT_MACROS
1332 #include <stdint.h>],
1333 [typedef int8_t my_int8_t;
1334 my_int8_t i8 = INT8_MIN;
1336 typedef int16_t my_int16_t;
1337 my_int16_t i16 = INT16_MIN;
1339 typedef int32_t my_int32_t;
1340 my_int32_t i32 = INT32_MIN;
1342 typedef int64_t my_int64_t;
1343 my_int64_t i64 = INT64_MIN;
1345 typedef int_fast8_t my_int_fast8_t;
1346 my_int_fast8_t if8 = INT_FAST8_MIN;
1347 if8 = INT_FAST8_MAX;
1348 typedef int_fast16_t my_int_fast16_t;
1349 my_int_fast16_t if16 = INT_FAST16_MIN;
1350 if16 = INT_FAST16_MAX;
1351 typedef int_fast32_t my_int_fast32_t;
1352 my_int_fast32_t if32 = INT_FAST32_MIN;
1353 if32 = INT_FAST32_MAX;
1354 typedef int_fast64_t my_int_fast64_t;
1355 my_int_fast64_t if64 = INT_FAST64_MIN;
1356 if64 = INT_FAST64_MAX;
1357 typedef int_least8_t my_int_least8_t;
1358 my_int_least8_t il8 = INT_LEAST8_MIN;
1359 il8 = INT_LEAST8_MAX;
1360 typedef int_least16_t my_int_least16_t;
1361 my_int_least16_t il16 = INT_LEAST16_MIN;
1362 il16 = INT_LEAST16_MAX;
1363 typedef int_least32_t my_int_least32_t;
1364 my_int_least32_t il32 = INT_LEAST32_MIN;
1365 il32 = INT_LEAST32_MAX;
1366 typedef int_least64_t my_int_least64_t;
1367 my_int_least64_t il64 = INT_LEAST64_MIN;
1368 il64 = INT_LEAST64_MAX;
1369 typedef intmax_t my_intmax_t;
1370 my_intmax_t im = INTMAX_MAX;
1372 typedef intptr_t my_intptr_t;
1373 my_intptr_t ip = INTPTR_MAX;
1375 typedef uint8_t my_uint8_t;
1376 my_uint8_t ui8 = UINT8_MAX;
1378 typedef uint16_t my_uint16_t;
1379 my_uint16_t ui16 = UINT16_MAX;
1381 typedef uint32_t my_uint32_t;
1382 my_uint32_t ui32 = UINT32_MAX;
1384 typedef uint64_t my_uint64_t;
1385 my_uint64_t ui64 = UINT64_MAX;
1387 typedef uint_fast8_t my_uint_fast8_t;
1388 my_uint_fast8_t uif8 = UINT_FAST8_MAX;
1389 uif8 = UINT_FAST8_MAX;
1390 typedef uint_fast16_t my_uint_fast16_t;
1391 my_uint_fast16_t uif16 = UINT_FAST16_MAX;
1392 uif16 = UINT_FAST16_MAX;
1393 typedef uint_fast32_t my_uint_fast32_t;
1394 my_uint_fast32_t uif32 = UINT_FAST32_MAX;
1395 uif32 = UINT_FAST32_MAX;
1396 typedef uint_fast64_t my_uint_fast64_t;
1397 my_uint_fast64_t uif64 = UINT_FAST64_MAX;
1398 uif64 = UINT_FAST64_MAX;
1399 typedef uint_least8_t my_uint_least8_t;
1400 my_uint_least8_t uil8 = UINT_LEAST8_MAX;
1401 uil8 = UINT_LEAST8_MAX;
1402 typedef uint_least16_t my_uint_least16_t;
1403 my_uint_least16_t uil16 = UINT_LEAST16_MAX;
1404 uil16 = UINT_LEAST16_MAX;
1405 typedef uint_least32_t my_uint_least32_t;
1406 my_uint_least32_t uil32 = UINT_LEAST32_MAX;
1407 uil32 = UINT_LEAST32_MAX;
1408 typedef uint_least64_t my_uint_least64_t;
1409 my_uint_least64_t uil64 = UINT_LEAST64_MAX;
1410 uil64 = UINT_LEAST64_MAX;
1411 typedef uintmax_t my_uintmax_t;
1412 my_uintmax_t uim = UINTMAX_MAX;
1414 typedef uintptr_t my_uintptr_t;
1415 my_uintptr_t uip = UINTPTR_MAX;
1417 ],[glibcxx_cv_c99_stdint_tr1=yes],
1418 [glibcxx_cv_c99_stdint_tr1=no])
1420 AC_MSG_RESULT($glibcxx_cv_c99_stdint_tr1)
1421 if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
1422 AC_DEFINE(_GLIBCXX_USE_C99_STDINT_TR1, 1,
1423 [Define if C99 types in <stdint.h> should be imported in
1424 <tr1/cstdint> in namespace std::tr1.])
1427 # Check for the existence of <math.h> functions.
1428 AC_MSG_CHECKING([for ISO C99 support to TR1 in <math.h>])
1429 AC_CACHE_VAL(glibcxx_cv_c99_math_tr1, [
1430 AC_TRY_COMPILE([#include <math.h>],
1431 [typedef double_t my_double_t;
1432 typedef float_t my_float_t;
1446 copysignf(0.0f, 0.0f);
1447 copysignl(0.0l, 0.0l);
1464 fmaf(0.0f, 0.0f, 0.0f);
1465 fmal(0.0l, 0.0l, 0.0l);
1508 nextafter(0.0, 0.0);
1509 nextafterf(0.0f, 0.0f);
1510 nextafterl(0.0l, 0.0l);
1511 nexttoward(0.0, 0.0);
1512 nexttowardf(0.0f, 0.0f);
1513 nexttowardl(0.0l, 0.0l);
1514 remainder(0.0, 0.0);
1515 remainderf(0.0f, 0.0f);
1516 remainderl(0.0l, 0.0l);
1517 remquo(0.0, 0.0, 0);
1518 remquof(0.0f, 0.0f, 0);
1519 remquol(0.0l, 0.0l, 0);
1538 ],[glibcxx_cv_c99_math_tr1=yes], [glibcxx_cv_c99_math_tr1=no])
1540 AC_MSG_RESULT($glibcxx_cv_c99_math_tr1)
1541 if test x"$glibcxx_cv_c99_math_tr1" = x"yes"; then
1542 AC_DEFINE(_GLIBCXX_USE_C99_MATH_TR1, 1,
1543 [Define if C99 functions or macros in <math.h> should be imported
1544 in <tr1/cmath> in namespace std::tr1.])
1547 # Check for the existence of <inttypes.h> functions (NB: doesn't make
1548 # sense if the glibcxx_cv_c99_stdint_tr1 check fails, per C99, 7.8/1).
1549 ac_c99_inttypes_tr1=no;
1550 if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
1551 AC_MSG_CHECKING([for ISO C99 support to TR1 in <inttypes.h>])
1552 AC_TRY_COMPILE([#include <inttypes.h>],
1553 [intmax_t i, numer, denom, base;
1556 intmax_t ret = imaxabs(i);
1557 imaxdiv_t dret = imaxdiv(numer, denom);
1558 ret = strtoimax(s, endptr, base);
1559 uintmax_t uret = strtoumax(s, endptr, base);
1560 ],[ac_c99_inttypes_tr1=yes], [ac_c99_inttypes_tr1=no])
1562 AC_MSG_RESULT($ac_c99_inttypes_tr1)
1563 if test x"$ac_c99_inttypes_tr1" = x"yes"; then
1564 AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_TR1, 1,
1565 [Define if C99 functions in <inttypes.h> should be imported in
1566 <tr1/cinttypes> in namespace std::tr1.])
1569 # Check for the existence of whcar_t <inttypes.h> functions (NB: doesn't
1570 # make sense if the glibcxx_cv_c99_stdint_tr1 check fails, per C99, 7.8/1).
1571 ac_c99_inttypes_wchar_t_tr1=no;
1572 if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
1573 AC_MSG_CHECKING([for wchar_t ISO C99 support to TR1 in <inttypes.h>])
1574 AC_TRY_COMPILE([#include <inttypes.h>],
1578 intmax_t ret = wcstoimax(s, endptr, base);
1579 uintmax_t uret = wcstoumax(s, endptr, base);
1580 ],[ac_c99_inttypes_wchar_t_tr1=yes],
1581 [ac_c99_inttypes_wchar_t_tr1=no])
1583 AC_MSG_RESULT($ac_c99_inttypes_wchar_t_tr1)
1584 if test x"$ac_c99_inttypes_wchar_t_tr1" = x"yes"; then
1585 AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1, 1,
1586 [Define if wchar_t C99 functions in <inttypes.h> should be
1587 imported in <tr1/cinttypes> in namespace std::tr1.])
1590 # Check for the existence of the <stdbool.h> header.
1591 AC_CHECK_HEADERS(stdbool.h)
1593 CXXFLAGS="$ac_save_CXXFLAGS"
1598 dnl Check whether "/dev/random" and "/dev/urandom" are available for the
1599 dnl random_device of "TR1" (Chapter 5.1, "Random number generation").
1601 AC_DEFUN([GLIBCXX_CHECK_RANDOM_TR1], [
1603 AC_MSG_CHECKING([for "/dev/random" and "/dev/urandom" for TR1 random_device])
1604 AC_CACHE_VAL(glibcxx_cv_random_tr1, [
1605 if test -r /dev/random && test -r /dev/urandom; then
1606 glibcxx_cv_random_tr1=yes;
1608 glibcxx_cv_random_tr1=no;
1611 AC_MSG_RESULT($glibcxx_cv_random_tr1)
1613 if test x"$glibcxx_cv_random_tr1" = x"yes"; then
1614 AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1, 1,
1615 [Define if /dev/random and /dev/urandom are available for
1616 the random_device of TR1 (Chapter 5.1).])
1622 dnl Compute the EOF, SEEK_CUR, and SEEK_END integer constants.
1624 AC_DEFUN([GLIBCXX_COMPUTE_STDIO_INTEGER_CONSTANTS], [
1626 AC_MSG_CHECKING([For some <stdio.h> integer constants.])
1628 AC_CACHE_VAL(glibcxx_cv_stdio_eof, [
1629 AC_COMPUTE_INT([glibcxx_cv_stdio_eof], [[EOF]],
1630 [#include <stdio.h>],
1631 [AC_MSG_ERROR([computing EOF failed])])
1633 AC_MSG_RESULT($glibcxx_cv_stdio_eof)
1634 AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_EOF, $glibcxx_cv_stdio_eof,
1635 [Define to the value of the EOF integer constant.])
1637 AC_CACHE_VAL(glibcxx_cv_stdio_seek_cur, [
1638 AC_COMPUTE_INT([glibcxx_cv_stdio_seek_cur], [[SEEK_CUR]],
1639 [#include <stdio.h>],
1640 [AC_MSG_ERROR([computing SEEK_CUR failed])])
1642 AC_MSG_RESULT($glibcxx_cv_stdio_seek_cur)
1643 AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_SEEK_CUR, $glibcxx_cv_stdio_seek_cur,
1644 [Define to the value of the SEEK_CUR integer constant.])
1646 AC_CACHE_VAL(glibcxx_cv_stdio_seek_end, [
1647 AC_COMPUTE_INT([glibcxx_cv_stdio_seek_end], [[SEEK_END]],
1648 [#include <stdio.h>],
1649 [AC_MSG_ERROR([computing SEEK_END failed])])
1651 AC_MSG_RESULT($glibcxx_cv_stdio_seek_end)
1652 AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_SEEK_END, $glibcxx_cv_stdio_seek_end,
1653 [Define to the value of the SEEK_END integer constant.])
1657 dnl Check whether macros, etc are present for <system_error>
1659 AC_DEFUN([GLIBCXX_CHECK_SYSTEM_ERROR], [
1661 m4_pushdef([n_syserr], [1])dnl
1662 m4_foreach([syserr], [EOWNERDEAD, ENOTRECOVERABLE, ENOLINK, EPROTO, ENODATA,
1663 ENOSR, ENOSTR, ETIME, EBADMSG, ECANCELED,
1664 EOVERFLOW, ENOTSUP, EIDRM, ETXTBSY],
1665 [m4_pushdef([SYSERR], m4_toupper(syserr))dnl
1666 AC_MSG_CHECKING([for syserr])
1667 AC_CACHE_VAL([glibcxx_cv_system_error[]n_syserr], [
1668 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]],
1669 [int i = syserr;])],
1670 [glibcxx_cv_system_error[]n_syserr=yes],
1671 [glibcxx_cv_system_error[]n_syserr=no])
1673 AC_MSG_RESULT([$glibcxx_cv_system_error[]n_syserr])
1674 if test x"$glibcxx_cv_system_error[]n_syserr" = x"yes"; then
1675 AC_DEFINE([HAVE_]SYSERR, 1, [Define if ]syserr[ exists.])
1677 m4_define([n_syserr], m4_incr(n_syserr))dnl
1678 m4_popdef([SYSERR])dnl
1680 m4_popdef([n_syserr])dnl
1684 dnl Check for what type of C headers to use.
1686 dnl --enable-cheaders= [does stuff].
1687 dnl --disable-cheaders [does not do anything, really].
1688 dnl + Usage: GLIBCXX_ENABLE_CHEADERS[(DEFAULT)]
1689 dnl Where DEFAULT is either 'c' or 'c_std' or 'c_global'.
1691 AC_DEFUN([GLIBCXX_ENABLE_CHEADERS], [
1692 GLIBCXX_ENABLE(cheaders,$1,[=KIND],
1693 [construct "C" headers for g++], [permit c|c_std|c_global])
1694 AC_MSG_NOTICE("C" header strategy set to $enable_cheaders)
1696 C_INCLUDE_DIR='${glibcxx_srcdir}/include/'$enable_cheaders
1698 # Allow overrides to configure.host here.
1699 if test $enable_cheaders = c_global; then
1703 if test $enable_cheaders = c_global || test $enable_cheaders = c_std; then
1707 AC_SUBST(C_INCLUDE_DIR)
1708 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c)
1709 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std)
1710 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_GLOBAL, test $enable_cheaders = c_global)
1711 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes)
1712 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_EXTRA, test $c_extra = yes)
1717 dnl Check for which locale library to use. The choice is mapped to
1718 dnl a subdirectory of config/locale.
1720 dnl Default is generic.
1722 AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
1723 GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
1724 [use MODEL for target locale package],
1725 [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
1727 # Deal with gettext issues. Default to not using it (=no) until we detect
1728 # support for it later. Let the user turn it off via --e/d, but let that
1729 # default to on for easier handling.
1732 AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]),
1736 # Either a known packaage, or "auto"
1737 if test $enable_clocale = no || test $enable_clocale = yes; then
1740 enable_clocale_flag=$enable_clocale
1742 # Probe for locale model to use if none specified.
1743 # Default to "generic".
1744 if test $enable_clocale_flag = auto; then
1745 case ${target_os} in
1746 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
1747 enable_clocale_flag=gnu
1750 enable_clocale_flag=darwin
1753 enable_clocale_flag=generic
1758 # Sanity check model, and test for special functionality.
1759 if test $enable_clocale_flag = gnu; then
1760 AC_EGREP_CPP([_GLIBCXX_ok], [
1761 #include <features.h>
1762 #if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined(__UCLIBC__)
1765 ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
1767 # Set it to scream when it hurts.
1768 ac_save_CFLAGS="$CFLAGS"
1769 CFLAGS="-Wimplicit-function-declaration -Werror"
1771 # Use strxfrm_l if available.
1772 AC_TRY_COMPILE([#define _GNU_SOURCE 1
1774 #include <locale.h>],
1775 [char s[128]; __locale_t loc; strxfrm_l(s, "C", 5, loc);],
1776 AC_DEFINE(HAVE_STRXFRM_L, 1,
1777 [Define if strxfrm_l is available in <string.h>.]),)
1779 # Use strerror_l if available.
1780 AC_TRY_COMPILE([#define _GNU_SOURCE 1
1782 #include <locale.h>],
1783 [__locale_t loc; strerror_l(5, loc);],
1784 AC_DEFINE(HAVE_STRERROR_L, 1,
1785 [Define if strerror_l is available in <string.h>.]),)
1787 CFLAGS="$ac_save_CFLAGS"
1790 # Perhaps use strerror_r if available, and strerror_l isn't.
1791 ac_save_CFLAGS="$CFLAGS"
1792 CFLAGS="-Wimplicit-function-declaration -Werror"
1793 AC_TRY_COMPILE([#define _GNU_SOURCE 1
1795 #include <locale.h>],
1796 [char s[128]; strerror_r(5, s, 128);],
1797 AC_DEFINE(HAVE_STRERROR_R, 1,
1798 [Define if strerror_r is available in <string.h>.]),)
1799 CFLAGS="$ac_save_CFLAGS"
1801 # Set configure bits for specified locale package
1802 AC_MSG_CHECKING([for C locale to use])
1803 case ${enable_clocale_flag} in
1805 AC_MSG_RESULT(generic)
1807 CLOCALE_H=config/locale/generic/c_locale.h
1808 CLOCALE_CC=config/locale/generic/c_locale.cc
1809 CCODECVT_CC=config/locale/generic/codecvt_members.cc
1810 CCOLLATE_CC=config/locale/generic/collate_members.cc
1811 CCTYPE_CC=config/locale/generic/ctype_members.cc
1812 CMESSAGES_H=config/locale/generic/messages_members.h
1813 CMESSAGES_CC=config/locale/generic/messages_members.cc
1814 CMONEY_CC=config/locale/generic/monetary_members.cc
1815 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1816 CTIME_H=config/locale/generic/time_members.h
1817 CTIME_CC=config/locale/generic/time_members.cc
1818 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
1821 AC_MSG_RESULT(darwin or freebsd)
1823 CLOCALE_H=config/locale/generic/c_locale.h
1824 CLOCALE_CC=config/locale/generic/c_locale.cc
1825 CCODECVT_CC=config/locale/generic/codecvt_members.cc
1826 CCOLLATE_CC=config/locale/generic/collate_members.cc
1827 CCTYPE_CC=config/locale/darwin/ctype_members.cc
1828 CMESSAGES_H=config/locale/generic/messages_members.h
1829 CMESSAGES_CC=config/locale/generic/messages_members.cc
1830 CMONEY_CC=config/locale/generic/monetary_members.cc
1831 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1832 CTIME_H=config/locale/generic/time_members.h
1833 CTIME_CC=config/locale/generic/time_members.cc
1834 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
1840 # Declare intention to use gettext, and add support for specific
1842 # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
1845 # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
1846 AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
1847 if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
1850 # Export the build objects.
1851 for ling in $ALL_LINGUAS; do \
1852 glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
1853 glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
1855 AC_SUBST(glibcxx_MOFILES)
1856 AC_SUBST(glibcxx_POFILES)
1858 CLOCALE_H=config/locale/gnu/c_locale.h
1859 CLOCALE_CC=config/locale/gnu/c_locale.cc
1860 CCODECVT_CC=config/locale/gnu/codecvt_members.cc
1861 CCOLLATE_CC=config/locale/gnu/collate_members.cc
1862 CCTYPE_CC=config/locale/gnu/ctype_members.cc
1863 CMESSAGES_H=config/locale/gnu/messages_members.h
1864 CMESSAGES_CC=config/locale/gnu/messages_members.cc
1865 CMONEY_CC=config/locale/gnu/monetary_members.cc
1866 CNUMERIC_CC=config/locale/gnu/numeric_members.cc
1867 CTIME_H=config/locale/gnu/time_members.h
1868 CTIME_CC=config/locale/gnu/time_members.cc
1869 CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h
1872 AC_MSG_RESULT(IEEE 1003.1)
1874 CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h
1875 CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc
1876 CCODECVT_CC=config/locale/generic/codecvt_members.cc
1877 CCOLLATE_CC=config/locale/generic/collate_members.cc
1878 CCTYPE_CC=config/locale/generic/ctype_members.cc
1879 CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h
1880 CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc
1881 CMONEY_CC=config/locale/generic/monetary_members.cc
1882 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1883 CTIME_H=config/locale/generic/time_members.h
1884 CTIME_CC=config/locale/generic/time_members.cc
1885 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
1889 # This is where the testsuite looks for locale catalogs, using the
1890 # -DLOCALEDIR define during testsuite compilation.
1891 glibcxx_localedir=${glibcxx_builddir}/po/share/locale
1892 AC_SUBST(glibcxx_localedir)
1894 # A standalone libintl (e.g., GNU libintl) may be in use.
1895 if test $USE_NLS = yes; then
1896 AC_CHECK_HEADERS([libintl.h], [], USE_NLS=no)
1897 AC_SEARCH_LIBS(gettext, intl, [], USE_NLS=no)
1899 if test $USE_NLS = yes; then
1900 AC_DEFINE(_GLIBCXX_USE_NLS, 1,
1901 [Define if NLS translations are to be used.])
1906 AC_SUBST(CMESSAGES_H)
1907 AC_SUBST(CCODECVT_CC)
1908 AC_SUBST(CCOLLATE_CC)
1910 AC_SUBST(CMESSAGES_CC)
1912 AC_SUBST(CNUMERIC_CC)
1915 AC_SUBST(CLOCALE_CC)
1916 AC_SUBST(CLOCALE_INTERNAL_H)
1921 dnl Check for which std::allocator base class to use. The choice is
1922 dnl mapped from a subdirectory of include/ext.
1926 AC_DEFUN([GLIBCXX_ENABLE_ALLOCATOR], [
1927 AC_MSG_CHECKING([for std::allocator base class])
1928 GLIBCXX_ENABLE(libstdcxx-allocator,auto,[=KIND],
1929 [use KIND for target std::allocator base],
1930 [permit new|malloc|mt|bitmap|pool|yes|no|auto])
1932 # If they didn't use this option switch, or if they specified --enable
1933 # with no specific model, we'll have to look for one. If they
1934 # specified --disable (???), do likewise.
1935 if test $enable_libstdcxx_allocator = no ||
1936 test $enable_libstdcxx_allocator = yes;
1938 enable_libstdcxx_allocator=auto
1941 # Either a known package, or "auto". Auto implies the default choice
1942 # for a particular platform.
1943 enable_libstdcxx_allocator_flag=$enable_libstdcxx_allocator
1945 # Probe for host-specific support if no specific model is specified.
1947 if test $enable_libstdcxx_allocator_flag = auto; then
1948 case ${target_os} in
1949 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
1950 enable_libstdcxx_allocator_flag=new
1953 enable_libstdcxx_allocator_flag=new
1957 AC_MSG_RESULT($enable_libstdcxx_allocator_flag)
1960 # Set configure bits for specified locale package
1961 case ${enable_libstdcxx_allocator_flag} in
1963 ALLOCATOR_H=config/allocator/bitmap_allocator_base.h
1964 ALLOCATOR_NAME=__gnu_cxx::bitmap_allocator
1967 ALLOCATOR_H=config/allocator/malloc_allocator_base.h
1968 ALLOCATOR_NAME=__gnu_cxx::malloc_allocator
1971 ALLOCATOR_H=config/allocator/mt_allocator_base.h
1972 ALLOCATOR_NAME=__gnu_cxx::__mt_alloc
1975 ALLOCATOR_H=config/allocator/new_allocator_base.h
1976 ALLOCATOR_NAME=__gnu_cxx::new_allocator
1979 ALLOCATOR_H=config/allocator/pool_allocator_base.h
1980 ALLOCATOR_NAME=__gnu_cxx::__pool_alloc
1984 AC_SUBST(ALLOCATOR_H)
1985 AC_SUBST(ALLOCATOR_NAME)
1990 dnl Check for whether the Boost-derived checks should be turned on.
1992 dnl --enable-concept-checks turns them on.
1993 dnl --disable-concept-checks leaves them off.
1994 dnl + Usage: GLIBCXX_ENABLE_CONCEPT_CHECKS[(DEFAULT)]
1995 dnl Where DEFAULT is either `yes' or `no'.
1997 AC_DEFUN([GLIBCXX_ENABLE_CONCEPT_CHECKS], [
1998 GLIBCXX_ENABLE(concept-checks,$1,,[use Boost-derived template checks])
1999 if test $enable_concept_checks = yes; then
2000 AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS, 1,
2001 [Define to use concept checking code from the boost libraries.])
2006 dnl Check for parallel mode pre-requisites, including OpenMP support.
2008 dnl + Usage: GLIBCXX_ENABLE_PARALLEL
2010 AC_DEFUN([GLIBCXX_ENABLE_PARALLEL], [
2014 # See if configured libgomp/omp.h exists. (libgomp may be in
2015 # noconfigdirs but not explicitly disabled.)
2016 if echo " ${TARGET_CONFIGDIRS} " | grep " libgomp " > /dev/null 2>&1 ; then
2017 enable_parallel=yes;
2019 AC_MSG_NOTICE([target-libgomp not built])
2022 AC_MSG_CHECKING([for parallel mode support])
2023 AC_MSG_RESULT([$enable_parallel])
2024 GLIBCXX_CONDITIONAL(ENABLE_PARALLEL, test $enable_parallel = yes)
2029 dnl Check for which I/O library to use: stdio, or something specific.
2031 dnl Default is stdio.
2033 AC_DEFUN([GLIBCXX_ENABLE_CSTDIO], [
2034 AC_MSG_CHECKING([for underlying I/O to use])
2035 GLIBCXX_ENABLE(cstdio,stdio,[=PACKAGE],
2036 [use target-specific I/O package], [permit stdio])
2038 # Now that libio has been removed, you can have any color you want as long
2039 # as it's black. This is one big no-op until other packages are added, but
2040 # showing the framework never hurts.
2041 case ${enable_cstdio} in
2043 CSTDIO_H=config/io/c_io_stdio.h
2044 BASIC_FILE_H=config/io/basic_file_stdio.h
2045 BASIC_FILE_CC=config/io/basic_file_stdio.cc
2046 AC_MSG_RESULT(stdio)
2051 AC_SUBST(BASIC_FILE_H)
2052 AC_SUBST(BASIC_FILE_CC)
2057 dnl Check for "unusual" flags to pass to the compiler while building.
2059 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
2060 dnl experimental flags such as -fpch, -fIMI, -Dfloat=char, etc.
2061 dnl --disable-cxx-flags passes nothing.
2062 dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
2063 dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
2064 dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
2065 dnl + Usage: GLIBCXX_ENABLE_CXX_FLAGS(default flags)
2066 dnl If "default flags" is an empty string, the effect is the same
2067 dnl as --disable or --enable=no.
2069 AC_DEFUN([GLIBCXX_ENABLE_CXX_FLAGS], [dnl
2070 AC_MSG_CHECKING([for extra compiler flags for building])
2071 GLIBCXX_ENABLE(cxx-flags,$1,[=FLAGS],
2072 [pass compiler FLAGS when building library],
2073 [case "x$enable_cxx_flags" in
2074 xno | x) enable_cxx_flags= ;;
2076 *) AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;;
2079 # Run through flags (either default or command-line) and set anything
2080 # extra (e.g., #defines) that must accompany particular g++ options.
2081 if test -n "$enable_cxx_flags"; then
2082 for f in $enable_cxx_flags; do
2086 *) # and we're trying to pass /what/ exactly?
2087 AC_MSG_ERROR([compiler flags start with a -]) ;;
2092 EXTRA_CXX_FLAGS="$enable_cxx_flags"
2093 AC_MSG_RESULT($EXTRA_CXX_FLAGS)
2094 AC_SUBST(EXTRA_CXX_FLAGS)
2099 dnl Check to see if debugging libraries are to be built.
2101 dnl --enable-libstdcxx-debug
2102 dnl builds a separate set of debugging libraries in addition to the
2103 dnl normal (shared, static) libstdc++ binaries.
2105 dnl --disable-libstdcxx-debug
2106 dnl builds only one (non-debug) version of libstdc++.
2108 dnl --enable-libstdcxx-debug-flags=FLAGS
2109 dnl iff --enable-debug == yes, then use FLAGS to build the debug library.
2111 dnl + Usage: GLIBCXX_ENABLE_DEBUG[(DEFAULT)]
2112 dnl Where DEFAULT is either `yes' or `no'.
2114 AC_DEFUN([GLIBCXX_ENABLE_DEBUG], [
2115 AC_MSG_CHECKING([for additional debug build])
2116 GLIBCXX_ENABLE(libstdcxx-debug,$1,,[build extra debug library])
2117 AC_MSG_RESULT($enable_libstdcxx_debug)
2118 GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_DEBUG, test $enable_libstdcxx_debug = yes)
2123 dnl Check for explicit debug flags.
2125 dnl --enable-libstdcxx-debug-flags='-O1'
2126 dnl is a general method for passing flags to be used when
2127 dnl building debug libraries with --enable-debug.
2129 dnl --disable-libstdcxx-debug-flags does nothing.
2130 dnl + Usage: GLIBCXX_ENABLE_DEBUG_FLAGS(default flags)
2131 dnl If "default flags" is an empty string, the effect is the same
2132 dnl as --disable or --enable=no.
2134 AC_DEFUN([GLIBCXX_ENABLE_DEBUG_FLAGS], [
2135 GLIBCXX_ENABLE(libstdcxx-debug-flags,[$1],[=FLAGS],
2136 [pass compiler FLAGS when building debug library],
2137 [case "x$enable_libstdcxx_debug_flags" in
2138 xno | x) enable_libstdcxx_debug_flags= ;;
2140 *) AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;;
2143 # Option parsed, now set things appropriately
2144 DEBUG_FLAGS="$enable_libstdcxx_debug_flags"
2145 AC_SUBST(DEBUG_FLAGS)
2147 AC_MSG_NOTICE([Debug build flags set to $DEBUG_FLAGS])
2152 dnl Check if the user only wants a freestanding library implementation.
2154 dnl --disable-hosted-libstdcxx will turn off most of the library build,
2155 dnl installing only the headers required by [17.4.1.3] and the language
2156 dnl support library. More than that will be built (to keep the Makefiles
2157 dnl conveniently clean), but not installed.
2160 dnl is_hosted (yes/no)
2163 dnl _GLIBCXX_HOSTED (always defined, either to 1 or 0)
2165 AC_DEFUN([GLIBCXX_ENABLE_HOSTED], [
2166 AC_ARG_ENABLE([hosted-libstdcxx],
2167 AC_HELP_STRING([--disable-hosted-libstdcxx],
2168 [only build freestanding C++ runtime support]),,
2171 enable_hosted_libstdcxx=no
2174 enable_hosted_libstdcxx=yes
2177 if test "$enable_hosted_libstdcxx" = no; then
2178 AC_MSG_NOTICE([Only freestanding libraries will be built])
2182 enable_libstdcxx_pch=no
2187 GLIBCXX_CONDITIONAL(GLIBCXX_HOSTED, test $is_hosted = yes)
2188 AC_DEFINE_UNQUOTED(_GLIBCXX_HOSTED, $hosted_define,
2189 [Define to 1 if a full hosted library is built, or 0 if freestanding.])
2194 dnl Check for template specializations for the 'long long' type.
2195 dnl The result determines only whether 'long long' I/O is enabled; things
2196 dnl like numeric_limits<> specializations are always available.
2198 dnl --enable-long-long defines _GLIBCXX_USE_LONG_LONG
2199 dnl --disable-long-long leaves _GLIBCXX_USE_LONG_LONG undefined
2200 dnl + Usage: GLIBCXX_ENABLE_LONG_LONG[(DEFAULT)]
2201 dnl Where DEFAULT is either `yes' or `no'.
2203 AC_DEFUN([GLIBCXX_ENABLE_LONG_LONG], [
2204 GLIBCXX_ENABLE(long-long,$1,,[enable template specializations for 'long long'])
2205 if test $enable_long_long = yes; then
2206 AC_DEFINE(_GLIBCXX_USE_LONG_LONG, 1,
2207 [Define if code specialized for long long should be used.])
2209 AC_MSG_CHECKING([for enabled long long specializations])
2210 AC_MSG_RESULT([$enable_long_long])
2215 dnl Check for decimal floating point.
2217 dnl http://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html#Decimal-Float
2219 dnl This checks to see if the host supports decimal floating point types.
2222 dnl _GLIBCXX_USE_DECIMAL_FLOAT
2224 AC_DEFUN([GLIBCXX_ENABLE_DECIMAL_FLOAT], [
2226 # Fake what AC_TRY_COMPILE does, without linking as this is
2227 # unnecessary for this test.
2229 cat > conftest.$ac_ext << EOF
2230 [#]line __oline__ "configure"
2240 AC_MSG_CHECKING([for ISO/IEC TR 24733 ])
2241 if AC_TRY_EVAL(ac_compile); then
2242 AC_DEFINE(_GLIBCXX_USE_DECIMAL_FLOAT, 1,
2243 [Define if ISO/IEC TR 24733 decimal floating point types are supported on this host.])
2248 AC_MSG_RESULT($enable_dfp)
2253 dnl Check for template specializations for the 'wchar_t' type.
2255 dnl --enable-wchar_t defines _GLIBCXX_USE_WCHAR_T
2256 dnl --disable-wchar_t leaves _GLIBCXX_USE_WCHAR_T undefined
2257 dnl + Usage: GLIBCXX_ENABLE_WCHAR_T[(DEFAULT)]
2258 dnl Where DEFAULT is either `yes' or `no'.
2260 dnl Necessary support must also be present.
2262 AC_DEFUN([GLIBCXX_ENABLE_WCHAR_T], [
2263 GLIBCXX_ENABLE(wchar_t,$1,,[enable template specializations for 'wchar_t'])
2265 # Test wchar.h for mbstate_t, which is needed for char_traits and fpos.
2266 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
2267 AC_MSG_CHECKING([for mbstate_t])
2268 AC_TRY_COMPILE([#include <wchar.h>],
2269 [mbstate_t teststate;],
2270 have_mbstate_t=yes, have_mbstate_t=no)
2271 AC_MSG_RESULT($have_mbstate_t)
2272 if test x"$have_mbstate_t" = xyes; then
2273 AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
2276 # Test it always, for use in GLIBCXX_ENABLE_C99, together with
2278 AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
2280 if test x"$enable_wchar_t" = x"yes"; then
2285 if test x"$ac_has_wchar_h" = xyes &&
2286 test x"$ac_has_wctype_h" = xyes; then
2287 AC_TRY_COMPILE([#include <wchar.h>
2348 ],[],[], [enable_wchar_t=no])
2356 if test x"$enable_wchar_t" = x"yes"; then
2357 AC_DEFINE(_GLIBCXX_USE_WCHAR_T, 1,
2358 [Define if code specialized for wchar_t should be used.])
2361 AC_MSG_CHECKING([for enabled wchar_t specializations])
2362 AC_MSG_RESULT([$enable_wchar_t])
2367 dnl Check to see if building and using a C++ precompiled header can be done.
2369 dnl --enable-libstdcxx-pch=yes
2370 dnl default, this shows intent to use stdc++.h.gch If it looks like it
2371 dnl may work, after some light-hearted attempts to puzzle out compiler
2372 dnl support, flip bits on in include/Makefile.am
2374 dnl --disable-libstdcxx-pch
2375 dnl turns off attempts to use or build stdc++.h.gch.
2378 dnl glibcxx_PCHFLAGS
2380 AC_DEFUN([GLIBCXX_ENABLE_PCH], [
2381 GLIBCXX_ENABLE(libstdcxx-pch,$1,,[build pre-compiled libstdc++ headers])
2382 if test $enable_libstdcxx_pch = yes; then
2383 AC_CACHE_CHECK([for compiler with PCH support],
2384 [glibcxx_cv_prog_CXX_pch],
2385 [ac_save_CXXFLAGS="$CXXFLAGS"
2386 CXXFLAGS="$CXXFLAGS -Werror -Winvalid-pch -Wno-deprecated"
2389 echo '#include <math.h>' > conftest.h
2390 if $CXX $CXXFLAGS $CPPFLAGS -x c++-header conftest.h \
2391 -o conftest.h.gch 1>&5 2>&1 &&
2392 echo '#error "pch failed"' > conftest.h &&
2393 echo '#include "conftest.h"' > conftest.cc &&
2394 $CXX -c $CXXFLAGS $CPPFLAGS conftest.cc 1>&5 2>&1 ;
2396 glibcxx_cv_prog_CXX_pch=yes
2398 glibcxx_cv_prog_CXX_pch=no
2401 CXXFLAGS=$ac_save_CXXFLAGS
2404 enable_libstdcxx_pch=$glibcxx_cv_prog_CXX_pch
2407 AC_MSG_CHECKING([for enabled PCH])
2408 AC_MSG_RESULT([$enable_libstdcxx_pch])
2410 GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes)
2411 if test $enable_libstdcxx_pch = yes; then
2412 glibcxx_PCHFLAGS="-include bits/stdc++.h"
2416 AC_SUBST(glibcxx_PCHFLAGS)
2421 dnl Check for atomic builtins.
2423 dnl http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#Atomic-Builtins
2425 dnl This checks to see if the host supports the compiler-generated
2426 dnl builtins for atomic operations for various integral sizes. Note, this
2427 dnl is intended to be an all-or-nothing switch, so all the atomic operations
2428 dnl that are used should be checked.
2431 dnl libgomp and libgfortran use a link test, see CHECK_SYNC_FETCH_AND_ADD.
2434 dnl _GLIBCXX_ATOMIC_BUILTINS_1
2435 dnl _GLIBCXX_ATOMIC_BUILTINS_2
2436 dnl _GLIBCXX_ATOMIC_BUILTINS_4
2437 dnl _GLIBCXX_ATOMIC_BUILTINS_8
2439 AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
2442 old_CXXFLAGS="$CXXFLAGS"
2444 # Do link tests if possible, instead asm tests, limited to some platforms
2445 # see discussion in PR target/40134, PR libstdc++/40133 and the thread
2446 # starting at http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00322.html
2447 atomic_builtins_link_tests=no
2448 if test x$gcc_no_link != xyes; then
2449 # Can do link tests. Limit to some tested platforms
2451 *-*-linux* | *-*-uclinux* | *-*-kfreebsd*-gnu | *-*-gnu*)
2452 atomic_builtins_link_tests=yes
2457 if test x$atomic_builtins_link_tests = xyes; then
2461 CXXFLAGS="$CXXFLAGS -fno-exceptions"
2463 AC_MSG_CHECKING([for atomic builtins for bool])
2464 AC_CACHE_VAL(glibcxx_cv_atomic_bool, [
2467 [typedef bool atomic_type;
2470 const atomic_type c3(0);
2471 __sync_fetch_and_add(&c1, c2);
2472 __sync_val_compare_and_swap(&c1, c3, c2);
2473 __sync_lock_test_and_set(&c1, c3);
2474 __sync_lock_release(&c1);
2475 __sync_synchronize();],
2476 [glibcxx_cv_atomic_bool=yes],
2477 [glibcxx_cv_atomic_bool=no])
2479 if test $glibcxx_cv_atomic_bool = yes; then
2480 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
2481 [Define if builtin atomic operations for bool are supported on this host.])
2483 AC_MSG_RESULT($glibcxx_cv_atomic_bool)
2485 AC_MSG_CHECKING([for atomic builtins for short])
2486 AC_CACHE_VAL(glibcxx_cv_atomic_short, [
2489 [typedef short atomic_type;
2492 const atomic_type c3(0);
2493 __sync_fetch_and_add(&c1, c2);
2494 __sync_val_compare_and_swap(&c1, c3, c2);
2495 __sync_lock_test_and_set(&c1, c3);
2496 __sync_lock_release(&c1);
2497 __sync_synchronize();],
2498 [glibcxx_cv_atomic_short=yes],
2499 [glibcxx_cv_atomic_short=no])
2501 if test $glibcxx_cv_atomic_short = yes; then
2502 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
2503 [Define if builtin atomic operations for short are supported on this host.])
2505 AC_MSG_RESULT($glibcxx_cv_atomic_short)
2507 AC_MSG_CHECKING([for atomic builtins for int])
2508 AC_CACHE_VAL(glibcxx_cv_atomic_int, [
2511 [typedef int atomic_type;
2514 const atomic_type c3(0);
2515 __sync_fetch_and_add(&c1, c2);
2516 __sync_val_compare_and_swap(&c1, c3, c2);
2517 __sync_lock_test_and_set(&c1, c3);
2518 __sync_lock_release(&c1);
2519 __sync_synchronize();],
2520 [glibcxx_cv_atomic_int=yes],
2521 [glibcxx_cv_atomic_int=no])
2523 if test $glibcxx_cv_atomic_int = yes; then
2524 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
2525 [Define if builtin atomic operations for int are supported on this host.])
2527 AC_MSG_RESULT($glibcxx_cv_atomic_int)
2529 AC_MSG_CHECKING([for atomic builtins for long long])
2530 AC_CACHE_VAL(glibcxx_cv_atomic_long_long, [
2533 [typedef long long atomic_type;
2536 const atomic_type c3(0);
2537 __sync_fetch_and_add(&c1, c2);
2538 __sync_val_compare_and_swap(&c1, c3, c2);
2539 __sync_lock_test_and_set(&c1, c3);
2540 __sync_lock_release(&c1);
2541 __sync_synchronize();],
2542 [glibcxx_cv_atomic_long_long=yes],
2543 [glibcxx_cv_atomic_long_long=no])
2545 if test $glibcxx_cv_atomic_long_long = yes; then
2546 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
2547 [Define if builtin atomic operations for long long are supported on this host.])
2549 AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
2555 # Compile unoptimized.
2558 # Fake what AC_TRY_COMPILE does.
2560 cat > conftest.$ac_ext << EOF
2561 [#]line __oline__ "configure"
2564 typedef bool atomic_type;
2567 const atomic_type c3(0);
2568 __sync_fetch_and_add(&c1, c2);
2569 __sync_val_compare_and_swap(&c1, c3, c2);
2570 __sync_lock_test_and_set(&c1, c3);
2571 __sync_lock_release(&c1);
2572 __sync_synchronize();
2577 AC_MSG_CHECKING([for atomic builtins for bool])
2578 if AC_TRY_EVAL(ac_compile); then
2579 if grep __sync_ conftest.s >/dev/null 2>&1 ; then
2580 glibcxx_cv_atomic_bool=no
2582 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
2583 [Define if builtin atomic operations for bool are supported on this host.])
2584 glibcxx_cv_atomic_bool=yes
2587 AC_MSG_RESULT($glibcxx_cv_atomic_bool)
2590 cat > conftest.$ac_ext << EOF
2591 [#]line __oline__ "configure"
2594 typedef short atomic_type;
2597 const atomic_type c3(0);
2598 __sync_fetch_and_add(&c1, c2);
2599 __sync_val_compare_and_swap(&c1, c3, c2);
2600 __sync_lock_test_and_set(&c1, c3);
2601 __sync_lock_release(&c1);
2602 __sync_synchronize();
2607 AC_MSG_CHECKING([for atomic builtins for short])
2608 if AC_TRY_EVAL(ac_compile); then
2609 if grep __sync_ conftest.s >/dev/null 2>&1 ; then
2610 glibcxx_cv_atomic_short=no
2612 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
2613 [Define if builtin atomic operations for short are supported on this host.])
2614 glibcxx_cv_atomic_short=yes
2617 AC_MSG_RESULT($glibcxx_cv_atomic_short)
2620 cat > conftest.$ac_ext << EOF
2621 [#]line __oline__ "configure"
2624 // NB: _Atomic_word not necessarily int.
2625 typedef int atomic_type;
2628 const atomic_type c3(0);
2629 __sync_fetch_and_add(&c1, c2);
2630 __sync_val_compare_and_swap(&c1, c3, c2);
2631 __sync_lock_test_and_set(&c1, c3);
2632 __sync_lock_release(&c1);
2633 __sync_synchronize();
2638 AC_MSG_CHECKING([for atomic builtins for int])
2639 if AC_TRY_EVAL(ac_compile); then
2640 if grep __sync_ conftest.s >/dev/null 2>&1 ; then
2641 glibcxx_cv_atomic_int=no
2643 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
2644 [Define if builtin atomic operations for int are supported on this host.])
2645 glibcxx_cv_atomic_int=yes
2648 AC_MSG_RESULT($glibcxx_cv_atomic_int)
2651 cat > conftest.$ac_ext << EOF
2652 [#]line __oline__ "configure"
2655 typedef long long atomic_type;
2658 const atomic_type c3(0);
2659 __sync_fetch_and_add(&c1, c2);
2660 __sync_val_compare_and_swap(&c1, c3, c2);
2661 __sync_lock_test_and_set(&c1, c3);
2662 __sync_lock_release(&c1);
2663 __sync_synchronize();
2668 AC_MSG_CHECKING([for atomic builtins for long long])
2669 if AC_TRY_EVAL(ac_compile); then
2670 if grep __sync_ conftest.s >/dev/null 2>&1 ; then
2671 glibcxx_cv_atomic_long_long=no
2673 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
2674 [Define if builtin atomic operations for long long are supported on this host.])
2675 glibcxx_cv_atomic_long_long=yes
2678 AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
2683 CXXFLAGS="$old_CXXFLAGS"
2686 # Set atomicity_dir to builtins if either of above tests pass.
2687 if test $glibcxx_cv_atomic_int = yes || test $glibcxx_cv_atomic_bool = yes ; then
2688 atomicity_dir=cpu/generic/atomicity_builtins
2691 # If still generic, set to mutex.
2692 if test $atomicity_dir = "cpu/generic" ; then
2693 atomicity_dir=cpu/generic/atomicity_mutex
2694 AC_MSG_WARN([No native atomic operations are provided for this platform.])
2695 if test "x$target_thread_file" = xsingle; then
2696 AC_MSG_WARN([They cannot be faked when thread support is disabled.])
2697 AC_MSG_WARN([Thread-safety of certain classes is not guaranteed.])
2699 AC_MSG_WARN([They will be faked using a mutex.])
2700 AC_MSG_WARN([Performance of certain classes will degrade as a result.])
2708 dnl Check for exception handling support. If an explicit enable/disable
2709 dnl sjlj exceptions is given, we don't have to detect. Otherwise the
2710 dnl target may or may not support call frame exceptions.
2712 dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
2713 dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
2714 dnl Neither one forces an attempt at detection.
2717 dnl _GLIBCXX_SJLJ_EXCEPTIONS if the compiler is configured for it
2719 AC_DEFUN([GLIBCXX_ENABLE_SJLJ_EXCEPTIONS], [
2720 AC_MSG_CHECKING([for exception model to use])
2723 GLIBCXX_ENABLE(sjlj-exceptions,auto,,
2724 [force use of builtin_setjmp for exceptions],
2725 [permit yes|no|auto])
2727 if test $enable_sjlj_exceptions = auto; then
2728 # Botheration. Now we've got to detect the exception model. Link tests
2729 # against libgcc.a are problematic since we've not been given proper -L
2730 # bits for single-tree newlib and libgloss.
2732 # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style.
2733 cat > conftest.$ac_ext << EOF
2734 [#]line __oline__ "configure"
2743 old_CXXFLAGS="$CXXFLAGS"
2745 if AC_TRY_EVAL(ac_compile); then
2746 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
2747 enable_sjlj_exceptions=yes
2748 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
2749 enable_sjlj_exceptions=no
2750 elif grep __cxa_end_cleanup conftest.s >/dev/null 2>&1 ; then
2751 enable_sjlj_exceptions=no
2754 CXXFLAGS="$old_CXXFLAGS"
2758 # This is a tad weird, for hysterical raisins. We have to map
2759 # enable/disable to two different models.
2760 case $enable_sjlj_exceptions in
2762 AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1,
2763 [Define if the compiler is configured for setjmp/longjmp exceptions.])
2764 ac_exception_model_name=sjlj
2767 ac_exception_model_name="call frame"
2770 AC_MSG_ERROR([unable to detect exception model])
2774 AC_MSG_RESULT($ac_exception_model_name)
2779 dnl Allow visibility attributes to be used on namespaces, objects, etc.
2781 dnl --enable-visibility enables attempt to use visibility attributes.
2782 dnl --disable-visibility turns off all use of visibility attributes.
2783 dnl + Usage: GLIBCXX_ENABLE_VISIBILITY[(DEFAULT)]
2784 dnl Where DEFAULT is 'yes'.
2786 AC_DEFUN([GLIBCXX_ENABLE_VISIBILITY], [
2787 GLIBCXX_ENABLE(visibility,$1,,[enables visibility safe usage])
2789 if test x$enable_visibility = xyes ; then
2790 dnl all hail libgfortran
2791 dnl Check whether the target supports hidden visibility.
2792 AC_CACHE_CHECK([whether the target supports hidden visibility],
2793 glibcxx_cv_have_attribute_visibility, [
2794 save_CFLAGS="$CFLAGS"
2795 CFLAGS="$CFLAGS -Werror"
2796 AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
2797 [], glibcxx_cv_have_attribute_visibility=yes,
2798 glibcxx_cv_have_attribute_visibility=no)
2799 CFLAGS="$save_CFLAGS"])
2800 if test $glibcxx_cv_have_attribute_visibility = no; then
2801 enable_visibility=no
2805 GLIBCXX_CONDITIONAL(ENABLE_VISIBILITY, test $enable_visibility = yes)
2806 AC_MSG_NOTICE([visibility supported: $enable_visibility])
2811 dnl Add version tags to symbols in shared library (or not), additionally
2812 dnl marking other symbols as private/local (or not).
2814 dnl --enable-symvers=style adds a version script to the linker call when
2815 dnl creating the shared library. The choice of version script is
2816 dnl controlled by 'style'.
2817 dnl --disable-symvers does not.
2818 dnl + Usage: GLIBCXX_ENABLE_SYMVERS[(DEFAULT)]
2819 dnl Where DEFAULT is either 'yes' or 'no'. Passing `yes' tries to
2820 dnl choose a default style based on linker characteristics. Passing
2821 dnl 'no' disables versioning.
2823 AC_DEFUN([GLIBCXX_ENABLE_SYMVERS], [
2825 GLIBCXX_ENABLE(symvers,$1,[=STYLE],
2826 [enables symbol versioning of the shared library],
2827 [permit yes|no|gnu|gnu-versioned-namespace|darwin|darwin-export|sun])
2829 # If we never went through the GLIBCXX_CHECK_LINKER_FEATURES macro, then we
2830 # don't know enough about $LD to do tricks...
2831 AC_REQUIRE([GLIBCXX_CHECK_LINKER_FEATURES])
2832 # Sun style symbol versions needs GNU c++filt for make_sunver.pl to work
2833 # with extern "C++" in version scripts.
2834 AC_REQUIRE([GCC_PROG_GNU_CXXFILT])
2836 # Turn a 'yes' into a suitable default.
2837 if test x$enable_symvers = xyes ; then
2838 if test $enable_shared = no || test "x$LD" = x || test x$gcc_no_link = xyes; then
2841 if test $with_gnu_ld = yes ; then
2842 case ${target_os} in
2844 enable_symvers=no ;;
2846 enable_symvers=gnu ;;
2849 case ${target_os} in
2851 enable_symvers=darwin ;;
2852 # Sun symbol versioning exists since Solaris 2.5.
2853 solaris2.[[5-9]]* | solaris2.1[[0-9]]*)
2854 # make_sunver.pl needs GNU c++filt to support extern "C++" in
2855 # version scripts, so disable symbol versioning if none can be
2857 if test -z "$ac_cv_path_CXXFILT"; then
2858 AC_MSG_WARN([=== You have requested Sun symbol versioning, but])
2859 AC_MSG_WARN([=== no GNU c++filt could be found.])
2860 AC_MSG_WARN([=== Symbol versioning will be disabled.])
2867 enable_symvers=no ;;
2873 # Check to see if 'darwin' or 'darwin-export' can win.
2874 if test x$enable_symvers = xdarwin-export ; then
2875 enable_symvers=darwin
2878 # Check if 'sun' was requested on non-Solaris 2 platforms.
2879 if test x$enable_symvers = xsun ; then
2880 case ${target_os} in
2886 AC_MSG_WARN([=== You have requested Sun symbol versioning, but])
2887 AC_MSG_WARN([=== you are not targetting Solaris 2.])
2888 AC_MSG_WARN([=== Symbol versioning will be disabled.])
2894 # Check to see if 'gnu' can win.
2895 if test $enable_symvers = gnu ||
2896 test $enable_symvers = gnu-versioned-namespace ||
2897 test $enable_symvers = sun; then
2898 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
2899 AC_MSG_CHECKING([for shared libgcc])
2900 ac_save_CFLAGS="$CFLAGS"
2902 AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes, glibcxx_shared_libgcc=no)
2903 CFLAGS="$ac_save_CFLAGS"
2904 if test $glibcxx_shared_libgcc = no; then
2905 cat > conftest.c <<EOF
2906 int main (void) { return 0; }
2909 glibcxx_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
2910 -shared -shared-libgcc -o conftest.so \
2911 conftest.c -v 2>&1 >/dev/null \
2912 | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
2914 rm -f conftest.c conftest.so
2915 if test x${glibcxx_libgcc_s_suffix+set} = xset; then
2916 CFLAGS=" -lgcc_s$glibcxx_libgcc_s_suffix"
2917 AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes)
2918 CFLAGS="$ac_save_CFLAGS"
2921 AC_MSG_RESULT($glibcxx_shared_libgcc)
2923 # For GNU ld, we need at least this version. The format is described in
2924 # GLIBCXX_CHECK_LINKER_FEATURES above.
2925 glibcxx_min_gnu_ld_version=21400
2927 # If no shared libgcc, can't win.
2928 if test $glibcxx_shared_libgcc != yes; then
2929 AC_MSG_WARN([=== You have requested GNU symbol versioning, but])
2930 AC_MSG_WARN([=== you are not building a shared libgcc_s.])
2931 AC_MSG_WARN([=== Symbol versioning will be disabled.])
2933 elif test $with_gnu_ld != yes && test $enable_symvers = sun; then
2934 : All interesting versions of Sun ld support sun style symbol versioning.
2935 elif test $with_gnu_ld != yes ; then
2937 AC_MSG_WARN([=== You have requested GNU symbol versioning, but])
2938 AC_MSG_WARN([=== you are not using the GNU linker.])
2939 AC_MSG_WARN([=== Symbol versioning will be disabled.])
2941 elif test $glibcxx_ld_is_gold = yes ; then
2942 : All versions of gold support symbol versioning.
2943 elif test $glibcxx_gnu_ld_version -lt $glibcxx_min_gnu_ld_version ; then
2944 # The right tools, the right setup, but too old. Fallbacks?
2945 AC_MSG_WARN(=== Linker version $glibcxx_gnu_ld_version is too old for)
2946 AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
2947 AC_MSG_WARN(=== You would need to upgrade your binutils to version)
2948 AC_MSG_WARN(=== $glibcxx_min_gnu_ld_version or later and rebuild GCC.)
2949 AC_MSG_WARN([=== Symbol versioning will be disabled.])
2954 # Everything parsed; figure out what file to use.
2955 case $enable_symvers in
2957 SYMVER_FILE=config/abi/pre/none.ver
2960 SYMVER_FILE=config/abi/pre/gnu.ver
2961 AC_DEFINE(_GLIBCXX_SYMVER_GNU, 1,
2962 [Define to use GNU versioning in the shared library.])
2964 gnu-versioned-namespace)
2965 SYMVER_FILE=config/abi/pre/gnu-versioned-namespace.ver
2966 AC_DEFINE(_GLIBCXX_SYMVER_GNU_NAMESPACE, 1,
2967 [Define to use GNU namespace versioning in the shared library.])
2970 SYMVER_FILE=config/abi/pre/gnu.ver
2971 AC_DEFINE(_GLIBCXX_SYMVER_DARWIN, 1,
2972 [Define to use darwin versioning in the shared library.])
2975 SYMVER_FILE=config/abi/pre/gnu.ver
2976 AC_DEFINE(_GLIBCXX_SYMVER_SUN, 1,
2977 [Define to use Sun versioning in the shared library.])
2981 if test x$enable_symvers != xno ; then
2982 AC_DEFINE(_GLIBCXX_SYMVER, 1,
2983 [Define to use symbol versioning in the shared library.])
2986 AC_CACHE_CHECK([whether the target supports .symver directive],
2987 glibcxx_cv_have_as_symver_directive, [
2988 AC_TRY_COMPILE([void foo (void); __asm (".symver foo, bar@SYMVER");],
2989 [], glibcxx_cv_have_as_symver_directive=yes,
2990 glibcxx_cv_have_as_symver_directive=no)])
2991 if test $glibcxx_cv_have_as_symver_directive = yes; then
2992 AC_DEFINE(HAVE_AS_SYMVER_DIRECTIVE, 1,
2993 [Define to 1 if the target assembler supports .symver directive.])
2996 AC_SUBST(SYMVER_FILE)
2997 AC_SUBST(port_specific_symbol_files)
2998 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS, test $enable_symvers != no)
2999 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU, test $enable_symvers = gnu)
3000 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU_NAMESPACE, test $enable_symvers = gnu-versioned-namespace)
3001 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_DARWIN, test $enable_symvers = darwin)
3002 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_SUN, test $enable_symvers = sun)
3003 AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
3005 if test $enable_symvers != no ; then
3006 case ${target_os} in
3007 # The Solaris 2 runtime linker doesn't support the GNU extension of
3008 # binding the same symbol to different versions
3010 symvers_renaming=no ;;
3011 # Other platforms with GNU symbol versioning (GNU/Linux, more?) do.
3013 AC_DEFINE(HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT, 1,
3014 [Define to 1 if the target runtime linker supports binding the same symbol to different versions.])
3015 symvers_renaming=yes ;;
3018 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_SOL2, test $symvers_renaming = no)
3020 # Now, set up compatibility support, if any.
3021 # In addition, need this to deal with std::size_t mangling in
3022 # src/compatibility.cc. In a perfect world, could use
3023 # typeid(std::size_t).name()[0] to do direct substitution.
3024 AC_MSG_CHECKING([for size_t as unsigned int])
3025 ac_save_CFLAGS="$CFLAGS"
3027 AC_TRY_COMPILE(, [__SIZE_TYPE__* stp; unsigned int* uip; stp = uip;],
3028 [glibcxx_size_t_is_i=yes], [glibcxx_size_t_is_i=no])
3029 CFLAGS=$ac_save_CFLAGS
3030 if test "$glibcxx_size_t_is_i" = yes; then
3031 AC_DEFINE(_GLIBCXX_SIZE_T_IS_UINT, 1, [Define if size_t is unsigned int.])
3033 AC_MSG_RESULT([$glibcxx_size_t_is_i])
3035 AC_MSG_CHECKING([for ptrdiff_t as int])
3036 ac_save_CFLAGS="$CFLAGS"
3038 AC_TRY_COMPILE(, [__PTRDIFF_TYPE__* ptp; int* ip; ptp = ip;],
3039 [glibcxx_ptrdiff_t_is_i=yes], [glibcxx_ptrdiff_t_is_i=no])
3040 CFLAGS=$ac_save_CFLAGS
3041 if test "$glibcxx_ptrdiff_t_is_i" = yes; then
3042 AC_DEFINE(_GLIBCXX_PTRDIFF_T_IS_INT, 1, [Define if ptrdiff_t is int.])
3044 AC_MSG_RESULT([$glibcxx_ptrdiff_t_is_i])
3049 dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
3050 dnl We must stage the required headers so that they will be installed
3051 dnl with the library (unlike libgcc, the STL implementation is provided
3052 dnl solely within headers). Since we must not inject random user-space
3053 dnl macro names into user-provided C++ code, we first stage into <file>-in
3054 dnl and process to <file> with an output command. The reason for a two-
3055 dnl stage process here is to correctly handle $srcdir!=$objdir without
3056 dnl having to write complex code (the sed commands to clean the macro
3057 dnl namespace are complex and fragile enough as it is). We must also
3058 dnl add a relative path so that -I- is supported properly.
3061 dnl glibcxx_thread_h
3064 dnl HAVE_GTHR_DEFAULT
3066 AC_DEFUN([GLIBCXX_ENABLE_THREADS], [
3067 AC_MSG_CHECKING([for thread model used by GCC])
3068 target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
3069 AC_MSG_RESULT([$target_thread_file])
3071 if test $target_thread_file != single; then
3072 AC_DEFINE(HAVE_GTHR_DEFAULT, 1,
3073 [Define if gthr-default.h exists
3074 (meaning that threading support is enabled).])
3077 glibcxx_thread_h=gthr-$target_thread_file.h
3079 dnl Check for __GTHREADS define.
3080 gthread_file=${toplevel_srcdir}/gcc/${glibcxx_thread_h}
3081 if grep __GTHREADS $gthread_file >/dev/null 2>&1 ; then
3087 AC_SUBST(glibcxx_thread_h)
3092 dnl Check if gthread implementation defines the types and functions
3093 dnl required by the c++0x thread library. Conforming gthread
3094 dnl implementations can define __GTHREADS_CXX0X to enable use with c++0x.
3096 AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
3100 ac_save_CXXFLAGS="$CXXFLAGS"
3101 CXXFLAGS="$CXXFLAGS -fno-exceptions -I${toplevel_srcdir}/gcc"
3103 target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
3104 case $target_thread_file in
3106 CXXFLAGS="$CXXFLAGS -DSUPPORTS_WEAK -DGTHREAD_USE_WEAK -D_PTHREADS"
3109 AC_MSG_CHECKING([for gthreads library])
3111 AC_TRY_COMPILE([#include "gthr.h"],
3113 #ifndef __GTHREADS_CXX0X
3117 // In case of POSIX threads check _POSIX_TIMEOUTS too.
3118 #if (defined(_PTHREADS) \
3119 && (!defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS <= 0))
3122 ], [ac_has_gthreads=yes], [ac_has_gthreads=no])
3124 AC_MSG_RESULT([$ac_has_gthreads])
3126 if test x"$ac_has_gthreads" = x"yes"; then
3127 AC_DEFINE(_GLIBCXX_HAS_GTHREADS, 1,
3128 [Define if gthreads library is available.])
3131 CXXFLAGS="$ac_save_CXXFLAGS"
3136 # Check whether LC_MESSAGES is available in <locale.h>.
3137 # Ulrich Drepper <drepper@cygnus.com>, 1995.
3139 # This file file be copied and used freely without restrictions. It can
3140 # be used in projects which are not available under the GNU Public License
3141 # but which still want to provide support for the GNU gettext functionality.
3142 # Please note that the actual code is *not* freely available.
3143 AC_DEFUN([AC_LC_MESSAGES], [
3144 AC_CHECK_HEADER(locale.h, [
3145 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
3146 [AC_TRY_COMPILE([#include <locale.h>], [return LC_MESSAGES],
3147 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
3148 if test $ac_cv_val_LC_MESSAGES = yes; then
3149 AC_DEFINE(HAVE_LC_MESSAGES, 1,
3150 [Define if LC_MESSAGES is available in <locale.h>.])
3155 # Macros from the top-level gcc directory.
3156 m4_include([../config/gc++filt.m4])
3157 m4_include([../config/tls.m4])