]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
acinclude.m4 ([GLIBCXX_ENABLE_CLOCK_GETTIME], [...]): Remove.
authorChris Fairles <cfairles@gcc.gnu.org>
Thu, 15 Jan 2009 14:01:04 +0000 (14:01 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 15 Jan 2009 14:01:04 +0000 (14:01 +0000)
2009-01-15  Chris Fairles  <cfairles@gcc.gnu.org>
    Paolo Carlini  <paolo.carlini@oracle.com>

* acinclude.m4 ([GLIBCXX_ENABLE_CLOCK_GETTIME],
[GLIBCXX_CHECK_NANOSLEEP]): Remove.
([GLIBCXX_ENABLE_LIBSTDCXX_TIME]): Add.
* configure.ac: Adjust.
* doc/xml/manual/configure.xml: Update.
* testsuite/lib/libstdc++.exp (check_v3_target_sched_yield): Add.
* testsuite/lib/dg-options.exp (dg-require-sched-yield): Add.
* testsuite/30_threads/thread/this_thread/2.cc: Use the latter.
* configure: Regenerate.
* config.h.in: Likewise.

* src/thread.cc (thread::thread(), thread::~thread, thread::get_id,
thread::joinable, thread::swap, this_thread::get_id,
this_thread::yield): Define inline...
* include/std/thread: ... here.
* config/abi/pre/gnu.ver: Adjust.

Co-Authored-By: Paolo Carlini <paolo.carlini@oracle.com>
From-SVN: r143397

12 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/acinclude.m4
libstdc++-v3/config.h.in
libstdc++-v3/config/abi/pre/gnu.ver
libstdc++-v3/configure
libstdc++-v3/configure.ac
libstdc++-v3/doc/xml/manual/configure.xml
libstdc++-v3/include/std/thread
libstdc++-v3/src/thread.cc
libstdc++-v3/testsuite/30_threads/thread/this_thread/2.cc
libstdc++-v3/testsuite/lib/dg-options.exp
libstdc++-v3/testsuite/lib/libstdc++.exp

index ee72977fd36c0b59a96a6b557a08f758051a3797..bbcb81416db2a7c66a4f782ed67ef058e96f7f79 100644 (file)
@@ -1,3 +1,23 @@
+2009-01-15  Chris Fairles  <cfairles@gcc.gnu.org>
+           Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * acinclude.m4 ([GLIBCXX_ENABLE_CLOCK_GETTIME],
+       [GLIBCXX_CHECK_NANOSLEEP]): Remove.
+       ([GLIBCXX_ENABLE_LIBSTDCXX_TIME]): Add.
+       * configure.ac: Adjust.
+       * doc/xml/manual/configure.xml: Update.
+       * testsuite/lib/libstdc++.exp (check_v3_target_sched_yield): Add.
+       * testsuite/lib/dg-options.exp (dg-require-sched-yield): Add.
+       * testsuite/30_threads/thread/this_thread/2.cc: Use the latter.
+       * configure: Regenerate.
+       * config.h.in: Likewise.
+
+       * src/thread.cc (thread::thread(), thread::~thread, thread::get_id,
+       thread::joinable, thread::swap, this_thread::get_id,
+       this_thread::yield): Define inline...
+       * include/std/thread: ... here.
+       * config/abi/pre/gnu.ver: Adjust.
+
 2009-01-13  Uros Bizjak  <ubizjak@gmail.com>
 
        * testsuite/ext/pb_ds/regression/hash_data_map_rand.cc:
index 71cc7e9bc80d870885344f0284b1c7c0f3c45bd4..4dd2b2b109be32b8bb779630ca172b813c383fc3 100644 (file)
@@ -1074,26 +1074,28 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [
 
 
 dnl
-dnl Check for clock_gettime clocks, used in the implementation of 20.8.5
-dnl [time.clock] in the current C++0x working draft.
-dnl
-dnl --enable-clock-gettime
-dnl --enable-clock-gettime=yes
-dnl        checks for the availability of monotonic and realtime clocks
-dnl        in libc and libposix4 and in case links the latter
-dnl --enable-clock-gettime=rt
+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
+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 --enable-libstdcxx-time=rt
 dnl        also searches (and, in case, 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 --enable-clock-gettime=no
-dnl --disable-clock-gettime
+dnl --enable-libstdcxx-time=no
+dnl --disable-libstdcxx-time
 dnl        disables the checks completely
 dnl
-AC_DEFUN([GLIBCXX_ENABLE_CLOCK_GETTIME], [
+AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
 
-  AC_MSG_CHECKING([for clock_gettime clocks])                                   
-  GLIBCXX_ENABLE(clock-gettime,$1,[=KIND],
+  AC_MSG_CHECKING([for clock_gettime, nanosleep and sched_yield])
+  GLIBCXX_ENABLE(libstdcxx-time,$1,[=KIND],
     [use KIND for check type],
     [permit yes|no|rt])
 
@@ -1103,19 +1105,47 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCK_GETTIME], [
   CXXFLAGS="$CXXFLAGS -fno-exceptions"
   ac_save_LIBS="$LIBS"
 
-  ac_has_clock_monotonic=no;  
+  ac_has_clock_monotonic=no;
   ac_has_clock_realtime=no;
 
-  if test x"$enable_clock_gettime" != x"no"; then
+  if test x"$enable_libstdcxx_time" != x"no"; then
 
-    if test x"$enable_clock_gettime" = x"rt"; then
+    if test x"$enable_libstdcxx_time" = x"rt"; then
       AC_SEARCH_LIBS(clock_gettime, [rt posix4])
+      AC_SEARCH_LIBS(nanosleep, [rt posix4])
     else
       AC_SEARCH_LIBS(clock_gettime, [posix4])
+      AC_SEARCH_LIBS(nanosleep, [posix4])
     fi
 
     case "$ac_cv_search_clock_gettime" in
       -l*) GLIBCXX_LIBS=$ac_cv_search_clock_gettime
+      ;;
+    esac
+    case "$ac_cv_search_nanosleep" in
+      -l*) GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_nanosleep"
+      ;;
+    esac
+
+    AC_SEARCH_LIBS(sched_yield, [rt posix4])
+
+    case "$ac_cv_search_sched_yield" in
+      -lposix4*)
+      GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield"
+      AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
+                [ Defined if sched_yield is available. ])
+      ;;
+      -lrt*)
+      if test x"$enable_libstdcxx_time" = x"rt"; then
+        GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield"
+       AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1, 
+                 [ Defined if sched_yield is available. ])
+      fi
+      ;;
+      *)
+      AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
+                [ Defined if sched_yield is available. ])
+      ;;
     esac
 
     AC_CHECK_HEADERS(unistd.h, ac_has_unistd_h=yes, ac_has_unistd_h=no)
