5 AC_DEFUN([gl_TIMESPEC],
7 dnl Prerequisites of lib/timespec.h.
8 AC_REQUIRE([AC_HEADER_TIME])
9 AC_CHECK_HEADERS_ONCE(sys/time.h)
10 jm_CHECK_TYPE_STRUCT_TIMESPEC
11 AC_STRUCT_ST_MTIM_NSEC
13 dnl Persuade glibc <time.h> to declare nanosleep().
14 AC_REQUIRE([AC_GNU_SOURCE])
16 AC_CHECK_DECLS(nanosleep, , , [#include <time.h>])
19 dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
20 dnl in time.h or sys/time.h.
22 AC_DEFUN([jm_CHECK_TYPE_STRUCT_TIMESPEC],
24 AC_REQUIRE([AC_HEADER_TIME])
25 AC_CHECK_HEADERS_ONCE(sys/time.h)
26 AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
29 # if TIME_WITH_SYS_TIME
30 # include <sys/time.h>
34 # include <sys/time.h>
40 [static struct timespec x; x.tv_sec = x.tv_nsec;],
41 fu_cv_sys_struct_timespec=yes,
42 fu_cv_sys_struct_timespec=no)
45 if test $fu_cv_sys_struct_timespec = yes; then
46 AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
47 [Define if struct timespec is declared in <time.h>. ])