diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2022-09-28 00:29:09 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2022-09-28 00:37:12 -0700 |
commit | a9b29ee4a0ffa4878d67eaf518dbeed098844b9e (patch) | |
tree | bbde8d6eae8b3676bb1d9f74d8ce0f6d7016c834 /m4/gettime.m4 | |
parent | c1eb13b32676b288a3ab3826501caf7bcd376b7f (diff) | |
download | emacs-a9b29ee4a0ffa4878d67eaf518dbeed098844b9e.tar.gz emacs-a9b29ee4a0ffa4878d67eaf518dbeed098844b9e.tar.bz2 emacs-a9b29ee4a0ffa4878d67eaf518dbeed098844b9e.zip |
Update from Gnulib by running admin/merge-gnulib
Diffstat (limited to 'm4/gettime.m4')
-rw-r--r-- | m4/gettime.m4 | 31 |
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], |