diff --git a/m4/acx_cfortran_flags.m4 b/m4/acx_cfortran_flags.m4 index 44854e587e043c411ff145dab2e255d1cdc49554..7c56876e8709793243e70a2d8d6a91483c859309 100644 --- a/m4/acx_cfortran_flags.m4 +++ b/m4/acx_cfortran_flags.m4 @@ -150,13 +150,17 @@ dnl check f77 flag matches fc flag AC_PROVIDE_IFELSE([AC_PROG_F77], [AC_PROVIDE_IFELSE([AC_PROG_FC], [dnl both FC and F77 are configured - AS_IF([test -z "$FC" -o X"$FC" != Xno], - [acx_cv_cf_flag="$acx_cv_fc_cf_flag (probed)"], - [test -z "$F77" -o X"$F77" != Xno], - [acx_cv_cf_flag="$acx_cv_f77_cf_flag (probed)"], + AS_IF([test -z "$FC" -o X"$FC" = Xno], + [dnl FC compiler is not available, take the flag for F77 + acx_cv_cf_flag="$acx_cv_f77_cf_flag (probed)"], + [test -z "$F77" -o X"$F77" = Xno], + [dnl F77 compiler is not available, take the flag for FC + acx_cv_cf_flag="$acx_cv_fc_cf_flag (probed)"], [AS_IF([test x"$acx_cv_f77_cf_flag" = x"$acx_cv_fc_cf_flag"], - [acx_cv_cf_flag="$acx_cv_f77_cf_flag (probed)"], - [AC_MSG_ERROR([cfortran.h flag for $F77 does not match the flag for $FC. + [dnl the flags for both compilers are the same + acx_cv_cf_flag="$acx_cv_f77_cf_flag (probed)"], + [dnl FC and F77 need different flags + AC_MSG_ERROR([cfortran.h flag for $F77 does not match the flag for $FC. Have you configured compatible compilers?])])]) ])],[acx_cv_cf_flag="$acx_cv_fc_cf_flag (probed)"]) ]) diff --git a/m4/acx_check_cfortran.m4 b/m4/acx_check_cfortran.m4 index edd50f8b3ef87807fe7b234ed65a68aee9a45267..f784dd6667ada6b43bc97222f39b202d983a6bdc 100644 --- a/m4/acx_check_cfortran.m4 +++ b/m4/acx_check_cfortran.m4 @@ -204,8 +204,7 @@ dnl AC_DEFUN([ACX_CHECK_CFORTRAN], [AC_CACHE_CHECK([if C externals constructed with cfortran.h work], [acx_cv_cfortran_works], - [acx_cv_cfortran_works=no - save_CPPFLAGS=$CPPFLAGS + [save_CPPFLAGS=$CPPFLAGS CPPFLAGS="-I]m4_ifval([$1],[$1],[$srcdir/include])[ $CPPFLAGS" dnl build C function AC_LANG_PUSH([C])