re PR libstdc++/55631 (Several ext/ headers can not be #included on their own)
[platform/upstream/gcc.git] / libstdc++-v3 / acinclude.m4
index 61fdb42..281ee7e 100644 (file)
@@ -169,6 +169,32 @@ AC_DEFUN([GLIBCXX_CHECK_COMPILER_FEATURES], [
 
 
 dnl
 
 
 dnl
+dnl Check if the assembler used supports disabling generation of hardware
+dnl capabilities.  This is only supported by Sun as at the moment.
+dnl
+dnl Defines:
+dnl  HWCAP_FLAGS='-Wa,-nH' if possible.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_ASSEMBLER_HWCAP], [
+  test -z "$HWCAP_FLAGS" && HWCAP_FLAGS=''
+
+  ac_save_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS -Wa,-nH"
+
+  AC_MSG_CHECKING([for as that supports -Wa,-nH])
+  AC_TRY_COMPILE([], [return 0;], [ac_hwcap_flags=yes],[ac_hwcap_flags=no])
+  if test "$ac_hwcap_flags" = "yes"; then
+    HWCAP_FLAGS="-Wa,-nH $HWCAP_FLAGS"
+  fi
+  AC_MSG_RESULT($ac_hwcap_flags)
+
+  CFLAGS="$ac_save_CFLAGS"
+
+  AC_SUBST(HWCAP_FLAGS)
+])
+
+
+dnl
 dnl If GNU ld is in use, check to see if tricky linker opts can be used.  If
 dnl the native linker is in use, all variables will be defined to something
 dnl safe (like an empty string).
 dnl If GNU ld is in use, check to see if tricky linker opts can be used.  If
 dnl the native linker is in use, all variables will be defined to something
 dnl safe (like an empty string).
@@ -660,6 +686,10 @@ if test x"$glibcxx_stylesheets" = x"yes"; then
     glibcxx_local_stylesheets=yes
     XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns
   fi
     glibcxx_local_stylesheets=yes
     XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns
   fi
+  if test -d /usr/share/xml/docbook/stylesheet/nwalsh5/current; then
+    glibcxx_local_stylesheets=yes
+    XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/nwalsh5/current
+  fi
 fi
 AC_MSG_RESULT($glibcxx_local_stylesheets)
 
 fi
 AC_MSG_RESULT($glibcxx_local_stylesheets)
 
@@ -729,7 +759,7 @@ AC_DEFUN([GLIBCXX_EXPORT_FLAGS], [
   # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
   AC_SUBST(OPTIMIZE_CXXFLAGS)
 
   # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
   AC_SUBST(OPTIMIZE_CXXFLAGS)
 
-  WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
+  WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi'
   AC_SUBST(WARN_FLAGS)
 ])
 
   AC_SUBST(WARN_FLAGS)
 ])
 
