Skip to content

Commit

Permalink
Remove HAVE_IOEO checks from CMake (HDFGroup#4160)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
derobins authored and brtnfld committed Mar 18, 2024
1 parent 095d16b commit 1265d4b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 77 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
65 changes: 8 additions & 57 deletions config/cmake/ConfigureChecks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
#-----------------------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
18 changes: 0 additions & 18 deletions config/cmake/HDFTests.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,21 +126,3 @@ main(void)
#endif
}
#endif

#ifdef HAVE_IOEO

#include <windows.h>
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 */

0 comments on commit 1265d4b

Please sign in to comment.