summaryrefslogtreecommitdiff
path: root/source3/configure.in
diff options
context:
space:
mode:
authorBjörn Jacke <bj@sernet.de>2009-02-11 21:19:01 +0100
committerVolker Lendecke <vl@samba.org>2009-02-12 13:00:44 +0100
commit263b798db9bd6c26a51fbf38e4d5d693d234fa5f (patch)
tree291241189f9c636fa1ec4f6ef5cee4ab4b9b386e /source3/configure.in
parentaff48fba1825b2838818ab2f1d037fae32ae132a (diff)
downloadsamba-263b798db9bd6c26a51fbf38e4d5d693d234fa5f.tar.gz
samba-263b798db9bd6c26a51fbf38e4d5d693d234fa5f.tar.bz2
samba-263b798db9bd6c26a51fbf38e4d5d693d234fa5f.zip
tidy up timestamp checks
AC_CHECK_MEMBERS should be a sufficient check, there's no need to do manual compile tests. We can also assume that we have ctime and atime members when we have the mtime member.
Diffstat (limited to 'source3/configure.in')
-rw-r--r--source3/configure.in300
1 files changed, 14 insertions, 286 deletions
diff --git a/source3/configure.in b/source3/configure.in
index 8e49074533..46e863a14d 100644
--- a/source3/configure.in
+++ b/source3/configure.in
@@ -1299,301 +1299,29 @@ fi
#################################################
# Check whether struct stat has timestamps with sub-second resolution.
-# At least IRIX and Solaris have these. FREEBSD does as well,
-# but with different members
#
-# We check that
-# all of st_mtim, st_atim and st_ctim exist
-# all of the members are in fact of type struct timespec
-#
-# There is some conflicting standards weirdness about whether we should use
-# "struct timespec" or "timespec_t". Linux doesn't have timespec_t, so we
-# prefer struct timespec.
-AC_CACHE_CHECK([whether struct stat has timespec timestamps],
- samba_cv_stat_timespec_hires,
- [
- 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 = s.st_mtimespec;
- t = s.st_ctimespec;
- t = s.st_atimespec;
- ],
- samba_cv_stat_timespec_hires=yes, samba_cv_stat_timespec_hires=no)
- ])
-if test x"$samba_cv_stat_timespec_hires" = x"yes" ; then
- AC_DEFINE(HAVE_STAT_ST_MTIMESPEC, 1, [whether struct stat contains st_mtimepec])
- AC_DEFINE(HAVE_STAT_ST_ATIMESPEC, 1, [whether struct stat contains st_atimespec])
- AC_DEFINE(HAVE_STAT_ST_CTIMESPEC, 1, [whether struct stat contains st_ctimespec])
- AC_DEFINE(HAVE_STAT_HIRES_TIMESTAMPS, 1, [whether struct stat has sub-second timestamps])
-fi
-
-
-
-AC_CACHE_CHECK([whether struct stat has sub-second timestamps], samba_cv_stat_hires,
- [
- 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_mtim.tv_sec;
- t.tv_nsec = s.st_mtim.tv_nsec;
- t.tv_sec = s.st_ctim.tv_sec;
- t.tv_nsec = s.st_ctim.tv_nsec;
- t.tv_sec = s.st_atim.tv_sec;
- t.tv_nsec = s.st_atim.tv_nsec;
- ],
- samba_cv_stat_hires=yes, samba_cv_stat_hires=no)
- ])
+samba_cv_stat_hires=no
+AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec], # Linux, Solaris
+ [samba_cv_stat_hires=yes])
+AC_CHECK_MEMBERS([struct stat.st_mtimensec], # BSD, if defined _POSIX_SOURCE
+ [samba_cv_stat_hires=yes])
+AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec], # BSD, if not defined _POSIX_SOURCE
+ [samba_cv_stat_hires=yes])
+AC_CHECK_MEMBERS([struct stat.st_mtime_n], # AIX
+ [samba_cv_stat_hires=yes])
+AC_CHECK_MEMBERS([struct stat.st_umtime], # Tru64
+ [samba_cv_stat_hires=yes])
if test x"$samba_cv_stat_hires" = x"yes" ; then
- AC_DEFINE(HAVE_STAT_ST_MTIM, 1, [whether struct stat contains st_mtim])
- AC_DEFINE(HAVE_STAT_ST_ATIM, 1, [whether struct stat contains st_atim])
- AC_DEFINE(HAVE_STAT_ST_CTIM, 1, [whether struct stat contains st_ctim])
AC_DEFINE(HAVE_STAT_HIRES_TIMESTAMPS, 1,
[whether struct stat has sub-second timestamps])
fi
-AC_CACHE_CHECK([whether struct stat has sub-second timestamps without struct timespec suffixed nsec], samba_cv_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_cv_stat_hires_notimespec=yes, samba_cv_stat_hires_notimespec=no)
- ])
-
-if test x"$samba_cv_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 suffixed nsec])
-fi
-
-dnl AIX stype sub-second timestamps:
-AC_CACHE_CHECK([whether struct stat has sub-second timestamps without struct timespec suffixed _n], samba_cv_stat_hires_notimespec_n,
- [
- 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_mtime_n;
- t.tv_sec = s.st_ctime;
- t.tv_nsec = s.st_ctime_n;
- t.tv_sec = s.st_atime;
- t.tv_nsec = s.st_atime_n;
- ],
- samba_cv_stat_hires_notimespec_n=yes, samba_cv_stat_hires_notimespec_n=no)
- ])
-
-if test x"$samba_cv_stat_hires_notimespec_n" = x"yes" ; then
- AC_DEFINE(HAVE_STAT_ST_MTIME_N, 1, [whether struct stat contains st_mtime_n])
- AC_DEFINE(HAVE_STAT_ST_ATIME_N, 1, [whether struct stat contains st_atime_n])
- AC_DEFINE(HAVE_STAT_ST_CTIME_N, 1, [whether struct stat contains st_ctime_n])
- AC_DEFINE(HAVE_STAT_HIRES_TIMESTAMPS, 1,
- [whether struct stat has sub-second timestamps without struct timespec suffixed _n])
-fi
-
-dnl Tru64 has _micro_second_ resolution:
-AC_CACHE_CHECK([whether struct stat has sub-second timestamps in st_uXtime], samba_cv_stat_hires_uxtime,
- [
- 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_umtime * 1000;
- t.tv_sec = s.st_ctime;
- t.tv_nsec = s.st_uctime * 1000;
- t.tv_sec = s.st_atime;
- t.tv_nsec = s.st_uatime * 1000;
- ],
- samba_cv_stat_hires_uxtime=yes, samba_cv_stat_hires_uxtime=no)
- ])
-
-if test x"$samba_cv_stat_hires_uxtime" = x"yes" ; then
- AC_DEFINE(HAVE_STAT_ST_UMTIME, 1, [whether struct stat contains st_umtime])
- AC_DEFINE(HAVE_STAT_ST_UATIME, 1, [whether struct stat contains st_uatime])
- AC_DEFINE(HAVE_STAT_ST_UCTIME, 1, [whether struct stat contains st_uctime])
- AC_DEFINE(HAVE_STAT_HIRES_TIMESTAMPS, 1,
- [whether struct stat has sub-second timestamps in st_uXtime])
-fi
-
-AC_CACHE_CHECK([whether struct stat has st_birthtimespec], samba_cv_stat_st_birthtimespec,
- [
- 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 = s.st_birthtimespec;
- ],
- samba_cv_stat_st_birthtimespec=yes, samba_cv_stat_st_birthtimespec=no)
- ])
-
-if test x"$samba_cv_stat_st_birthtimespec" = x"yes" ; then
- AC_DEFINE(HAVE_STAT_ST_BIRTHTIMESPEC, 1, [whether struct stat contains st_birthtimespec])
-fi
-
-AC_CACHE_CHECK([whether struct stat has st_birthtimensec], samba_cv_stat_st_birthtimensec,
- [
- 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_nsec = s.st_birthtimensec;
- ],
- samba_cv_stat_st_birthtimensec=yes, samba_cv_stat_st_birthtimensec=no)
- ])
-
-if test x"$samba_cv_stat_st_birthtimensec" = x"yes" ; then
- AC_DEFINE(HAVE_STAT_ST_BIRTHTIMENSEC, 1, [whether struct stat contains st_birthtimensec])
-fi
+# recent FreeBSD, NetBSD have creation timestamps called birthtime:
+AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec])
+AC_CHECK_MEMBERS([struct stat.st_birthtime], AC_CHECK_MEMBERS([struct stat.st_birthtimensec]))
-AC_CACHE_CHECK([whether struct stat has st_birthtime], samba_cv_stat_st_birthtime,
- [
- 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 time_t t;
- struct stat s = {0};
- t = s.st_birthtime;
- ],
- samba_cv_stat_st_birthtime=yes, samba_cv_stat_st_birthtime=no)
- ])
-
-if test x"$samba_cv_stat_st_birthtime" = x"yes" ; then
- AC_DEFINE(HAVE_STAT_ST_BIRTHTIME, 1, [whether struct stat contains st_birthtime])
-fi
AC_CACHE_CHECK([whether there is DOS flags support in the stat struct], samba_cv_stat_dos_flags,
[