From 2a567e8155a883a1d79a7879e953449ed7505945 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Thu, 2 Jul 2015 14:04:25 -0500 Subject: [svn-r27326] Working version of cmake on linux. --- CMakeLists.txt | 2 ++ MANIFEST | 1 + config/cmake/ConfigureChecks.cmake | 12 ++++--- config/cmake/H5pubconf.h.in | 12 +++++++ configure | 21 +++++-------- configure.ac | 8 ++--- fortran/src/H5config_f.inc.cmake | 64 ++++++++++++++++++++++++++++---------- fortran/test/CMakeLists.txt | 4 +-- hl/fortran/test/CMakeLists.txt | 8 ++--- m4/aclocal_fc.m4 | 10 +++--- 10 files changed, 91 insertions(+), 51 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 33b4bca..e638ba1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -638,6 +638,7 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for endif (BUILD_SHARED_LIBS AND APPLE) option (HDF5_ENABLE_F2003 "Enable FORTRAN 2003 Standard" ON) include (${HDF_RESOURCES_EXT_DIR}/HDFUseFortran.cmake) + include (${HDF_RESOURCES_DIR}/HDF5UseFortran.cmake) if (HDF5_ENABLE_F2003) if (NOT FORTRAN_HAVE_ISO_C_BINDING) set (HDF5_ENABLE_F2003 OFF) @@ -686,6 +687,7 @@ endif (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++" # Check if Fortran's default real is double precision. If it is and HL is # being built then configure should fail due to bug HDFFV-889. #----------------------------------------------------------------------------- + if (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB ) if (NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE) message (FATAL_ERROR " **** Fortran high-level routines are not supported when the default REAL is DOUBLE PRECISION, use HDF5_BUILD_HL_LIB:BOOL=OFF **** ") diff --git a/MANIFEST b/MANIFEST index 2f79088..a775ed9 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2374,6 +2374,7 @@ ./config/cmake/hdf5-config-version.cmake.in ./config/cmake/HDFCompilerFlags.cmake ./config/cmake/HDF5Macros.cmake +./config/cmake/HDF5UseFortran.cmake ./config/cmake/libhdf5.settings.cmake.in ./config/cmake/mccacheinit.cmake ./config/cmake/patch.xml diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 4edec03..d021758 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -146,6 +146,10 @@ if (NOT WINDOWS) endif (HDF5_ENABLE_DIRECT_VFD) endif (NOT WINDOWS) +#----------------------------------------------------------------------------- +# Check if C has __float128 extension +#----------------------------------------------------------------------------- +CHECK_TYPE_SIZE("__float128" H5_HAVE_FLOAT128) #----------------------------------------------------------------------------- # Macro to determine the various conversion capabilities @@ -197,11 +201,6 @@ MACRO (H5MiscConversionTest VAR TEST msg) ENDMACRO (H5MiscConversionTest) #----------------------------------------------------------------------------- -# Check if C has __float128 extension -#----------------------------------------------------------------------------- -CHECK_TYPE_SIZE("__float128" _FLOAT128) - -#----------------------------------------------------------------------------- # Check various conversion capabilities #----------------------------------------------------------------------------- @@ -243,3 +242,6 @@ set (FC ${CMAKE_Fortran_COMPILER}) foreach (LINK_LIB ${LINK_LIBS}) set (LIBS "${LIBS} -l${LINK_LIB}") endforeach (LINK_LIB ${LINK_LIBS}) + + + diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index fcbdbd5..f7dcce2 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -63,6 +63,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@ + +/* Determine the maximum decimal precision in C MSB NOT USED??*/ +#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/configure b/configure index 0cac5b3..c48c985 100755 --- a/configure +++ b/configure @@ -5602,7 +5602,7 @@ _ACEOF -## Check for __FLOAT128 extension +## Check for non-standard extenstion __FLOAT128 extension # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. @@ -5718,7 +5718,7 @@ main () FILE * pFile; pFile = fopen("pac_Cconftest.out","w"); - fprintf(pFile, "%d\n %d\n", C_LDBL_DIG, C_FLT128_DIG); + fprintf(pFile, "%d\n%d\n", C_LDBL_DIG, C_FLT128_DIG); ; return 0; @@ -6405,7 +6405,6 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Fortran compiler version compatible with Fortran 2003 HDF" >&5 $as_echo_n "checking if Fortran compiler version compatible with Fortran 2003 HDF... " >&6; } - HAVE_FORTRAN_2003="no" HAVE_F2003_REQUIREMENTS="no" cat > conftest.$ac_ext <<_ACEOF program main @@ -6436,8 +6435,6 @@ rm -f core conftest.err conftest.$ac_objext \ if test "X$HAVE_F2003_REQUIREMENTS" = "Xno"; then as_fn_error $? "Fortran compiler lacks required Fortran 2003 features; unsupported Fortran 2003 compiler, remove --enable-fortran" "$LINENO" 5 - else - HAVE_FORTRAN_2003="yes" fi ## -------------------------------------------------------------------- @@ -7305,8 +7302,7 @@ else WRITE(8,'(I0)') max_decimal_prec WRITE(8,'(I0)') num_ikinds WRITE(8,'(I0)') num_rkinds - - END + END _ACEOF @@ -7525,8 +7521,7 @@ else WRITE(8,'(I0)') max_decimal_prec WRITE(8,'(I0)') num_ikinds WRITE(8,'(I0)') num_rkinds - - END + END _ACEOF @@ -7833,7 +7828,7 @@ $as_echo "#define FORTRAN_HAVE_C_LONG_DOUBLE 1" >>confdefs.h FORTRAN_C_LONG_DOUBLE_IS_UNIQUE="0" if test "X$FORTRAN_HAVE_C_LONG_DOUBLE"; then - FORTRAN_C_LONG_DOUBLE_IS_UNIQUE="no" + C_LONG_DOUBLE_IS_UNIQUE_FORTRAN="no" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Fortran C_LONG_DOUBLE is different from C_DOUBLE" >&5 $as_echo_n "checking if Fortran C_LONG_DOUBLE is different from C_DOUBLE... " >&6; } @@ -7866,14 +7861,14 @@ _ACEOF if ac_fn_fc_try_compile "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - FORTRAN_C_LONG_DOUBLE_IS_UNIQUE="yes" + C_LONG_DOUBLE_IS_UNIQUE_FORTRAN="yes" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "X$FORTRAN_C_LONG_DOUBLE_IS_UNIQUE" = "Xyes"; then + if test "X$C_LONG_DOUBLE_IS_UNIQUE_FORTRAN" = "Xyes"; then FORTRAN_C_LONG_DOUBLE_IS_UNIQUE="1" $as_echo "#define FORTRAN_C_LONG_DOUBLE_IS_UNIQUE 1" >>confdefs.h @@ -7895,7 +7890,7 @@ _ACEOF max_real_fortran_sizeof="`echo \"$PAC_FC_ALL_REAL_KINDS_SIZEOF\" | perl -ne '/,(\d+)\}/; print $1'`" max_real_fortran_kind="`echo \"$PAC_FC_ALL_REAL_KINDS\" | perl -ne '/,(\d+)\}/; print $1'`" - if test "$ac_cv_sizeof___float128" != 0;then + if test "$ac_cv_sizeof___float128" != 0;then if test "$ac_cv_sizeof___float128" != "$max_real_fortran_sizeof" && test "${ac_cv_sizeof_long_double}" != "$max_real_fortran_sizeof"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Fortran REAL(KIND=$max_real_fortran_kind) is $max_real_fortran_sizeof Bytes, but no corresponding C float type exists of that size diff --git a/configure.ac b/configure.ac index 22eb693..fcceafb 100644 --- a/configure.ac +++ b/configure.ac @@ -360,7 +360,7 @@ esac AC_CHECK_SIZEOF([long double], [8]) -## Check for __FLOAT128 extension +## Check for non-standard extenstion __FLOAT128 extension AC_CHECK_SIZEOF([__float128]) AC_CHECK_SIZEOF([_Quad]) HAVE_FLOAT128=0 @@ -457,8 +457,6 @@ if test "X$HDF_FORTRAN" = "Xyes"; then if test "X$HAVE_F2003_REQUIREMENTS" = "Xno"; then AC_MSG_ERROR([Fortran compiler lacks required Fortran 2003 features; unsupported Fortran 2003 compiler, remove --enable-fortran]) - else - HAVE_FORTRAN_2003="yes" fi ## -------------------------------------------------------------------- @@ -563,7 +561,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then FORTRAN_C_LONG_DOUBLE_IS_UNIQUE="0" if test "X$FORTRAN_HAVE_C_LONG_DOUBLE"; then PAC_PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE - if test "X$FORTRAN_C_LONG_DOUBLE_IS_UNIQUE" = "Xyes"; then + if test "X$C_LONG_DOUBLE_IS_UNIQUE_FORTRAN" = "Xyes"; then FORTRAN_C_LONG_DOUBLE_IS_UNIQUE="1" AC_DEFINE([FORTRAN_C_LONG_DOUBLE_IS_UNIQUE], [1], [Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE]) else @@ -583,6 +581,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then max_real_fortran_sizeof="`echo \"[$]PAC_FC_ALL_REAL_KINDS_SIZEOF\" | perl -ne '/,(\d+)\}/; print $1'`" max_real_fortran_kind="`echo \"[$]PAC_FC_ALL_REAL_KINDS\" | perl -ne '/,(\d+)\}/; print $1'`" + dnl remove the invalid kind from the list if test "$ac_cv_sizeof___float128" != 0;then if test "$ac_cv_sizeof___float128" != "$max_real_fortran_sizeof" && test "${ac_cv_sizeof_long_double}" != "$max_real_fortran_sizeof"; then AC_MSG_WARN([ @@ -606,7 +605,6 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_DEFINE_UNQUOTED([H5CONFIG_F_RKIND], $H5CONFIG_F_RKIND, [Define valid Fortran REAL KINDs]) AC_DEFINE_UNQUOTED([H5CONFIG_F_RKIND_SIZEOF], $H5CONFIG_F_RKIND_SIZEOF, [Define valid Fortran REAL KINDs Sizeof]) - dnl remove the invalid kind from the list dnl AC_MSG_WARN([...$PAC_FC_ALL_REAL_KINDS_SIZEOF...$PAC_FC_ALL_REAL_KINDS...]) dnl PAC_FC_ALL_REAL_KINDS="{4,8,16}" dnl tmp3="`echo $PAC_FC_ALL_REAL_KINDS | perl -pe 's/,[0-9]*\}$/\}/g'`" diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index 9fbc987..f751c20 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -29,29 +29,61 @@ #endif ! Define if the intrinsic C_LONG_DOUBLE exists -#define H5_FORTRAN_HAVE_C_LONG_DOUBLE @FORTRAN_HAVE_C_LONG_DOUBLE@ +#define H5_FORTRAN_HAVE_C_LONG_DOUBLE @H5_FORTRAN_HAVE_C_LONG_DOUBLE@ -#if H5_FORTRAN_HAVE_C_LONG_DOUBLE==0 -#undef H5_FORTRAN_HAVE_C_LONG_DOUBLE -#endif +! Define if Fortran C_LONG_DOUBLE is different from C_DOUBLE +#define H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE @FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ + +! Define if the intrinsic module ISO_FORTRAN_ENV exists +#define H5_HAVE_ISO_FORTRAN_ENV @HAVE_ISO_FORTRAN_ENV@ + +! Define the size of C's long double +#define H5_SIZEOF_LONG_DOUBLE @SIZEOF_LONG_DOUBLE@ + +! Define the maximum decimal precision for reals +#define H5_PAC_FC_MAX_REAL_PRECISION @H5_PAC_FC_MAX_REAL_PRECISION@ + +! If C has quad precision +#define H5_HAVE_FLOAT128 @H5_HAVE_FLOAT128@ + +! Define if INTEGER*16 is available +#define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @HAVE_Fortran_INTEGER_SIZEOF_16@ + +! Maximum decimal precision for C +#define H5_PAC_C_MAX_REAL_PRECISION @H5_PAC_C_MAX_REAL_PRECISION@ + +! number of valid REAL KINDs +#define H5_H5CONFIG_F_NUM_RKIND @H5CONFIG_F_NUM_RKIND@ + +! valid REAL KINDs (need to have a matching C counter-part) +#define H5_H5CONFIG_F_RKIND @H5CONFIG_F_RKIND@ + +! valid REAL KINDs (need to have a matching C counter-part) +#define H5_H5CONFIG_F_RKIND_SIZEOF @H5CONFIG_F_RKIND_SIZEOF@ + +! number of valid INTEGER KINDs +#define H5_H5CONFIG_F_NUM_IKIND @H5CONFIG_F_NUM_IKIND@ + +! valid INTEGER KINDs (need to have a matching C counter-part) +#define H5_H5CONFIG_F_IKIND @H5CONFIG_F_IKIND@ ! should this be ${HDF_PREFIX} instead of H5 MSB -#define H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ +!#define H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ -#if H5_SIZEOF_LONG_DOUBLE==0 -#undef H5_SIZEOF_LONG_DOUBLE -#endif +!#if H5_SIZEOF_LONG_DOUBLE==0 +!#undef H5_SIZEOF_LONG_DOUBLE +!#endif ! Define if the C intrinsic __FLOAT128 exists -#define H5_HAVE_FLOAT128 @HAVE_FLOAT128@ +!#define H5_HAVE_FLOAT128 @HAVE_FLOAT128@ -#if H5_HAVE_FLOAT128==0 -#undef H5_HAVE_FLOAT128 -#endif +!#if H5_HAVE_FLOAT128==0 +!#undef H5_HAVE_FLOAT128 +!#endif ! Define if INTEGER*16 is available -#define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @HAVE_Fortran_INTEGER_SIZEOF_16@ +!#define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @HAVE_Fortran_INTEGER_SIZEOF_16@ -#if H5_HAVE_Fortran_INTEGER_SIZEOF_16==0 -#undef H5_HAVE_Fortran_INTEGER_SIZEOF_16 -#endif +!#if H5_HAVE_Fortran_INTEGER_SIZEOF_16==0 +!#undef H5_HAVE_Fortran_INTEGER_SIZEOF_16 +!#endif diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index d71fefd..9b82765 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -23,8 +23,8 @@ set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "$/include>" ) -set_source_files_properties (tf.F90 PROPERTIES LANGUAGE Fortran) -add_library (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} tf.F90) +set_source_files_properties (tf.F90 tf_gen.F90 PROPERTIES LANGUAGE Fortran) +add_library (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} tf.F90 tf_gen.F90) set (SHARED_LINK_FLAGS " ") if (WIN32) diff --git a/hl/fortran/test/CMakeLists.txt b/hl/fortran/test/CMakeLists.txt index 55fb987..d90b524 100644 --- a/hl/fortran/test/CMakeLists.txt +++ b/hl/fortran/test/CMakeLists.txt @@ -7,7 +7,7 @@ PROJECT (HDF5_HL_FORTRAN_TESTS C CXX Fortran) INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src) #-- Adding test for hl_f90_tstds -add_executable (hl_f90_tstds tstds.f90) +add_executable (hl_f90_tstds tstds.F90) TARGET_NAMING (hl_f90_tstds ${LIB_TYPE}) TARGET_FORTRAN_PROPERTIES (hl_f90_tstds ${LIB_TYPE} " " " ") target_link_libraries (hl_f90_tstds ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) @@ -16,7 +16,7 @@ set_target_properties (hl_f90_tstds PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_tstds PROPERTIES FOLDER test/hl/fortran) #-- Adding test for hl_f90_tstlite -add_executable (hl_f90_tstlite tstlite.f90) +add_executable (hl_f90_tstlite tstlite.F90) TARGET_NAMING (hl_f90_tstlite ${LIB_TYPE}) TARGET_FORTRAN_PROPERTIES (hl_f90_tstlite ${LIB_TYPE} " " " ") target_link_libraries (hl_f90_tstlite ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) @@ -25,7 +25,7 @@ set_target_properties (hl_f90_tstlite PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_tstlite PROPERTIES FOLDER test/hl/fortran) #-- Adding test for hl_f90_tstimage -add_executable (hl_f90_tstimage tstimage.f90) +add_executable (hl_f90_tstimage tstimage.F90) TARGET_NAMING (hl_f90_tstimage ${LIB_TYPE}) TARGET_FORTRAN_PROPERTIES (hl_f90_tstimage ${LIB_TYPE} " " " ") target_link_libraries (hl_f90_tstimage ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) @@ -34,7 +34,7 @@ set_target_properties (hl_f90_tstimage PROPERTIES LINKER_LANGUAGE Fortran) set_target_properties (hl_f90_tstimage PROPERTIES FOLDER test/hl/fortran) #-- Adding test for hl_f90_tsttable -add_executable (hl_f90_tsttable tsttable.f90) +add_executable (hl_f90_tsttable tsttable.F90) TARGET_NAMING (hl_f90_tsttable ${LIB_TYPE}) TARGET_FORTRAN_PROPERTIES (hl_f90_tsttable ${LIB_TYPE} " " " ") target_link_libraries (hl_f90_tsttable ${HDF5_HL_F90_LIB_TARGET} ${HDF5_F90_LIB_TARGET}) diff --git a/m4/aclocal_fc.m4 b/m4/aclocal_fc.m4 index f937b64..bd724b1 100644 --- a/m4/aclocal_fc.m4 +++ b/m4/aclocal_fc.m4 @@ -144,7 +144,7 @@ dnl Check if C_LONG_DOUBLE is different from C_DOUBLE if test "X$FORTRAN_HAVE_C_LONG_DOUBLE" = "Xyes"; then AC_DEFUN([PAC_PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE],[ - FORTRAN_C_LONG_DOUBLE_IS_UNIQUE="no" + C_LONG_DOUBLE_IS_UNIQUE_FORTRAN="no" AC_MSG_CHECKING([if Fortran C_LONG_DOUBLE is different from C_DOUBLE]) AC_COMPILE_IFELSE([AC_LANG_SOURCE([ @@ -171,7 +171,7 @@ AC_DEFUN([PAC_PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE],[ CALL h5t(d) END PROGRAM main ])], [AC_MSG_RESULT([yes]) - FORTRAN_C_LONG_DOUBLE_IS_UNIQUE="yes"], + C_LONG_DOUBLE_IS_UNIQUE_FORTRAN="yes"], [AC_MSG_RESULT([no])]) ]) fi @@ -184,7 +184,6 @@ AC_DEFUN([PAC_PROG_FC_HAVE_F2003_REQUIREMENTS],[ dnl -------------------------------------------------------------------- dnl Default for FORTRAN 2003 compliant compilers dnl - HAVE_FORTRAN_2003="no" HAVE_F2003_REQUIREMENTS="no" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ @@ -372,8 +371,7 @@ AC_RUN_IFELSE([ WRITE(8,'(I0)') max_decimal_prec WRITE(8,'(I0)') num_ikinds WRITE(8,'(I0)') num_rkinds - - END + END ]) ],[ if test -s pac_fconftest.out ; then @@ -584,7 +582,7 @@ rm -f pac_Cconftest.out ],[[ FILE * pFile; pFile = fopen("pac_Cconftest.out","w"); - fprintf(pFile, "%d\n %d\n", C_LDBL_DIG, C_FLT128_DIG); + fprintf(pFile, "%d\n%d\n", C_LDBL_DIG, C_FLT128_DIG); ]]) ]) AC_RUN_IFELSE([],[ -- cgit v0.12