diff --git a/configure.ac b/configure.ac index a33acac85..b1b3bdacf 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 ]], [[ 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 + # include + #else + # ifdef HAVE_SYS_TIME_H + # include + # else + # include + # 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 7bf7b048a..3a7dd6f4c 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 int nanosleep(const struct timespec *, struct timespec *); #endif #ifndef HAVE_UTIMENSAT +# include /* start with the high bits and work down to minimise risk of overlap */ # ifndef AT_SYMLINK_NOFOLLOW # define AT_SYMLINK_NOFOLLOW 0x80000000