(AM_FUNC_GETLOADAVG): Use AC_CHECK_HEADERS, not
[gnulib.git] / m4 / utimes.m4
1 #serial 3
2
3 dnl Shamelessly cloned from acspecific.m4's AC_FUNC_UTIME_NULL,
4 dnl then do case-insensitive s/utime/utimes/.
5
6 AC_DEFUN(jm_FUNC_UTIMES_NULL,
7 [AC_CACHE_CHECK(whether utimes accepts a null argument, ac_cv_func_utimes_null,
8 [rm -f conftestdata; > conftestdata
9 AC_TRY_RUN([
10 /* In case stat has been defined to rpl_stat, undef it here.  */
11 #undef stat
12 #include <sys/types.h>
13 #include <sys/stat.h>
14 main() {
15 struct stat s, t;
16 exit(!(stat ("conftestdata", &s) == 0 && utimes("conftestdata", (long *)0) == 0
17 && stat("conftestdata", &t) == 0 && t.st_mtime >= s.st_mtime
18 && t.st_mtime - s.st_mtime < 120));
19 }],
20   ac_cv_func_utimes_null=yes,
21   ac_cv_func_utimes_null=no,
22   ac_cv_func_utimes_null=no)
23 rm -f core core.* *.core])
24
25     if test $ac_cv_func_utimes_null = yes; then
26       AC_DEFINE_UNQUOTED(HAVE_UTIMES_NULL, 1,
27                          [Define if utimes accepts a null argument])
28     fi
29   ]
30 )