@@ -1146,8 +1176,20 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCK_GETTIME], [
         ], [ac_has_clock_realtime=yes], [ac_has_clock_realtime=no])
 
       AC_MSG_RESULT($ac_has_clock_realtime)
-    fi
 
+      AC_MSG_CHECKING([for nanosleep])
+      AC_TRY_LINK(
+        [#include <unistd.h>
+         #include <time.h>
+        ],
+        [#if _POSIX_TIMERS > 0
+          timespec tp;
+         #endif
+          nanosleep(&tp, 0);
+        ], [ac_has_nanosleep=yes], [ac_has_nanosleep=no])
+
+      AC_MSG_RESULT($ac_has_nanosleep)
+    fi
   fi
 
   if test x"$ac_has_clock_monotonic" = x"yes"; then
@@ -1160,6 +1202,11 @@ AC_DEFUN([GLIBCXX_ENABLE_CLOCK_GETTIME], [
       [ Defined if clock_gettime has realtime clock support. ])
   fi
 
+  if test x"$ac_has_nanosleep" = x"yes"; then
+    AC_DEFINE(_GLIBCXX_USE_NANOSLEEP, 1,
+      [ Defined if nanosleep is available. ])
+  fi
+
   AC_SUBST(GLIBCXX_LIBS)
 
   CXXFLAGS="$ac_save_CXXFLAGS"
@@ -1200,39 +1247,6 @@ AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [
   AC_LANG_RESTORE
 ])
 
