summaryrefslogtreecommitdiff
path: root/m4/gettime.m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2022-09-28 00:29:09 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2022-09-28 00:37:12 -0700
commita9b29ee4a0ffa4878d67eaf518dbeed098844b9e (patch)
treebbde8d6eae8b3676bb1d9f74d8ce0f6d7016c834 /m4/gettime.m4
parentc1eb13b32676b288a3ab3826501caf7bcd376b7f (diff)
downloademacs-a9b29ee4a0ffa4878d67eaf518dbeed098844b9e.tar.gz
Update from Gnulib by running admin/merge-gnulib
Diffstat (limited to 'm4/gettime.m4')
-rw-r--r--m4/gettime.m431
1 files changed, 29 insertions, 2 deletions
diff --git a/m4/gettime.m4 b/m4/gettime.m4
index f0aeb4d0e4d..c3e0713b575 100644
--- a/m4/gettime.m4
+++ b/m4/gettime.m4
@@ -1,4 +1,4 @@
-# gettime.m4 serial 11
+# gettime.m4 serial 12
dnl Copyright (C) 2002, 2004-2006, 2009-2022 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -9,7 +9,34 @@ AC_DEFUN([gl_GETTIME],
dnl Prerequisites of lib/gettime.c.
AC_REQUIRE([gl_CLOCK_TIME])
AC_REQUIRE([gl_TIMESPEC])
- AC_CHECK_FUNCS_ONCE([timespec_get])
+
+ AC_REQUIRE([gl_CHECK_FUNC_TIMESPEC_GET])
+ if test $gl_cv_func_timespec_get = yes; then
+ AC_DEFINE([HAVE_TIMESPEC_GET], [1],
+ [Define if you have the timespec_get function.])
+ fi
+])
+
+dnl Tests whether the function timespec_get exists.
+dnl Sets gl_cv_func_timespec_get.
+AC_DEFUN([gl_CHECK_FUNC_TIMESPEC_GET],
+[
+ dnl Persuade OpenBSD <time.h> to declare timespec_get().
+ AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
+
+ dnl We can't use AC_CHECK_FUNC here, because timespec_get() is defined as a
+ dnl static inline function in <time.h> on MSVC 14.
+ AC_CACHE_CHECK([for timespec_get], [gl_cv_func_timespec_get],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <time.h>
+ struct timespec ts;
+ ]],
+ [[return timespec_get (&ts, 0);]])
+ ],
+ [gl_cv_func_timespec_get=yes],
+ [gl_cv_func_timespec_get=no])
+ ])
])
AC_DEFUN([gl_GETTIME_RES],