diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2021-11-20 14:34:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-20 14:34:15 (GMT) |
commit | d74b2ddecbc68e27bf5bedcc1d169abcf0708a1a (patch) | |
tree | 56a8997347b8167411e11dc890200dda537f4e99 /m4 | |
parent | e7f11d487c57fd8af73afe06ab70593012cf17e5 (diff) | |
download | hdf5-d74b2ddecbc68e27bf5bedcc1d169abcf0708a1a.zip hdf5-d74b2ddecbc68e27bf5bedcc1d169abcf0708a1a.tar.gz hdf5-d74b2ddecbc68e27bf5bedcc1d169abcf0708a1a.tar.bz2 |
Merge Github #969 Use stdout instead of file for configure check #1089 (#1205)
Diffstat (limited to 'm4')
-rw-r--r-- | m4/aclocal_fc.f90 | 21 | ||||
-rw-r--r-- | m4/aclocal_fc.m4 | 150 |
2 files changed, 67 insertions, 104 deletions
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!]) ],[]) |