summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-02-22 07:09:13 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-02-22 07:09:13 +0000
commit55c154ed7d3390875a1c65f4db96546ccdc85225 (patch)
treeab17f79c542a1f75f9bc2e0c3c7e47fccc44dca3 /m4
parentba8ad9a1e62f14aad6a6600b612ae51d5546f150 (diff)
downloadcoreutils-55c154ed7d3390875a1c65f4db96546ccdc85225.tar.xz
(gl_PREREQ_GETHRXTIME): Require gl_CLOCK_TIME,
gl_USE_SYSTEM_EXTENSIONS. Check whether CLOCK_MONOTONIC is defined, and set LIB_GETHRXTIME accordingly. This is needed for newer GNU/Linux systems that have clock_gettime, so that they link in the appropriate library for it when needed.
Diffstat (limited to 'm4')
-rw-r--r--m4/gethrxtime.m429
1 files changed, 24 insertions, 5 deletions
diff --git a/m4/gethrxtime.m4 b/m4/gethrxtime.m4
index 89c6a21e7..82ca6280e 100644
--- a/m4/gethrxtime.m4
+++ b/m4/gethrxtime.m4
@@ -1,9 +1,11 @@
-# gethrxtime.m4 serial 1
+# gethrxtime.m4 serial 2
dnl Copyright (C) 2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
+dnl Written by Paul Eggert.
+
AC_DEFUN([gl_GETHRXTIME],
[
AC_LIBSOURCES([gethrxtime.c, gethrxtime.h, xtime.h])
@@ -48,10 +50,27 @@ AC_DEFUN([gl_XTIME],
# Prerequisites of lib/gethrxtime.c.
AC_DEFUN([gl_PREREQ_GETHRXTIME],
[
- dnl Do not AC_REQUIRE([gl_CLOCK_TIME]), since that would unnecessarily
- dnl require -lrt on Solaris. Invocations of clock_gettime should be
- dnl safe in gethrxtime.c since Solaris has native gethrtime.
AC_REQUIRE([AC_HEADER_TIME])
+ AC_REQUIRE([gl_CLOCK_TIME])
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_CHECK_FUNCS_ONCE(gettimeofday microuptime nanouptime)
- :
+
+ if test $ac_cv_func_nanouptime != yes; then
+ LIB_GETHRXTIME=
+ AC_CACHE_CHECK([whether CLOCK_MONOTONIC is defined],
+ gl_cv_have_CLOCK_MONOTONIC,
+ [AC_EGREP_CPP([have_CLOCK_MONOTONIC],
+ [
+# include <time.h>
+# ifdef CLOCK_MONOTONIC
+ have_CLOCK_MONOTONIC
+# endif
+ ],
+ gl_cv_have_CLOCK_MONOTONIC=yes,
+ gl_cv_have_CLOCK_MONOTONIC=no)])
+ if test $gl_cv_have_CLOCK_MONOTONIC = yes; then
+ LIB_GETHRXTIME=$LIB_CLOCK_GETTIME
+ fi
+ AC_SUBST([LIB_GETHRXTIME])
+ fi
])