summaryrefslogtreecommitdiff
path: root/source3/configure.in
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-02-10 01:43:33 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:10:01 -0500
commit687e5be25e6090cf73867c3e08dab6a381c0adbc (patch)
tree69f3b79fc39b88b7e0843b9019099e70915dd5c1 /source3/configure.in
parente97ad44d55895d6f5d269b2c316329cbf66e15ac (diff)
downloadsamba-687e5be25e6090cf73867c3e08dab6a381c0adbc.tar.gz
samba-687e5be25e6090cf73867c3e08dab6a381c0adbc.tar.bz2
samba-687e5be25e6090cf73867c3e08dab6a381c0adbc.zip
r13423: Write wrapper functions (and configure tests) so we can
always assume we can get a struct timespec out of a stat struct. This will allow us to portably move to nsec timestamps on files and directories in the file server code in future. Jeremy. (This used to be commit 07132d8796a08aa71d6719cb07b5b2c999930632)
Diffstat (limited to 'source3/configure.in')
-rw-r--r--source3/configure.in39
1 files changed, 39 insertions, 0 deletions
diff --git a/source3/configure.in b/source3/configure.in
index 6dedbd3441..9774479acb 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -1395,6 +1395,45 @@ if test x"$samba_stat_hires" = x"yes" ; then
[whether struct stat has sub-second timestamps])
fi
+AC_CACHE_CHECK([whether struct stat has sub-second timestamps without struct timespec], samba_stat_hires_notimespec,
+ [
+ AC_TRY_COMPILE(
+ [
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+ ],
+ [
+ struct timespec t;
+ struct stat s = {0};
+ t.tv_sec = s.st_mtime;
+ t.tv_nsec = s.st_mtimensec;
+ t.tv_sec = s.st_ctime;
+ t.tv_nsec = s.st_ctimensec;
+ t.tv_sec = s.st_atime;
+ t.tv_nsec = s.st_atimensec;
+ ],
+ samba_stat_hires=yes, samba_stat_hires=no)
+ ])
+
+if test x"$samba_stat_hires_notimespec" = x"yes" ; then
+ AC_DEFINE(HAVE_STAT_ST_MTIMENSEC, 1, [whether struct stat contains st_mtimensec])
+ AC_DEFINE(HAVE_STAT_ST_ATIMENSEC, 1, [whether struct stat contains st_atimensec])
+ AC_DEFINE(HAVE_STAT_ST_CTIMENSEC, 1, [whether struct stat contains st_ctimensec])
+ AC_DEFINE(HAVE_STAT_HIRES_TIMESTAMPS, 1,
+ [whether struct stat has sub-second timestamps without struct timespec])
+fi
+
#####################################
# we might need the resolv library on some systems
AC_CHECK_LIB(resolv, dn_expand)