diff options
-rwxr-xr-x | configure | 142 | ||||
-rw-r--r-- | configure.ac | 24 | ||||
-rw-r--r-- | fortran/src/H5Aff.F90 | 19 | ||||
-rw-r--r-- | fortran/src/H5Dff.F90 | 17 | ||||
-rw-r--r-- | fortran/src/H5Pff.F90 | 31 | ||||
-rw-r--r-- | fortran/src/H5config_f.inc.in | 3 | ||||
-rw-r--r-- | hl/fortran/src/H5LTff.F90 | 23 | ||||
-rw-r--r-- | hl/fortran/src/H5TBff.F90 | 23 | ||||
-rw-r--r-- | m4/aclocal_fc.m4 | 35 | ||||
-rw-r--r-- | src/H5config.h.in | 3 |
10 files changed, 250 insertions, 70 deletions
@@ -1805,10 +1805,10 @@ fi } # ac_fn_fc_try_compile -# ac_fn_c_try_link LINENO -# ----------------------- +# ac_fn_fc_try_link LINENO +# ------------------------ # Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () +ac_fn_fc_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext @@ -1828,7 +1828,7 @@ $as_echo "$ac_try_echo"; } >&5 fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || + test -z "$ac_fc_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || @@ -1849,12 +1849,12 @@ fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} # ac_fn_c_try_link +} # ac_fn_fc_try_link -# ac_fn_fc_try_link LINENO -# ------------------------ +# ac_fn_c_try_link LINENO +# ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_fc_try_link () +ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext @@ -1874,7 +1874,7 @@ $as_echo "$ac_try_echo"; } >&5 fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { - test -z "$ac_fc_werror_flag" || + test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || @@ -1895,7 +1895,7 @@ fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval -} # ac_fn_fc_try_link +} # ac_fn_c_try_link # ac_fn_cxx_try_compile LINENO # ---------------------------- @@ -5728,6 +5728,46 @@ ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest ac_compiler_gnu=$ac_cv_fc_compiler_gnu + ## Checking if the compiler supports the required Fortran 2003 features and + ## stopping if it does not. + + { $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 + + + USE iso_c_binding + IMPLICIT NONE + TYPE(C_PTR) :: ptr + TYPE(C_FUNPTR) :: funptr + CHARACTER(LEN=80, KIND=c_char), TARGET :: ichr + + ptr = C_LOC(ichr(1:1)) + + + end +_ACEOF +if ac_fn_fc_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_F2003_REQUIREMENTS=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_exeext conftest.$ac_ext + + + if test "X$HAVE_F2003_REQUIREMENTS" = "Xno"; then + as_fn_error $? "Fortran compiler lacks required Fortran 2003 features; unsupported Fortran 2003 compiler, remove --enable-fortran2003" "$LINENO" 5 + else + HAVE_FORTRAN_2003="yes" + fi + ## -------------------------------------------------------------------- ## Define wrappers for the C compiler to use Fortran function names ## @@ -6492,6 +6532,49 @@ rm -f core conftest.err conftest.$ac_objext \ + ## See if C_LONG_DOUBLE is available, and if it is different from C_DOUBLE + + HAVE_C_LONG_DOUBLE_FORTRAN="no" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if Fortran C_LONG_DOUBLE is valid" >&5 +$as_echo_n "checking if Fortran C_LONG_DOUBLE is valid... " >&6; } + + cat > conftest.$ac_ext <<_ACEOF + + 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 + +_ACEOF +if ac_fn_fc_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + HAVE_C_LONG_DOUBLE_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 neither intrinsic functions SIZEOF or STORAGE_SIZE is available then stop configure with an error if test "X$HAVE_SIZEOF_FORTRAN" = "Xno" && test "X$HAVE_STORAGE_SIZE_FORTRAN" = "Xno"; then as_fn_error $? "Fortran compiler requires either intrinsic functions SIZEOF or STORAGE_SIZE" "$LINENO" 5 @@ -6515,45 +6598,10 @@ $as_echo "#define FORTRAN_HAVE_SIZEOF 1" >>confdefs.h fi + if test "X$HAVE_C_LONG_DOUBLE_FORTRAN" = "Xyes"; then - ## Checking if the compiler supports the required Fortran 2003 features and - ## disable Fortran 2003 if it does not. - - { $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 - +$as_echo "#define FORTRAN_HAVE_C_LONG_DOUBLE 1" >>confdefs.h - USE iso_c_binding - IMPLICIT NONE - TYPE(C_PTR) :: ptr - TYPE(C_FUNPTR) :: funptr - CHARACTER(LEN=80, KIND=c_char), TARGET :: ichr - - ptr = C_LOC(ichr(1:1)) - - - end -_ACEOF -if ac_fn_fc_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - HAVE_F2003_REQUIREMENTS=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_exeext conftest.$ac_ext - - - if test "X$HAVE_F2003_REQUIREMENTS" = "Xno"; then - as_fn_error $? "Fortran compiler lacks required Fortran 2003 features; unsupported Fortran 2003 compiler, remove --enable-fortran2003" "$LINENO" 5 - else - HAVE_FORTRAN_2003="yes" fi else FC="no" diff --git a/configure.ac b/configure.ac index c84d933..9afb028 100644 --- a/configure.ac +++ b/configure.ac @@ -401,6 +401,16 @@ if test "X$HDF_FORTRAN" = "Xyes"; then ## Change to the Fortran 90 language AC_LANG_PUSH(Fortran) + ## Checking if the compiler supports the required Fortran 2003 features and + ## stopping if it does not. + PAC_PROG_FC_HAVE_F2003_REQUIREMENTS + + if test "X$HAVE_F2003_REQUIREMENTS" = "Xno"; then + AC_MSG_ERROR([Fortran compiler lacks required Fortran 2003 features; unsupported Fortran 2003 compiler, remove --enable-fortran2003]) + else + HAVE_FORTRAN_2003="yes" + fi + ## -------------------------------------------------------------------- ## Define wrappers for the C compiler to use Fortran function names ## @@ -416,6 +426,9 @@ if test "X$HDF_FORTRAN" = "Xyes"; then ## See if the fortran compiler supports the intrinsic function "STORAGE_SIZE" PAC_PROG_FC_STORAGE_SIZE + ## See if C_LONG_DOUBLE is available, and if it is different from C_DOUBLE + PAC_PROG_FC_HAVE_C_LONG_DOUBLE + ## If neither intrinsic functions SIZEOF or STORAGE_SIZE is available then stop configure with an error if test "X$HAVE_SIZEOF_FORTRAN" = "Xno" && test "X$HAVE_STORAGE_SIZE_FORTRAN" = "Xno"; then AC_MSG_ERROR([Fortran compiler requires either intrinsic functions SIZEOF or STORAGE_SIZE]) @@ -433,15 +446,8 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_DEFINE([FORTRAN_HAVE_SIZEOF], [1], [Define if we have Fortran intrinsic SIZEOF]) fi - - ## Checking if the compiler supports the required Fortran 2003 features and - ## disable Fortran 2003 if it does not. - PAC_PROG_FC_HAVE_F2003_REQUIREMENTS - - if test "X$HAVE_F2003_REQUIREMENTS" = "Xno"; then - AC_MSG_ERROR([Fortran compiler lacks required Fortran 2003 features; unsupported Fortran 2003 compiler, remove --enable-fortran2003]) - else - HAVE_FORTRAN_2003="yes" + if test "X$HAVE_C_LONG_DOUBLE_FORTRAN" = "Xyes"; then + AC_DEFINE([FORTRAN_HAVE_C_LONG_DOUBLE], [1], [Define if we have Fortran C_LONG_DOUBLE]) fi else FC="no" diff --git a/fortran/src/H5Aff.F90 b/fortran/src/H5Aff.F90 index dc54a0b..3a59e3b 100644 --- a/fortran/src/H5Aff.F90 +++ b/fortran/src/H5Aff.F90 @@ -64,10 +64,12 @@ ! !***** +#include "H5config_f.inc" + MODULE H5A - USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_ptr, c_char, c_int, C_NULL_CHAR, C_LOC, & - C_FLOAT, C_DOUBLE, C_LONG_DOUBLE + USE, INTRINSIC :: ISO_C_BINDING + USE H5GLOBAL INTERFACE h5awrite_f @@ -103,6 +105,7 @@ MODULE H5A MODULE PROCEDURE h5awrite_c_double_5 MODULE PROCEDURE h5awrite_c_double_6 MODULE PROCEDURE h5awrite_c_double_7 +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5awrite_c_long_double_scalar MODULE PROCEDURE h5awrite_c_long_double_1 MODULE PROCEDURE h5awrite_c_long_double_2 @@ -111,6 +114,7 @@ MODULE H5A MODULE PROCEDURE h5awrite_c_long_double_5 MODULE PROCEDURE h5awrite_c_long_double_6 MODULE PROCEDURE h5awrite_c_long_double_7 +#endif ! This is the preferred way to call h5awrite ! by passing an address MODULE PROCEDURE h5awrite_ptr @@ -149,6 +153,7 @@ MODULE H5A MODULE PROCEDURE h5aread_c_double_5 MODULE PROCEDURE h5aread_c_double_6 MODULE PROCEDURE h5aread_c_double_7 +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5aread_c_long_double_scalar MODULE PROCEDURE h5aread_c_long_double_1 MODULE PROCEDURE h5aread_c_long_double_2 @@ -157,6 +162,7 @@ MODULE H5A MODULE PROCEDURE h5aread_c_long_double_5 MODULE PROCEDURE h5aread_c_long_double_6 MODULE PROCEDURE h5aread_c_long_double_7 +#endif ! This is the preferred way to call h5aread ! by passing an address MODULE PROCEDURE h5aread_ptr @@ -2323,7 +2329,6 @@ CONTAINS hdferr = H5Awrite_f_c(attr_id, memtype_id, f_ptr) END SUBROUTINE h5awrite_c_double_6 - SUBROUTINE h5awrite_c_double_7(attr_id, memtype_id, buf, dims, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier @@ -2342,7 +2347,7 @@ CONTAINS END SUBROUTINE h5awrite_c_double_7 - +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE SUBROUTINE h5awrite_c_long_double_scalar(attr_id, memtype_id, buf, dims, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier @@ -2358,7 +2363,6 @@ CONTAINS hdferr = H5Awrite_f_c(attr_id, memtype_id, f_ptr) END SUBROUTINE h5awrite_c_long_double_scalar - SUBROUTINE h5awrite_c_long_double_1(attr_id, memtype_id, buf, dims, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier @@ -2484,6 +2488,7 @@ CONTAINS hdferr = H5Awrite_f_c(attr_id, memtype_id, f_ptr) END SUBROUTINE h5awrite_c_long_double_7 +#endif SUBROUTINE H5Awrite_char_scalar(attr_id, memtype_id, buf, dims, hdferr) IMPLICIT NONE @@ -3133,6 +3138,8 @@ CONTAINS hdferr = H5Aread_f_c(attr_id, memtype_id, f_ptr) END SUBROUTINE h5aread_c_double_7 +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE + SUBROUTINE h5aread_c_long_double_scalar(attr_id, memtype_id, buf, dims, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier @@ -3272,6 +3279,8 @@ CONTAINS hdferr = H5Aread_f_c(attr_id, memtype_id, f_ptr) END SUBROUTINE h5aread_c_long_double_7 +#endif + SUBROUTINE H5Aread_char_scalar(attr_id, memtype_id, buf, dims, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: attr_id ! Attribute identifier diff --git a/fortran/src/H5Dff.F90 b/fortran/src/H5Dff.F90 index 00f3975..090ea08 100644 --- a/fortran/src/H5Dff.F90 +++ b/fortran/src/H5Dff.F90 @@ -79,9 +79,11 @@ ! !***** +#include "H5config_f.inc" + MODULE H5D - USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_CHAR, C_FLOAT, C_DOUBLE, C_LOC, C_LONG_DOUBLE + USE, INTRINSIC :: ISO_C_BINDING USE H5GLOBAL INTERFACE h5dextend_f @@ -135,6 +137,7 @@ MODULE H5D MODULE PROCEDURE h5dwrite_c_double_5 MODULE PROCEDURE h5dwrite_c_double_6 MODULE PROCEDURE h5dwrite_c_double_7 +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5dwrite_c_long_double_scalar MODULE PROCEDURE h5dwrite_c_long_double_1 MODULE PROCEDURE h5dwrite_c_long_double_2 @@ -143,6 +146,7 @@ MODULE H5D MODULE PROCEDURE h5dwrite_c_long_double_5 MODULE PROCEDURE h5dwrite_c_long_double_6 MODULE PROCEDURE h5dwrite_c_long_double_7 +#endif ! This is the preferred way to call h5dwrite ! by passing an address MODULE PROCEDURE h5dwrite_ptr @@ -183,6 +187,7 @@ MODULE H5D MODULE PROCEDURE h5dread_c_double_5 MODULE PROCEDURE h5dread_c_double_6 MODULE PROCEDURE h5dread_c_double_7 +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5dread_c_long_double_scalar MODULE PROCEDURE h5dread_c_long_double_1 MODULE PROCEDURE h5dread_c_long_double_2 @@ -191,6 +196,7 @@ MODULE H5D MODULE PROCEDURE h5dread_c_long_double_5 MODULE PROCEDURE h5dread_c_long_double_6 MODULE PROCEDURE h5dread_c_long_double_7 +#endif ! This is the preferred way to call h5dread ! by passing an address MODULE PROCEDURE h5dread_ptr @@ -242,7 +248,9 @@ MODULE H5D MODULE PROCEDURE h5dfill_integer MODULE PROCEDURE h5dfill_c_float MODULE PROCEDURE h5dfill_c_double +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5dfill_c_long_double +#endif MODULE PROCEDURE h5dfill_char END INTERFACE @@ -3378,6 +3386,7 @@ CONTAINS END SUBROUTINE h5dread_c_double_7 +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE SUBROUTINE h5dread_c_long_double_scalar(dset_id, mem_type_id, buf, dims, hdferr, & mem_space_id, file_space_id, xfer_prp) IMPLICIT NONE @@ -3661,6 +3670,7 @@ CONTAINS file_space_id_default, xfer_prp_default, f_ptr) END SUBROUTINE h5dread_c_long_double_7 +#endif SUBROUTINE h5dwrite_c_double_scalar(dset_id, mem_type_id, buf, dims, hdferr, & mem_space_id, file_space_id, xfer_prp) @@ -3943,6 +3953,7 @@ CONTAINS END SUBROUTINE h5dwrite_c_double_7 +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE SUBROUTINE h5dwrite_c_long_double_scalar(dset_id, mem_type_id, buf, dims, hdferr, & mem_space_id, file_space_id, xfer_prp) IMPLICIT NONE @@ -4223,6 +4234,7 @@ CONTAINS file_space_id_default, xfer_prp_default, f_ptr) END SUBROUTINE h5dwrite_c_long_double_7 +#endif !****s* H5D (F03)/h5dwrite_f_F03 ! @@ -4502,6 +4514,7 @@ CONTAINS END SUBROUTINE h5dfill_c_double +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE SUBROUTINE h5dfill_c_long_double(fill_value, space_id, buf, hdferr) IMPLICIT NONE REAL(KIND=C_LONG_DOUBLE), INTENT(IN), TARGET :: fill_value ! Fill value @@ -4525,7 +4538,7 @@ CONTAINS f_ptr_buf, mem_type_id) END SUBROUTINE h5dfill_c_long_double - +#endif ! ! NAME ! h5dfill_char diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index b9d2240..4e74b9c 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -33,9 +33,7 @@ MODULE H5P -! Can't specify ONLY because of a bug in gfortran < v4.7 Bug: 45190, 37829 - USE, INTRINSIC :: ISO_C_BINDING !, ONLY : c_ptr, c_null_ptr, c_funptr, c_null_funptr, & -! c_char, c_int, C_NULL_CHAR, C_LOC, C_DOUBLE, C_FLOAT + USE, INTRINSIC :: ISO_C_BINDING USE H5GLOBAL INTERFACE h5pset_fapl_multi_f @@ -47,7 +45,9 @@ MODULE H5P MODULE PROCEDURE h5pset_fill_value_integer MODULE PROCEDURE h5pset_fill_value_c_float MODULE PROCEDURE h5pset_fill_value_c_double +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5pset_fill_value_c_long_double +#endif MODULE PROCEDURE h5pset_fill_value_char ! Recommended procedure: MODULE PROCEDURE h5pset_fill_value_ptr @@ -58,7 +58,9 @@ MODULE H5P MODULE PROCEDURE h5pget_fill_value_integer MODULE PROCEDURE h5pget_fill_value_c_float MODULE PROCEDURE h5pget_fill_value_c_double +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5pget_fill_value_c_long_double +#endif MODULE PROCEDURE h5pget_fill_value_char ! Recommended procedure: MODULE PROCEDURE h5pget_fill_value_ptr @@ -69,7 +71,9 @@ MODULE H5P MODULE PROCEDURE h5pset_integer MODULE PROCEDURE h5pset_c_float MODULE PROCEDURE h5pset_c_double +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5pset_c_long_double +#endif MODULE PROCEDURE h5pset_char ! Recommended procedure: MODULE PROCEDURE h5pset_ptr @@ -80,7 +84,9 @@ MODULE H5P MODULE PROCEDURE h5pget_integer MODULE PROCEDURE h5pget_c_float MODULE PROCEDURE h5pget_c_double +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5pget_c_long_double +#endif ! Recommended procedure: MODULE PROCEDURE h5pget_ptr END INTERFACE @@ -89,7 +95,9 @@ MODULE H5P MODULE PROCEDURE h5pregister_integer MODULE PROCEDURE h5pregister_c_float MODULE PROCEDURE h5pregister_c_double +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5pregister_c_long_double +#endif ! Recommended procedure: MODULE PROCEDURE h5pregister_ptr END INTERFACE @@ -98,7 +106,9 @@ MODULE H5P MODULE PROCEDURE h5pinsert_integer MODULE PROCEDURE h5pinsert_c_float MODULE PROCEDURE h5pinsert_c_double +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5pinsert_c_long_double +#endif MODULE PROCEDURE h5pinsert_char ! Recommended procedure: MODULE PROCEDURE h5pinsert_ptr @@ -6295,6 +6305,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) hdferr = h5pset_fill_value_c(prp_id, type_id, f_ptr) END SUBROUTINE h5pset_fill_value_c_double +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE SUBROUTINE h5pset_fill_value_c_long_double(prp_id, type_id, fillvalue, hdferr) IMPLICIT NONE INTEGER(HID_T), INTENT(IN) :: prp_id ! Property list identifier @@ -6308,6 +6319,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) f_ptr = C_LOC(fillvalue) hdferr = h5pset_fill_value_c(prp_id, type_id, f_ptr) END SUBROUTINE h5pset_fill_value_c_long_double +#endif SUBROUTINE h5pget_fill_value_c_float(prp_id, type_id, fillvalue, hdferr) IMPLICIT NONE @@ -6340,6 +6352,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pget_fill_value_c_double +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE SUBROUTINE h5pget_fill_value_c_long_double(prp_id, type_id, fillvalue, & hdferr) IMPLICIT NONE @@ -6355,6 +6368,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) hdferr = h5pget_fill_value_c(prp_id, type_id, f_ptr) END SUBROUTINE h5pget_fill_value_c_long_double +#endif SUBROUTINE h5pset_fill_value_char(prp_id, type_id, fillvalue, hdferr) IMPLICIT NONE @@ -6617,6 +6631,9 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) hdferr = h5pget_c(prp_id, name, name_len, f_ptr) END SUBROUTINE h5pset_c_double + + +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE ! !****s* H5P (F90)/h5pset_c_long_double ! @@ -6654,6 +6671,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) hdferr = h5pget_c(prp_id, name, name_len, f_ptr) END SUBROUTINE h5pset_c_long_double +#endif SUBROUTINE h5pset_char(prp_id, name, value, hdferr) IMPLICIT NONE @@ -6790,6 +6808,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) hdferr = h5pget_c(prp_id, name, name_len, f_ptr) END SUBROUTINE h5pget_c_double +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE !****s* H5P (F90)/h5pget_c_long_double ! ! NAME @@ -6826,6 +6845,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) name_len = LEN(name) hdferr = h5pget_c(prp_id, name, name_len, f_ptr) END SUBROUTINE h5pget_c_long_double +#endif SUBROUTINE h5pget_char(prp_id, name, value, hdferr) IMPLICIT NONE @@ -7049,7 +7069,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pregister_c_double - +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE ! !****s* H5P/h5pregister_c_long_double ! @@ -7092,6 +7112,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) hdferr = h5pregister_c(class, name, name_len, size, f_ptr) END SUBROUTINE h5pregister_c_long_double +#endif SUBROUTINE h5pregister_char(class, name, size, value, hdferr) IMPLICIT NONE @@ -7277,6 +7298,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pinsert_c_double +#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE !****s* H5P (F90)/h5pinsert_c_long_double ! ! NAME @@ -7317,6 +7339,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) hdferr = h5pinsert_c(plist, name , name_len, size, f_ptr) END SUBROUTINE h5pinsert_c_long_double +#endif SUBROUTINE h5pinsert_char(plist, name, size, value, hdferr) IMPLICIT NONE diff --git a/fortran/src/H5config_f.inc.in b/fortran/src/H5config_f.inc.in index ceecd36..dde4c11 100644 --- a/fortran/src/H5config_f.inc.in +++ b/fortran/src/H5config_f.inc.in @@ -11,3 +11,6 @@ ! Define if the intrinsic function C_SIZEOF exists #undef FORTRAN_HAVE_C_SIZEOF + +! Define if the intrinsic function C_LONG_DOUBLE exists +#undef FORTRAN_HAVE_C_LONG_DOUBLE diff --git a/hl/fortran/src/H5LTff.F90 b/hl/fortran/src/H5LTff.F90 index 0d05a36..8334a76 100644 --- a/hl/fortran/src/H5LTff.F90 +++ b/hl/fortran/src/H5LTff.F90 @@ -30,6 +30,7 @@ ! This is needed for Windows based operating systems. ! +#include "H5config_f.inc" MODULE h5lt USE, INTRINSIC :: ISO_C_BINDING USE h5fortran_types @@ -57,6 +58,7 @@ MODULE h5lt MODULE PROCEDURE h5ltmake_dataset_f_c_double5 MODULE PROCEDURE h5ltmake_dataset_f_c_double6 MODULE PROCEDURE h5ltmake_dataset_f_c_double7 +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5ltmake_dataset_f_c_long_double1 MODULE PROCEDURE h5ltmake_dataset_f_c_long_double2 MODULE PROCEDURE h5ltmake_dataset_f_c_long_double3 @@ -64,6 +66,7 @@ MODULE h5lt MODULE PROCEDURE h5ltmake_dataset_f_c_long_double5 MODULE PROCEDURE h5ltmake_dataset_f_c_long_double6 MODULE PROCEDURE h5ltmake_dataset_f_c_long_double7 +#endif END INTERFACE INTERFACE h5ltread_dataset_f @@ -88,6 +91,7 @@ MODULE h5lt MODULE PROCEDURE h5ltread_dataset_f_c_double5 MODULE PROCEDURE h5ltread_dataset_f_c_double6 MODULE PROCEDURE h5ltread_dataset_f_c_double7 +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5ltread_dataset_f_c_long_double1 MODULE PROCEDURE h5ltread_dataset_f_c_long_double2 MODULE PROCEDURE h5ltread_dataset_f_c_long_double3 @@ -95,6 +99,7 @@ MODULE h5lt MODULE PROCEDURE h5ltread_dataset_f_c_long_double5 MODULE PROCEDURE h5ltread_dataset_f_c_long_double6 MODULE PROCEDURE h5ltread_dataset_f_c_long_double7 +#endif END INTERFACE INTERFACE h5ltmake_dataset_int_f @@ -122,6 +127,7 @@ MODULE h5lt MODULE PROCEDURE h5ltmake_dataset_c_double_f_5 MODULE PROCEDURE h5ltmake_dataset_c_double_f_6 MODULE PROCEDURE h5ltmake_dataset_c_double_f_7 +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5ltmake_dataset_c_long_double_f_1 MODULE PROCEDURE h5ltmake_dataset_c_long_double_f_2 MODULE PROCEDURE h5ltmake_dataset_c_long_double_f_3 @@ -129,6 +135,7 @@ MODULE h5lt MODULE PROCEDURE h5ltmake_dataset_c_long_double_f_5 MODULE PROCEDURE h5ltmake_dataset_c_long_double_f_6 MODULE PROCEDURE h5ltmake_dataset_c_long_double_f_7 +#endif END INTERFACE INTERFACE h5ltmake_dataset_double_f @@ -146,6 +153,7 @@ MODULE h5lt MODULE PROCEDURE h5ltmake_dataset_c_double_f_5 MODULE PROCEDURE h5ltmake_dataset_c_double_f_6 MODULE PROCEDURE h5ltmake_dataset_c_double_f_7 +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5ltmake_dataset_c_long_double_f_1 MODULE PROCEDURE h5ltmake_dataset_c_long_double_f_2 MODULE PROCEDURE h5ltmake_dataset_c_long_double_f_3 @@ -153,6 +161,7 @@ MODULE h5lt MODULE PROCEDURE h5ltmake_dataset_c_long_double_f_5 MODULE PROCEDURE h5ltmake_dataset_c_long_double_f_6 MODULE PROCEDURE h5ltmake_dataset_c_long_double_f_7 +#endif END INTERFACE INTERFACE h5ltread_dataset_int_f @@ -180,6 +189,7 @@ MODULE h5lt MODULE PROCEDURE h5ltread_dataset_c_double_f_5 MODULE PROCEDURE h5ltread_dataset_c_double_f_6 MODULE PROCEDURE h5ltread_dataset_c_double_f_7 +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5ltread_dataset_c_long_double_f_1 MODULE PROCEDURE h5ltread_dataset_c_long_double_f_2 MODULE PROCEDURE h5ltread_dataset_c_long_double_f_3 @@ -187,6 +197,7 @@ MODULE h5lt MODULE PROCEDURE h5ltread_dataset_c_long_double_f_5 MODULE PROCEDURE h5ltread_dataset_c_long_double_f_6 MODULE PROCEDURE h5ltread_dataset_c_long_double_f_7 +#endif END INTERFACE INTERFACE h5ltread_dataset_double_f @@ -204,6 +215,7 @@ MODULE h5lt MODULE PROCEDURE h5ltread_dataset_c_double_f_5 MODULE PROCEDURE h5ltread_dataset_c_double_f_6 MODULE PROCEDURE h5ltread_dataset_c_double_f_7 +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5ltread_dataset_c_long_double_f_1 MODULE PROCEDURE h5ltread_dataset_c_long_double_f_2 MODULE PROCEDURE h5ltread_dataset_c_long_double_f_3 @@ -211,6 +223,7 @@ MODULE h5lt MODULE PROCEDURE h5ltread_dataset_c_long_double_f_5 MODULE PROCEDURE h5ltread_dataset_c_long_double_f_6 MODULE PROCEDURE h5ltread_dataset_c_long_double_f_7 +#endif END INTERFACE INTERFACE @@ -835,6 +848,7 @@ CONTAINS END SUBROUTINE h5ltmake_dataset_f_c_double7 +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE !------------------------------------------------------------------------- ! Function(s): h5ltmake_dataset_f_c_long_double(1-7) ! @@ -1012,6 +1026,8 @@ CONTAINS END SUBROUTINE h5ltmake_dataset_f_c_long_double7 +#endif + !------------------------------------------------------------------------- ! Function(s): h5ltread_dataset_f_int(1-7) ! @@ -1590,6 +1606,7 @@ CONTAINS END SUBROUTINE h5ltread_dataset_f_c_double7 +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE !------------------------------------------------------------------------- ! Function(s): h5ltread_dataset_f_c_long_double(1-7) ! @@ -1764,6 +1781,7 @@ CONTAINS errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,type_id,f_ptr,dims) END SUBROUTINE h5ltread_dataset_f_c_long_double7 +#endif !------------------------------------------------------------------------- ! Function: h5ltmake_dataset_int_f_1 @@ -2291,6 +2309,7 @@ CONTAINS END SUBROUTINE h5ltmake_dataset_c_double_f_7 +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE !------------------------------------------------------------------------- ! Function(s): h5ltmake_dataset_c_long_double_f_(1-7) ! @@ -2466,6 +2485,7 @@ CONTAINS errcode = h5ltmake_dataset_c(loc_id,namelen,dset_name,rank,dims,H5T_NATIVE_DOUBLE,f_ptr) END SUBROUTINE h5ltmake_dataset_c_long_double_f_7 +#endif !------------------------------------------------------------------------- ! Function(s): h5ltread_dataset_int_f_(1-7) @@ -2954,6 +2974,7 @@ CONTAINS END SUBROUTINE h5ltread_dataset_c_double_f_7 +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE !------------------------------------------------------------------------- ! Function9s): h5ltread_dataset_c_long_double_f_(1-7) ! @@ -3115,7 +3136,7 @@ CONTAINS errcode = h5ltread_dataset_c(loc_id,namelen,dset_name,H5T_NATIVE_DOUBLE,f_ptr,dims) END SUBROUTINE h5ltread_dataset_c_long_double_f_7 - +#endif !------------------------------------------------------------------------- ! Function: h5ltmake_dataset_string_f diff --git a/hl/fortran/src/H5TBff.F90 b/hl/fortran/src/H5TBff.F90 index 26f80dc..34894a5 100644 --- a/hl/fortran/src/H5TBff.F90 +++ b/hl/fortran/src/H5TBff.F90 @@ -30,6 +30,7 @@ ! Windows dll file 'hdf5_hl_fortrandll.def.in' in the hl/fortran/src directory. ! This is needed for Windows based operating systems. ! +#include "H5config_f.inc" MODULE h5tb @@ -37,12 +38,13 @@ MODULE h5tb USE h5fortran_types USE hdf5 - INTERFACE h5tbwrite_field_name_f MODULE PROCEDURE h5tbwrite_field_name_f_int MODULE PROCEDURE h5tbwrite_field_name_f_c_float MODULE PROCEDURE h5tbwrite_field_name_f_c_double +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5tbwrite_field_name_f_c_long_double +#endif MODULE PROCEDURE h5tbwrite_field_name_f_string END INTERFACE @@ -50,7 +52,9 @@ MODULE h5tb MODULE PROCEDURE h5tbread_field_name_f_int MODULE PROCEDURE h5tbread_field_name_f_c_float MODULE PROCEDURE h5tbread_field_name_f_c_double +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5tbread_field_name_f_c_long_double +#endif MODULE PROCEDURE h5tbread_field_name_f_string END INTERFACE @@ -58,7 +62,9 @@ MODULE h5tb MODULE PROCEDURE h5tbwrite_field_index_f_int MODULE PROCEDURE h5tbwrite_field_index_f_c_float MODULE PROCEDURE h5tbwrite_field_index_f_c_double +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5tbwrite_field_index_f_c_long_double +#endif MODULE PROCEDURE h5tbwrite_field_index_f_string END INTERFACE @@ -66,7 +72,9 @@ MODULE h5tb MODULE PROCEDURE h5tbread_field_index_f_int MODULE PROCEDURE h5tbread_field_index_f_c_float MODULE PROCEDURE h5tbread_field_index_f_c_double +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5tbread_field_index_f_c_long_double +#endif MODULE PROCEDURE h5tbread_field_index_f_string END INTERFACE @@ -74,7 +82,9 @@ MODULE h5tb MODULE PROCEDURE h5tbinsert_field_f_int MODULE PROCEDURE h5tbinsert_field_f_c_float MODULE PROCEDURE h5tbinsert_field_f_c_double +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE MODULE PROCEDURE h5tbinsert_field_f_c_long_double +#endif MODULE PROCEDURE h5tbinsert_field_f_string END INTERFACE @@ -98,7 +108,6 @@ MODULE h5tb END FUNCTION h5tbwrite_field_name_c END INTERFACE - INTERFACE INTEGER FUNCTION h5tbread_field_name_c(loc_id,namelen,dset_name,namelen1,field_name, & start,nrecords,type_size,buf) & @@ -404,6 +413,7 @@ CONTAINS END SUBROUTINE h5tbwrite_field_name_f_c_double +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE SUBROUTINE h5tbwrite_field_name_f_c_long_double(loc_id,& dset_name,& field_name,& @@ -436,6 +446,7 @@ CONTAINS start,nrecords,type_size,f_ptr) END SUBROUTINE h5tbwrite_field_name_f_c_long_double +#endif SUBROUTINE h5tbwrite_field_name_f_string(loc_id,& dset_name,& @@ -583,6 +594,7 @@ CONTAINS END SUBROUTINE h5tbread_field_name_f_c_double +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE SUBROUTINE h5tbread_field_name_f_c_long_double(loc_id,& dset_name,& field_name,& @@ -614,6 +626,7 @@ CONTAINS start,nrecords,type_size,f_ptr) END SUBROUTINE h5tbread_field_name_f_c_long_double +#endif SUBROUTINE h5tbread_field_name_f_string(loc_id,& dset_name,& @@ -753,6 +766,7 @@ CONTAINS END SUBROUTINE h5tbwrite_field_index_f_c_double +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE SUBROUTINE h5tbwrite_field_index_f_c_long_double(loc_id,& dset_name,& field_index,& @@ -782,6 +796,7 @@ CONTAINS start,nrecords,type_size,f_ptr) END SUBROUTINE h5tbwrite_field_index_f_c_long_double +#endif SUBROUTINE h5tbwrite_field_index_f_string(loc_id,& dset_name,& @@ -916,6 +931,7 @@ CONTAINS END SUBROUTINE h5tbread_field_index_f_c_double +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE SUBROUTINE h5tbread_field_index_f_c_long_double(loc_id,& dset_name,& field_index,& @@ -944,6 +960,7 @@ CONTAINS start,nrecords,type_size,f_ptr) END SUBROUTINE h5tbread_field_index_f_c_long_double +#endif SUBROUTINE h5tbread_field_index_f_string(loc_id,& dset_name,& @@ -1076,6 +1093,7 @@ CONTAINS END SUBROUTINE h5tbinsert_field_f_c_double +#ifdef FORTRAN_HAVE_C_LONG_DOUBLE SUBROUTINE h5tbinsert_field_f_c_long_double(loc_id,& dset_name,& field_name,& @@ -1104,6 +1122,7 @@ CONTAINS field_type,field_index,f_ptr) END SUBROUTINE h5tbinsert_field_f_c_long_double +#endif SUBROUTINE h5tbinsert_field_f_string(loc_id,& dset_name,& diff --git a/m4/aclocal_fc.m4 b/m4/aclocal_fc.m4 index c177143..571ad43 100644 --- a/m4/aclocal_fc.m4 +++ b/m4/aclocal_fc.m4 @@ -111,6 +111,41 @@ AC_DEFUN([PAC_PROG_FC_STORAGE_SIZE],[ ]) +dnl Check to see C_LONG_DOUBLE is available, and if it +dnl is different from C_DOUBLE + +AC_DEFUN([PAC_PROG_FC_HAVE_C_LONG_DOUBLE],[ + HAVE_C_LONG_DOUBLE_FORTRAN="no" + AC_MSG_CHECKING([if Fortran C_LONG_DOUBLE is valid]) + + AC_COMPILE_IFELSE([AC_LANG_SOURCE([ + 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 + ])], [AC_MSG_RESULT([yes]) + HAVE_C_LONG_DOUBLE_FORTRAN="yes"], + [AC_MSG_RESULT([no])]) +]) + dnl Checking if the compiler supports the required Fortran 2003 features and dnl disable Fortran 2003 if it does not. diff --git a/src/H5config.h.in b/src/H5config.h.in index 1cfc395..2b34ade 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -30,6 +30,9 @@ /* As FC_FUNC, but for C identifiers containing underscores. */ #undef FC_FUNC_ +/* Define if we have Fortran C_LONG_DOUBLE */ +#undef FORTRAN_HAVE_C_LONG_DOUBLE + /* Define if we have Fortran intrinsic C_SIZEOF */ #undef FORTRAN_HAVE_C_SIZEOF |