summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/cmake/ConfigureChecks.cmake9
-rw-r--r--config/cmake/HDF5UseFortran.cmake71
-rw-r--r--m4/aclocal_fc.f9021
-rw-r--r--m4/aclocal_fc.m4150
4 files changed, 93 insertions, 158 deletions
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
index 7b9d603..483e551 100644
--- a/config/cmake/ConfigureChecks.cmake
+++ b/config/cmake/ConfigureChecks.cmake
@@ -232,7 +232,7 @@ endif ()
# so this one is used.
#-----------------------------------------------------------------------------
set (RUN_OUTPUT_PATH_DEFAULT ${CMAKE_BINARY_DIR})
-macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR)
+macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR RETURN_OUTPUT_VAR)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
message (VERBOSE "Detecting C ${FUNCTION_NAME}")
endif ()
@@ -248,7 +248,7 @@ macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR)
RUN_OUTPUT_VARIABLE OUTPUT_VAR
)
- set (${RETURN_VAR} ${OUTPUT_VAR})
+ set (${RETURN_OUTPUT_VAR} ${OUTPUT_VAR})
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
message (VERBOSE "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
@@ -304,12 +304,11 @@ set (PROG_SRC
#define C_LDBL_DIG DECIMAL_DIG\n\
#else\n\
#define C_LDBL_DIG LDBL_DIG\n\
-#endif\n\nint main() {\nFILE *pFile = fopen(\"pac_Cconftest.out\",\"w\")\\\;\nfprintf(pFile, \"\\%d\\\;\\%d\\\;\", C_LDBL_DIG, C_FLT128_DIG)\\\;\n\nreturn 0\\\;\n}\n
+#endif\n\nint main() {\nprintf(\"\\%d\\\;\\%d\\\;\", C_LDBL_DIG, C_FLT128_DIG)\\\;\n\nreturn 0\\\;\n}\n
"
)
-C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_RES)
-file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_Cconftest.out" PROG_OUTPUT4)
+C_RUN ("maximum decimal precision for C" ${PROG_SRC} PROG_RES PROG_OUTPUT4)
message (STATUS "Testing maximum decimal precision for C - ${PROG_OUTPUT4}")
# dnl The output from the above program will be:
diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake
index e192ec4..40027ea 100644
--- a/config/cmake/HDF5UseFortran.cmake
+++ b/config/cmake/HDF5UseFortran.cmake
@@ -32,15 +32,10 @@ macro (READ_SOURCE SOURCE_START SOURCE_END RETURN_VAR)
endmacro ()
set (RUN_OUTPUT_PATH_DEFAULT ${CMAKE_BINARY_DIR})
-if (NOT CMAKE_VERSION VERSION_LESS "3.14.0")
- if (HDF5_REQUIRED_LIBRARIES)
- set (CMAKE_REQUIRED_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}")
- endif ()
-else ()
# The provided CMake Fortran macros don't provide a general compile/run function
# so this one is used.
#-----------------------------------------------------------------------------
-macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 RETURN_VAR)
+macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1 RETURN_VAR RETURN_OUTPUT_VAR)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0")
message (VERBOSE "Detecting Fortran ${FUNCTION_NAME}")
endif ()
@@ -52,7 +47,9 @@ macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90
LINK_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}"
+ RUN_OUTPUT_VARIABLE OUTPUT_VAR
)
+ set (${RETURN_OUTPUT_VAR} ${OUTPUT_VAR})
if (${COMPILE_RESULT_VAR})
set(${RETURN_VAR} ${RUN_RESULT_VAR})
@@ -81,7 +78,6 @@ macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1
set(${RETURN_VAR} ${COMPILE_RESULT_VAR})
endif ()
endmacro ()
-endif ()
#-----------------------------------------------------------------------------
# Check to see C_LONG_DOUBLE is available
@@ -130,25 +126,20 @@ endif ()
#-----------------------------------------------------------------------------
READ_SOURCE ("PROGRAM FC_AVAIL_KINDS" "END PROGRAM FC_AVAIL_KINDS" SOURCE_CODE)
-if (NOT CMAKE_VERSION VERSION_LESS "3.14.0")
- check_fortran_source_runs (${SOURCE_CODE} FC_AVAIL_KINDS_RESULT SRC_EXT f90)
-else ()
FORTRAN_RUN ("REAL and INTEGER KINDs"
"${SOURCE_CODE}"
XX
YY
FC_AVAIL_KINDS_RESULT
+ PROG_OUTPUT
)
-endif ()
-
# dnl The output from the above program will be:
# dnl -- LINE 1 -- valid integer kinds (comma seperated list)
# dnl -- LINE 2 -- valid real kinds (comma seperated list)
# dnl -- LINE 3 -- max decimal precision for reals
# dnl -- LINE 4 -- number of valid integer kinds
# dnl -- LINE 5 -- number of valid real kinds
-
-file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_fconftest.out" PROG_OUTPUT)
+#
# Convert the string to a list of strings by replacing the carriage return with a semicolon
string (REGEX REPLACE "\n" ";" PROG_OUTPUT "${PROG_OUTPUT}")
@@ -196,20 +187,14 @@ foreach (KIND ${VAR})
"
PROGRAM main
USE ISO_C_BINDING
+ USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT
IMPLICIT NONE
INTEGER (KIND=${KIND}) a
- OPEN(8,FILE='pac_validIntKinds.${KIND}.out',FORM='formatted')
- WRITE(8,'(I0)') ${FC_SIZEOF_A}
- CLOSE(8)
+ WRITE(stderr,'(I0)') ${FC_SIZEOF_A}
END
"
)
- if (NOT CMAKE_VERSION VERSION_LESS "3.14.0")
- check_fortran_source_runs (${PROG_SRC_${KIND}} VALIDINTKINDS_RESULT_${KIND} SRC_EXT f90)
- else ()
- FORTRAN_RUN("INTEGER KIND SIZEOF" ${PROG_SRC_${KIND}} XX YY VALIDINTKINDS_RESULT_${KIND})
- endif ()
- file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_validIntKinds.${KIND}.out" PROG_OUTPUT1)
+ FORTRAN_RUN("INTEGER KIND SIZEOF" ${PROG_SRC_${KIND}} XX YY VALIDINTKINDS_RESULT_${KIND} PROG_OUTPUT1)
string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}")
set (pack_int_sizeof "${pack_int_sizeof} ${PROG_OUTPUT1},")
endforeach ()
@@ -245,22 +230,16 @@ foreach (KIND ${VAR} )
"
PROGRAM main
USE ISO_C_BINDING
+ USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT
IMPLICIT NONE
REAL (KIND=${KIND}) a
- OPEN(8,FILE='pac_validRealKinds.${KIND}.out',FORM='formatted')
- WRITE(8,'(I0)') ${FC_SIZEOF_A}
- CLOSE(8)
+ WRITE(stderr,'(I0)') ${FC_SIZEOF_A}
END
"
)
- if (NOT CMAKE_VERSION VERSION_LESS "3.14.0")
- check_fortran_source_runs (${PROG_SRC2_${KIND}} VALIDREALKINDS_RESULT_${KIND} SRC_EXT f90)
- else ()
- FORTRAN_RUN ("REAL KIND SIZEOF" ${PROG_SRC2_${KIND}} XX YY VALIDREALKINDS_RESULT_${KIND})
- endif ()
- file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_validRealKinds.${KIND}.out" PROG_OUTPUT1)
- string (REGEX REPLACE "\n" "" PROG_OUTPUT1 "${PROG_OUTPUT1}")
- set (pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT1},")
+ FORTRAN_RUN ("REAL KIND SIZEOF" ${PROG_SRC2_${KIND}} XX YY VALIDREALKINDS_RESULT_${KIND} PROG_OUTPUT2)
+ string (REGEX REPLACE "\n" "" PROG_OUTPUT2 "${PROG_OUTPUT2}")
+ set (pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT2},")
endforeach ()
if (pack_real_sizeof STREQUAL "")
@@ -293,27 +272,21 @@ set (PROG_SRC3
"
PROGRAM main
USE ISO_C_BINDING
+ USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT
IMPLICIT NONE
INTEGER a
REAL b
DOUBLE PRECISION c
- OPEN(8,FILE='pac_sizeof_native_kinds.out',FORM='formatted')
- WRITE(8,*) ${FC_SIZEOF_A}
- WRITE(8,*) kind(a)
- WRITE(8,*) ${FC_SIZEOF_B}
- WRITE(8,*) kind(b)
- WRITE(8,*) ${FC_SIZEOF_C}
- WRITE(8,*) kind(c)
- CLOSE(8)
+ WRITE(stderr,*) ${FC_SIZEOF_A}
+ WRITE(stderr,*) kind(a)
+ WRITE(stderr,*) ${FC_SIZEOF_B}
+ WRITE(stderr,*) kind(b)
+ WRITE(stderr,*) ${FC_SIZEOF_C}
+ WRITE(stderr,*) kind(c)
END
"
)
-if (NOT CMAKE_VERSION VERSION_LESS "3.14.0")
- check_fortran_source_runs (${PROG_SRC3} PAC_SIZEOF_NATIVE_KINDS_RESULT SRC_EXT f90)
-else ()
- FORTRAN_RUN ("SIZEOF NATIVE KINDs" ${PROG_SRC3} XX YY PAC_SIZEOF_NATIVE_KINDS_RESULT)
-endif ()
-file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_sizeof_native_kinds.out" PROG_OUTPUT3)
+FORTRAN_RUN ("SIZEOF NATIVE KINDs" ${PROG_SRC3} XX YY PAC_SIZEOF_NATIVE_KINDS_RESULT PROG_OUTPUT3)
# dnl The output from the above program will be:
# dnl -- LINE 1 -- sizeof INTEGER
# dnl -- LINE 2 -- kind of INTEGER
@@ -321,7 +294,7 @@ file (READ "${RUN_OUTPUT_PATH_DEFAULT}/pac_sizeof_native_kinds.out" PROG_OUTPUT3
# dnl -- LINE 4 -- kind of REAL
# dnl -- LINE 5 -- sizeof DOUBLE PRECISION
# dnl -- LINE 6 -- kind of DOUBLE PRECISION
-
+#
# Convert the string to a list of strings by replacing the carriage return with a semicolon
string (REGEX REPLACE "\n" ";" PROG_OUTPUT3 "${PROG_OUTPUT3}")
diff --git a/m4/aclocal_fc.f90 b/m4/aclocal_fc.f90
index e9a11c0..240a768 100644
--- a/m4/aclocal_fc.f90
+++ b/m4/aclocal_fc.f90
@@ -82,6 +82,7 @@ END PROGRAM PROG_FC_C_LONG_DOUBLE_EQ_C_DOUBLE
!---- START ----- Determine the available KINDs for REALs and INTEGERs
PROGRAM FC_AVAIL_KINDS
+ USE, INTRINSIC :: ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT
IMPLICIT NONE
INTEGER :: ik, jk, k, kk, max_decimal_prec
INTEGER :: prev_rkind, num_rkinds = 1, num_ikinds = 1
@@ -89,8 +90,6 @@ PROGRAM FC_AVAIL_KINDS
INTEGER, DIMENSION(1:10) :: list_rkinds = -1
LOGICAL :: new_kind
- OPEN(8, FILE='pac_fconftest.out', FORM='formatted')
-
! Find integer KINDs
list_ikinds(num_ikinds)=SELECTED_INT_KIND(1)
DO ik = 2, 36
@@ -103,11 +102,11 @@ PROGRAM FC_AVAIL_KINDS
ENDDO
DO k = 1, num_ikinds
- WRITE(8,'(I0)', ADVANCE='NO') list_ikinds(k)
+ WRITE(stderr,'(I0)', ADVANCE='NO') list_ikinds(k)
IF(k.NE.num_ikinds)THEN
- WRITE(8,'(A)',ADVANCE='NO') ','
+ WRITE(stderr,'(A)',ADVANCE='NO') ','
ELSE
- WRITE(8,'()')
+ WRITE(stderr,'()')
ENDIF
ENDDO
@@ -140,17 +139,17 @@ PROGRAM FC_AVAIL_KINDS
ENDDO prec
DO k = 1, num_rkinds
- WRITE(8,'(I0)', ADVANCE='NO') list_rkinds(k)
+ WRITE(stderr,'(I0)', ADVANCE='NO') list_rkinds(k)
IF(k.NE.num_rkinds)THEN
- WRITE(8,'(A)',ADVANCE='NO') ','
+ WRITE(stderr,'(A)',ADVANCE='NO') ','
ELSE
- WRITE(8,'()')
+ WRITE(stderr,'()')
ENDIF
ENDDO
- WRITE(8,'(I0)') max_decimal_prec
- WRITE(8,'(I0)') num_ikinds
- WRITE(8,'(I0)') num_rkinds
+ WRITE(stderr,'(I0)') max_decimal_prec
+ WRITE(stderr,'(I0)') num_ikinds
+ WRITE(stderr,'(I0)') num_rkinds
END PROGRAM FC_AVAIL_KINDS
!---- END ----- Determine the available KINDs for REALs and INTEGERs
diff --git a/m4/aclocal_fc.m4 b/m4/aclocal_fc.m4
index e5d664d..49ff485 100644
--- a/m4/aclocal_fc.m4
+++ b/m4/aclocal_fc.m4
@@ -68,7 +68,7 @@ AC_DEFUN([PAC_PROG_FC_ISO_FORTRAN_ENV],[
AC_MSG_CHECKING([if Fortran compiler supports intrinsic module ISO_FORTRAN_ENV])
TEST_SRC="`sed -n '/PROGRAM PROG_FC_ISO_FORTRAN_ENV/,/END PROGRAM PROG_FC_ISO_FORTRAN_ENV/p' $srcdir/m4/aclocal_fc.f90`"
AC_LINK_IFELSE([$TEST_SRC],[AC_MSG_RESULT([yes])
- HAVE_ISO_FORTRAN_ENV="yes"],
+ HAVE_ISO_FORTRAN_ENV="yes"],
[AC_MSG_RESULT([no])])
])
@@ -79,7 +79,7 @@ AC_DEFUN([PAC_PROG_FC_SIZEOF],[
AC_MSG_CHECKING([if Fortran compiler supports intrinsic SIZEOF])
TEST_SRC="`sed -n '/PROGRAM PROG_FC_SIZEOF/,/END PROGRAM PROG_FC_SIZEOF/p' $srcdir/m4/aclocal_fc.f90`"
AC_LINK_IFELSE([$TEST_SRC],[AC_MSG_RESULT([yes])
- HAVE_SIZEOF_FORTRAN="yes"],
+ HAVE_SIZEOF_FORTRAN="yes"],
[AC_MSG_RESULT([no])])
])
@@ -90,7 +90,7 @@ AC_DEFUN([PAC_PROG_FC_C_SIZEOF],[
AC_MSG_CHECKING([if Fortran compiler supports intrinsic C_SIZEOF])
TEST_SRC="`sed -n '/PROGRAM PROG_FC_C_SIZEOF/,/END PROGRAM PROG_FC_C_SIZEOF/p' $srcdir/m4/aclocal_fc.f90`"
AC_LINK_IFELSE([$TEST_SRC], [AC_MSG_RESULT([yes])
- HAVE_C_SIZEOF_FORTRAN="yes"],
+ HAVE_C_SIZEOF_FORTRAN="yes"],
[AC_MSG_RESULT([no])])
])
@@ -101,7 +101,7 @@ AC_DEFUN([PAC_PROG_FC_STORAGE_SIZE],[
AC_MSG_CHECKING([if Fortran compiler supports intrinsic STORAGE_SIZE])
TEST_SRC="`sed -ne '/PROGRAM PROG_FC_STORAGE_SIZE/,/END PROGRAM PROG_FC_STORAGE_SIZE/p' $srcdir/m4/aclocal_fc.f90`"
AC_LINK_IFELSE([$TEST_SRC], [AC_MSG_RESULT([yes])
- HAVE_STORAGE_SIZE_FORTRAN="yes"],
+ HAVE_STORAGE_SIZE_FORTRAN="yes"],
[AC_MSG_RESULT([no])])
])
@@ -114,7 +114,7 @@ AC_DEFUN([PAC_PROG_FC_HAVE_C_LONG_DOUBLE],[
TEST_SRC=""
TEST_SRC="`sed -n '/PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE/,/END PROGRAM PROG_FC_HAVE_C_LONG_DOUBLE/p' $srcdir/m4/aclocal_fc.f90`"
AC_LINK_IFELSE([$TEST_SRC], [AC_MSG_RESULT([yes])
- HAVE_C_LONG_DOUBLE_FORTRAN="yes"],
+ HAVE_C_LONG_DOUBLE_FORTRAN="yes"],
[AC_MSG_RESULT([no])])
])
@@ -146,8 +146,8 @@ AC_DEFUN([PAC_PROG_FC_HAVE_F2003_REQUIREMENTS],[
dnl -------------------------------------------------------------------------
dnl AC_F9X_MODS()
dnl
-dnl Check how F9X handles modules. This macro also checks which
-dnl command-line option to use to include the module once it's built.
+dnl Check how F9X handles modules. This macro also checks which
+dnl command-line option to use to include the module once it's built.
dnl
AC_DEFUN([AC_F9X_MODS],
[AC_MSG_CHECKING(what $FC does with modules)
@@ -223,7 +223,6 @@ else
fi
AC_SUBST(F9XMODFLAG)
AC_SUBST(F9XMODEXT)
-rm -rf conftest*
AC_LANG_POP(Fortran)
])
@@ -241,9 +240,9 @@ dnl Change to the Fortran 90 language
dnl Try link a simple MPI program.
AC_MSG_CHECKING([whether a simple MPI-IO Fortran program can be linked])
AC_LINK_IFELSE([$TEST_SRC],
- [AC_MSG_RESULT([yes])],
- [AC_MSG_RESULT([no])
- AC_MSG_ERROR([unable to link a simple MPI-IO Fortran program])])
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ AC_MSG_ERROR([unable to link a simple MPI-IO Fortran program])])
dnl Change to the C language
AC_LANG_POP(Fortran)
@@ -257,51 +256,43 @@ dnl This is a runtime test.
dnl
AC_DEFUN([PAC_FC_AVAIL_KINDS],[
AC_LANG_PUSH([Fortran])
-rm -f pac_fconftest.out
TEST_SRC="`sed -n '/PROGRAM FC_AVAIL_KINDS/,/END PROGRAM FC_AVAIL_KINDS/p' $srcdir/m4/aclocal_fc.f90`"
AC_RUN_IFELSE([$TEST_SRC],
[
- if test -s pac_fconftest.out ; then
-
- dnl The output from the above program will be:
- dnl -- LINE 1 -- valid integer kinds (comma seperated list)
- dnl -- LINE 2 -- valid real kinds (comma seperated list)
- dnl -- LINE 3 -- max decimal precision for reals
- dnl -- LINE 4 -- number of valid integer kinds
- dnl -- LINE 5 -- number of valid real kinds
-
- pac_validIntKinds="`sed -n '1p' pac_fconftest.out`"
- pac_validRealKinds="`sed -n '2p' pac_fconftest.out`"
- PAC_FC_MAX_REAL_PRECISION="`sed -n '3p' pac_fconftest.out`"
+ dnl The output from the above program will be:
+ dnl -- LINE 1 -- valid integer kinds (comma seperated list)
+ dnl -- LINE 2 -- valid real kinds (comma seperated list)
+ dnl -- LINE 3 -- max decimal precision for reals
+ dnl -- LINE 4 -- number of valid integer kinds
+ dnl -- LINE 5 -- number of valid real kinds
+
+ pac_validIntKinds=$(./conftest$EXEEXT 2>&1 | sed -n '1p')
+ pac_validRealKinds=$(./conftest$EXEEXT 2>&1 | sed -n '2p')
+ PAC_FC_MAX_REAL_PRECISION=$(./conftest$EXEEXT 2>&1 | sed -n '3p')
AC_DEFINE_UNQUOTED([PAC_FC_MAX_REAL_PRECISION], $PAC_FC_MAX_REAL_PRECISION, [Define Fortran Maximum Real Decimal Precision])
PAC_FC_ALL_INTEGER_KINDS="{`echo $pac_validIntKinds`}"
PAC_FC_ALL_REAL_KINDS="{`echo $pac_validRealKinds`}"
- PAC_FORTRAN_NUM_INTEGER_KINDS="`sed -n '4p' pac_fconftest.out`"
- H5CONFIG_F_NUM_IKIND="INTEGER, PARAMETER :: num_ikinds = `echo $PAC_FORTRAN_NUM_INTEGER_KINDS`"
- H5CONFIG_F_IKIND="INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/`echo $pac_validIntKinds`/)"
- H5CONFIG_F_NUM_RKIND="INTEGER, PARAMETER :: num_rkinds = `sed -n '5p' pac_fconftest.out`"
- H5CONFIG_F_RKIND="INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/`echo $pac_validRealKinds`/)"
+ PAC_FORTRAN_NUM_INTEGER_KINDS=$(./conftest$EXEEXT 2>&1 | sed -n '4p')
+ H5CONFIG_F_NUM_IKIND="INTEGER, PARAMETER :: num_ikinds = `echo $PAC_FORTRAN_NUM_INTEGER_KINDS`"
+ H5CONFIG_F_IKIND="INTEGER, DIMENSION(1:num_ikinds) :: ikind = (/`echo $pac_validIntKinds`/)"
+ H5CONFIG_F_NUM_RKIND="INTEGER, PARAMETER :: num_rkinds = $(./conftest$EXEEXT 2>&1 | sed -n '5p')"
+ H5CONFIG_F_RKIND="INTEGER, DIMENSION(1:num_rkinds) :: rkind = (/`echo $pac_validRealKinds`/)"
- AC_DEFINE_UNQUOTED([H5CONFIG_F_NUM_RKIND], $H5CONFIG_F_NUM_RKIND, [Define number of valid Fortran REAL KINDs])
- AC_DEFINE_UNQUOTED([H5CONFIG_F_NUM_IKIND], $H5CONFIG_F_NUM_IKIND, [Define number of valid Fortran INTEGER KINDs])
- AC_DEFINE_UNQUOTED([H5CONFIG_F_RKIND], $H5CONFIG_F_RKIND, [Define valid Fortran REAL KINDs])
- AC_DEFINE_UNQUOTED([H5CONFIG_F_IKIND], $H5CONFIG_F_IKIND, [Define valid Fortran INTEGER KINDs])
+ AC_DEFINE_UNQUOTED([H5CONFIG_F_NUM_RKIND], $H5CONFIG_F_NUM_RKIND, [Define number of valid Fortran REAL KINDs])
+ AC_DEFINE_UNQUOTED([H5CONFIG_F_NUM_IKIND], $H5CONFIG_F_NUM_IKIND, [Define number of valid Fortran INTEGER KINDs])
+ AC_DEFINE_UNQUOTED([H5CONFIG_F_RKIND], $H5CONFIG_F_RKIND, [Define valid Fortran REAL KINDs])
+ AC_DEFINE_UNQUOTED([H5CONFIG_F_IKIND], $H5CONFIG_F_IKIND, [Define valid Fortran INTEGER KINDs])
AC_MSG_CHECKING([for Number of Fortran INTEGER KINDs])
AC_MSG_RESULT([$PAC_FORTRAN_NUM_INTEGER_KINDS])
AC_MSG_CHECKING([for Fortran INTEGER KINDs])
AC_MSG_RESULT([$PAC_FC_ALL_INTEGER_KINDS])
- AC_MSG_CHECKING([for Fortran REAL KINDs])
- AC_MSG_RESULT([$PAC_FC_ALL_REAL_KINDS])
- AC_MSG_CHECKING([for Fortran REALs maximum decimal precision])
- AC_MSG_RESULT([$PAC_FC_MAX_REAL_PRECISION])
- else
- AC_MSG_RESULT([Error])
- AC_MSG_ERROR([No output from Fortran test program!])
- fi
- rm -f pac_fconftest.out
+ AC_MSG_CHECKING([for Fortran REAL KINDs])
+ AC_MSG_RESULT([$PAC_FC_ALL_REAL_KINDS])
+ AC_MSG_CHECKING([for Fortran REALs maximum decimal precision])
+ AC_MSG_RESULT([$PAC_FC_MAX_REAL_PRECISION])
],[
AC_MSG_RESULT([Error])
AC_MSG_ERROR([Failed to run Fortran program to determine available KINDs])
@@ -314,29 +305,22 @@ AC_REQUIRE([PAC_FC_AVAIL_KINDS])
AC_MSG_CHECKING([sizeof of available INTEGER KINDs])
AC_LANG_PUSH([Fortran])
pack_int_sizeof=""
-rm -f pac_fconftest.out
for kind in `echo $pac_validIntKinds | sed -e 's/,/ /g'`; do
AC_LANG_CONFTEST([
AC_LANG_SOURCE([
PROGRAM main
USE ISO_C_BINDING
+ USE ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT
IMPLICIT NONE
INTEGER (KIND=$kind) a
- OPEN(8, FILE='pac_fconftest.out', FORM='formatted')
- WRITE(8,'(I0)') $FC_SIZEOF_A
- CLOSE(8)
+ WRITE(stderr,'(I0)') $FC_SIZEOF_A
END
])
])
AC_RUN_IFELSE([],[
- if test -s pac_fconftest.out ; then
- sizes="`cat pac_fconftest.out`"
- pack_int_sizeof="$pack_int_sizeof $sizes,"
- else
- AC_MSG_ERROR([No output from Fortran test program!])
- fi
- rm -f pac_fconftest.out
+ sizes=$(./conftest$EXEEXT 2>&1)
+ pack_int_sizeof="$pack_int_sizeof $sizes,"
],[
AC_MSG_ERROR([Fortran program fails to build or run!])
],[
@@ -359,22 +343,16 @@ for kind in `echo $pac_validRealKinds | sed -e 's/,/ /g'`; do
AC_LANG_SOURCE([
PROGRAM main
USE ISO_C_BINDING
+ USE ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT
IMPLICIT NONE
REAL (KIND=$kind) :: a
- OPEN(8, FILE='pac_fconftest.out', FORM='formatted')
- WRITE(8,'(I0)') $FC_SIZEOF_A
- CLOSE(8)
+ WRITE(stderr,'(I0)') $FC_SIZEOF_A
END
])
])
AC_RUN_IFELSE([],[
- if test -s pac_fconftest.out ; then
- sizes="`cat pac_fconftest.out`"
- pack_real_sizeof="$pack_real_sizeof $sizes,"
- else
- AC_MSG_ERROR([No output from Fortran test program!])
- fi
- rm -f pac_fconftest.out
+ sizes=$(./conftest$EXEEXT 2>&1)
+ pack_real_sizeof="$pack_real_sizeof $sizes,"
],[
AC_MSG_ERROR([Fortran program fails to build or run!])
],[
@@ -396,33 +374,27 @@ rm -f pac_fconftest.out
AC_LANG_SOURCE([
PROGRAM main
USE ISO_C_BINDING
+ USE ISO_FORTRAN_ENV, ONLY : stderr=>ERROR_UNIT
IMPLICIT NONE
INTEGER a
REAL b
DOUBLE PRECISION c
- OPEN(8, FILE='pac_fconftest.out', FORM='formatted')
- WRITE(8,*) $FC_SIZEOF_A
- WRITE(8,*) KIND(a)
- WRITE(8,*) $FC_SIZEOF_B
- WRITE(8,*) KIND(b)
- WRITE(8,*) $FC_SIZEOF_C
- WRITE(8,*) KIND(c)
- CLOSE(8)
+ WRITE(stderr,*) $FC_SIZEOF_A
+ WRITE(stderr,*) KIND(a)
+ WRITE(stderr,*) $FC_SIZEOF_B
+ WRITE(stderr,*) KIND(b)
+ WRITE(stderr,*) $FC_SIZEOF_C
+ WRITE(stderr,*) KIND(c)
END
])
])
AC_RUN_IFELSE([],[
- if test -s pac_fconftest.out ; then
- PAC_FORTRAN_NATIVE_INTEGER_SIZEOF="`sed -n '1p' pac_fconftest.out`"
- PAC_FORTRAN_NATIVE_INTEGER_KIND="`sed -n '2p' pac_fconftest.out`"
- PAC_FORTRAN_NATIVE_REAL_SIZEOF="`sed -n '3p' pac_fconftest.out`"
- PAC_FORTRAN_NATIVE_REAL_KIND="`sed -n '4p' pac_fconftest.out`"
- PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF="`sed -n '5p' pac_fconftest.out`"
- PAC_FORTRAN_NATIVE_DOUBLE_KIND="`sed -n '6p' pac_fconftest.out`"
- else
- AC_MSG_ERROR([No output from Fortran test program!])
- fi
- rm -f pac_fconftest.out
+ PAC_FORTRAN_NATIVE_INTEGER_SIZEOF=$(./conftest$EXEEXT 2>&1 | sed -n '1p')
+ PAC_FORTRAN_NATIVE_INTEGER_KIND=$(./conftest$EXEEXT 2>&1 | sed -n '2p')
+ PAC_FORTRAN_NATIVE_REAL_SIZEOF=$(./conftest$EXEEXT 2>&1 | sed -n '3p')
+ PAC_FORTRAN_NATIVE_REAL_KIND=$(./conftest$EXEEXT 2>&1 | sed -n '4p')
+ PAC_FORTRAN_NATIVE_DOUBLE_SIZEOF=$(./conftest$EXEEXT 2>&1 | sed -n '5p')
+ PAC_FORTRAN_NATIVE_DOUBLE_KIND=$(./conftest$EXEEXT 2>&1 | sed -n '6p')
],[
AC_MSG_ERROR([Fortran program fails to build or run!])
],[
@@ -434,7 +406,6 @@ AC_LANG_POP([Fortran])
AC_DEFUN([PAC_FC_LDBL_DIG],[
AC_MSG_CHECKING([maximum decimal precision for C])
-rm -f pac_Cconftest.out
AC_LANG_CONFTEST([
AC_LANG_PROGRAM([
#include <float.h>
@@ -458,19 +429,12 @@ rm -f pac_Cconftest.out
#define C_LDBL_DIG LDBL_DIG
#endif
],[[
- FILE * pFile;
- pFile = fopen("pac_Cconftest.out","w");
- fprintf(pFile, "%d\n%d\n", C_LDBL_DIG, C_FLT128_DIG);
+ fprintf(stderr, "%d\n%d\n", C_LDBL_DIG, C_FLT128_DIG);
]])
])
AC_RUN_IFELSE([],[
- if test -s pac_Cconftest.out ; then
- LDBL_DIG="`sed -n '1p' pac_Cconftest.out`"
- FLT128_DIG="`sed -n '2p' pac_Cconftest.out`"
- else
- AC_MSG_ERROR([No output from C decimal precision program!])
- fi
- rm -f pac_Cconftest.out
+ LDBL_DIG=$(./conftest$EXEEXT 2>&1 | sed -n '1p')
+ FLT128_DIG=$(./conftest$EXEEXT 2>&1 | sed -n '2p')
],[
AC_MSG_ERROR([C program fails to build or run!])
],[])