@@ -1115,16 +1145,16 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [
 
 dnl
 dnl Check for clock_gettime, nanosleep and sched_yield, used in the
 
 dnl
 dnl Check for clock_gettime, nanosleep and sched_yield, used in the
-dnl implementation of 20.8.5 [time.clock], and 30.2.2 [thread.thread.this]
-dnl in the current C++0x working draft.
+dnl implementation of 20.11.7 [time.clock], and 30.3.2 [thread.thread.this]
+dnl in the C++11 standard.
 dnl
 dnl --enable-libstdcxx-time
 dnl --enable-libstdcxx-time=yes
 dnl        checks for the availability of monotonic and realtime clocks,
 dnl
 dnl --enable-libstdcxx-time
 dnl --enable-libstdcxx-time=yes
 dnl        checks for the availability of monotonic and realtime clocks,
-dnl        nanosleep and sched_yield in libc and libposix4 and, in case, links
-dnl       the latter
+dnl        nanosleep and sched_yield in libc and libposix4 and, if needed,
+dnl        links in the latter.
 dnl --enable-libstdcxx-time=rt
 dnl --enable-libstdcxx-time=rt
-dnl        also searches (and, in case, links) librt.  Note that this is
+dnl        also searches (and, if needed, links) librt.  Note that this is
 dnl        not always desirable because, in glibc, for example, in turn it
 dnl        triggers the linking of libpthread too, which activates locking,
 dnl        a large overhead for single-thread programs.
 dnl        not always desirable because, in glibc, for example, in turn it
 dnl        triggers the linking of libpthread too, which activates locking,
 dnl        a large overhead for single-thread programs.
@@ -1132,6 +1162,11 @@ dnl --enable-libstdcxx-time=no
 dnl --disable-libstdcxx-time
 dnl        disables the checks completely
 dnl
 dnl --disable-libstdcxx-time
 dnl        disables the checks completely
 dnl
+dnl N.B. Darwin provides nanosleep but doesn't support the whole POSIX
+dnl Timers option, so doesn't define _POSIX_TIMERS. Because the test
+dnl below fails Darwin unconditionally defines _GLIBCXX_USE_NANOSLEEP in
+dnl os_defines.h and also defines _GLIBCXX_USE_SCHED_YIELD.
+dnl
 AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
 
   AC_MSG_CHECKING([for clock_gettime, nanosleep and sched_yield])
 AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
 
   AC_MSG_CHECKING([for clock_gettime, nanosleep and sched_yield])
@@ -1246,6 +1281,24 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
   if test x"$ac_has_nanosleep" = x"yes"; then
     AC_DEFINE(_GLIBCXX_USE_NANOSLEEP, 1,
       [ Defined if nanosleep is available. ])
   if test x"$ac_has_nanosleep" = x"yes"; then
     AC_DEFINE(_GLIBCXX_USE_NANOSLEEP, 1,
       [ Defined if nanosleep is available. ])
+  else
+      AC_MSG_CHECKING([for sleep])
+      AC_TRY_COMPILE([#include <unistd.h>],
+                     [sleep(1)],
+                     [ac_has_sleep=yes],[ac_has_sleep=no])
+      if test x"$ac_has_sleep" = x"yes"; then
+        AC_DEFINE(HAVE_SLEEP,1, [Defined if sleep exists.])
+      fi
+      AC_MSG_RESULT($ac_has_sleep)
+      AC_MSG_CHECKING([for usleep])
+      AC_TRY_COMPILE([#include <unistd.h>],
+                     [sleep(1);
+                      usleep(100);],
+                     [ac_has_usleep=yes],[ac_has_usleep=no])
+      if test x"$ac_has_usleep" = x"yes"; then
+        AC_DEFINE(HAVE_USLEEP,1, [Defined if usleep exists.])
+      fi
+      AC_MSG_RESULT($ac_has_usleep)
   fi
 
   AC_SUBST(GLIBCXX_LIBS)
   fi
 
   AC_SUBST(GLIBCXX_LIBS)
@@ -1256,8 +1309,8 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
 ])
 
 dnl
 ])
 
 dnl
-dnl Check for gettimeofday, used in the implementation of 20.8.5
-dnl [time.clock] in the current C++0x working draft.
+dnl Check for gettimeofday, used in the implementation of 20.11.7
+dnl [time.clock] in the C++11 standard.
 dnl
 AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [
 
 dnl
 AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [
 
@@ -1715,95 +1768,30 @@ AC_DEFUN([GLIBCXX_COMPUTE_STDIO_INTEGER_CONSTANTS], [
 ])
 
 dnl
 ])
 
 dnl
