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 to 1
568 dnl --disable-fully-dynamic-string defines _GLIBCXX_FULLY_DYNAMIC_STRING to 0
569 dnl otherwise undefined
570 dnl + Usage: GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING[(DEFAULT)]
571 dnl Where DEFAULT is either `yes' or `no'.
573 AC_DEFUN([GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING], [
574 GLIBCXX_ENABLE(fully-dynamic-string,$1,,[do not put empty strings in per-process static memory])
575 if test $enable_fully_dynamic_string = yes; then
576 enable_fully_dynamic_string_def=1
578 enable_fully_dynamic_string_def=0
580 AC_DEFINE_UNQUOTED([_GLIBCXX_FULLY_DYNAMIC_STRING], [${enable_fully_dynamic_string_def}],
581 [Define to 1 if a fully dynamic basic_string is wanted, 0 to disable, undefined for platform defaults])
586 dnl Does any necessary configuration of the testsuite directory. Generates
587 dnl the testsuite_hooks.h header.
589 dnl GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE must be done before this.
593 dnl GLIBCXX_TEST_WCHAR_T
594 dnl GLIBCXX_TEST_THREAD
597 dnl baseline_subdir_switch
599 AC_DEFUN([GLIBCXX_CONFIGURE_TESTSUITE], [
600 if $GLIBCXX_IS_NATIVE ; then
601 # Do checks for resource limit functions.
602 GLIBCXX_CHECK_SETRLIMIT
604 # Look for setenv, so that extended locale tests can be performed.
605 GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv)
608 if $GLIBCXX_IS_NATIVE && test $is_hosted = yes &&
609 test $enable_symvers != no; then
612 enable_abi_check=no ;;
614 enable_abi_check=yes ;;
617 # Only build this as native, since automake does not understand
622 # Export file names for ABI checking.
623 baseline_dir="$glibcxx_srcdir/config/abi/post/${abi_baseline_pair}"
624 AC_SUBST(baseline_dir)
625 baseline_subdir_switch="$abi_baseline_subdir_switch"
626 AC_SUBST(baseline_subdir_switch)
631 dnl Does any necessary configuration of the documentation directory.
633 dnl XSLTPROC must be set before this
636 dnl glibcxx_stylesheets
640 AC_DEFUN([GLIBCXX_CONFIGURE_DOCBOOK], [
642 AC_MSG_CHECKING([for stylesheets used in generation of documentation])
643 glibcxx_stylesheets=no
644 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
645 glibcxx_stylesheets=yes
647 AC_MSG_RESULT($glibcxx_stylesheets)
649 AC_MSG_CHECKING([for local stylesheet directory])
650 glibcxx_local_stylesheets=no
651 if test x"$glibcxx_stylesheets" = x"yes"; then
652 if test -d /usr/share/sgml/docbook/xsl-ns-stylesheets; then
653 glibcxx_local_stylesheets=yes
654 XSL_STYLE_DIR=/usr/share/sgml/docbook/xsl-ns-stylesheets
656 if test -d /usr/share/xml/docbook/stylesheet/docbook-xsl-ns; then
657 glibcxx_local_stylesheets=yes
658 XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns
661 AC_MSG_RESULT($glibcxx_local_stylesheets)
663 if test x"$glibcxx_local_stylesheets" = x"yes"; then
664 AC_SUBST(XSL_STYLE_DIR)
665 AC_MSG_NOTICE($XSL_STYLE_DIR)
667 glibcxx_stylesheets=no
673 dnl Set up *_INCLUDES variables for all sundry Makefile.am's.
677 dnl TOPLEVEL_INCLUDES
679 AC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [
680 # Used for every C++ compile we perform.
682 -I$glibcxx_builddir/include/$host_alias \
683 -I$glibcxx_builddir/include \
684 -I$glibcxx_srcdir/libsupc++"
686 # For Canadian crosses, pick this up too.
687 if test $CANADIAN = yes; then
688 GLIBCXX_INCLUDES="$GLIBCXX_INCLUDES -I\${includedir}"
691 # Stuff in the actual top level. Currently only used by libsupc++ to
692 # get unwind* headers from the libgcc dir.
693 #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/libgcc -I$(toplevel_srcdir)/include'
694 TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/libgcc'
696 # Now, export this to all the little Makefiles....
697 AC_SUBST(GLIBCXX_INCLUDES)
698 AC_SUBST(TOPLEVEL_INCLUDES)
703 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
704 dnl (SECTION_FLAGS is done under CHECK_COMPILER_FEATURES.)
707 dnl OPTIMIZE_CXXFLAGS
710 AC_DEFUN([GLIBCXX_EXPORT_FLAGS], [
711 # Optimization flags that are probably a good idea for thrill-seekers. Just
712 # uncomment the lines below and make, everything else is ready to go...
713 # Alternatively OPTIMIZE_CXXFLAGS can be set in configure.host.
714 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
715 AC_SUBST(OPTIMIZE_CXXFLAGS)
717 WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
723 dnl All installation directory information is determined here.
727 dnl glibcxx_prefixdir
728 dnl glibcxx_toolexecdir
729 dnl glibcxx_toolexeclibdir
731 dnl Assumes cross_compiling bits already done, and with_cross_host in
734 dnl This logic must match gcc/configure.ac's setting of gcc_gxx_include_dir.
735 dnl config/gxx-include-dir.m4 must be kept consistant with this as well.
736 AC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [
737 glibcxx_toolexecdir=no
738 glibcxx_toolexeclibdir=no
739 glibcxx_prefixdir=$prefix
741 AC_MSG_CHECKING([for gxx-include-dir])
742 AC_ARG_WITH([gxx-include-dir],
743 AC_HELP_STRING([--with-gxx-include-dir=DIR],
744 [installation directory for include files]),
746 yes) AC_MSG_ERROR([Missing directory for --with-gxx-include-dir]) ;;
747 no) gxx_include_dir=no ;;
748 *) gxx_include_dir=$withval ;;
750 [gxx_include_dir=no])
751 AC_MSG_RESULT($gxx_include_dir)
753 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
754 AC_ARG_ENABLE([version-specific-runtime-libs],
755 AC_HELP_STRING([--enable-version-specific-runtime-libs],
756 [Specify that runtime libraries should be installed in a compiler-specific directory]),
757 [case "$enableval" in
758 yes) version_specific_libs=yes ;;
759 no) version_specific_libs=no ;;
760 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
762 [version_specific_libs=no])
763 AC_MSG_RESULT($version_specific_libs)
765 # Default case for install directory for include files.
766 if test $version_specific_libs = no && test $gxx_include_dir = no; then
767 gxx_include_dir='include/c++/${gcc_version}'
768 if test -n "$with_cross_host" &&
769 test x"$with_cross_host" != x"no"; then
770 gxx_include_dir='${prefix}/${target_alias}/'"$gxx_include_dir"
772 gxx_include_dir='${prefix}/'"$gxx_include_dir"
776 # Version-specific runtime libs processing.
777 if test $version_specific_libs = yes; then
778 # Need the gcc compiler version to know where to install libraries
779 # and header files if --enable-version-specific-runtime-libs option
780 # is selected. FIXME: these variables are misnamed, there are
781 # no executables installed in _toolexecdir or _toolexeclibdir.
782 if test x"$gxx_include_dir" = x"no"; then
783 gxx_include_dir='${libdir}/gcc/${host_alias}/${gcc_version}/include/c++'
785 glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
786 glibcxx_toolexeclibdir='${toolexecdir}/${gcc_version}$(MULTISUBDIR)'
789 # Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir
790 # Install a library built with a cross compiler in tooldir, not libdir.
791 if test x"$glibcxx_toolexecdir" = x"no"; then
792 if test -n "$with_cross_host" &&
793 test x"$with_cross_host" != x"no"; then
794 glibcxx_toolexecdir='${exec_prefix}/${host_alias}'
795 glibcxx_toolexeclibdir='${toolexecdir}/lib'
797 glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
798 glibcxx_toolexeclibdir='${libdir}'
800 multi_os_directory=`$CXX -print-multi-os-directory`
801 case $multi_os_directory in
802 .) ;; # Avoid trailing /.
803 *) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;;
807 AC_MSG_CHECKING([for install location])
808 AC_MSG_RESULT($gxx_include_dir)
810 AC_SUBST(glibcxx_prefixdir)
811 AC_SUBST(gxx_include_dir)
812 AC_SUBST(glibcxx_toolexecdir)
813 AC_SUBST(glibcxx_toolexeclibdir)
819 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
820 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
821 dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
823 dnl See docs/html/17_intro/configury.html#enable for documentation.
825 m4_define([GLIBCXX_ENABLE],[dnl
826 m4_define([_g_switch],[--enable-$1])dnl
827 m4_define([_g_help],[AC_HELP_STRING([_g_switch$3],[$4 @<:@default=$2@:>@])])dnl
828 AC_ARG_ENABLE([$1],m4_dquote(_g_help),
833 m4_bpatsubst([$5],[permit ])) ;;
834 *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
835 dnl Idea for future: generate a URL pointing to
836 dnl "onlinedocs/configopts.html#whatever"
843 *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
847 [enable_]m4_bpatsubst([$1],-,_)[=][$2])
848 m4_undefine([_g_switch])dnl
849 m4_undefine([_g_help])dnl
854 dnl Check for ISO/IEC 9899:1999 "C99" support.
856 dnl --enable-c99 defines _GLIBCXX_USE_C99
857 dnl --disable-c99 leaves _GLIBCXX_USE_C99 undefined
858 dnl + Usage: GLIBCXX_ENABLE_C99[(DEFAULT)]
859 dnl Where DEFAULT is either `yes' or `no'.
860 dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
862 AC_DEFUN([GLIBCXX_ENABLE_C99], [
863 GLIBCXX_ENABLE(c99,$1,,[turns on ISO/IEC 9899:1999 support])
865 if test x"$enable_c99" = x"yes"; then
870 # Use -std=c++98 because the default (-std=gnu++98) leaves __STRICT_ANSI__
871 # undefined and fake C99 facilities - like pre-standard snprintf - may be
872 # spuriously enabled.
873 # Long term, -std=c++0x could be even better, could manage to explicitely
874 # request C99 facilities to the underlying C headers.
875 ac_save_CXXFLAGS="$CXXFLAGS"
876 CXXFLAGS="$CXXFLAGS -std=c++98"
878 ac_save_gcc_no_link="$gcc_no_link"
880 if test x$gcc_no_link != xyes; then
881 # Use -fno-exceptions to that the C driver can link these tests without
882 # hitting undefined references to personality routines.
883 CXXFLAGS="$CXXFLAGS -fno-exceptions"
884 AC_CHECK_LIB(m, sin, [
887 # Use the default compile-only tests in GCC_TRY_COMPILE_OR_LINK
892 # Check for the existence of <math.h> functions used if C99 is enabled.
893 AC_MSG_CHECKING([for ISO C99 support in <math.h>])
894 AC_CACHE_VAL(glibcxx_cv_c99_math, [
895 GCC_TRY_COMPILE_OR_LINK(
897 volatile double d1, d2;
905 i = isgreater(d1, d2);
906 i = isgreaterequal(d1, d2);
908 i = islessequal(d1, d2);
909 i = islessgreater(d1, d2);
910 i = islessgreater(d1, d2);
911 i = isunordered(d1, d2);
912 ],[glibcxx_cv_c99_math=yes], [glibcxx_cv_c99_math=no])
914 AC_MSG_RESULT($glibcxx_cv_c99_math)
915 if test x"$glibcxx_cv_c99_math" = x"yes"; then
916 AC_DEFINE(_GLIBCXX_USE_C99_MATH, 1,
917 [Define if C99 functions or macros in <math.h> should be imported
918 in <cmath> in namespace std.])
921 # Check for the existence of <complex.h> complex math functions.
922 # This is necessary even though libstdc++ uses the builtin versions
923 # of these functions, because if the builtin cannot be used, a reference
924 # to the library function is emitted.
925 AC_CHECK_HEADERS(tgmath.h, ac_has_tgmath_h=yes, ac_has_tgmath_h=no)
926 AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no)
927 glibcxx_cv_c99_complex=no;
928 if test x"$ac_has_complex_h" = x"yes"; then
929 AC_MSG_CHECKING([for ISO C99 support in <complex.h>])
930 GCC_TRY_COMPILE_OR_LINK(
931 [#include <complex.h>
932 typedef __complex__ float float_type;
933 typedef __complex__ double double_type;
934 typedef __complex__ long double ld_type;
935 volatile float_type tmpf;
936 volatile double_type tmpd;
937 volatile ld_type tmpld;
940 volatile long double ld;],
952 tmpf = cpowf(tmpf, tmpf);
965 tmpd = cpow(tmpd, tmpd);
969 tmpld = ccosl(tmpld);
970 tmpld = ccoshl(tmpld);
971 tmpld = cexpl(tmpld);
972 tmpld = clogl(tmpld);
973 tmpld = csinl(tmpld);
974 tmpld = csinhl(tmpld);
975 tmpld = csqrtl(tmpld);
976 tmpld = ctanl(tmpld);
977 tmpld = ctanhl(tmpld);
978 tmpld = cpowl(tmpld, tmpld);
979 tmpld = cprojl(tmpld);
980 ],[glibcxx_cv_c99_complex=yes], [glibcxx_cv_c99_complex=no])
982 AC_MSG_RESULT($glibcxx_cv_c99_complex)
983 if test x"$glibcxx_cv_c99_complex" = x"yes"; then
984 AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX, 1,
985 [Define if C99 functions in <complex.h> should be used in
986 <complex>. Using compiler builtins for these functions requires
987 corresponding C99 library functions to be present.])
990 # Check for the existence in <stdio.h> of vscanf, et. al.
991 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
992 AC_CACHE_VAL(glibcxx_cv_c99_stdio, [
993 GCC_TRY_COMPILE_OR_LINK(
996 void foo(char* fmt, ...)
998 va_list args; va_start(args, fmt);
999 vfscanf(stderr, "%i", args);
1001 vsnprintf(fmt, 0, "%i", args);
1002 vsscanf(fmt, "%i", args);
1004 [snprintf("12", 0, "%i");],
1005 [glibcxx_cv_c99_stdio=yes], [glibcxx_cv_c99_stdio=no])
1007 AC_MSG_RESULT($glibcxx_cv_c99_stdio)
1009 # Check for the existence in <stdlib.h> of lldiv_t, et. al.
1010 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
1011 AC_CACHE_VAL(glibcxx_cv_c99_stdlib, [
1012 GCC_TRY_COMPILE_OR_LINK(
1013 [#include <stdlib.h>
1015 volatile long double ld;
1016 volatile unsigned long long ll;
1019 f = strtof("gnu", &tmp);
1020 ld = strtold("gnu", &tmp);
1021 ll = strtoll("gnu", &tmp, 10);
1022 ll = strtoull("gnu", &tmp, 10);
1024 mydivt = lldiv(10,1);
1029 ],[glibcxx_cv_c99_stdlib=yes], [glibcxx_cv_c99_stdlib=no])
1031 AC_MSG_RESULT($glibcxx_cv_c99_stdlib)
1033 # Check for the existence in <wchar.h> of wcstold, etc.
1034 glibcxx_cv_c99_wchar=no;
1035 if test x"$ac_has_wchar_h" = xyes &&
1036 test x"$ac_has_wctype_h" = xyes; then
1037 AC_MSG_CHECKING([for ISO C99 support in <wchar.h>])
1038 AC_TRY_COMPILE([#include <wchar.h>
1045 ],[],[glibcxx_cv_c99_wchar=yes], [glibcxx_cv_c99_wchar=no])
1047 # Checks for wide character functions that may not be present.
1048 # Injection of these is wrapped with guard macros.
1049 # NB: only put functions here, instead of immediately above, if
1050 # absolutely necessary.
1051 AC_TRY_COMPILE([#include <wchar.h>
1052 namespace test { using ::vfwscanf; } ], [],
1053 [AC_DEFINE(HAVE_VFWSCANF,1,
1054 [Defined if vfwscanf exists.])],[])
1056 AC_TRY_COMPILE([#include <wchar.h>
1057 namespace test { using ::vswscanf; } ], [],
1058 [AC_DEFINE(HAVE_VSWSCANF,1,
1059 [Defined if vswscanf exists.])],[])
1061 AC_TRY_COMPILE([#include <wchar.h>
1062 namespace test { using ::vwscanf; } ], [],
1063 [AC_DEFINE(HAVE_VWSCANF,1,[Defined if vwscanf exists.])],[])
1065 AC_TRY_COMPILE([#include <wchar.h>
1066 namespace test { using ::wcstof; } ], [],
1067 [AC_DEFINE(HAVE_WCSTOF,1,[Defined if wcstof exists.])],[])
1069 AC_TRY_COMPILE([#include <wctype.h>],
1070 [ wint_t t; int i = iswblank(t);],
1071 [AC_DEFINE(HAVE_ISWBLANK,1,
1072 [Defined if iswblank exists.])],[])
1074 AC_MSG_RESULT($glibcxx_cv_c99_wchar)
1077 # Option parsed, now set things appropriately.
1078 if test x"$glibcxx_cv_c99_math" = x"no" ||
1079 test x"$glibcxx_cv_c99_complex" = x"no" ||
1080 test x"$glibcxx_cv_c99_stdio" = x"no" ||
1081 test x"$glibcxx_cv_c99_stdlib" = x"no" ||
1082 test x"$glibcxx_cv_c99_wchar" = x"no"; then
1085 AC_DEFINE(_GLIBCXX_USE_C99, 1,
1086 [Define if C99 functions or macros from <wchar.h>, <math.h>,
1087 <complex.h>, <stdio.h>, and <stdlib.h> can be used or exposed.])
1090 gcc_no_link="$ac_save_gcc_no_link"
1091 LIBS="$ac_save_LIBS"
1092 CXXFLAGS="$ac_save_CXXFLAGS"
1096 AC_MSG_CHECKING([for fully enabled ISO C99 support])
1097 AC_MSG_RESULT($enable_c99)
1102 dnl Check for clock_gettime, nanosleep and sched_yield, used in the
1103 dnl implementation of 20.8.5 [time.clock], and 30.2.2 [thread.thread.this]
1104 dnl in the current C++0x working draft.
1106 dnl --enable-libstdcxx-time
1107 dnl --enable-libstdcxx-time=yes
1108 dnl checks for the availability of monotonic and realtime clocks,
1109 dnl nanosleep and sched_yield in libc and libposix4 and, in case, links
1111 dnl --enable-libstdcxx-time=rt
1112 dnl also searches (and, in case, links) librt. Note that this is
1113 dnl not always desirable because, in glibc, for example, in turn it
1114 dnl triggers the linking of libpthread too, which activates locking,
1115 dnl a large overhead for single-thread programs.
1116 dnl --enable-libstdcxx-time=no
1117 dnl --disable-libstdcxx-time
1118 dnl disables the checks completely
1120 AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
1122 AC_MSG_CHECKING([for clock_gettime, nanosleep and sched_yield])
1123 GLIBCXX_ENABLE(libstdcxx-time,$1,[[[=KIND]]],
1124 [use KIND for check type],
1129 ac_save_CXXFLAGS="$CXXFLAGS"
1130 CXXFLAGS="$CXXFLAGS -fno-exceptions"
1131 ac_save_LIBS="$LIBS"
1133 ac_has_clock_monotonic=no
1134 ac_has_clock_realtime=no
1135 AC_MSG_RESULT($enable_libstdcxx_time)
1137 if test x"$enable_libstdcxx_time" != x"no"; then
1139 if test x"$enable_libstdcxx_time" = x"rt"; then
1140 AC_SEARCH_LIBS(clock_gettime, [rt posix4])
1141 AC_SEARCH_LIBS(nanosleep, [rt posix4])
1143 AC_SEARCH_LIBS(clock_gettime, [posix4])
1144 AC_SEARCH_LIBS(nanosleep, [posix4])
1147 case "$ac_cv_search_clock_gettime" in
1148 -l*) GLIBCXX_LIBS=$ac_cv_search_clock_gettime
1151 case "$ac_cv_search_nanosleep" in
1152 -l*) GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_nanosleep"
1156 AC_SEARCH_LIBS(sched_yield, [rt posix4])
1158 case "$ac_cv_search_sched_yield" in
1160 GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield"
1161 AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
1162 [ Defined if sched_yield is available. ])
1165 if test x"$enable_libstdcxx_time" = x"rt"; then
1166 GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield"
1167 AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
1168 [ Defined if sched_yield is available. ])
1172 AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
1173 [ Defined if sched_yield is available. ])
1177 AC_CHECK_HEADERS(unistd.h, ac_has_unistd_h=yes, ac_has_unistd_h=no)
1179 if test x"$ac_has_unistd_h" = x"yes"; then
1180 AC_MSG_CHECKING([for monotonic clock])
1182 [#include <unistd.h>
1185 [#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
1188 clock_gettime(CLOCK_MONOTONIC, &tp);
1189 ], [ac_has_clock_monotonic=yes], [ac_has_clock_monotonic=no])
1191 AC_MSG_RESULT($ac_has_clock_monotonic)
1193 AC_MSG_CHECKING([for realtime clock])
1195 [#include <unistd.h>
1198 [#if _POSIX_TIMERS > 0
1201 clock_gettime(CLOCK_REALTIME, &tp);
1202 ], [ac_has_clock_realtime=yes], [ac_has_clock_realtime=no])
1204 AC_MSG_RESULT($ac_has_clock_realtime)
1206 AC_MSG_CHECKING([for nanosleep])
1208 [#include <unistd.h>
1211 [#if _POSIX_TIMERS > 0
1215 ], [ac_has_nanosleep=yes], [ac_has_nanosleep=no])
1217 AC_MSG_RESULT($ac_has_nanosleep)
1221 if test x"$ac_has_clock_monotonic" = x"yes"; then
1222 AC_DEFINE(_GLIBCXX_USE_CLOCK_MONOTONIC, 1,
1223 [ Defined if clock_gettime has monotonic clock support. ])
1226 if test x"$ac_has_clock_realtime" = x"yes"; then
1227 AC_DEFINE(_GLIBCXX_USE_CLOCK_REALTIME, 1,
1228 [ Defined if clock_gettime has realtime clock support. ])
1231 if test x"$ac_has_nanosleep" = x"yes"; then
1232 AC_DEFINE(_GLIBCXX_USE_NANOSLEEP, 1,
1233 [ Defined if nanosleep is available. ])
1236 AC_SUBST(GLIBCXX_LIBS)
1238 CXXFLAGS="$ac_save_CXXFLAGS"
1239 LIBS="$ac_save_LIBS"
1244 dnl Check for gettimeofday, used in the implementation of 20.8.5
1245 dnl [time.clock] in the current C++0x working draft.
1247 AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [
1249 AC_MSG_CHECKING([for gettimeofday])
1253 ac_save_CXXFLAGS="$CXXFLAGS"
1254 CXXFLAGS="$CXXFLAGS -fno-exceptions"
1256 ac_has_gettimeofday=no;
1257 AC_CHECK_HEADERS(sys/time.h, ac_has_sys_time_h=yes, ac_has_sys_time_h=no)
1258 if test x"$ac_has_sys_time_h" = x"yes"; then
1259 AC_MSG_CHECKING([for gettimeofday])
1260 GCC_TRY_COMPILE_OR_LINK([#include <sys/time.h>],
1261 [timeval tv; gettimeofday(&tv, 0);],
1262 [ac_has_gettimeofday=yes], [ac_has_gettimeofday=no])
1264 AC_MSG_RESULT($ac_has_gettimeofday)
1267 if test x"$ac_has_gettimeofday" = x"yes"; then
1268 AC_DEFINE(_GLIBCXX_USE_GETTIMEOFDAY, 1,
1269 [ Defined if gettimeofday is available. ])
1272 CXXFLAGS="$ac_save_CXXFLAGS"
1277 dnl Check for ISO/IEC 9899:1999 "C99" support to ISO/IEC DTR 19768 "TR1"
1278 dnl facilities in Chapter 8, "C compatibility".
1280 AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
1285 # Use -std=c++98 because the default (-std=gnu++98) leaves __STRICT_ANSI__
1286 # undefined and fake C99 facilities may be spuriously enabled.
1287 ac_save_CXXFLAGS="$CXXFLAGS"
1288 CXXFLAGS="$CXXFLAGS -std=c++98"
1290 # Check for the existence of <complex.h> complex math functions used
1292 AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no)
1293 ac_c99_complex_tr1=no;
1294 if test x"$ac_has_complex_h" = x"yes"; then
1295 AC_MSG_CHECKING([for ISO C99 support to TR1 in <complex.h>])
1296 AC_TRY_COMPILE([#include <complex.h>],
1297 [typedef __complex__ float float_type; float_type tmpf;
1304 typedef __complex__ double double_type; double_type tmpd;
1311 typedef __complex__ long double ld_type; ld_type tmpld;
1318 ],[ac_c99_complex_tr1=yes], [ac_c99_complex_tr1=no])
1320 AC_MSG_RESULT($ac_c99_complex_tr1)
1321 if test x"$ac_c99_complex_tr1" = x"yes"; then
1322 AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX_TR1, 1,
1323 [Define if C99 functions in <complex.h> should be used in
1324 <tr1/complex>. Using compiler builtins for these functions
1325 requires corresponding C99 library functions to be present.])
1328 # Check for the existence of <ctype.h> functions.
1329 AC_MSG_CHECKING([for ISO C99 support to TR1 in <ctype.h>])
1330 AC_CACHE_VAL(glibcxx_cv_c99_ctype_tr1, [
1331 AC_TRY_COMPILE([#include <ctype.h>],
1335 ],[glibcxx_cv_c99_ctype_tr1=yes],
1336 [glibcxx_cv_c99_ctype_tr1=no])
1338 AC_MSG_RESULT($glibcxx_cv_c99_ctype_tr1)
1339 if test x"$glibcxx_cv_c99_ctype_tr1" = x"yes"; then
1340 AC_DEFINE(_GLIBCXX_USE_C99_CTYPE_TR1, 1,
1341 [Define if C99 functions in <ctype.h> should be imported in
1342 <tr1/cctype> in namespace std::tr1.])
1345 # Check for the existence of <fenv.h> functions.
1346 AC_CHECK_HEADERS(fenv.h, ac_has_fenv_h=yes, ac_has_fenv_h=no)
1348 if test x"$ac_has_fenv_h" = x"yes"; then
1349 AC_MSG_CHECKING([for ISO C99 support to TR1 in <fenv.h>])
1350 AC_TRY_COMPILE([#include <fenv.h>],
1355 ret = feclearexcept(except);
1356 ret = fegetexceptflag(pflag, except);
1357 ret = feraiseexcept(except);
1358 ret = fesetexceptflag(pflag, except);
1359 ret = fetestexcept(except);
1361 ret = fesetround(mode);
1362 ret = fegetenv(penv);
1363 ret = feholdexcept(penv);
1364 ret = fesetenv(penv);
1365 ret = feupdateenv(penv);
1366 ],[ac_c99_fenv_tr1=yes], [ac_c99_fenv_tr1=no])
1368 AC_MSG_RESULT($ac_c99_fenv_tr1)
1369 if test x"$ac_c99_fenv_tr1" = x"yes"; then
1370 AC_DEFINE(_GLIBCXX_USE_C99_FENV_TR1, 1,
1371 [Define if C99 functions in <fenv.h> should be imported in
1372 <tr1/cfenv> in namespace std::tr1.])
1375 # Check for the existence of <stdint.h> types.
1376 AC_MSG_CHECKING([for ISO C99 support to TR1 in <stdint.h>])
1377 AC_CACHE_VAL(glibcxx_cv_c99_stdint_tr1, [
1378 AC_TRY_COMPILE([#define __STDC_LIMIT_MACROS
1379 #define __STDC_CONSTANT_MACROS
1380 #include <stdint.h>],
1381 [typedef int8_t my_int8_t;
1382 my_int8_t i8 = INT8_MIN;
1384 typedef int16_t my_int16_t;
1385 my_int16_t i16 = INT16_MIN;
1387 typedef int32_t my_int32_t;
1388 my_int32_t i32 = INT32_MIN;
1390 typedef int64_t my_int64_t;
1391 my_int64_t i64 = INT64_MIN;
1393 typedef int_fast8_t my_int_fast8_t;
1394 my_int_fast8_t if8 = INT_FAST8_MIN;
1395 if8 = INT_FAST8_MAX;
1396 typedef int_fast16_t my_int_fast16_t;
1397 my_int_fast16_t if16 = INT_FAST16_MIN;
1398 if16 = INT_FAST16_MAX;
1399 typedef int_fast32_t my_int_fast32_t;
1400 my_int_fast32_t if32 = INT_FAST32_MIN;
1401 if32 = INT_FAST32_MAX;
1402 typedef int_fast64_t my_int_fast64_t;
1403 my_int_fast64_t if64 = INT_FAST64_MIN;
1404 if64 = INT_FAST64_MAX;
1405 typedef int_least8_t my_int_least8_t;
1406 my_int_least8_t il8 = INT_LEAST8_MIN;
1407 il8 = INT_LEAST8_MAX;
1408 typedef int_least16_t my_int_least16_t;
1409 my_int_least16_t il16 = INT_LEAST16_MIN;
1410 il16 = INT_LEAST16_MAX;
1411 typedef int_least32_t my_int_least32_t;
1412 my_int_least32_t il32 = INT_LEAST32_MIN;
1413 il32 = INT_LEAST32_MAX;
1414 typedef int_least64_t my_int_least64_t;
1415 my_int_least64_t il64 = INT_LEAST64_MIN;
1416 il64 = INT_LEAST64_MAX;
1417 typedef intmax_t my_intmax_t;
1418 my_intmax_t im = INTMAX_MAX;
1420 typedef intptr_t my_intptr_t;
1421 my_intptr_t ip = INTPTR_MAX;
1423 typedef uint8_t my_uint8_t;
1424 my_uint8_t ui8 = UINT8_MAX;
1426 typedef uint16_t my_uint16_t;
1427 my_uint16_t ui16 = UINT16_MAX;
1429 typedef uint32_t my_uint32_t;
1430 my_uint32_t ui32 = UINT32_MAX;
1432 typedef uint64_t my_uint64_t;
1433 my_uint64_t ui64 = UINT64_MAX;
1435 typedef uint_fast8_t my_uint_fast8_t;
1436 my_uint_fast8_t uif8 = UINT_FAST8_MAX;
1437 uif8 = UINT_FAST8_MAX;
1438 typedef uint_fast16_t my_uint_fast16_t;
1439 my_uint_fast16_t uif16 = UINT_FAST16_MAX;
1440 uif16 = UINT_FAST16_MAX;
1441 typedef uint_fast32_t my_uint_fast32_t;
1442 my_uint_fast32_t uif32 = UINT_FAST32_MAX;
1443 uif32 = UINT_FAST32_MAX;
1444 typedef uint_fast64_t my_uint_fast64_t;
1445 my_uint_fast64_t uif64 = UINT_FAST64_MAX;
1446 uif64 = UINT_FAST64_MAX;
1447 typedef uint_least8_t my_uint_least8_t;
1448 my_uint_least8_t uil8 = UINT_LEAST8_MAX;
1449 uil8 = UINT_LEAST8_MAX;
1450 typedef uint_least16_t my_uint_least16_t;
1451 my_uint_least16_t uil16 = UINT_LEAST16_MAX;
1452 uil16 = UINT_LEAST16_MAX;
1453 typedef uint_least32_t my_uint_least32_t;
1454 my_uint_least32_t uil32 = UINT_LEAST32_MAX;
1455 uil32 = UINT_LEAST32_MAX;
1456 typedef uint_least64_t my_uint_least64_t;
1457 my_uint_least64_t uil64 = UINT_LEAST64_MAX;
1458 uil64 = UINT_LEAST64_MAX;
1459 typedef uintmax_t my_uintmax_t;
1460 my_uintmax_t uim = UINTMAX_MAX;
1462 typedef uintptr_t my_uintptr_t;
1463 my_uintptr_t uip = UINTPTR_MAX;
1465 ],[glibcxx_cv_c99_stdint_tr1=yes],
1466 [glibcxx_cv_c99_stdint_tr1=no])
1468 AC_MSG_RESULT($glibcxx_cv_c99_stdint_tr1)
1469 if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
1470 AC_DEFINE(_GLIBCXX_USE_C99_STDINT_TR1, 1,
1471 [Define if C99 types in <stdint.h> should be imported in
1472 <tr1/cstdint> in namespace std::tr1.])
1475 # Check for the existence of <math.h> functions.
1476 AC_MSG_CHECKING([for ISO C99 support to TR1 in <math.h>])
1477 AC_CACHE_VAL(glibcxx_cv_c99_math_tr1, [
1478 AC_TRY_COMPILE([#include <math.h>],
1479 [typedef double_t my_double_t;
1480 typedef float_t my_float_t;
1494 copysignf(0.0f, 0.0f);
1495 copysignl(0.0l, 0.0l);
1512 fmaf(0.0f, 0.0f, 0.0f);
1513 fmal(0.0l, 0.0l, 0.0l);
1556 nextafter(0.0, 0.0);
1557 nextafterf(0.0f, 0.0f);
1558 nextafterl(0.0l, 0.0l);
1559 nexttoward(0.0, 0.0);
1560 nexttowardf(0.0f, 0.0f);
1561 nexttowardl(0.0l, 0.0l);
1562 remainder(0.0, 0.0);
1563 remainderf(0.0f, 0.0f);
1564 remainderl(0.0l, 0.0l);
1565 remquo(0.0, 0.0, 0);
1566 remquof(0.0f, 0.0f, 0);
1567 remquol(0.0l, 0.0l, 0);
1586 ],[glibcxx_cv_c99_math_tr1=yes], [glibcxx_cv_c99_math_tr1=no])
1588 AC_MSG_RESULT($glibcxx_cv_c99_math_tr1)
1589 if test x"$glibcxx_cv_c99_math_tr1" = x"yes"; then
1590 AC_DEFINE(_GLIBCXX_USE_C99_MATH_TR1, 1,
1591 [Define if C99 functions or macros in <math.h> should be imported
1592 in <tr1/cmath> in namespace std::tr1.])
1595 # Check for the existence of <inttypes.h> functions (NB: doesn't make
1596 # sense if the glibcxx_cv_c99_stdint_tr1 check fails, per C99, 7.8/1).
1597 ac_c99_inttypes_tr1=no;
1598 if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
1599 AC_MSG_CHECKING([for ISO C99 support to TR1 in <inttypes.h>])
1600 AC_TRY_COMPILE([#include <inttypes.h>],
1601 [intmax_t i, numer, denom, base;
1604 intmax_t ret = imaxabs(i);
1605 imaxdiv_t dret = imaxdiv(numer, denom);
1606 ret = strtoimax(s, endptr, base);
1607 uintmax_t uret = strtoumax(s, endptr, base);
1608 ],[ac_c99_inttypes_tr1=yes], [ac_c99_inttypes_tr1=no])
1610 AC_MSG_RESULT($ac_c99_inttypes_tr1)
1611 if test x"$ac_c99_inttypes_tr1" = x"yes"; then
1612 AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_TR1, 1,
1613 [Define if C99 functions in <inttypes.h> should be imported in
1614 <tr1/cinttypes> in namespace std::tr1.])
1617 # Check for the existence of whcar_t <inttypes.h> functions (NB: doesn't
1618 # make sense if the glibcxx_cv_c99_stdint_tr1 check fails, per C99, 7.8/1).
1619 ac_c99_inttypes_wchar_t_tr1=no;
1620 if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
1621 AC_MSG_CHECKING([for wchar_t ISO C99 support to TR1 in <inttypes.h>])
1622 AC_TRY_COMPILE([#include <inttypes.h>],
1626 intmax_t ret = wcstoimax(s, endptr, base);
1627 uintmax_t uret = wcstoumax(s, endptr, base);
1628 ],[ac_c99_inttypes_wchar_t_tr1=yes],
1629 [ac_c99_inttypes_wchar_t_tr1=no])
1631 AC_MSG_RESULT($ac_c99_inttypes_wchar_t_tr1)
1632 if test x"$ac_c99_inttypes_wchar_t_tr1" = x"yes"; then
1633 AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1, 1,
1634 [Define if wchar_t C99 functions in <inttypes.h> should be
1635 imported in <tr1/cinttypes> in namespace std::tr1.])
1638 # Check for the existence of the <stdbool.h> header.
1639 AC_CHECK_HEADERS(stdbool.h)
1641 CXXFLAGS="$ac_save_CXXFLAGS"
1646 dnl Check whether "/dev/random" and "/dev/urandom" are available for the
1647 dnl random_device of "TR1" (Chapter 5.1, "Random number generation").
1649 AC_DEFUN([GLIBCXX_CHECK_RANDOM_TR1], [
1651 AC_MSG_CHECKING([for "/dev/random" and "/dev/urandom" for TR1 random_device])
1652 AC_CACHE_VAL(glibcxx_cv_random_tr1, [
1653 if test -r /dev/random && test -r /dev/urandom; then
1654 glibcxx_cv_random_tr1=yes;
1656 glibcxx_cv_random_tr1=no;
1659 AC_MSG_RESULT($glibcxx_cv_random_tr1)
1661 if test x"$glibcxx_cv_random_tr1" = x"yes"; then
1662 AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1, 1,
1663 [Define if /dev/random and /dev/urandom are available for
1664 the random_device of TR1 (Chapter 5.1).])
1670 dnl Compute the EOF, SEEK_CUR, and SEEK_END integer constants.
1672 AC_DEFUN([GLIBCXX_COMPUTE_STDIO_INTEGER_CONSTANTS], [
1674 AC_CACHE_CHECK([for the value of EOF], glibcxx_cv_stdio_eof, [
1675 AC_COMPUTE_INT([glibcxx_cv_stdio_eof], [[EOF]],
1676 [#include <stdio.h>],
1677 [AC_MSG_ERROR([computing EOF failed])])
1679 AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_EOF, $glibcxx_cv_stdio_eof,
1680 [Define to the value of the EOF integer constant.])
1682 AC_CACHE_CHECK([for the value of SEEK_CUR], glibcxx_cv_stdio_seek_cur, [
1683 AC_COMPUTE_INT([glibcxx_cv_stdio_seek_cur], [[SEEK_CUR]],
1684 [#include <stdio.h>],
1685 [AC_MSG_ERROR([computing SEEK_CUR failed])])
1687 AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_SEEK_CUR, $glibcxx_cv_stdio_seek_cur,
1688 [Define to the value of the SEEK_CUR integer constant.])
1690 AC_CACHE_CHECK([for the value of SEEK_END], glibcxx_cv_stdio_seek_end, [
1691 AC_COMPUTE_INT([glibcxx_cv_stdio_seek_end], [[SEEK_END]],
1692 [#include <stdio.h>],
1693 [AC_MSG_ERROR([computing SEEK_END failed])])
1695 AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_SEEK_END, $glibcxx_cv_stdio_seek_end,
1696 [Define to the value of the SEEK_END integer constant.])
1700 dnl Check whether required C++ overloads are present in <math.h>.
1703 AC_DEFUN([GLIBCXX_CHECK_MATH_PROTO], [
1710 # Solaris 8 FCS only had an overload for double std::abs(double) in
1711 # <iso/math_iso.h>. Patches 111721-04 (SPARC) and 112757-01 (x86)
1712 # introduced the full set also found from Solaris 9 onwards.
1713 AC_MSG_CHECKING([for float std::abs(float) overload])
1714 AC_CACHE_VAL(glibcxx_cv_abs_float, [
1715 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1718 inline float abs(float __x)
1719 { return __builtin_fabsf(__x); }
1722 [glibcxx_cv_abs_float=no],
1723 [glibcxx_cv_abs_float=yes]
1726 # autoheader cannot handle indented templates.
1727 AH_VERBATIM([__CORRECT_ISO_CPP_MATH_H_PROTO1],
1728 [/* Define if all C++ overloads are available in <math.h>. */
1729 #if __cplusplus >= 199711L
1730 #undef __CORRECT_ISO_CPP_MATH_H_PROTO1
1732 AH_VERBATIM([__CORRECT_ISO_CPP_MATH_H_PROTO2],
1733 [/* Define if only double std::abs(double) is available in <math.h>. */
1734 #if __cplusplus >= 199711L
1735 #undef __CORRECT_ISO_CPP_MATH_H_PROTO2
1738 if test $glibcxx_cv_abs_float = yes; then
1739 AC_DEFINE(__CORRECT_ISO_CPP_MATH_H_PROTO1)
1741 AC_DEFINE(__CORRECT_ISO_CPP_MATH_H_PROTO2)
1743 AC_MSG_RESULT($glibcxx_cv_abs_float)
1751 dnl Check whether required C++ overloads are present in <stdlib.h>.
1754 AC_DEFUN([GLIBCXX_CHECK_STDLIB_PROTO], [
1761 # Solaris 8 FCS lacked the overloads for long std::abs(long) and
1762 # ldiv_t std::div(long, long) in <iso/stdlib_iso.h>. Patches 109607-02
1763 # (SPARC) and 109608-02 (x86) introduced them.
1764 AC_MSG_CHECKING([for long std::abs(long) overload])
1765 AC_CACHE_VAL(glibcxx_cv_abs_long, [
1766 AC_COMPILE_IFELSE([AC_LANG_SOURCE(
1767 [#include <stdlib.h>
1770 abs(long __i) { return labs(__i); }
1773 [glibcxx_cv_abs_long=no],
1774 [glibcxx_cv_abs_long=yes]
1777 # autoheader cannot handle indented templates.
1778 AH_VERBATIM([__CORRECT_ISO_CPP_STDLIB_H_PROTO],
1779 [/* Define if all C++ overloads are available in <stdlib.h>. */
1780 #if __cplusplus >= 199711L
1781 #undef __CORRECT_ISO_CPP_STDLIB_H_PROTO
1783 if test $glibcxx_cv_abs_long = yes; then
1784 AC_DEFINE(__CORRECT_ISO_CPP_STDLIB_H_PROTO, 1)
1786 AC_MSG_RESULT($glibcxx_cv_abs_long)
1794 dnl Check whether macros, etc are present for <system_error>
1796 AC_DEFUN([GLIBCXX_CHECK_SYSTEM_ERROR], [
1798 m4_pushdef([n_syserr], [1])dnl
1799 m4_foreach([syserr], [EOWNERDEAD, ENOTRECOVERABLE, ENOLINK, EPROTO, ENODATA,
1800 ENOSR, ENOSTR, ETIME, EBADMSG, ECANCELED,
1801 EOVERFLOW, ENOTSUP, EIDRM, ETXTBSY,
1802 ECHILD, ENOSPC, EPERM,
1803 ETIMEDOUT, EWOULDBLOCK],
1804 [m4_pushdef([SYSERR], m4_toupper(syserr))dnl
1805 AC_MSG_CHECKING([for syserr])
1806 AC_CACHE_VAL([glibcxx_cv_system_error[]n_syserr], [
1807 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]],
1808 [int i = syserr;])],
1809 [glibcxx_cv_system_error[]n_syserr=yes],
1810 [glibcxx_cv_system_error[]n_syserr=no])
1812 AC_MSG_RESULT([$glibcxx_cv_system_error[]n_syserr])
1813 if test x"$glibcxx_cv_system_error[]n_syserr" = x"yes"; then
1814 AC_DEFINE([HAVE_]SYSERR, 1, [Define if ]syserr[ exists.])
1816 m4_define([n_syserr], m4_incr(n_syserr))dnl
1817 m4_popdef([SYSERR])dnl
1819 m4_popdef([n_syserr])dnl
1823 dnl Check for what type of C headers to use.
1825 dnl --enable-cheaders= [does stuff].
1826 dnl --disable-cheaders [does not do anything, really].
1827 dnl + Usage: GLIBCXX_ENABLE_CHEADERS[(DEFAULT)]
1828 dnl Where DEFAULT is either 'c' or 'c_std' or 'c_global'.
1830 AC_DEFUN([GLIBCXX_ENABLE_CHEADERS], [
1831 GLIBCXX_ENABLE(cheaders,$1,[[[=KIND]]],
1832 [construct "C" headers for g++], [permit c|c_std|c_global])
1833 AC_MSG_NOTICE("C" header strategy set to $enable_cheaders)
1835 C_INCLUDE_DIR='${glibcxx_srcdir}/include/'$enable_cheaders
1837 # Allow overrides to configure.host here.
1838 if test $enable_cheaders = c_global; then
1842 AC_SUBST(C_INCLUDE_DIR)
1843 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c)
1844 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std)
1845 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_GLOBAL, test $enable_cheaders = c_global)
1846 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes)
1851 dnl Check for which locale library to use. The choice is mapped to
1852 dnl a subdirectory of config/locale.
1854 dnl Default is generic.
1856 AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
1857 GLIBCXX_ENABLE(clocale,auto,[[[=MODEL]]],
1858 [use MODEL for target locale package],
1859 [permit generic|gnu|ieee_1003.1-2001|newlib|yes|no|auto])
1861 # Deal with gettext issues. Default to not using it (=no) until we detect
1862 # support for it later. Let the user turn it off via --e/d, but let that
1863 # default to on for easier handling.
1866 AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]),
1870 # Either a known package, or "auto"
1871 if test $enable_clocale = no || test $enable_clocale = yes; then
1874 enable_clocale_flag=$enable_clocale
1876 # Probe for locale model to use if none specified.
1877 # Default to "generic".
1878 if test $enable_clocale_flag = auto; then
1879 case ${target_os} in
1880 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
1881 enable_clocale_flag=gnu
1884 enable_clocale_flag=darwin
1887 if test x"$with_newlib" = x"yes"; then
1888 enable_clocale_flag=newlib
1890 enable_clocale_flag=generic
1896 # Sanity check model, and test for special functionality.
1897 if test $enable_clocale_flag = gnu; then
1898 AC_EGREP_CPP([_GLIBCXX_ok], [
1899 #include <features.h>
1900 #if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined(__UCLIBC__)
1903 ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
1905 # Set it to scream when it hurts.
1906 ac_save_CFLAGS="$CFLAGS"
1907 CFLAGS="-Wimplicit-function-declaration -Werror"
1909 # Use strxfrm_l if available.
1910 AC_TRY_COMPILE([#define _GNU_SOURCE 1
1912 #include <locale.h>],
1913 [char s[128]; __locale_t loc; strxfrm_l(s, "C", 5, loc);],
1914 AC_DEFINE(HAVE_STRXFRM_L, 1,
1915 [Define if strxfrm_l is available in <string.h>.]),)
1917 # Use strerror_l if available.
1918 AC_TRY_COMPILE([#define _GNU_SOURCE 1
1920 #include <locale.h>],
1921 [__locale_t loc; strerror_l(5, loc);],
1922 AC_DEFINE(HAVE_STRERROR_L, 1,
1923 [Define if strerror_l is available in <string.h>.]),)
1925 CFLAGS="$ac_save_CFLAGS"
1928 # Perhaps use strerror_r if available, and strerror_l isn't.
1929 ac_save_CFLAGS="$CFLAGS"
1930 CFLAGS="-Wimplicit-function-declaration -Werror"
1931 AC_TRY_COMPILE([#define _GNU_SOURCE 1
1933 #include <locale.h>],
1934 [char s[128]; strerror_r(5, s, 128);],
1935 AC_DEFINE(HAVE_STRERROR_R, 1,
1936 [Define if strerror_r is available in <string.h>.]),)
1937 CFLAGS="$ac_save_CFLAGS"
1939 # Set configure bits for specified locale package
1940 AC_MSG_CHECKING([for C locale to use])
1941 case ${enable_clocale_flag} in
1943 AC_MSG_RESULT(generic)
1945 CLOCALE_H=config/locale/generic/c_locale.h
1946 CLOCALE_CC=config/locale/generic/c_locale.cc
1947 CCODECVT_CC=config/locale/generic/codecvt_members.cc
1948 CCOLLATE_CC=config/locale/generic/collate_members.cc
1949 CCTYPE_CC=config/locale/generic/ctype_members.cc
1950 CMESSAGES_H=config/locale/generic/messages_members.h
1951 CMESSAGES_CC=config/locale/generic/messages_members.cc
1952 CMONEY_CC=config/locale/generic/monetary_members.cc
1953 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1954 CTIME_H=config/locale/generic/time_members.h
1955 CTIME_CC=config/locale/generic/time_members.cc
1956 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
1959 AC_MSG_RESULT(darwin or freebsd)
1961 CLOCALE_H=config/locale/generic/c_locale.h
1962 CLOCALE_CC=config/locale/generic/c_locale.cc
1963 CCODECVT_CC=config/locale/generic/codecvt_members.cc
1964 CCOLLATE_CC=config/locale/generic/collate_members.cc
1965 CCTYPE_CC=config/locale/darwin/ctype_members.cc
1966 CMESSAGES_H=config/locale/generic/messages_members.h
1967 CMESSAGES_CC=config/locale/generic/messages_members.cc
1968 CMONEY_CC=config/locale/generic/monetary_members.cc
1969 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1970 CTIME_H=config/locale/generic/time_members.h
1971 CTIME_CC=config/locale/generic/time_members.cc
1972 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
1978 # Declare intention to use gettext, and add support for specific
1980 # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
1983 # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
1984 AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
1985 if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
1988 # Export the build objects.
1989 for ling in $ALL_LINGUAS; do \
1990 glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
1991 glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
1993 AC_SUBST(glibcxx_MOFILES)
1994 AC_SUBST(glibcxx_POFILES)
1996 CLOCALE_H=config/locale/gnu/c_locale.h
1997 CLOCALE_CC=config/locale/gnu/c_locale.cc
1998 CCODECVT_CC=config/locale/gnu/codecvt_members.cc
1999 CCOLLATE_CC=config/locale/gnu/collate_members.cc
2000 CCTYPE_CC=config/locale/gnu/ctype_members.cc
2001 CMESSAGES_H=config/locale/gnu/messages_members.h
2002 CMESSAGES_CC=config/locale/gnu/messages_members.cc
2003 CMONEY_CC=config/locale/gnu/monetary_members.cc
2004 CNUMERIC_CC=config/locale/gnu/numeric_members.cc
2005 CTIME_H=config/locale/gnu/time_members.h
2006 CTIME_CC=config/locale/gnu/time_members.cc
2007 CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h
2010 AC_MSG_RESULT(IEEE 1003.1)
2012 CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h
2013 CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc
2014 CCODECVT_CC=config/locale/generic/codecvt_members.cc
2015 CCOLLATE_CC=config/locale/generic/collate_members.cc
2016 CCTYPE_CC=config/locale/generic/ctype_members.cc
2017 CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h
2018 CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc
2019 CMONEY_CC=config/locale/generic/monetary_members.cc
2020 CNUMERIC_CC=config/locale/generic/numeric_members.cc
2021 CTIME_H=config/locale/generic/time_members.h
2022 CTIME_CC=config/locale/generic/time_members.cc
2023 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
2026 AC_MSG_RESULT(newlib)
2028 CLOCALE_H=config/locale/generic/c_locale.h
2029 CLOCALE_CC=config/locale/generic/c_locale.cc
2030 CCODECVT_CC=config/locale/generic/codecvt_members.cc
2031 CCOLLATE_CC=config/locale/generic/collate_members.cc
2032 CCTYPE_CC=config/locale/newlib/ctype_members.cc
2033 CMESSAGES_H=config/locale/generic/messages_members.h
2034 CMESSAGES_CC=config/locale/generic/messages_members.cc
2035 CMONEY_CC=config/locale/generic/monetary_members.cc
2036 CNUMERIC_CC=config/locale/generic/numeric_members.cc
2037 CTIME_H=config/locale/generic/time_members.h
2038 CTIME_CC=config/locale/generic/time_members.cc
2039 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
2043 # This is where the testsuite looks for locale catalogs, using the
2044 # -DLOCALEDIR define during testsuite compilation.
2045 glibcxx_localedir=${glibcxx_builddir}/po/share/locale
2046 AC_SUBST(glibcxx_localedir)
2048 # A standalone libintl (e.g., GNU libintl) may be in use.
2049 if test $USE_NLS = yes; then
2050 AC_CHECK_HEADERS([libintl.h], [], USE_NLS=no)
2051 AC_SEARCH_LIBS(gettext, intl, [], USE_NLS=no)
2053 if test $USE_NLS = yes; then
2054 AC_DEFINE(_GLIBCXX_USE_NLS, 1,
2055 [Define if NLS translations are to be used.])
2060 AC_SUBST(CMESSAGES_H)
2061 AC_SUBST(CCODECVT_CC)
2062 AC_SUBST(CCOLLATE_CC)
2064 AC_SUBST(CMESSAGES_CC)
2066 AC_SUBST(CNUMERIC_CC)
2069 AC_SUBST(CLOCALE_CC)
2070 AC_SUBST(CLOCALE_INTERNAL_H)
2075 dnl Check for which std::allocator base class to use. The choice is
2076 dnl mapped from a subdirectory of include/ext.
2080 AC_DEFUN([GLIBCXX_ENABLE_ALLOCATOR], [
2081 AC_MSG_CHECKING([for std::allocator base class])
2082 GLIBCXX_ENABLE(libstdcxx-allocator,auto,[[[=KIND]]],
2083 [use KIND for target std::allocator base],
2084 [permit new|malloc|mt|bitmap|pool|yes|no|auto])
2086 # If they didn't use this option switch, or if they specified --enable
2087 # with no specific model, we'll have to look for one. If they
2088 # specified --disable (???), do likewise.
2089 if test $enable_libstdcxx_allocator = no ||
2090 test $enable_libstdcxx_allocator = yes;
2092 enable_libstdcxx_allocator=auto
2095 # Either a known package, or "auto". Auto implies the default choice
2096 # for a particular platform.
2097 enable_libstdcxx_allocator_flag=$enable_libstdcxx_allocator
2099 # Probe for host-specific support if no specific model is specified.
2101 if test $enable_libstdcxx_allocator_flag = auto; then
2102 case ${target_os} in
2103 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
2104 enable_libstdcxx_allocator_flag=new
2107 enable_libstdcxx_allocator_flag=new
2111 AC_MSG_RESULT($enable_libstdcxx_allocator_flag)
2114 # Set configure bits for specified locale package
2115 case ${enable_libstdcxx_allocator_flag} in
2117 ALLOCATOR_H=config/allocator/bitmap_allocator_base.h
2118 ALLOCATOR_NAME=__gnu_cxx::bitmap_allocator
2121 ALLOCATOR_H=config/allocator/malloc_allocator_base.h
2122 ALLOCATOR_NAME=__gnu_cxx::malloc_allocator
2125 ALLOCATOR_H=config/allocator/mt_allocator_base.h
2126 ALLOCATOR_NAME=__gnu_cxx::__mt_alloc
2129 ALLOCATOR_H=config/allocator/new_allocator_base.h
2130 ALLOCATOR_NAME=__gnu_cxx::new_allocator
2133 ALLOCATOR_H=config/allocator/pool_allocator_base.h
2134 ALLOCATOR_NAME=__gnu_cxx::__pool_alloc
2138 AC_SUBST(ALLOCATOR_H)
2139 AC_SUBST(ALLOCATOR_NAME)
2144 dnl Check for whether the Boost-derived checks should be turned on.
2146 dnl --enable-concept-checks turns them on.
2147 dnl --disable-concept-checks leaves them off.
2148 dnl + Usage: GLIBCXX_ENABLE_CONCEPT_CHECKS[(DEFAULT)]
2149 dnl Where DEFAULT is either `yes' or `no'.
2151 AC_DEFUN([GLIBCXX_ENABLE_CONCEPT_CHECKS], [
2152 GLIBCXX_ENABLE(concept-checks,$1,,[use Boost-derived template checks])
2153 if test $enable_concept_checks = yes; then
2154 AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS, 1,
2155 [Define to use concept checking code from the boost libraries.])
2160 dnl Use extern templates.
2162 dnl --enable-extern-template defines _GLIBCXX_EXTERN_TEMPLATE to 1
2163 dnl --disable-extern-template defines _GLIBCXX_EXTERN_TEMPLATE to 0
2165 dnl + Usage: GLIBCXX_ENABLE_TEMPLATE[(DEFAULT)]
2166 dnl Where DEFAULT is `yes' or `no'.
2168 AC_DEFUN([GLIBCXX_ENABLE_EXTERN_TEMPLATE], [
2170 GLIBCXX_ENABLE(extern-template,$1,,[enable extern template])
2172 AC_MSG_CHECKING([for extern template support])
2173 AC_MSG_RESULT([$enable_extern_template])
2175 GLIBCXX_CONDITIONAL(ENABLE_EXTERN_TEMPLATE, test $enable_extern_template = yes)
2179 dnl Check for parallel mode pre-requisites, including OpenMP support.
2181 dnl + Usage: GLIBCXX_ENABLE_PARALLEL
2183 AC_DEFUN([GLIBCXX_ENABLE_PARALLEL], [
2187 # See if configured libgomp/omp.h exists. (libgomp may be in
2188 # noconfigdirs but not explicitly disabled.)
2189 if echo " ${TARGET_CONFIGDIRS} " | grep " libgomp " > /dev/null 2>&1 ; then
2190 enable_parallel=yes;
2192 AC_MSG_NOTICE([target-libgomp not built])
2195 AC_MSG_CHECKING([for parallel mode support])
2196 AC_MSG_RESULT([$enable_parallel])
2197 GLIBCXX_CONDITIONAL(ENABLE_PARALLEL, test $enable_parallel = yes)
2202 dnl Check for which I/O library to use: stdio, or something specific.
2204 dnl Default is stdio.
2206 AC_DEFUN([GLIBCXX_ENABLE_CSTDIO], [
2207 AC_MSG_CHECKING([for underlying I/O to use])
2208 GLIBCXX_ENABLE(cstdio,stdio,[[[=PACKAGE]]],
2209 [use target-specific I/O package], [permit stdio])
2211 # Now that libio has been removed, you can have any color you want as long
2212 # as it's black. This is one big no-op until other packages are added, but
2213 # showing the framework never hurts.
2214 case ${enable_cstdio} in
2216 CSTDIO_H=config/io/c_io_stdio.h
2217 BASIC_FILE_H=config/io/basic_file_stdio.h
2218 BASIC_FILE_CC=config/io/basic_file_stdio.cc
2219 AC_MSG_RESULT(stdio)
2224 AC_SUBST(BASIC_FILE_H)
2225 AC_SUBST(BASIC_FILE_CC)
2230 dnl Check for "unusual" flags to pass to the compiler while building.
2232 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
2233 dnl experimental flags such as -fpch, -fIMI, -Dfloat=char, etc.
2234 dnl --disable-cxx-flags passes nothing.
2235 dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
2236 dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
2237 dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
2238 dnl + Usage: GLIBCXX_ENABLE_CXX_FLAGS(default flags)
2239 dnl If "default flags" is an empty string, the effect is the same
2240 dnl as --disable or --enable=no.
2242 AC_DEFUN([GLIBCXX_ENABLE_CXX_FLAGS], [dnl
2243 AC_MSG_CHECKING([for extra compiler flags for building])
2244 GLIBCXX_ENABLE(cxx-flags,$1,[=FLAGS],
2245 [pass compiler FLAGS when building library],
2246 [case "x$enable_cxx_flags" in
2247 xno | x) enable_cxx_flags= ;;
2249 *) AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;;
2252 # Run through flags (either default or command-line) and set anything
2253 # extra (e.g., #defines) that must accompany particular g++ options.
2254 if test -n "$enable_cxx_flags"; then
2255 for f in $enable_cxx_flags; do
2259 *) # and we're trying to pass /what/ exactly?
2260 AC_MSG_ERROR([compiler flags start with a -]) ;;
2265 EXTRA_CXX_FLAGS="$enable_cxx_flags"
2266 AC_MSG_RESULT($EXTRA_CXX_FLAGS)
2267 AC_SUBST(EXTRA_CXX_FLAGS)
2272 dnl Check to see if debugging libraries are to be built.
2274 dnl --enable-libstdcxx-debug
2275 dnl builds a separate set of debugging libraries in addition to the
2276 dnl normal (shared, static) libstdc++ binaries.
2278 dnl --disable-libstdcxx-debug
2279 dnl builds only one (non-debug) version of libstdc++.
2281 dnl --enable-libstdcxx-debug-flags=FLAGS
2282 dnl iff --enable-debug == yes, then use FLAGS to build the debug library.
2284 dnl + Usage: GLIBCXX_ENABLE_DEBUG[(DEFAULT)]
2285 dnl Where DEFAULT is either `yes' or `no'.
2287 AC_DEFUN([GLIBCXX_ENABLE_DEBUG], [
2288 AC_MSG_CHECKING([for additional debug build])
2289 GLIBCXX_ENABLE(libstdcxx-debug,$1,,[build extra debug library])
2290 AC_MSG_RESULT($enable_libstdcxx_debug)
2291 GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_DEBUG, test $enable_libstdcxx_debug = yes)
2296 dnl Check for explicit debug flags.
2298 dnl --enable-libstdcxx-debug-flags='-O1'
2299 dnl is a general method for passing flags to be used when
2300 dnl building debug libraries with --enable-debug.
2302 dnl --disable-libstdcxx-debug-flags does nothing.
2303 dnl + Usage: GLIBCXX_ENABLE_DEBUG_FLAGS(default flags)
2304 dnl If "default flags" is an empty string, the effect is the same
2305 dnl as --disable or --enable=no.
2307 AC_DEFUN([GLIBCXX_ENABLE_DEBUG_FLAGS], [
2308 GLIBCXX_ENABLE(libstdcxx-debug-flags,[$1],[=FLAGS],
2309 [pass compiler FLAGS when building debug library],
2310 [case "x$enable_libstdcxx_debug_flags" in
2311 xno | x) enable_libstdcxx_debug_flags= ;;
2313 *) AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;;
2316 # Option parsed, now set things appropriately
2317 DEBUG_FLAGS="$enable_libstdcxx_debug_flags"
2318 AC_SUBST(DEBUG_FLAGS)
2320 AC_MSG_NOTICE([Debug build flags set to $DEBUG_FLAGS])
2325 dnl Check if the user only wants a freestanding library implementation.
2327 dnl --disable-hosted-libstdcxx will turn off most of the library build,
2328 dnl installing only the headers required by [17.4.1.3] and the language
2329 dnl support library. More than that will be built (to keep the Makefiles
2330 dnl conveniently clean), but not installed.
2333 dnl is_hosted (yes/no)
2336 dnl _GLIBCXX_HOSTED (always defined, either to 1 or 0)
2338 AC_DEFUN([GLIBCXX_ENABLE_HOSTED], [
2339 AC_ARG_ENABLE([hosted-libstdcxx],
2340 AC_HELP_STRING([--disable-hosted-libstdcxx],
2341 [only build freestanding C++ runtime support]),,
2344 enable_hosted_libstdcxx=no
2347 enable_hosted_libstdcxx=yes
2350 if test "$enable_hosted_libstdcxx" = no; then
2351 AC_MSG_NOTICE([Only freestanding libraries will be built])
2355 enable_libstdcxx_pch=no
2360 GLIBCXX_CONDITIONAL(GLIBCXX_HOSTED, test $is_hosted = yes)
2361 AC_DEFINE_UNQUOTED(_GLIBCXX_HOSTED, $hosted_define,
2362 [Define to 1 if a full hosted library is built, or 0 if freestanding.])
2367 dnl Check for template specializations for the 'long long' type.
2368 dnl The result determines only whether 'long long' I/O is enabled; things
2369 dnl like numeric_limits<> specializations are always available.
2371 dnl --enable-long-long defines _GLIBCXX_USE_LONG_LONG
2372 dnl --disable-long-long leaves _GLIBCXX_USE_LONG_LONG undefined
2373 dnl + Usage: GLIBCXX_ENABLE_LONG_LONG[(DEFAULT)]
2374 dnl Where DEFAULT is either `yes' or `no'.
2376 AC_DEFUN([GLIBCXX_ENABLE_LONG_LONG], [
2377 GLIBCXX_ENABLE(long-long,$1,,[enable template specializations for 'long long'])
2378 if test $enable_long_long = yes; then
2379 AC_DEFINE(_GLIBCXX_USE_LONG_LONG, 1,
2380 [Define if code specialized for long long should be used.])
2382 AC_MSG_CHECKING([for enabled long long specializations])
2383 AC_MSG_RESULT([$enable_long_long])
2388 dnl Check for decimal floating point.
2390 dnl http://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html#Decimal-Float
2392 dnl This checks to see if the host supports decimal floating point types.
2395 dnl _GLIBCXX_USE_DECIMAL_FLOAT
2397 AC_DEFUN([GLIBCXX_ENABLE_DECIMAL_FLOAT], [
2399 # Fake what AC_TRY_COMPILE does, without linking as this is
2400 # unnecessary for this test.
2402 cat > conftest.$ac_ext << EOF
2403 [#]line __oline__ "configure"
2413 AC_MSG_CHECKING([for ISO/IEC TR 24733 ])
2414 if AC_TRY_EVAL(ac_compile); then
2415 AC_DEFINE(_GLIBCXX_USE_DECIMAL_FLOAT, 1,
2416 [Define if ISO/IEC TR 24733 decimal floating point types are supported on this host.])
2421 AC_MSG_RESULT($enable_dfp)
2426 dnl Check for GNU 128-bit integer and floating point types.
2428 dnl Note: also checks that the types aren't standard types.
2431 dnl _GLIBCXX_USE_INT128
2432 dnl _GLIBCXX_USE_FLOAT128
2434 AC_DEFUN([GLIBCXX_ENABLE_INT128_FLOAT128], [
2439 # Fake what AC_TRY_COMPILE does, without linking as this is
2440 # unnecessary for this test.
2442 cat > conftest.$ac_ext << EOF
2443 [#]line __oline__ "configure"
2444 template<typename T1, typename T2>
2446 { typedef T2 type; };
2448 template<typename T>
2453 typename same<long, __int128>::type i1;
2454 typename same<long long, __int128>::type i2;
2458 AC_MSG_CHECKING([for __int128])
2459 if AC_TRY_EVAL(ac_compile); then
2460 AC_DEFINE(_GLIBCXX_USE_INT128, 1,
2461 [Define if __int128 is supported on this host.])
2466 AC_MSG_RESULT($enable_int128)
2469 cat > conftest.$ac_ext << EOF
2470 [#]line __oline__ "configure"
2471 template<typename T1, typename T2>
2473 { typedef T2 type; };
2475 template<typename T>
2480 typename same<double, __float128>::type f1;
2481 typename same<long double, __float128>::type f2;
2485 AC_MSG_CHECKING([for __float128])
2486 if AC_TRY_EVAL(ac_compile); then
2487 AC_DEFINE(_GLIBCXX_USE_FLOAT128, 1,
2488 [Define if __float128 is supported on this host.])
2493 AC_MSG_RESULT($enable_float128)
2500 dnl Check for template specializations for the 'wchar_t' type.
2502 dnl --enable-wchar_t defines _GLIBCXX_USE_WCHAR_T
2503 dnl --disable-wchar_t leaves _GLIBCXX_USE_WCHAR_T undefined
2504 dnl + Usage: GLIBCXX_ENABLE_WCHAR_T[(DEFAULT)]
2505 dnl Where DEFAULT is either `yes' or `no'.
2507 dnl Necessary support must also be present.
2509 AC_DEFUN([GLIBCXX_ENABLE_WCHAR_T], [
2510 GLIBCXX_ENABLE(wchar_t,$1,,[enable template specializations for 'wchar_t'])
2512 # Test wchar.h for mbstate_t, which is needed for char_traits and fpos.
2513 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
2514 AC_MSG_CHECKING([for mbstate_t])
2515 AC_TRY_COMPILE([#include <wchar.h>],
2516 [mbstate_t teststate;],
2517 have_mbstate_t=yes, have_mbstate_t=no)
2518 AC_MSG_RESULT($have_mbstate_t)
2519 if test x"$have_mbstate_t" = xyes; then
2520 AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
2523 # Test it always, for use in GLIBCXX_ENABLE_C99, together with
2525 AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
2527 if test x"$enable_wchar_t" = x"yes"; then
2532 if test x"$ac_has_wchar_h" = xyes &&
2533 test x"$ac_has_wctype_h" = xyes; then
2534 AC_TRY_COMPILE([#include <wchar.h>
2595 ],[],[], [enable_wchar_t=no])
2603 if test x"$enable_wchar_t" = x"yes"; then
2604 AC_DEFINE(_GLIBCXX_USE_WCHAR_T, 1,
2605 [Define if code specialized for wchar_t should be used.])
2608 AC_MSG_CHECKING([for enabled wchar_t specializations])
2609 AC_MSG_RESULT([$enable_wchar_t])
2614 dnl Check to see if building and using a C++ precompiled header can be done.
2616 dnl --enable-libstdcxx-pch=yes
2617 dnl default, this shows intent to use stdc++.h.gch If it looks like it
2618 dnl may work, after some light-hearted attempts to puzzle out compiler
2619 dnl support, flip bits on in include/Makefile.am
2621 dnl --disable-libstdcxx-pch
2622 dnl turns off attempts to use or build stdc++.h.gch.
2625 dnl glibcxx_PCHFLAGS
2627 AC_DEFUN([GLIBCXX_ENABLE_PCH], [
2628 GLIBCXX_ENABLE(libstdcxx-pch,$1,,[build pre-compiled libstdc++ headers])
2629 if test $enable_libstdcxx_pch = yes; then
2630 AC_CACHE_CHECK([for compiler with PCH support],
2631 [glibcxx_cv_prog_CXX_pch],
2632 [ac_save_CXXFLAGS="$CXXFLAGS"
2633 CXXFLAGS="$CXXFLAGS -Werror -Winvalid-pch -Wno-deprecated"
2636 echo '#include <math.h>' > conftest.h
2637 if $CXX $CXXFLAGS $CPPFLAGS -x c++-header conftest.h \
2638 -o conftest.h.gch 1>&5 2>&1 &&
2639 echo '#error "pch failed"' > conftest.h &&
2640 echo '#include "conftest.h"' > conftest.cc &&
2641 $CXX -c $CXXFLAGS $CPPFLAGS conftest.cc 1>&5 2>&1 ;
2643 glibcxx_cv_prog_CXX_pch=yes
2645 glibcxx_cv_prog_CXX_pch=no
2648 CXXFLAGS=$ac_save_CXXFLAGS
2651 enable_libstdcxx_pch=$glibcxx_cv_prog_CXX_pch
2654 AC_MSG_CHECKING([for enabled PCH])
2655 AC_MSG_RESULT([$enable_libstdcxx_pch])
2657 GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes)
2658 if test $enable_libstdcxx_pch = yes; then
2659 glibcxx_PCHFLAGS="-include bits/stdc++.h"
2663 AC_SUBST(glibcxx_PCHFLAGS)
2668 dnl Check for atomic builtins.
2670 dnl http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#Atomic-Builtins
2672 dnl This checks to see if the host supports the compiler-generated
2673 dnl builtins for atomic operations for various integral sizes. Note, this
2674 dnl is intended to be an all-or-nothing switch, so all the atomic operations
2675 dnl that are used should be checked.
2678 dnl libgomp and libgfortran use a link test, see CHECK_SYNC_FETCH_AND_ADD.
2681 dnl _GLIBCXX_ATOMIC_BUILTINS_1
2682 dnl _GLIBCXX_ATOMIC_BUILTINS_2
2683 dnl _GLIBCXX_ATOMIC_BUILTINS_4
2684 dnl _GLIBCXX_ATOMIC_BUILTINS_8
2686 AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
2689 old_CXXFLAGS="$CXXFLAGS"
2691 # Do link tests if possible, instead asm tests, limited to some platforms
2692 # see discussion in PR target/40134, PR libstdc++/40133 and the thread
2693 # starting at http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00322.html
2694 atomic_builtins_link_tests=no
2695 if test x$gcc_no_link != xyes; then
2696 # Can do link tests. Limit to some tested platforms
2698 *-*-linux* | *-*-uclinux* | *-*-kfreebsd*-gnu | *-*-gnu*)
2699 atomic_builtins_link_tests=yes
2704 if test x$atomic_builtins_link_tests = xyes; then
2708 CXXFLAGS="$CXXFLAGS -fno-exceptions"
2710 AC_MSG_CHECKING([for atomic builtins for bool])
2711 AC_CACHE_VAL(glibcxx_cv_atomic_bool, [
2714 [typedef bool atomic_type;
2717 const atomic_type c3(0);
2718 __sync_fetch_and_add(&c1, c2);
2719 __sync_val_compare_and_swap(&c1, c3, c2);
2720 __sync_lock_test_and_set(&c1, c3);
2721 __sync_lock_release(&c1);
2722 __sync_synchronize();],
2723 [glibcxx_cv_atomic_bool=yes],
2724 [glibcxx_cv_atomic_bool=no])
2726 if test $glibcxx_cv_atomic_bool = yes; then
2727 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
2728 [Define if builtin atomic operations for bool are supported on this host.])
2730 AC_MSG_RESULT($glibcxx_cv_atomic_bool)
2732 AC_MSG_CHECKING([for atomic builtins for short])
2733 AC_CACHE_VAL(glibcxx_cv_atomic_short, [
2736 [typedef short atomic_type;
2739 const atomic_type c3(0);
2740 __sync_fetch_and_add(&c1, c2);
2741 __sync_val_compare_and_swap(&c1, c3, c2);
2742 __sync_lock_test_and_set(&c1, c3);
2743 __sync_lock_release(&c1);
2744 __sync_synchronize();],
2745 [glibcxx_cv_atomic_short=yes],
2746 [glibcxx_cv_atomic_short=no])
2748 if test $glibcxx_cv_atomic_short = yes; then
2749 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
2750 [Define if builtin atomic operations for short are supported on this host.])
2752 AC_MSG_RESULT($glibcxx_cv_atomic_short)
2754 AC_MSG_CHECKING([for atomic builtins for int])
2755 AC_CACHE_VAL(glibcxx_cv_atomic_int, [
2758 [typedef int atomic_type;
2761 const atomic_type c3(0);
2762 __sync_fetch_and_add(&c1, c2);
2763 __sync_val_compare_and_swap(&c1, c3, c2);
2764 __sync_lock_test_and_set(&c1, c3);
2765 __sync_lock_release(&c1);
2766 __sync_synchronize();],
2767 [glibcxx_cv_atomic_int=yes],
2768 [glibcxx_cv_atomic_int=no])
2770 if test $glibcxx_cv_atomic_int = yes; then
2771 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
2772 [Define if builtin atomic operations for int are supported on this host.])
2774 AC_MSG_RESULT($glibcxx_cv_atomic_int)
2776 AC_MSG_CHECKING([for atomic builtins for long long])
2777 AC_CACHE_VAL(glibcxx_cv_atomic_long_long, [
2780 [typedef long long atomic_type;
2783 const atomic_type c3(0);
2784 __sync_fetch_and_add(&c1, c2);
2785 __sync_val_compare_and_swap(&c1, c3, c2);
2786 __sync_lock_test_and_set(&c1, c3);
2787 __sync_lock_release(&c1);
2788 __sync_synchronize();],
2789 [glibcxx_cv_atomic_long_long=yes],
2790 [glibcxx_cv_atomic_long_long=no])
2792 if test $glibcxx_cv_atomic_long_long = yes; then
2793 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
2794 [Define if builtin atomic operations for long long are supported on this host.])
2796 AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
2802 # Compile unoptimized.
2805 # Fake what AC_TRY_COMPILE does.
2807 cat > conftest.$ac_ext << EOF
2808 [#]line __oline__ "configure"
2811 typedef bool atomic_type;
2814 const atomic_type c3(0);
2815 __sync_fetch_and_add(&c1, c2);
2816 __sync_val_compare_and_swap(&c1, c3, c2);
2817 __sync_lock_test_and_set(&c1, c3);
2818 __sync_lock_release(&c1);
2819 __sync_synchronize();
2824 AC_MSG_CHECKING([for atomic builtins for bool])
2825 if AC_TRY_EVAL(ac_compile); then
2826 if grep __sync_ conftest.s >/dev/null 2>&1 ; then
2827 glibcxx_cv_atomic_bool=no
2829 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
2830 [Define if builtin atomic operations for bool are supported on this host.])
2831 glibcxx_cv_atomic_bool=yes
2834 AC_MSG_RESULT($glibcxx_cv_atomic_bool)
2837 cat > conftest.$ac_ext << EOF
2838 [#]line __oline__ "configure"
2841 typedef short atomic_type;
2844 const atomic_type c3(0);
2845 __sync_fetch_and_add(&c1, c2);
2846 __sync_val_compare_and_swap(&c1, c3, c2);
2847 __sync_lock_test_and_set(&c1, c3);
2848 __sync_lock_release(&c1);
2849 __sync_synchronize();
2854 AC_MSG_CHECKING([for atomic builtins for short])
2855 if AC_TRY_EVAL(ac_compile); then
2856 if grep __sync_ conftest.s >/dev/null 2>&1 ; then
2857 glibcxx_cv_atomic_short=no
2859 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
2860 [Define if builtin atomic operations for short are supported on this host.])
2861 glibcxx_cv_atomic_short=yes
2864 AC_MSG_RESULT($glibcxx_cv_atomic_short)
2867 cat > conftest.$ac_ext << EOF
2868 [#]line __oline__ "configure"
2871 // NB: _Atomic_word not necessarily int.
2872 typedef int atomic_type;
2875 const atomic_type c3(0);
2876 __sync_fetch_and_add(&c1, c2);
2877 __sync_val_compare_and_swap(&c1, c3, c2);
2878 __sync_lock_test_and_set(&c1, c3);
2879 __sync_lock_release(&c1);
2880 __sync_synchronize();
2885 AC_MSG_CHECKING([for atomic builtins for int])
2886 if AC_TRY_EVAL(ac_compile); then
2887 if grep __sync_ conftest.s >/dev/null 2>&1 ; then
2888 glibcxx_cv_atomic_int=no
2890 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
2891 [Define if builtin atomic operations for int are supported on this host.])
2892 glibcxx_cv_atomic_int=yes
2895 AC_MSG_RESULT($glibcxx_cv_atomic_int)
2898 cat > conftest.$ac_ext << EOF
2899 [#]line __oline__ "configure"
2902 typedef long long atomic_type;
2905 const atomic_type c3(0);
2906 __sync_fetch_and_add(&c1, c2);
2907 __sync_val_compare_and_swap(&c1, c3, c2);
2908 __sync_lock_test_and_set(&c1, c3);
2909 __sync_lock_release(&c1);
2910 __sync_synchronize();
2915 AC_MSG_CHECKING([for atomic builtins for long long])
2916 if AC_TRY_EVAL(ac_compile); then
2917 if grep __sync_ conftest.s >/dev/null 2>&1 ; then
2918 glibcxx_cv_atomic_long_long=no
2920 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
2921 [Define if builtin atomic operations for long long are supported on this host.])
2922 glibcxx_cv_atomic_long_long=yes
2925 AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
2930 CXXFLAGS="$old_CXXFLAGS"
2933 # Set atomicity_dir to builtins if either of above tests pass.
2934 if test $glibcxx_cv_atomic_int = yes || test $glibcxx_cv_atomic_bool = yes ; then
2935 atomicity_dir=cpu/generic/atomicity_builtins
2938 # If still generic, set to mutex.
2939 if test $atomicity_dir = "cpu/generic" ; then
2940 atomicity_dir=cpu/generic/atomicity_mutex
2941 AC_MSG_WARN([No native atomic operations are provided for this platform.])
2942 if test "x$target_thread_file" = xsingle; then
2943 AC_MSG_WARN([They cannot be faked when thread support is disabled.])
2944 AC_MSG_WARN([Thread-safety of certain classes is not guaranteed.])
2946 AC_MSG_WARN([They will be faked using a mutex.])
2947 AC_MSG_WARN([Performance of certain classes will degrade as a result.])
2955 dnl Check for exception handling support. If an explicit enable/disable
2956 dnl sjlj exceptions is given, we don't have to detect. Otherwise the
2957 dnl target may or may not support call frame exceptions.
2959 dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
2960 dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
2961 dnl Neither one forces an attempt at detection.
2964 dnl _GLIBCXX_SJLJ_EXCEPTIONS if the compiler is configured for it
2966 AC_DEFUN([GLIBCXX_ENABLE_SJLJ_EXCEPTIONS], [
2967 AC_MSG_CHECKING([for exception model to use])
2970 GLIBCXX_ENABLE(sjlj-exceptions,auto,,
2971 [force use of builtin_setjmp for exceptions],
2972 [permit yes|no|auto])
2974 if test $enable_sjlj_exceptions = auto; then
2975 # Botheration. Now we've got to detect the exception model. Link tests
2976 # against libgcc.a are problematic since we've not been given proper -L
2977 # bits for single-tree newlib and libgloss.
2979 # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style.
2980 cat > conftest.$ac_ext << EOF
2981 [#]line __oline__ "configure"
2990 old_CXXFLAGS="$CXXFLAGS"
2992 if AC_TRY_EVAL(ac_compile); then
2993 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
2994 enable_sjlj_exceptions=yes
2995 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
2996 enable_sjlj_exceptions=no
2997 elif grep __cxa_end_cleanup conftest.s >/dev/null 2>&1 ; then
2998 enable_sjlj_exceptions=no
3001 CXXFLAGS="$old_CXXFLAGS"
3005 # This is a tad weird, for hysterical raisins. We have to map
3006 # enable/disable to two different models.
3007 case $enable_sjlj_exceptions in
3009 AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1,
3010 [Define if the compiler is configured for setjmp/longjmp exceptions.])
3011 ac_exception_model_name=sjlj
3014 ac_exception_model_name="call frame"
3017 AC_MSG_ERROR([unable to detect exception model])
3021 AC_MSG_RESULT($ac_exception_model_name)
3026 dnl Allow visibility attributes to be used on namespaces, objects, etc.
3028 dnl --enable-visibility enables attempt to use visibility attributes.
3029 dnl --disable-visibility turns off all use of visibility attributes.
3030 dnl + Usage: GLIBCXX_ENABLE_VISIBILITY[(DEFAULT)]
3031 dnl Where DEFAULT is 'yes'.
3033 AC_DEFUN([GLIBCXX_ENABLE_VISIBILITY], [
3034 GLIBCXX_ENABLE(visibility,$1,,[enables visibility safe usage])
3036 if test x$enable_visibility = xyes ; then
3037 dnl all hail libgfortran
3038 dnl Check whether the target supports hidden visibility.
3039 AC_CACHE_CHECK([whether the target supports hidden visibility],
3040 glibcxx_cv_have_attribute_visibility, [
3041 save_CFLAGS="$CFLAGS"
3042 CFLAGS="$CFLAGS -Werror"
3043 AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
3044 [], glibcxx_cv_have_attribute_visibility=yes,
3045 glibcxx_cv_have_attribute_visibility=no)
3046 CFLAGS="$save_CFLAGS"])
3047 if test $glibcxx_cv_have_attribute_visibility = no; then
3048 enable_visibility=no
3052 GLIBCXX_CONDITIONAL(ENABLE_VISIBILITY, test $enable_visibility = yes)
3053 AC_MSG_NOTICE([visibility supported: $enable_visibility])
3058 dnl Add version tags to symbols in shared library (or not), additionally
3059 dnl marking other symbols as private/local (or not).
3061 dnl Sets libtool_VERSION, and determines shared library SONAME.
3063 dnl This depends on GLIBCXX CHECK_LINKER_FEATURES, but without it assumes no.
3065 dnl --enable-symvers=style adds a version script to the linker call when
3066 dnl creating the shared library. The choice of version script is
3067 dnl controlled by 'style'.
3068 dnl --disable-symvers does not.
3070 dnl + Usage: GLIBCXX_ENABLE_SYMVERS[(DEFAULT)]
3071 dnl Where DEFAULT is either 'yes' or 'no'. Passing `yes' tries to
3072 dnl choose a default style based on linker characteristics. Passing
3073 dnl 'no' disables versioning.
3075 AC_DEFUN([GLIBCXX_ENABLE_SYMVERS], [
3077 GLIBCXX_ENABLE(symvers,$1,[[[=STYLE]]],
3078 [enables symbol versioning of the shared library],
3079 [permit yes|no|gnu|gnu-versioned-namespace|darwin|darwin-export|sun])
3081 # If we never went through the GLIBCXX_CHECK_LINKER_FEATURES macro, then we
3082 # don't know enough about $LD to do tricks...
3083 AC_REQUIRE([GLIBCXX_CHECK_LINKER_FEATURES])
3084 # Sun style symbol versions needs GNU c++filt for make_sunver.pl to work
3085 # with extern "C++" in version scripts.
3086 AC_REQUIRE([GCC_PROG_GNU_CXXFILT])
3088 # Turn a 'yes' into a suitable default.
3089 if test x$enable_symvers = xyes ; then
3090 if test $enable_shared = no || test "x$LD" = x || test x$gcc_no_link = xyes; then
3093 if test $with_gnu_ld = yes ; then
3094 case ${target_os} in
3096 enable_symvers=no ;;
3098 enable_symvers=gnu ;;
3101 case ${target_os} in
3103 enable_symvers=darwin ;;
3104 # Sun symbol versioning exists since Solaris 2.5.
3105 solaris2.[[5-9]]* | solaris2.1[[0-9]]*)
3106 # make_sunver.pl needs GNU c++filt to support extern "C++" in
3107 # version scripts, so disable symbol versioning if none can be
3109 if test -z "$ac_cv_path_CXXFILT"; then
3110 AC_MSG_WARN([=== You have requested Sun symbol versioning, but])
3111 AC_MSG_WARN([=== no GNU c++filt could be found.])
3112 AC_MSG_WARN([=== Symbol versioning will be disabled.])
3119 enable_symvers=no ;;
3125 # Check to see if 'darwin' or 'darwin-export' can win.
3126 if test x$enable_symvers = xdarwin-export ; then
3127 enable_symvers=darwin
3130 # Check if 'sun' was requested on non-Solaris 2 platforms.
3131 if test x$enable_symvers = xsun ; then
3132 case ${target_os} in
3138 AC_MSG_WARN([=== You have requested Sun symbol versioning, but])
3139 AC_MSG_WARN([=== you are not targetting Solaris 2.])
3140 AC_MSG_WARN([=== Symbol versioning will be disabled.])
3146 # Check to see if 'gnu' can win.
3147 if test $enable_symvers = gnu ||
3148 test $enable_symvers = gnu-versioned-namespace ||
3149 test $enable_symvers = sun; then
3150 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
3151 AC_MSG_CHECKING([for shared libgcc])
3152 ac_save_CFLAGS="$CFLAGS"
3154 AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes, glibcxx_shared_libgcc=no)
3155 CFLAGS="$ac_save_CFLAGS"
3156 if test $glibcxx_shared_libgcc = no; then
3157 cat > conftest.c <<EOF
3158 int main (void) { return 0; }
3161 glibcxx_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
3162 -shared -shared-libgcc -o conftest.so \
3163 conftest.c -v 2>&1 >/dev/null \
3164 | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
3166 rm -f conftest.c conftest.so
3167 if test x${glibcxx_libgcc_s_suffix+set} = xset; then
3168 CFLAGS=" -lgcc_s$glibcxx_libgcc_s_suffix"
3169 AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes)
3170 CFLAGS="$ac_save_CFLAGS"
3173 AC_MSG_RESULT($glibcxx_shared_libgcc)
3175 # For GNU ld, we need at least this version. The format is described in
3176 # GLIBCXX_CHECK_LINKER_FEATURES above.
3177 glibcxx_min_gnu_ld_version=21400
3179 # If no shared libgcc, can't win.
3180 if test $glibcxx_shared_libgcc != yes; then
3181 AC_MSG_WARN([=== You have requested GNU symbol versioning, but])
3182 AC_MSG_WARN([=== you are not building a shared libgcc_s.])
3183 AC_MSG_WARN([=== Symbol versioning will be disabled.])
3185 elif test $with_gnu_ld != yes && test $enable_symvers = sun; then
3186 : All interesting versions of Sun ld support sun style symbol versioning.
3187 elif test $with_gnu_ld != yes ; then
3189 AC_MSG_WARN([=== You have requested GNU symbol versioning, but])
3190 AC_MSG_WARN([=== you are not using the GNU linker.])
3191 AC_MSG_WARN([=== Symbol versioning will be disabled.])
3193 elif test $glibcxx_ld_is_gold = yes ; then
3194 : All versions of gold support symbol versioning.
3195 elif test $glibcxx_gnu_ld_version -lt $glibcxx_min_gnu_ld_version ; then
3196 # The right tools, the right setup, but too old. Fallbacks?
3197 AC_MSG_WARN(=== Linker version $glibcxx_gnu_ld_version is too old for)
3198 AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
3199 AC_MSG_WARN(=== You would need to upgrade your binutils to version)
3200 AC_MSG_WARN(=== $glibcxx_min_gnu_ld_version or later and rebuild GCC.)
3201 AC_MSG_WARN([=== Symbol versioning will be disabled.])
3206 # For libtool versioning info, format is CURRENT:REVISION:AGE
3207 libtool_VERSION=6:17:0
3209 # Everything parsed; figure out what files and settings to use.
3210 case $enable_symvers in
3212 SYMVER_FILE=config/abi/pre/none.ver
3215 SYMVER_FILE=config/abi/pre/gnu.ver
3216 AC_DEFINE(_GLIBCXX_SYMVER_GNU, 1,
3217 [Define to use GNU versioning in the shared library.])
3219 gnu-versioned-namespace)
3220 libtool_VERSION=7:0:0
3221 SYMVER_FILE=config/abi/pre/gnu-versioned-namespace.ver
3222 AC_DEFINE(_GLIBCXX_SYMVER_GNU_NAMESPACE, 1,
3223 [Define to use GNU namespace versioning in the shared library.])
3226 SYMVER_FILE=config/abi/pre/gnu.ver
3227 AC_DEFINE(_GLIBCXX_SYMVER_DARWIN, 1,
3228 [Define to use darwin versioning in the shared library.])
3231 SYMVER_FILE=config/abi/pre/gnu.ver
3232 AC_DEFINE(_GLIBCXX_SYMVER_SUN, 1,
3233 [Define to use Sun versioning in the shared library.])
3237 if test x$enable_symvers != xno ; then
3238 AC_DEFINE(_GLIBCXX_SYMVER, 1,
3239 [Define to use symbol versioning in the shared library.])
3242 AC_CACHE_CHECK([whether the target supports .symver directive],
3243 glibcxx_cv_have_as_symver_directive, [
3244 AC_TRY_COMPILE([void foo (void); __asm (".symver foo, bar@SYMVER");],
3245 [], glibcxx_cv_have_as_symver_directive=yes,
3246 glibcxx_cv_have_as_symver_directive=no)])
3247 if test $glibcxx_cv_have_as_symver_directive = yes; then
3248 AC_DEFINE(HAVE_AS_SYMVER_DIRECTIVE, 1,
3249 [Define to 1 if the target assembler supports .symver directive.])
3252 AC_SUBST(SYMVER_FILE)
3253 AC_SUBST(port_specific_symbol_files)
3254 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS, test $enable_symvers != no)
3255 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU, test $enable_symvers = gnu)
3256 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU_NAMESPACE, test $enable_symvers = gnu-versioned-namespace)
3257 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_DARWIN, test $enable_symvers = darwin)
3258 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_SUN, test $enable_symvers = sun)
3259 AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
3261 if test $enable_symvers != no ; then
3262 case ${target_os} in
3263 # The Solaris 2 runtime linker doesn't support the GNU extension of
3264 # binding the same symbol to different versions
3266 symvers_renaming=no ;;
3267 # Other platforms with GNU symbol versioning (GNU/Linux, more?) do.
3269 AC_DEFINE(HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT, 1,
3270 [Define to 1 if the target runtime linker supports binding the same symbol to different versions.])
3271 symvers_renaming=yes ;;
3276 GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_SOL2, test $symvers_renaming = no)
3278 # Now, set up compatibility support, if any.
3279 # In addition, need this to deal with std::size_t mangling in
3280 # src/compatibility.cc. In a perfect world, could use
3281 # typeid(std::size_t).name()[0] to do direct substitution.
3282 AC_MSG_CHECKING([for size_t as unsigned int])
3283 ac_save_CFLAGS="$CFLAGS"
3285 AC_TRY_COMPILE(, [__SIZE_TYPE__* stp; unsigned int* uip; stp = uip;],
3286 [glibcxx_size_t_is_i=yes], [glibcxx_size_t_is_i=no])
3287 CFLAGS=$ac_save_CFLAGS
3288 if test "$glibcxx_size_t_is_i" = yes; then
3289 AC_DEFINE(_GLIBCXX_SIZE_T_IS_UINT, 1, [Define if size_t is unsigned int.])
3291 AC_MSG_RESULT([$glibcxx_size_t_is_i])
3293 AC_MSG_CHECKING([for ptrdiff_t as int])
3294 ac_save_CFLAGS="$CFLAGS"
3296 AC_TRY_COMPILE(, [__PTRDIFF_TYPE__* ptp; int* ip; ptp = ip;],
3297 [glibcxx_ptrdiff_t_is_i=yes], [glibcxx_ptrdiff_t_is_i=no])
3298 CFLAGS=$ac_save_CFLAGS
3299 if test "$glibcxx_ptrdiff_t_is_i" = yes; then
3300 AC_DEFINE(_GLIBCXX_PTRDIFF_T_IS_INT, 1, [Define if ptrdiff_t is int.])
3302 AC_MSG_RESULT([$glibcxx_ptrdiff_t_is_i])
3307 dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
3308 dnl We must stage the required headers so that they will be installed
3309 dnl with the library (unlike libgcc, the STL implementation is provided
3310 dnl solely within headers). Since we must not inject random user-space
3311 dnl macro names into user-provided C++ code, we first stage into <file>-in
3312 dnl and process to <file> with an output command. The reason for a two-
3313 dnl stage process here is to correctly handle $srcdir!=$objdir without
3314 dnl having to write complex code (the sed commands to clean the macro
3315 dnl namespace are complex and fragile enough as it is). We must also
3316 dnl add a relative path so that -I- is supported properly.
3319 dnl glibcxx_thread_h
3322 dnl HAVE_GTHR_DEFAULT
3324 AC_DEFUN([GLIBCXX_ENABLE_THREADS], [
3325 AC_MSG_CHECKING([for thread model used by GCC])
3326 target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
3327 AC_MSG_RESULT([$target_thread_file])
3329 if test $target_thread_file != single; then
3330 AC_DEFINE(HAVE_GTHR_DEFAULT, 1,
3331 [Define if gthr-default.h exists
3332 (meaning that threading support is enabled).])
3335 glibcxx_thread_h=gthr-$target_thread_file.h
3337 dnl Check for __GTHREADS define.
3338 gthread_file=${toplevel_srcdir}/gcc/${glibcxx_thread_h}
3339 if grep __GTHREADS $gthread_file >/dev/null 2>&1 ; then
3345 AC_SUBST(glibcxx_thread_h)
3350 dnl Check if gthread implementation defines the types and functions
3351 dnl required by the c++0x thread library. Conforming gthread
3352 dnl implementations can define __GTHREADS_CXX0X to enable use with c++0x.
3354 AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
3358 ac_save_CXXFLAGS="$CXXFLAGS"
3359 CXXFLAGS="$CXXFLAGS -fno-exceptions -I${toplevel_srcdir}/gcc"
3361 AC_MSG_CHECKING([check whether it can be safely assumed that mutex_timedlock is available])
3363 AC_TRY_COMPILE([#include <unistd.h>],
3365 #if !defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS < 0
3368 ], [ac_gthread_use_mutex_timedlock=1], [ac_gthread_use_mutex_timedlock=0])
3370 AC_DEFINE_UNQUOTED(_GTHREAD_USE_MUTEX_TIMEDLOCK, $ac_gthread_use_mutex_timedlock,
3371 [Define to 1 if mutex_timedlock is available.])
3373 if test $ac_gthread_use_mutex_timedlock = 1 ; then res_mutex_timedlock=yes ;
3374 else res_mutex_timedlock=no ; fi
3375 AC_MSG_RESULT([$res_mutex_timedlock])
3377 target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
3378 case $target_thread_file in
3380 CXXFLAGS="$CXXFLAGS -DSUPPORTS_WEAK -DGTHREAD_USE_WEAK -D_PTHREADS"
3383 AC_MSG_CHECKING([for gthreads library])
3390 #ifndef __GTHREADS_CXX0X
3394 // In case of POSIX threads check _POSIX_TIMEOUTS too.
3395 #if (defined(_PTHREADS) \
3396 && (!defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS <= 0))
3399 ], [ac_has_gthreads=yes], [ac_has_gthreads=no])
3401 AC_MSG_RESULT([$ac_has_gthreads])
3403 if test x"$ac_has_gthreads" = x"yes"; then
3404 AC_DEFINE(_GLIBCXX_HAS_GTHREADS, 1,
3405 [Define if gthreads library is available.])
3408 CXXFLAGS="$ac_save_CXXFLAGS"
3413 # Check whether LC_MESSAGES is available in <locale.h>.
3414 # Ulrich Drepper <drepper@cygnus.com>, 1995.
3416 # This file file be copied and used freely without restrictions. It can
3417 # be used in projects which are not available under the GNU Public License
3418 # but which still want to provide support for the GNU gettext functionality.
3419 # Please note that the actual code is *not* freely available.
3420 AC_DEFUN([AC_LC_MESSAGES], [
3421 AC_CHECK_HEADER(locale.h, [
3422 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
3423 [AC_TRY_COMPILE([#include <locale.h>], [return LC_MESSAGES],
3424 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
3425 if test $ac_cv_val_LC_MESSAGES = yes; then
3426 AC_DEFINE(HAVE_LC_MESSAGES, 1,
3427 [Define if LC_MESSAGES is available in <locale.h>.])
3433 dnl Check whether get_nprocs is available in <sys/sysinfo.h>, and define _GLIBCXX_USE_GET_NPROCS.
3435 AC_DEFUN([GLIBCXX_CHECK_GET_NPROCS], [
3439 ac_save_CXXFLAGS="$CXXFLAGS"
3440 CXXFLAGS="$CXXFLAGS -fno-exceptions"
3442 AC_MSG_CHECKING([for get_nprocs])
3443 AC_CACHE_VAL(glibcxx_cv_GET_NPROCS, [
3444 GCC_TRY_COMPILE_OR_LINK(
3445 [#include <sys/sysinfo.h>],
3446 [int n = get_nprocs();],
3447 [glibcxx_cv_GET_NPROCS=yes],
3448 [glibcxx_cv_GET_NPROCS=no])
3450 if test $glibcxx_cv_GET_NPROCS = yes; then
3451 AC_DEFINE(_GLIBCXX_USE_GET_NPROCS, 1, [Define if get_nprocs is available in <sys/sysinfo.h>.])
3453 AC_MSG_RESULT($glibcxx_cv_GET_NPROCS)
3455 CXXFLAGS="$ac_save_CXXFLAGS"
3460 dnl Check whether sysconf(_SC_NPROCESSORS_ONLN) is available in <unistd.h>, and define _GLIBCXX_USE_SC_NPROCESSORS_ONLN.
3462 AC_DEFUN([GLIBCXX_CHECK_SC_NPROCESSORS_ONLN], [
3466 ac_save_CXXFLAGS="$CXXFLAGS"
3467 CXXFLAGS="$CXXFLAGS -fno-exceptions"
3469 AC_MSG_CHECKING([for _SC_NPROCESSORS_ONLN])
3470 AC_CACHE_VAL(glibcxx_cv_SC_NPROCESSORS_ONLN, [
3471 GCC_TRY_COMPILE_OR_LINK(
3472 [#include <unistd.h>],
3473 [int n = sysconf(_SC_NPROCESSORS_ONLN);],
3474 [glibcxx_cv_SC_NPROCESSORS_ONLN=yes],
3475 [glibcxx_cv_SC_NPROCESSORS_ONLN=no])
3477 if test $glibcxx_cv_SC_NPROCESSORS_ONLN = yes; then
3478 AC_DEFINE(_GLIBCXX_USE_SC_NPROCESSORS_ONLN, 1, [Define if _SC_NPROCESSORS_ONLN is available in <unistd.h>.])
3480 AC_MSG_RESULT($glibcxx_cv_SC_NPROCESSORS_ONLN)
3482 CXXFLAGS="$ac_save_CXXFLAGS"
3487 # Macros from the top-level gcc directory.
3488 m4_include([../config/gc++filt.m4])
3489 m4_include([../config/tls.m4])