2 dnl GLIBCXX_CONDITIONAL (NAME, SHELL-TEST)
4 dnl Exactly like AM_CONDITIONAL, but delays evaluation of the test until the
5 dnl end of configure. This lets tested variables be reassigned, and the
6 dnl conditional will depend on the final state of the variable. For a simple
7 dnl example of why this is needed, see GLIBCXX_ENABLE_HOSTED.
9 m4_define([_m4_divert(glibcxx_diversion)], 8000)dnl
10 AC_DEFUN([GLIBCXX_CONDITIONAL], [dnl
11 m4_divert_text([glibcxx_diversion],dnl
12 AM_CONDITIONAL([$1],[$2])
15 AC_DEFUN([GLIBCXX_EVALUATE_CONDITIONALS], [m4_undivert([glibcxx_diversion])])dnl
19 dnl Check to see what architecture and operating system we are compiling
20 dnl for. Also, if architecture- or OS-specific flags are required for
21 dnl compilation, pick them up here.
23 AC_DEFUN([GLIBCXX_CHECK_HOST], [
24 . $glibcxx_srcdir/configure.host
25 AC_MSG_NOTICE([CPU config directory is $cpu_include_dir])
26 AC_MSG_NOTICE([OS config directory is $os_include_dir])
30 dnl Initialize the rest of the library configury. At this point we have
31 dnl variables like $host.
36 dnl glibcxx_builddir (absolute path)
37 dnl glibcxx_srcdir (absolute path)
38 dnl toplevel_srcdir (absolute path)
41 dnl with_target_subdir
43 dnl - the variables in GLIBCXX_CHECK_HOST / configure.host
44 dnl - default settings for all AM_CONFITIONAL test variables
45 dnl - lots of tools, like CC and CXX
47 AC_DEFUN([GLIBCXX_CONFIGURE], [
48 # Keep these sync'd with the list in Makefile.am. The first provides an
49 # expandable list at autoconf time; the second provides an expandable list
50 # (i.e., shell variable) at configure time.
51 m4_define([glibcxx_SUBDIRS],[include libsupc++ python src doc po testsuite])
52 SUBDIRS='glibcxx_SUBDIRS'
54 # These need to be absolute paths, yet at the same time need to
55 # canonicalize only relative paths, because then amd will not unmount
56 # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
57 glibcxx_builddir=`${PWDCMD-pwd}`
59 [\\/$]* | ?:[\\/]*) glibcxx_srcdir=${srcdir} ;;
60 *) glibcxx_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
62 toplevel_srcdir=${glibcxx_srcdir}/..
63 AC_SUBST(glibcxx_builddir)
64 AC_SUBST(glibcxx_srcdir)
65 AC_SUBST(toplevel_srcdir)
67 # We use these options to decide which functions to include. They are
68 # set from the top level.
69 AC_ARG_WITH([target-subdir],
70 AC_HELP_STRING([--with-target-subdir=SUBDIR],
71 [configuring in a subdirectory]))
73 AC_ARG_WITH([cross-host],
74 AC_HELP_STRING([--with-cross-host=HOST],
75 [configuring with a cross compiler]))
78 AC_HELP_STRING([--with-newlib],
79 [assume newlib as a system C library]))
81 # Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't
82 # available). Uncomment the next line to force a particular method.
88 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
92 # Set up safe default values for all subsequent AM_CONDITIONAL tests
93 # which are themselves conditionally expanded.
94 ## (Right now, this only matters for enable_wchar_t, but nothing prevents
95 ## other macros from doing the same. This should be automated.) -pme
97 # Check for C library flavor since Linux platforms use different configuration
98 # directories depending on the C library in use.
99 AC_EGREP_CPP([_using_uclibc], [
104 ], uclibc=yes, uclibc=no)
106 AC_EGREP_CPP([_using_bionic], [
111 ], bionic=yes, bionic=no)
113 # Find platform-specific directories containing configuration info.
114 # Also possibly modify flags used elsewhere, as needed by the platform.
120 dnl Tests for newer compiler features, or features that are present in newer
121 dnl compiler versions but not older compiler versions still in use, should
125 dnl WERROR='-Werror' if requested and possible; g++'s that lack the
126 dnl new inlining code or the new system_header pragma will die on -Werror.
127 dnl Leave it out by default and use maint-mode to use it.
128 dnl SECTION_FLAGS='-ffunction-sections -fdata-sections' if
129 dnl compiler supports it and the user has not requested debug mode.
131 AC_DEFUN([GLIBCXX_CHECK_COMPILER_FEATURES], [
132 # All these tests are for C++; save the language and the compiler flags.
133 # The CXXFLAGS thing is suspicious, but based on similar bits previously
134 # found in GLIBCXX_CONFIGURE.
137 ac_test_CXXFLAGS="${CXXFLAGS+set}"
138 ac_save_CXXFLAGS="$CXXFLAGS"
140 # Check for maintainer-mode bits.
141 if test x"$USE_MAINTAINER_MODE" = xno; then
147 # Check for -ffunction-sections -fdata-sections
148 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
149 CXXFLAGS='-g -Werror -ffunction-sections -fdata-sections'
150 AC_TRY_COMPILE([int foo; void bar() { };],, [ac_fdsections=yes], [ac_fdsections=no])
151 if test "$ac_test_CXXFLAGS" = set; then
152 CXXFLAGS="$ac_save_CXXFLAGS"
154 # this is the suspicious part
157 if test x"$ac_fdsections" = x"yes"; then
158 SECTION_FLAGS='-ffunction-sections -fdata-sections'
160 AC_MSG_RESULT($ac_fdsections)
164 AC_SUBST(SECTION_FLAGS)
169 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
170 dnl the native linker is in use, all variables will be defined to something
171 dnl safe (like an empty string).
174 dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible
175 dnl OPT_LDFLAGS='-Wl,-O1' and '-z,relro' if possible
176 dnl LD (as a side effect of testing)
179 dnl glibcxx_ld_is_gold (set to "no" or "yes")
180 dnl glibcxx_gnu_ld_version (possibly)
182 dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
183 dnl set glibcxx_gnu_ld_version to 12345. Zeros cause problems.
185 AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [
186 # If we're not using GNU ld, then there's no point in even trying these
187 # tests. Check for that first. We should have already tested for gld
188 # by now (in libtool), but require it now just to be safe...
189 test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
190 test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
191 AC_REQUIRE([AC_PROG_LD])
192 AC_REQUIRE([AC_PROG_AWK])
194 # The name set by libtool depends on the version of libtool. Shame on us
195 # for depending on an impl detail, but c'est la vie. Older versions used
196 # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
197 # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
198 # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
199 # set (hence we're using an older libtool), then set it.
200 if test x${with_gnu_ld+set} != xset; then
201 if test x${ac_cv_prog_gnu_ld+set} != xset; then
202 # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
205 with_gnu_ld=$ac_cv_prog_gnu_ld
209 # Start by getting the version number. I think the libtool test already
210 # does some of this, but throws away the result.
211 glibcxx_ld_is_gold=no
212 if test x"$with_gnu_ld" = x"yes"; then
213 AC_MSG_CHECKING([for ld version])
215 if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; then
216 glibcxx_ld_is_gold=yes
218 ldver=`$LD --version 2>/dev/null |
219 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'`
221 glibcxx_gnu_ld_version=`echo $ldver | \
222 $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
223 AC_MSG_RESULT($glibcxx_gnu_ld_version)
227 glibcxx_have_gc_sections=no
228 if test "$glibcxx_ld_is_gold" = "yes"; then
229 if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then
230 glibcxx_have_gc_sections=yes
233 glibcxx_gcsections_min_ld=21602
234 if test x"$with_gnu_ld" = x"yes" &&
235 test $glibcxx_gnu_ld_version -gt $glibcxx_gcsections_min_ld ; then
236 glibcxx_have_gc_sections=yes
239 if test "$glibcxx_have_gc_sections" = "yes"; then
240 # Sufficiently young GNU ld it is! Joy and bunny rabbits!
241 # NB: This flag only works reliably after 2.16.1. Configure tests
242 # for this are difficult, so hard wire a value that should work.
244 ac_test_CFLAGS="${CFLAGS+set}"
245 ac_save_CFLAGS="$CFLAGS"
246 CFLAGS='-Wl,--gc-sections'
248 # Check for -Wl,--gc-sections
249 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
250 AC_TRY_LINK([ int one(void) { return 1; }
251 int two(void) { return 2; }
252 ], [ two(); ] , [ac_gcsections=yes], [ac_gcsections=no])
253 if test "$ac_gcsections" = "yes"; then
256 if $CC -c conftest.c; then
257 if $LD --gc-sections -o conftest conftest.o 2>&1 | \
258 grep "Warning: gc-sections option ignored" > /dev/null; then
262 rm -f conftest.c conftest.o conftest
264 if test "$ac_gcsections" = "yes"; then
265 SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
267 AC_MSG_RESULT($ac_gcsections)
269 if test "$ac_test_CFLAGS" = set; then
270 CFLAGS="$ac_save_CFLAGS"
272 # this is the suspicious part
278 # Note this is only for shared objects.
280 if test x"$with_gnu_ld" = x"yes"; then
281 AC_MSG_CHECKING([for ld that supports -Wl,-z,relro])
282 cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"`
283 if test -n "$cxx_z_relo"; then
284 OPT_LDFLAGS="-Wl,-z,relro"
287 AC_MSG_RESULT($ac_ld_relro)
290 # Set linker optimization flags.
291 if test x"$with_gnu_ld" = x"yes"; then
292 OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
295 AC_SUBST(SECTION_LDFLAGS)
296 AC_SUBST(OPT_LDFLAGS)
301 dnl Check for headers for, and arguments to, the setrlimit() function.
302 dnl Used only in testsuite_hooks.h. Called from GLIBCXX_CONFIGURE_TESTSUITE.
305 dnl _GLIBCXX_RES_LIMITS if we can set artificial resource limits
306 dnl various HAVE_LIMIT_* for individual limit names
308 AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT_ancilliary], [
309 AC_MSG_CHECKING([for RLIMIT_$1])
312 #include <sys/time.h>
313 #include <sys/resource.h>
315 [ int f = RLIMIT_$1 ; ],
316 [glibcxx_mresult=1], [glibcxx_mresult=0])
317 AC_DEFINE_UNQUOTED(HAVE_LIMIT_$1, $glibcxx_mresult,
318 [Only used in build directory testsuite_hooks.h.])
319 if test $glibcxx_mresult = 1 ; then res=yes ; else res=no ; fi
323 AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT], [
324 setrlimit_have_headers=yes
325 AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h,
327 [setrlimit_have_headers=no])
328 # If don't have the headers, then we can't run the tests now, and we
329 # won't be seeing any of these during testsuite compilation.
330 if test $setrlimit_have_headers = yes; then
331 # Can't do these in a loop, else the resulting syntax is wrong.
332 GLIBCXX_CHECK_SETRLIMIT_ancilliary(DATA)
333 GLIBCXX_CHECK_SETRLIMIT_ancilliary(RSS)
334 GLIBCXX_CHECK_SETRLIMIT_ancilliary(VMEM)
335 GLIBCXX_CHECK_SETRLIMIT_ancilliary(AS)
336 GLIBCXX_CHECK_SETRLIMIT_ancilliary(FSIZE)
338 # Check for rlimit, setrlimit.
339 AC_CACHE_VAL(glibcxx_cv_setrlimit, [
342 #include <sys/time.h>
343 #include <sys/resource.h>
347 [glibcxx_cv_setrlimit=yes], [glibcxx_cv_setrlimit=no])
351 AC_MSG_CHECKING([for testsuite resource limits support])
352 if test $setrlimit_have_headers = yes && test $glibcxx_cv_setrlimit = yes; then
354 AC_DEFINE(_GLIBCXX_RES_LIMITS, 1,
355 [Define if using setrlimit to set resource limits during
360 AC_MSG_RESULT($ac_res_limits)
365 dnl Check whether S_ISREG (Posix) or S_IFREG is available in <sys/stat.h>.
366 dnl Define HAVE_S_ISREG / HAVE_S_IFREG appropriately.
368 AC_DEFUN([GLIBCXX_CHECK_S_ISREG_OR_S_IFREG], [
372 ac_save_CXXFLAGS="$CXXFLAGS"
373 CXXFLAGS="$CXXFLAGS -fno-exceptions"
375 AC_MSG_CHECKING([for S_ISREG or S_IFREG])
376 AC_CACHE_VAL(glibcxx_cv_S_ISREG, [
377 GCC_TRY_COMPILE_OR_LINK(
378 [#include <sys/stat.h>],
381 S_ISREG(buffer.st_mode);],
382 [glibcxx_cv_S_ISREG=yes],
383 [glibcxx_cv_S_ISREG=no])
385 AC_CACHE_VAL(glibcxx_cv_S_IFREG, [
386 GCC_TRY_COMPILE_OR_LINK(
387 [#include <sys/stat.h>],
390 S_IFREG & buffer.st_mode;],
391 [glibcxx_cv_S_IFREG=yes],
392 [glibcxx_cv_S_IFREG=no])
395 if test $glibcxx_cv_S_ISREG = yes; then
396 AC_DEFINE(HAVE_S_ISREG, 1,
397 [Define if S_IFREG is available in <sys/stat.h>.])
399 elif test $glibcxx_cv_S_IFREG = yes; then
400 AC_DEFINE(HAVE_S_IFREG, 1,
401 [Define if S_IFREG is available in <sys/stat.h>.])
406 CXXFLAGS="$ac_save_CXXFLAGS"
412 dnl Check whether poll is available in <poll.h>, and define HAVE_POLL.
414 AC_DEFUN([GLIBCXX_CHECK_POLL], [
418 ac_save_CXXFLAGS="$CXXFLAGS"
419 CXXFLAGS="$CXXFLAGS -fno-exceptions"
421 AC_MSG_CHECKING([for poll])
422 AC_CACHE_VAL(glibcxx_cv_POLL, [
423 GCC_TRY_COMPILE_OR_LINK(
425 [struct pollfd pfd[1];
426 pfd[0].events = POLLIN;
428 [glibcxx_cv_POLL=yes],
429 [glibcxx_cv_POLL=no])
431 if test $glibcxx_cv_POLL = yes; then
432 AC_DEFINE(HAVE_POLL, 1, [Define if poll is available in <poll.h>.])
434 AC_MSG_RESULT($glibcxx_cv_POLL)
436 CXXFLAGS="$ac_save_CXXFLAGS"
442 dnl Check whether writev is available in <sys/uio.h>, and define HAVE_WRITEV.
444 AC_DEFUN([GLIBCXX_CHECK_WRITEV], [
448 ac_save_CXXFLAGS="$CXXFLAGS"
449 CXXFLAGS="$CXXFLAGS -fno-exceptions"
451 AC_MSG_CHECKING([for writev])
452 AC_CACHE_VAL(glibcxx_cv_WRITEV, [
453 GCC_TRY_COMPILE_OR_LINK(
454 [#include <sys/uio.h>],
455 [struct iovec iov[2];
457 [glibcxx_cv_WRITEV=yes],
458 [glibcxx_cv_WRITEV=no])
460 if test $glibcxx_cv_WRITEV = yes; then
461 AC_DEFINE(HAVE_WRITEV, 1, [Define if writev is available in <sys/uio.h>.])
463 AC_MSG_RESULT($glibcxx_cv_WRITEV)
465 CXXFLAGS="$ac_save_CXXFLAGS"
471 dnl Check whether int64_t is available in <stdint.h>, and define HAVE_INT64_T.
472 dnl Also check whether int64_t is actually a typedef to long or long long.
474 AC_DEFUN([GLIBCXX_CHECK_INT64_T], [
479 AC_MSG_CHECKING([for int64_t])
480 AC_CACHE_VAL(glibcxx_cv_INT64_T, [
482 [#include <stdint.h>],
484 [glibcxx_cv_INT64_T=yes],
485 [glibcxx_cv_INT64_T=no])
488 if test $glibcxx_cv_INT64_T = yes; then
489 AC_DEFINE(HAVE_INT64_T, 1, [Define if int64_t is available in <stdint.h>.])
490 AC_MSG_RESULT($glibcxx_cv_INT64_T)
492 AC_MSG_CHECKING([for int64_t as long])
493 AC_CACHE_VAL(glibcxx_cv_int64_t_long, [
496 template<typename, typename> struct same { enum { value = -1 }; };
497 template<typename Tp> struct same<Tp, Tp> { enum { value = 1 }; };
498 int array[same<int64_t, long>::value];], [],
499 [glibcxx_cv_int64_t_long=yes], [glibcxx_cv_int64_t_long=no])
502 if test $glibcxx_cv_int64_t_long = yes; then
503 AC_DEFINE(HAVE_INT64_T_LONG, 1, [Define if int64_t is a long.])
504 AC_MSG_RESULT($glibcxx_cv_int64_t_long)
507 AC_MSG_CHECKING([for int64_t as long long])
508 AC_CACHE_VAL(glibcxx_cv_int64_t_long_long, [
511 template<typename, typename> struct same { enum { value = -1 }; };
512 template<typename Tp> struct same<Tp, Tp> { enum { value = 1 }; };
513 int array[same<int64_t, long long>::value];], [],
514 [glibcxx_cv_int64_t_long_long=yes], [glibcxx_cv_int64_t_long_long=no])
517 if test $glibcxx_cv_int64_t_long_long = yes; then
518 AC_DEFINE(HAVE_INT64_T_LONG_LONG, 1, [Define if int64_t is a long long.])
519 AC_MSG_RESULT($glibcxx_cv_int64_t_long_long)
528 dnl Check whether LFS support is available.
530 AC_DEFUN([GLIBCXX_CHECK_LFS], [
533 ac_save_CXXFLAGS="$CXXFLAGS"
534 CXXFLAGS="$CXXFLAGS -fno-exceptions"
535 AC_MSG_CHECKING([for LFS support])
536 AC_CACHE_VAL(glibcxx_cv_LFS, [
537 GCC_TRY_COMPILE_OR_LINK(
540 #include <sys/stat.h>
544 fseeko64(fp, 0, SEEK_CUR);
546 lseek64(1, 0, SEEK_CUR);
549 [glibcxx_cv_LFS=yes],
552 if test $glibcxx_cv_LFS = yes; then
553 AC_DEFINE(_GLIBCXX_USE_LFS, 1, [Define if LFS support is available.])
555 AC_MSG_RESULT($glibcxx_cv_LFS)
556 CXXFLAGS="$ac_save_CXXFLAGS"
562 dnl Check for whether a fully dynamic basic_string implementation should
563 dnl be turned on, that does not put empty objects in per-process static
564 dnl memory (mostly useful together with shared memory allocators, see PR
565 dnl libstdc++/16612 for details).
567 dnl --enable-fully-dynamic-string defines _GLIBCXX_FULLY_DYNAMIC_STRING
568 dnl --disable-fully-dynamic-string leaves _GLIBCXX_FULLY_DYNAMIC_STRING undefined
569 dnl + Usage: GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING[(DEFAULT)]
570 dnl Where DEFAULT is either `yes' or `no'.
572 AC_DEFUN([GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING], [
573 GLIBCXX_ENABLE(fully-dynamic-string,$1,,[do not put empty strings in per-process static memory])
574 if test $enable_fully_dynamic_string = yes; then
575 AC_DEFINE(_GLIBCXX_FULLY_DYNAMIC_STRING, 1,
576 [Define if a fully dynamic basic_string is wanted.])
582 dnl Does any necessary configuration of the testsuite directory. Generates
583 dnl the testsuite_hooks.h header.
585 dnl GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE must be done before this.
589 dnl GLIBCXX_TEST_WCHAR_T
590 dnl GLIBCXX_TEST_THREAD
593 dnl baseline_subdir_switch
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)
621 baseline_subdir_switch="$abi_baseline_subdir_switch"
622 AC_SUBST(baseline_subdir_switch)
627 dnl Does any necessary configuration of the documentation directory.
629 dnl XSLTPROC must be set before this
632 dnl glibcxx_stylesheets
636 AC_DEFUN([GLIBCXX_CONFIGURE_DOCBOOK], [
638 AC_MSG_CHECKING([for stylesheets used in generation of documentation])
639 glibcxx_stylesheets=no
640 if test x${XSLTPROC} = xyes && echo '<title/>' | xsltproc --noout --nonet --xinclude http://docbook.sourceforge.net/release/xsl-ns/current/xhtml-1_1/docbook.xsl - 2>/dev/null; then
641 glibcxx_stylesheets=yes
643 AC_MSG_RESULT($glibcxx_stylesheets)
645 AC_MSG_CHECKING([for local stylesheet directory])
646 glibcxx_local_stylesheets=no
647 if test x"$glibcxx_stylesheets" = x"yes"; then
648 if test -d /usr/share/sgml/docbook/xsl-ns-stylesheets; then
649 glibcxx_local_stylesheets=yes
650 XSL_STYLE_DIR=/usr/share/sgml/docbook/xsl-ns-stylesheets
652 if test -d /usr/share/xml/docbook/stylesheet/docbook-xsl-ns; then
653 glibcxx_local_stylesheets=yes
654 XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns
657 AC_MSG_RESULT($glibcxx_local_stylesheets)
659 if test x"$glibcxx_local_stylesheets" = x"yes"; then
660 AC_SUBST(XSL_STYLE_DIR)
661 AC_MSG_NOTICE($XSL_STYLE_DIR)
663 glibcxx_stylesheets=no
669 dnl Set up *_INCLUDES variables for all sundry Makefile.am's.
673 dnl TOPLEVEL_INCLUDES
675 AC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [
676 # Used for every C++ compile we perform.
678 -I$glibcxx_builddir/include/$host_alias \
679 -I$glibcxx_builddir/include \
680 -I$glibcxx_srcdir/libsupc++"
682 # For Canadian crosses, pick this up too.
683 if test $CANADIAN = yes; then
684 GLIBCXX_INCLUDES="$GLIBCXX_INCLUDES -I\${includedir}"
687 # Stuff in the actual top level. Currently only used by libsupc++ to
688 # get unwind* headers from the libgcc dir.
689 #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/libgcc -I$(toplevel_srcdir)/include'
690 TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/libgcc'
692 # Now, export this to all the little Makefiles....
693 AC_SUBST(GLIBCXX_INCLUDES)
694 AC_SUBST(TOPLEVEL_INCLUDES)
699 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
700 dnl (SECTION_FLAGS is done under CHECK_COMPILER_FEATURES.)
703 dnl OPTIMIZE_CXXFLAGS
706 AC_DEFUN([GLIBCXX_EXPORT_FLAGS], [
707 # Optimization flags that are probably a good idea for thrill-seekers. Just
708 # uncomment the lines below and make, everything else is ready to go...
709 # Alternatively OPTIMIZE_CXXFLAGS can be set in configure.host.
710 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
711 AC_SUBST(OPTIMIZE_CXXFLAGS)
713 WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
719 dnl All installation directory information is determined here.
723 dnl glibcxx_prefixdir
724 dnl glibcxx_toolexecdir
725 dnl glibcxx_toolexeclibdir
727 dnl Assumes cross_compiling bits already done, and with_cross_host in
730 dnl This logic must match gcc/configure.ac's setting of gcc_gxx_include_dir.
731 dnl config/gxx-include-dir.m4 must be kept consistant with this as well.
732 AC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [
733 glibcxx_toolexecdir=no
734 glibcxx_toolexeclibdir=no
735 glibcxx_prefixdir=$prefix
737 AC_MSG_CHECKING([for gxx-include-dir])
738 AC_ARG_WITH([gxx-include-dir],
739 AC_HELP_STRING([--with-gxx-include-dir=DIR],
740 [installation directory for include files]),
742 yes) AC_MSG_ERROR([Missing directory for --with-gxx-include-dir]) ;;
743 no) gxx_include_dir=no ;;
744 *) gxx_include_dir=$withval ;;
746 [gxx_include_dir=no])
747 AC_MSG_RESULT($gxx_include_dir)
749 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
750 AC_ARG_ENABLE([version-specific-runtime-libs],
751 AC_HELP_STRING([--enable-version-specific-runtime-libs],
752 [Specify that runtime libraries should be installed in a compiler-specific directory]),
753 [case "$enableval" in
754 yes) version_specific_libs=yes ;;
755 no) version_specific_libs=no ;;
756 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
758 [version_specific_libs=no])
759 AC_MSG_RESULT($version_specific_libs)
761 # Default case for install directory for include files.
762 if test $version_specific_libs = no && test $gxx_include_dir = no; then
763 gxx_include_dir='include/c++/${gcc_version}'
764 if test -n "$with_cross_host" &&
765 test x"$with_cross_host" != x"no"; then
766 gxx_include_dir='${prefix}/${target_alias}/'"$gxx_include_dir"
768 gxx_include_dir='${prefix}/'"$gxx_include_dir"
772 # Version-specific runtime libs processing.
773 if test $version_specific_libs = yes; then
774 # Need the gcc compiler version to know where to install libraries
775 # and header files if --enable-version-specific-runtime-libs option
776 # is selected. FIXME: these variables are misnamed, there are
777 # no executables installed in _toolexecdir or _toolexeclibdir.
778 if test x"$gxx_include_dir" = x"no"; then
779 gxx_include_dir='${libdir}/gcc/${host_alias}/${gcc_version}/include/c++'
781 glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
782 glibcxx_toolexeclibdir='${toolexecdir}/${gcc_version}$(MULTISUBDIR)'
785 # Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir
786 # Install a library built with a cross compiler in tooldir, not libdir.
787 if test x"$glibcxx_toolexecdir" = x"no"; then
788 if test -n "$with_cross_host" &&
789 test x"$with_cross_host" != x"no"; then
790 glibcxx_toolexecdir='${exec_prefix}/${host_alias}'
791 glibcxx_toolexeclibdir='${toolexecdir}/lib'
793 glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
794 glibcxx_toolexeclibdir='${libdir}'
796 multi_os_directory=`$CXX -print-multi-os-directory`
797 case $multi_os_directory in
798 .) ;; # Avoid trailing /.
799 *) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;;
803 AC_MSG_CHECKING([for install location])
804 AC_MSG_RESULT($gxx_include_dir)
806 AC_SUBST(glibcxx_prefixdir)
807 AC_SUBST(gxx_include_dir)
808 AC_SUBST(glibcxx_toolexecdir)
809 AC_SUBST(glibcxx_toolexeclibdir)
815 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
816 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
817 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
819 dnl See docs/html/17_intro/configury.html#enable for documentation.
821 m4_define([GLIBCXX_ENABLE],[dnl
822 m4_define([_g_switch],[--enable-$1])dnl
823 m4_define([_g_help],[AC_HELP_STRING([_g_switch$3],[$4 @<:@default=$2@:>@])])dnl
824 AC_ARG_ENABLE([$1],m4_dquote(_g_help),
829 m4_bpatsubst([$5],[permit ])) ;;
830 *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
831 dnl Idea for future: generate a URL pointing to
832 dnl "onlinedocs/configopts.html#whatever"
839 *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
843 [enable_]m4_bpatsubst([$1],-,_)[=][$2])
844 m4_undefine([_g_switch])dnl
845 m4_undefine([_g_help])dnl
850 dnl Check for ISO/IEC 9899:1999 "C99" support.
852 dnl --enable-c99 defines _GLIBCXX_USE_C99
853 dnl --disable-c99 leaves _GLIBCXX_USE_C99 undefined
854 dnl + Usage: GLIBCXX_ENABLE_C99[(DEFAULT)]
855 dnl Where DEFAULT is either `yes' or `no'.
856 dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
858 AC_DEFUN([GLIBCXX_ENABLE_C99], [
859 GLIBCXX_ENABLE(c99,$1,,[turns on ISO/IEC 9899:1999 support])
861 if test x"$enable_c99" = x"yes"; then
866 # Use -std=c++98 because the default (-std=gnu++98) leaves __STRICT_ANSI__
867 # undefined and fake C99 facilities - like pre-standard snprintf - may be
868 # spuriously enabled.
869 # Long term, -std=c++0x could be even better, could manage to explicitely
870 # request C99 facilities to the underlying C headers.
871 ac_save_CXXFLAGS="$CXXFLAGS"
872 CXXFLAGS="$CXXFLAGS -std=c++98"
874 ac_save_gcc_no_link="$gcc_no_link"
876 if test x$gcc_no_link != xyes; then
877 # Use -fno-exceptions to that the C driver can link these tests without
878 # hitting undefined references to personality routines.
879 CXXFLAGS="$CXXFLAGS -fno-exceptions"
880 AC_CHECK_LIB(m, sin, [
883 # Use the default compile-only tests in GCC_TRY_COMPILE_OR_LINK
888 # Check for the existence of <math.h> functions used if C99 is enabled.
889 AC_MSG_CHECKING([for ISO C99 support in <math.h>])
890 AC_CACHE_VAL(glibcxx_cv_c99_math, [
891 GCC_TRY_COMPILE_OR_LINK(
893 volatile double d1, d2;
901 i = isgreater(d1, d2);
902 i = isgreaterequal(d1, d2);
904 i = islessequal(d1, d2);
905 i = islessgreater(d1, d2);
906 i = islessgreater(d1, d2);
907 i = isunordered(d1, d2);
908 ],[glibcxx_cv_c99_math=yes], [glibcxx_cv_c99_math=no])
910 AC_MSG_RESULT($glibcxx_cv_c99_math)
911 if test x"$glibcxx_cv_c99_math" = x"yes"; then
912 AC_DEFINE(_GLIBCXX_USE_C99_MATH, 1,
913 [Define if C99 functions or macros in <math.h> should be imported
914 in <cmath> in namespace std.])
917 # Check for the existence of <complex.h> complex math functions.
918 # This is necessary even though libstdc++ uses the builtin versions
919 # of these functions, because if the builtin cannot be used, a reference
920 # to the library function is emitted.
921 AC_CHECK_HEADERS(tgmath.h, ac_has_tgmath_h=yes, ac_has_tgmath_h=no)
922 AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no)
923 glibcxx_cv_c99_complex=no;
924 if test x"$ac_has_complex_h" = x"yes"; then
925 AC_MSG_CHECKING([for ISO C99 support in <complex.h>])
926 GCC_TRY_COMPILE_OR_LINK(
927 [#include <complex.h>
928 typedef __complex__ float float_type;
929 typedef __complex__ double double_type;
930 typedef __complex__ long double ld_type;
931 volatile float_type tmpf;
932 volatile double_type tmpd;
933 volatile ld_type tmpld;
936 volatile long double ld;],
948 tmpf = cpowf(tmpf, tmpf);
961 tmpd = cpow(tmpd, tmpd);
965 tmpld = ccosl(tmpld);
966 tmpld = ccoshl(tmpld);
967 tmpld = cexpl(tmpld);
968 tmpld = clogl(tmpld);
969 tmpld = csinl(tmpld);
970 tmpld = csinhl(tmpld);
971 tmpld = csqrtl(tmpld);
972 tmpld = ctanl(tmpld);
973 tmpld = ctanhl(tmpld);
974 tmpld = cpowl(tmpld, tmpld);
975 tmpld = cprojl(tmpld);
976 ],[glibcxx_cv_c99_complex=yes], [glibcxx_cv_c99_complex=no])
978 AC_MSG_RESULT($glibcxx_cv_c99_complex)
979 if test x"$glibcxx_cv_c99_complex" = x"yes"; then
980 AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX, 1,
981 [Define if C99 functions in <complex.h> should be used in
982 <complex>. Using compiler builtins for these functions requires
983 corresponding C99 library functions to be present.])
986 # Check for the existence in <stdio.h> of vscanf, et. al.
987 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
988 AC_CACHE_VAL(glibcxx_cv_c99_stdio, [
989 GCC_TRY_COMPILE_OR_LINK(
992 void foo(char* fmt, ...)
994 va_list args; va_start(args, fmt);
995 vfscanf(stderr, "%i", args);
997 vsnprintf(fmt, 0, "%i", args);
998 vsscanf(fmt, "%i", args);
1000 [snprintf("12", 0, "%i");],
1001 [glibcxx_cv_c99_stdio=yes], [glibcxx_cv_c99_stdio=no])
1003 AC_MSG_RESULT($glibcxx_cv_c99_stdio)
1005 # Check for the existence in <stdlib.h> of lldiv_t, et. al.
1006 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
1007 AC_CACHE_VAL(glibcxx_cv_c99_stdlib, [
1008 GCC_TRY_COMPILE_OR_LINK(
1009 [#include <stdlib.h>
1011 volatile long double ld;
1012 volatile unsigned long long ll;
1015 f = strtof("gnu", &tmp);
1016 ld = strtold("gnu", &tmp);
1017 ll = strtoll("gnu", &tmp, 10);
1018 ll = strtoull("gnu", &tmp, 10);
1020 mydivt = lldiv(10,1);
1025 ],[glibcxx_cv_c99_stdlib=yes], [glibcxx_cv_c99_stdlib=no])
1027 AC_MSG_RESULT($glibcxx_cv_c99_stdlib)
1029 # Check for the existence in <wchar.h> of wcstold, etc.
1030 glibcxx_cv_c99_wchar=no;
1031 if test x"$ac_has_wchar_h" = xyes &&
1032 test x"$ac_has_wctype_h" = xyes; then
1033 AC_MSG_CHECKING([for ISO C99 support in <wchar.h>])
1034 AC_TRY_COMPILE([#include <wchar.h>
1041 ],[],[glibcxx_cv_c99_wchar=yes], [glibcxx_cv_c99_wchar=no])
1043 # Checks for wide character functions that may not be present.
1044 # Injection of these is wrapped with guard macros.
1045 # NB: only put functions here, instead of immediately above, if
1046 # absolutely necessary.
1047 AC_TRY_COMPILE([#include <wchar.h>
1048 namespace test { using ::vfwscanf; } ], [],
1049 [AC_DEFINE(HAVE_VFWSCANF,1,
1050 [Defined if vfwscanf exists.])],[])
1052 AC_TRY_COMPILE([#include <wchar.h>
1053 namespace test { using ::vswscanf; } ], [],
1054 [AC_DEFINE(HAVE_VSWSCANF,1,
1055 [Defined if vswscanf exists.])],[])
1057 AC_TRY_COMPILE([#include <wchar.h>
1058 namespace test { using ::vwscanf; } ], [],
1059 [AC_DEFINE(HAVE_VWSCANF,1,[Defined if vwscanf exists.])],[])
1061 AC_TRY_COMPILE([#include <wchar.h>
1062 namespace test { using ::wcstof; } ], [],
1063 [AC_DEFINE(HAVE_WCSTOF,1,[Defined if wcstof exists.])],[])
1065 AC_TRY_COMPILE([#include <wctype.h>],
1066 [ wint_t t; int i = iswblank(t);],
1067 [AC_DEFINE(HAVE_ISWBLANK,1,
1068 [Defined if iswblank exists.])],[])
1070 AC_MSG_RESULT($glibcxx_cv_c99_wchar)
1073 # Option parsed, now set things appropriately.
1074 if test x"$glibcxx_cv_c99_math" = x"no" ||
1075 test x"$glibcxx_cv_c99_complex" = x"no" ||
1076 test x"$glibcxx_cv_c99_stdio" = x"no" ||
1077 test x"$glibcxx_cv_c99_stdlib" = x"no" ||
1078 test x"$glibcxx_cv_c99_wchar" = x"no"; then
1081 AC_DEFINE(_GLIBCXX_USE_C99, 1,
1082 [Define if C99 functions or macros from <wchar.h>, <math.h>,
1083 <complex.h>, <stdio.h>, and <stdlib.h> can be used or exposed.])
1086 gcc_no_link="$ac_save_gcc_no_link"
1087 LIBS="$ac_save_LIBS"
1088 CXXFLAGS="$ac_save_CXXFLAGS"
1092 AC_MSG_CHECKING([for fully enabled ISO C99 support])
1093 AC_MSG_RESULT($enable_c99)
1098 dnl Check for clock_gettime, nanosleep and sched_yield, used in the
1099 dnl implementation of 20.8.5 [time.clock], and 30.2.2 [thread.thread.this]
1100 dnl in the current C++0x working draft.
1102 dnl --enable-libstdcxx-time
1103 dnl --enable-libstdcxx-time=yes
1104 dnl checks for the availability of monotonic and realtime clocks,
1105 dnl nanosleep and sched_yield in libc and libposix4 and, in case, links
1107 dnl --enable-libstdcxx-time=rt
1108 dnl also searches (and, in case, links) librt. Note that this is
1109 dnl not always desirable because, in glibc, for example, in turn it
1110 dnl triggers the linking of libpthread too, which activates locking,
1111 dnl a large overhead for single-thread programs.
1112 dnl --enable-libstdcxx-time=no
1113 dnl --disable-libstdcxx-time
1114 dnl disables the checks completely
1116 AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
1118 AC_MSG_CHECKING([for clock_gettime, nanosleep and sched_yield])
1119 GLIBCXX_ENABLE(libstdcxx-time,$1,[[[=KIND]]],
1120 [use KIND for check type],
1125 ac_save_CXXFLAGS="$CXXFLAGS"
1126 CXXFLAGS="$CXXFLAGS -fno-exceptions"
1127 ac_save_LIBS="$LIBS"
1129 ac_has_clock_monotonic=no
1130 ac_has_clock_realtime=no
1131 AC_MSG_RESULT($enable_libstdcxx_time)
1133 if test x"$enable_libstdcxx_time" != x"no"; then
1135 if test x"$enable_libstdcxx_time" = x"rt"; then
1136 AC_SEARCH_LIBS(clock_gettime, [rt posix4])
1137 AC_SEARCH_LIBS(nanosleep, [rt posix4])
1139 AC_SEARCH_LIBS(clock_gettime, [posix4])
1140 AC_SEARCH_LIBS(nanosleep, [posix4])
1143 case "$ac_cv_search_clock_gettime" in
1144 -l*) GLIBCXX_LIBS=$ac_cv_search_clock_gettime
1147 case "$ac_cv_search_nanosleep" in
1148 -l*) GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_nanosleep"
1152 AC_SEARCH_LIBS(sched_yield, [rt posix4])
1154 case "$ac_cv_search_sched_yield" in
1156 GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield"
1157 AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
1158 [ Defined if sched_yield is available. ])
1161 if test x"$enable_libstdcxx_time" = x"rt"; then
1162 GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield"
1163 AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
1164 [ Defined if sched_yield is available. ])
1168 AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
1169 [ Defined if sched_yield is available. ])
1173 AC_CHECK_HEADERS(unistd.h, ac_has_unistd_h=yes, ac_has_unistd_h=no)
1175 if test x"$ac_has_unistd_h" = x"yes"; then
1176 AC_MSG_CHECKING([for monotonic clock])
1178 [#include <unistd.h>
1181 [#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
1184 clock_gettime(CLOCK_MONOTONIC, &tp);
1185 ], [ac_has_clock_monotonic=yes], [ac_has_clock_monotonic=no])
1187 AC_MSG_RESULT($ac_has_clock_monotonic)
1189 AC_MSG_CHECKING([for realtime clock])
1191 [#include <unistd.h>
1194 [#if _POSIX_TIMERS > 0
1197 clock_gettime(CLOCK_REALTIME, &tp);
1198 ], [ac_has_clock_realtime=yes], [ac_has_clock_realtime=no])
1200 AC_MSG_RESULT($ac_has_clock_realtime)
1202 AC_MSG_CHECKING([for nanosleep])
1204 [#include <unistd.h>
1207 [#if _POSIX_TIMERS > 0
1211 ], [ac_has_nanosleep=yes], [ac_has_nanosleep=no])
1213 AC_MSG_RESULT($ac_has_nanosleep)
1217 if test x"$ac_has_clock_monotonic" = x"yes"; then
1218 AC_DEFINE(_GLIBCXX_USE_CLOCK_MONOTONIC, 1,
1219 [ Defined if clock_gettime has monotonic clock support. ])
1222 if test x"$ac_has_clock_realtime" = x"yes"; then
1223 AC_DEFINE(_GLIBCXX_USE_CLOCK_REALTIME, 1,
1224 [ Defined if clock_gettime has realtime clock support. ])
1227 if test x"$ac_has_nanosleep" = x"yes"; then
1228 AC_DEFINE(_GLIBCXX_USE_NANOSLEEP, 1,
1229 [ Defined if nanosleep is available. ])
1232 AC_SUBST(GLIBCXX_LIBS)
1234 CXXFLAGS="$ac_save_CXXFLAGS"
1235 LIBS="$ac_save_LIBS"
1240 dnl Check for gettimeofday, used in the implementation of 20.8.5
1241 dnl [time.clock] in the current C++0x working draft.
1243 AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [
1245 AC_MSG_CHECKING([for gettimeofday])
1249 ac_save_CXXFLAGS="$CXXFLAGS"
1250 CXXFLAGS="$CXXFLAGS -fno-exceptions"
1252 ac_has_gettimeofday=no;
1253 AC_CHECK_HEADERS(sys/time.h, ac_has_sys_time_h=yes, ac_has_sys_time_h=no)
1254 if test x"$ac_has_sys_time_h" = x"yes"; then
1255 AC_MSG_CHECKING([for gettimeofday])
1256 GCC_TRY_COMPILE_OR_LINK([#include <sys/time.h>],
1257 [timeval tv; gettimeofday(&tv, 0);],
1258 [ac_has_gettimeofday=yes], [ac_has_gettimeofday=no])
1260 AC_MSG_RESULT($ac_has_gettimeofday)
1263 if test x"$ac_has_gettimeofday" = x"yes"; then
1264 AC_DEFINE(_GLIBCXX_USE_GETTIMEOFDAY, 1,
1265 [ Defined if gettimeofday is available. ])
1268 CXXFLAGS="$ac_save_CXXFLAGS"
1273 dnl Check for ISO/IEC 9899:1999 "C99" support to ISO/IEC DTR 19768 "TR1"
1274 dnl facilities in Chapter 8, "C compatibility".
1276 AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
1281 # Use -std=c++98 because the default (-std=gnu++98) leaves __STRICT_ANSI__
1282 # undefined and fake C99 facilities may be spuriously enabled.
1283 ac_save_CXXFLAGS="$CXXFLAGS"
1284 CXXFLAGS="$CXXFLAGS -std=c++98"
1286 # Check for the existence of <complex.h> complex math functions used
1288 AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no)
1289 ac_c99_complex_tr1=no;
1290 if test x"$ac_has_complex_h" = x"yes"; then
1291 AC_MSG_CHECKING([for ISO C99 support to TR1 in <complex.h>])
1292 AC_TRY_COMPILE([#include <complex.h>],
1293 [typedef __complex__ float float_type; float_type tmpf;
1300 typedef __complex__ double double_type; double_type tmpd;
1307 typedef __complex__ long double ld_type; ld_type tmpld;
1314 ],[ac_c99_complex_tr1=yes], [ac_c99_complex_tr1=no])
1316 AC_MSG_RESULT($ac_c99_complex_tr1)
1317 if test x"$ac_c99_complex_tr1" = x"yes"; then
1318 AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX_TR1, 1,
1319 [Define if C99 functions in <complex.h> should be used in
1320 <tr1/complex>. Using compiler builtins for these functions
1321 requires corresponding C99 library functions to be present.])
1324 # Check for the existence of <ctype.h> functions.
1325 AC_MSG_CHECKING([for ISO C99 support to TR1 in <ctype.h>])
1326 AC_CACHE_VAL(glibcxx_cv_c99_ctype_tr1, [
1327 AC_TRY_COMPILE([#include <ctype.h>],
1331 ],[glibcxx_cv_c99_ctype_tr1=yes],
1332 [glibcxx_cv_c99_ctype_tr1=no])
1334 AC_MSG_RESULT($glibcxx_cv_c99_ctype_tr1)
1335 if test x"$glibcxx_cv_c99_ctype_tr1" = x"yes"; then
1336 AC_DEFINE(_GLIBCXX_USE_C99_CTYPE_TR1, 1,
1337 [Define if C99 functions in <ctype.h> should be imported in
1338 <tr1/cctype> in namespace std::tr1.])
1341 # Check for the existence of <fenv.h> functions.
1342 AC_CHECK_HEADERS(fenv.h, ac_has_fenv_h=yes, ac_has_fenv_h=no)
1344 if test x"$ac_has_fenv_h" = x"yes"; then
1345 AC_MSG_CHECKING([for ISO C99 support to TR1 in <fenv.h>])
1346 AC_TRY_COMPILE([#include <fenv.h>],
1351 ret = feclearexcept(except);
1352 ret = fegetexceptflag(pflag, except);
1353 ret = feraiseexcept(except);
1354 ret = fesetexceptflag(pflag, except);
1355 ret = fetestexcept(except);
1357 ret = fesetround(mode);
1358 ret = fegetenv(penv);
1359 ret = feholdexcept(penv);
1360 ret = fesetenv(penv);
1361 ret = feupdateenv(penv);
1362 ],[ac_c99_fenv_tr1=yes], [ac_c99_fenv_tr1=no])
1364 AC_MSG_RESULT($ac_c99_fenv_tr1)
1365 if test x"$ac_c99_fenv_tr1" = x"yes"; then
1366 AC_DEFINE(_GLIBCXX_USE_C99_FENV_TR1, 1,
1367 [Define if C99 functions in <fenv.h> should be imported in
1368 <tr1/cfenv> in namespace std::tr1.])
1371 # Check for the existence of <stdint.h> types.
1372 AC_MSG_CHECKING([for ISO C99 support to TR1 in <stdint.h>])
1373 AC_CACHE_VAL(glibcxx_cv_c99_stdint_tr1, [
1374 AC_TRY_COMPILE([#define __STDC_LIMIT_MACROS
1375 #define __STDC_CONSTANT_MACROS
1376 #include <stdint.h>],
1377 [typedef int8_t my_int8_t;
1378 my_int8_t i8 = INT8_MIN;
1380 typedef int16_t my_int16_t;
1381 my_int16_t i16 = INT16_MIN;
1383 typedef int32_t my_int32_t;
1384 my_int32_t i32 = INT32_MIN;
1386 typedef int64_t my_int64_t;
1387 my_int64_t i64 = INT64_MIN;
1389 typedef int_fast8_t my_int_fast8_t;
1390 my_int_fast8_t if8 = INT_FAST8_MIN;
1391 if8 = INT_FAST8_MAX;
1392 typedef int_fast16_t my_int_fast16_t;
1393 my_int_fast16_t if16 = INT_FAST16_MIN;
1394 if16 = INT_FAST16_MAX;
1395 typedef int_fast32_t my_int_fast32_t;
1396 my_int_fast32_t if32 = INT_FAST32_MIN;
1397 if32 = INT_FAST32_MAX;
1398 typedef int_fast64_t my_int_fast64_t;
1399 my_int_fast64_t if64 = INT_FAST64_MIN;
1400 if64 = INT_FAST64_MAX;
1401 typedef int_least8_t my_int_least8_t;
1402 my_int_least8_t il8 = INT_LEAST8_MIN;
1403 il8 = INT_LEAST8_MAX;
1404 typedef int_least16_t my_int_least16_t;
1405 my_int_least16_t il16 = INT_LEAST16_MIN;
1406 il16 = INT_LEAST16_MAX;
1407 typedef int_least32_t my_int_least32_t;
1408 my_int_least32_t il32 = INT_LEAST32_MIN;
1409 il32 = INT_LEAST32_MAX;
1410 typedef int_least64_t my_int_least64_t;
1411 my_int_least64_t il64 = INT_LEAST64_MIN;
1412 il64 = INT_LEAST64_MAX;
1413 typedef intmax_t my_intmax_t;
1414 my_intmax_t im = INTMAX_MAX;
1416 typedef intptr_t my_intptr_t;
1417 my_intptr_t ip = INTPTR_MAX;
1419 typedef uint8_t my_uint8_t;
1420 my_uint8_t ui8 = UINT8_MAX;
1422 typedef uint16_t my_uint16_t;
1423 my_uint16_t ui16 = UINT16_MAX;
1425 typedef uint32_t my_uint32_t;
1426 my_uint32_t ui32 = UINT32_MAX;
1428 typedef uint64_t my_uint64_t;
1429 my_uint64_t ui64 = UINT64_MAX;
1431 typedef uint_fast8_t my_uint_fast8_t;
1432 my_uint_fast8_t uif8 = UINT_FAST8_MAX;
1433 uif8 = UINT_FAST8_MAX;
1434 typedef uint_fast16_t my_uint_fast16_t;
1435 my_uint_fast16_t uif16 = UINT_FAST16_MAX;
1436 uif16 = UINT_FAST16_MAX;
1437 typedef uint_fast32_t my_uint_fast32_t;
1438 my_uint_fast32_t uif32 = UINT_FAST32_MAX;
1439 uif32 = UINT_FAST32_MAX;
1440 typedef uint_fast64_t my_uint_fast64_t;
1441 my_uint_fast64_t uif64 = UINT_FAST64_MAX;
1442 uif64 = UINT_FAST64_MAX;
1443 typedef uint_least8_t my_uint_least8_t;
1444 my_uint_least8_t uil8 = UINT_LEAST8_MAX;
1445 uil8 = UINT_LEAST8_MAX;
1446 typedef uint_least16_t my_uint_least16_t;
1447 my_uint_least16_t uil16 = UINT_LEAST16_MAX;
1448 uil16 = UINT_LEAST16_MAX;
1449 typedef uint_least32_t my_uint_least32_t;
1450 my_uint_least32_t uil32 = UINT_LEAST32_MAX;
1451 uil32 = UINT_LEAST32_MAX;
1452 typedef uint_least64_t my_uint_least64_t;
1453 my_uint_least64_t uil64 = UINT_LEAST64_MAX;
1454 uil64 = UINT_LEAST64_MAX;
1455 typedef uintmax_t my_uintmax_t;
1456 my_uintmax_t uim = UINTMAX_MAX;
1458 typedef uintptr_t my_uintptr_t;
1459 my_uintptr_t uip = UINTPTR_MAX;
1461 ],[glibcxx_cv_c99_stdint_tr1=yes],
1462 [glibcxx_cv_c99_stdint_tr1=no])
1464 AC_MSG_RESULT($glibcxx_cv_c99_stdint_tr1)
1465 if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
1466 AC_DEFINE(_GLIBCXX_USE_C99_STDINT_TR1, 1,
1467 [Define if C99 types in <stdint.h> should be imported in
1468 <tr1/cstdint> in namespace std::tr1.])
1471 # Check for the existence of <math.h> functions.
1472 AC_MSG_CHECKING([for ISO C99 support to TR1 in <math.h>])
1473 AC_CACHE_VAL(glibcxx_cv_c99_math_tr1, [
1474 AC_TRY_COMPILE([#include <math.h>],
1475 [typedef double_t my_double_t;
1476 typedef float_t my_float_t;
1490 copysignf(0.0f, 0.0f);
1491 copysignl(0.0l, 0.0l);
1508 fmaf(0.0f, 0.0f, 0.0f);
1509 fmal(0.0l, 0.0l, 0.0l);
1552 nextafter(0.0, 0.0);
1553 nextafterf(0.0f, 0.0f);
1554 nextafterl(0.0l, 0.0l);
1555 nexttoward(0.0, 0.0);
1556 nexttowardf(0.0f, 0.0f);
1557 nexttowardl(0.0l, 0.0l);
1558 remainder(0.0, 0.0);
1559 remainderf(0.0f, 0.0f);
1560 remainderl(0.0l, 0.0l);
1561 remquo(0.0, 0.0, 0);
1562 remquof(0.0f, 0.0f, 0);
1563 remquol(0.0l, 0.0l, 0);
1582 ],[glibcxx_cv_c99_math_tr1=yes], [glibcxx_cv_c99_math_tr1=no])
1584 AC_MSG_RESULT($glibcxx_cv_c99_math_tr1)
1585 if test x"$glibcxx_cv_c99_math_tr1" = x"yes"; then
1586 AC_DEFINE(_GLIBCXX_USE_C99_MATH_TR1, 1,
1587 [Define if C99 functions or macros in <math.h> should be imported
1588 in <tr1/cmath> in namespace std::tr1.])
1591 # Check for the existence of <inttypes.h> functions (NB: doesn't make
1592 # sense if the glibcxx_cv_c99_stdint_tr1 check fails, per C99, 7.8/1).
1593 ac_c99_inttypes_tr1=no;
1594 if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
1595 AC_MSG_CHECKING([for ISO C99 support to TR1 in <inttypes.h>])
1596 AC_TRY_COMPILE([#include <inttypes.h>],
1597 [intmax_t i, numer, denom, base;
1600 intmax_t ret = imaxabs(i);
1601 imaxdiv_t dret = imaxdiv(numer, denom);
1602 ret = strtoimax(s, endptr, base);
1603 uintmax_t uret = strtoumax(s, endptr, base);
1604 ],[ac_c99_inttypes_tr1=yes], [ac_c99_inttypes_tr1=no])
1606 AC_MSG_RESULT($ac_c99_inttypes_tr1)
1607 if test x"$ac_c99_inttypes_tr1" = x"yes"; then
1608 AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_TR1, 1,
1609 [Define if C99 functions in <inttypes.h> should be imported in
1610 <tr1/cinttypes> in namespace std::tr1.])
1613 # Check for the existence of whcar_t <inttypes.h> functions (NB: doesn't
1614 # make sense if the glibcxx_cv_c99_stdint_tr1 check fails, per C99, 7.8/1).
1615 ac_c99_inttypes_wchar_t_tr1=no;
1616 if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
1617 AC_MSG_CHECKING([for wchar_t ISO C99 support to TR1 in <inttypes.h>])
1618 AC_TRY_COMPILE([#include <inttypes.h>],
1622 intmax_t ret = wcstoimax(s, endptr, base);
1623 uintmax_t uret = wcstoumax(s, endptr, base);
1624 ],[ac_c99_inttypes_wchar_t_tr1=yes],
1625 [ac_c99_inttypes_wchar_t_tr1=no])
1627 AC_MSG_RESULT($ac_c99_inttypes_wchar_t_tr1)
1628 if test x"$ac_c99_inttypes_wchar_t_tr1" = x"yes"; then
1629 AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1, 1,
1630 [Define if wchar_t C99 functions in <inttypes.h> should be
1631 imported in <tr1/cinttypes> in namespace std::tr1.])
1634 # Check for the existence of the <stdbool.h> header.
1635 AC_CHECK_HEADERS(stdbool.h)
1637 CXXFLAGS="$ac_save_CXXFLAGS"
1642 dnl Check whether "/dev/random" and "/dev/urandom" are available for the
1643 dnl random_device of "TR1" (Chapter 5.1, "Random number generation").
1645 AC_DEFUN([GLIBCXX_CHECK_RANDOM_TR1], [
1647 AC_MSG_CHECKING([for "/dev/random" and "/dev/urandom" for TR1 random_device])
1648 AC_CACHE_VAL(glibcxx_cv_random_tr1, [
1649 if test -r /dev/random && test -r /dev/urandom; then
1650 glibcxx_cv_random_tr1=yes;
1652 glibcxx_cv_random_tr1=no;
1655 AC_MSG_RESULT($glibcxx_cv_random_tr1)
1657 if test x"$glibcxx_cv_random_tr1" = x"yes"; then
1658 AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1, 1,
1659 [Define if /dev/random and /dev/urandom are available for
1660 the random_device of TR1 (Chapter 5.1).])
1666 dnl Compute the EOF, SEEK_CUR, and SEEK_END integer constants.
1668 AC_DEFUN([GLIBCXX_COMPUTE_STDIO_INTEGER_CONSTANTS], [
1670 AC_CACHE_CHECK([for the value of EOF], glibcxx_cv_stdio_eof, [
1671 AC_COMPUTE_INT([glibcxx_cv_stdio_eof], [[EOF]],
1672 [#include <stdio.h>],
1673 [AC_MSG_ERROR([computing EOF failed])])
1675 AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_EOF, $glibcxx_cv_stdio_eof,
1676 [Define to the value of the EOF integer constant.])
1678 AC_CACHE_CHECK([for the value of SEEK_CUR], glibcxx_cv_stdio_seek_cur, [
1679 AC_COMPUTE_INT([glibcxx_cv_stdio_seek_cur], [[SEEK_CUR]],
1680 [#include <stdio.h>],
1681 [AC_MSG_ERROR([computing SEEK_CUR failed])])
1683 AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_SEEK_CUR, $glibcxx_cv_stdio_seek_cur,
1684 [Define to the value of the SEEK_CUR integer constant.])
1686 AC_CACHE_CHECK([for the value of SEEK_END], glibcxx_cv_stdio_seek_end, [
1687 AC_COMPUTE_INT([glibcxx_cv_stdio_seek_end], [[SEEK_END]],
1688 [#include <stdio.h>],
1689 [AC_MSG_ERROR([computing SEEK_END failed])])
1691 AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_SEEK_END, $glibcxx_cv_stdio_seek_end,
1692 [Define to the value of the SEEK_END integer constant.])
1696 dnl Check whether required C++ overloads are present in <math.h>.
1699 AC_DEFUN([GLIBCXX_CHECK_MATH_PROTO], [
1706 # Solaris 8 FCS only had an overload for double std::abs(double) in
1707 # <iso/math_iso.h>. Patches 111721-04 (SPARC) and 112757-01 (x86)
1708 # introduced the full set also found from Solaris 9 onwards.
1709 AC_MSG_CHECKING([for float std::abs(float) overload])
1710 AC_CACHE_VAL(glibcxx_cv_abs_float, [
1711 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1714 inline float abs(float __x)
1715 { return __builtin_fabsf(__x); }
1718 [glibcxx_cv_abs_float=no],
1719 [glibcxx_cv_abs_float=yes]
1722 # autoheader cannot handle indented templates.
1723 AH_VERBATIM([__CORRECT_ISO_CPP_MATH_H_PROTO1],
1724 [/* Define if all C++ overloads are available in <math.h>. */
1725 #if __cplusplus >= 199711L
1726 #undef __CORRECT_ISO_CPP_MATH_H_PROTO1
1728 AH_VERBATIM([__CORRECT_ISO_CPP_MATH_H_PROTO2],
1729 [/* Define if only double std::abs(double) is available in <math.h>. */
1730 #if __cplusplus >= 199711L
1731 #undef __CORRECT_ISO_CPP_MATH_H_PROTO2
1734 if test $glibcxx_cv_abs_float = yes; then
1735 AC_DEFINE(__CORRECT_ISO_CPP_MATH_H_PROTO1)
1737 AC_DEFINE(__CORRECT_ISO_CPP_MATH_H_PROTO2)
1739 AC_MSG_RESULT($glibcxx_cv_abs_float)
1747 dnl Check whether required C++ overloads are present in <stdlib.h>.
1750 AC_DEFUN([GLIBCXX_CHECK_STDLIB_PROTO], [
1757 # Solaris 8 FCS lacked the overloads for long std::abs(long) and
1758 # ldiv_t std::div(long, long) in <iso/stdlib_iso.h>. Patches 109607-02
1759 # (SPARC) and 109608-02 (x86) introduced them.
1760 AC_MSG_CHECKING([for long std::abs(long) overload])
1761 AC_CACHE_VAL(glibcxx_cv_abs_long, [
1762 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1763 [#include <stdlib.h>
1766 abs(long __i) { return labs(__i); }
1769 [glibcxx_cv_abs_long=no],
1770 [glibcxx_cv_abs_long=yes]
1773 # autoheader cannot handle indented templates.
1774 AH_VERBATIM([__CORRECT_ISO_CPP_STDLIB_H_PROTO],
1775 [/* Define if all C++ overloads are available in <stdlib.h>. */
1776 #if __cplusplus >= 199711L
1777 #undef __CORRECT_ISO_CPP_STDLIB_H_PROTO
1779 if test $glibcxx_cv_abs_long = yes; then
1780 AC_DEFINE(__CORRECT_ISO_CPP_STDLIB_H_PROTO, 1)
1782 AC_MSG_RESULT($glibcxx_cv_abs_long)
1790 dnl Check whether macros, etc are present for <system_error>
1792 AC_DEFUN([GLIBCXX_CHECK_SYSTEM_ERROR], [
1794 m4_pushdef([n_syserr], [1])dnl
1795 m4_foreach([syserr], [EOWNERDEAD, ENOTRECOVERABLE, ENOLINK, EPROTO, ENODATA,
1796 ENOSR, ENOSTR, ETIME, EBADMSG, ECANCELED,
1797 EOVERFLOW, ENOTSUP, EIDRM, ETXTBSY,
1798 ECHILD, ENOSPC, EPERM,
1799 ETIMEDOUT, EWOULDBLOCK],
1800 [m4_pushdef([SYSERR], m4_toupper(syserr))dnl
1801 AC_MSG_CHECKING([for syserr])
1802 AC_CACHE_VAL([glibcxx_cv_system_error[]n_syserr], [
1803 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]],
1804 [int i = syserr;])],
1805 [glibcxx_cv_system_error[]n_syserr=yes],
1806 [glibcxx_cv_system_error[]n_syserr=no])
1808 AC_MSG_RESULT([$glibcxx_cv_system_error[]n_syserr])
1809 if test x"$glibcxx_cv_system_error[]n_syserr" = x"yes"; then
1810 AC_DEFINE([HAVE_]SYSERR, 1, [Define if ]syserr[ exists.])
1812 m4_define([n_syserr], m4_incr(n_syserr))dnl
1813 m4_popdef([SYSERR])dnl
1815 m4_popdef([n_syserr])dnl
1819 dnl Check for what type of C headers to use.
1821 dnl --enable-cheaders= [does stuff].
1822 dnl --disable-cheaders [does not do anything, really].
1823 dnl + Usage: GLIBCXX_ENABLE_CHEADERS[(DEFAULT)]
1824 dnl Where DEFAULT is either 'c' or 'c_std' or 'c_global'.
1826 AC_DEFUN([GLIBCXX_ENABLE_CHEADERS], [
1827 GLIBCXX_ENABLE(cheaders,$1,[[[=KIND]]],
1828 [construct "C" headers for g++], [permit c|c_std|c_global])
1829 AC_MSG_NOTICE("C" header strategy set to $enable_cheaders)
1831 C_INCLUDE_DIR='${glibcxx_srcdir}/include/'$enable_cheaders
1833 # Allow overrides to configure.host here.
1834 if test $enable_cheaders = c_global; then
1838 AC_SUBST(C_INCLUDE_DIR)
1839 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c)
1840 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std)
1841 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_GLOBAL, test $enable_cheaders = c_global)
1842 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes)
1847 dnl Check for which locale library to use. The choice is mapped to
1848 dnl a subdirectory of config/locale.
1850 dnl Default is generic.
1852 AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
1853 GLIBCXX_ENABLE(clocale,auto,[[[=MODEL]]],
1854 [use MODEL for target locale package],
1855 [permit generic|gnu|ieee_1003.1-2001|newlib|yes|no|auto])
1857 # Deal with gettext issues. Default to not using it (=no) until we detect
1858 # support for it later. Let the user turn it off via --e/d, but let that
1859 # default to on for easier handling.
1862 AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]),
1866 # Either a known package, or "auto"
1867 if test $enable_clocale = no || test $enable_clocale = yes; then
1870 enable_clocale_flag=$enable_clocale
1872 # Probe for locale model to use if none specified.
1873 # Default to "generic".
1874 if test $enable_clocale_flag = auto; then
1875 case ${target_os} in
1876 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
1877 enable_clocale_flag=gnu
1880 enable_clocale_flag=darwin
1883 if test x"$with_newlib" = x"yes"; then
1884 enable_clocale_flag=newlib
1886 enable_clocale_flag=generic
1892 # Sanity check model, and test for special functionality.
1893 if test $enable_clocale_flag = gnu; then
1894 AC_EGREP_CPP([_GLIBCXX_ok], [
1895 #include <features.h>
1896 #if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined(__UCLIBC__)
1899 ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
1901 # Set it to scream when it hurts.
1902 ac_save_CFLAGS="$CFLAGS"
1903 CFLAGS="-Wimplicit-function-declaration -Werror"
1905 # Use strxfrm_l if available.
1906 AC_TRY_COMPILE([#define _GNU_SOURCE 1
1908 #include <locale.h>],
1909 [char s[128]; __locale_t loc; strxfrm_l(s, "C", 5, loc);],
1910 AC_DEFINE(HAVE_STRXFRM_L, 1,
1911 [Define if strxfrm_l is available in <string.h>.]),)
1913 # Use strerror_l if available.
1914 AC_TRY_COMPILE([#define _GNU_SOURCE 1
1916 #include <locale.h>],
1917 [__locale_t loc; strerror_l(5, loc);],
1918 AC_DEFINE(HAVE_STRERROR_L, 1,
1919 [Define if strerror_l is available in <string.h>.]),)
1921 CFLAGS="$ac_save_CFLAGS"
1924 # Perhaps use strerror_r if available, and strerror_l isn't.
1925 ac_save_CFLAGS="$CFLAGS"
1926 CFLAGS="-Wimplicit-function-declaration -Werror"
1927 AC_TRY_COMPILE([#define _GNU_SOURCE 1
1929 #include <locale.h>],
1930 [char s[128]; strerror_r(5, s, 128);],
1931 AC_DEFINE(HAVE_STRERROR_R, 1,
1932 [Define if strerror_r is available in <string.h>.]),)
1933 CFLAGS="$ac_save_CFLAGS"
1935 # Set configure bits for specified locale package
1936 AC_MSG_CHECKING([for C locale to use])
1937 case ${enable_clocale_flag} in
1939 AC_MSG_RESULT(generic)
1941 CLOCALE_H=config/locale/generic/c_locale.h
1942 CLOCALE_CC=config/locale/generic/c_locale.cc
1943 CCODECVT_CC=config/locale/generic/codecvt_members.cc
1944 CCOLLATE_CC=config/locale/generic/collate_members.cc
1945 CCTYPE_CC=config/locale/generic/ctype_members.cc
1946 CMESSAGES_H=config/locale/generic/messages_members.h
1947 CMESSAGES_CC=config/locale/generic/messages_members.cc
1948 CMONEY_CC=config/locale/generic/monetary_members.cc
1949 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1950 CTIME_H=config/locale/generic/time_members.h
1951 CTIME_CC=config/locale/generic/time_members.cc
1952 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
1955 AC_MSG_RESULT(darwin or freebsd)
1957 CLOCALE_H=config/locale/generic/c_locale.h
1958 CLOCALE_CC=config/locale/generic/c_locale.cc
1959 CCODECVT_CC=config/locale/generic/codecvt_members.cc
1960 CCOLLATE_CC=config/locale/generic/collate_members.cc
1961 CCTYPE_CC=config/locale/darwin/ctype_members.cc
1962 CMESSAGES_H=config/locale/generic/messages_members.h
1963 CMESSAGES_CC=config/locale/generic/messages_members.cc
1964 CMONEY_CC=config/locale/generic/monetary_members.cc
1965 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1966 CTIME_H=config/locale/generic/time_members.h
1967 CTIME_CC=config/locale/generic/time_members.cc
1968 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
1974 # Declare intention to use gettext, and add support for specific
1976 # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
1979 # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
1980 AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
1981 if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
1984 # Export the build objects.
1985 for ling in $ALL_LINGUAS; do \
1986 glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
1987 glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
1989 AC_SUBST(glibcxx_MOFILES)
1990 AC_SUBST(glibcxx_POFILES)
1992 CLOCALE_H=config/locale/gnu/c_locale.h
1993 CLOCALE_CC=config/locale/gnu/c_locale.cc
1994 CCODECVT_CC=config/locale/gnu/codecvt_members.cc
1995 CCOLLATE_CC=config/locale/gnu/collate_members.cc
1996 CCTYPE_CC=config/locale/gnu/ctype_members.cc
1997 CMESSAGES_H=config/locale/gnu/messages_members.h
1998 CMESSAGES_CC=config/locale/gnu/messages_members.cc
1999 CMONEY_CC=config/locale/gnu/monetary_members.cc
2000 CNUMERIC_CC=config/locale/gnu/numeric_members.cc
2001 CTIME_H=config/locale/gnu/time_members.h
2002 CTIME_CC=config/locale/gnu/time_members.cc
2003 CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h
2006 AC_MSG_RESULT(IEEE 1003.1)
2008 CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h
2009 CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc
2010 CCODECVT_CC=config/locale/generic/codecvt_members.cc
2011 CCOLLATE_CC=config/locale/generic/collate_members.cc
2012 CCTYPE_CC=config/locale/generic/ctype_members.cc
2013 CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h
2014 CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc
2015 CMONEY_CC=config/locale/generic/monetary_members.cc
2016 CNUMERIC_CC=config/locale/generic/numeric_members.cc
2017 CTIME_H=config/locale/generic/time_members.h
2018 CTIME_CC=config/locale/generic/time_members.cc
2019 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
2022 AC_MSG_RESULT(newlib)
2024 CLOCALE_H=config/locale/generic/c_locale.h
2025 CLOCALE_CC=config/locale/generic/c_locale.cc
2026 CCODECVT_CC=config/locale/generic/codecvt_members.cc
2027 CCOLLATE_CC=config/locale/generic/collate_members.cc
2028 CCTYPE_CC=config/locale/newlib/ctype_members.cc
2029 CMESSAGES_H=config/locale/generic/messages_members.h
2030 CMESSAGES_CC=config/locale/generic/messages_members.cc
2031 CMONEY_CC=config/locale/generic/monetary_members.cc
2032 CNUMERIC_CC=config/locale/generic/numeric_members.cc
2033 CTIME_H=config/locale/generic/time_members.h
2034 CTIME_CC=config/locale/generic/time_members.cc
2035 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
2039 # This is where the testsuite looks for locale catalogs, using the
2040 # -DLOCALEDIR define during testsuite compilation.
2041 glibcxx_localedir=${glibcxx_builddir}/po/share/locale
2042 AC_SUBST(glibcxx_localedir)
2044 # A standalone libintl (e.g., GNU libintl) may be in use.
2045 if test $USE_NLS = yes; then
2046 AC_CHECK_HEADERS([libintl.h], [], USE_NLS=no)
2047 AC_SEARCH_LIBS(gettext, intl, [], USE_NLS=no)
2049 if test $USE_NLS = yes; then
2050 AC_DEFINE(_GLIBCXX_USE_NLS, 1,
2051 [Define if NLS translations are to be used.])
2056 AC_SUBST(CMESSAGES_H)
2057 AC_SUBST(CCODECVT_CC)
2058 AC_SUBST(CCOLLATE_CC)
2060 AC_SUBST(CMESSAGES_CC)
2062 AC_SUBST(CNUMERIC_CC)
2065 AC_SUBST(CLOCALE_CC)
2066 AC_SUBST(CLOCALE_INTERNAL_H)
2071 dnl Check for which std::allocator base class to use. The choice is
2072 dnl mapped from a subdirectory of include/ext.
2076 AC_DEFUN([GLIBCXX_ENABLE_ALLOCATOR], [
2077 AC_MSG_CHECKING([for std::allocator base class])
2078 GLIBCXX_ENABLE(libstdcxx-allocator,auto,[[[=KIND]]],
2079 [use KIND for target std::allocator base],
2080 [permit new|malloc|mt|bitmap|pool|yes|no|auto])
2082 # If they didn't use this option switch, or if they specified --enable
2083 # with no specific model, we'll have to look for one. If they
2084 # specified --disable (???), do likewise.
2085 if test $enable_libstdcxx_allocator = no ||
2086 test $enable_libstdcxx_allocator = yes;
2088 enable_libstdcxx_allocator=auto
2091 # Either a known package, or "auto". Auto implies the default choice
2092 # for a particular platform.
2093 enable_libstdcxx_allocator_flag=$enable_libstdcxx_allocator
2095 # Probe for host-specific support if no specific model is specified.
2097 if test $enable_libstdcxx_allocator_flag = auto; then
2098 case ${target_os} in
2099 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
2100 enable_libstdcxx_allocator_flag=new
2103 enable_libstdcxx_allocator_flag=new
2107 AC_MSG_RESULT($enable_libstdcxx_allocator_flag)
2110 # Set configure bits for specified locale package
2111 case ${enable_libstdcxx_allocator_flag} in
2113 ALLOCATOR_H=config/allocator/bitmap_allocator_base.h
2114 ALLOCATOR_NAME=__gnu_cxx::bitmap_allocator
2117 ALLOCATOR_H=config/allocator/malloc_allocator_base.h
2118 ALLOCATOR_NAME=__gnu_cxx::malloc_allocator
2121 ALLOCATOR_H=config/allocator/mt_allocator_base.h
2122 ALLOCATOR_NAME=__gnu_cxx::__mt_alloc
2125 ALLOCATOR_H=config/allocator/new_allocator_base.h
2126 ALLOCATOR_NAME=__gnu_cxx::new_allocator
2129 ALLOCATOR_H=config/allocator/pool_allocator_base.h
2130 ALLOCATOR_NAME=__gnu_cxx::__pool_alloc
2134 AC_SUBST(ALLOCATOR_H)
2135 AC_SUBST(ALLOCATOR_NAME)
2140 dnl Check for whether the Boost-derived checks should be turned on.
2142 dnl --enable-concept-checks turns them on.
2143 dnl --disable-concept-checks leaves them off.
2144 dnl + Usage: GLIBCXX_ENABLE_CONCEPT_CHECKS[(DEFAULT)]
2145 dnl Where DEFAULT is either `yes' or `no'.
2147 AC_DEFUN([GLIBCXX_ENABLE_CONCEPT_CHECKS], [
2148 GLIBCXX_ENABLE(concept-checks,$1,,[use Boost-derived template checks])
2149 if test $enable_concept_checks = yes; then
2150 AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS, 1,
2151 [Define to use concept checking code from the boost libraries.])
2156 dnl Use extern templates.
2158 dnl --enable-extern-template defines _GLIBCXX_EXTERN_TEMPLATE to 1
2159 dnl --disable-extern-template defines _GLIBCXX_EXTERN_TEMPLATE to 0
2161 dnl + Usage: GLIBCXX_ENABLE_TEMPLATE[(DEFAULT)]
2162 dnl Where DEFAULT is `yes' or `no'.
2164 AC_DEFUN([GLIBCXX_ENABLE_EXTERN_TEMPLATE], [
2166 GLIBCXX_ENABLE(extern-template,$1,,[enable extern template])
2168 AC_MSG_CHECKING([for extern template support])
2169 AC_MSG_RESULT([$enable_extern_template])
2171 GLIBCXX_CONDITIONAL(ENABLE_EXTERN_TEMPLATE, test $enable_extern_template = yes)
2175 dnl Check for parallel mode pre-requisites, including OpenMP support.
2177 dnl + Usage: GLIBCXX_ENABLE_PARALLEL
2179 AC_DEFUN([GLIBCXX_ENABLE_PARALLEL], [
2183 # See if configured libgomp/omp.h exists. (libgomp may be in
2184 # noconfigdirs but not explicitly disabled.)
2185 if echo " ${TARGET_CONFIGDIRS} " | grep " libgomp " > /dev/null 2>&1 ; then
2186 enable_parallel=yes;
2188 AC_MSG_NOTICE([target-libgomp not built])
2191 AC_MSG_CHECKING([for parallel mode support])
2192 AC_MSG_RESULT([$enable_parallel])
2193 GLIBCXX_CONDITIONAL(ENABLE_PARALLEL, test $enable_parallel = yes)
2198 dnl Check for which I/O library to use: stdio, or something specific.
2200 dnl Default is stdio.
2202 AC_DEFUN([GLIBCXX_ENABLE_CSTDIO], [
2203 AC_MSG_CHECKING([for underlying I/O to use])
2204 GLIBCXX_ENABLE(cstdio,stdio,[[[=PACKAGE]]],
2205 [use target-specific I/O package], [permit stdio])
2207 # Now that libio has been removed, you can have any color you want as long
2208 # as it's black. This is one big no-op until other packages are added, but
2209 # showing the framework never hurts.
2210 case ${enable_cstdio} in
2212 CSTDIO_H=config/io/c_io_stdio.h
2213 BASIC_FILE_H=config/io/basic_file_stdio.h
2214 BASIC_FILE_CC=config/io/basic_file_stdio.cc
2215 AC_MSG_RESULT(stdio)
2220 AC_SUBST(BASIC_FILE_H)
2221 AC_SUBST(BASIC_FILE_CC)
2226 dnl Check for "unusual" flags to pass to the compiler while building.
2228 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
2229 dnl experimental flags such as -fpch, -fIMI, -Dfloat=char, etc.
2230 dnl --disable-cxx-flags passes nothing.
2231 dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
2232 dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
2233 dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
2234 dnl + Usage: GLIBCXX_ENABLE_CXX_FLAGS(default flags)
2235 dnl If "default flags" is an empty string, the effect is the same
2236 dnl as --disable or --enable=no.
2238 AC_DEFUN([GLIBCXX_ENABLE_CXX_FLAGS], [dnl
2239 AC_MSG_CHECKING([for extra compiler flags for building])
2240 GLIBCXX_ENABLE(cxx-flags,$1,[=FLAGS],
2241 [pass compiler FLAGS when building library],
2242 [case "x$enable_cxx_flags" in
2243 xno | x) enable_cxx_flags= ;;
2245 *) AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;;
2248 # Run through flags (either default or command-line) and set anything
2249 # extra (e.g., #defines) that must accompany particular g++ options.
2250 if test -n "$enable_cxx_flags"; then
2251 for f in $enable_cxx_flags; do
2255 *) # and we're trying to pass /what/ exactly?
2256 AC_MSG_ERROR([compiler flags start with a -]) ;;
2261 EXTRA_CXX_FLAGS="$enable_cxx_flags"
2262 AC_MSG_RESULT($EXTRA_CXX_FLAGS)
2263 AC_SUBST(EXTRA_CXX_FLAGS)
2268 dnl Check to see if debugging libraries are to be built.
2270 dnl --enable-libstdcxx-debug
2271 dnl builds a separate set of debugging libraries in addition to the
2272 dnl normal (shared, static) libstdc++ binaries.
2274 dnl --disable-libstdcxx-debug
2275 dnl builds only one (non-debug) version of libstdc++.
2277 dnl --enable-libstdcxx-debug-flags=FLAGS
2278 dnl iff --enable-debug == yes, then use FLAGS to build the debug library.
2280 dnl + Usage: GLIBCXX_ENABLE_DEBUG[(DEFAULT)]
2281 dnl Where DEFAULT is either `yes' or `no'.
2283 AC_DEFUN([GLIBCXX_ENABLE_DEBUG], [
2284 AC_MSG_CHECKING([for additional debug build])
2285 GLIBCXX_ENABLE(libstdcxx-debug,$1,,[build extra debug library])
2286 AC_MSG_RESULT($enable_libstdcxx_debug)
2287 GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_DEBUG, test $enable_libstdcxx_debug = yes)
2292 dnl Check for explicit debug flags.
2294 dnl --enable-libstdcxx-debug-flags='-O1'
2295 dnl is a general method for passing flags to be used when
2296 dnl building debug libraries with --enable-debug.
2298 dnl --disable-libstdcxx-debug-flags does nothing.
2299 dnl + Usage: GLIBCXX_ENABLE_DEBUG_FLAGS(default flags)
2300 dnl If "default flags" is an empty string, the effect is the same
2301 dnl as --disable or --enable=no.
2303 AC_DEFUN([GLIBCXX_ENABLE_DEBUG_FLAGS], [
2304 GLIBCXX_ENABLE(libstdcxx-debug-flags,[$1],[=FLAGS],
2305 [pass compiler FLAGS when building debug library],
2306 [case "x$enable_libstdcxx_debug_flags" in
2307 xno | x) enable_libstdcxx_debug_flags= ;;
2309 *) AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;;
2312 # Option parsed, now set things appropriately
2313 DEBUG_FLAGS="$enable_libstdcxx_debug_flags"
2314 AC_SUBST(DEBUG_FLAGS)
2316 AC_MSG_NOTICE([Debug build flags set to $DEBUG_FLAGS])
2321 dnl Check if the user only wants a freestanding library implementation.
2323 dnl --disable-hosted-libstdcxx will turn off most of the library build,
2324 dnl installing only the headers required by [17.4.1.3] and the language
2325 dnl support library. More than that will be built (to keep the Makefiles
2326 dnl conveniently clean), but not installed.
2329 dnl is_hosted (yes/no)
2332 dnl _GLIBCXX_HOSTED (always defined, either to 1 or 0)
2334 AC_DEFUN([GLIBCXX_ENABLE_HOSTED], [
2335 AC_ARG_ENABLE([hosted-libstdcxx],
2336 AC_HELP_STRING([--disable-hosted-libstdcxx],
2337 [only build freestanding C++ runtime support]),,
2340 enable_hosted_libstdcxx=no
2343 enable_hosted_libstdcxx=yes
2346 if test "$enable_hosted_libstdcxx" = no; then
2347 AC_MSG_NOTICE([Only freestanding libraries will be built])
2351 enable_libstdcxx_pch=no
2356 GLIBCXX_CONDITIONAL(GLIBCXX_HOSTED, test $is_hosted = yes)
2357 AC_DEFINE_UNQUOTED(_GLIBCXX_HOSTED, $hosted_define,
2358 [Define to 1 if a full hosted library is built, or 0 if freestanding.])
2363 dnl Check for template specializations for the 'long long' type.
2364 dnl The result determines only whether 'long long' I/O is enabled; things
2365 dnl like numeric_limits<> specializations are always available.
2367 dnl --enable-long-long defines _GLIBCXX_USE_LONG_LONG
2368 dnl --disable-long-long leaves _GLIBCXX_USE_LONG_LONG undefined
2369 dnl + Usage: GLIBCXX_ENABLE_LONG_LONG[(DEFAULT)]
2370 dnl Where DEFAULT is either `yes' or `no'.
2372 AC_DEFUN([GLIBCXX_ENABLE_LONG_LONG], [
2373 GLIBCXX_ENABLE(long-long,$1,,[enable template specializations for 'long long'])
2374 if test $enable_long_long = yes; then
2375 AC_DEFINE(_GLIBCXX_USE_LONG_LONG, 1,
2376 [Define if code specialized for long long should be used.])
2378 AC_MSG_CHECKING([for enabled long long specializations])
2379 AC_MSG_RESULT([$enable_long_long])
2384 dnl Check for decimal floating point.
2386 dnl http://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html#Decimal-Float
2388 dnl This checks to see if the host supports decimal floating point types.
2391 dnl _GLIBCXX_USE_DECIMAL_FLOAT
2393 AC_DEFUN([GLIBCXX_ENABLE_DECIMAL_FLOAT], [
2395 # Fake what AC_TRY_COMPILE does, without linking as this is
2396 # unnecessary for this test.
2398 cat > conftest.$ac_ext << EOF
2399 [#]line __oline__ "configure"
2409 AC_MSG_CHECKING([for ISO/IEC TR 24733 ])
2410 if AC_TRY_EVAL(ac_compile); then
2411 AC_DEFINE(_GLIBCXX_USE_DECIMAL_FLOAT, 1,
2412 [Define if ISO/IEC TR 24733 decimal floating point types are supported on this host.])
2417 AC_MSG_RESULT($enable_dfp)
2422 dnl Check for GNU 128-bit integer and floating point types.
2424 dnl Note: also checks that the types aren't standard types.
2427 dnl _GLIBCXX_USE_INT128
2428 dnl _GLIBCXX_USE_FLOAT128
2430 AC_DEFUN([GLIBCXX_ENABLE_INT128_FLOAT128], [
2435 # Fake what AC_TRY_COMPILE does, without linking as this is
2436 # unnecessary for this test.
2438 cat > conftest.$ac_ext << EOF
2439 [#]line __oline__ "configure"
2440 template<typename T1, typename T2>
2442 { typedef T2 type; };
2444 template<typename T>
2449 typename same<long, __int128>::type i1;
2450 typename same<long long, __int128>::type i2;
2454 AC_MSG_CHECKING([for __int128])
2455 if AC_TRY_EVAL(ac_compile); then
2456 AC_DEFINE(_GLIBCXX_USE_INT128, 1,
2457 [Define if __int128 is supported on this host.])
2462 AC_MSG_RESULT($enable_int128)
2465 cat > conftest.$ac_ext << EOF
2466 [#]line __oline__ "configure"
2467 template<typename T1, typename T2>
2469 { typedef T2 type; };
2471 template<typename T>
2476 typename same<double, __float128>::type f1;
2477 typename same<long double, __float128>::type f2;
2481 AC_MSG_CHECKING([for __float128])
2482 if AC_TRY_EVAL(ac_compile); then
2483 AC_DEFINE(_GLIBCXX_USE_FLOAT128, 1,
2484 [Define if __float128 is supported on this host.])
2489 AC_MSG_RESULT($enable_float128)
2496 dnl Check for template specializations for the 'wchar_t' type.
2498 dnl --enable-wchar_t defines _GLIBCXX_USE_WCHAR_T
2499 dnl --disable-wchar_t leaves _GLIBCXX_USE_WCHAR_T undefined
2500 dnl + Usage: GLIBCXX_ENABLE_WCHAR_T[(DEFAULT)]
2501 dnl Where DEFAULT is either `yes' or `no'.
2503 dnl Necessary support must also be present.
2505 AC_DEFUN([GLIBCXX_ENABLE_WCHAR_T], [
2506 GLIBCXX_ENABLE(wchar_t,$1,,[enable template specializations for 'wchar_t'])
2508 # Test wchar.h for mbstate_t, which is needed for char_traits and fpos.
2509 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
2510 AC_MSG_CHECKING([for mbstate_t])
2511 AC_TRY_COMPILE([#include <wchar.h>],
2512 [mbstate_t teststate;],
2513 have_mbstate_t=yes, have_mbstate_t=no)
2514 AC_MSG_RESULT($have_mbstate_t)
2515 if test x"$have_mbstate_t" = xyes; then
2516 AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
2519 # Test it always, for use in GLIBCXX_ENABLE_C99, together with
2521 AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
2523 if test x"$enable_wchar_t" = x"yes"; then
2528 if test x"$ac_has_wchar_h" = xyes &&
2529 test x"$ac_has_wctype_h" = xyes; then
2530 AC_TRY_COMPILE([#include <wchar.h>
2591 ],[],[], [enable_wchar_t=no])
2599 if test x"$enable_wchar_t" = x"yes"; then
2600 AC_DEFINE(_GLIBCXX_USE_WCHAR_T, 1,
2601 [Define if code specialized for wchar_t should be used.])
2604 AC_MSG_CHECKING([for enabled wchar_t specializations])
2605 AC_MSG_RESULT([$enable_wchar_t])
2610 dnl Check to see if building and using a C++ precompiled header can be done.
2612 dnl --enable-libstdcxx-pch=yes
2613 dnl default, this shows intent to use stdc++.h.gch If it looks like it
2614 dnl may work, after some light-hearted attempts to puzzle out compiler
2615 dnl support, flip bits on in include/Makefile.am
2617 dnl --disable-libstdcxx-pch
2618 dnl turns off attempts to use or build stdc++.h.gch.
2621 dnl glibcxx_PCHFLAGS
2623 AC_DEFUN([GLIBCXX_ENABLE_PCH], [
2624 GLIBCXX_ENABLE(libstdcxx-pch,$1,,[build pre-compiled libstdc++ headers])
2625 if test $enable_libstdcxx_pch = yes; then
2626 AC_CACHE_CHECK([for compiler with PCH support],
2627 [glibcxx_cv_prog_CXX_pch],
2628 [ac_save_CXXFLAGS="$CXXFLAGS"
2629 CXXFLAGS="$CXXFLAGS -Werror -Winvalid-pch -Wno-deprecated"
2632 echo '#include <math.h>' > conftest.h
2633 if $CXX $CXXFLAGS $CPPFLAGS -x c++-header conftest.h \
2634 -o conftest.h.gch 1>&5 2>&1 &&
2635 echo '#error "pch failed"' > conftest.h &&
2636 echo '#include "conftest.h"' > conftest.cc &&
2637 $CXX -c $CXXFLAGS $CPPFLAGS conftest.cc 1>&5 2>&1 ;
2639 glibcxx_cv_prog_CXX_pch=yes
2641 glibcxx_cv_prog_CXX_pch=no
2644 CXXFLAGS=$ac_save_CXXFLAGS
2647 enable_libstdcxx_pch=$glibcxx_cv_prog_CXX_pch
2650 AC_MSG_CHECKING([for enabled PCH])
2651 AC_MSG_RESULT([$enable_libstdcxx_pch])
2653 GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes)
2654 if test $enable_libstdcxx_pch = yes; then
2655 glibcxx_PCHFLAGS="-include bits/stdc++.h"
2659 AC_SUBST(glibcxx_PCHFLAGS)
2664 dnl Check for atomic builtins.
2666 dnl http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#Atomic-Builtins
2668 dnl This checks to see if the host supports the compiler-generated
2669 dnl builtins for atomic operations for various integral sizes. Note, this
2670 dnl is intended to be an all-or-nothing switch, so all the atomic operations
2671 dnl that are used should be checked.
2674 dnl libgomp and libgfortran use a link test, see CHECK_SYNC_FETCH_AND_ADD.
2677 dnl _GLIBCXX_ATOMIC_BUILTINS_1
2678 dnl _GLIBCXX_ATOMIC_BUILTINS_2
2679 dnl _GLIBCXX_ATOMIC_BUILTINS_4
2680 dnl _GLIBCXX_ATOMIC_BUILTINS_8
2682 AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
2685 old_CXXFLAGS="$CXXFLAGS"
2687 # Do link tests if possible, instead asm tests, limited to some platforms
2688 # see discussion in PR target/40134, PR libstdc++/40133 and the thread
2689 # starting at http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00322.html
2690 atomic_builtins_link_tests=no
2691 if test x$gcc_no_link != xyes; then
2692 # Can do link tests. Limit to some tested platforms
2694 *-*-linux* | *-*-uclinux* | *-*-kfreebsd*-gnu | *-*-gnu*)
2695 atomic_builtins_link_tests=yes
2700 if test x$atomic_builtins_link_tests = xyes; then
2704 CXXFLAGS="$CXXFLAGS -fno-exceptions"
2706 AC_MSG_CHECKING([for atomic builtins for bool])
2707 AC_CACHE_VAL(glibcxx_cv_atomic_bool, [
2710 [typedef bool atomic_type;
2713 const atomic_type c3(0);
2714 __sync_fetch_and_add(&c1, c2);
2715 __sync_val_compare_and_swap(&c1, c3, c2);
2716 __sync_lock_test_and_set(&c1, c3);
2717 __sync_lock_release(&c1);
2718 __sync_synchronize();],
2719 [glibcxx_cv_atomic_bool=yes],
2720 [glibcxx_cv_atomic_bool=no])
2722 if test $glibcxx_cv_atomic_bool = yes; then
2723 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
2724 [Define if builtin atomic operations for bool are supported on this host.])
2726 AC_MSG_RESULT($glibcxx_cv_atomic_bool)
2728 AC_MSG_CHECKING([for atomic builtins for short])
2729 AC_CACHE_VAL(glibcxx_cv_atomic_short, [
2732 [typedef short atomic_type;
2735 const atomic_type c3(0);
2736 __sync_fetch_and_add(&c1, c2);
2737 __sync_val_compare_and_swap(&c1, c3, c2);
2738 __sync_lock_test_and_set(&c1, c3);
2739 __sync_lock_release(&c1);
2740 __sync_synchronize();],
2741 [glibcxx_cv_atomic_short=yes],
2742 [glibcxx_cv_atomic_short=no])
2744 if test $glibcxx_cv_atomic_short = yes; then
2745 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
2746 [Define if builtin atomic operations for short are supported on this host.])
2748 AC_MSG_RESULT($glibcxx_cv_atomic_short)
2750 AC_MSG_CHECKING([for atomic builtins for int])
2751 AC_CACHE_VAL(glibcxx_cv_atomic_int, [
2754 [typedef int atomic_type;
2757 const atomic_type c3(0);
2758 __sync_fetch_and_add(&c1, c2);
2759 __sync_val_compare_and_swap(&c1, c3, c2);
2760 __sync_lock_test_and_set(&c1, c3);
2761 __sync_lock_release(&c1);
2762 __sync_synchronize();],
2763 [glibcxx_cv_atomic_int=yes],
2764 [glibcxx_cv_atomic_int=no])
2766 if test $glibcxx_cv_atomic_int = yes; then
2767 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
2768 [Define if builtin atomic operations for int are supported on this host.])
2770 AC_MSG_RESULT($glibcxx_cv_atomic_int)
2772 AC_MSG_CHECKING([for atomic builtins for long long])
2773 AC_CACHE_VAL(glibcxx_cv_atomic_long_long, [
2776 [typedef long long atomic_type;
2779 const atomic_type c3(0);
2780 __sync_fetch_and_add(&c1, c2);
2781 __sync_val_compare_and_swap(&c1, c3, c2);
2782 __sync_lock_test_and_set(&c1, c3);
2783 __sync_lock_release(&c1);
2784 __sync_synchronize();],
2785 [glibcxx_cv_atomic_long_long=yes],
2786 [glibcxx_cv_atomic_long_long=no])
2788 if test $glibcxx_cv_atomic_long_long = yes; then
2789 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
2790 [Define if builtin atomic operations for long long are supported on this host.])
2792 AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
2798 # Compile unoptimized.
2801 # Fake what AC_TRY_COMPILE does.
2803 cat > conftest.$ac_ext << EOF
2804 [#]line __oline__ "configure"
2807 typedef bool atomic_type;
2810 const atomic_type c3(0);
2811 __sync_fetch_and_add(&c1, c2);
2812 __sync_val_compare_and_swap(&c1, c3, c2);
2813 __sync_lock_test_and_set(&c1, c3);
2814 __sync_lock_release(&c1);
2815 __sync_synchronize();
2820 AC_MSG_CHECKING([for atomic builtins for bool])
2821 if AC_TRY_EVAL(ac_compile); then
2822 if grep __sync_ conftest.s >/dev/null 2>&1 ; then
2823 glibcxx_cv_atomic_bool=no
2825 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
2826 [Define if builtin atomic operations for bool are supported on this host.])
2827 glibcxx_cv_atomic_bool=yes
2830 AC_MSG_RESULT($glibcxx_cv_atomic_bool)
2833 cat > conftest.$ac_ext << EOF
2834 [#]line __oline__ "configure"
2837 typedef short atomic_type;
2840 const atomic_type c3(0);
2841 __sync_fetch_and_add(&c1, c2);
2842 __sync_val_compare_and_swap(&c1, c3, c2);
2843 __sync_lock_test_and_set(&c1, c3);
2844 __sync_lock_release(&c1);
2845 __sync_synchronize();
2850 AC_MSG_CHECKING([for atomic builtins for short])
2851 if AC_TRY_EVAL(ac_compile); then
2852 if grep __sync_ conftest.s >/dev/null 2>&1 ; then
2853 glibcxx_cv_atomic_short=no
2855 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
2856 [Define if builtin atomic operations for short are supported on this host.])
2857 glibcxx_cv_atomic_short=yes
2860 AC_MSG_RESULT($glibcxx_cv_atomic_short)
2863 cat > conftest.$ac_ext << EOF
2864 [#]line __oline__ "configure"
2867 // NB: _Atomic_word not necessarily int.
2868 typedef int atomic_type;
2871 const atomic_type c3(0);
2872 __sync_fetch_and_add(&c1, c2);
2873 __sync_val_compare_and_swap(&c1, c3, c2);
2874 __sync_lock_test_and_set(&c1, c3);
2875 __sync_lock_release(&c1);
2876 __sync_synchronize();
2881 AC_MSG_CHECKING([for atomic builtins for int])
2882 if AC_TRY_EVAL(ac_compile); then
2883 if grep __sync_ conftest.s >/dev/null 2>&1 ; then
2884 glibcxx_cv_atomic_int=no
2886 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
2887 [Define if builtin atomic operations for int are supported on this host.])
2888 glibcxx_cv_atomic_int=yes
2891 AC_MSG_RESULT($glibcxx_cv_atomic_int)
2894 cat > conftest.$ac_ext << EOF
2895 [#]line __oline__ "configure"
2898 typedef long long atomic_type;
2901 const atomic_type c3(0);
2902 __sync_fetch_and_add(&c1, c2);
2903 __sync_val_compare_and_swap(&c1, c3, c2);
2904 __sync_lock_test_and_set(&c1, c3);
2905 __sync_lock_release(&c1);
2906 __sync_synchronize();
2911 AC_MSG_CHECKING([for atomic builtins for long long])
2912 if AC_TRY_EVAL(ac_compile); then
2913 if grep __sync_ conftest.s >/dev/null 2>&1 ; then
2914 glibcxx_cv_atomic_long_long=no
2916 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
2917 [Define if builtin atomic operations for long long are supported on this host.])
2918 glibcxx_cv_atomic_long_long=yes
2921 AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
2926 CXXFLAGS="$old_CXXFLAGS"
2929 # Set atomicity_dir to builtins if either of above tests pass.
2930 if test $glibcxx_cv_atomic_int = yes || test $glibcxx_cv_atomic_bool = yes ; then
2931 atomicity_dir=cpu/generic/atomicity_builtins
2934 # If still generic, set to mutex.
2935 if test $atomicity_dir = "cpu/generic" ; then
2936 atomicity_dir=cpu/generic/atomicity_mutex
2937 AC_MSG_WARN([No native atomic operations are provided for this platform.])
2938 if test "x$target_thread_file" = xsingle; then
2939 AC_MSG_WARN([They cannot be faked when thread support is disabled.])
2940 AC_MSG_WARN([Thread-safety of certain classes is not guaranteed.])
2942 AC_MSG_WARN([They will be faked using a mutex.])
2943 AC_MSG_WARN([Performance of certain classes will degrade as a result.])
2951 dnl Check for exception handling support. If an explicit enable/disable
2952 dnl sjlj exceptions is given, we don't have to detect. Otherwise the
2953 dnl target may or may not support call frame exceptions.
2955 dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
2956 dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
2957 dnl Neither one forces an attempt at detection.
2960 dnl _GLIBCXX_SJLJ_EXCEPTIONS if the compiler is configured for it
2962 AC_DEFUN([GLIBCXX_ENABLE_SJLJ_EXCEPTIONS], [
2963 AC_MSG_CHECKING([for exception model to use])
2966 GLIBCXX_ENABLE(sjlj-exceptions,auto,,
2967 [force use of builtin_setjmp for exceptions],
2968 [permit yes|no|auto])
2970 if test $enable_sjlj_exceptions = auto; then
2971 # Botheration. Now we've got to detect the exception model. Link tests
2972 # against libgcc.a are problematic since we've not been given proper -L
2973 # bits for single-tree newlib and libgloss.
2975 # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style.
2976 cat > conftest.$ac_ext << EOF
2977 [#]line __oline__ "configure"
2986 old_CXXFLAGS="$CXXFLAGS"
2988 if AC_TRY_EVAL(ac_compile); then
2989 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
2990 enable_sjlj_exceptions=yes
2991 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
2992 enable_sjlj_exceptions=no
2993 elif grep __cxa_end_cleanup conftest.s >/dev/null 2>&1 ; then
2994 enable_sjlj_exceptions=no
2997 CXXFLAGS="$old_CXXFLAGS"
3001 # This is a tad weird, for hysterical raisins. We have to map
3002 # enable/disable to two different models.
3003 case $enable_sjlj_exceptions in
3005 AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1,
3006 [Define if the compiler is configured for setjmp/longjmp exceptions.])
3007 ac_exception_model_name=sjlj
3010 ac_exception_model_name="call frame"
3013 AC_MSG_ERROR([unable to detect exception model])
3017 AC_MSG_RESULT($ac_exception_model_name)
3022 dnl Allow visibility attributes to be used on namespaces, objects, etc.
3024 dnl --enable-visibility enables attempt to use visibility attributes.
3025 dnl --disable-visibility turns off all use of visibility attributes.
3026 dnl + Usage: GLIBCXX_ENABLE_VISIBILITY[(DEFAULT)]
3027 dnl Where DEFAULT is 'yes'.
3029 AC_DEFUN([GLIBCXX_ENABLE_VISIBILITY], [
3030 GLIBCXX_ENABLE(visibility,$1,,[enables visibility safe usage])
3032 if test x$enable_visibility = xyes ; then
3033 dnl all hail libgfortran
3034 dnl Check whether the target supports hidden visibility.
3035 AC_CACHE_CHECK([whether the target supports hidden visibility],
3036 glibcxx_cv_have_attribute_visibility, [
3037 save_CFLAGS="$CFLAGS"
3038 CFLAGS="$CFLAGS -Werror"
3039 AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
3040 [], glibcxx_cv_have_attribute_visibility=yes,
3041 glibcxx_cv_have_attribute_visibility=no)
3042 CFLAGS="$save_CFLAGS"])
3043 if test $glibcxx_cv_have_attribute_visibility = no; then
3044 enable_visibility=no
3048 GLIBCXX_CONDITIONAL(ENABLE_VISIBILITY, test $enable_visibility = yes)
3049 AC_MSG_NOTICE([visibility supported: $enable_visibility])
3054 dnl Add version tags to symbols in shared library (or not), additionally
3055 dnl marking other symbols as private/local (or not).
3057 dnl Sets libtool_VERSION, and determines shared library SONAME.
3059 dnl This depends on GLIBCXX CHECK_LINKER_FEATURES, but without it assumes no.
3061 dnl --enable-symvers=style adds a version script to the linker call when
3062 dnl creating the shared library. The choice of version script is
3063 dnl controlled by 'style'.
3064 dnl --disable-symvers does not.
3066 dnl + Usage: GLIBCXX_ENABLE_SYMVERS[(DEFAULT)]
3067 dnl Where DEFAULT is either 'yes' or 'no'. Passing `yes' tries to
3068 dnl choose a default style based on linker characteristics. Passing
3069 dnl 'no' disables versioning.
3071 AC_DEFUN([GLIBCXX_ENABLE_SYMVERS], [
3073 GLIBCXX_ENABLE(symvers,$1,[[[=STYLE]]],
3074 [enables symbol versioning of the shared library],
3075 [permit yes|no|gnu|gnu-versioned-namespace|darwin|darwin-export|sun])
3077 # If we never went through the GLIBCXX_CHECK_LINKER_FEATURES macro, then we
3078 # don't know enough about $LD to do tricks...
3079 AC_REQUIRE([GLIBCXX_CHECK_LINKER_FEATURES])
3080 # Sun style symbol versions needs GNU c++filt for make_sunver.pl to work
3081 # with extern "C++" in version scripts.
3082 AC_REQUIRE([GCC_PROG_GNU_CXXFILT])
3084 # Turn a 'yes' into a suitable default.
3085 if test x$enable_symvers = xyes ; then
3086 if test $enable_shared = no || test "x$LD" = x || test x$gcc_no_link = xyes; then
3089 if test $with_gnu_ld = yes ; then
3090 case ${target_os} in
3092 enable_symvers=no ;;
3094 enable_symvers=gnu ;;
3097 case ${target_os} in
3099 enable_symvers=darwin ;;
3100 # Sun symbol versioning exists since Solaris 2.5.
3101 solaris2.[[5-9]]* | solaris2.1[[0-9]]*)
3102 # make_sunver.pl needs GNU c++filt to support extern "C++" in
3103 # version scripts, so disable symbol versioning if none can be
3105 if test -z "$ac_cv_path_CXXFILT"; then
3106 AC_MSG_WARN([=== You have requested Sun symbol versioning, but])
3107 AC_MSG_WARN([=== no GNU c++filt could be found.])
3108 AC_MSG_WARN([=== Symbol versioning will be disabled.])
3115 enable_symvers=no ;;
3121 # Check to see if 'darwin' or 'darwin-export' can win.
3122 if test x$enable_symvers = xdarwin-export ; then
3123 enable_symvers=darwin
3126 # Check if 'sun' was requested on non-Solaris 2 platforms.
3127 if test x$enable_symvers = xsun ; then
3128 case ${target_os} in
3134 AC_MSG_WARN([=== You have requested Sun symbol versioning, but])
3135 AC_MSG_WARN([=== you are not targetting Solaris 2.])
3136 AC_MSG_WARN([=== Symbol versioning will be disabled.])
3142 # Check to see if 'gnu' can win.
3143 if test $enable_symvers = gnu ||
3144 test $enable_symvers = gnu-versioned-namespace ||
3145 test $enable_symvers = sun; then
3146 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
3147 AC_MSG_CHECKING([for shared libgcc])
3148 ac_save_CFLAGS="$CFLAGS"
3150 AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes, glibcxx_shared_libgcc=no)
3151 CFLAGS="$ac_save_CFLAGS"
3152 if test $glibcxx_shared_libgcc = no; then
3153 cat > conftest.c <<EOF
3154 int main (void) { return 0; }
3157 glibcxx_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
3158 -shared -shared-libgcc -o conftest.so \
3159 conftest.c -v 2>&1 >/dev/null \
3160 | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
3162 rm -f conftest.c conftest.so
3163 if test x${glibcxx_libgcc_s_suffix+set} = xset; then
3164 CFLAGS=" -lgcc_s$glibcxx_libgcc_s_suffix"
3165 AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes)
3166 CFLAGS="$ac_save_CFLAGS"
3169 AC_MSG_RESULT($glibcxx_shared_libgcc)
3171 # For GNU ld, we need at least this version. The format is described in
3172 # GLIBCXX_CHECK_LINKER_FEATURES above.
3173 glibcxx_min_gnu_ld_version=21400
3175 # If no shared libgcc, can't win.
3176 if test $glibcxx_shared_libgcc != yes; then
3177 AC_MSG_WARN([=== You have requested GNU symbol versioning, but])
3178 AC_MSG_WARN([=== you are not building a shared libgcc_s.])
3179 AC_MSG_WARN([=== Symbol versioning will be disabled.])
3181 elif test $with_gnu_ld != yes && test $enable_symvers = sun; then
3182 : All interesting versions of Sun ld support sun style symbol versioning.
3183 elif test $with_gnu_ld != yes ; then
3185 AC_MSG_WARN([=== You have requested GNU symbol versioning, but])
3186 AC_MSG_WARN([=== you are not using the GNU linker.])
3187 AC_MSG_WARN([=== Symbol versioning will be disabled.])
3189 elif test $glibcxx_ld_is_gold = yes ; then
3190 : All versions of gold support symbol versioning.
3191 elif test $glibcxx_gnu_ld_version -lt $glibcxx_min_gnu_ld_version ; then
3192 # The right tools, the right setup, but too old. Fallbacks?
3193 AC_MSG_WARN(=== Linker version $glibcxx_gnu_ld_version is too old for)
3194 AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
3195 AC_MSG_WARN(=== You would need to upgrade your binutils to version)
3196 AC_MSG_WARN(=== $glibcxx_min_gnu_ld_version or later and rebuild GCC.)
3197 AC_MSG_WARN([=== Symbol versioning will be disabled.])
3202 # For libtool versioning info, format is CURRENT:REVISION:AGE
3203 libtool_VERSION=6:17:0
3205 # Everything parsed; figure out what files and settings to use.
3206 case $enable_symvers in
3208 SYMVER_FILE=config/abi/pre/none.ver
3211 SYMVER_FILE=config/abi/pre/gnu.ver
3212 AC_DEFINE(_GLIBCXX_SYMVER_GNU, 1,
3213 [Define to use GNU versioning in the shared library.])
3215 gnu-versioned-namespace)
3216 libtool_VERSION=7:0:0
3217 SYMVER_FILE=config/abi/pre/gnu-versioned-namespace.ver
3218 AC_DEFINE(_GLIBCXX_SYMVER_GNU_NAMESPACE, 1,
3219 [Define to use GNU namespace versioning in the shared library.])
3222 SYMVER_FILE=config/abi/pre/gnu.ver
3223 AC_DEFINE(_GLIBCXX_SYMVER_DARWIN, 1,
3224 [Define to use darwin versioning in the shared library.])
3227 SYMVER_FILE=config/abi/pre/gnu.ver
3228 AC_DEFINE(_GLIBCXX_SYMVER_SUN, 1,
3229 [Define to use Sun versioning in the shared library.])
3233 if test x$enable_symvers != xno ; then
3234 AC_DEFINE(_GLIBCXX_SYMVER, 1,
3235 [Define to use symbol versioning in the shared library.])
3238 AC_CACHE_CHECK([whether the target supports .symver directive],
3239 glibcxx_cv_have_as_symver_directive, [
3240 AC_TRY_COMPILE([void foo (void); __asm (".symver foo, bar@SYMVER");],
3241 [], glibcxx_cv_have_as_symver_directive=yes,
3242 glibcxx_cv_have_as_symver_directive=no)])
3243 if test $glibcxx_cv_have_as_symver_directive = yes; then
3244 AC_DEFINE(HAVE_AS_SYMVER_DIRECTIVE, 1,
3245 [Define to 1 if the target assembler supports .symver directive.])
3248 AC_SUBST(SYMVER_FILE)
3249 AC_SUBST(port_specific_symbol_files)
3250 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS, test $enable_symvers != no)
3251 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU, test $enable_symvers = gnu)
3252 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU_NAMESPACE, test $enable_symvers = gnu-versioned-namespace)
3253 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_DARWIN, test $enable_symvers = darwin)
3254 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_SUN, test $enable_symvers = sun)
3255 AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
3257 if test $enable_symvers != no ; then
3258 case ${target_os} in
3259 # The Solaris 2 runtime linker doesn't support the GNU extension of
3260 # binding the same symbol to different versions
3262 symvers_renaming=no ;;
3263 # Other platforms with GNU symbol versioning (GNU/Linux, more?) do.
3265 AC_DEFINE(HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT, 1,
3266 [Define to 1 if the target runtime linker supports binding the same symbol to different versions.])
3267 symvers_renaming=yes ;;
3272 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_SOL2, test $symvers_renaming = no)
3274 # Now, set up compatibility support, if any.
3275 # In addition, need this to deal with std::size_t mangling in
3276 # src/compatibility.cc. In a perfect world, could use
3277 # typeid(std::size_t).name()[0] to do direct substitution.
3278 AC_MSG_CHECKING([for size_t as unsigned int])
3279 ac_save_CFLAGS="$CFLAGS"
3281 AC_TRY_COMPILE(, [__SIZE_TYPE__* stp; unsigned int* uip; stp = uip;],
3282 [glibcxx_size_t_is_i=yes], [glibcxx_size_t_is_i=no])
3283 CFLAGS=$ac_save_CFLAGS
3284 if test "$glibcxx_size_t_is_i" = yes; then
3285 AC_DEFINE(_GLIBCXX_SIZE_T_IS_UINT, 1, [Define if size_t is unsigned int.])
3287 AC_MSG_RESULT([$glibcxx_size_t_is_i])
3289 AC_MSG_CHECKING([for ptrdiff_t as int])
3290 ac_save_CFLAGS="$CFLAGS"
3292 AC_TRY_COMPILE(, [__PTRDIFF_TYPE__* ptp; int* ip; ptp = ip;],
3293 [glibcxx_ptrdiff_t_is_i=yes], [glibcxx_ptrdiff_t_is_i=no])
3294 CFLAGS=$ac_save_CFLAGS
3295 if test "$glibcxx_ptrdiff_t_is_i" = yes; then
3296 AC_DEFINE(_GLIBCXX_PTRDIFF_T_IS_INT, 1, [Define if ptrdiff_t is int.])
3298 AC_MSG_RESULT([$glibcxx_ptrdiff_t_is_i])
3303 dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
3304 dnl We must stage the required headers so that they will be installed
3305 dnl with the library (unlike libgcc, the STL implementation is provided
3306 dnl solely within headers). Since we must not inject random user-space
3307 dnl macro names into user-provided C++ code, we first stage into <file>-in
3308 dnl and process to <file> with an output command. The reason for a two-
3309 dnl stage process here is to correctly handle $srcdir!=$objdir without
3310 dnl having to write complex code (the sed commands to clean the macro
3311 dnl namespace are complex and fragile enough as it is). We must also
3312 dnl add a relative path so that -I- is supported properly.
3315 dnl glibcxx_thread_h
3318 dnl HAVE_GTHR_DEFAULT
3320 AC_DEFUN([GLIBCXX_ENABLE_THREADS], [
3321 AC_MSG_CHECKING([for thread model used by GCC])
3322 target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
3323 AC_MSG_RESULT([$target_thread_file])
3325 if test $target_thread_file != single; then
3326 AC_DEFINE(HAVE_GTHR_DEFAULT, 1,
3327 [Define if gthr-default.h exists
3328 (meaning that threading support is enabled).])
3331 glibcxx_thread_h=gthr-$target_thread_file.h
3333 dnl Check for __GTHREADS define.
3334 gthread_file=${toplevel_srcdir}/gcc/${glibcxx_thread_h}
3335 if grep __GTHREADS $gthread_file >/dev/null 2>&1 ; then
3341 AC_SUBST(glibcxx_thread_h)
3346 dnl Check if gthread implementation defines the types and functions
3347 dnl required by the c++0x thread library. Conforming gthread
3348 dnl implementations can define __GTHREADS_CXX0X to enable use with c++0x.
3350 AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
3354 ac_save_CXXFLAGS="$CXXFLAGS"
3355 CXXFLAGS="$CXXFLAGS -fno-exceptions -I${toplevel_srcdir}/gcc"
3357 AC_MSG_CHECKING([check whether it can be safely assumed that mutex_timedlock is available])
3359 AC_TRY_COMPILE([#include <unistd.h>],
3361 #if !defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS < 0
3364 ], [ac_gthread_use_mutex_timedlock=1], [ac_gthread_use_mutex_timedlock=0])
3366 AC_DEFINE_UNQUOTED(_GTHREAD_USE_MUTEX_TIMEDLOCK, $ac_gthread_use_mutex_timedlock,
3367 [Define to 1 if mutex_timedlock is available.])
3369 if test $ac_gthread_use_mutex_timedlock = 1 ; then res_mutex_timedlock=yes ;
3370 else res_mutex_timedlock=no ; fi
3371 AC_MSG_RESULT([$res_mutex_timedlock])
3373 target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
3374 case $target_thread_file in
3376 CXXFLAGS="$CXXFLAGS -DSUPPORTS_WEAK -DGTHREAD_USE_WEAK -D_PTHREADS"
3379 AC_MSG_CHECKING([for gthreads library])
3386 #ifndef __GTHREADS_CXX0X
3390 // In case of POSIX threads check _POSIX_TIMEOUTS too.
3391 #if (defined(_PTHREADS) \
3392 && (!defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS <= 0))
3395 ], [ac_has_gthreads=yes], [ac_has_gthreads=no])
3397 AC_MSG_RESULT([$ac_has_gthreads])
3399 if test x"$ac_has_gthreads" = x"yes"; then
3400 AC_DEFINE(_GLIBCXX_HAS_GTHREADS, 1,
3401 [Define if gthreads library is available.])
3404 CXXFLAGS="$ac_save_CXXFLAGS"
3409 # Check whether LC_MESSAGES is available in <locale.h>.
3410 # Ulrich Drepper <drepper@cygnus.com>, 1995.
3412 # This file file be copied and used freely without restrictions. It can
3413 # be used in projects which are not available under the GNU Public License
3414 # but which still want to provide support for the GNU gettext functionality.
3415 # Please note that the actual code is *not* freely available.
3416 AC_DEFUN([AC_LC_MESSAGES], [
3417 AC_CHECK_HEADER(locale.h, [
3418 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
3419 [AC_TRY_COMPILE([#include <locale.h>], [return LC_MESSAGES],
3420 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
3421 if test $ac_cv_val_LC_MESSAGES = yes; then
3422 AC_DEFINE(HAVE_LC_MESSAGES, 1,
3423 [Define if LC_MESSAGES is available in <locale.h>.])
3429 dnl Check whether get_nprocs is available in <sys/sysinfo.h>, and define _GLIBCXX_USE_GET_NPROCS.
3431 AC_DEFUN([GLIBCXX_CHECK_GET_NPROCS], [
3435 ac_save_CXXFLAGS="$CXXFLAGS"
3436 CXXFLAGS="$CXXFLAGS -fno-exceptions"
3438 AC_MSG_CHECKING([for get_nprocs])
3439 AC_CACHE_VAL(glibcxx_cv_GET_NPROCS, [
3440 GCC_TRY_COMPILE_OR_LINK(
3441 [#include <sys/sysinfo.h>],
3442 [int n = get_nprocs();],
3443 [glibcxx_cv_GET_NPROCS=yes],
3444 [glibcxx_cv_GET_NPROCS=no])
3446 if test $glibcxx_cv_GET_NPROCS = yes; then
3447 AC_DEFINE(_GLIBCXX_USE_GET_NPROCS, 1, [Define if get_nprocs is available in <sys/sysinfo.h>.])
3449 AC_MSG_RESULT($glibcxx_cv_GET_NPROCS)
3451 CXXFLAGS="$ac_save_CXXFLAGS"
3456 dnl Check whether sysconf(_SC_NPROCESSORS_ONLN) is available in <unistd.h>, and define _GLIBCXX_USE_SC_NPROCESSORS_ONLN.
3458 AC_DEFUN([GLIBCXX_CHECK_SC_NPROCESSORS_ONLN], [
3462 ac_save_CXXFLAGS="$CXXFLAGS"
3463 CXXFLAGS="$CXXFLAGS -fno-exceptions"
3465 AC_MSG_CHECKING([for _SC_NPROCESSORS_ONLN])
3466 AC_CACHE_VAL(glibcxx_cv_SC_NPROCESSORS_ONLN, [
3467 GCC_TRY_COMPILE_OR_LINK(
3468 [#include <unistd.h>],
3469 [int n = sysconf(_SC_NPROCESSORS_ONLN);],
3470 [glibcxx_cv_SC_NPROCESSORS_ONLN=yes],
3471 [glibcxx_cv_SC_NPROCESSORS_ONLN=no])
3473 if test $glibcxx_cv_SC_NPROCESSORS_ONLN = yes; then
3474 AC_DEFINE(_GLIBCXX_USE_SC_NPROCESSORS_ONLN, 1, [Define if _SC_NPROCESSORS_ONLN is available in <unistd.h>.])
3476 AC_MSG_RESULT($glibcxx_cv_SC_NPROCESSORS_ONLN)
3478 CXXFLAGS="$ac_save_CXXFLAGS"
3483 # Macros from the top-level gcc directory.
3484 m4_include([../config/gc++filt.m4])
3485 m4_include([../config/tls.m4])