From 347ed5638e0fe3aba4546c0face8983ec0c44557 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Mon, 28 Feb 2022 11:30:15 +0100 Subject: [PATCH] Add -fallow-argument-mismatch to configry --- config/pac.m4 | 31 +++++++++++++++++++++++++++++++ configure | 46 +++++++++++++++++++++++++++++++++++++++++++--- configure.ac | 12 +++++++++--- 3 files changed, 83 insertions(+), 6 deletions(-) diff --git a/config/pac.m4 b/config/pac.m4 index 4621ed18..08554d67 100644 --- a/config/pac.m4 +++ b/config/pac.m4 @@ -194,6 +194,37 @@ AC_DEFUN(PAC_HAVE_MODERN_GFORTRAN, AC_LANG_POP([Fortran]) ]) +dnl @synopsis PAC_HAVE_GFORTRAN_10( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl +dnl Will check if the GNU fortran version is suitable for PSBLAS. +dnl If yes, will execute ACTION-IF-FOUND. Otherwise, ACTION-IF-NOT-FOUND. +dnl +dnl Note : Will use MPIFC; if unset, will use '$FC'. +dnl +dnl @author Michele Martone +dnl +AC_DEFUN(PAC_HAVE_GFORTRAN_10, + [AC_MSG_CHECKING([for version 10 or later of GNU Fortran]) + AC_LANG_PUSH([Fortran]) + ac_exeext='' + ac_ext='F90' + dnl ac_link='${MPIFC-$FC} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' + ac_fc=${MPIFC-$FC}; + AC_COMPILE_IFELSE([ + program main +#if ( __GNUC__ >= 10 ) + print *, "ok" +#else + this program will fail +#endif + end], + [ AC_MSG_RESULT([yes]) + ifelse([$1], , :, [ $1])], + [ AC_MSG_RESULT([no]) + ifelse([$2], , , [ $2])]) +AC_LANG_POP([Fortran]) +]) + dnl @synopsis PAC_FORTRAN_CHECK_HAVE_MPI_MOD( [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) dnl dnl Will determine if the fortran compiler MPIFC needs to include mpi.h or needs diff --git a/configure b/configure index 47935ffb..fb8d0800 100755 --- a/configure +++ b/configure @@ -7401,18 +7401,58 @@ fi if test "X$FCOPT" == "X" ; then FCOPT="$FCFLAGS"; fi + + if test "X$FCOPT" == "X" ; then if test "X$psblas_cv_fc" == "Xgcc" ; then # note that no space should be placed around the equality symbol in assignations # Note : 'native' is valid _only_ on GCC/x86 (32/64 bits) - FCOPT="-g -O3 $FCOPT" + FCOPT="-g -O3 -frecursive $FCOPT" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for version 10 or later of GNU Fortran" >&5 +$as_echo_n "checking for version 10 or later of GNU Fortran... " >&6; } + ac_ext=${ac_fc_srcext-f} +ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&5' +ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_fc_compiler_gnu + + ac_exeext='' + ac_ext='F90' + ac_fc=${MPIFC-$FC}; + cat > conftest.$ac_ext <<_ACEOF + + program main +#if ( __GNUC__ >= 10 ) + print *, "ok" +#else + this program will fail +#endif + end +_ACEOF +if ac_fn_fc_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + FCOPT="-fallow-argument-mismatch $FCOPT" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + elif test "X$psblas_cv_fc" == X"xlf" ; then # XL compiler : consider using -qarch=auto FCOPT="-O3 -qarch=auto -qlanglvl=extended -qxlf2003=polymorphic:autorealloc $FCOPT" FCFLAGS="-qhalt=e -qlanglvl=extended -qxlf2003=polymorphic:autorealloc $FCFLAGS" elif test "X$psblas_cv_fc" == X"ifc" ; then # other compilers .. - FCOPT="-O3 $FCOPT" + FCOPT="-O3 -recursive $FCOPT" elif test "X$psblas_cv_fc" == X"pg" ; then # other compilers .. FCOPT="-fast $FCOPT" @@ -8017,7 +8057,7 @@ if test x"$pac_cv_openmp" == x"yes" ; then CDEFINES="-DOPENMP $CDEFINES"; FCOPT="$FCOPT $pac_cv_openmp_fcopt"; CCOPT="$CCOPT $pac_cv_openmp_ccopt"; - CXXOPT="$CXXOPT $pac_cv_openmp_ccopt"; + CXXOPT="$CXXOPT $pac_cv_openmp_cxxopt"; FLINK="$FLINK $pac_cv_openmp_fcopt"; fi # diff --git a/configure.ac b/configure.ac index 338bd365..28e37269 100755 --- a/configure.ac +++ b/configure.ac @@ -412,19 +412,25 @@ fi # Honor FCFLAGS if they were specified explicitly, but --with-fcopt take precedence if test "X$FCOPT" == "X" ; then FCOPT="$FCFLAGS"; -fi +fi + + if test "X$FCOPT" == "X" ; then if test "X$psblas_cv_fc" == "Xgcc" ; then # note that no space should be placed around the equality symbol in assignations # Note : 'native' is valid _only_ on GCC/x86 (32/64 bits) - FCOPT="-g -O3 $FCOPT" + FCOPT="-g -O3 -frecursive $FCOPT" + PAC_HAVE_GFORTRAN_10( + [FCOPT="-fallow-argument-mismatch $FCOPT"], + []) + elif test "X$psblas_cv_fc" == X"xlf" ; then # XL compiler : consider using -qarch=auto FCOPT="-O3 -qarch=auto -qlanglvl=extended -qxlf2003=polymorphic:autorealloc $FCOPT" FCFLAGS="-qhalt=e -qlanglvl=extended -qxlf2003=polymorphic:autorealloc $FCFLAGS" elif test "X$psblas_cv_fc" == X"ifc" ; then # other compilers .. - FCOPT="-O3 $FCOPT" + FCOPT="-O3 -recursive $FCOPT" elif test "X$psblas_cv_fc" == X"pg" ; then # other compilers .. FCOPT="-fast $FCOPT"