[openssh-commits] [openssh] 01/03: Improve search for 'struct timespec'.

git+noreply at mindrot.org git+noreply at mindrot.org
Tue Jan 14 14:48:54 AEDT 2020


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit e0cedcad51fe02683943bf4f1ad2961aa3f35313
Author: Darren Tucker <dtucker at dtucker.net>
Date:   Tue Jan 14 09:42:52 2020 +1100

    Improve search for 'struct timespec'.
    
    Make struct timespec test consistent with existing timeval test.
    Include time.h for timespec in compat header where required.
---
 configure.ac              | 25 ++++++++++++++++++++++++-
 openbsd-compat/bsd-misc.h |  2 ++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index a33acac8..b1b3bdac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4025,6 +4025,8 @@ if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
 		[define if you have struct addrinfo data type])
 fi
 
+AC_HEADER_TIME
+
 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
 	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
 	[[ struct timeval tv; tv.tv_sec = 1;]])],
@@ -4037,7 +4039,28 @@ if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
 	have_struct_timeval=1
 fi
 
-AC_CHECK_TYPES([struct timespec])
+AC_CACHE_CHECK([for struct timespec], ac_cv_have_struct_timespec, [
+	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+    #ifdef TIME_WITH_SYS_TIME
+    # include <sys/time.h>
+    # include <time.h>
+    #else
+    # ifdef HAVE_SYS_TIME_H
+    #  include <sys/time.h>
+    # else
+    #  include <time.h>
+    # endif
+    #endif
+	]],
+	[[ struct timespec ts; ts.tv_sec = 1;]])],
+	[ ac_cv_have_struct_timespec="yes" ],
+	[ ac_cv_have_struct_timespec="no"
+	])
+])
+if test "x$ac_cv_have_struct_timespec" = "xyes" ; then
+	AC_DEFINE([HAVE_STRUCT_TIMESPEC], [1], [define if you have struct timespec])
+	have_struct_timespec=1
+fi
 
 # We need int64_t or else certain parts of the compile will fail.
 if test "x$ac_cv_have_int64_t" = "xno" && \
diff --git a/openbsd-compat/bsd-misc.h b/openbsd-compat/bsd-misc.h
index 7bf7b048..3a7dd6f4 100644
--- a/openbsd-compat/bsd-misc.h
+++ b/openbsd-compat/bsd-misc.h
@@ -88,10 +88,12 @@ struct timespec {
 #endif /* !HAVE_STRUCT_TIMESPEC */
 
 #if !defined(HAVE_NANOSLEEP) && !defined(HAVE_NSLEEP)
+# include <time.h>
 int nanosleep(const struct timespec *, struct timespec *);
 #endif
 
 #ifndef HAVE_UTIMENSAT
+# include <time.h>
 /* start with the high bits and work down to minimise risk of overlap */
 # ifndef AT_SYMLINK_NOFOLLOW
 #  define AT_SYMLINK_NOFOLLOW 0x80000000

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list