From 85bcb7790404198084b47f9dcf49d8ab08f4aa4f Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Tue, 16 Jun 2015 16:47:00 -0500 Subject: [svn-r27221] Reworked Fortran autools REAL KIND detection. --- Makefile.in | 5 + c++/Makefile.in | 5 + c++/examples/Makefile.in | 5 + c++/src/Makefile.in | 5 + c++/test/Makefile.in | 5 + configure | 302 ++++++++++++++++++++++++----------- configure.ac | 91 ++++++++--- examples/Makefile.in | 5 + fortran/Makefile.in | 5 + fortran/examples/Makefile.in | 5 + fortran/src/H5_f.c | 24 +-- fortran/src/H5config_f.inc.in | 15 ++ fortran/src/H5fort_type_defines.h.in | 1 - fortran/src/H5match_types.c | 53 +++--- fortran/src/H5test_kind.F90 | 158 ++++++++---------- fortran/src/Makefile.in | 5 + fortran/test/Makefile.in | 5 + fortran/testpar/Makefile.in | 5 + hl/Makefile.in | 5 + hl/c++/Makefile.in | 5 + hl/c++/examples/Makefile.in | 5 + hl/c++/src/Makefile.in | 5 + hl/c++/test/Makefile.in | 5 + hl/examples/Makefile.in | 5 + hl/fortran/Makefile.in | 5 + hl/fortran/examples/Makefile.in | 5 + hl/fortran/src/H5LTff.F90 | 14 +- hl/fortran/src/Makefile.in | 5 + hl/fortran/test/Makefile.in | 5 + hl/src/Makefile.in | 5 + hl/test/Makefile.in | 5 + hl/tools/Makefile.in | 5 + hl/tools/gif2h5/Makefile.in | 5 + m4/aclocal_fc.m4 | 40 ++++- src/H5config.h.in | 18 +++ src/Makefile.in | 5 + test/Makefile.in | 5 + testpar/Makefile.in | 5 + tools/Makefile.in | 5 + tools/h5copy/Makefile.in | 5 + tools/h5diff/Makefile.in | 5 + tools/h5dump/Makefile.in | 5 + tools/h5import/Makefile.in | 5 + tools/h5jam/Makefile.in | 5 + tools/h5ls/Makefile.in | 5 + tools/h5repack/Makefile.in | 5 + tools/h5stat/Makefile.in | 5 + tools/lib/Makefile.in | 5 + tools/misc/Makefile.in | 5 + tools/perform/Makefile.in | 5 + 50 files changed, 672 insertions(+), 244 deletions(-) diff --git a/Makefile.in b/Makefile.in index 34dfa99..ce0c833 100644 --- a/Makefile.in +++ b/Makefile.in @@ -299,6 +299,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/c++/Makefile.in b/c++/Makefile.in index 50f5b31..2315cc2 100644 --- a/c++/Makefile.in +++ b/c++/Makefile.in @@ -459,6 +459,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/c++/examples/Makefile.in b/c++/examples/Makefile.in index 115c118..6b0f894 100644 --- a/c++/examples/Makefile.in +++ b/c++/examples/Makefile.in @@ -407,6 +407,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in index 3ca4f55..42c7a86 100644 --- a/c++/src/Makefile.in +++ b/c++/src/Makefile.in @@ -470,6 +470,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in index feb6054..0da1d86 100644 --- a/c++/test/Makefile.in +++ b/c++/test/Makefile.in @@ -461,6 +461,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/configure b/configure index c79ee83..456b846 100755 --- a/configure +++ b/configure @@ -710,7 +710,6 @@ PARALLEL TIME TR AR -PERL HL_FOR HL CXXCPP @@ -719,6 +718,11 @@ am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS +H5CONFIG_F_IKIND +H5CONFIG_F_NUM_IKIND +H5CONFIG_F_RKIND_SIZEOF +H5CONFIG_F_RKIND +H5CONFIG_F_NUM_RKIND FORTRAN_SIZEOF_LONG_DOUBLE FORTRAN_C_LONG_DOUBLE_IS_UNIQUE FORTRAN_HAVE_C_LONG_DOUBLE @@ -837,6 +841,7 @@ am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM +PERL target_alias host_alias build_alias @@ -3011,6 +3016,60 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +## PLACE CHECKS FOR REQUIRED PACKAGES NEEDED TO INSTALL HDF5 AT THE BEGINNING +## -------------------------------------------------------------------------- +## Check if they have Perl installed on their system. We only need Perl +## if they're using a GNU compiler. +## + PERL="" +##if test "X$GCC" = "Xyes"; then + for ac_prog in perl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_PERL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$PERL"; then + ac_cv_prog_PERL="$PERL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_PERL="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +PERL=$ac_cv_prog_PERL +if test -n "$PERL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 +$as_echo "$PERL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$PERL" && break +done + +##fi + + ac_config_headers="$ac_config_headers src/H5config.h" @@ -5542,6 +5601,46 @@ _ACEOF +## Check for __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]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of __float128" >&5 +$as_echo_n "checking size of __float128... " >&6; } +if ${ac_cv_sizeof___float128+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (__float128))" "ac_cv_sizeof___float128" "$ac_includes_default"; then : + +else + if test "$ac_cv_type___float128" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (__float128) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof___float128=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof___float128" >&5 +$as_echo "$ac_cv_sizeof___float128" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF___FLOAT128 $ac_cv_sizeof___float128 +_ACEOF + + +if test "$ac_cv_sizeof___float128" != 0; then + +$as_echo "#define HAVE_FLOAT128 1" >>confdefs.h + +fi + ## ---------------------------------------------------------------------- ## Check if they would like the Fortran interface compiled ## @@ -6974,7 +7073,6 @@ rm -f core conftest.err conftest.$ac_objext \ - ## Set the sizeof function for use later in the fortran tests if test "X$HAVE_STORAGE_SIZE_FORTRAN" = "Xyes";then FC_SIZEOF_A="STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" @@ -7032,12 +7130,15 @@ else PROGRAM main IMPLICIT NONE INTEGER :: ik, k, lastkind, max_decimal_prec + INTEGER :: num_rkinds, num_ikinds + num_ikinds = 0 lastkind=SELECTED_INT_KIND(1) OPEN(8, FILE='pac_fconftest.out', form='formatted') WRITE(8,'(A)',ADVANCE='NO') 'A' ! Find integer KINDs DO ik=2,36 k = SELECTED_INT_KIND(ik) IF (k .NE. lastkind) THEN + num_ikinds = num_ikinds + 1 WRITE(8,'(I0)',ADVANCE='NO') lastkind lastkind = k IF(k.GT.0) WRITE(8,'(A)',ADVANCE='NO') ' ' @@ -7045,16 +7146,19 @@ else IF (k .LE. 0) EXIT ENDDO IF (lastkind.NE.-1) THEN + num_ikinds = num_ikinds + 1 WRITE(8,'(I0,A)',ADVANCE='NO') lastkind, 'B ' ELSE WRITE(8,'(A)',ADVANCE='NO') 'B ' ENDIF WRITE(8,'(A)',ADVANCE='NO') 'C' ! 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(8,'(I0)',ADVANCE='NO') lastkind lastkind = k IF(k.GT.0) WRITE(8,'(A)',ADVANCE='NO') ' ' @@ -7063,12 +7167,16 @@ else IF (k .LE. 0) EXIT ENDDO IF (lastkind.NE.-1)THEN + num_rkinds = num_rkinds + 1 WRITE(8,'(I0,A)',ADVANCE='NO') lastkind, 'D' ELSE WRITE(8,'(A)',ADVANCE='NO') 'D' ENDIF WRITE(8,'(A,I0,A)',ADVANCE='NO') ' E',max_decimal_prec,'F' + WRITE(8,'(A,I0,A)',ADVANCE='NO') ' a',num_ikinds,'b' + WRITE(8,'(A,I0,A)',ADVANCE='NO') ' c',num_rkinds,'d' + END @@ -7087,8 +7195,24 @@ cat >>confdefs.h <<_ACEOF #define PAC_FC_MAX_REAL_PRECISION $PAC_FC_MAX_REAL_PRECISION _ACEOF + PAC_FC_ALL_INTEGER_KINDS="{`echo $pac_validIntKinds | sed -e 's/ /,/g'`}" PAC_FC_ALL_REAL_KINDS="{`echo $pac_validRealKinds | sed -e 's/ /,/g'`}" + + H5CONFIG_F_NUM_IKIND="INTEGER, PARAMETER :: num_ikinds = `echo $tmp | sed -e 's/.*a\(.*\)b.*/\1/'`" + H5CONFIG_F_IKIND="INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/`echo $pac_validIntKinds | sed -e 's/ /,/g'`/)" + + +cat >>confdefs.h <<_ACEOF +#define H5CONFIG_F_NUM_IKIND $H5CONFIG_F_NUM_IKIND +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define H5CONFIG_F_IKIND $H5CONFIG_F_IKIND +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran INTEGER KINDs" >&5 $as_echo_n "checking for Fortran INTEGER KINDs... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PAC_FC_ALL_INTEGER_KINDS" >&5 @@ -7215,12 +7339,15 @@ else PROGRAM main IMPLICIT NONE INTEGER :: ik, k, lastkind, max_decimal_prec + INTEGER :: num_rkinds, num_ikinds + num_ikinds = 0 lastkind=SELECTED_INT_KIND(1) OPEN(8, FILE='pac_fconftest.out', form='formatted') WRITE(8,'(A)',ADVANCE='NO') 'A' ! Find integer KINDs DO ik=2,36 k = SELECTED_INT_KIND(ik) IF (k .NE. lastkind) THEN + num_ikinds = num_ikinds + 1 WRITE(8,'(I0)',ADVANCE='NO') lastkind lastkind = k IF(k.GT.0) WRITE(8,'(A)',ADVANCE='NO') ' ' @@ -7228,16 +7355,19 @@ else IF (k .LE. 0) EXIT ENDDO IF (lastkind.NE.-1) THEN + num_ikinds = num_ikinds + 1 WRITE(8,'(I0,A)',ADVANCE='NO') lastkind, 'B ' ELSE WRITE(8,'(A)',ADVANCE='NO') 'B ' ENDIF WRITE(8,'(A)',ADVANCE='NO') 'C' ! 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(8,'(I0)',ADVANCE='NO') lastkind lastkind = k IF(k.GT.0) WRITE(8,'(A)',ADVANCE='NO') ' ' @@ -7246,12 +7376,16 @@ else IF (k .LE. 0) EXIT ENDDO IF (lastkind.NE.-1)THEN + num_rkinds = num_rkinds + 1 WRITE(8,'(I0,A)',ADVANCE='NO') lastkind, 'D' ELSE WRITE(8,'(A)',ADVANCE='NO') 'D' ENDIF WRITE(8,'(A,I0,A)',ADVANCE='NO') ' E',max_decimal_prec,'F' + WRITE(8,'(A,I0,A)',ADVANCE='NO') ' a',num_ikinds,'b' + WRITE(8,'(A,I0,A)',ADVANCE='NO') ' c',num_rkinds,'d' + END @@ -7270,8 +7404,24 @@ cat >>confdefs.h <<_ACEOF #define PAC_FC_MAX_REAL_PRECISION $PAC_FC_MAX_REAL_PRECISION _ACEOF + PAC_FC_ALL_INTEGER_KINDS="{`echo $pac_validIntKinds | sed -e 's/ /,/g'`}" PAC_FC_ALL_REAL_KINDS="{`echo $pac_validRealKinds | sed -e 's/ /,/g'`}" + + H5CONFIG_F_NUM_IKIND="INTEGER, PARAMETER :: num_ikinds = `echo $tmp | sed -e 's/.*a\(.*\)b.*/\1/'`" + H5CONFIG_F_IKIND="INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/`echo $pac_validIntKinds | sed -e 's/ /,/g'`/)" + + +cat >>confdefs.h <<_ACEOF +#define H5CONFIG_F_NUM_IKIND $H5CONFIG_F_NUM_IKIND +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define H5CONFIG_F_IKIND $H5CONFIG_F_IKIND +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran INTEGER KINDs" >&5 $as_echo_n "checking for Fortran INTEGER KINDs... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PAC_FC_ALL_INTEGER_KINDS" >&5 @@ -7363,7 +7513,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi done -PAC_FC_ALL_INTEGER_KINDS_SIZEOF="{ $pack_int_sizeof }" +PAC_FC_ALL_INTEGER_KINDS_SIZEOF="{`echo $pack_int_sizeof | sed -e 's/,$//' | sed -e 's/ //g'`}" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PAC_FC_ALL_INTEGER_KINDS_SIZEOF" >&5 $as_echo "$PAC_FC_ALL_INTEGER_KINDS_SIZEOF" >&6; } ac_ext=${ac_fc_srcext-f} @@ -7425,7 +7575,7 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ fi done -PAC_FC_ALL_REAL_KINDS_SIZEOF="{ $pack_real_sizeof }" +PAC_FC_ALL_REAL_KINDS_SIZEOF="{`echo $pack_real_sizeof | sed -e 's/,$//' | sed -e 's/ //g'`}" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PAC_FC_ALL_REAL_KINDS_SIZEOF" >&5 $as_echo "$PAC_FC_ALL_REAL_KINDS_SIZEOF" >&6; } ac_ext=${ac_fc_srcext-f} @@ -7452,6 +7602,11 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu + + + + + ## Setting definition if there is a 16 byte fortran integer if `echo $PAC_FC_ALL_INTEGER_KINDS_SIZEOF | grep '16' >/dev/null`; then HAVE_Fortran_INTEGER_SIZEOF_16="1" @@ -7584,6 +7739,50 @@ cat >>confdefs.h <<_ACEOF _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" != "$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 + !!! Fortran interfaces will not be generated for REAL(KIND=$max_real_fortran_kind) !!! + " >&5 +$as_echo "$as_me: 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) !!! + " >&2;} + PAC_FC_ALL_REAL_KINDS="`echo \"$PAC_FC_ALL_REAL_KINDS\" | $PERL -pe 's/,\d+}/}/g;'`" + PAC_FC_ALL_REAL_KINDS_SIZEOF="`echo \"$PAC_FC_ALL_REAL_KINDS_SIZEOF\" | $PERL -pe 's/,\d+}/}/g;'`" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Fortran interoperable KINDS with C" >&5 +$as_echo_n "checking for Fortran interoperable KINDS with C... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PAC_FC_ALL_REAL_KINDS" >&5 +$as_echo "$PAC_FC_ALL_REAL_KINDS" >&6; } + + H5CONFIG_F_NUM_RKIND="INTEGER, PARAMETER :: num_rkinds = `echo \"$PAC_FC_ALL_REAL_KINDS\" | perl -e '$count = ( =~ tr/,//);print $count+1'`" + H5CONFIG_F_RKIND="INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/`echo $PAC_FC_ALL_REAL_KINDS | sed -e 's/{//g' | sed -e 's/}//g'`/)" + H5CONFIG_F_RKIND_SIZEOF="INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/`echo $PAC_FC_ALL_REAL_KINDS_SIZEOF | sed -e 's/{//g' | sed -e 's/}//g'`/)" + + +cat >>confdefs.h <<_ACEOF +#define H5CONFIG_F_NUM_RKIND $H5CONFIG_F_NUM_RKIND +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define H5CONFIG_F_RKIND $H5CONFIG_F_RKIND +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define H5CONFIG_F_RKIND_SIZEOF $H5CONFIG_F_RKIND_SIZEOF +_ACEOF + + + + ## Change back to the C language ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -7601,10 +7800,16 @@ rm -f pac_Cconftest.out #include #include - #if __STDC_VERSION__ >= 199901L - #define C_LDBL_DIG DECIMAL_DIG + #define CHECK_FLOAT128 $ac_cv_sizeof___float128 + #if CHECK_FLOAT128!=0 + #include + #define C_LDBL_DIG FLT128_DIG #else + # if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define C_LDBL_DIG DECIMAL_DIG + # else #define C_LDBL_DIG LDBL_DIG + # endif #endif #ifdef FC_DUMMY_MAIN @@ -8425,56 +8630,6 @@ fi ## ---------------------------------------------------------------------- -## Check if they have Perl installed on their system. We only need Perl -## if they're using a GNU compiler. -## - PERL="" -if test "X$GCC" = "Xyes"; then - for ac_prog in perl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_PERL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$PERL"; then - ac_cv_prog_PERL="$PERL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_PERL="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -PERL=$ac_cv_prog_PERL -if test -n "$PERL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 -$as_echo "$PERL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$PERL" && break -done - -fi - -## ---------------------------------------------------------------------- ## Check which archiving tool to use. This needs to be done before ## the AM_PROG_LIBTOOL macro. ## @@ -24940,41 +25095,6 @@ $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi rm -f confcache -## Check for __FLOAT128 extension -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __float128" >&5 -$as_echo_n "checking for __float128... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef FC_DUMMY_MAIN -#ifndef FC_DUMMY_MAIN_EQ_F77 -# ifdef __cplusplus - extern "C" -# endif - int FC_DUMMY_MAIN() { return 1; } -#endif -#endif -int -main () -{ -__float128 x; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -$as_echo "#define HAVE_FLOAT128 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -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 - ## ---------------------------------------------------------------------- ## Check if the dev_t type is a scalar type (must come after the check for ## sys/types.h) diff --git a/configure.ac b/configure.ac index 96c43f9..9272c99 100644 --- a/configure.ac +++ b/configure.ac @@ -27,6 +27,19 @@ AC_PREREQ([2.69]) ## release!!! ## AC_INIT([HDF5], [1.9.222], [help@hdfgroup.org]) + + + +## PLACE CHECKS FOR REQUIRED PACKAGES NEEDED TO INSTALL HDF5 AT THE BEGINNING +## -------------------------------------------------------------------------- +## Check if they have Perl installed on their system. We only need Perl +## if they're using a GNU compiler. +## +AC_SUBST([PERL]) PERL="" +##if test "X$GCC" = "Xyes"; then + AC_CHECK_PROGS([PERL], [perl],, [$PATH]) +##fi + AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADER([src/H5config.h]) @@ -346,6 +359,12 @@ esac AC_CHECK_SIZEOF([long double], [8]) +## Check for __FLOAT128 extension +AC_CHECK_SIZEOF([__float128]) +if test "$ac_cv_sizeof___float128" != 0; then + AC_DEFINE([HAVE_FLOAT128], [1], [Determine if __float128 is available]) +fi + ## ---------------------------------------------------------------------- ## Check if they would like the Fortran interface compiled ## @@ -429,7 +448,6 @@ if test "X$HDF_FORTRAN" = "Xyes"; then ## See if the fortran compiler supports the intrinsic function "STORAGE_SIZE" PAC_PROG_FC_STORAGE_SIZE - ## Set the sizeof function for use later in the fortran tests if test "X$HAVE_STORAGE_SIZE_FORTRAN" = "Xyes";then FC_SIZEOF_A="STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" @@ -471,6 +489,11 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_SUBST([FORTRAN_HAVE_C_LONG_DOUBLE]) AC_SUBST([FORTRAN_C_LONG_DOUBLE_IS_UNIQUE]) AC_SUBST([FORTRAN_SIZEOF_LONG_DOUBLE]) + AC_SUBST([H5CONFIG_F_NUM_RKIND]) + AC_SUBST([H5CONFIG_F_RKIND]) + AC_SUBST([H5CONFIG_F_RKIND_SIZEOF]) + AC_SUBST([H5CONFIG_F_NUM_IKIND]) + AC_SUBST([H5CONFIG_F_IKIND]) ## Setting definition if there is a 16 byte fortran integer if `echo $PAC_FC_ALL_INTEGER_KINDS_SIZEOF | grep '16' >/dev/null`; then @@ -524,6 +547,54 @@ if test "X$HDF_FORTRAN" = "Xyes"; then FORTRAN_SIZEOF_LONG_DOUBLE=${ac_cv_sizeof_long_double} AC_DEFINE_UNQUOTED([FORTRAN_SIZEOF_LONG_DOUBLE], ["${ac_cv_sizeof_long_double}"], [Determine the size of C long double]) + + dnl get the largest sizeof for REAL kinds + dnl max_real_fortran_sizeof="`echo $pack_real_sizeof | sed -e 's/, *$//g' | sed -e [0-9]*$`" + dnl max_real_fortran_sizeof="`echo $PAC_FC_ALL_REAL_KINDS_SIZEOF | sed -e 's/, }//g' | sed -e [0-9]*$`" + dnl max_real_fortran_sizeof="`echo $PAC_FC_ALL_REAL_KINDS_SIZEOF | sed -e 's/\(, \}\)//g' | sed -e 's/.* //g'`" + + 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" != "$max_real_fortran_sizeof" && test "${ac_cv_sizeof_long_double}" != "$max_real_fortran_sizeof"; then + AC_MSG_WARN([ + 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) !!! + ]) + PAC_FC_ALL_REAL_KINDS="`echo \"[$]PAC_FC_ALL_REAL_KINDS\" | $PERL -pe 's/,\d+}/}/g;'`" + PAC_FC_ALL_REAL_KINDS_SIZEOF="`echo \"[$]PAC_FC_ALL_REAL_KINDS_SIZEOF\" | $PERL -pe 's/,\d+}/}/g;'`" + fi + AC_MSG_CHECKING([for Fortran interoperable KINDS with C]) + AC_MSG_RESULT([$PAC_FC_ALL_REAL_KINDS]) + + dnl count the number of real kinds + H5CONFIG_F_NUM_RKIND="INTEGER, PARAMETER :: num_rkinds = `echo \"[$]PAC_FC_ALL_REAL_KINDS\" | perl -e '$count = ( =~ tr/,//);print $count+1'`" + H5CONFIG_F_RKIND="INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/`echo $PAC_FC_ALL_REAL_KINDS | sed -e 's/{//g' | sed -e 's/}//g'`/)" + H5CONFIG_F_RKIND_SIZEOF="INTEGER, DIMENSION(1:num_rkinds) :: rkind_sizeof = (/`echo $PAC_FC_ALL_REAL_KINDS_SIZEOF | sed -e 's/{//g' | sed -e 's/}//g'`/)" + + AC_DEFINE_UNQUOTED([H5CONFIG_F_NUM_RKIND], $H5CONFIG_F_NUM_RKIND, [Define number of valid Fortran REAL KINDs]) + 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'`" + dnl tmp1="`echo "${PAC_FC_ALL_REAL_KINDS}" | sed -e 's/,[0-9]*\}*\$/}/g'`" + dnl tmp1="`echo $pac_validRealKinds | sed s/'w*$'//`" + dnl tmp2="`echo $PAC_FC_ALL_REAL_KINDS_SIZEOF | sed -e 's/[0-9]*, \}*$/}/g'`" + dnl tmp3="$PAC_FC_ALL_REAL_KINDS_SIZEOF" + dnl echo "$tmp3" + dnl tmp2=`echo $tmp3 | sed -e 's/[0-9]//'` + dnl AC_MSG_WARN([here $tmp2....]) + + dnl PAC_FC_ALL_REAL_KINDS="{4,8,16}" + dnl echo "$PAC_FC_ALL_REAL_KINDS" + dnl tmp1="`echo "${PAC_FC_ALL_REAL_KINDS}" | sed -e 's/,[0-9]*\}*\$/}/g'`" + dnl tmp1="`echo $pac_validRealKinds | sed s/'w*$'//`" + dnl tmp2="`echo $PAC_FC_ALL_REAL_KINDS_SIZEOF | sed -e 's/[0-9]*, \}*$/}/g'`" + dnl tmp3="$PAC_FC_ALL_REAL_KINDS_SIZEOF" + ## Change back to the C language AC_LANG_POP(Fortran) PAC_LDBL_DIG @@ -600,15 +671,6 @@ fi ## ---------------------------------------------------------------------- -## Check if they have Perl installed on their system. We only need Perl -## if they're using a GNU compiler. -## -AC_SUBST([PERL]) PERL="" -if test "X$GCC" = "Xyes"; then - AC_CHECK_PROGS([PERL], [perl],, [$PATH]) -fi - -## ---------------------------------------------------------------------- ## Check which archiving tool to use. This needs to be done before ## the AM_PROG_LIBTOOL macro. ## @@ -1154,15 +1216,6 @@ AC_CHECK_SIZEOF([off64_t], [8]) ## Checkpoint the cache AC_CACHE_SAVE -## Check for __FLOAT128 extension -AC_MSG_CHECKING([for __float128]) -AC_TRY_COMPILE([], - [__float128 x;], - [AC_DEFINE([HAVE_FLOAT128], [1], [Determine if __float128 is available]) - AC_MSG_RESULT([yes])], - AC_MSG_RESULT([no]) -) - ## ---------------------------------------------------------------------- ## Check if the dev_t type is a scalar type (must come after the check for ## sys/types.h) diff --git a/examples/Makefile.in b/examples/Makefile.in index 1ea46a2..79232ae 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -407,6 +407,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/fortran/Makefile.in b/fortran/Makefile.in index 54465a8..8585623 100644 --- a/fortran/Makefile.in +++ b/fortran/Makefile.in @@ -463,6 +463,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in index 0f6cb1a..f97fdc8 100644 --- a/fortran/examples/Makefile.in +++ b/fortran/examples/Makefile.in @@ -407,6 +407,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index f21528f..fa96ebe 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -227,27 +227,29 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes /* * FIND H5T_NATIVE_REAL_C_LONG_DOUBLE */ -#if H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE +#if H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE!=0 if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(float)) { if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_FLOAT)) < 0) return ret_value; } /*end if */ else if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(double)) { if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; } /*end if */ -# if FORTRAN_HAVE_C_LONG_DOUBLE!=0 +# if H5_FORTRAN_HAVE_C_LONG_DOUBLE!=0 else if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(long double)) { - if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value; - } /*end else */ + if ( H5_PAC_C_MAX_REAL_PRECISION >= H5_PAC_FC_MAX_REAL_PRECISION) { + if ((types[12] = (hid_t_f)H5Tcopy(H5T_NATIVE_LDOUBLE)) < 0) return ret_value; + } + else { + if ((types[12] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value; + if ( H5Tset_precision (types[12], 128) < 0) return ret_value; + } + } # else - else if (sizeof(real_C_LONG_DOUBLE_f) == sizeof(long double)) { - if ((types[12] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value; - if ( H5Tset_precision (types[12], 128) < 0) return ret_value; - } /*end else */ + if ((types[12] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value; + if ( H5Tset_precision (types[12], 64) < 0) return ret_value; # endif - #else - if ((types[12] = H5Tcopy (H5T_NATIVE_FLOAT)) < 0) return ret_value; - if ( H5Tset_precision (types[12], 64) < 0) return ret_value; + if ((types[12] = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0) return ret_value; #endif /* * FIND H5T_NATIVE_B_8 diff --git a/fortran/src/H5config_f.inc.in b/fortran/src/H5config_f.inc.in index d6909ed..b0de405 100644 --- a/fortran/src/H5config_f.inc.in +++ b/fortran/src/H5config_f.inc.in @@ -39,3 +39,18 @@ ! Maximum decimal precision for C #undef PAC_C_MAX_REAL_PRECISION +! number of valid REAL KINDs +#undef H5CONFIG_F_NUM_RKIND + +! valid REAL KINDs (need to have a matching C counter-part) +#undef H5CONFIG_F_RKIND + +! valid REAL KINDs (need to have a matching C counter-part) +#undef H5CONFIG_F_RKIND_SIZEOF + +! number of valid INTEGER KINDs +#undef H5CONFIG_F_NUM_IKIND + +! valid INTEGER KINDs (need to have a matching C counter-part) +#undef H5CONFIG_F_IKIND + diff --git a/fortran/src/H5fort_type_defines.h.in b/fortran/src/H5fort_type_defines.h.in index 5511742..0e14e86 100644 --- a/fortran/src/H5fort_type_defines.h.in +++ b/fortran/src/H5fort_type_defines.h.in @@ -11,7 +11,6 @@ #define H5_FORTRAN_INTEGER_KINDS_SIZEOF @PAC_FC_ALL_INTEGER_KINDS_SIZEOF@ #define H5_FORTRAN_REAL_KINDS @PAC_FC_ALL_REAL_KINDS@ #define H5_FORTRAN_REAL_KINDS_SIZEOF @PAC_FC_ALL_REAL_KINDS_SIZEOF@ -#define H5_PAC_FC_MAX_REAL_PRECISION @PAC_FC_MAX_REAL_PRECISION@ #define H5_HAVE_Fortran_INTEGER_SIZEOF_16 @HAVE_Fortran_INTEGER_SIZEOF_16@ #define H5_FORTRAN_HAVE_C_LONG_DOUBLE @FORTRAN_HAVE_C_LONG_DOUBLE@ #define H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE @FORTRAN_C_LONG_DOUBLE_IS_UNIQUE@ diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index b0e682d..360f224 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -153,7 +153,6 @@ int main(void) int FoundRealSizeKind[10]; int i, j,flag; char chrA[32],chrB[32]; - int H5_C_HAS_REAL_NATIVE_16; int IntKinds[] = H5_FORTRAN_INTEGER_KINDS; int IntKinds_SizeOf[] = H5_FORTRAN_INTEGER_KINDS_SIZEOF; @@ -169,9 +168,6 @@ int main(void) c_header = fopen(CFILE, "w"); fort_header = fopen(FFILE, "w"); - /* Default is C has 16 byte float */ - H5_C_HAS_REAL_NATIVE_16 = 1; - /* Write copyright, boilerplate to both files */ initCfile(); initFfile(); @@ -208,30 +204,45 @@ int main(void) /* (b) Define c_float_x */ for(i=0;i< H5_FORTRAN_NUM_REAL_KINDS;i++) { - if (sizeof(float) == RealKinds_SizeOf[i]) { writeTypedef("float", "float", RealKinds[i]); - strcpy(Real_C_TYPES[i], "C_FLOAT"); } + strcpy(Real_C_TYPES[i], "C_FLOAT"); + } else if(sizeof(double) == RealKinds_SizeOf[i]) { writeTypedef("float", "double", RealKinds[i]); - strcpy(Real_C_TYPES[i], "C_DOUBLE"); } + strcpy(Real_C_TYPES[i], "C_DOUBLE"); + } #if H5_FORTRAN_HAVE_C_LONG_DOUBLE!=0 else if(sizeof(long double) == RealKinds_SizeOf[i] && found_long_double == 0) { writeTypedef("float", "long double", RealKinds[i]); strcpy(Real_C_TYPES[i], "C_LONG_DOUBLE"); - found_long_double = 1; } -#endif -#ifdef H5_HAVE_FLOAT128 + found_long_double = 1; + } +# ifdef H5_HAVE_FLOAT128 /* Don't select a higher precision than Fortran can support */ else if(sizeof(__float128) == RealKinds_SizeOf[i] && found_long_double == 1 && H5_PAC_FC_MAX_REAL_PRECISION > 28) { writeTypedef("float", "__float128", RealKinds[i]); strcpy(Real_C_TYPES[i], "C_FLOAT128"); } -#else +# else else if(sizeof(long double) == RealKinds_SizeOf[i] && found_long_double == 1 && H5_PAC_FC_MAX_REAL_PRECISION > 28) { writeTypedef("float", "long double", RealKinds[i]); strcpy(Real_C_TYPES[i], "C_FLOAT128"); } +# endif +#else /* There is no C_LONG_DOUBLE intrinsic */ +# ifdef H5_HAVE_FLOAT128 + /* Don't select a higher precision than Fortran can support */ + else if(sizeof(__float128) == RealKinds_SizeOf[i] ) { + writeTypedef("float", "__float128", RealKinds[i]); + strcpy(Real_C_TYPES[i], "C_FLOAT128"); + } +# else + else if(sizeof(long double) == RealKinds_SizeOf[i] ) { + writeTypedef("float", "long double", RealKinds[i]); + strcpy(Real_C_TYPES[i], "C_FLOAT128"); + } +# endif #endif /* else { */ /* /\* Did not find the real type, use the next smallest *\/ */ @@ -246,10 +257,12 @@ int main(void) /* writeTypedef("float", "long double", RealKinds[i]); */ /* strcpy(Real_C_TYPES[i], "C_LONG_DOUBLE"); } */ else { - printf(" **** HDF5 WARNING ****\n"); - printf("Fortran REAL is %d bytes, but no corresponding C floating type exists\n",RealKinds_SizeOf[i]); - printf("Fortran Interface will create a custom datatype to store Fortran Real\n",RealKinds_SizeOf[i]); + printf("\n **** HDF5 WARNING ****\n"); + printf("Fortran REAL(KIND=%d) is %d Bytes, but no corresponding C float type exists of that size\n",RealKinds[i],RealKinds_SizeOf[i]); + printf(" !!! Fortran interfaces will not be generated for REAL(KIND=%d) !!!\n\n",RealKinds[i]); + RealKinds_SizeOf[i] = -1; + RealKinds[i] = -1; /* writeTypedef("float", "long double", RealKinds[i]); */ /* strcpy(Real_C_TYPES[i], "C_LONG_DOUBLE"); } */ } @@ -392,12 +405,14 @@ int main(void) FoundRealSize[4] = -1; for(i=0;i 0) { + FoundRealSize[i] = (int)RealKinds[i]; + FoundRealSizeKind[i] = (int)RealKinds_SizeOf[i]; + sprintf(chrA, "Fortran_REAL_%s", Real_C_TYPES[i]); /* sprintf(chrB, "real_%d_f", FoundRealSize[i]); */ - sprintf(chrB, "real_%s_f", Real_C_TYPES[i]); - writeToFiles("float",chrA, chrB, RealKinds[i], RealKinds_SizeOf[i]); + sprintf(chrB, "real_%s_f", Real_C_TYPES[i]); + writeToFiles("float",chrA, chrB, RealKinds[i], RealKinds_SizeOf[i]); + } } /* for(i=0;i #include - #if __STDC_VERSION__ >= 199901L + #define CHECK_FLOAT128 $ac_cv_sizeof___float128 + #if CHECK_FLOAT128!=0 + #include + #define C_LDBL_DIG FLT128_DIG + #else + # if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define C_LDBL_DIG DECIMAL_DIG - #else + # else #define C_LDBL_DIG LDBL_DIG + # endif #endif ],[[ FILE * pFile; diff --git a/src/H5config.h.in b/src/H5config.h.in index a174c6a..d7d1487 100644 --- a/src/H5config.h.in +++ b/src/H5config.h.in @@ -48,6 +48,21 @@ /* Determine the size of C long double */ #undef FORTRAN_SIZEOF_LONG_DOUBLE +/* Define valid Fortran INTEGER KINDs */ +#undef H5CONFIG_F_IKIND + +/* Define number of valid Fortran INTEGER KINDs */ +#undef H5CONFIG_F_NUM_IKIND + +/* Define number of valid Fortran REAL KINDs */ +#undef H5CONFIG_F_NUM_RKIND + +/* Define valid Fortran REAL KINDs */ +#undef H5CONFIG_F_RKIND + +/* Define valid Fortran REAL KINDs Sizeof */ +#undef H5CONFIG_F_RKIND_SIZEOF + /* Define to 1 if you have the `alarm' function. */ #undef HAVE_ALARM @@ -548,6 +563,9 @@ /* The size of `unsigned', as computed by sizeof. */ #undef SIZEOF_UNSIGNED +/* The size of `__float128', as computed by sizeof. */ +#undef SIZEOF___FLOAT128 + /* The size of `__int64', as computed by sizeof. */ #undef SIZEOF___INT64 diff --git a/src/Makefile.in b/src/Makefile.in index 9390993..ffa6fa9 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -522,6 +522,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/test/Makefile.in b/test/Makefile.in index 5ca332b..d3f1b86 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -866,6 +866,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/testpar/Makefile.in b/testpar/Makefile.in index 228d678..5797dfc 100644 --- a/testpar/Makefile.in +++ b/testpar/Makefile.in @@ -493,6 +493,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/tools/Makefile.in b/tools/Makefile.in index feebdc4..0f5684d 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -460,6 +460,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/tools/h5copy/Makefile.in b/tools/h5copy/Makefile.in index 8b07885..1b50662 100644 --- a/tools/h5copy/Makefile.in +++ b/tools/h5copy/Makefile.in @@ -468,6 +468,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/tools/h5diff/Makefile.in b/tools/h5diff/Makefile.in index dc79985..7b4d121 100644 --- a/tools/h5diff/Makefile.in +++ b/tools/h5diff/Makefile.in @@ -475,6 +475,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/tools/h5dump/Makefile.in b/tools/h5dump/Makefile.in index d423072..9865e3a 100644 --- a/tools/h5dump/Makefile.in +++ b/tools/h5dump/Makefile.in @@ -474,6 +474,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/tools/h5import/Makefile.in b/tools/h5import/Makefile.in index 4ee206c..d6e784a 100644 --- a/tools/h5import/Makefile.in +++ b/tools/h5import/Makefile.in @@ -468,6 +468,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/tools/h5jam/Makefile.in b/tools/h5jam/Makefile.in index 0c6274a..c915437 100644 --- a/tools/h5jam/Makefile.in +++ b/tools/h5jam/Makefile.in @@ -480,6 +480,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/tools/h5ls/Makefile.in b/tools/h5ls/Makefile.in index e1ffa9a..8fb9822 100644 --- a/tools/h5ls/Makefile.in +++ b/tools/h5ls/Makefile.in @@ -460,6 +460,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/tools/h5repack/Makefile.in b/tools/h5repack/Makefile.in index 637d9dd..c0b6685 100644 --- a/tools/h5repack/Makefile.in +++ b/tools/h5repack/Makefile.in @@ -492,6 +492,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/tools/h5stat/Makefile.in b/tools/h5stat/Makefile.in index de1df70..6bf37f3 100644 --- a/tools/h5stat/Makefile.in +++ b/tools/h5stat/Makefile.in @@ -470,6 +470,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in index 5d20d4f..fcfb019 100644 --- a/tools/lib/Makefile.in +++ b/tools/lib/Makefile.in @@ -457,6 +457,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in index 89b7d5e..2688e8d 100644 --- a/tools/misc/Makefile.in +++ b/tools/misc/Makefile.in @@ -495,6 +495,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ diff --git a/tools/perform/Makefile.in b/tools/perform/Makefile.in index 7ca11ef..4804533 100644 --- a/tools/perform/Makefile.in +++ b/tools/perform/Makefile.in @@ -499,6 +499,11 @@ FORTRAN_HAVE_C_LONG_DOUBLE = @FORTRAN_HAVE_C_LONG_DOUBLE@ FORTRAN_SIZEOF_LONG_DOUBLE = @FORTRAN_SIZEOF_LONG_DOUBLE@ FSEARCH_DIRS = @FSEARCH_DIRS@ GREP = @GREP@ +H5CONFIG_F_IKIND = @H5CONFIG_F_IKIND@ +H5CONFIG_F_NUM_IKIND = @H5CONFIG_F_NUM_IKIND@ +H5CONFIG_F_NUM_RKIND = @H5CONFIG_F_NUM_RKIND@ +H5CONFIG_F_RKIND = @H5CONFIG_F_RKIND@ +H5CONFIG_F_RKIND_SIZEOF = @H5CONFIG_F_RKIND_SIZEOF@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ -- cgit v0.12