*** empty log message ***
[findutils.git] / m4 / timespec.m4
blob36ea5cac389bb0622dc1b420ff0358fc5e0cecc4
1 #serial 4
3 dnl From Jim Meyering
5 dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
6 dnl in time.h or sys/time.h.
8 AC_DEFUN(jm_CHECK_TYPE_STRUCT_TIMESPEC,
10   AC_REQUIRE([AC_HEADER_TIME])
11   AC_CACHE_CHECK([for struct timespec], fu_cv_sys_struct_timespec,
12     [AC_TRY_COMPILE(
13       [
14 #      if TIME_WITH_SYS_TIME
15 #       include <sys/time.h>
16 #       include <time.h>
17 #      else
18 #       if HAVE_SYS_TIME_H
19 #        include <sys/time.h>
20 #       else
21 #        include <time.h>
22 #       endif
23 #      endif
24       ],
25       [static struct timespec x; x.tv_sec = x.tv_nsec;],
26       fu_cv_sys_struct_timespec=yes,
27       fu_cv_sys_struct_timespec=no)
28     ])
30   if test $fu_cv_sys_struct_timespec = yes; then
31     AC_DEFINE_UNQUOTED(HAVE_STRUCT_TIMESPEC, 1,
32                        [Define if struct timespec is declared in <time.h>. ])
33   fi