-dnl
-dnl Check for nanosleep, used in the implementation of 30.2.2
-dnl [thread.thread.this] in the current C++0x working draft.
-dnl
-AC_DEFUN([GLIBCXX_CHECK_NANOSLEEP], [
-
-  AC_MSG_CHECKING([for nanosleep])
-
-  AC_LANG_SAVE
-  AC_LANG_CPLUSPLUS
-  ac_save_CXXFLAGS="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAGS -fno-exceptions"
-
-  ac_has_nanosleep=no;
-  AC_CHECK_HEADERS(time.h, ac_has_time_h=yes, ac_has_time_h=no)
-  if test x"$ac_has_time_h" = x"yes"; then
-    AC_MSG_CHECKING([for nanosleep])
-    AC_TRY_COMPILE([#include <time.h>],                                                                                                         
-      [timespec ts; nanosleep(&ts, 0);],
-      [ac_has_nanosleep=yes], [ac_has_nanosleep=no])
-
-    AC_MSG_RESULT($ac_has_nanosleep)
-  fi
-
-  if test x"$ac_has_nanosleep" = x"yes"; then
-    AC_DEFINE(_GLIBCXX_USE_NANOSLEEP, 1,
-      [ Defined if nanosleep is available. ])
-  fi
-
-  CXXFLAGS="$ac_save_CXXFLAGS"
-  AC_LANG_RESTORE
-])
-
 dnl
 dnl Check for ISO/IEC 9899:1999 "C99" support to ISO/IEC DTR 19768 "TR1"
 dnl facilities in Chapter 8, "C compatibility".
index 5d63b7fc9238a1a36914630796fad11ec6ab60db..10246a0a1c36531b41784073d9c424cc6aff1cb7 100644 (file)
 /* Define to 1 if you have the <tgmath.h> header file. */
 #undef HAVE_TGMATH_H
 
-/* Define to 1 if you have the <time.h> header file. */
-#undef HAVE_TIME_H
-
 /* Define to 1 if the target supports thread-local storage. */
 #undef HAVE_TLS
 
    of TR1 (Chapter 5.1). */
 #undef _GLIBCXX_USE_RANDOM_TR1
 
+/* Defined if sched_yield is available. */
+#undef _GLIBCXX_USE_SCHED_YIELD
+
 /* Define if code specialized for wchar_t should be used. */
 #undef _GLIBCXX_USE_WCHAR_T
 
index 833435d9330f551889081bc95064e4f4d6cb3346..887ea3f0c88274b488958c5abfba63a6b0c59076 100644 (file)
@@ -901,21 +901,12 @@ GLIBCXX_3.4.11 {
     _ZNSt22condition_variable_anyD2Ev;
 
     # thread
-    _ZNKSt6thread6get_idEv;
-    _ZNKSt6thread8joinableEv;
     _ZNSt10shared_ptrISt18__thread_data_baseED1Ev;
-    _ZNSt11this_thread5yieldEv;
-    _ZNSt11this_thread6get_idEv;
     _ZNSt12bad_weak_ptrD0Ev;
     _ZNSt12bad_weak_ptrD1Ev;
     _ZNSt6thread14__start_threadEv;
     _ZNSt6thread4joinEv;
-    _ZNSt6thread4swapEOS_;
     _ZNSt6thread6detachEv;
-    _ZNSt6threadC1Ev;
-    _ZNSt6threadC2Ev;
-    _ZNSt6threadD1Ev;
-    _ZNSt6threadD2Ev;
 
     # system_error
     _ZSt15system_category;
index 598e207be3da1dbb29cfc1ad5d9745f07dd33faa..714b9b5abc8564fa70477127c781a55695c7086c 100755 (executable)
@@ -1052,7 +1052,7 @@ Optional Features:
   --enable-fully-dynamic-string
                           do not put empty strings in per-process static
                           memory [default=no]
-  --enable-clock-gettime=KIND
+  --enable-libstdcxx-time=KIND
                           use KIND for check type [default=no]
   --enable-tls            Use thread-local storage [default=yes]
   --disable-rpath         do not hardcode runtime library paths
@@ -21711,25 +21711,25 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-# For clock_gettime support.
+# For clock_gettime, nanosleep and sched_yield support.
 # NB: The default is [no], because otherwise it requires linking.
 
 
-  echo "$as_me:$LINENO: checking for clock_gettime clocks" >&5
-echo $ECHO_N "checking for clock_gettime clocks... $ECHO_C" >&6
-   # Check whether --enable-clock-gettime or --disable-clock-gettime was given.
-if test "${enable_clock_gettime+set}" = set; then
-  enableval="$enable_clock_gettime"
+  echo "$as_me:$LINENO: checking for clock_gettime, nanosleep and sched_yield" >&5
+echo $ECHO_N "checking for clock_gettime, nanosleep and sched_yield... $ECHO_C" >&6
+   # Check whether --enable-libstdcxx-time or --disable-libstdcxx-time was given.
+if test "${enable_libstdcxx_time+set}" = set; then
+  enableval="$enable_libstdcxx_time"
 
       case "$enableval" in
        yes|no|rt) ;;
-       *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable clock-gettime" >&5
-echo "$as_me: error: Unknown argument to enable/disable clock-gettime" >&2;}
+       *) { { echo "$as_me:$LINENO: error: Unknown argument to enable/disable libstdcxx-time" >&5
+echo "$as_me: error: Unknown argument to enable/disable libstdcxx-time" >&2;}
    { (exit 1); exit 1; }; } ;;
                           esac
 
 else
-  enable_clock_gettime=no
+  enable_libstdcxx_time=no
 fi;
 
 
@@ -21748,9 +21748,9 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
   ac_has_clock_monotonic=no;
   ac_has_clock_realtime=no;
 
-  if test x"$enable_clock_gettime" != x"no"; then
+  if test x"$enable_libstdcxx_time" != x"no"; then
 
-    if test x"$enable_clock_gettime" = x"rt"; then
+    if test x"$enable_libstdcxx_time" = x"rt"; then
       echo "$as_me:$LINENO: checking for library containing clock_gettime" >&5
 echo $ECHO_N "checking for library containing clock_gettime... $ECHO_C" >&6
 if test "${ac_cv_search_clock_gettime+set}" = set; then
@@ -21887,14 +21887,13 @@ if test "$ac_cv_search_clock_gettime" != no; then
 
 fi
 
