Change jm_ to gl_ in AC_DEFINE'd names. Update all uses.
[gnulib.git] / m4 / timespec.m4
1 #serial 8
2
3 dnl From Jim Meyering
4
5 AC_DEFUN([gl_TIMESPEC],
6 [
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
12
13   dnl Persuade glibc <time.h> to declare nanosleep().
14   AC_REQUIRE([AC_GNU_SOURCE])
15
16   AC_CHECK_DECLS(nanosleep, , , [#include <time.h>])
17 ])
18
19 dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
20 dnl in time.h or sys/time.h.
21
22 AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
23 [
24   dnl Persuade pedantic Solaris to declare struct timespec.
25   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
26
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,
30     [AC_TRY_COMPILE(
31       [
32 #      if TIME_WITH_SYS_TIME
33 #       include <sys/time.h>
34 #       include <time.h>
35 #      else
36 #       if HAVE_SYS_TIME_H
37 #        include <sys/time.h>
38 #       else
39 #        include <time.h>
40 #       endif
41 #      endif
42       ],
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)
46     ])
47
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>. ])
51   fi
52 ])