summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2011-11-13 23:39:54 +0000
committerPaul Smith <psmith@gnu.org>2011-11-13 23:39:54 +0000
commitbfc3e1ca7c0c1504c9873ee1baacce73330b037e (patch)
tree35883fc2128e735d7fb5fa77624a12e99fca104e
parentc7d07fd0b5e0fcbb76480f207fdd64573d50c893 (diff)
downloadgunmake-bfc3e1ca7c0c1504c9873ee1baacce73330b037e.tar.gz
Enable high-resolution timestamps for Darwin (Mac OSX)
Patch provided by Troy Runkel <Troy.Runkel@mathworks.com>
-rw-r--r--ChangeLog6
-rw-r--r--acinclude.m414
-rw-r--r--filedef.h2
3 files changed, 15 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index adcab64..52724d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-11-13 Paul Smith <psmith@gnu.org>
+
+ * acinclude.m4 (AC_STRUCT_ST_MTIM_NSEC): Add support for Darwin.
+ Patch provided by Troy Runkel <Troy.Runkel@mathworks.com>
+ * filedef.h (FILE_TIMESTAMP_STAT_MODTIME): Ditto.
+
2011-09-18 Paul Smith <psmith@gnu.org>
* main.c (main): If we're re-exec'ing and we're the master make,
diff --git a/acinclude.m4 b/acinclude.m4
index 0e56441..6d273e5 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -100,22 +100,24 @@ changequote([,])dnl
dnl ---------------------------------------------------------------------------
dnl From Paul Eggert <eggert@twinsun.com>
+dnl Update for Darwin by Troy Runkel <Troy.Runkel@mathworks.com>
AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC],
- [AC_CACHE_CHECK([for nanoseconds field of struct stat.st_mtim],
+ [AC_CACHE_CHECK([for nanoseconds field of struct stat],
ac_cv_struct_st_mtim_nsec,
[ac_save_CPPFLAGS="$CPPFLAGS"
ac_cv_struct_st_mtim_nsec=no
- # tv_nsec -- the usual case
- # _tv_nsec -- Solaris 2.6, if
+ # st_mtim.tv_nsec -- the usual case
+ # st_mtim._tv_nsec -- Solaris 2.6, if
# (defined _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED == 1
# && !defined __EXTENSIONS__)
- # st__tim.tv_nsec -- UnixWare 2.1.2
- for ac_val in tv_nsec _tv_nsec st__tim.tv_nsec; do
+ # st_mtim.st__tim.tv_nsec -- UnixWare 2.1.2
+ # st_mtimespec.tv_nsec -- Darwin (Mac OSX)
+ for ac_val in st_mtim.tv_nsec st_mtim._tv_nsec st_mtim.st__tim.tv_nsec st_mtimespec.tv_nsec; do
CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/stat.h>
- ], [struct stat s; s.st_mtim.ST_MTIM_NSEC;],
+ ], [struct stat s; s.ST_MTIM_NSEC;],
[ac_cv_struct_st_mtim_nsec=$ac_val; break])
done
CPPFLAGS="$ac_save_CPPFLAGS"
diff --git a/filedef.h b/filedef.h
index 98e3f49..173e753 100644
--- a/filedef.h
+++ b/filedef.h
@@ -118,7 +118,7 @@ void print_file_data_base (void);
#if FILE_TIMESTAMP_HI_RES
# define FILE_TIMESTAMP_STAT_MODTIME(fname, st) \
- file_timestamp_cons (fname, (st).st_mtime, (st).st_mtim.ST_MTIM_NSEC)
+ file_timestamp_cons (fname, (st).st_mtime, (st).ST_MTIM_NSEC)
#else
# define FILE_TIMESTAMP_STAT_MODTIME(fname, st) \
file_timestamp_cons (fname, (st).st_mtime, 0)