aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES8
-rw-r--r--RELEASE-NOTES3
-rw-r--r--acinclude.m454
-rw-r--r--ares/acinclude.m454
4 files changed, 116 insertions, 3 deletions
diff --git a/CHANGES b/CHANGES
index ca52dd1f4..1f6a3d8e5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,14 @@
Changelog
+Yang Tse (29 Jun 2008)
+- John Lightsey filed bug report #1999181: "CLOCK_MONOTONIC always fails on
+ some systems" (http://curl.haxx.se/bug/view.cgi?id=1999181). The problem was
+ that the configure script did not use the _POSIX_MONOTONIC_CLOCK feature test
+ macro when checking monotonic clock availability. This is now fixed and the
+ monotonic clock will not be used unless the feature test macro is defined
+ with a value greater than zero indicating always supported.
+
Daniel Fandrich (25 Jun 2008)
- Honour --stderr with the -v option.
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index d94eb1e8a..1320f752b 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -25,6 +25,7 @@ This release includes the following bugfixes:
o SCP or SFTP over socks proxy crashed
o RC4-MD5 cipher now works with NSS-built libcurl
o range requests with --head are now done correctly
+ o configure script misdetected monotonic clock availability
This release includes the following known bugs:
@@ -43,6 +44,6 @@ advice from friends like these:
Lenny Rachitsky, Axel Tillequin, Arnaud Ebalard, Yang Tse, Dan Fandrich,
Rob Crittenden, Dengminwen, Christopher Palow, Hans-Jurgen May,
- Phil Pellouchoud, Eduard Bloch
+ Phil Pellouchoud, Eduard Bloch, John Lightsey
Thanks! (and sorry if I forgot to mention someone)
diff --git a/acinclude.m4 b/acinclude.m4
index b72604ab7..b672367aa 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1979,13 +1979,16 @@ dnl Check if monotonic clock_gettime is available.
AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
AC_REQUIRE([AC_HEADER_TIME])dnl
- AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
+ AC_CHECK_HEADERS(sys/types.h unistd.h sys/time.h time.h)
AC_MSG_CHECKING([for monotonic clock_gettime])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#ifdef TIME_WITH_SYS_TIME
@@ -1997,8 +2000,14 @@ AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
#endif
#endif
]],[[
+#if defined(_POSIX_MONOTONIC_CLOCK) && (_POSIX_MONOTONIC_CLOCK > 0)
+ dnl The monotonic clock will not be used unless the feature test macro is
+ dnl defined with a value greater than zero indicating _always_ supported.
struct timespec ts;
(void)clock_gettime(CLOCK_MONOTONIC, &ts);
+#else
+ HAVE_CLOCK_GETTIME_MONOTONIC shall not be defined.
+#endif
]])
],[
AC_MSG_RESULT([yes])
@@ -2039,6 +2048,9 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#ifdef TIME_WITH_SYS_TIME
@@ -2082,6 +2094,46 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
;;
esac
#
+ dnl only do runtime verification when not cross-compiling
+ if test "x$cross_compiling" != "xyes" &&
+ test "$ac_cv_func_clock_gettime" = "yes"; then
+ AC_MSG_CHECKING([if monotonic clock_gettime works])
+ AC_RUN_IFELSE([
+ AC_LANG_PROGRAM([[
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#ifdef TIME_WITH_SYS_TIME
+#include <time.h>
+#endif
+#else
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#endif
+ ]],[[
+#if defined(_POSIX_MONOTONIC_CLOCK) && (_POSIX_MONOTONIC_CLOCK > 0)
+ struct timespec ts;
+ if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
+ exit(0);
+#endif
+ exit(1);
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
+ ac_cv_func_clock_gettime="no"
+ LIBS="$curl_cv_save_LIBS"
+ ])
+ fi
+ #
case "$ac_cv_func_clock_gettime" in
yes)
AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,
diff --git a/ares/acinclude.m4 b/ares/acinclude.m4
index 7f51d1503..1875c0d5a 100644
--- a/ares/acinclude.m4
+++ b/ares/acinclude.m4
@@ -1446,13 +1446,16 @@ dnl Check if monotonic clock_gettime is available.
AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
AC_REQUIRE([AC_HEADER_TIME])dnl
- AC_CHECK_HEADERS(sys/types.h sys/time.h time.h)
+ AC_CHECK_HEADERS(sys/types.h unistd.h sys/time.h time.h)
AC_MSG_CHECKING([for monotonic clock_gettime])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#ifdef TIME_WITH_SYS_TIME
@@ -1464,8 +1467,14 @@ AC_DEFUN([CURL_CHECK_FUNC_CLOCK_GETTIME_MONOTONIC], [
#endif
#endif
]],[[
+#if defined(_POSIX_MONOTONIC_CLOCK) && (_POSIX_MONOTONIC_CLOCK > 0)
+ dnl The monotonic clock will not be used unless the feature test macro is
+ dnl defined with a value greater than zero indicating _always_ supported.
struct timespec ts;
(void)clock_gettime(CLOCK_MONOTONIC, &ts);
+#else
+ HAVE_CLOCK_GETTIME_MONOTONIC shall not be defined.
+#endif
]])
],[
AC_MSG_RESULT([yes])
@@ -1506,6 +1515,9 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#ifdef TIME_WITH_SYS_TIME
@@ -1549,6 +1561,46 @@ AC_DEFUN([CURL_CHECK_LIBS_CLOCK_GETTIME_MONOTONIC], [
;;
esac
#
+ dnl only do runtime verification when not cross-compiling
+ if test "x$cross_compiling" != "xyes" &&
+ test "$ac_cv_func_clock_gettime" = "yes"; then
+ AC_MSG_CHECKING([if monotonic clock_gettime works])
+ AC_RUN_IFELSE([
+ AC_LANG_PROGRAM([[
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#ifdef TIME_WITH_SYS_TIME
+#include <time.h>
+#endif
+#else
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#endif
+ ]],[[
+#if defined(_POSIX_MONOTONIC_CLOCK) && (_POSIX_MONOTONIC_CLOCK > 0)
+ struct timespec ts;
+ if (0 == clock_gettime(CLOCK_MONOTONIC, &ts))
+ exit(0);
+#endif
+ exit(1);
+ ]])
+ ],[
+ AC_MSG_RESULT([yes])
+ ],[
+ AC_MSG_RESULT([no])
+ AC_MSG_WARN([HAVE_CLOCK_GETTIME_MONOTONIC will not be defined])
+ ac_cv_func_clock_gettime="no"
+ LIBS="$curl_cv_save_LIBS"
+ ])
+ fi
+ #
case "$ac_cv_func_clock_gettime" in
yes)
AC_DEFINE_UNQUOTED(HAVE_CLOCK_GETTIME_MONOTONIC, 1,