From: Sami Kerola Date: Sun, 9 Oct 2016 21:21:34 +0000 (+0100) Subject: build-sys: use proper check to find if time_t is defined X-Git-Tag: v0.88~21^2^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f6b6239f6344f27f74c09b2f6cacd01791b5cc2;p=thirdparty%2Fmtr.git build-sys: use proper check to find if time_t is defined The time_t check feels unlikely to be necessary, but perhaps it is useful. At least it used to be back in 2004. Reference: 3210151c58dd98731816b57b0e375250aeb8fb6f --- diff --git a/configure.ac b/configure.ac index 504bfcb..11fece6 100644 --- a/configure.ac +++ b/configure.ac @@ -163,6 +163,10 @@ AC_CHECK_TYPE([socklen_t], #include #endif]]) +AC_CHECK_TYPES([time_t], [], [], [[ +#include +]]) + # Add C flags to display more warnings AC_MSG_CHECKING([for C flags to get more warnings]) ac_save_CFLAGS="$CFLAGS" diff --git a/curses.c b/curses.c index 16e4916..ca758dd 100644 --- a/curses.c +++ b/curses.c @@ -18,19 +18,19 @@ #include "config.h" +#include "mtr.h" + #include #include #include #include #include +#include /* MacOSX may need this before socket.h...*/ #if defined(HAVE_SYS_TYPES_H) # include -#else -/* If a system doesn't have sys/types.h, lets hope that time_t is an int */ -# define time_t int #endif #include @@ -64,7 +64,6 @@ #include "display.h" #include "utils.h" -#include enum { NUM_FACTORS = 8 }; static double factors[NUM_FACTORS]; diff --git a/mtr.h b/mtr.h index 524bba8..2487ad6 100644 --- a/mtr.h +++ b/mtr.h @@ -20,6 +20,8 @@ #ifndef MTR_MTR_H #define MTR_MTR_H +#include "config.h" + #include #include #include @@ -35,6 +37,10 @@ typedef struct in6_addr ip_t; typedef struct in_addr ip_t; #endif +#ifndef HAVE_TIME_T +typedef int time_t; +#endif + /* The __unused__ attribute was added in gcc 3.2.7. */ #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) # define ATTRIBUTE_UNUSED __attribute__((__unused__))