diff options
author | Jim Meyering <jim@meyering.net> | 2003-08-10 13:32:18 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-08-10 13:32:18 +0000 |
commit | 950a94e7487305e5c1b3c3bc56d3f0be0ecd241b (patch) | |
tree | d9fb66cc8d09c901f1ee122942b880159c3066ac | |
parent | 8892d683be7d11937a271644247592a3e7b6db5e (diff) | |
download | coreutils-950a94e7487305e5c1b3c3bc56d3f0be0ecd241b.tar.xz |
.
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | aclocal.m4 | 48 | ||||
-rw-r--r-- | config.hin | 3 |
3 files changed, 52 insertions, 1 deletions
diff --git a/Makefile.in b/Makefile.in index 2c39bb01b..e63d04754 100644 --- a/Makefile.in +++ b/Makefile.in @@ -216,7 +216,7 @@ $(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(srcdir)/configure: $(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) -$(ACLOCAL_M4): configure.ac m4/acl.m4 m4/afs.m4 m4/alloca.m4 m4/assert.m4 m4/bison.m4 m4/boottime.m4 m4/c-stack.m4 m4/canonicalize.m4 m4/check-decl.m4 m4/chown.m4 m4/codeset.m4 m4/d-ino.m4 m4/d-type.m4 m4/dirfd.m4 m4/dos.m4 m4/error.m4 m4/extensions.m4 m4/fnmatch.m4 m4/fpending.m4 m4/fstypename.m4 m4/fsusage.m4 m4/ftruncate.m4 m4/ftw.m4 m4/getcwd-path-max.m4 m4/getcwd.m4 m4/getgroups.m4 m4/getline.m4 m4/getndelim2.m4 m4/gettext.m4 m4/gettimeofday.m4 m4/glibc.m4 m4/glibc21.m4 m4/group-member.m4 m4/host-os.m4 m4/human.m4 m4/iconv.m4 m4/intdiv0.m4 m4/intmax_t.m4 m4/inttypes-pri.m4 m4/inttypes.m4 m4/inttypes_h.m4 m4/isc-posix.m4 m4/jm-macros.m4 m4/jm-mktime.m4 m4/jm-winsz1.m4 m4/jm-winsz2.m4 m4/lchown.m4 m4/lcmessage.m4 m4/lib-check.m4 m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 m4/link-follow.m4 m4/longdouble.m4 m4/longlong.m4 m4/ls-mntd-fs.m4 m4/lstat.m4 m4/mbrtowc.m4 m4/mbswidth.m4 m4/memcmp.m4 m4/memcoll.m4 m4/mkdir-slash.m4 m4/mkstemp.m4 m4/mktime.m4 m4/nanosleep.m4 m4/onceonly.m4 m4/open-max.m4 m4/perl.m4 m4/prereq.m4 m4/progtest.m4 m4/putenv.m4 m4/readdir.m4 m4/regex.m4 m4/rename.m4 m4/restrict.m4 m4/rmdir-errno.m4 m4/search-libs.m4 m4/signed.m4 m4/ssize_t.m4 m4/st_dm_mode.m4 m4/st_mtim.m4 m4/stat.m4 m4/stdbool.m4 m4/stdint_h.m4 m4/strftime.m4 m4/timespec.m4 m4/tm_gmtoff.m4 m4/tzset.m4 m4/uintmax_t.m4 m4/unlink-busy.m4 m4/unlocked-io.m4 m4/uptime.m4 m4/utimbuf.m4 m4/utime.m4 m4/utimens.m4 m4/utimes.m4 m4/vasnprintf.m4 m4/vasprintf.m4 m4/wchar_t.m4 m4/wint_t.m4 m4/xstrtoimax.m4 m4/xstrtoumax.m4 +$(ACLOCAL_M4): configure.ac m4/acl.m4 m4/afs.m4 m4/alloca.m4 m4/assert.m4 m4/bison.m4 m4/boottime.m4 m4/c-stack.m4 m4/canonicalize.m4 m4/check-decl.m4 m4/chown.m4 m4/codeset.m4 m4/d-ino.m4 m4/d-type.m4 m4/dirfd.m4 m4/dos.m4 m4/error.m4 m4/extensions.m4 m4/fnmatch.m4 m4/fpending.m4 m4/fstypename.m4 m4/fsusage.m4 m4/ftruncate.m4 m4/ftw.m4 m4/getcwd-path-max.m4 m4/getcwd.m4 m4/getgroups.m4 m4/getline.m4 m4/getndelim2.m4 m4/gettext.m4 m4/gettimeofday.m4 m4/glibc.m4 m4/glibc21.m4 m4/group-member.m4 m4/host-os.m4 m4/human.m4 m4/iconv.m4 m4/intdiv0.m4 m4/intmax_t.m4 m4/inttypes-pri.m4 m4/inttypes.m4 m4/inttypes_h.m4 m4/isc-posix.m4 m4/jm-macros.m4 m4/jm-mktime.m4 m4/jm-winsz1.m4 m4/jm-winsz2.m4 m4/lchown.m4 m4/lcmessage.m4 m4/lib-check.m4 m4/lib-ld.m4 m4/lib-link.m4 m4/lib-prefix.m4 m4/link-follow.m4 m4/longdouble.m4 m4/longlong.m4 m4/ls-mntd-fs.m4 m4/lstat.m4 m4/mbrtowc.m4 m4/mbswidth.m4 m4/memcmp.m4 m4/memcoll.m4 m4/mkdir-slash.m4 m4/mkstemp.m4 m4/mktime.m4 m4/nanosleep.m4 m4/onceonly.m4 m4/open-max.m4 m4/perl.m4 m4/prereq.m4 m4/progtest.m4 m4/putenv.m4 m4/readdir.m4 m4/regex.m4 m4/rename.m4 m4/restrict.m4 m4/rmdir-errno.m4 m4/search-libs.m4 m4/signed.m4 m4/ssize_t.m4 m4/st_dm_mode.m4 m4/st_mtim.m4 m4/stat.m4 m4/stdbool.m4 m4/stdint_h.m4 m4/strftime.m4 m4/timespec.m4 m4/tm_gmtoff.m4 m4/tzset.m4 m4/uintmax_t.m4 m4/unlink-busy.m4 m4/unlocked-io.m4 m4/uptime.m4 m4/utimbuf.m4 m4/utime.m4 m4/utimens.m4 m4/utimes-null.m4 m4/utimes.m4 m4/vasnprintf.m4 m4/vasprintf.m4 m4/wchar_t.m4 m4/wint_t.m4 m4/xstrtoimax.m4 m4/xstrtoumax.m4 cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 diff --git a/aclocal.m4 b/aclocal.m4 index 09d335eae..c14382053 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -2430,6 +2430,7 @@ AC_DEFUN([gl_UTIMENS], [ dnl Prerequisites of lib/utimens.c. AC_REQUIRE([gl_TIMESPEC]) + AC_REQUIRE([gl_FUNC_UTIMES]) AC_REQUIRE([jm_CHECK_TYPE_STRUCT_TIMESPEC]) AC_REQUIRE([jm_CHECK_TYPE_STRUCT_UTIMBUF]) AC_CHECK_FUNCS_ONCE(utime) @@ -2521,6 +2522,53 @@ AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC], ] ) +# See if we need to work around bugs in glibc's implementation of utimes +# from around July/August 2003. +# First, there was a bug that would make utimes set mtime and atime +# to zero (1970-01-01) unconditionally. +# Then, there is/was code to round rather than truncate. +# +# From Jim Meyering, with suggestions from Paul Eggert. + +AC_DEFUN([gl_FUNC_UTIMES], +[ + AC_CACHE_CHECK([determine whether the utimes function works], + gl_cv_func_working_utimes, + [ + AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/time.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdio.h> +#include <utime.h> + +int +main () +{ + static struct timeval timeval[2] = {{9, 10}, {999999, 999999}}; + struct stat sbuf; + char const *file = "x"; + FILE *f; + + exit ( ! ((f = fopen (file, "w")) + && fclose (f) == 0 + && utimes (file, timeval) == 0 + && lstat (file, &sbuf) == 0 + && sbuf.st_atime == timeval[0].tv_sec + && sbuf.st_mtime == timeval[1].tv_sec) ); +} + ]])], + [gl_cv_func_working_utimes=yes], + [gl_cv_func_working_utimes=no], + [gl_cv_func_working_utimes=no])]) + + if test $gl_cv_func_working_utimes = yes; then + AC_DEFINE([HAVE_WORKING_UTIMES], 1, [Define if utimes works properly. ]) + fi +]) + #serial 5 dnl A replacement for autoconf's macro by the same name. This version diff --git a/config.hin b/config.hin index 5377ae1b4..fb8e14dc5 100644 --- a/config.hin +++ b/config.hin @@ -1121,6 +1121,9 @@ /* Define if readdir is found to work properly in some unusual cases. */ #undef HAVE_WORKING_READDIR +/* Define if utimes works properly. */ +#undef HAVE_WORKING_UTIMES + /* Define to 1 if the system has the type `_Bool'. */ #undef HAVE__BOOL |