From 8e2fc4a2e2325a006d42b1df5c339549cdd2cb94 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Tue, 6 Jul 2021 10:39:15 -0700 Subject: Remove checks for winsock2.h (#813) This is only needed on Windows and always available, so there's no need to check for it. --- config/cmake/H5pubconf.h.in | 3 --- config/cmake_ext_mod/ConfigureChecks.cmake | 6 ------ configure.ac | 2 -- src/H5private.h | 13 ++++++------- src/H5system.c | 6 +++--- tools/lib/io_timer.h | 2 +- 6 files changed, 10 insertions(+), 22 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 35ff8cf..5a94be3 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -388,9 +388,6 @@ /* Define if your system has window style path name. */ #cmakedefine H5_HAVE_WINDOW_PATH @H5_HAVE_WINDOW_PATH@ -/* Define to 1 if you have the header file. */ -#cmakedefine H5_HAVE_WINSOCK2_H @H5_HAVE_WINSOCK2_H@ - /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_ZLIB_H @H5_HAVE_ZLIB_H@ diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index fca38a4..27c7045 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -53,7 +53,6 @@ if (MINGW) set (${HDF_PREFIX}_HAVE_MINGW 1) set (WINDOWS 1) # MinGW tries to imitate Windows set (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1") - set (${HDF_PREFIX}_HAVE_WINSOCK2_H 1) set (__USE_MINGW_ANSI_STDIO 1) endif () @@ -117,11 +116,6 @@ CHECK_INCLUDE_FILE_CONCAT ("features.h" ${HDF_PREFIX}_HAVE_FEATURES_H) CHECK_INCLUDE_FILE_CONCAT ("dirent.h" ${HDF_PREFIX}_HAVE_DIRENT_H) CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) -# Windows -if (NOT CYGWIN) - CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" ${HDF_PREFIX}_HAVE_WINSOCK2_H) -endif () - CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" ${HDF_PREFIX}_HAVE_GLOBUS_COMMON_H) CHECK_INCLUDE_FILE_CONCAT ("pdb.h" ${HDF_PREFIX}_HAVE_PDB_H) CHECK_INCLUDE_FILE_CONCAT ("pthread.h" ${HDF_PREFIX}_HAVE_PTHREAD_H) diff --git a/configure.ac b/configure.ac index 3dd7328..55ea12c 100644 --- a/configure.ac +++ b/configure.ac @@ -1240,8 +1240,6 @@ case $host_os in esac ## Windows -## The winsock header is needed for gethostname -AC_CHECK_HEADERS([winsock2.h]) case "`uname`" in MINGW*) AC_HAVE_LIBRARY([ws2_32]) diff --git a/src/H5private.h b/src/H5private.h index a5c6efd..f29ec02 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -106,22 +106,21 @@ #define H5_DEFAULT_VOL H5VL_NATIVE #ifdef H5_HAVE_WIN32_API + /* The following two defines must be before any windows headers are included */ #define WIN32_LEAN_AND_MEAN /* Exclude rarely-used stuff from Windows headers */ #define NOGDI /* Exclude Graphic Display Interface macros */ -#ifdef H5_HAVE_WINSOCK2_H -#include -#endif +#include + +#include /* For _getcwd() */ +#include /* POSIX I/O */ +#include /* For GetUserName() */ #ifdef H5_HAVE_THREADSAFE #include /* For _beginthread() */ #endif -#include -#include /* For _getcwd() */ -#include /* POSIX I/O */ - #endif /*H5_HAVE_WIN32_API*/ #ifndef F_OK diff --git a/src/H5system.c b/src/H5system.c index 0849373..eba8341 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -365,7 +365,7 @@ Wsetenv(const char *name, const char *value, int overwrite) return (int)_putenv_s(name, value); } /* end Wsetenv() */ -#ifdef H5_HAVE_WINSOCK2_H +#ifdef H5_HAVE_WIN32_API #pragma comment(lib, "advapi32.lib") #endif @@ -450,12 +450,12 @@ char * Wgetlogin(void) { -#ifdef H5_HAVE_WINSOCK2_H +#ifdef H5_HAVE_WIN32_API DWORD bufferCount = WloginBuffer_count; if (GetUserName(Wlogin_buffer, &bufferCount) != 0) return (Wlogin_buffer); else -#endif /* H5_HAVE_WINSOCK2_H */ +#endif return NULL; } diff --git a/tools/lib/io_timer.h b/tools/lib/io_timer.h index 75db660..0b0f0bb 100644 --- a/tools/lib/io_timer.h +++ b/tools/lib/io_timer.h @@ -22,7 +22,7 @@ #include #endif -#ifdef H5_HAVE_WINSOCK2_H +#ifdef H5_HAVE_WIN32_API #include #endif -- cgit v0.12