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 gl_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([gl_CHECK_TYPE_STRUCT_TIMESPEC],
24 dnl Persuade pedantic Solaris to declare struct timespec.
25 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
27 AC_REQUIRE([AC_HEADER_TIME])
28 AC_CHECK_HEADERS_ONCE(sys/time.h)
29 AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
32 # if TIME_WITH_SYS_TIME
33 # include <sys/time.h>
37 # include <sys/time.h>
43 [static struct timespec x; x.tv_sec = x.tv_nsec;],
44 fu_cv_sys_struct_timespec=yes,
45 fu_cv_sys_struct_timespec=no)
48 if test $fu_cv_sys_struct_timespec = yes; then
49 AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
50 [Define if struct timespec is declared in <time.h>. ])