-dnl Check whether required C++ overloads are present in <math.h>.
-dnl
-
-AC_DEFUN([GLIBCXX_CHECK_MATH_PROTO], [
-
-  AC_LANG_SAVE
-  AC_LANG_CPLUSPLUS
-
-  case "$host" in
-    *-*-solaris2.*)
-      # Solaris 8 FCS only had an overload for double std::abs(double) in
-      # <iso/math_iso.h>.  Patches 111721-04 (SPARC) and 112757-01 (x86)
-      # introduced the full set also found from Solaris 9 onwards.
-      AC_MSG_CHECKING([for float std::abs(float) overload])
-      AC_CACHE_VAL(glibcxx_cv_abs_float, [
-       AC_COMPILE_IFELSE([AC_LANG_SOURCE(
-         [#include <math.h>
-          namespace std {
-            inline float abs(float __x)
-            {  return __builtin_fabsf(__x); }
-          }
-       ])],
-       [glibcxx_cv_abs_float=no],
-       [glibcxx_cv_abs_float=yes]
-      )])
-
-      # autoheader cannot handle indented templates.
-      AH_VERBATIM([__CORRECT_ISO_CPP_MATH_H_PROTO1],
-       [/* Define if all C++ overloads are available in <math.h>.  */
-#if __cplusplus >= 199711L
-#undef __CORRECT_ISO_CPP_MATH_H_PROTO1
-#endif])
-      AH_VERBATIM([__CORRECT_ISO_CPP_MATH_H_PROTO2],
-       [/* Define if only double std::abs(double) is available in <math.h>.  */
-#if __cplusplus >= 199711L
-#undef __CORRECT_ISO_CPP_MATH_H_PROTO2
-#endif])
-
-      if test $glibcxx_cv_abs_float = yes; then
-       AC_DEFINE(__CORRECT_ISO_CPP_MATH_H_PROTO1)
-      else
-       AC_DEFINE(__CORRECT_ISO_CPP_MATH_H_PROTO2)
-      fi
-      AC_MSG_RESULT($glibcxx_cv_abs_float)
-      ;;
-  esac
-
-  AC_LANG_RESTORE
-])
-
-dnl
-dnl Check whether required C++ overloads are present in <stdlib.h>.
+dnl Check whether required C++ overloads are present in <stdio.h>.
 dnl
 dnl
-
-AC_DEFUN([GLIBCXX_CHECK_STDLIB_PROTO], [
+AC_DEFUN([GLIBCXX_CHECK_STDIO_PROTO], [
 
   AC_LANG_SAVE
   AC_LANG_CPLUSPLUS
 
 
   AC_LANG_SAVE
   AC_LANG_CPLUSPLUS
 
-  case "$host" in
-    *-*-solaris2.*)
-      # Solaris 8 FCS lacked the overloads for long std::abs(long) and
-      # ldiv_t std::div(long, long) in <iso/stdlib_iso.h>.  Patches 109607-02
-      # (SPARC) and 109608-02 (x86) introduced them.
-      AC_MSG_CHECKING([for long std::abs(long) overload])
-      AC_CACHE_VAL(glibcxx_cv_abs_long, [
-       AC_COMPILE_IFELSE([AC_LANG_SOURCE(
-         [#include <stdlib.h>
-          namespace std {
-            inline long
-            abs(long __i) { return labs(__i); }
+  AC_MSG_CHECKING([for gets declaration])
+  AC_CACHE_VAL(glibcxx_cv_gets, [
+  AC_COMPILE_IFELSE([AC_LANG_SOURCE(
+         [#include <stdio.h>
+          namespace test 
+          {
+              using ::gets;
           }
        ])],
           }
        ])],
-       [glibcxx_cv_abs_long=no],
-       [glibcxx_cv_abs_long=yes]
+       [glibcxx_cv_gets=yes],
+       [glibcxx_cv_gets=no]
       )])
 
       )])
 
-      # autoheader cannot handle indented templates.
-      AH_VERBATIM([__CORRECT_ISO_CPP_STDLIB_H_PROTO],
-       [/* Define if all C++ overloads are available in <stdlib.h>.  */
-#if __cplusplus >= 199711L
-#undef __CORRECT_ISO_CPP_STDLIB_H_PROTO
-#endif])
-      if test $glibcxx_cv_abs_long = yes; then
-       AC_DEFINE(__CORRECT_ISO_CPP_STDLIB_H_PROTO, 1)
-      fi
-      AC_MSG_RESULT($glibcxx_cv_abs_long)
-      ;;
-  esac
+  if test $glibcxx_cv_gets = yes; then
+    AC_DEFINE(HAVE_GETS, 1, [Define if gets is available in <stdio.h>.])
+  fi
+  AC_MSG_RESULT($glibcxx_cv_gets)
 
   AC_LANG_RESTORE
 ])
 
   AC_LANG_RESTORE
 ])
@@ -1901,6 +1889,9 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
       darwin* | freebsd*)
        enable_clocale_flag=darwin
        ;;
       darwin* | freebsd*)
        enable_clocale_flag=darwin
        ;;
+      openbsd*)
+       enable_clocale_flag=newlib
+       ;;
       *)
        if test x"$with_newlib" = x"yes"; then
          enable_clocale_flag=newlib
       *)
        if test x"$with_newlib" = x"yes"; then
          enable_clocale_flag=newlib
@@ -2212,7 +2203,6 @@ AC_DEFUN([GLIBCXX_ENABLE_PARALLEL], [
 
   AC_MSG_CHECKING([for parallel mode support])
   AC_MSG_RESULT([$enable_parallel])
 
   AC_MSG_CHECKING([for parallel mode support])
   AC_MSG_RESULT([$enable_parallel])
-  GLIBCXX_CONDITIONAL(ENABLE_PARALLEL, test $enable_parallel = yes)
 ])
 
 
 ])
 
 
