From 55c154ed7d3390875a1c65f4db96546ccdc85225 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 22 Feb 2005 07:09:13 +0000 Subject: (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. --- m4/gethrxtime.m4 | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) (limited to 'm4/gethrxtime.m4') 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 +# 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 ]) -- cgit v1.2.3-54-g00ecf