summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2020-01-14 09:42:52 +1100
committerDarren Tucker <dtucker@dtucker.net>2020-01-14 14:28:01 +1100
commite0cedcad51fe02683943bf4f1ad2961aa3f35313 (patch)
treecb8a3197f708f4b1b51809661ec885689521f2bc /configure.ac
parentacaf9e058594310001ce64468ed2923dc6323e81 (diff)
Improve search for 'struct timespec'.
Make struct timespec test consistent with existing timeval test. Include time.h for timespec in compat header where required.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac25
1 files changed, 24 insertions, 1 deletions
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
4025 [define if you have struct addrinfo data type]) 4025 [define if you have struct addrinfo data type])
4026fi 4026fi
4027 4027
4028AC_HEADER_TIME
4029
4028AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [ 4030AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
4029 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]], 4031 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/time.h> ]],
4030 [[ struct timeval tv; tv.tv_sec = 1;]])], 4032 [[ struct timeval tv; tv.tv_sec = 1;]])],
@@ -4037,7 +4039,28 @@ if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
4037 have_struct_timeval=1 4039 have_struct_timeval=1
4038fi 4040fi
4039 4041
4040AC_CHECK_TYPES([struct timespec]) 4042AC_CACHE_CHECK([for struct timespec], ac_cv_have_struct_timespec, [
4043 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
4044 #ifdef TIME_WITH_SYS_TIME
4045 # include <sys/time.h>
4046 # include <time.h>
4047 #else
4048 # ifdef HAVE_SYS_TIME_H
4049 # include <sys/time.h>
4050 # else
4051 # include <time.h>
4052 # endif
4053 #endif
4054 ]],
4055 [[ struct timespec ts; ts.tv_sec = 1;]])],
4056 [ ac_cv_have_struct_timespec="yes" ],
4057 [ ac_cv_have_struct_timespec="no"
4058 ])
4059])
4060if test "x$ac_cv_have_struct_timespec" = "xyes" ; then
4061 AC_DEFINE([HAVE_STRUCT_TIMESPEC], [1], [define if you have struct timespec])
4062 have_struct_timespec=1
4063fi
4041 4064
4042# We need int64_t or else certain parts of the compile will fail. 4065# We need int64_t or else certain parts of the compile will fail.
4043if test "x$ac_cv_have_int64_t" = "xno" && \ 4066if test "x$ac_cv_have_int64_t" = "xno" && \