diff options
Diffstat (limited to 'fortran/src')
-rw-r--r-- | fortran/src/CMakeLists.txt | 52 | ||||
-rw-r--r-- | fortran/src/H5_f.c | 18 | ||||
-rw-r--r-- | fortran/src/H5_ff.F90 | 8 | ||||
-rw-r--r-- | fortran/src/H5config_f.inc.cmake | 28 | ||||
-rw-r--r-- | fortran/src/H5config_f.inc.in | 12 | ||||
-rw-r--r-- | fortran/src/H5fort_type_defines.h.in | 1 | ||||
-rw-r--r-- | fortran/src/Makefile.in | 1 |
7 files changed, 84 insertions, 36 deletions
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index d6e77ba..03db548 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -31,7 +31,7 @@ configure_file (${HDF5_F90_SRC_SOURCE_DIR}/H5config_f.inc.cmake ${CMAKE_BINARY_D #----------------------------------------------------------------------------- # Setup the Fortran auto-detection utilities -# H5test_kind.F90 used to generate H5fortran_detect.F90 and H5_KINDff.F90 +# H5test_kind.F90 used to generate various KIND interfaces # H5fortran_detect.F90 used to generate H5fort_type_defines.h # H5fort_type_defines.h used to generate H5f90i_gen.h + H5fortran_types.F90 #----------------------------------------------------------------------------- @@ -67,31 +67,31 @@ add_custom_command ( DEPENDS H5test_FortranHavekind ) #----------------------------------------------------------------------------- -add_executable (H5fortran_detect - ${HDF5_F90_BINARY_DIR}/H5fortran_detect.F90 -) -if (WIN32 AND MSVC) - if (BUILD_SHARED_LIBS) - set_target_properties (H5fortran_detect - PROPERTIES - COMPILE_FLAGS "/MT" - ) - endif (BUILD_SHARED_LIBS) - set_target_properties (H5fortran_detect - PROPERTIES - LINK_FLAGS "/SUBSYSTEM:CONSOLE" - ) -endif (WIN32 AND MSVC) -set_target_properties (H5fortran_detect PROPERTIES LINKER_LANGUAGE Fortran) - -set (CMD $<TARGET_FILE:H5fortran_detect>) -add_custom_command ( - OUTPUT ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h - COMMAND ${CMD} - ARGS > ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h - WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} - DEPENDS H5fortran_detect -) +#add_executable (H5fortran_detect +# ${HDF5_F90_BINARY_DIR}/H5fortran_detect.F90 +#) +#if (WIN32 AND MSVC) +# if (BUILD_SHARED_LIBS) +# set_target_properties (H5fortran_detect +# PROPERTIES +# COMPILE_FLAGS "/MT" +# ) +# endif (BUILD_SHARED_LIBS) +# set_target_properties (H5fortran_detect +# PROPERTIES +# LINK_FLAGS "/SUBSYSTEM:CONSOLE" +# ) +#endif (WIN32 AND MSVC) +#set_target_properties (H5fortran_detect PROPERTIES LINKER_LANGUAGE Fortran) +# +#set (CMD $<TARGET_FILE:H5fortran_detect>) +#add_custom_command ( +# OUTPUT ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h +# COMMAND ${CMD} +# ARGS > ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h +# WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR} +# DEPENDS H5fortran_detect +#) INCLUDE_DIRECTORIES (${HDF5_F90_BINARY_DIR} ${CMAKE_Fortran_MODULE_DIRECTORY}) #----------------------------------------------------------------------------- diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index 6a6be41..c12b610 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -240,7 +240,7 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes if ((types[15] = (hid_t_f)H5Tcopy(H5T_NATIVE_B32)) < 0) return ret_value; if ((types[16] = (hid_t_f)H5Tcopy(H5T_NATIVE_B64)) < 0) return ret_value; -/* #ifdef -MSB- */ +#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 /* * FIND H5T_NATIVE_INTEGER_16 */ @@ -260,6 +260,10 @@ h5init_types_c( hid_t_f * types, hid_t_f * floatingtypes, hid_t_f * integertypes if ((types[17] = H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; if ( H5Tset_precision (types[17], 128) < 0) return ret_value; } /*end else */ +#else + if ((types[17] = H5Tcopy (H5T_NATIVE_INT)) < 0) return ret_value; + if ( H5Tset_precision (types[17], 128) < 0) return ret_value; +#endif /* #ifdef -MSB- */ @@ -356,16 +360,16 @@ h5close_types_c( hid_t_f * types, int_f *lentypes, int i; for (i = 0; i < *lentypes; i++) { - c_type_id = types[i]; - if ( H5Tclose(c_type_id) < 0) return ret_value; + c_type_id = types[i]; + if ( H5Tclose(c_type_id) < 0) return ret_value; } for (i = 0; i < *floatinglen; i++) { - c_type_id = floatingtypes[i]; - if ( H5Tclose(c_type_id) < 0) return ret_value; + c_type_id = floatingtypes[i]; + if ( H5Tclose(c_type_id) < 0) return ret_value; } for (i = 0; i < *integerlen; i++) { - c_type_id = integertypes[i]; - if ( H5Tclose(c_type_id) < 0) return ret_value; + c_type_id = integertypes[i]; + if ( H5Tclose(c_type_id) < 0) return ret_value; } ret_value = 0; return ret_value; diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 25c7eab..f4090cc 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -30,6 +30,8 @@ ! !***** +#include <H5config_f.inc> + MODULE H5LIB USE, INTRINSIC :: ISO_C_BINDING, ONLY : c_ptr, C_INTPTR_T @@ -377,9 +379,10 @@ CONTAINS h5_type = H5T_NATIVE_INTEGER_4 ELSE IF(kind.EQ.Fortran_INTEGER_8)THEN h5_type = H5T_NATIVE_INTEGER_8 -! NEED ifdef -MSB- +#if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 ELSE IF(kind.EQ.Fortran_INTEGER_16)THEN h5_type = H5T_NATIVE_INTEGER_16 +#endif ENDIF ELSE IF(flag.EQ.H5_REAL_KIND)THEN IF(kind.EQ.Fortran_REAL_C_FLOAT)THEN @@ -388,9 +391,10 @@ CONTAINS h5_type = H5T_NATIVE_REAL_C_DOUBLE ELSE IF(kind.EQ.Fortran_REAL_C_LONG_DOUBLE)THEN h5_type = H5T_NATIVE_REAL_C_LONG_DOUBLE -! NEED ifdef -MSB- +#if H5_HAVE_FLOAT128!=0 ELSE IF(kind.EQ.Fortran_REAL_C_FLOAT128)THEN h5_type = H5T_NATIVE_FLOAT_128 +#endif ENDIF ENDIF diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake index cbdfb9b..cb1d9e8 100644 --- a/fortran/src/H5config_f.inc.cmake +++ b/fortran/src/H5config_f.inc.cmake @@ -27,3 +27,31 @@ #if H5_FORTRAN_HAVE_C_SIZEOF==0 #undef H5_FORTRAN_HAVE_C_SIZEOF #endif + +! Define if the intrinsic function FORTRAN_HAVE_C_LONG_DOUBLE exists +#define H5_FORTRAN_HAVE_C_LONG_DOUBLE @FORTRAN_HAVE_C_LONG_DOUBLE@ + +#if H5_FORTRAN_HAVE_C_LONG_DOUBLE==0 +#undef H5_FORTRAN_HAVE_C_LONG_DOUBLE +#endif + +! should this be ${HDF_PREFIX} instead of H5 MSB +#define H5_SIZEOF_LONG_DOUBLE @H5_SIZEOF_LONG_DOUBLE@ + +#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@ + +#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@ + +#if H5_HAVE_Fortran_INTEGER_SIZEOF_16==0 +#undef H5_HAVE_Fortran_INTEGER_SIZEOF_16 +#endif diff --git a/fortran/src/H5config_f.inc.in b/fortran/src/H5config_f.inc.in index 0203315..b227c13 100644 --- a/fortran/src/H5config_f.inc.in +++ b/fortran/src/H5config_f.inc.in @@ -1,5 +1,8 @@ ! fortran/src/H5config_f.inc. Generated from fortran/src/H5config_f.inc.in by configure +! The script to replace the defines in H5config_f.inc.in is +! located in configure.ac in the Fortran section. + ! Define if we have parallel support #undef HAVE_PARALLEL @@ -19,4 +22,11 @@ #undef HAVE_ISO_FORTRAN_ENV ! Define the size of C's long double -#define H5_SIZEOF_LONG_DOUBLE +#undef SIZEOF_LONG_DOUBLE + +! Define if the C intrinsic __FLOAT128 exists +#undef HAVE_FLOAT128 + +! Define if INTEGER*16 is available +#undef HAVE_Fortran_INTEGER_SIZEOF_16 + diff --git a/fortran/src/H5fort_type_defines.h.in b/fortran/src/H5fort_type_defines.h.in index ad7b666..9e8015c 100644 --- a/fortran/src/H5fort_type_defines.h.in +++ b/fortran/src/H5fort_type_defines.h.in @@ -11,6 +11,7 @@ #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_HAVE_Fortran_INTEGER_SIZEOF_16 @HAVE_Fortran_INTEGER_SIZEOF_16@ #define C_LONG_DOUBLE_KIND 10 #define C_LONG_DOUBLE_SIZEOF 12 #define C_DOUBLE_KIND 8 diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in index 3809775..8aea063 100644 --- a/fortran/src/Makefile.in +++ b/fortran/src/Makefile.in @@ -514,6 +514,7 @@ H5_LDFLAGS = @H5_LDFLAGS@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HAVE_DMALLOC = @HAVE_DMALLOC@ +HAVE_Fortran_INTEGER_SIZEOF_16 = @HAVE_Fortran_INTEGER_SIZEOF_16@ HAVE_PTHREAD = @HAVE_PTHREAD@ HDF5_HL = @HDF5_HL@ HDF5_INTERFACES = @HDF5_INTERFACES@ |