-    else
-      echo "$as_me:$LINENO: checking for library containing clock_gettime" >&5
-echo $ECHO_N "checking for library containing clock_gettime... $ECHO_C" >&6
-if test "${ac_cv_search_clock_gettime+set}" = set; then
+      echo "$as_me:$LINENO: checking for library containing nanosleep" >&5
+echo $ECHO_N "checking for library containing nanosleep... $ECHO_C" >&6
+if test "${ac_cv_search_nanosleep+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_func_search_save_LIBS=$LIBS
-ac_cv_search_clock_gettime=no
+ac_cv_search_nanosleep=no
 if test x$gcc_no_link = xyes; then
   { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
 echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
@@ -21913,11 +21912,11 @@ extern "C"
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char clock_gettime ();
+char nanosleep ();
 int
 main ()
 {
-clock_gettime ();
+nanosleep ();
   ;
   return 0;
 }
@@ -21944,7 +21943,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_search_clock_gettime="none required"
+  ac_cv_search_nanosleep="none required"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
@@ -21952,8 +21951,8 @@ sed 's/^/| /' conftest.$ac_ext >&5
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-if test "$ac_cv_search_clock_gettime" = no; then
-  for ac_lib in posix4; do
+if test "$ac_cv_search_nanosleep" = no; then
+  for ac_lib in rt posix4; do
     LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
     if test x$gcc_no_link = xyes; then
   { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
@@ -21973,11 +21972,11 @@ extern "C"
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char clock_gettime ();
+char nanosleep ();
 int
 main ()
 {
-clock_gettime ();
+nanosleep ();
   ;
   return 0;
 }
@@ -22004,7 +22003,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_search_clock_gettime="-l$ac_lib"
+  ac_cv_search_nanosleep="-l$ac_lib"
 break
 else
   echo "$as_me: failed program was:" >&5
@@ -22017,47 +22016,51 @@ rm -f conftest.err conftest.$ac_objext \
 fi
 LIBS=$ac_func_search_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_search_clock_gettime" >&5
-echo "${ECHO_T}$ac_cv_search_clock_gettime" >&6
-if test "$ac_cv_search_clock_gettime" != no; then
-  test "$ac_cv_search_clock_gettime" = "none required" || LIBS="$ac_cv_search_clock_gettime $LIBS"
+echo "$as_me:$LINENO: result: $ac_cv_search_nanosleep" >&5
+echo "${ECHO_T}$ac_cv_search_nanosleep" >&6
+if test "$ac_cv_search_nanosleep" != no; then
+  test "$ac_cv_search_nanosleep" = "none required" || LIBS="$ac_cv_search_nanosleep $LIBS"
 
 fi
 
-    fi
-
-    case "$ac_cv_search_clock_gettime" in
-      -l*) GLIBCXX_LIBS=$ac_cv_search_clock_gettime
-    esac
-
-
-for ac_header in unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+    else
+      echo "$as_me:$LINENO: checking for library containing clock_gettime" >&5
+echo $ECHO_N "checking for library containing clock_gettime... $ECHO_C" >&6
+if test "${ac_cv_search_clock_gettime+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
 else
-  # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_clock_gettime=no
+if test x$gcc_no_link = xyes; then
+  { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+   { (exit 1); exit 1; }; }
+fi
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char clock_gettime ();
+int
+main ()
+{
+clock_gettime ();
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -22071,122 +22074,100 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
+        { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_header_compiler=yes
+  ac_cv_search_clock_gettime="none required"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
-
-# Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_clock_gettime" = no; then
+  for ac_lib in posix4; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    if test x$gcc_no_link = xyes; then
+  { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+   { (exit 1); exit 1; }; }
+fi
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <$ac_header>
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char clock_gettime ();
+int
+main ()
+{
+clock_gettime ();
+  ;
+  return 0;
+}
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_clock_gettime="-l$ac_lib"
+break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-  ac_header_preproc=no
-fi
-rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    (
-      cat <<\_ASBOX
-## ----------------------------------------- ##
-## Report this to the package-unused lists.  ##
-## ----------------------------------------- ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
-
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
 fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
- ac_has_unistd_h=yes
-else
-  ac_has_unistd_h=no
+LIBS=$ac_func_search_save_LIBS
 fi
+echo "$as_me:$LINENO: result: $ac_cv_search_clock_gettime" >&5
+echo "${ECHO_T}$ac_cv_search_clock_gettime" >&6
+if test "$ac_cv_search_clock_gettime" != no; then
+  test "$ac_cv_search_clock_gettime" = "none required" || LIBS="$ac_cv_search_clock_gettime $LIBS"
 
-done
-
+fi
 
-    if test x"$ac_has_unistd_h" = x"yes"; then
-      echo "$as_me:$LINENO: checking for monotonic clock" >&5
-echo $ECHO_N "checking for monotonic clock... $ECHO_C" >&6
-      if test x$gcc_no_link = xyes; then
+      echo "$as_me:$LINENO: checking for library containing nanosleep" >&5
+echo $ECHO_N "checking for library containing nanosleep... $ECHO_C" >&6
+if test "${ac_cv_search_nanosleep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_nanosleep=no
+if test x$gcc_no_link = xyes; then
   { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
 echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
    { (exit 1); exit 1; }; }
@@ -22197,17 +22178,18 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <unistd.h>
-         #include <time.h>
 
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char nanosleep ();
 int
 main ()
 {
-#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
-          timespec tp;
-         #endif
-          clock_gettime(CLOCK_MONOTONIC, &tp);
-
+nanosleep ();
   ;
   return 0;
 }
@@ -22234,22 +22216,18 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_has_clock_monotonic=yes
+  ac_cv_search_nanosleep="none required"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_has_clock_monotonic=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
-
-      echo "$as_me:$LINENO: result: $ac_has_clock_monotonic" >&5
-echo "${ECHO_T}$ac_has_clock_monotonic" >&6
-
-      echo "$as_me:$LINENO: checking for realtime clock" >&5
-echo $ECHO_N "checking for realtime clock... $ECHO_C" >&6
-      if test x$gcc_no_link = xyes; then
+if test "$ac_cv_search_nanosleep" = no; then
+  for ac_lib in posix4; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    if test x$gcc_no_link = xyes; then
   { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
 echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
    { (exit 1); exit 1; }; }
@@ -22260,17 +22238,18 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <unistd.h>
-         #include <time.h>
 
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char nanosleep ();
 int
 main ()
 {
-#if _POSIX_TIMERS > 0
-          timespec tp;
-         #endif
-          clock_gettime(CLOCK_REALTIME, &tp);
-
+nanosleep ();
   ;
   return 0;
 }
@@ -22297,101 +22276,134 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_has_clock_realtime=yes
+  ac_cv_search_nanosleep="-l$ac_lib"
+break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_has_clock_realtime=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_nanosleep" >&5
+echo "${ECHO_T}$ac_cv_search_nanosleep" >&6
+if test "$ac_cv_search_nanosleep" != no; then
+  test "$ac_cv_search_nanosleep" = "none required" || LIBS="$ac_cv_search_nanosleep $LIBS"
 
-      echo "$as_me:$LINENO: result: $ac_has_clock_realtime" >&5
-echo "${ECHO_T}$ac_has_clock_realtime" >&6
-    fi
+fi
 
-  fi
+    fi
 
-  if test x"$ac_has_clock_monotonic" = x"yes"; then
+    case "$ac_cv_search_clock_gettime" in
+      -l*) GLIBCXX_LIBS=$ac_cv_search_clock_gettime
+      ;;
+    esac
+    case "$ac_cv_search_nanosleep" in
+      -l*) GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_nanosleep"
+      ;;
+    esac
 
-cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_USE_CLOCK_MONOTONIC 1
+    echo "$as_me:$LINENO: checking for library containing sched_yield" >&5
+echo $ECHO_N "checking for library containing sched_yield... $ECHO_C" >&6
+if test "${ac_cv_search_sched_yield+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_sched_yield=no
+if test x$gcc_no_link = xyes; then
+  { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
 _ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
 
-  fi
-
-  if test x"$ac_has_clock_realtime" = x"yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_USE_CLOCK_REALTIME 1
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char sched_yield ();
+int
+main ()
+{
+sched_yield ();
+  ;
+  return 0;
+}
 _ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_sched_yield="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
 
-  fi
-
-
-
-  CXXFLAGS="$ac_save_CXXFLAGS"
-  LIBS="$ac_save_LIBS"
-  ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-# For gthread support
-
-
-
-  ac_ext=cc
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-
-  ac_save_CXXFLAGS="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAGS -fno-exceptions -I${toplevel_srcdir}/gcc"
-
-  target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
-  case $target_thread_file in
-    posix)
-      CXXFLAGS="$CXXFLAGS -DSUPPORTS_WEAK -DGTHREAD_USE_WEAK -D_PTHREADS"
-  esac
-
-  echo "$as_me:$LINENO: checking for gthreads library" >&5
-echo $ECHO_N "checking for gthreads library... $ECHO_C" >&6
-
-  cat >conftest.$ac_ext <<_ACEOF
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_sched_yield" = no; then
+  for ac_lib in rt posix4; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    if test x$gcc_no_link = xyes; then
+  { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include "gthr.h"
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char sched_yield ();
 int
 main ()
 {
-
-      #ifndef __GTHREADS_CXX0X
-      #error
-      #endif
-
-      // In case of POSIX threads check _POSIX_TIMEOUTS too.
-      #if (defined(_PTHREADS) \
-           && (!defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS <= 0))
-      #error
-      #endif
-
+sched_yield ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -22405,61 +22417,63 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
+        { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_has_gthreads=yes
+  ac_cv_search_sched_yield="-l$ac_lib"
+break
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_has_gthreads=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_sched_yield" >&5
+echo "${ECHO_T}$ac_cv_search_sched_yield" >&6
+if test "$ac_cv_search_sched_yield" != no; then
+  test "$ac_cv_search_sched_yield" = "none required" || LIBS="$ac_cv_search_sched_yield $LIBS"
 
-  echo "$as_me:$LINENO: result: $ac_has_gthreads" >&5
-echo "${ECHO_T}$ac_has_gthreads" >&6
+fi
 
-  if test x"$ac_has_gthreads" = x"yes"; then
+
+    case "$ac_cv_search_sched_yield" in
+      -lposix4*)
+      GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield"
 
 cat >>confdefs.h <<\_ACEOF
-#define _GLIBCXX_HAS_GTHREADS 1
+#define _GLIBCXX_USE_SCHED_YIELD 1
 _ACEOF
 
-  fi
-
-  CXXFLAGS="$ac_save_CXXFLAGS"
-  ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-# For nanosleep support
-
-
-  echo "$as_me:$LINENO: checking for nanosleep" >&5
-echo $ECHO_N "checking for nanosleep... $ECHO_C" >&6
+      ;;
+      -lrt*)
+      if test x"$enable_libstdcxx_time" = x"rt"; then
+        GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield"
 
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_USE_SCHED_YIELD 1
+_ACEOF
 
+      fi
+      ;;
+      *)
 
-  ac_ext=cc
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_USE_SCHED_YIELD 1
+_ACEOF
 
-  ac_save_CXXFLAGS="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAGS -fno-exceptions"
+      ;;
+    esac
 
-  ac_has_nanosleep=no;
 
-for ac_header in time.h
+for ac_header in unistd.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
 if eval "test \"\${$as_ac_Header+set}\" = set"; then
@@ -22603,34 +22617,172 @@ if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
- ac_has_time_h=yes
+ ac_has_unistd_h=yes
 else
-  ac_has_time_h=no
+  ac_has_unistd_h=no
 fi
 
 done
 
-  if test x"$ac_has_time_h" = x"yes"; then
-    echo "$as_me:$LINENO: checking for nanosleep" >&5
+
+    if test x"$ac_has_unistd_h" = x"yes"; then
+      echo "$as_me:$LINENO: checking for monotonic clock" >&5
+echo $ECHO_N "checking for monotonic clock... $ECHO_C" >&6
+      if test x$gcc_no_link = xyes; then
+  { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <unistd.h>
+         #include <time.h>
+
+int
+main ()
+{
+#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
+          timespec tp;
+         #endif
+          clock_gettime(CLOCK_MONOTONIC, &tp);
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_has_clock_monotonic=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_has_clock_monotonic=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+
+      echo "$as_me:$LINENO: result: $ac_has_clock_monotonic" >&5
+echo "${ECHO_T}$ac_has_clock_monotonic" >&6
+
+      echo "$as_me:$LINENO: checking for realtime clock" >&5
+echo $ECHO_N "checking for realtime clock... $ECHO_C" >&6
+      if test x$gcc_no_link = xyes; then
+  { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <unistd.h>
+         #include <time.h>
+
+int
+main ()
+{
+#if _POSIX_TIMERS > 0
+          timespec tp;
+         #endif
+          clock_gettime(CLOCK_REALTIME, &tp);
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_has_clock_realtime=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_has_clock_realtime=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+
+      echo "$as_me:$LINENO: result: $ac_has_clock_realtime" >&5
+echo "${ECHO_T}$ac_has_clock_realtime" >&6
+
+      echo "$as_me:$LINENO: checking for nanosleep" >&5
 echo $ECHO_N "checking for nanosleep... $ECHO_C" >&6
-    cat >conftest.$ac_ext <<_ACEOF
+      if test x$gcc_no_link = xyes; then
+  { { echo "$as_me:$LINENO: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&5
+echo "$as_me: error: Link tests are not allowed after GCC_NO_EXECUTABLES." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <time.h>
+#include <unistd.h>
+         #include <time.h>
+
 int
 main ()
 {
-timespec ts; nanosleep(&ts, 0);
+#if _POSIX_TIMERS > 0
+          timespec tp;
+         #endif
+          nanosleep(&tp, 0);
+
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -22644,7 +22796,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
+        { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
@@ -22657,10 +22809,28 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
 ac_has_nanosleep=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
 
-    echo "$as_me:$LINENO: result: $ac_has_nanosleep" >&5
+      echo "$as_me:$LINENO: result: $ac_has_nanosleep" >&5
 echo "${ECHO_T}$ac_has_nanosleep" >&6
+    fi
+  fi
+
+  if test x"$ac_has_clock_monotonic" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_USE_CLOCK_MONOTONIC 1
+_ACEOF
+
+  fi
+
+  if test x"$ac_has_clock_realtime" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_USE_CLOCK_REALTIME 1
+_ACEOF
+
   fi
 
   if test x"$ac_has_nanosleep" = x"yes"; then
@@ -22671,6 +22841,108 @@ _ACEOF
 
   fi
 
+
+
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  LIBS="$ac_save_LIBS"
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+# For gthread support
+
+
+
+  ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -fno-exceptions -I${toplevel_srcdir}/gcc"
+
+  target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
+  case $target_thread_file in
+    posix)
+      CXXFLAGS="$CXXFLAGS -DSUPPORTS_WEAK -DGTHREAD_USE_WEAK -D_PTHREADS"
+  esac
+
+  echo "$as_me:$LINENO: checking for gthreads library" >&5
+echo $ECHO_N "checking for gthreads library... $ECHO_C" >&6
+
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include "gthr.h"
+int
+main ()
+{
+
+      #ifndef __GTHREADS_CXX0X
+      #error
+      #endif
+
+      // In case of POSIX threads check _POSIX_TIMEOUTS too.
+      #if (defined(_PTHREADS) \
+           && (!defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS <= 0))
+      #error
+      #endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_cxx_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_has_gthreads=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_has_gthreads=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+  echo "$as_me:$LINENO: result: $ac_has_gthreads" >&5
+echo "${ECHO_T}$ac_has_gthreads" >&6
+
+  if test x"$ac_has_gthreads" = x"yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _GLIBCXX_HAS_GTHREADS 1
+_ACEOF
+
+  fi
+
   CXXFLAGS="$ac_save_CXXFLAGS"
   ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
index 36701f2ab96a494086e73e7ea6c8811e5ec34f71..ae97d89687600ded22a6e2544cfee3f393ad9484 100644 (file)
@@ -145,16 +145,13 @@ GLIBCXX_CHECK_STDIO_MACROS
 # For gettimeofday support.
 GLIBCXX_CHECK_GETTIMEOFDAY
 
-# For clock_gettime support.
+# For clock_gettime, nanosleep and sched_yield support.
 # NB: The default is [no], because otherwise it requires linking.
-GLIBCXX_ENABLE_CLOCK_GETTIME([no])
+GLIBCXX_ENABLE_LIBSTDCXX_TIME([no])
 
 # For gthread support
 GLIBCXX_CHECK_GTHREADS
 
-# For nanosleep support
-GLIBCXX_CHECK_NANOSLEEP
-
 AC_LC_MESSAGES
 
 # Check for available headers.
index 9ddd31cf89e11447664c53699138800687bc445f..7fa5a1e14a71bfb2500d4f7460a0763ed40e2a5e 100644 (file)
      </para>
  </listitem></varlistentry>
 
- <varlistentry><term><code>--enable-clock-gettime=OPTION</code></term>
+ <varlistentry><term><code>--enable-libstdcxx-time=OPTION</code></term>
  <listitem><para>Enables link-type checks for the availability of the
-        clock_gettime clocks, used in [time.clock] of the current C++0x draft.
-        The choice OPTION=yes checks for the availability of the monotonic and
-        realtime clocks in libc and libposix4.  In case of need the latter is 
-        also linked to libstdc++ as part of the build process.  OPTION=rt
-        also searches (and, in case, links) librt.   Note that the latter
-        is not always desirable because, in glibc, for example, in turn it
-        triggers the linking of libpthread too, which activates locking,
-        a large overhead for single-thread programs.  OPTION=no skips the
-        tests completely.  The default is OPTION=no.
+        clock_gettime clocks, used in the implementation of [time.clock],
+        and of the nanosleep and sched_yield functions, used in the
+        implementation of [thread.thread.this] of the current C++0x draft.
+        The choice OPTION=yes checks for the availability of the facilities
+        in libc and libposix4.  In case of need the latter is also linked
+        to libstdc++ as part of the build process.  OPTION=rt also searches
+        (and, in case, links) librt.   Note that the latter is not always
+        desirable because, in glibc, for example, in turn it triggers the
+        linking of libpthread too, which activates locking, a large overhead
+        for single-thread programs.  OPTION=no skips the tests completely.
+        The default is OPTION=no.
     </para>
  </listitem></varlistentry>
 
index 2a70100127187fac0924797f9ff97444c58b6552..422e36265395168f81b2d0150017d7f33b765780 100644 (file)
@@ -1,6 +1,6 @@
 // <thread> -*- C++ -*-
 
-// Copyright (C) 2008 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -96,7 +96,7 @@ namespace std
     typedef __gthread_t native_handle_type;
 
     // cons
-    thread();
+    thread() = default;
     
     template<typename _Callable>
       explicit thread(_Callable __f)
@@ -108,7 +108,8 @@ namespace std
       : _M_thread_data(__make_thread_data(std::bind(__f, __args...)))
       { __start_thread(); }
 
-    ~thread();
+    ~thread()
+    { detach(); }
 
     thread(const thread&) = delete;
     thread(thread&&);
@@ -117,7 +118,8 @@ namespace std
 
     // members
     void 
-    swap(thread&& __t);
+    swap(thread&& __t)
+    { std::swap(_M_thread_data, __t._M_thread_data); }
 
     bool 
     joinable() const;
@@ -128,7 +130,7 @@ namespace std
     void 
     detach();
 
-    id
+    thread::id
     get_id() const;
 
     native_handle_type 
@@ -181,18 +183,20 @@ namespace std
     thread::id
     get_id();
 
-    void
-    yield();
+#ifdef _GLIBCXX_USE_SCHED_YIELD
+    inline void
+    yield()
+    { __gthread_yield(); }
+#endif
 
+#ifdef _GLIBCXX_USE_NANOSLEEP
     template<typename _Clock, typename _Duration>
-      void
+      inline void
       sleep_until(const chrono::time_point<_Clock, _Duration>& __atime)
-      {
-       sleep_for(__atime - _Clock::now());
-      }
+      { sleep_for(__atime - _Clock::now()); }
 
     template<typename _Rep, typename _Period>
-      void
+      inline void
       sleep_for(const chrono::duration<_Rep, _Period>& __rtime)
       {
        chrono::seconds __s =
@@ -207,10 +211,9 @@ namespace std
            static_cast<long>(__ns.count())
          };
 
-#ifdef _GLIBCXX_USE_NANOSLEEP
        ::nanosleep(&__ts, 0);
-#endif
       }
+#endif
   }
 
   /// thread::id
@@ -226,10 +229,8 @@ namespace std
 
     friend bool 
     operator==(thread::id __x, thread::id __y)
-    { 
-      return 
-       static_cast<bool>(__gthread_equal(__x._M_thread_id, __y._M_thread_id));
-    }
+    { return static_cast<bool>(__gthread_equal(__x._M_thread_id,
+                                              __y._M_thread_id)); }
 
     friend bool
     operator<(thread::id __x, thread::id __y)
@@ -271,6 +272,26 @@ namespace std
       else
        return __out << __id._M_thread_id;
     }  
+
+  inline bool
+  thread::joinable() const
+  { return get_id() != thread::id(); }
+
+  inline thread::id
+  thread::get_id() const
+  {
+    if(_M_thread_data)
+      return thread::id(_M_thread_data->_M_thread_handle);
+    else
+      return thread::id();
+  }
+
+  namespace this_thread
+  {
+    inline thread::id
+    get_id()
+    { return thread::id(__gthread_self()); }
+  }
 }
 
 #endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
index b869e07d6e0ed9a0401e25deee479ccc19bc68f6..b7a4f83a8e54c4a5cf4d1328e95d888b83dbcbff 100644 (file)
@@ -1,6 +1,6 @@
 // thread -*- C++ -*-
 
-// Copyright (C) 2008 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -58,27 +58,6 @@ namespace std
     }
   }
 
-  thread::thread()
-  { }
-
-  thread::~thread()
-  {
-    detach();
-  }
-
-  thread::id
-  thread::get_id() const
-  {
-    if(_M_thread_data)
-      return thread::id(_M_thread_data->_M_thread_handle); 
-    else
-      return thread::id();
-  }
-
-  bool
-  thread::joinable() const
-  { return get_id() != id(); }
-  
   void
   thread::join()
   {
@@ -108,12 +87,6 @@ namespace std
       }
   }
 
-  void
-  thread::swap(thread&& __t)
-  {
-    std::swap(_M_thread_data, __t._M_thread_data);
-  }
-
   void 
   thread::__start_thread()
   {
@@ -123,17 +96,6 @@ namespace std
     if(__e)
       __throw_system_error(__e);
   }
-
-  namespace this_thread
-  {
-    thread::id
-    get_id()
-    { return thread::id(__gthread_self()); }
-    
-    void
-    yield()
-    { __gthread_yield(); }   
-  }
 }
 
 #endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
