summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2015-01-13 16:23:07 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2015-01-13 16:23:07 (GMT)
commitc6cf45e3e70dcf50f707d3fee68e5a92944982d7 (patch)
treedc3a44f19c52659128a29a5f3bdf56335a5206c3
parentd3ddfe842da3d31fc15f8b1851a87fbe56703412 (diff)
downloadhdf5-c6cf45e3e70dcf50f707d3fee68e5a92944982d7.zip
hdf5-c6cf45e3e70dcf50f707d3fee68e5a92944982d7.tar.gz
hdf5-c6cf45e3e70dcf50f707d3fee68e5a92944982d7.tar.bz2
[svn-r25978] Bug fix for HDFFV-8847
Tested: h5committest
-rwxr-xr-xconfigure5
-rw-r--r--configure.ac3
-rw-r--r--fortran/src/CMakeLists.txt1
-rw-r--r--fortran/src/H5match_types.c224
-rw-r--r--src/H5config.h.in3
5 files changed, 227 insertions, 9 deletions
diff --git a/configure b/configure
index f5fd975..8a476dd 100755
--- a/configure
+++ b/configure
@@ -6849,8 +6849,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
## echo $HAVE_FORTRAN_2003
as_fn_error $? "Fortran compiler lacks required Fortran 2003 features; unsupported Fortran 2003 compiler, remove --enable-fortran2003" "$LINENO" 5
else
- ## echo $HAVE_FORTRAN_2003
HAVE_FORTRAN_2003="yes"
+ ## We are have a 2003 compiler
+
+$as_echo "#define HAVE_FORTRAN_2003 1" >>confdefs.h
+
fi
fi
else
diff --git a/configure.ac b/configure.ac
index 9559d7e..98d2b6a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -569,8 +569,9 @@ if test "X$HDF_FORTRAN" = "Xyes"; then
## echo $HAVE_FORTRAN_2003
AC_MSG_ERROR([Fortran compiler lacks required Fortran 2003 features; unsupported Fortran 2003 compiler, remove --enable-fortran2003])
else
- ## echo $HAVE_FORTRAN_2003
HAVE_FORTRAN_2003="yes"
+ ## We are have a 2003 compiler
+ AC_DEFINE([HAVE_FORTRAN_2003], [1], [Define if we have F2003 compiler])
fi
fi
else
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index b149017..efd8a02 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -157,6 +157,7 @@ set_target_properties (${HDF5_F90_C_LIB_TARGET} PROPERTIES
if (HDF5_ENABLE_F2003)
# F2003 features are enabled
set (F_STATUS "_F03")
+ set (H5_HAVE_FORTRAN_2003 1)
else (HDF5_ENABLE_F2003)
# F2003 features are not enabled
set (F_STATUS "_F90")
diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c
index 3fa0efc..a15ae3c 100644
--- a/fortran/src/H5match_types.c
+++ b/fortran/src/H5match_types.c
@@ -52,7 +52,9 @@ void writeTypedef(const char* c_type, unsigned int size);
void writeFloatTypedef(const char* c_type, unsigned int size);
void writeTypedefDefault(unsigned int size);
void writeToFiles(const char* fortran_type, const char* c_type, int size, unsigned int kind);
+void writeToFilesF03(const char* fortran_type, const char* c_type, int size, const char* kind);
void writeFloatToFiles(const char* fortran_type, const char* c_type, int size, unsigned int kind);
+void writeFloatToFilesF03(const char* fortran_type, const char* c_type, int size, const char* kind);
static void
initCfile(void)
@@ -100,12 +102,16 @@ initFfile(void)
! access to either file, you may request a copy from help@hdfgroup.org. *\n\
! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\
!\n!\n\
-! This file is automatically generated and contains HDF5 Fortran90 type definitions.\n!\n\
+! This file is automatically generated by H5match_types.c and \n\
+! contains HDF5 Fortran90 type definitions.\n!\n\
MODULE H5FORTRAN_TYPES\n\
!\n\
! HDF5 integers\n\
!\n");
+#ifdef H5_HAVE_FORTRAN_2003
+ fprintf(fort_header," USE ISO_C_BINDING\n");
+#endif
}
static void
@@ -147,20 +153,35 @@ void writeToFiles(const char* fortran_type, const char* c_type, int size, unsign
fprintf(c_header, "typedef c_int_%d %s;\n", size, c_type);
}
+void writeToFilesF03(const char* fortran_type, const char* c_type, int size, const char* kind)
+{
+ fprintf(fort_header, " INTEGER, PARAMETER :: %s = %s\n", fortran_type, kind);
+ fprintf(c_header, "typedef c_int_%d %s;\n", size, c_type);
+}
+
/* Create matching Fortran and C floating types by writing to both files */
void writeFloatToFiles(const char* fortran_type, const char* c_type, int size, unsigned int kind)
{
fprintf(fort_header, " INTEGER, PARAMETER :: %s = %u\n", fortran_type, kind);
-
+ fprintf(c_header, "typedef c_float_%d %s;\n", size, c_type);
+}
+void writeFloatToFilesF03(const char* fortran_type, const char* c_type, int size, const char* kind)
+{
+ fprintf(fort_header, " INTEGER, PARAMETER :: %s = %s\n", fortran_type, kind);
fprintf(c_header, "typedef c_float_%d %s;\n", size, c_type);
}
int main(void)
{
int FoundIntSize[4];
+#ifdef H5_HAVE_FORTRAN_2003
+ const char *FoundIntSizeKind_F03[4];
+ const char *FoundRealSizeKind_F03[3];
+#else
unsigned FoundIntSizeKind[4];
- int FoundRealSize[3];
unsigned FoundRealSizeKind[3];
+#endif
+ int FoundRealSize[3];
int i,j,flag;
char chrA[20],chrB[20];
int H5_C_HAS_REAL_NATIVE_16;
@@ -234,7 +255,6 @@ int main(void)
#endif /*H5_FORTRAN_HAS_INTEGER_8_KIND*/
/* Define c_float_x */
-
#if defined H5_FORTRAN_HAS_REAL_NATIVE_4_KIND || defined H5_FORTRAN_HAS_REAL_4_KIND
if(sizeof(long double) == 4)
writeFloatTypedef("long double", 4);
@@ -280,6 +300,20 @@ int main(void)
/* Now begin defining fortran types. */
fprintf(c_header, "\n");
/* haddr_t */
+#ifdef H5_HAVE_FORTRAN_2003
+#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HADDR_T >= 8
+ writeToFilesF03("HADDR_T", "haddr_t_f", 8, "C_INT64_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_HADDR_T >= 4
+ writeToFilesF03("HADDR_T", "haddr_t_f", 4, "C_INT32_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_2_KIND && H5_SIZEOF_HADDR_T >= 2
+ writeToFilesF03("HADDR_T", "haddr_t_f", 2, "C_INT16_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_1_KIND && H5_SIZEOF_HADDR_T >= 1
+ writeToFilesF03("HADDR_T", "haddr_t_f", 1, "C_INT8_T");
+#else
+ /* Error: couldn't find a size for haddr_t */
+ return -1;
+#endif
+#else
#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HADDR_T >= 8
writeToFiles("HADDR_T", "haddr_t_f", 8, H5_FORTRAN_HAS_INTEGER_8_KIND);
#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_HADDR_T >= 4
@@ -292,8 +326,23 @@ int main(void)
/* Error: couldn't find a size for haddr_t */
return -1;
#endif
+#endif
/* hsize_t */
+#ifdef H5_HAVE_FORTRAN_2003
+#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HSIZE_T >= 8
+ writeToFilesF03("HSIZE_T", "hsize_t_f", 8, "C_INT64_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_HSIZE_T >= 4
+ writeToFilesF03("HSIZE_T", "hsize_t_f", 4, "C_INT32_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_2_KIND && H5_SIZEOF_HSIZE_T >= 2
+ writeToFilesF03("HSIZE_T", "hsize_t_f", 2, "C_INT16_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_1_KIND && H5_SIZEOF_HSIZE_T >= 1
+ writeToFilesF03("HSIZE_T", "hsize_t_f", 1, "C_INT8_T");
+#else
+ /* Error: couldn't find a size for hsize_t */
+ return -1;
+#endif
+#else
#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HSIZE_T >= 8
writeToFiles("HSIZE_T", "hsize_t_f", 8, H5_FORTRAN_HAS_INTEGER_8_KIND);
#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_HSIZE_T >= 4
@@ -306,8 +355,23 @@ int main(void)
/* Error: couldn't find a size for hsize_t */
return -1;
#endif
+#endif
/* hssize_t */
+#ifdef H5_HAVE_FORTRAN_2003
+#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HSSIZE_T >= 8
+ writeToFilesF03("HSSIZE_T", "hssize_t_f", 8, "C_INT64_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_HSSIZE_T >= 4
+ writeToFilesF03("HSSIZE_T", "hssize_t_f", 4, "C_INT32_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_2_KIND && H5_SIZEOF_HSSIZE_T >= 2
+ writeToFilesF03("HSSIZE_T", "hssize_t_f", 2, "C_INT16_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_1_KIND && H5_SIZEOF_HSSIZE_T >= 1
+ writeToFilesF03("HSSIZE_T", "hssize_t_f", 1, "C_INT8_T");
+#else
+ /* Error: couldn't find a size for hssize_t */
+ return -1;
+#endif
+#else
#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HSSIZE_T >= 8
writeToFiles("HSSIZE_T", "hssize_t_f", 8, H5_FORTRAN_HAS_INTEGER_8_KIND);
#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_HSSIZE_T >= 4
@@ -320,7 +384,23 @@ int main(void)
/* Error: couldn't find a size for hssize_t */
return -1;
#endif
+#endif
+#ifdef H5_HAVE_FORTRAN_2003
+ /* off_t */
+#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_OFF_T >= 8
+ writeToFilesF03("OFF_T", "off_t_f", 8, "C_INT64_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_OFF_T >= 4
+ writeToFilesF03("OFF_T", "off_t_f", 4, "C_INT32_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_2_KIND && H5_SIZEOF_OFF_T >= 2
+ writeToFilesF03("OFF_T", "off_t_f", 2, "C_INT16_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_1_KIND && H5_SIZEOF_OFF_T >= 1
+ writeToFilesF03("OFF_T", "off_t_f", 1, "C_INT8_T");
+#else
+ /* Error: couldn't find a size for off_t */
+ return -1;
+#endif
+#else
/* off_t */
#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_OFF_T >= 8
writeToFiles("OFF_T", "off_t_f", 8, H5_FORTRAN_HAS_INTEGER_8_KIND);
@@ -334,8 +414,23 @@ int main(void)
/* Error: couldn't find a size for off_t */
return -1;
#endif
+#endif
- /* size_t */
+ /* size_t */
+#ifdef H5_HAVE_FORTRAN_2003
+#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_SIZE_T >= 8
+ writeToFilesF03("SIZE_T", "size_t_f", 8, "C_INT64_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_SIZE_T >= 4
+ writeToFilesF03("SIZE_T", "size_t_f", 4, "C_INT32_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_2_KIND && H5_SIZEOF_SIZE_T >= 2
+ writeToFilesF03("SIZE_T", "size_t_f", 2, "C_INT16_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_1_KIND && H5_SIZEOF_SIZE_T >= 1
+ writeToFilesF03("SIZE_T", "size_t_f", 1, "C_INT8_T");
+#else
+ /* Error: couldn't find a size for size_t */
+ return -1;
+#endif
+#else
#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_SIZE_T >= 8
writeToFiles("SIZE_T", "size_t_f", 8, H5_FORTRAN_HAS_INTEGER_8_KIND);
#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_SIZE_T >= 4
@@ -348,8 +443,23 @@ int main(void)
/* Error: couldn't find a size for size_t */
return -1;
#endif
+#endif
/* int */
+#ifdef H5_HAVE_FORTRAN_2003
+#if defined H5_FORTRAN_HAS_NATIVE_8_KIND
+ writeToFilesF03("Fortran_INTEGER", "int_f", 8, "C_INT64_T");
+#elif defined H5_FORTRAN_HAS_NATIVE_4_KIND
+ writeToFilesF03("Fortran_INTEGER", "int_f", 4, "C_INT32_T");
+#elif defined H5_FORTRAN_HAS_NATIVE_2_KIND
+ writeToFilesF03("Fortran_INTEGER", "int_f", 2, "C_INT16_T");
+#elif defined H5_FORTRAN_HAS_NATIVE_1_KIND
+ writeToFilesF03("Fortran_INTEGER", "int_f", 1, "C_INT8_T");
+#else
+ /* Error: couldn't find a size for int */
+ return -1;
+#endif
+#else
#if defined H5_FORTRAN_HAS_NATIVE_8_KIND
writeToFiles("Fortran_INTEGER", "int_f", 8, H5_FORTRAN_HAS_NATIVE_8_KIND);
#elif defined H5_FORTRAN_HAS_NATIVE_4_KIND
@@ -362,6 +472,7 @@ int main(void)
/* Error: couldn't find a size for int */
return -1;
#endif
+#endif
/* int_1, int_2, int_4, int_8 */
@@ -377,19 +488,35 @@ int main(void)
#if defined H5_FORTRAN_HAS_INTEGER_1_KIND
FoundIntSize[0] = 1;
+#ifdef H5_HAVE_FORTRAN_2003
+ FoundIntSizeKind_F03[0] = "C_INT8_T";
+#else
FoundIntSizeKind[0] = H5_FORTRAN_HAS_INTEGER_1_KIND;
#endif
+#endif
#if defined H5_FORTRAN_HAS_INTEGER_2_KIND
FoundIntSize[1] = 2;
+#ifdef H5_HAVE_FORTRAN_2003
+ FoundIntSizeKind_F03[1] = "C_INT16_T";
+#else
FoundIntSizeKind[1] = H5_FORTRAN_HAS_INTEGER_2_KIND;
#endif
+#endif
#if defined H5_FORTRAN_HAS_INTEGER_4_KIND
FoundIntSize[2] = 4;
+#ifdef H5_HAVE_FORTRAN_2003
+ FoundIntSizeKind_F03[2] = "C_INT32_T";
+#else
FoundIntSizeKind[2] = H5_FORTRAN_HAS_INTEGER_4_KIND;
#endif
+#endif
#if defined H5_FORTRAN_HAS_INTEGER_8_KIND
FoundIntSize[3] = 8;
- FoundIntSizeKind[3] = H5_FORTRAN_HAS_INTEGER_8_KIND ;
+#ifdef H5_HAVE_FORTRAN_2003
+ FoundIntSizeKind_F03[3] = "C_INT64_T";
+#else
+ FoundIntSizeKind[3] = H5_FORTRAN_HAS_INTEGER_8_KIND;
+#endif
#endif
for(i=0;i<4;i++) {
@@ -397,7 +524,11 @@ int main(void)
{
sprintf(chrA, "Fortran_INTEGER_%d", FoundIntSize[i]);
sprintf(chrB, "int_%d_f", FoundIntSize[i]);
+#ifdef H5_HAVE_FORTRAN_2003
+ writeToFilesF03(chrA, chrB, FoundIntSize[i], FoundIntSizeKind_F03[i]);
+#else
writeToFiles(chrA, chrB, FoundIntSize[i], FoundIntSizeKind[i]);
+#endif
}
else /* Did not find the integer type */
{
@@ -408,7 +539,11 @@ int main(void)
{
sprintf(chrA, "Fortran_INTEGER_%d", (-1)*FoundIntSize[i]);
sprintf(chrB, "int_%d_f", (-1)*FoundIntSize[i]);
+#ifdef H5_HAVE_FORTRAN_2003
+ writeToFilesF03(chrA, chrB, FoundIntSize[j], FoundIntSizeKind_F03[j]);
+#else
writeToFiles(chrA, chrB, FoundIntSize[j], FoundIntSizeKind[j]);
+#endif
flag = 1;
break;
}
@@ -421,7 +556,11 @@ int main(void)
{
sprintf(chrA, "Fortran_INTEGER_%d", (-1)*FoundIntSize[i]);
sprintf(chrB, "int_%d_f", (-1)*FoundIntSize[i]);
+#ifdef H5_HAVE_FORTRAN_2003
+ writeToFilesF03(chrA, chrB, FoundIntSize[j], FoundIntSizeKind_F03[j]);
+#else
writeToFiles(chrA, chrB, FoundIntSize[j], FoundIntSizeKind[j]);
+#endif
flag = 1;
break;
}
@@ -445,17 +584,29 @@ int main(void)
#if defined H5_FORTRAN_HAS_REAL_4_KIND
FoundRealSize[0] = 4;
+#ifdef H5_HAVE_FORTRAN_2003
+ FoundRealSizeKind_F03[0] = "C_FLOAT";
+#else
FoundRealSizeKind[0] = H5_FORTRAN_HAS_REAL_4_KIND;
#endif
+#endif
#if defined H5_FORTRAN_HAS_REAL_8_KIND
FoundRealSize[1] = 8;
+#ifdef H5_HAVE_FORTRAN_2003
+ FoundRealSizeKind_F03[1] = "C_DOUBLE";
+#else
FoundRealSizeKind[1] = H5_FORTRAN_HAS_REAL_8_KIND;
#endif
+#endif
#if defined H5_FORTRAN_HAS_REAL_16_KIND
if(H5_C_HAS_REAL_NATIVE_16 != 0) {
FoundRealSize[2] = 16;
+#ifdef H5_HAVE_FORTRAN_2003
+ FoundRealSizeKind_F03[2] = "C_LONG_DOUBLE";
+#else
FoundRealSizeKind[2] = H5_FORTRAN_HAS_REAL_16_KIND;
+#endif
}
#endif
@@ -464,7 +615,11 @@ int main(void)
{
sprintf(chrA, "Fortran_REAL_%d", FoundRealSize[i]);
sprintf(chrB, "real_%d_f", FoundRealSize[i]);
+#ifdef H5_HAVE_FORTRAN_2003
+ writeFloatToFilesF03(chrA, chrB, FoundRealSize[i], FoundRealSizeKind_F03[i]);
+#else
writeFloatToFiles(chrA, chrB, FoundRealSize[i], FoundRealSizeKind[i]);
+#endif
}
else /* Did not find the real type */
{
@@ -476,7 +631,11 @@ int main(void)
sprintf(chrA, "Fortran_REAL_%d", (-1)*FoundRealSize[i]);
sprintf(chrB, "real_%d_f", (-1)*FoundRealSize[i]);
if(FoundRealSize[j]>4) {
+#ifdef H5_HAVE_FORTRAN_2003
+ writeFloatToFilesF03(chrA, chrB, FoundRealSize[j], FoundRealSizeKind_F03[j]);
+#else
writeFloatToFiles(chrA, chrB, FoundRealSize[j], FoundRealSizeKind[j]);
+#endif
flag = 1;
}
/* else { */
@@ -495,7 +654,11 @@ int main(void)
sprintf(chrA, "Fortran_REAL_%d", (-1)*FoundRealSize[i]);
sprintf(chrB, "real_%d_f", (-1)*FoundRealSize[i]);
if(FoundRealSize[j]>4)
+#ifdef H5_HAVE_FORTRAN_2003
+ writeFloatToFilesF03(chrA, chrB, FoundRealSize[j], FoundRealSizeKind_F03[j]);
+#else
writeFloatToFiles(chrA, chrB, FoundRealSize[j], FoundRealSizeKind[j]);
+#endif
/* else { */
/* writeFloatToFiles(chrA, chrB, FoundRealSize[j]); */
/* } */
@@ -510,6 +673,22 @@ int main(void)
}
/* hid_t */
+#ifdef H5_HAVE_FORTRAN_2003
+#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HID_T >= 8
+ writeToFilesF03("HID_T", "hid_t_f", 8, "C_INT64_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_HID_T >= 4
+ writeToFilesF03("HID_T", "hid_t_f", 4, "C_INT32_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_2_KIND && H5_SIZEOF_HID_T >= 2
+ writeToFilesF03("HID_T", "hid_t_f", 2, "C_INT16_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_1_KIND && H5_SIZEOF_HID_T >= 1
+ writeToFilesF03("HID_T", "hid_t_f", 1, "C_INT8_T");
+#elif defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HID_T >= 4
+ writeToFilesF03("HID_T", "hid_t_f", 8, "C_INT64_T");
+#else
+ /* Error: couldn't find a size for hid_t */
+ return -1;
+#endif
+#else
#if defined H5_FORTRAN_HAS_INTEGER_8_KIND && H5_SIZEOF_HID_T >= 8
writeToFiles("HID_T", "hid_t_f", 8, H5_FORTRAN_HAS_INTEGER_8_KIND);
#elif defined H5_FORTRAN_HAS_INTEGER_4_KIND && H5_SIZEOF_HID_T >= 4
@@ -524,8 +703,23 @@ int main(void)
/* Error: couldn't find a size for hid_t */
return -1;
#endif
+#endif
/* real_f */
+#ifdef H5_HAVE_FORTRAN_2003
+#if defined H5_FORTRAN_HAS_REAL_NATIVE_16_KIND
+ if(H5_C_HAS_REAL_NATIVE_16 != 0) {
+ writeFloatToFilesF03("Fortran_REAL", "real_f", 16, "C_LONG_DOUBLE");
+ }
+#elif defined H5_FORTRAN_HAS_REAL_NATIVE_8_KIND
+ writeFloatToFilesF03("Fortran_REAL", "real_f", 8, "C_DOUBLE");
+#elif defined H5_FORTRAN_HAS_REAL_NATIVE_4_KIND
+ writeFloatToFilesF03("Fortran_REAL", "real_f", 4, "C_FLOAT");
+#else
+ /* Error: couldn't find a size for real_f */
+ return -1;
+#endif
+#else
#if defined H5_FORTRAN_HAS_REAL_NATIVE_16_KIND
if(H5_C_HAS_REAL_NATIVE_16 != 0) {
writeFloatToFiles("Fortran_REAL", "real_f", 16, H5_FORTRAN_HAS_REAL_NATIVE_16_KIND);
@@ -538,17 +732,30 @@ int main(void)
/* Error: couldn't find a size for real_f */
return -1;
#endif
+#endif
/* double_f */
#if defined H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND
if(H5_C_HAS_REAL_NATIVE_16 != 0) { /* Check if C has 16 byte floats */
+#ifdef H5_HAVE_FORTRAN_2003
+ writeFloatToFilesF03("Fortran_DOUBLE", "double_f", 16, "C_LONG_DOUBLE");
+#else
writeFloatToFiles("Fortran_DOUBLE", "double_f", 16, H5_FORTRAN_HAS_DOUBLE_NATIVE_16_KIND);
+#endif
} else {
#if defined H5_FORTRAN_HAS_REAL_NATIVE_8_KIND /* Fall back to 8 byte floats */
+#ifdef H5_HAVE_FORTRAN_2003
+ writeFloatToFilesF03("Fortran_DOUBLE", "double_f", 8, "C_DOUBLE");
+#else
writeFloatToFiles("Fortran_DOUBLE", "double_f", 8, H5_FORTRAN_HAS_REAL_NATIVE_8_KIND);
+#endif
}
#elif defined H5_FORTRAN_HAS_REAL_NATIVE_4_KIND /* Fall back to 4 byte floats */
+#ifdef H5_HAVE_FORTRAN_2003
+ writeFloatToFilesF03("Fortran_DOUBLE", "double_f", 4, "C_FLOAT");
+#else
writeFloatToFiles("Fortran_DOUBLE", "double_f", 4, H5_FORTRAN_HAS_REAL_NATIVE_4_KIND);
+#endif
}
#else
/* Error: couldn't find a size for double_f when fortran has 16 byte reals */
@@ -557,7 +764,11 @@ int main(void)
#endif
#elif defined H5_FORTRAN_HAS_DOUBLE_NATIVE_8_KIND
+#ifdef H5_HAVE_FORTRAN_2003
+ writeFloatToFilesF03("Fortran_DOUBLE", "double_f", 8, "C_DOUBLE");
+#else
writeFloatToFiles("Fortran_DOUBLE", "double_f", 8, H5_FORTRAN_HAS_DOUBLE_NATIVE_8_KIND);
+#endif
#else
/* Error: couldn't find a size for real_f */
return -1;
@@ -570,7 +781,6 @@ int main(void)
fprintf(fort_header, " INTEGER, PARAMETER :: H5R_DSET_REG_REF_BUF_SIZE_F = %u\n", H5_SIZEOF_HADDR_T + 4 );
-
/* Close files */
endCfile();
endFfile();
diff --git a/src/H5config.h.in b/src/H5config.h.in
index daf7d0d..7aedf82 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -129,6 +129,9 @@
/* Define to 1 if you have the `fork' function. */
#undef HAVE_FORK
+/* Define if we have F2003 compiler */
+#undef HAVE_FORTRAN_2003
+
/* Define to 1 if you have the `frexpf' function. */
#undef HAVE_FREXPF