@@ -2382,6 +2372,31 @@ AC_DEFUN([GLIBCXX_ENABLE_HOSTED], [
 
 
 dnl
 
 
 dnl
+dnl Check if the user wants a non-verbose library implementation.
+dnl
+dnl --disable-libstdcxx-verbose will turn off descriptive messages to
+dnl standard error on termination.
+dnl
+dnl Defines:
+dnl  _GLIBCXX_VERBOSE (always defined, either to 1 or 0)
+dnl
+AC_DEFUN([GLIBCXX_ENABLE_VERBOSE], [
+  AC_ARG_ENABLE([libstdcxx-verbose],
+    AC_HELP_STRING([--disable-libstdcxx-verbose],
+                  [disable termination messages to standard error]),,
+                  [enable_libstdcxx_verbose=yes])
+  if test x"$enable_libstdcxx_verbose" = xyes; then
+    verbose_define=1
+  else
+    AC_MSG_NOTICE([verbose termination messages are disabled])
+    verbose_define=0
+  fi
+  AC_DEFINE_UNQUOTED(_GLIBCXX_VERBOSE, $verbose_define,
+    [Define to 1 if a verbose library is built, or 0 otherwise.])
+])
+
+
+dnl
 dnl Check for template specializations for the 'long long' type.
 dnl The result determines only whether 'long long' I/O is enabled; things
 dnl like numeric_limits<> specializations are always available.
 dnl Check for template specializations for the 'long long' type.
 dnl The result determines only whether 'long long' I/O is enabled; things
 dnl like numeric_limits<> specializations are always available.
@@ -2824,7 +2839,7 @@ EOF
 
     AC_MSG_CHECKING([for atomic builtins for bool])
     if AC_TRY_EVAL(ac_compile); then
 
     AC_MSG_CHECKING([for atomic builtins for bool])
     if AC_TRY_EVAL(ac_compile); then
-      if grep __sync_ conftest.s >/dev/null 2>&1 ; then
+      if grep __atomic_ conftest.s >/dev/null 2>&1 ; then
        glibcxx_cv_atomic_bool=no
       else
        glibcxx_cv_atomic_bool=yes
        glibcxx_cv_atomic_bool=no
       else
        glibcxx_cv_atomic_bool=yes
@@ -2853,7 +2868,7 @@ EOF
 
     AC_MSG_CHECKING([for atomic builtins for short])
     if AC_TRY_EVAL(ac_compile); then
 
     AC_MSG_CHECKING([for atomic builtins for short])
     if AC_TRY_EVAL(ac_compile); then
-      if grep __sync_ conftest.s >/dev/null 2>&1 ; then
+      if grep __atomic_ conftest.s >/dev/null 2>&1 ; then
        glibcxx_cv_atomic_short=no
       else
        glibcxx_cv_atomic_short=yes
        glibcxx_cv_atomic_short=no
       else
        glibcxx_cv_atomic_short=yes
@@ -2883,7 +2898,7 @@ EOF
 
     AC_MSG_CHECKING([for atomic builtins for int])
     if AC_TRY_EVAL(ac_compile); then
 
     AC_MSG_CHECKING([for atomic builtins for int])
     if AC_TRY_EVAL(ac_compile); then
-      if grep __sync_ conftest.s >/dev/null 2>&1 ; then
+      if grep __atomic_ conftest.s >/dev/null 2>&1 ; then
        glibcxx_cv_atomic_int=no
       else
        glibcxx_cv_atomic_int=yes
        glibcxx_cv_atomic_int=no
       else
        glibcxx_cv_atomic_int=yes
@@ -2912,7 +2927,7 @@ EOF
 
     AC_MSG_CHECKING([for atomic builtins for long long])
     if AC_TRY_EVAL(ac_compile); then
 
     AC_MSG_CHECKING([for atomic builtins for long long])
     if AC_TRY_EVAL(ac_compile); then
-      if grep __sync_ conftest.s >/dev/null 2>&1 ; then
+      if grep __atomic_ conftest.s >/dev/null 2>&1 ; then
        glibcxx_cv_atomic_long_long=no
       else
        glibcxx_cv_atomic_long_long=yes
        glibcxx_cv_atomic_long_long=no
       else
        glibcxx_cv_atomic_long_long=yes
@@ -2926,11 +2941,10 @@ EOF
   CXXFLAGS="$old_CXXFLAGS"
   AC_LANG_RESTORE
 
   CXXFLAGS="$old_CXXFLAGS"
   AC_LANG_RESTORE
 
-  # Set atomicity_dir to builtins if all of above tests pass.
+  # Set atomicity_dir to builtins if all but the long long test above passes.
   if test $glibcxx_cv_atomic_bool = yes \
      && test $glibcxx_cv_atomic_short = yes \
   if test $glibcxx_cv_atomic_bool = yes \
      && test $glibcxx_cv_atomic_short = yes \
-     && test $glibcxx_cv_atomic_int = yes \
-     && test $glibcxx_cv_atomic_long_long = yes ; then
+     && test $glibcxx_cv_atomic_int = yes; then
     AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS, 1,
     [Define if the compiler supports C++11 atomics.])
     atomicity_dir=cpu/generic/atomicity_builtins
     AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS, 1,
     [Define if the compiler supports C++11 atomics.])
     atomicity_dir=cpu/generic/atomicity_builtins
