Remove workaround for bug in Linux kernel 2.6.8 or thereabouts.
[gnulib.git] / m4 / timespec.m4
1 #serial 9
2
3 # Copyright (C) 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
7
8 dnl From Jim Meyering
9
10 AC_DEFUN([gl_TIMESPEC],
11 [
12   dnl Prerequisites of lib/timespec.h.
13   AC_REQUIRE([AC_HEADER_TIME])
14   AC_CHECK_HEADERS_ONCE(sys/time.h)
15   gl_CHECK_TYPE_STRUCT_TIMESPEC
16   AC_STRUCT_ST_MTIM_NSEC
17
18   dnl Persuade glibc <time.h> to declare nanosleep().
19   AC_REQUIRE([AC_GNU_SOURCE])
20
21   AC_CHECK_DECLS(nanosleep, , , [#include <time.h>])
22 ])
23
24 dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
25 dnl in time.h or sys/time.h.
26
27 AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
28 [
29   dnl Persuade pedantic Solaris to declare struct timespec.
30   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
31
32   AC_REQUIRE([AC_HEADER_TIME])
33   AC_CHECK_HEADERS_ONCE(sys/time.h)
34   AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
35     [AC_TRY_COMPILE(
36       [
37 #      if TIME_WITH_SYS_TIME
38 #       include <sys/time.h>
39 #       include <time.h>
40 #      else
41 #       if HAVE_SYS_TIME_H
42 #        include <sys/time.h>
43 #       else
44 #        include <time.h>
45 #       endif
46 #      endif
47       ],
48       [static struct timespec x; x.tv_sec = x.tv_nsec;],
49       fu_cv_sys_struct_timespec=yes,
50       fu_cv_sys_struct_timespec=no)
51     ])
52
53   if test $fu_cv_sys_struct_timespec = yes; then
54     AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
55               [Define if struct timespec is declared in <time.h>. ])
56   fi
57 ])