aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2016-11-06 11:52:12 +0100
committerAndreas Schneider <asn@cryptomilk.org>2016-11-06 11:52:12 +0100
commit528b9c5323c61e65877c5fa0dd0f5444edccc981 (patch)
tree978e1a64765f31bb5bb1a7bb365449dab0b060bb
parentfab85b495e1bb023017b8da916d679e52f39c3f4 (diff)
downloadlibssh-528b9c5323c61e65877c5fa0dd0f5444edccc981.tar.gz
libssh-528b9c5323c61e65877c5fa0dd0f5444edccc981.tar.xz
libssh-528b9c5323c61e65877c5fa0dd0f5444edccc981.zip
cmake: Correctly check for sys/[u]time.h
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r--ConfigureChecks.cmake1
-rw-r--r--config.h.cmake3
-rw-r--r--include/libssh/priv.h4
-rw-r--r--src/log.c7
-rw-r--r--src/misc.c8
-rw-r--r--src/pcap.c4
-rw-r--r--tests/client/torture_connect.c2
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 <sys/time.h> header file. */
#cmakedefine HAVE_SYS_TIME_H 1
+/* Define to 1 if you have the <sys/utime.h> header file. */
+#cmakedefine HAVE_SYS_UTIME_H 1
+
/* Define to 1 if you have the <termios.h> 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 <sys/time.h>
-#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 <stdio.h>
#include <stdarg.h>
#include <string.h>
-#ifndef _WIN32
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
-#else
+#endif /* HAVE_SYS_TIME_H */
+#ifdef HAVE_SYS_UTIME_H
#include <sys/utime.h>
-#endif
+#endif /* HAVE_SYS_TIME_H */
#include <time.h>
#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 <netinet/in.h>
#include <arpa/inet.h>
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif /* HAVE_SYS_TIME_H */
-
#endif /* _WIN32 */
#include <limits.h>
@@ -47,6 +43,10 @@
#include <sys/types.h>
#include <ctype.h>
#include <time.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#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 <ws2tcpip.h>
#else
#include <netinet/in.h>
-#include <sys/time.h>
#include <sys/socket.h>
#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif /* HAVE_SYS_TIME_H */
#include <errno.h>
#include <stdlib.h>
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 <libssh/libssh.h>
+#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
+#endif /* HAVE_SYS_TIME_H */
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/types.h>