@@ -3205,7 +3219,7 @@ changequote([,])dnl
 fi
 
 # For libtool versioning info, format is CURRENT:REVISION:AGE
 fi
 
 # For libtool versioning info, format is CURRENT:REVISION:AGE
-libtool_VERSION=6:17:0
+libtool_VERSION=6:18:0
 
 # Everything parsed; figure out what files and settings to use.
 case $enable_symvers in
 
 # Everything parsed; figure out what files and settings to use.
 case $enable_symvers in
@@ -3264,17 +3278,14 @@ if test $enable_symvers != no ; then
      # The Solaris 2 runtime linker doesn't support the GNU extension of
      # binding the same symbol to different versions
      solaris2*)
      # The Solaris 2 runtime linker doesn't support the GNU extension of
      # binding the same symbol to different versions
      solaris2*)
-       symvers_renaming=no  ;;
+       ;;
      # Other platforms with GNU symbol versioning (GNU/Linux, more?) do.
      *)
        AC_DEFINE(HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT, 1,
         [Define to 1 if the target runtime linker supports binding the same symbol to different versions.])
      # Other platforms with GNU symbol versioning (GNU/Linux, more?) do.
      *)
        AC_DEFINE(HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT, 1,
         [Define to 1 if the target runtime linker supports binding the same symbol to different versions.])
-       symvers_renaming=yes  ;;
+       ;;
     esac
     esac
-else
-    symvers_renaming=no
 fi
 fi
-GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_SOL2, test $symvers_renaming = no)
 
 # Now, set up compatibility support, if any.
 # In addition, need this to deal with std::size_t mangling in
 
 # Now, set up compatibility support, if any.
 # In addition, need this to deal with std::size_t mangling in
@@ -3316,10 +3327,14 @@ dnl having to write complex code (the sed commands to clean the macro
 dnl namespace are complex and fragile enough as it is).  We must also
 dnl add a relative path so that -I- is supported properly.
 dnl
 dnl namespace are complex and fragile enough as it is).  We must also
 dnl add a relative path so that -I- is supported properly.
 dnl
+dnl Substs:
+dnl  thread_header
+dnl
 AC_DEFUN([GLIBCXX_ENABLE_THREADS], [
   AC_MSG_CHECKING([for thread model used by GCC])
   target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
   AC_MSG_RESULT([$target_thread_file])
 AC_DEFUN([GLIBCXX_ENABLE_THREADS], [
   AC_MSG_CHECKING([for thread model used by GCC])
   target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
   AC_MSG_RESULT([$target_thread_file])
+  GCC_AC_THREAD_HEADER([$target_thread_file])
 ])
 
 
 ])
 
 
@@ -3328,7 +3343,14 @@ dnl Check if gthread implementation defines the types and functions
 dnl required by the c++0x thread library.  Conforming gthread
 dnl implementations can define __GTHREADS_CXX0X to enable use with c++0x.
 dnl
 dnl required by the c++0x thread library.  Conforming gthread
 dnl implementations can define __GTHREADS_CXX0X to enable use with c++0x.
 dnl
