Commit 610870b2 by Paolo Carlini Committed by Paolo Carlini

acinclude.m4 ([GLIBCXX_CHECK_GETTIMEOFDAY]): Change to use GCC_TRY_COMPILE_OR_LINK.

2008-08-23  Paolo Carlini  <paolo.carlini@oracle.com>

	* acinclude.m4 ([GLIBCXX_CHECK_GETTIMEOFDAY]): Change to use
	GCC_TRY_COMPILE_OR_LINK.
	([GLIBCXX_CHECK_CLOCK_GETTIME]): Rename to
	[GLIBCXX_ENABLE_CLOCK_GETTIME], a versatile configure-time option,
	[no] by default, since it includes TRY_LINK checks.  librt is also
	searched, if requested.
	* doc/xml/manual/configure.xml: Document the latter.
	* configure.ac: Move the above checks outside native-only.
	* configure: Regenerate.

From-SVN: r139530
parent 033f28dc
2008-08-23 Paolo Carlini <paolo.carlini@oracle.com> 2008-08-23 Paolo Carlini <paolo.carlini@oracle.com>
* acinclude.m4 ([GLIBCXX_CHECK_GETTIMEOFDAY]): Change to use
GCC_TRY_COMPILE_OR_LINK.
([GLIBCXX_CHECK_CLOCK_GETTIME]): Rename to
[GLIBCXX_ENABLE_CLOCK_GETTIME], a versatile configure-time option,
[no] by default, since it includes TRY_LINK checks. librt is also
searched, if requested.
* doc/xml/manual/configure.xml: Document the latter.
* configure.ac: Move the above checks outside native-only.
* configure: Regenerate.
2008-08-23 Paolo Carlini <paolo.carlini@oracle.com>
* testsuite/lib/libstdc++.exp (check_v3_target_atomic_builtins): Add. * testsuite/lib/libstdc++.exp (check_v3_target_atomic_builtins): Add.
* testsuite/lib/dg-options.exp (dg-require-atomic-builtins): Likewise. * testsuite/lib/dg-options.exp (dg-require-atomic-builtins): Likewise.
* testsuite/18_support/exception_ptr/current_exception.cc: Use it. * testsuite/18_support/exception_ptr/current_exception.cc: Use it.
......
...@@ -1074,10 +1074,29 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [ ...@@ -1074,10 +1074,29 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [
dnl dnl
dnl Check for IEEE Std 1003.1-2001 clock_gettime required for dnl Check for clock_gettime clocks, used in the implementation of 20.8.5
dnl 20.8.5 [time.clock] in the current C++0X working draft. dnl [time.clock] in the current C++0x working draft.
dnl dnl
AC_DEFUN([GLIBCXX_CHECK_CLOCK_GETTIME], [ dnl --enable-clock-gettime
dnl --enable-clock-gettime=yes
dnl checks for the availability of monotonic or realtime clocks
dnl in libc and libposix4
dnl --enable-clock-gettime=rt
dnl searches librt too, and in case of success enables its linking
dnl to libstdc++ as part of the build process. Note that this is
dnl not always desirable because, in glibc, for example, in turn it
dnl triggers automatically the linking of libpthread too, which
dnl activates locking, a large overhead for single-thread programs.
dnl --enable-clock-gettime=no
dnl --disable-clock-gettime
dnl disables the checks completely
dnl
AC_DEFUN([GLIBCXX_ENABLE_CLOCK_GETTIME], [
AC_MSG_CHECKING([for clock_gettime clocks])
GLIBCXX_ENABLE(clock-gettime,$1,,
[use KIND for check type],
[permit yes|no|rt])
AC_LANG_SAVE AC_LANG_SAVE
AC_LANG_CPLUSPLUS AC_LANG_CPLUSPLUS
...@@ -1085,45 +1104,53 @@ AC_DEFUN([GLIBCXX_CHECK_CLOCK_GETTIME], [ ...@@ -1085,45 +1104,53 @@ AC_DEFUN([GLIBCXX_CHECK_CLOCK_GETTIME], [
CXXFLAGS="$CXXFLAGS -fno-exceptions" CXXFLAGS="$CXXFLAGS -fno-exceptions"
ac_save_LIBS="$LIBS" ac_save_LIBS="$LIBS"
AC_SEARCH_LIBS(clock_gettime, [posix4]) ac_has_clock_monotonic=no;
ac_has_clock_realtime=no;
# Link to -lposix4. if test x"$enable_clock_gettime" != x"no"; then
case "$ac_cv_search_clock_gettime" in
-lposix4*) GLIBCXX_LIBS=$ac_cv_search_clock_gettime
esac
AC_CHECK_HEADERS(unistd.h, ac_has_unistd_h=yes, ac_has_unistd_h=no) if test x"$enable_clock_gettime" = x"rt"; then
AC_SEARCH_LIBS(clock_gettime, [rt posix4])
ac_has_clock_monotonic=no; else
ac_has_clock_realtime=no; AC_SEARCH_LIBS(clock_gettime, [posix4])
if test x"$ac_has_unistd_h" = x"yes"; then fi
AC_MSG_CHECKING([for monotonic clock])
AC_TRY_LINK( case "$ac_cv_search_clock_gettime" in
[#include <unistd.h> -l*) GLIBCXX_LIBS=$ac_cv_search_clock_gettime
#include <time.h> esac
],
[#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK) AC_CHECK_HEADERS(unistd.h, ac_has_unistd_h=yes, ac_has_unistd_h=no)
timespec tp;
#endif if test x"$ac_has_unistd_h" = x"yes"; then
clock_gettime(CLOCK_MONOTONIC, &tp); AC_MSG_CHECKING([for monotonic clock])
], [ac_has_clock_monotonic=yes], [ac_has_clock_monotonic=no]) AC_TRY_LINK(
[#include <unistd.h>
AC_MSG_RESULT($ac_has_clock_monotonic) #include <time.h>
],
AC_MSG_CHECKING([for realtime clock]) [#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
AC_TRY_LINK( timespec tp;
[#include <unistd.h> #endif
#include <time.h> clock_gettime(CLOCK_MONOTONIC, &tp);
], ], [ac_has_clock_monotonic=yes], [ac_has_clock_monotonic=no])
[#if _POSIX_TIMERS > 0
timespec tp; AC_MSG_RESULT($ac_has_clock_monotonic)
#endif
clock_gettime(CLOCK_REALTIME, &tp);
], [ac_has_clock_realtime=yes], [ac_has_clock_realtime=no])
AC_MSG_RESULT($ac_has_clock_realtime) AC_MSG_CHECKING([for realtime clock])
fi AC_TRY_LINK(
[#include <unistd.h>
#include <time.h>
],
[#if _POSIX_TIMERS > 0
timespec tp;
#endif
clock_gettime(CLOCK_REALTIME, &tp);
], [ac_has_clock_realtime=yes], [ac_has_clock_realtime=no])
AC_MSG_RESULT($ac_has_clock_realtime)
fi
fi
if test x"$ac_has_clock_monotonic" = x"yes"; then if test x"$ac_has_clock_monotonic" = x"yes"; then
AC_DEFINE(_GLIBCXX_USE_CLOCK_MONOTONIC, 1, AC_DEFINE(_GLIBCXX_USE_CLOCK_MONOTONIC, 1,
[ Defined if clock_gettime has monotonic clock support. ]) [ Defined if clock_gettime has monotonic clock support. ])
...@@ -1142,11 +1169,13 @@ AC_DEFUN([GLIBCXX_CHECK_CLOCK_GETTIME], [ ...@@ -1142,11 +1169,13 @@ AC_DEFUN([GLIBCXX_CHECK_CLOCK_GETTIME], [
]) ])
dnl dnl
dnl Check for IEEE Std 1003.1-2001 gettimeofday required for dnl Check for gettimeofday, used in the implementation of 20.8.5
dnl 20.8.5 [time.clock] in the current C++0X working draft. dnl [time.clock] in the current C++0x working draft.
dnl dnl
AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [ AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [
AC_MSG_CHECKING([for gettimeofday])
AC_LANG_SAVE AC_LANG_SAVE
AC_LANG_CPLUSPLUS AC_LANG_CPLUSPLUS
ac_save_CXXFLAGS="$CXXFLAGS" ac_save_CXXFLAGS="$CXXFLAGS"
...@@ -1156,7 +1185,7 @@ AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [ ...@@ -1156,7 +1185,7 @@ AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [
AC_CHECK_HEADERS(sys/time.h, ac_has_sys_time_h=yes, ac_has_sys_time_h=no) AC_CHECK_HEADERS(sys/time.h, ac_has_sys_time_h=yes, ac_has_sys_time_h=no)
if test x"$ac_has_sys_time_h" = x"yes"; then if test x"$ac_has_sys_time_h" = x"yes"; then
AC_MSG_CHECKING([for gettimeofday]) AC_MSG_CHECKING([for gettimeofday])
AC_TRY_LINK([#include <sys/time.h>], GCC_TRY_COMPILE_OR_LINK([#include <sys/time.h>],
[timeval tv; gettimeofday(&tv, 0);], [timeval tv; gettimeofday(&tv, 0);],
[ac_has_gettimeofday=yes], [ac_has_gettimeofday=no]) [ac_has_gettimeofday=yes], [ac_has_gettimeofday=no])
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -143,6 +143,13 @@ GLIBCXX_CHECK_C99_TR1 ...@@ -143,6 +143,13 @@ GLIBCXX_CHECK_C99_TR1
# For common values of EOF, SEEK_CUR, SEEK_END. # For common values of EOF, SEEK_CUR, SEEK_END.
GLIBCXX_CHECK_STDIO_MACROS GLIBCXX_CHECK_STDIO_MACROS
# For gettimeofday support.
GLIBCXX_CHECK_GETTIMEOFDAY
# For clock_gettime support.
# NB: The default is [no], because otherwise it requires linking.
GLIBCXX_ENABLE_CLOCK_GETTIME([no])
AC_LC_MESSAGES AC_LC_MESSAGES
# Check for available headers. # Check for available headers.
...@@ -167,12 +174,6 @@ if $GLIBCXX_IS_NATIVE; then ...@@ -167,12 +174,6 @@ if $GLIBCXX_IS_NATIVE; then
# For dev/random and dev/urandom for TR1. # For dev/random and dev/urandom for TR1.
GLIBCXX_CHECK_RANDOM_TR1 GLIBCXX_CHECK_RANDOM_TR1
# For clock_gettime support.
GLIBCXX_CHECK_CLOCK_GETTIME
# For gettimeofday support.
GLIBCXX_CHECK_GETTIMEOFDAY
# For TLS support. # For TLS support.
GCC_CHECK_TLS GCC_CHECK_TLS
......
...@@ -312,7 +312,27 @@ ...@@ -312,7 +312,27 @@
environment. environment.
</para> </para>
</listitem></varlistentry> </listitem></varlistentry>
</variablelist>
<varlistentry><term><code>--enable-clock-gettime</code></term>
<listitem><para>This is an abbreviated form of
<code>'--enable-clock-gettime=yes'</code>(described next).
</para>
</listitem></varlistentry>
<varlistentry><term><code>--enable-clock-gettime=OPTION</code></term>
<listitem><para>Enables checks (link-type too) for the clock_gettime clocks,
used in the implementation [time.clock] in the current C++0x draft.
The choice OPTION=yes checks for the availability of the monotonic and
realtime clocks in libc and libposix4. OPTION=rt searches librt too,
and in case of success enables its linking to libstdc++ as part of the
build process. Note that this is not always desirable because, in
glibc, for example, in turn it triggers automatically 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>
</variablelist>
</sect1> </sect1>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment