Could someone please apply this patch: [PATCH] Ignore Set-But-Null `ac_fc_srcext` when setting `ac_ext`
This allows to reset `ac_fc_srcext` after `AC_FC_SRCEXT` was called: ``` save=$ac_fc_srcext AC_FC_PP_SRCEXT([F]) ac_fc_srcext=$save ``` Which `AC_FC_PP_DEFINE()` also does and thus it breaks later usage of `AC_LANG_PUSH(Fortran)` * lib/autoconf/fortran.m4 (AC_LANG(Fortran)): Do not consider a Set-But-Null `ac_fc_srcext` a valid value, and thus use the default `f` in this case too. --- lib/autoconf/fortran.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4 index 17043c56..fbd64ea9 100644 --- a/lib/autoconf/fortran.m4 +++ b/lib/autoconf/fortran.m4 @@ -220,7 +220,7 @@ m4_define([AC_LANG_FUNC_LINK_TRY(Fortran 77)], # AC_LANG(Fortran) # ---------------- AC_LANG_DEFINE([Fortran], [fc], [FC], [FC], [Fortran 77], -[ac_ext=${ac_fc_srcext-f} +[ac_ext=${ac_fc_srcext:-f} ac_compile='$FC -c $FCFLAGS $ac_fcflags_srcext conftest.$ac_ext >&AS_MESSAGE_LOG_FD' ac_link='$FC -o conftest$ac_exeext $FCFLAGS $LDFLAGS $ac_fcflags_srcext conftest.$ac_ext $LIBS >&AS_MESSAGE_LOG_FD' ac_compiler_gnu=$ac_cv_fc_compiler_gnu -- 2.17.0.591.ge996b92f55 On Sat, Dec 1, 2018 at 3:39 PM Bert Wesarg <bert.wes...@googlemail.com> wrote: > > ,Dear all, > > AC_LANG(Fortran) uses the above parameter expansion to set `ac_ext`, see here: > > > http://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/fortran.m4#n223 > > Though I consider it harmful, because if $ac_fc_srcext is set but null > the value of ac_ext is also null. > > That problem arises, if one wants to use the usual 'save=$var; : do > something; var=$save' idiom. Which is done in fortran.m4 in > AC_FC_PP_DEFINE here too: > > > http://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/fortran.m4#n1302 > > It does: > > AC_LANG_PUSH([Fortran])dnl > ac_fc_pp_define_srcext_save=$ac_fc_srcext > AC_FC_PP_SRCEXT([F]) > AC_CACHE_CHECK(…) > ac_fc_srcext=$ac_fc_pp_define_srcext_save > > If $ac_fc_srcext was unset before, its now set but null, thus the next > ac_ext=${ac_fc_srcext-f} is null too. > > On a side note, AC_FC_PP_SRCEXT may also set $ac_fcflags_srcext, but > that is not saved/restored by AC_FC_PP_DEFINE. > > Can someone please have a llok at my reasoning? > > Thanks. > > Best, > Bert