s/conftestdata/conftest.data/
[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 conftest.data; > conftest.data
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 ("conftest.data", &s) == 0
17        && utimes("conftest.data", (long *)0) == 0
18        && stat("conftest.data", &t) == 0
19        && t.st_mtime >= s.st_mtime
20        && t.st_mtime - s.st_mtime < 120));
21 }],
22   ac_cv_func_utimes_null=yes,
23   ac_cv_func_utimes_null=no,
24   ac_cv_func_utimes_null=no)
25 rm -f core core.* *.core])
26
27     if test $ac_cv_func_utimes_null = yes; then
28       AC_DEFINE_UNQUOTED(HAVE_UTIMES_NULL, 1,
29                          [Define if utimes accepts a null argument])
30     fi
31   ]
32 )