summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2011-04-20 18:17:25 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2011-04-20 18:17:25 (GMT)
commit27be7d1e2d95618c72bbefbed54e644b3b2d21ae (patch)
tree340f1389648dbe534a5182edbe32d5a86227f92a /config
parent6b50db00cb90e1bd6854c2713411127161be362d (diff)
downloadhdf5-27be7d1e2d95618c72bbefbed54e644b3b2d21ae.zip
hdf5-27be7d1e2d95618c72bbefbed54e644b3b2d21ae.tar.gz
hdf5-27be7d1e2d95618c72bbefbed54e644b3b2d21ae.tar.bz2
[svn-r20572] Bug #5929: On windows check for existence of InitOnceExecuteOnce for use by threads.
merge from 1.8 r20568
Diffstat (limited to 'config')
-rw-r--r--config/cmake/ConfigureChecks.cmake70
-rw-r--r--config/cmake/HDF5Tests.c42
2 files changed, 90 insertions, 22 deletions
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
index f1883cd..1d76a4a 100644
--- a/config/cmake/ConfigureChecks.cmake
+++ b/config/cmake/ConfigureChecks.cmake
@@ -155,6 +155,7 @@ IF (WINDOWS)
SET (H5_HAVE_WINDOW_PATH 1)
SET (WINDOWS_MAX_BUF (1024 * 1024 * 1024))
SET (H5_DEFAULT_VFD H5FD_WINDOWS)
+ SET (LINK_LIBS ${LINK_LIBS} "kernel32")
ELSE (WINDOWS)
SET (H5_DEFAULT_VFD H5FD_SEC2)
ENDIF (WINDOWS)
@@ -208,7 +209,6 @@ ENDIF (NOT WINDOWS)
CHECK_LIBRARY_EXISTS_CONCAT ("ws2_32" WSAStartup H5_HAVE_LIBWS2_32)
CHECK_LIBRARY_EXISTS_CONCAT ("wsock32" gethostbyname H5_HAVE_LIBWSOCK32)
-#CHECK_LIBRARY_EXISTS_CONCAT ("dl" dlopen H5_HAVE_LIBDL)
CHECK_LIBRARY_EXISTS_CONCAT ("ucb" gethostname H5_HAVE_LIBUCB)
CHECK_LIBRARY_EXISTS_CONCAT ("socket" connect H5_HAVE_LIBSOCKET)
CHECK_LIBRARY_EXISTS ("c" gethostbyname "" NOT_NEED_LIBNSL)
@@ -219,6 +219,9 @@ ENDIF (NOT NOT_NEED_LIBNSL)
SET (USE_INCLUDES "")
+IF (WINDOWS)
+ SET (USE_INCLUDES ${USE_INCLUDES} "windows.h")
+ENDIF (WINDOWS)
#-----------------------------------------------------------------------------
# Check IF header file exists and add it to the list.
#-----------------------------------------------------------------------------
@@ -275,6 +278,7 @@ IF (H5_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED)
CHECK_INCLUDE_FILE_CXX ("stdint.h" H5_HAVE_STDINT_H_CXX)
IF (NOT H5_HAVE_STDINT_H_CXX)
SET (H5_HAVE_STDINT_H "" CACHE INTERNAL "Have includes HAVE_STDINT_H")
+ SET (USE_INCLUDES ${USE_INCLUDES} "stdint.h")
ENDIF (NOT H5_HAVE_STDINT_H_CXX)
ENDIF (H5_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED)
@@ -579,6 +583,70 @@ IF (NOT WINDOWS)
ENDIF (NOT WINDOWS)
#-----------------------------------------------------------------------------
+# Check if InitOnceExecuteOnce is available
+#-----------------------------------------------------------------------------
+IF (WINDOWS)
+ MESSAGE (STATUS "Checking for InitOnceExecuteOnce:")
+ IF("${H5_HAVE_IOEO}" MATCHES "^${H5_HAVE_IOEO}$")
+ IF (LARGEFILE)
+ SET (CMAKE_REQUIRED_DEFINITIONS
+ "${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE"
+ )
+ ENDIF (LARGEFILE)
+ SET(MACRO_CHECK_FUNCTION_DEFINITIONS
+ "-DHAVE_IOEO ${CMAKE_REQUIRED_FLAGS}")
+ IF(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
+ "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
+ ELSE(CMAKE_REQUIRED_LIBRARIES)
+ SET(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES)
+ ENDIF(CMAKE_REQUIRED_LIBRARIES)
+ IF(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES
+ "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+ ELSE(CMAKE_REQUIRED_INCLUDES)
+ SET(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES)
+ ENDIF(CMAKE_REQUIRED_INCLUDES)
+
+ TRY_RUN(HAVE_IOEO_EXITCODE HAVE_IOEO_COMPILED
+ ${CMAKE_BINARY_DIR}
+ ${HDF5_RESOURCES_DIR}/HDF5Tests.c
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+ -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}
+ "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
+ "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"
+ 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(NOT HAVE_IOEO_COMPILED)
+ # if the return value was 0 then it worked
+ IF("${HAVE_IOEO_EXITCODE}" EQUAL 0)
+ SET(H5_HAVE_IOEO 1 CACHE INTERNAL "Test InitOnceExecuteOnce")
+ MESSAGE(STATUS "Performing Test InitOnceExecuteOnce - Success")
+ FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Performing C SOURCE FILE Test InitOnceExecuteOnce succeded with the following output:\n"
+ "${OUTPUT}\n"
+ "Return value: ${HAVE_IOEO}\n")
+ ELSE("${HAVE_IOEO_EXITCODE}" EQUAL 0)
+ IF(CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN")
+ SET(H5_HAVE_IOEO "${HAVE_IOEO_EXITCODE}")
+ ELSE(CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN")
+ SET(H5_HAVE_IOEO "" CACHE INTERNAL "Test InitOnceExecuteOnce")
+ ENDIF(CMAKE_CROSSCOMPILING AND "${HAVE_IOEO_EXITCODE}" MATCHES "FAILED_TO_RUN")
+
+ MESSAGE(STATUS "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("${HAVE_IOEO_EXITCODE}" EQUAL 0)
+ ENDIF("${H5_HAVE_IOEO}" MATCHES "^${H5_HAVE_IOEO}$")
+ENDIF (WINDOWS)
+
+
+#-----------------------------------------------------------------------------
# Option to see if GPFS is available on this filesystem --enable-gpfs
#-----------------------------------------------------------------------------
OPTION (HDF5_ENABLE_GPFS "Enable GPFS hints for the MPI/POSIX file driver" OFF)
diff --git a/config/cmake/HDF5Tests.c b/config/cmake/HDF5Tests.c
index 55e91a4..f580bbc 100644
--- a/config/cmake/HDF5Tests.c
+++ b/config/cmake/HDF5Tests.c
@@ -327,16 +327,6 @@ int main ()
#endif /* DEV_T_IS_SCALAR */
-#if defined( INLINE_TEST_inline ) || defined( INLINE_TEST___inline__ ) || defined( INLINE_TEST___inline )
-#ifndef __cplusplus
-typedef int foo_t;
-static INLINE_TEST_INLINE foo_t static_foo () { return 0; }
-INLINE_TEST_INLINE foo_t foo () {return 0; }
-int main() { return 0; }
-#endif
-
-#endif /* INLINE_TEST */
-
#ifdef HAVE_OFF64_T
#include <sys/types.h>
int main()
@@ -384,21 +374,31 @@ int main ()
#endif /* HAVE_GPFS */
-#ifdef HAVE_WIN_THREADS
+#ifdef HAVE_IOEO
#include <windows.h>
+typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
int main ()
{
- BOOL first_init_g=INIT_ONCE_STATIC_INIT;
- BOOL CALLBACK win32_first_thread_init(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContext);
- BOOL ret=FALSE;
-
- ret=InitOnceExecuteOnce(&first_init_g, win32_first_thread_init, NULL, NULL);
- exit(ret ? 0 : 1);
+ PGNSI pGNSI;
+ pGNSI = (PGNSI) GetProcAddress(
+ GetModuleHandle(TEXT("kernel32.dll")),
+ "InitOnceExecuteOnce");
+ if(NULL == pGNSI)
+ return 1;
+ else
+ return 0;
}
-BOOL CALLBACK
-win32_first_thread_init(PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContext)
-{return TRUE;}
-#endif /* HAVE_WIN_THREADS */
+#endif /* HAVE_IOEO */
+
+#if defined( INLINE_TEST_inline ) || defined( INLINE_TEST___inline__ ) || defined( INLINE_TEST___inline )
+#ifndef __cplusplus
+typedef int foo_t;
+static INLINE_TEST_INLINE foo_t static_foo () { return 0; }
+INLINE_TEST_INLINE foo_t foo () {return 0; }
+int main() { return 0; }
+#endif
+
+#endif /* INLINE_TEST */