From 68e8c0e62724b2a450e30f2becdcc9452ac0abb4 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Sat, 16 Mar 2024 12:01:24 -0700 Subject: [PATCH] Remove HAVE_IOEO checks from CMake (#4160) This was intended to check for thread-safety functionality on Windows. The required functionality has been standard since Windows Vista, so these checks can be removed. --- CMakeLists.txt | 4 +- config/cmake/ConfigureChecks.cmake | 65 ++++-------------------------- config/cmake/HDFTests.c | 18 --------- 3 files changed, 10 insertions(+), 77 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb8b596b7d..81a6e96b6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -919,8 +919,8 @@ if (HDF5_ENABLE_THREADSAFE) message (VERBOSE " **** Allowing unsupported HL and thread-safety options **** ") endif () endif () - if (H5_HAVE_IOEO) - message (VERBOSE " **** Win32 threads requires WINVER>=0x600 (Windows Vista/7/8) **** ") + if (WIN32) + # When Win32 is available, we use those threads set (H5_HAVE_WIN_THREADS 1) else () if (NOT H5_HAVE_PTHREAD_H) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 86a96cead0..2905fe9ad0 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -261,6 +261,13 @@ endif () # # https://docs.oracle.com/cd/E23824_01/html/821-1474/lfcompile-5.html +# MinGW and Cygwin +if (MINGW OR CYGWIN) + set (CMAKE_REQUIRED_DEFINITIONS + "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE" + ) +endif () + #----------------------------------------------------------------------------- # Check the size in bytes of all the int and float types #----------------------------------------------------------------------------- @@ -326,7 +333,7 @@ if (MINGW OR NOT WINDOWS) endif () HDF_CHECK_TYPE_SIZE (off_t ${HDF_PREFIX}_SIZEOF_OFF_T) -HDF_CHECK_TYPE_SIZE (time_t ${HDF_PREFIX}_SIZEOF_TIME_T) +HDF_CHECK_TYPE_SIZE (time_t ${HDF_PREFIX}_SIZEOF_TIME_T) #----------------------------------------------------------------------------- # Extra C99 types @@ -439,62 +446,6 @@ if (MINGW OR NOT WINDOWS) endforeach () endif () -#----------------------------------------------------------------------------- -# Check if InitOnceExecuteOnce is available -#----------------------------------------------------------------------------- -if (WINDOWS) - if (NOT HDF_NO_IOEO_TEST) - message (VERBOSE "Checking for InitOnceExecuteOnce:") - if (NOT DEFINED ${HDF_PREFIX}_HAVE_IOEO) - if (LARGEFILE) - set (CMAKE_REQUIRED_DEFINITIONS - "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE" - ) - endif () - set (MACRO_CHECK_FUNCTION_DEFINITIONS "-DHAVE_IOEO ${CMAKE_REQUIRED_FLAGS}") - if (CMAKE_REQUIRED_INCLUDES) - set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - else () - set (CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) - endif () - - TRY_RUN(HAVE_IOEO_EXITCODE HAVE_IOEO_COMPILED - ${CMAKE_BINARY_DIR} - ${HDF_RESOURCES_DIR}/HDFTests.c - COMPILE_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} ${MACRO_CHECK_FUNCTION_DEFINITIONS}" - LINK_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}" - CMAKE_FLAGS "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES} -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}" - COMPILE_OUTPUT_VARIABLE OUTPUT - ) - # if it did not compile make the return value fail code of 1 - if (NOT HAVE_IOEO_COMPILED) - set (HAVE_IOEO_EXITCODE 1) - endif () - # if the return value was 0 then it worked - if ("${HAVE_IOEO_EXITCODE}" EQUAL 0) - set (${HDF_PREFIX}_HAVE_IOEO 1 CACHE INTERNAL "Test InitOnceExecuteOnce") - message (VERBOSE "Performing Test InitOnceExecuteOnce - Success") - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing C SOURCE FILE Test InitOnceExecuteOnce succeeded with the following output:\n" - "${OUTPUT}\n" - "Return value: ${HAVE_IOEO}\n") - else () - if (CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN") - set (${HDF_PREFIX}_HAVE_IOEO "${HAVE_IOEO_EXITCODE}") - else () - set (${HDF_PREFIX}_HAVE_IOEO "" CACHE INTERNAL "Test InitOnceExecuteOnce") - endif () - - message (VERBOSE "Performing Test InitOnceExecuteOnce - Failed") - file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Performing InitOnceExecuteOnce Test failed with the following output:\n" - "${OUTPUT}\n" - "Return value: ${HAVE_IOEO_EXITCODE}\n") - endif () - endif () - endif () -endif () - # ---------------------------------------------------------------------- # Set the flag to indicate that the machine can handle converting # denormalized floating-point values. diff --git a/config/cmake/HDFTests.c b/config/cmake/HDFTests.c index 3d16721346..73f7739bac 100644 --- a/config/cmake/HDFTests.c +++ b/config/cmake/HDFTests.c @@ -126,21 +126,3 @@ main(void) #endif } #endif - -#ifdef HAVE_IOEO - -#include -typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); -int main () -{ - PGNSI pGNSI; - - pGNSI = (PGNSI) GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "InitOnceExecuteOnce"); - - if (NULL == pGNSI) - return 1; - else - return 0; -} - -#endif /* HAVE_IOEO */