summaryrefslogtreecommitdiffstats
path: root/m4/aclocal_fc.m4
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2021-11-18 05:53:00 (GMT)
committerGitHub <noreply@github.com>2021-11-18 05:53:00 (GMT)
commitaa2f6735fb7b0dbeae52e9478890e81216c63744 (patch)
treeb501fdc9caabbbd58d026d675e744caf6022bfdf /m4/aclocal_fc.m4
parentb823ddc52636596a886c9cc8424142b7c28a1b29 (diff)
downloadhdf5-aa2f6735fb7b0dbeae52e9478890e81216c63744.zip
hdf5-aa2f6735fb7b0dbeae52e9478890e81216c63744.tar.gz
hdf5-aa2f6735fb7b0dbeae52e9478890e81216c63744.tar.bz2
Github #969 Use stdout instead of file for configure check (#1089)
* Use stdout instead of file for configure check * Make change requested by #1157 * Change fortran to use stderr for configure * Correct typo * remove obsolete file check * Fortran statement fix
Diffstat (limited to 'm4/aclocal_fc.m4')
-rw-r--r--m4/aclocal_fc.m4150
1 files changed, 57 insertions, 93 deletions
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!])
],[])