From 528b9c5323c61e65877c5fa0dd0f5444edccc981 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sun, 6 Nov 2016 11:52:12 +0100 Subject: cmake: Correctly check for sys/[u]time.h Signed-off-by: Andreas Schneider --- ConfigureChecks.cmake | 1 + config.h.cmake | 3 +++ include/libssh/priv.h | 4 ---- src/log.c | 7 ++++--- src/misc.c | 8 ++++---- src/pcap.c | 4 +++- tests/client/torture_connect.c | 2 ++ 7 files changed, 17 insertions(+), 12 deletions(-) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 56822f35..f290a6f1 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -59,6 +59,7 @@ check_include_file(unistd.h HAVE_UNISTD_H) check_include_file(util.h HAVE_UTIL_H) check_include_file(libutil.h HAVE_LIBUTIL_H) check_include_file(sys/time.h HAVE_SYS_TIME_H) +check_include_file(sys/utime.h HAVE_SYS_UTIME_H) check_include_file(sys/param.h HAVE_SYS_PARAM_H) check_include_file(arpa/inet.h HAVE_ARPA_INET_H) check_include_file(byteswap.h HAVE_BYTESWAP_H) diff --git a/config.h.cmake b/config.h.cmake index 8d9bfd21..be8e9ee2 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -35,6 +35,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_SYS_TIME_H 1 +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_UTIME_H 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_TERMIOS_H 1 diff --git a/include/libssh/priv.h b/include/libssh/priv.h index da07d93a..2e41225f 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -185,10 +185,6 @@ int gettimeofday(struct timeval *__p, void *__t); # define LIBSSH_MEM_PROTECTION #endif -#ifdef HAVE_SYS_TIME_H -#include -#endif - /* forward declarations */ struct ssh_common_struct; struct ssh_kex_struct; diff --git a/src/log.c b/src/log.c index a72dd412..79afbce7 100644 --- a/src/log.c +++ b/src/log.c @@ -24,11 +24,12 @@ #include #include #include -#ifndef _WIN32 +#ifdef HAVE_SYS_TIME_H #include -#else +#endif /* HAVE_SYS_TIME_H */ +#ifdef HAVE_SYS_UTIME_H #include -#endif +#endif /* HAVE_SYS_TIME_H */ #include #include "libssh/priv.h" diff --git a/src/misc.c b/src/misc.c index 64cda47b..a3aa1b93 100644 --- a/src/misc.c +++ b/src/misc.c @@ -33,10 +33,6 @@ #include #include -#ifdef HAVE_SYS_TIME_H -#include -#endif /* HAVE_SYS_TIME_H */ - #endif /* _WIN32 */ #include @@ -47,6 +43,10 @@ #include #include #include +#ifdef HAVE_SYS_TIME_H +#include +#endif /* HAVE_SYS_TIME_H */ + #ifdef _WIN32 diff --git a/src/pcap.c b/src/pcap.c index 043326b2..bfb237ba 100644 --- a/src/pcap.c +++ b/src/pcap.c @@ -29,9 +29,11 @@ #include #else #include -#include #include #endif +#ifdef HAVE_SYS_TIME_H +#include +#endif /* HAVE_SYS_TIME_H */ #include #include diff --git a/tests/client/torture_connect.c b/tests/client/torture_connect.c index 212fc6b1..45e32b4c 100644 --- a/tests/client/torture_connect.c +++ b/tests/client/torture_connect.c @@ -23,7 +23,9 @@ #include "torture.h" #include +#ifdef HAVE_SYS_TIME_H #include +#endif /* HAVE_SYS_TIME_H */ #include #include #include -- cgit v1.2.3