diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index f290a6f1..e18965a5 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -65,6 +65,8 @@ check_include_file(arpa/inet.h HAVE_ARPA_INET_H) check_include_file(byteswap.h HAVE_BYTESWAP_H) if (WIN32) + check_include_file(io.h HAVE_IO_H) + check_include_files("winsock2.h;ws2tcpip.h;wspiapi.h" HAVE_WSPIAPI_H) if (NOT HAVE_WSPIAPI_H) message(STATUS "WARNING: Without wspiapi.h, this build will only work on Windows XP and newer versions") diff --git a/config.h.cmake b/config.h.cmake index be8e9ee2..dd54d5db 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -38,6 +38,9 @@ /* 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_IO_H 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_TERMIOS_H 1 diff --git a/src/connector.c b/src/connector.c index b2f03abd..54e85241 100644 --- a/src/connector.c +++ b/src/connector.c @@ -27,7 +27,7 @@ #define CHUNKSIZE 4096 #ifdef _WIN32 -# if _MSC_VER >= 1400 +# ifdef HAVE_IO_H # include # undef open # define open _open @@ -37,7 +37,7 @@ # define read _read # undef unlink # define unlink _unlink -# endif /* _MSC_VER */ +# endif /* HAVE_IO_H */ #endif struct ssh_connector_struct { diff --git a/src/misc.c b/src/misc.c index a3aa1b93..fe62b448 100644 --- a/src/misc.c +++ b/src/misc.c @@ -59,9 +59,9 @@ #include #include -#if _MSC_VER >= 1400 -# include -#endif /* _MSC_VER */ +#ifdef HAVE_IO_H +#include +#endif /* HAVE_IO_H */ #endif /* _WIN32 */ diff --git a/src/pki.c b/src/pki.c index 1469a68d..36e3c0cd 100644 --- a/src/pki.c +++ b/src/pki.c @@ -41,7 +41,7 @@ #include #ifdef _WIN32 -# if _MSC_VER >= 1400 +# ifdef HAVE_IO_H # include # undef open # define open _open @@ -51,7 +51,7 @@ # define read _read # undef unlink # define unlink _unlink -# endif /* _MSC_VER */ +# endif /* HAVE_IO_H */ #endif #include "libssh/libssh.h"