diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2015-12-08 20:49:12 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2015-12-08 20:49:12 (GMT) |
commit | af371007e8bd28da2cebba7d079359611c898871 (patch) | |
tree | aa9edc02ee27520b8a92a04707cda78235d631d7 | |
parent | 015d8047fb6841c7a2a9464fdf792dd82344c1ab (diff) | |
download | hdf5-af371007e8bd28da2cebba7d079359611c898871.zip hdf5-af371007e8bd28da2cebba7d079359611c898871.tar.gz hdf5-af371007e8bd28da2cebba7d079359611c898871.tar.bz2 |
[svn-r28538] Merge of r28479 from revise_chunks.
Fixes OS X compilation problems and brings some Linux symbols in
line with the Autotools when building with CMake.
Tested on: 64-bit OS X 10.11.1 El Capitan (Darwin 15.0.0)
Xcode 7.1 Apple LLVM 7.0.0 (clang-700.1.76)
-rw-r--r-- | config/cmake_ext_mod/ConfigureChecks.cmake | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index fd502e5..c4fabf1 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -262,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) @@ -293,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}) @@ -315,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}) |