diff options
author | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2015-08-11 01:00:33 (GMT) |
---|---|---|
committer | Scot Breitenfeld <brtnfld@hdfgroup.org> | 2015-08-11 01:00:33 (GMT) |
commit | 415eb5512b0726716b5f8f72de3dda11ecff8091 (patch) | |
tree | ec3eddd4abad940acc89f83c0f114203ff3d6345 /config/cmake | |
parent | 1900d6a65db0bebcadbcbf98f8a8a9e1d9ff47b4 (diff) | |
parent | a9bef45c7528f2fcca5817900b5536d9d6c14889 (diff) | |
download | hdf5-415eb5512b0726716b5f8f72de3dda11ecff8091.zip hdf5-415eb5512b0726716b5f8f72de3dda11ecff8091.tar.gz hdf5-415eb5512b0726716b5f8f72de3dda11ecff8091.tar.bz2 |
[svn-r27488] Merged the F2003_v1.10 branch to the trunk.
Tested: h5committest
Diffstat (limited to 'config/cmake')
-rw-r--r-- | config/cmake/ConfigureChecks.cmake | 11 | ||||
-rw-r--r-- | config/cmake/H5pubconf.h.in | 12 | ||||
-rw-r--r-- | config/cmake/HDF518_Examples.cmake.in | 3 | ||||
-rw-r--r-- | config/cmake/HDF5UseFortran.cmake | 491 | ||||
-rw-r--r-- | config/cmake/hdf5-config.cmake.in | 1 | ||||
-rw-r--r-- | config/cmake/libhdf5.settings.cmake.in | 1 | ||||
-rw-r--r-- | config/cmake/mccacheinit.cmake | 2 |
7 files changed, 515 insertions, 6 deletions
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 09f1caf..b9f18a9 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -158,6 +158,17 @@ if (NOT WINDOWS) endif (HDF5_ENABLE_DIRECT_VFD) endif (NOT WINDOWS) +#----------------------------------------------------------------------------- +# Check if C has __float128 extension +#----------------------------------------------------------------------------- + +CHECK_TYPE_SIZE("__float128" SIZEOF___FLOAT128) +if(${HAVE_SIZEOF___FLOAT128}) + SET(H5_HAVE_FLOAT128 1) +else (${HAVE_SIZEOF___FLOAT128}) + SET(H5_HAVE_FLOAT128 0) + SET(SIZEOF___FLOAT128 0) +endif(${HAVE_SIZEOF___FLOAT128}) #----------------------------------------------------------------------------- # Macro to determine the various conversion capabilities diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index af9afde..37bcfbf 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -45,6 +45,18 @@ /* As FC_FUNC, but for C identifiers containing underscores. */ #define @H5_FC_FUNC_@ +/* Define Fortran Maximum Real Decimal Precision */ +#cmakedefine H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ + +/* Define C Maximum Real Decimal Precision */ +#cmakedefine H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@ + +/* Define if we have Fortran C_LONG_DOUBLE */ +#cmakedefine H5_FORTRAN_HAVE_C_LONG_DOUBLE @H5_FORTRAN_HAVE_C_LONG_DOUBLE@ + +/* Determine if __float128 is available */ +#cmakedefine H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@ + /* Define to 1 if you have the `alarm' function. */ #cmakedefine H5_HAVE_ALARM @H5_HAVE_ALARM@ diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in index febf20a..c82fcf2 100644 --- a/config/cmake/HDF518_Examples.cmake.in +++ b/config/cmake/HDF518_Examples.cmake.in @@ -13,7 +13,6 @@ set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) set(CTEST_BUILD_CONFIGURATION "Release") #set(NO_MAC_FORTRAN "true") #set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") -set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_ENABLE_F2003:BOOL=ON") #set(CTEST_USE_TAR_SOURCE "${CTEST_SCRIPT_ARG}") ############################################################################################################### @@ -123,4 +122,4 @@ if(res GREATER 0) endif(res GREATER 0) #----------------------------------------------------------------------------- ############################################################################################################## -message(STATUS "DONE")
\ No newline at end of file +message(STATUS "DONE") diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake new file mode 100644 index 0000000..b3dec14 --- /dev/null +++ b/config/cmake/HDF5UseFortran.cmake @@ -0,0 +1,491 @@ + +## Check for non-standard extenstion quadmath.h + +CHECK_INCLUDE_FILES(quadmath.h C_HAVE_QUADMATH) + +if (${C_HAVE_QUADMATH}) + set(HAVE_QUADMATH 1) +else () + set(HAVE_QUADMATH 0) +endif() + +# +# This file provides functions for HDF5 specific Fortran support. +# +#------------------------------------------------------------------------------- +ENABLE_LANGUAGE (Fortran) + +# The provided CMake Fortran macros don't provide a general compile/run function +# so this one is used. +#----------------------------------------------------------------------------- +MACRO (FORTRAN_RUN FUNCTION CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR RETURN) +# MSB CHECK WHY THIS CHECK? +# if (NOT DEFINED ${RUN_RESULT_VAR}) + message (STATUS "Detecting Fortran ${FUNCTION}") + if (CMAKE_REQUIRED_LIBRARIES) + set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + else (CMAKE_REQUIRED_LIBRARIES) + set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) + endif (CMAKE_REQUIRED_LIBRARIES) + file (WRITE + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 + "${CODE}" + ) + TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90 + CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" + RUN_OUTPUT_VARIABLE OUTPUT + ) + + + + set(${RETURN} ${OUTPUT}) + + #message ( "Test result1 ${RETURN} ") + #message ( "Test result3 ${RESULT} ") + #message ( "Test result2 ${CMAKE_MATCH_0} ") + #message ( "Test result4 ${CMAKE_MATCH_1} ") + #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") + #message ( "Test result2 ${COMPILE_RESULT_VAR} ") + #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") + #message ( "Test result1 ${RUN_RESULT_VAR} ") + #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") + + if (${COMPILE_RESULT_VAR}) + if (${RUN_RESULT_VAR} MATCHES 0) + message (STATUS "Testing Fortran ${FUNCTION} - OK") + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n" + "${OUTPUT}\n\n" + ) + else () + message (STATUS "Testing Fortran ${FUNCTION} - Fail") + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n" + "${OUTPUT}\n\n") + endif () + endif () +# endif (NOT DEFINED ${RUN_RESULT_VAR}) +ENDMACRO (FORTRAN_RUN) + +#----------------------------------------------------------------------------- +# Check to see C_LONG_DOUBLE is available +CHECK_FORTRAN_FEATURE(c_long_double + " + PROGRAM main + USE ISO_C_BINDING + REAL(KIND=C_LONG_DOUBLE) :: d + END PROGRAM + " + FORTRAN_HAVE_C_LONG_DOUBLE +) +if (${FORTRAN_HAVE_C_LONG_DOUBLE}) + set(FORTRAN_HAVE_C_LONG_DOUBLE 1) +else () + set(FORTRAN_HAVE_C_LONG_DOUBLE 0) +endif() + +# Check to see C_LONG_DOUBLE is different from C_DOUBLE + +CHECK_FORTRAN_FEATURE(c_long_double + " + MODULE type_mod + USE ISO_C_BINDING + INTERFACE h5t + MODULE PROCEDURE h5t_c_double + MODULE PROCEDURE h5t_c_long_double + END INTERFACE + CONTAINS + SUBROUTINE h5t_c_double(r) + REAL(KIND=C_DOUBLE) :: r + END SUBROUTINE h5t_c_double + SUBROUTINE h5t_c_long_double(d) + REAL(KIND=C_LONG_DOUBLE) :: d + END SUBROUTINE h5t_c_long_double + END MODULE type_mod + PROGRAM main + USE ISO_C_BINDING + USE type_mod + REAL(KIND=C_DOUBLE) :: r + REAL(KIND=C_LONG_DOUBLE) :: d + CALL h5t(r) + CALL h5t(d) + END PROGRAM main + " + FORTRAN_C_LONG_DOUBLE_IS_UNIQUE +) +if (${FORTRAN_C_LONG_DOUBLE_IS_UNIQUE}) + set(FORTRAN_C_LONG_DOUBLE_IS_UNIQUE 1) +else () + set(FORTRAN_C_LONG_DOUBLE_IS_UNIQUE 0) +endif() + +## Set the sizeof function for use later in the fortran tests +if(FORTRAN_HAVE_STORAGE_SIZE) + set(FC_SIZEOF_A "STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") + set(FC_SIZEOF_B "STORAGE_SIZE(b, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") + set(FC_SIZEOF_C "STORAGE_SIZE(c, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)") +elseif(FORTRAN_HAVE_C_SIZEOF) + set(FC_SIZEOF_A "SIZEOF(a)") + set(FC_SIZEOF_B "SIZEOF(b)") + set(FC_SIZEOF_C "SIZEOF(c)") +else(FORTRAN_HAVE_STORAGE_SIZE) + message (FATAL_ERROR "Fortran compiler requires either intrinsic functions SIZEOF or STORAGE_SIZE") +endif(FORTRAN_HAVE_STORAGE_SIZE) + +#----------------------------------------------------------------------------- +# Determine the available KINDs for REALs and INTEGERs +#----------------------------------------------------------------------------- + +FORTRAN_RUN("REAL and INTEGER KINDs" + " + PROGRAM main + IMPLICIT NONE + INTEGER :: ik, k, lastkind, max_decimal_prec + INTEGER :: num_rkinds, num_ikinds + num_ikinds = 0 + lastkind=SELECTED_INT_KIND(1) + ! Find integer KINDs + DO ik=2,36 + k = SELECTED_INT_KIND(ik) + IF (k .NE. lastkind) THEN + num_ikinds = num_ikinds + 1 + WRITE(*,'(I0)',ADVANCE='NO') lastkind + lastkind = k + IF(k.GT.0) WRITE(*,'(A)',ADVANCE='NO') ',' + ENDIF + IF (k .LE. 0) EXIT + ENDDO + IF (lastkind.NE.-1) THEN + num_ikinds = num_ikinds + 1 + WRITE(*,'(I0)') lastkind + ELSE + WRITE(*,'()') + ENDIF + ! Find real KINDs + num_rkinds = 0 + lastkind=SELECTED_REAL_KIND(1) + max_decimal_prec = 1 + DO ik=2,36 + k = SELECTED_REAL_KIND(ik) + IF (k .NE. lastkind) THEN + num_rkinds = num_rkinds + 1 + WRITE(*,'(I0)',ADVANCE='NO') lastkind + lastkind = k + IF(k.GT.0) WRITE(*,'(A)',ADVANCE='NO') ',' + max_decimal_prec = ik + ENDIF + IF (k .LE. 0) EXIT + ENDDO + IF (lastkind.NE.-1)THEN + num_rkinds = num_rkinds + 1 + WRITE(*,'(I0)') lastkind + ELSE + WRITE(*,'()') + ENDIF + WRITE(*,'(I0)') max_decimal_prec + WRITE(*,'(I0)') num_ikinds + WRITE(*,'(I0)') num_rkinds + END + " + XX + YY + PROG_OUTPUT +) +# dnl The output from the above program will be: +# dnl -- LINE 1 -- valid integer kinds (comma seperated list) +# dnl -- LINE 2 -- valid real kinds (comma seperated list) +# dnl -- LINE 3 -- max decimal precision for reals +# dnl -- LINE 4 -- number of valid integer kinds +# dnl -- LINE 5 -- number of valid real kinds + +# Convert the string to a list of strings by replacing the carriage return with a semicolon +string(REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") + +list(GET PROG_OUTPUT 0 pac_validIntKinds) +list(GET PROG_OUTPUT 1 pac_validRealKinds) +list(GET PROG_OUTPUT 2 H5_PAC_FC_MAX_REAL_PRECISION) + +set(PAC_FC_ALL_INTEGER_KINDS "\{${pac_validIntKinds}\}") +set(PAC_FC_ALL_REAL_KINDS "\{${pac_validRealKinds}\}") + +list(GET PROG_OUTPUT 3 NUM_IKIND) +list(GET PROG_OUTPUT 4 NUM_RKIND) + +set(H5CONFIG_F_NUM_IKIND "INTEGER, PARAMETER :: num_ikinds = ${NUM_IKIND}") +set(H5CONFIG_F_IKIND "INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/${pac_validIntKinds}/)") + +message ( " ........REAL KINDS FOUND ${PAC_FC_ALL_REAL_KINDS}") +message ( " ........INTEGER KINDS FOUND ${PAC_FC_ALL_REAL_KINDS}") +message ( " ........MAX DECIMAL PRECISION ${H5_PAC_FC_MAX_REAL_PRECISION}") + +#----------------------------------------------------------------------------- +# Determine the available KINDs for REALs and INTEGERs +#----------------------------------------------------------------------------- +# ********** +# INTEGERS +# ********** +string(REGEX REPLACE "," ";" VAR_KIND "${pac_validIntKinds}") + +foreach( KIND ${VAR_KIND} ) + set(PROG_SRC + " + PROGRAM main + USE ISO_C_BINDING + IMPLICIT NONE + INTEGER (KIND=${KIND}) a + WRITE(*,'(I0)') ${FC_SIZEOF_A} + END + " + ) + FORTRAN_RUN("INTEGER KIND SIZEOF" ${PROG_SRC} + XX + YY + PROG_OUTPUT1 + ) + string(REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") + set(pack_int_sizeof "${pack_int_sizeof} ${PROG_OUTPUT1},") +endforeach(KIND) +string(STRIP ${pack_int_sizeof} pack_int_sizeof) + + +#Remove trailing comma +string(REGEX REPLACE ",$" "" pack_int_sizeof "${pack_int_sizeof}") +#Remove spaces +string(REGEX REPLACE " " "" pack_int_sizeof "${pack_int_sizeof}") + +set(PAC_FC_ALL_INTEGER_KINDS_SIZEOF "\{${pack_int_sizeof}\}") + +message("...FOUND SIZEOF for INTEGER KINDs ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF}") +# ********** +# REALS +# ********** +string(REGEX REPLACE "," ";" VAR_KIND "${pac_validRealKinds}") + +#find the maximum kind of the real +list(LENGTH VAR_KIND LEN_VAR_KIND) +MATH (EXPR _LEN "${LEN_VAR_KIND} - 1") +list(GET VAR_KIND ${_LEN} max_real_fortran_kind) + +foreach( KIND ${VAR_KIND} ) + set(PROG_SRC + " + PROGRAM main + USE ISO_C_BINDING + IMPLICIT NONE + REAL (KIND=${KIND}) a + WRITE(*,'(I0)') ${FC_SIZEOF_A} + END + " + ) + FORTRAN_RUN("REAL KIND SIZEOF" ${PROG_SRC} + XX + YY + PROG_OUTPUT1 + ) + string(REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}") + set(pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT1},") +endforeach(KIND) +string(STRIP ${pack_real_sizeof} pack_real_sizeof) + +#Remove trailing comma +string(REGEX REPLACE ",$" "" pack_real_sizeof "${pack_real_sizeof}") +#Remove spaces +string(REGEX REPLACE " " "" pack_real_sizeof "${pack_real_sizeof}") + +set(H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${pack_real_sizeof}/)") + +message("...FOUND SIZEOF for REAL KINDs \{${pack_real_sizeof}\}") + +#find the maximum kind of the real +list(LENGTH VAR_KIND LEN_VAR_KIND) +MATH (EXPR _LEN "${LEN_VAR_KIND} - 1") +list(GET VAR_KIND ${_LEN} max_real_fortran_sizeof) + +set(PAC_FC_ALL_REAL_KINDS_SIZEOF "\{${pack_real_sizeof}\}") +#----------------------------------------------------------------------------- +# Find sizeof of native kinds +#----------------------------------------------------------------------------- +FORTRAN_RUN("SIZEOF NATIVE KINDs" + " + PROGRAM main + USE ISO_C_BINDING + IMPLICIT NONE + INTEGER a + REAL b + DOUBLE PRECISION c + WRITE(*,*) ${FC_SIZEOF_A} + WRITE(*,*) kind(a) + WRITE(*,*) ${FC_SIZEOF_B} + WRITE(*,*) kind(b) + WRITE(*,*) ${FC_SIZEOF_C} + WRITE(*,*) kind(c) + END + " + XX + YY + PROG_OUTPUT +) +# dnl The output from the above program will be: +# dnl -- LINE 1 -- sizeof INTEGER +# dnl -- LINE 2 -- kind of INTEGER +# dnl -- LINE 3 -- sizeof REAL +# dnl -- LINE 4 -- kind of REAL +# dnl -- LINE 5 -- sizeof DOUBLE PRECISION +# dnl -- LINE 6 -- kind of DOUBLE PRECISION + +# Convert the string to a list of strings by replacing the carriage return with a semicolon +string(REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") + +list(GET PROG_OUTPUT 0 PAC_FORTRAN_NATIVE_INTEGER_SIZEOF) +list(GET PROG_OUTPUT 1 PAC_FORTRAN_NATIVE_INTEGER_KIND) +list(GET PROG_OUTPUT 2 PAC_FORTRAN_NATIVE_REAL_SIZEOF) +list(GET PROG_OUTPUT 3 PAC_FORTRAN_NATIVE_REAL_KIND) +list(GET PROG_OUTPUT 4 PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF) +list(GET PROG_OUTPUT 5 PAC_FORTRAN_NATIVE_DOUBLE_KIND) + +set(FORTRAN_SIZEOF_LONG_DOUBLE ${${HDF_PREFIX}_SIZEOF_LONG_DOUBLE}) +#set(H5_SIZEOF_LONG_DOUBLE ${${HDF_PREFIX}_SIZEOF_LONG_DOUBLE}) + +# remove the invalid kind from the list +if(NOT(${SIZEOF___FLOAT128} EQUAL 0)) + if(NOT(${SIZEOF___FLOAT128} EQUAL ${max_real_fortran_sizeof}) AND NOT(${FORTRAN_SIZEOF_LONG_DOUBLE} EQUAL ${max_real_fortran_sizeof})) + message(WARNING " + Fortran REAL(KIND=${max_real_fortran_kind}) is $max_real_fortran_sizeof Bytes, but no corresponding C float type exists of that size + !!! Fortran interfaces will not be generated for REAL(KIND=${max_real_fortran_kind}) !!!") + string(REGEX REPLACE ",[0-9]+}" "}" PAC_FC_ALL_REAL_KINDS ${PAC_FC_ALL_REAL_KINDS}) + string(REGEX REPLACE ",[0-9]+}" "}" PAC_FC_ALL_REAL_KINDS_SIZEOF ${PAC_FC_ALL_REAL_KINDS_SIZEOF}) + MATH (EXPR NUM_RKIND "${NUM_RKIND} - 1") + endif(NOT(${SIZEOF___FLOAT128} EQUAL ${max_real_fortran_sizeof}) AND NOT(${FORTRAN_SIZEOF_LONG_DOUBLE} EQUAL ${max_real_fortran_sizeof})) +endif(NOT(${SIZEOF___FLOAT128} EQUAL 0)) + +set(H5CONFIG_F_NUM_RKIND "INTEGER, PARAMETER :: num_rkinds = ${NUM_RKIND}") + +string(REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS}) +string(REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR}) +set(H5CONFIG_F_RKIND "INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/${OUT_VAR}/)") + +string(REGEX REPLACE "{" "" OUT_VAR ${PAC_FC_ALL_REAL_KINDS_SIZEOF}) +string(REGEX REPLACE "}" "" OUT_VAR ${OUT_VAR}) +set(H5CONFIG_F_RKIND_SIZEOF "INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/${OUT_VAR}/)") + +ENABLE_LANGUAGE (C) + +#----------------------------------------------------------------------------- +# The provided CMake C macros don't provide a general compile/run function +# so this one is used. +#----------------------------------------------------------------------------- +MACRO (C_RUN FUNCTION CODE RUN_RESULT_VAR COMPILE_RESULT_VAR RETURN) +# MSB CHECK WHY THIS CHECK? +# if (NOT DEFINED ${RUN_RESULT_VAR}) + message (STATUS "Detecting C ${FUNCTION}") + if (CMAKE_REQUIRED_LIBRARIES) + set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") + else (CMAKE_REQUIRED_LIBRARIES) + set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES) + endif (CMAKE_REQUIRED_LIBRARIES) + file (WRITE + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c + ${CODE} + ) + TRY_RUN (${RUN_RESULT_VAR} ${COMPILE_RESULT_VAR} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler1.c + CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}" + RUN_OUTPUT_VARIABLE OUTPUT + ) + + set(${RETURN} ${OUTPUT}) + + #message ( "Test result1 ${RETURN} ") + #message ( "Test result3 ${RESULT} ") + #message ( "Test result2 ${CMAKE_MATCH_0} ") + #message ( "Test result4 ${CMAKE_MATCH_1} ") + #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") + #message ( "Test result ${COMPILE_RESULT_VAR} ") + #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") + #message ( "Test result ${RUN_RESULT_VAR} ") + #message ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ") + + if (${COMPILE_RESULT_VAR}) + if (${RUN_RESULT_VAR} MATCHES 0) + set (${RUN_RESULT_VAR} 1 CACHE INTERNAL "Have C function ${FUNCTION}") + message (STATUS "Testing C ${FUNCTION} - OK") + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the C ${FUNCTION} exists passed with the following output:\n" + "${OUTPUT}\n\n" + ) + else () + message (STATUS "Testing C ${FUNCTION} - Fail") + set (${RUN_RESULT_VAR} "" CACHE INTERNAL "Have C function ${FUNCTION}") + file (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the C ${FUNCTION} exists failed with the following output:\n" + "${OUTPUT}\n\n") + endif () + endif() +# endif (NOT DEFINED ${RUN_RESULT_VAR}) +ENDMACRO (C_RUN) + +set(PROG_SRC + " +#include <float.h> +#include <stdio.h> +#define CHECK_FLOAT128 ${SIZEOF___FLOAT128} +#if CHECK_FLOAT128!=0 +# if ${HAVE_QUADMATH}!=0 +#include <quadmath.h> +# endif +# ifdef FLT128_DIG +#define C_FLT128_DIG FLT128_DIG +# else +#define C_FLT128_DIG 0 +# endif +#else +#define C_FLT128_DIG 0 +#endif +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L +#define C_LDBL_DIG DECIMAL_DIG +#else +#define C_LDBL_DIG LDBL_DIG +#endif + void main() { + printf(\"%d\\\\n%d\\\\n\", C_LDBL_DIG, C_FLT128_DIG)\\\; + } + " + ) + +C_RUN("maximum decimal precision for C" ${PROG_SRC} + XX + YY + PROG_OUTPUT +) + +# dnl The output from the above program will be: +# dnl -- LINE 1 -- long double decimal precision +# dnl -- LINE 2 -- __float128 decimal precision + +# Convert the string to a list of strings by replacing the carriage return with a semicolon +string(REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}") + +list(GET PROG_OUTPUT 0 LDBL_DIG) +list(GET PROG_OUTPUT 1 FLT128_DIG) + +if(SIZEOF___FLOAT128 EQUAL 0 OR FLT128_DIG EQUAL 0) + SET(H5_HAVE_FLOAT128 0) + SET(SIZEOF___FLOAT128 0) + set(H5_PAC_C_MAX_REAL_PRECISION ${LDBL_DIG}) +else () + set(H5_PAC_C_MAX_REAL_PRECISION ${FLT128_DIG}) +endif() + + +# Setting definition if there is a 16 byte fortran integer +string(FIND ${PAC_FC_ALL_INTEGER_KINDS_SIZEOF} "16" pos) +if(${pos} EQUAL -1) + set(HAVE_Fortran_INTEGER_SIZEOF_16 0) +else () + set(HAVE_Fortran_INTEGER_SIZEOF_16 1) +endif () diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index 321267f..adeec55 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -22,7 +22,6 @@ set (${HDF5_PACKAGE_NAME}_VALID_COMPONENTS #----------------------------------------------------------------------------- set (${HDF5_PACKAGE_NAME}_ENABLE_PARALLEL @HDF5_ENABLE_PARALLEL@) set (${HDF5_PACKAGE_NAME}_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@) -set (${HDF5_PACKAGE_NAME}_ENABLE_F2003 @HDF5_ENABLE_F2003@) set (${HDF5_PACKAGE_NAME}_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@) set (${HDF5_PACKAGE_NAME}_BUILD_TOOLS @HDF5_BUILD_TOOLS@) set (${HDF5_PACKAGE_NAME}_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@) diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index 8ef67a5..ba764a4 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -38,7 +38,6 @@ Languages: ---------- Fortran: @HDF5_BUILD_FORTRAN@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @CMAKE_Fortran_COMPILER@ -@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran 2003 Compiler: @HDF5_ENABLE_F2003@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Flags: @CMAKE_Fortran_FLAGS@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @H5_FCFLAGS@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ AM Fortran Flags: @AM_FCFLAGS@ diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake index af506e6..39ec124 100644 --- a/config/cmake/mccacheinit.cmake +++ b/config/cmake/mccacheinit.cmake @@ -16,8 +16,6 @@ set (HDF5_BUILD_EXAMPLES ON CACHE BOOL "Build HDF5 Library Examples" FORCE) set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE) -set (HDF5_ENABLE_F2003 ON CACHE BOOL "Enable FORTRAN 2003 Standard" FORCE) - set (HDF5_BUILD_HL_LIB ON CACHE BOOL "Build HIGH Level HDF5 Library" FORCE) set (HDF5_BUILD_TOOLS ON CACHE BOOL "Build HDF5 Tools" FORCE) |