summaryrefslogtreecommitdiffstats
path: root/config/cmake/ConfigureChecks.cmake
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2022-11-12 18:53:35 (GMT)
committerGitHub <noreply@github.com>2022-11-12 18:53:35 (GMT)
commit03cc2210165cc02fd50c87e6653c4b95b0bd7d83 (patch)
treef218458b268f5ca3eaec948d88d6d793f7f7a979 /config/cmake/ConfigureChecks.cmake
parent0f94940f1a9ae95de38b70709eb413511b76c73b (diff)
downloadhdf5-03cc2210165cc02fd50c87e6653c4b95b0bd7d83.zip
hdf5-03cc2210165cc02fd50c87e6653c4b95b0bd7d83.tar.gz
hdf5-03cc2210165cc02fd50c87e6653c4b95b0bd7d83.tar.bz2
moved quad precision checks (#2252)
* Only check quad sizes if fortran is enabled * fixed if struct
Diffstat (limited to 'config/cmake/ConfigureChecks.cmake')
-rw-r--r--config/cmake/ConfigureChecks.cmake159
1 files changed, 81 insertions, 78 deletions
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
index d4da06f..ef434b3 100644
--- a/config/cmake/ConfigureChecks.cmake
+++ b/config/cmake/ConfigureChecks.cmake
@@ -750,75 +750,76 @@ if (HDF5_ENABLE_MIRROR_VFD)
endif()
#-----------------------------------------------------------------------------
-# Check if C has __float128 extension
+# Check if C has __float128 extension (used for Fortran only)
#-----------------------------------------------------------------------------
-HDF_CHECK_TYPE_SIZE(__float128 _SIZEOF___FLOAT128)
-if (${_SIZEOF___FLOAT128})
- set (${HDF_PREFIX}_HAVE_FLOAT128 1)
- set (${HDF_PREFIX}_SIZEOF___FLOAT128 ${_SIZEOF___FLOAT128})
-else ()
- set (${HDF_PREFIX}_HAVE_FLOAT128 0)
- set (${HDF_PREFIX}_SIZEOF___FLOAT128 0)
-endif ()
+if (HDF5_BUILD_FORTRAN)
+ HDF_CHECK_TYPE_SIZE(__float128 _SIZEOF___FLOAT128)
+ if (${_SIZEOF___FLOAT128})
+ set (${HDF_PREFIX}_HAVE_FLOAT128 1)
+ set (${HDF_PREFIX}_SIZEOF___FLOAT128 ${_SIZEOF___FLOAT128})
+ else ()
+ set (${HDF_PREFIX}_HAVE_FLOAT128 0)
+ set (${HDF_PREFIX}_SIZEOF___FLOAT128 0)
+ endif ()
-HDF_CHECK_TYPE_SIZE(_Quad _SIZEOF__QUAD)
-if (NOT ${_SIZEOF__QUAD})
- set (${HDF_PREFIX}_SIZEOF__QUAD 0)
-else ()
- set (${HDF_PREFIX}_SIZEOF__QUAD ${_SIZEOF__QUAD})
-endif ()
+ HDF_CHECK_TYPE_SIZE(_Quad _SIZEOF__QUAD)
+ if (NOT ${_SIZEOF__QUAD})
+ set (${HDF_PREFIX}_SIZEOF__QUAD 0)
+ else ()
+ set (${HDF_PREFIX}_SIZEOF__QUAD ${_SIZEOF__QUAD})
+ endif ()
#-----------------------------------------------------------------------------
# The provided CMake C macros don't provide a general compile/run function
# so this one is used.
#-----------------------------------------------------------------------------
-set (RUN_OUTPUT_PATH_DEFAULT ${CMAKE_BINARY_DIR})
-macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR RETURN_OUTPUT_VAR)
- message (VERBOSE "Detecting C ${FUNCTION_NAME}")
- file (WRITE
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c
- ${SOURCE_CODE}
- )
- TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR
- ${CMAKE_BINARY_DIR}
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c
- COMPILE_DEFINITIONS "-D_SIZEOF___FLOAT128=${H5_SIZEOF___FLOAT128};-D_HAVE_QUADMATH_H=${H5_HAVE_QUADMATH_H}"
- COMPILE_OUTPUT_VARIABLE COMPILEOUT
- RUN_OUTPUT_VARIABLE OUTPUT_VAR
- )
+ set (RUN_OUTPUT_PATH_DEFAULT ${CMAKE_BINARY_DIR})
+ macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR RETURN_OUTPUT_VAR)
+ message (VERBOSE "Detecting C ${FUNCTION_NAME}")
+ file (WRITE
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c
+ ${SOURCE_CODE}
+ )
+ TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c
+ COMPILE_DEFINITIONS "-D_SIZEOF___FLOAT128=${H5_SIZEOF___FLOAT128};-D_HAVE_QUADMATH_H=${H5_HAVE_QUADMATH_H}"
+ COMPILE_OUTPUT_VARIABLE COMPILEOUT
+ RUN_OUTPUT_VARIABLE OUTPUT_VAR
+ )
- set (${RETURN_OUTPUT_VAR} ${OUTPUT_VAR})
-
- message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
- message (VERBOSE "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ")
- message (VERBOSE "Test COMPILE_OUTPUT ${COMPILEOUT} ")
- message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
- message (VERBOSE "Test RUN_RESULT_VAR ${RUN_RESULT_VAR} ")
- message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
-
- if (COMPILE_RESULT_VAR)
- if (RUN_RESULT_VAR EQUAL "0")
- set (${RETURN_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}")
- message (VERBOSE "Testing C ${FUNCTION_NAME} - OK")
- file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
- "Determining if the C ${FUNCTION_NAME} exists passed with the following output:\n"
- "${OUTPUT_VAR}\n\n"
- )
+ set (${RETURN_OUTPUT_VAR} ${OUTPUT_VAR})
+
+ message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+ message (VERBOSE "Test COMPILE_RESULT_VAR ${COMPILE_RESULT_VAR} ")
+ message (VERBOSE "Test COMPILE_OUTPUT ${COMPILEOUT} ")
+ message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+ message (VERBOSE "Test RUN_RESULT_VAR ${RUN_RESULT_VAR} ")
+ message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+
+ if (COMPILE_RESULT_VAR)
+ if (RUN_RESULT_VAR EQUAL "0")
+ set (${RETURN_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION_NAME}")
+ message (VERBOSE "Testing C ${FUNCTION_NAME} - OK")
+ file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the C ${FUNCTION_NAME} exists passed with the following output:\n"
+ "${OUTPUT_VAR}\n\n"
+ )
+ else ()
+ message (VERBOSE "Testing C ${FUNCTION_NAME} - Fail")
+ set (${RETURN_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION_NAME}")
+ file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the C ${FUNCTION_NAME} exists failed with the following output:\n"
+ "${OUTPUT_VAR}\n\n")
+ endif ()
else ()
- message (VERBOSE "Testing C ${FUNCTION_NAME} - Fail")
- set (${RETURN_VAR} 0 CACHE INTERNAL "Have C function ${FUNCTION_NAME}")
- file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
- "Determining if the C ${FUNCTION_NAME} exists failed with the following output:\n"
- "${OUTPUT_VAR}\n\n")
+ message (FATAL_ERROR "Compilation of C ${FUNCTION_NAME} - Failed")
endif ()
- else ()
- message (FATAL_ERROR "Compilation of C ${FUNCTION_NAME} - Failed")
- endif ()
-endmacro ()
+ endmacro ()
-set (PROG_SRC
- "
+ set (PROG_SRC
+ "
#include <float.h>\n\
#include <stdio.h>\n\
#define CHECK_FLOAT128 _SIZEOF___FLOAT128\n\
@@ -839,31 +840,33 @@ set (PROG_SRC
#else\n\
#define C_LDBL_DIG LDBL_DIG\n\
#endif\n\nint main() {\nprintf(\"\\%d\\\;\\%d\\\;\", C_LDBL_DIG, C_FLT128_DIG)\\\;\n\nreturn 0\\\;\n}\n
- "
-)
+ "
+ )
-C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_RES PROG_OUTPUT4)
-message (STATUS "Testing maximum decimal precision for C - ${PROG_OUTPUT4}")
+ C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_RES PROG_OUTPUT4)
+ message (STATUS "Testing maximum decimal precision for C - ${PROG_OUTPUT4}")
-# dnl The output from the above program will be:
-# dnl -- long double decimal precision -- __float128 decimal precision
+ # dnl The output from the above program will be:
+ # dnl -- long double decimal precision -- __float128 decimal precision
-list (GET PROG_OUTPUT4 0 H5_LDBL_DIG)
-list (GET PROG_OUTPUT4 1 H5_FLT128_DIG)
+ list (GET PROG_OUTPUT4 0 H5_LDBL_DIG)
+ list (GET PROG_OUTPUT4 1 H5_FLT128_DIG)
-if (${HDF_PREFIX}_SIZEOF___FLOAT128 EQUAL "0" OR FLT128_DIG EQUAL "0")
- set (${HDF_PREFIX}_HAVE_FLOAT128 0)
- set (${HDF_PREFIX}_SIZEOF___FLOAT128 0)
- set (_PAC_C_MAX_REAL_PRECISION ${H5_LDBL_DIG})
-else ()
- set (_PAC_C_MAX_REAL_PRECISION ${H5_FLT128_DIG})
-endif ()
-if (NOT ${_PAC_C_MAX_REAL_PRECISION})
- set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION 0)
-else ()
- set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION ${_PAC_C_MAX_REAL_PRECISION})
-endif ()
-message (STATUS "maximum decimal precision for C var - ${${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION}")
+ if (${HDF_PREFIX}_SIZEOF___FLOAT128 EQUAL "0" OR FLT128_DIG EQUAL "0")
+ set (${HDF_PREFIX}_HAVE_FLOAT128 0)
+ set (${HDF_PREFIX}_SIZEOF___FLOAT128 0)
+ set (_PAC_C_MAX_REAL_PRECISION ${H5_LDBL_DIG})
+ else ()
+ set (_PAC_C_MAX_REAL_PRECISION ${H5_FLT128_DIG})
+ endif ()
+ if (NOT ${_PAC_C_MAX_REAL_PRECISION})
+ set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION 0)
+ else ()
+ set (${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION ${_PAC_C_MAX_REAL_PRECISION})
+ endif ()
+ message (STATUS "maximum decimal precision for C var - ${${HDF_PREFIX}_PAC_C_MAX_REAL_PRECISION}")
+
+endif()
#-----------------------------------------------------------------------------
# Macro to determine the various conversion capabilities