3 # Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software
6 # This file is free software; the Free Software Foundation
7 # gives unlimited permission to copy and/or distribute it,
8 # with or without modifications, as long as this notice is preserved.
12 AC_DEFUN([gl_TIMESPEC],
14 dnl Prerequisites of lib/timespec.h.
15 AC_REQUIRE([AC_C_INLINE])
16 AC_CHECK_HEADERS_ONCE(sys/time.h)
17 gl_CHECK_TYPE_STRUCT_TIMESPEC
19 dnl Persuade glibc and Solaris <time.h> to declare nanosleep.
20 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
22 AC_CHECK_DECLS(nanosleep, , , [#include <time.h>])
25 dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
26 dnl in time.h or sys/time.h.
28 AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
30 dnl Persuade pedantic Solaris to declare struct timespec.
31 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
33 AC_CHECK_HEADERS_ONCE(sys/time.h)
34 AC_CACHE_CHECK([for struct timespec], [gl_cv_sys_struct_timespec],
42 [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
43 [gl_cv_sys_struct_timespec=yes],
44 [gl_cv_sys_struct_timespec=no])])
46 if test $gl_cv_sys_struct_timespec = yes; then
47 AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
48 [Define if struct timespec is declared in <time.h>. ])