1#serial 7
2
3# Copyright (C) 1998, 1999, 2001, 2003, 2004, 2006 Free Software
4# Foundation, Inc.
5
6# This file is free software; the Free Software Foundation
7# gives unlimited permission to copy and/or distribute it,
8# with or without modifications, as long as this notice is preserved.
9
10dnl Shamelessly cloned from acspecific.m4's AC_FUNC_UTIME_NULL,
11dnl then do case-insensitive s/utime/utimes/.
12
13AC_DEFUN([gl_FUNC_UTIMES_NULL],
14[AC_CACHE_CHECK(whether utimes accepts a null argument, ac_cv_func_utimes_null,
15[rm -f conftest.data; > conftest.data
16AC_TRY_RUN([
17/* In case stat has been defined to rpl_stat, undef it here.  */
18#undef stat
19#include <sys/types.h>
20#include <sys/stat.h>
21#include <sys/time.h>
22int
23main () {
24struct stat s, t;
25return ! (stat ("conftest.data", &s) == 0
26	  && utimes ("conftest.data", 0) == 0
27	  && stat ("conftest.data", &t) == 0
28	  && t.st_mtime >= s.st_mtime
29	  && t.st_mtime - s.st_mtime < 120));
30}],
31  ac_cv_func_utimes_null=yes,
32  ac_cv_func_utimes_null=no,
33  ac_cv_func_utimes_null=no)
34rm -f core core.* *.core])
35
36    if test $ac_cv_func_utimes_null = yes; then
37      AC_DEFINE(HAVE_UTIMES_NULL, 1,
38		[Define if utimes accepts a null argument])
39    fi
40  ]
41)
42