index cf60c2ccab220e3d0362c08328f8937a7598ab45..a632a45942f046bcaa9108f1a2726398dfca58b8 100644 (file)
@@ -4,8 +4,9 @@
 // { dg-options " -std=gnu++0x " { target *-*-cygwin *-*-darwin* } }
 // { dg-require-cstdint "" }
 // { dg-require-gthreads "" }
+// { dg-require-sched-yield "" }
 
-// Copyright (C) 2008 Free Software Foundation, Inc.
+// Copyright (C) 2008, 2009 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
index 78072256476fbbeff40d48434e181203d80d44a2..8270376d57e80d3d55c06b072b380ea304c03a80 100644 (file)
@@ -1,6 +1,7 @@
 # Handlers for additional dg-xxx keywords in tests.
 
-# Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
+# Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -125,6 +126,15 @@ proc dg-require-nanosleep { args } {
     return
 }
 
+proc dg-require-sched-yield { args } {
+    if { ![ check_v3_target_sched_yield ] } {
+        upvar dg-do-what dg-do-what
+        set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+        return
+    }
+    return
+}
+
 proc dg-require-string-conversions { args } {
     if { ![ check_v3_target_string_conversions ] } {
         upvar dg-do-what dg-do-what
index 3b2e18b7b2c74330e3ff6bcb4feb8f456a802af5..bd01b25bc184dfdbcec71c2ed8b4d3541ad93e2d 100644 (file)
@@ -1,6 +1,6 @@
 # libstdc++ "tool init file" for DejaGNU
 
-# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
 # Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
@@ -1261,6 +1261,64 @@ proc check_v3_target_nanosleep { } {
     return $et_nanosleep
 }
 
+proc check_v3_target_sched_yield { } {
+    global cxxflags
+    global DEFAULT_CXXFLAGS
+    global et_sched_yield
+
+    global tool
+
+    if { ![info exists et_sched_yield_target_name] } {
+        set et_sched_yield_target_name ""
+    }
+
+    # If the target has changed since we set the cached value, clear it.
+    set current_target [current_target_name]
+    if { $current_target != $et_sched_yield_target_name } {
+        verbose "check_v3_target_sched_yield: `$et_sched_yield_target_name'" 2
+        set et_sched_yield_target_name $current_target
+        if [info exists et_sched_yield] {
+            verbose "check_v3_target_sched_yield: removing cached result" 2
+            unset et_sched_yield
+        }
+    }
+
+    if [info exists et_sched_yield] {
+        verbose "check_v3_target_sched_yield: using cached result" 2
+    } else {
+        set et_sched_yield 0
+
+        # Set up and compile a C++0x test program that depends
+        # on the sched_yield facility to be available.
+        set src sched_yield[pid].cc
+        set exe sched_yield[pid].exe
+
+        set f [open $src "w"]
+        puts $f "#include <bits/c++config.h>"
+        puts $f "int main()"
+        puts $f "#ifdef _GLIBCXX_USE_SCHED_YIELD"
+        puts $f "{ return 0; }"
+        puts $f "#endif"
+        close $f
+
+        set cxxflags_saved $cxxflags
+        set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+
+        set lines [v3_target_compile $src $exe executable ""]
+        set cxxflags $cxxflags_saved
+        file delete $src
+
+        if [string match "" $lines] {
+            # No error message, compilation succeeded.
+            set et_sched_yield 1
+        } else {
+            verbose "check_v3_target_sched_yield: compilation failed" 2
+        }
+    }
+    verbose "check_v3_target_sched_yield: $et_sched_yield" 2
+    return $et_sched_yield
+}
+
 proc check_v3_target_string_conversions { } {
     global cxxflags
     global DEFAULT_CXXFLAGS