summaryrefslogtreecommitdiffstats
path: root/config/cmake_ext_mod/ConfigureChecks.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'config/cmake_ext_mod/ConfigureChecks.cmake')
-rw-r--r--config/cmake_ext_mod/ConfigureChecks.cmake138
1 files changed, 66 insertions, 72 deletions
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake
index 6885187..cfda66b 100644
--- a/config/cmake_ext_mod/ConfigureChecks.cmake
+++ b/config/cmake_ext_mod/ConfigureChecks.cmake
@@ -31,13 +31,13 @@ if (APPLE)
endif (APPLE)
# Check for Darwin (not just Apple - we also want to catch OpenDarwin)
-if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
- set (${HDF_PREFIX}_HAVE_DARWIN 1)
+if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set (${HDF_PREFIX}_HAVE_DARWIN 1)
endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Check for Solaris
-if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
- set (${HDF_PREFIX}_HAVE_SOLARIS 1)
+if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+ set (${HDF_PREFIX}_HAVE_SOLARIS 1)
endif (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
#-----------------------------------------------------------------------------
@@ -141,10 +141,6 @@ MACRO (HDF_FUNCTION_TEST OTHER_TEST)
set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
endif (CMAKE_REQUIRED_LIBRARIES)
- foreach (def ${HDF_EXTRA_TEST_DEFINITIONS})
- set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}=${${def}}")
- endforeach (def)
-
foreach (def
HAVE_SYS_TIME_H
HAVE_UNISTD_H
@@ -266,27 +262,23 @@ set (LINUX_LFS 0)
set (HDF_EXTRA_C_FLAGS)
set (HDF_EXTRA_FLAGS)
if (NOT WINDOWS)
- if (NOT ${HDF_PREFIX}_HAVE_SOLARIS)
+ # Might want to check explicitly for Linux and possibly Cygwin
+ # instead of checking for not Solaris or Darwin.
+ if (NOT ${HDF_PREFIX}_HAVE_SOLARIS AND NOT ${HDF_PREFIX}_HAVE_DARWIN)
# Linux Specific flags
# This was originally defined as _POSIX_SOURCE which was updated to
# _POSIX_C_SOURCE=199506L to expose a greater amount of POSIX
# functionality so clock_gettime and CLOCK_MONOTONIC are defined
- # correctly.
+ # correctly. This was later updated to 200112L so that
+ # posix_memalign() is visible for the direct VFD code on Linux
+ # systems.
# POSIX feature information can be found in the gcc manual at:
# http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html
- set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=199506L)
- # _BSD_SOURCE deprecated in GLIBC >= 2.20
- TRY_RUN (HAVE_DEFAULT_SOURCE_RUN HAVE_DEFAULT_SOURCE_COMPILE
- ${CMAKE_BINARY_DIR}
- ${HDF_RESOURCES_EXT_DIR}/HDFTests.c
- CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DHAVE_DEFAULT_SOURCE
- OUTPUT_VARIABLE OUTPUT
- )
- if (HAVE_DEFAULT_SOURCE_COMPILE AND HAVE_DEFAULT_SOURCE_RUN)
- set (HDF_EXTRA_FLAGS -D_DEFAULT_SOURCE)
- else (HAVE_DEFAULT_SOURCE_COMPILE AND HAVE_DEFAULT_SOURCE_RUN)
- set (HDF_EXTRA_FLAGS -D_BSD_SOURCE)
- endif (HAVE_DEFAULT_SOURCE_COMPILE AND HAVE_DEFAULT_SOURCE_RUN)
+ set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200112L)
+
+ # Need to add this so that O_DIRECT is visible for the direct
+ # VFD on Linux systems.
+ set (HDF_EXTRA_C_FLAGS -D_GNU_SOURCE)
option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON)
if (HDF_ENABLE_LARGE_FILE)
@@ -297,6 +289,11 @@ if (NOT WINDOWS)
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-DTEST_LFS_WORKS
OUTPUT_VARIABLE OUTPUT
)
+
+ # The LARGEFILE definitions were from the transition period
+ # and are probably no longer needed. The FILE_OFFSET_BITS
+ # check should be generalized for all POSIX systems as it
+ # is in the Autotools.
if (TEST_LFS_WORKS_COMPILE)
if (TEST_LFS_WORKS_RUN MATCHES 0)
set (TEST_LFS_WORKS 1 CACHE INTERNAL ${msg})
@@ -319,7 +316,7 @@ if (NOT WINDOWS)
endif (TEST_LFS_WORKS_COMPILE)
endif (HDF_ENABLE_LARGE_FILE)
set (CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${HDF_EXTRA_FLAGS})
- endif (NOT ${HDF_PREFIX}_HAVE_SOLARIS)
+ endif (NOT ${HDF_PREFIX}_HAVE_SOLARIS AND NOT ${HDF_PREFIX}_HAVE_DARWIN)
endif (NOT WINDOWS)
add_definitions (${HDF_EXTRA_FLAGS})
@@ -422,6 +419,19 @@ if (NOT ${HDF_PREFIX}_SIZEOF_OFF64_T)
set (${HDF_PREFIX}_SIZEOF_OFF64_T 0)
endif (NOT ${HDF_PREFIX}_SIZEOF_OFF64_T)
+#-----------------------------------------------------------------------------
+# Extra C99 types
+#-----------------------------------------------------------------------------
+
+# _Bool type support
+CHECK_INCLUDE_FILE_CONCAT (stdbool.h ${HDF_PREFIX}_HAVE_STDBOOL_H)
+if (HAVE_STDBOOL_H)
+ set (CMAKE_EXTRA_INCLUDE_FILES stdbool.h)
+ HDF_CHECK_TYPE_SIZE (bool ${HDF_PREFIX}_SIZEOF_BOOL)
+else (HAVE_STDBOOL_H)
+ HDF_CHECK_TYPE_SIZE (_Bool ${HDF_PREFIX}_SIZEOF_BOOL)
+endif (HAVE_STDBOOL_H)
+
if (NOT WINDOWS)
#-----------------------------------------------------------------------------
# Check if the dev_t type is a scalar type
@@ -437,6 +447,7 @@ if (NOT WINDOWS)
#-----------------------------------------------------------------------------
# Check a bunch of time functions
#-----------------------------------------------------------------------------
+ CHECK_FUNCTION_EXISTS (gettimeofday ${HDF_PREFIX}_HAVE_GETTIMEOFDAY)
foreach (test
HAVE_TM_GMTOFF
HAVE___TM_GMTOFF
@@ -479,6 +490,8 @@ endif (NOT WINDOWS)
# Check for some functions that are used
#
CHECK_FUNCTION_EXISTS (alarm ${HDF_PREFIX}_HAVE_ALARM)
+CHECK_FUNCTION_EXISTS (fcntl ${HDF_PREFIX}_HAVE_FCNTL)
+CHECK_FUNCTION_EXISTS (flock ${HDF_PREFIX}_HAVE_FLOCK)
CHECK_FUNCTION_EXISTS (fork ${HDF_PREFIX}_HAVE_FORK)
CHECK_FUNCTION_EXISTS (frexpf ${HDF_PREFIX}_HAVE_FREXPF)
CHECK_FUNCTION_EXISTS (frexpl ${HDF_PREFIX}_HAVE_FREXPL)
@@ -556,10 +569,6 @@ MACRO (HDF_CXX_FUNCTION_TEST OTHER_TEST)
set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
endif (CMAKE_REQUIRED_LIBRARIES)
- foreach (def ${HDF_EXTRA_TEST_DEFINITIONS})
- set (MACRO_CHECK_FUNCTION_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS} -D${def}=${${def}}")
- endforeach (def)
-
foreach (def
HAVE_SYS_TIME_H
HAVE_UNISTD_H
@@ -626,7 +635,7 @@ if (WINDOWS)
"${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE"
)
endif (LARGEFILE)
- set (MACRO_CHECK_FUNCTION_DEFINITIONS
+ set (MACRO_CHECK_FUNCTION_DEFINITIONS
"-DHAVE_IOEO ${CMAKE_REQUIRED_FLAGS}")
if (CMAKE_REQUIRED_LIBRARIES)
set (CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES
@@ -658,7 +667,7 @@ if (WINDOWS)
if ("${HAVE_IOEO_EXITCODE}" EQUAL 0)
set (${HDF_PREFIX}_HAVE_IOEO 1 CACHE INTERNAL "Test InitOnceExecuteOnce")
message (STATUS "Performing Test InitOnceExecuteOnce - Success")
- file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ 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")
@@ -670,7 +679,7 @@ if (WINDOWS)
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
+ 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")
@@ -682,60 +691,45 @@ endif (WINDOWS)
#-----------------------------------------------------------------------------
# Determine how 'inline' is used
#-----------------------------------------------------------------------------
-set (HDF_EXTRA_TEST_DEFINITIONS INLINE_TEST_INLINE)
foreach (inline_test inline __inline__ __inline)
- set (INLINE_TEST_INLINE ${inline_test})
- HDF_FUNCTION_TEST (INLINE_TEST_${inline_test})
+ string (TOUPPER ${inline_test} INLINE_TEST_MACRO)
+ HDF_FUNCTION_TEST (HAVE_${INLINE_TEST_MACRO})
endforeach (inline_test)
-set (HDF_EXTRA_TEST_DEFINITIONS)
-if (INLINE_TEST___inline__)
- set (${HDF_PREFIX}_inline __inline__)
-else (INLINE_TEST___inline__)
- if (INLINE_TEST___inline)
- set (${HDF_PREFIX}_inline __inline)
- else (INLINE_TEST___inline)
- if (INLINE_TEST_inline)
- set (${HDF_PREFIX}_inline inline)
- endif (INLINE_TEST_inline)
- endif (INLINE_TEST___inline)
-endif (INLINE_TEST___inline__)
-
#-----------------------------------------------------------------------------
# Check how to print a Long Long integer
#-----------------------------------------------------------------------------
if (NOT ${HDF_PREFIX}_PRINTF_LL_WIDTH OR ${HDF_PREFIX}_PRINTF_LL_WIDTH MATCHES "unknown")
set (PRINT_LL_FOUND 0)
message (STATUS "Checking for appropriate format for 64 bit long:")
- foreach (HDF5_PRINTF_LL l64 l L q I64 ll)
- set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH=${HDF5_PRINTF_LL}")
- if (${HDF_PREFIX}_SIZEOF_LONG_LONG)
- set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG")
- endif (${HDF_PREFIX}_SIZEOF_LONG_LONG)
- TRY_RUN (HDF5_PRINTF_LL_TEST_RUN HDF5_PRINTF_LL_TEST_COMPILE
- ${CMAKE_BINARY_DIR}
- ${HDF_RESOURCES_EXT_DIR}/HDFTests.c
- CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS}
- OUTPUT_VARIABLE OUTPUT
+ set (CURRENT_TEST_DEFINITIONS "-DPRINTF_LL_WIDTH")
+ if (${HDF_PREFIX}_SIZEOF_LONG_LONG)
+ set (CURRENT_TEST_DEFINITIONS "${CURRENT_TEST_DEFINITIONS} -DHAVE_LONG_LONG")
+ endif (${HDF_PREFIX}_SIZEOF_LONG_LONG)
+ TRY_RUN (${HDF_PREFIX}_PRINTF_LL_TEST_RUN ${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE
+ ${CMAKE_BINARY_DIR}
+ ${HDF_RESOURCES_EXT_DIR}/HDFTests.c
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${CURRENT_TEST_DEFINITIONS}
+ OUTPUT_VARIABLE OUTPUT
+ )
+ if (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE)
+ if (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0)
+ string(REGEX REPLACE ".*PRINTF_LL_WIDTH=\\[(.*)\\].*" "\\1" ${HDF_PREFIX}_PRINTF_LL "${OUTPUT}")
+ set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${${HDF_PREFIX}_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll")
+ set (PRINT_LL_FOUND 1)
+ else (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0)
+ message ("Width test failed with result: ${${HDF_PREFIX}_PRINTF_LL_TEST_RUN}")
+ endif (${HDF_PREFIX}_PRINTF_LL_TEST_RUN MATCHES 0)
+ else (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE)
+ file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
+ "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH failed with the following output:\n ${OUTPUT}\n"
)
- if (HDF5_PRINTF_LL_TEST_COMPILE)
- if (HDF5_PRINTF_LL_TEST_RUN MATCHES 0)
- set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"${HDF5_PRINTF_LL}\"" CACHE INTERNAL "Width for printf for type `long long' or `__int64', us. `ll")
- set (PRINT_LL_FOUND 1)
- else (HDF5_PRINTF_LL_TEST_RUN MATCHES 0)
- message ("Width with ${HDF5_PRINTF_LL} failed with result: ${HDF5_PRINTF_LL_TEST_RUN}")
- endif (HDF5_PRINTF_LL_TEST_RUN MATCHES 0)
- else (HDF5_PRINTF_LL_TEST_COMPILE)
- file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log
- "Test ${HDF_PREFIX}_PRINTF_LL_WIDTH for ${HDF5_PRINTF_LL} failed with the following output:\n ${OUTPUT}\n"
- )
- endif (HDF5_PRINTF_LL_TEST_COMPILE)
- endforeach (HDF5_PRINTF_LL)
+ endif (${HDF_PREFIX}_PRINTF_LL_TEST_COMPILE)
if (PRINT_LL_FOUND)
- message (STATUS "Checking for apropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}")
+ message (STATUS "Checking for appropriate format for 64 bit long: found ${${HDF_PREFIX}_PRINTF_LL_WIDTH}")
else (PRINT_LL_FOUND)
- message (STATUS "Checking for apropriate format for 64 bit long: not found")
+ message (STATUS "Checking for appropriate format for 64 bit long: not found")
set (${HDF_PREFIX}_PRINTF_LL_WIDTH "\"unknown\"" CACHE INTERNAL
"Width for printf for type `long long' or `__int64', us. `ll"
)