From f2d20bab131e98e9ec1ad38f0aab774badc27d94 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Mon, 11 May 2020 14:08:42 -0600 Subject: [PATCH] Added a check for compiler flag -fallow-argument-mismatch, introduced in gcc 10. For the time being, this flag is required when compiling netCDF-Fortran with gfortran 10. Added in support of https://github.com/Unidata/netcdf-fortran/issues/212 --- configure.ac | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/configure.ac b/configure.ac index 9e9960b9..d6fcdfab 100644 --- a/configure.ac +++ b/configure.ac @@ -272,12 +272,36 @@ EOF fi fi +# Test to see if fortran compiler supports the flag +# -fallow-argument-mismatch flag introduced in gfortran 10. +# +# See https://github.com/Unidata/netcdf-fortran/issues/212 +ac_save_FCFLAGS="$FCFLAGS" +AC_MSG_CHECKING([if Fortran compiler supports allow-mismatch flag]) +cat <conftest.f90 +Program test +USE ISO_C_BINDING, ONLY: C_PTRDIFF_T +End Program +EOF +doit='$FC -c ${FCFLAGS} ${FCFLAGS_f90} -fallow-argument-mismatch conftest.f90' +if AC_TRY_EVAL(doit); then + nf_allow_mismatch=yes + FCFLAGS="${FCFLAGS} -fallow-argument-mismatch" + else + nf_allow_mismatch=no +fi +AC_MSG_RESULT([$nf_allow_mismatch]) + + +# End testing of gfortan allow-mismatch flags. + # We must have F2003 ISO bindings to build. if test "x$nc_iso_c_binding" = xno; then AC_MSG_FAILURE([Fortran 2003 interface not supported]) fi nc_build_f03=yes + # Does the user want to check into fortran type information? AC_MSG_CHECKING([whether fortran type sizes should be checked]) AC_ARG_ENABLE([fortran-type-check],