+dnl GLIBCXX_ENABLE_SYMVERS must be done before this.
+dnl
 AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
 AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
+  GLIBCXX_ENABLE(libstdcxx-threads,auto,,[enable C++11 threads support])
+
+  if test x$enable_libstdcxx_threads = xauto || 
+     test x$enable_libstdcxx_threads = xyes; then
+
   AC_LANG_SAVE
   AC_LANG_CPLUSPLUS
 
   AC_LANG_SAVE
   AC_LANG_CPLUSPLUS
 
@@ -3367,7 +3389,28 @@ AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
       #ifndef __GTHREADS_CXX0X
       #error
       #endif
       #ifndef __GTHREADS_CXX0X
       #error
       #endif
-    ], [ac_has_gthreads=yes], [ac_has_gthreads=no])
+    ], [case $target_os in
+         # gthreads support breaks symbol versioning on Solaris 9 (PR
+         # libstdc++/52189).
+          solaris2.9*)
+           if test x$enable_symvers = xno; then
+             ac_has_gthreads=yes
+           elif test x$enable_libstdcxx_threads = xyes; then
+             AC_MSG_WARN([You have requested C++11 threads support, but])
+             AC_MSG_WARN([this breaks symbol versioning.])
+             ac_has_gthreads=yes
+           else
+             ac_has_gthreads=no
+           fi
+           ;;
+         *)
+           ac_has_gthreads=yes
+           ;;
+        esac],
+       [ac_has_gthreads=no])
+  else
+    ac_has_gthreads=no
+  fi
 
   AC_MSG_RESULT([$ac_has_gthreads])
 
 
   AC_MSG_RESULT([$ac_has_gthreads])
 
@@ -3401,6 +3444,26 @@ AC_DEFUN([AC_LC_MESSAGES], [
 ])
 
 dnl
 ])
 
 dnl
+dnl Check whether rdrand is supported in the assembler.
+AC_DEFUN([GLIBCXX_CHECK_X86_RDRAND], [
+  AC_MSG_CHECKING([for rdrand support in assembler])
+  AC_CACHE_VAL(ac_cv_x86_rdrand, [
+  ac_cv_x86_rdrand=no
+  case "$target" in
+    i?86-*-* | \
+    x86_64-*-*)
+    AC_TRY_COMPILE(, [asm("rdrand %eax");],
+               [ac_cv_x86_rdrand=yes], [ac_cv_x86_rdrand=no])
+  esac
+  ])
+  if test $ac_cv_x86_rdrand = yes; then
+    AC_DEFINE(_GLIBCXX_X86_RDRAND, 1,
+               [ Defined if as can handle rdrand. ])
+  fi
+  AC_MSG_RESULT($ac_cv_x86_rdrand)
+])
+
+dnl
 dnl Check whether get_nprocs is available in <sys/sysinfo.h>, and define _GLIBCXX_USE_GET_NPROCS.
 dnl
 AC_DEFUN([GLIBCXX_CHECK_GET_NPROCS], [
 dnl Check whether get_nprocs is available in <sys/sysinfo.h>, and define _GLIBCXX_USE_GET_NPROCS.
 dnl
 AC_DEFUN([GLIBCXX_CHECK_GET_NPROCS], [
@@ -3563,7 +3626,19 @@ AC_SUBST(python_mod_dir)
 GLIBCXX_CONDITIONAL(ENABLE_PYTHONDIR, test $python_mod_dir != no)
 ])
 
 GLIBCXX_CONDITIONAL(ENABLE_PYTHONDIR, test $python_mod_dir != no)
 ])
 
+dnl
+dnl Check to see if -Werror is disabled.
+dnl
+dnl --enable-werror/--disable-werror
+AC_DEFUN([GLIBCXX_ENABLE_WERROR], [
+  AC_MSG_CHECKING([for -Werror])
+  GLIBCXX_ENABLE(werror,$1,,[turns on -Werror])
+  AC_MSG_RESULT($enable_werror)
+  GLIBCXX_CONDITIONAL(ENABLE_WERROR, test $enable_werror = yes)
+])
+
 
 # Macros from the top-level gcc directory.
 m4_include([../config/gc++filt.m4])
 m4_include([../config/tls.m4])
 
 # Macros from the top-level gcc directory.
 m4_include([../config/gc++filt.m4])
 m4_include([../config/tls.m4])
+m4_include([../config/gthr.m4])