diff options
Diffstat (limited to 'config/cmake/ConfigureChecks.cmake')
-rw-r--r-- | config/cmake/ConfigureChecks.cmake | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 32faed4..8c401d9 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -560,6 +560,19 @@ endif () MARK_AS_ADVANCED (HDF5_STRICT_FORMAT_CHECKS) # ---------------------------------------------------------------------- +# Decide whether the data accuracy has higher priority during data +# conversions. If not, some hard conversions will still be preferred even +# though the data may be wrong (for example, some compilers don't +# support denormalized floating values) to maximize speed. +#----------------------------------------------------------------------------- +option (HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conversions" ON) +mark_as_advanced (HDF5_WANT_DATA_ACCURACY) +if (HDF5_WANT_DATA_ACCURACY) + set (${HDF_PREFIX}_WANT_DATA_ACCURACY 1) +endif () +MARK_AS_ADVANCED (HDF5_WANT_DATA_ACCURACY) + +# ---------------------------------------------------------------------- # Decide whether the presence of user's exception handling functions is # checked and data conversion exceptions are returned. This is mainly # for the speed optimization of hard conversions. Soft conversions can @@ -847,3 +860,83 @@ if (HDF5_BUILD_FORTRAN) message (STATUS "maximum decimal precision for C var - ${${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION}") endif() + +#----------------------------------------------------------------------------- +# Macro to determine the various conversion capabilities +#----------------------------------------------------------------------------- +macro (H5ConversionTests TEST msg) + if (NOT DEFINED ${TEST}) + TRY_RUN (${TEST}_RUN ${TEST}_COMPILE + ${CMAKE_BINARY_DIR} + ${HDF_RESOURCES_DIR}/ConversionTests.c + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=-D${TEST}_TEST + OUTPUT_VARIABLE OUTPUT + ) + if (${TEST}_COMPILE) + if (${TEST}_RUN EQUAL "0") + set (${TEST} 1 CACHE INTERNAL ${msg}) + message (VERBOSE "${msg}... yes") + else () + set (${TEST} "" CACHE INTERNAL ${msg}) + message (VERBOSE "${msg}... no") + file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + "Test ${TEST} Run failed with the following output and exit code:\n ${OUTPUT}\n" + ) + endif () + else () + set (${TEST} "" CACHE INTERNAL ${msg}) + message (VERBOSE "${msg}... no") + file (APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + "Test ${TEST} Compile failed with the following output:\n ${OUTPUT}\n" + ) + endif () + + endif () +endmacro () + +#----------------------------------------------------------------------------- +# Check various conversion capabilities +#----------------------------------------------------------------------------- + +# ---------------------------------------------------------------------- +# Set the flag to indicate that the machine is using a special algorithm toconvert +# 'long double' to '(unsigned) long' values. (This flag should only be set for +# the IBM Power Linux. When the bit sequence of long double is +# 0x4351ccf385ebc8a0bfcc2a3c3d855620, the converted value of (unsigned)long +# is 0x004733ce17af227f, not the same as the library's conversion to 0x004733ce17af2282. +# The machine's conversion gets the correct value. We define the macro and disable +# this kind of test until we figure out what algorithm they use. +#----------------------------------------------------------------------------- +H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LONG_SPECIAL "Checking IF your system converts long double to (unsigned) long values with special algorithm") +# ---------------------------------------------------------------------- +# Set the flag to indicate that the machine is using a special algorithm +# to convert some values of '(unsigned) long' to 'long double' values. +# (This flag should be off for all machines, except for IBM Power Linux, +# when the bit sequences are 003fff..., 007fff..., 00ffff..., 01ffff..., +# ..., 7fffff..., the compiler uses a unknown algorithm. We define a +# macro and skip the test for now until we know about the algorithm. +#----------------------------------------------------------------------------- +H5ConversionTests (${HDF_PREFIX}_LONG_TO_LDOUBLE_SPECIAL "Checking IF your system can convert (unsigned) long to long double values with special algorithm") +# ---------------------------------------------------------------------- +# Set the flag to indicate that the machine can accurately convert +# 'long double' to '(unsigned) long long' values. (This flag should be set for +# all machines, except for Mac OS 10.4 and SGI IRIX64 6.5. When the bit sequence +# of long double is 0x4351ccf385ebc8a0bfcc2a3c..., the values of (unsigned)long long +# start to go wrong on these two machines. Adjusting it higher to +# 0x4351ccf385ebc8a0dfcc... or 0x4351ccf385ebc8a0ffcc... will make the converted +# values wildly wrong. This test detects this wrong behavior and disable the test. +#----------------------------------------------------------------------------- +H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LLONG_ACCURATE "Checking IF correctly converting long double to (unsigned) long long values") +# ---------------------------------------------------------------------- +# Set the flag to indicate that the machine can accurately convert +# '(unsigned) long long' to 'long double' values. (This flag should be set for +# all machines, except for Mac OS 10.4, when the bit sequences are 003fff..., +# 007fff..., 00ffff..., 01ffff..., ..., 7fffff..., the converted values are twice +# as big as they should be. +#----------------------------------------------------------------------------- +H5ConversionTests (${HDF_PREFIX}_LLONG_TO_LDOUBLE_CORRECT "Checking IF correctly converting (unsigned) long long to long double values") +# ---------------------------------------------------------------------- +# Set the flag to indicate that the machine can accurately convert +# some long double values +#----------------------------------------------------------------------------- +H5ConversionTests (${HDF_PREFIX}_DISABLE_SOME_LDOUBLE_CONV "Checking IF the cpu is power9 and cannot correctly converting long double values") |