Il 05/12/2010 22:19, Ralf Wildenhues ha scritto: > Hello Giulio, > > * Giulio Paci wrote on Wed, Dec 01, 2010 at 03:02:05PM CET: > >> Here is a patch to fix the issue in fortran.m4. >> I hope you'll find it useful. >> > Thanks for the patch. I have a nit, see the inline comment below. > > Can you run the Autoconf test suite with and without this patch applied? > Like this: > env F77=fort77 make check > > There should be a decrease in failed tests. > Output changes from:
Fortran low level compiling/preprocessing macros. 303: GNU Fortran 77 FAILED (fortran.at:31) 304: GNU Fortran ok 305: AC_OPENMP and Fortran 77 skipped (fortran.at:112) 306: AC_OPENMP and Fortran ok 307: AC_F77_DUMMY_MAIN usage FAILED (fortran.at:242) 308: AC_FC_DUMMY_MAIN usage ok 309: AC_F77_MAIN usage FAILED (fortran.at:402) 310: AC_FC_MAIN usage ok 311: AC_F77_FUNC usage FAILED (fortran.at:561) 312: AC_FC_FUNC usage ok 313: AC_FC_SRCEXT usage ok 314: AC_FC_FREEFORM ok 315: AC_FC_FREEFORM with AC_FC_SRCEXT ok 316: AC_FC_FIXEDFORM ok 317: AC_FC_FIXEDFORM with AC_FC_SRCEXT ok 318: AC_FC_LINE_LENGTH ok Testing autoconf/fortran macros. 319: AC_F77_MAIN FAILED (acfortran.at:13) 320: AC_F77_WRAPPERS FAILED (acfortran.at:14) 321: AC_FC_FIXEDFORM ok 322: AC_FC_FREEFORM ok 323: AC_FC_LINE_LENGTH ok 324: AC_FC_MAIN ok 325: AC_FC_WRAPPERS ok 326: AC_PROG_F77_C_O ok 327: AC_PROG_FC_C_O ok 328: AC_F77_NAME_MANGLING ok 329: AC_LANG_FORTRAN77 ok To: Fortran low level compiling/preprocessing macros. 303: GNU Fortran 77 FAILED (fortran.at:31) 304: GNU Fortran ok 305: AC_OPENMP and Fortran 77 skipped (fortran.at:112) 306: AC_OPENMP and Fortran ok 307: AC_F77_DUMMY_MAIN usage ok 308: AC_FC_DUMMY_MAIN usage ok 309: AC_F77_MAIN usage ok 310: AC_FC_MAIN usage ok 311: AC_F77_FUNC usage ok 312: AC_FC_FUNC usage ok 313: AC_FC_SRCEXT usage ok 314: AC_FC_FREEFORM ok 315: AC_FC_FREEFORM with AC_FC_SRCEXT ok 316: AC_FC_FIXEDFORM ok 317: AC_FC_FIXEDFORM with AC_FC_SRCEXT ok 318: AC_FC_LINE_LENGTH ok Testing autoconf/fortran macros. 319: AC_F77_MAIN ok 320: AC_F77_WRAPPERS ok 321: AC_FC_FIXEDFORM ok 322: AC_FC_FREEFORM ok 323: AC_FC_LINE_LENGTH ok 324: AC_FC_MAIN ok 325: AC_FC_WRAPPERS ok 326: AC_PROG_F77_C_O ok 327: AC_PROG_FC_C_O ok 328: AC_F77_NAME_MANGLING ok 329: AC_LANG_FORTRAN77 ok >> *** fortran.m4 2010-12-01 14:51:32.000000000 +0100 >> --- fortran.m4 2010-12-01 14:40:29.000000000 +0100 >> *************** case $ac_[]_AC_LANG_ABBREV[]_v_output in >> *** 541,546 **** >> --- 541,550 ---- >> s/-ignore *'[[^']]*'/ /g; s/-ignore *\"[[^\"]]*\"/ /g >> s/-def *'[[^']]*'/ /g; s/-def *\"[[^\"]]*\"/ /g"` ;; >> >> + # If we are using fort77 (the f2c wrapper) then filter output and delete >> quotes. >> + *fort77*gcc*) >> + ac_[]_AC_LANG_ABBREV[]_v_output=`echo >> "$ac_[]_AC_LANG_ABBREV[]_v_output" | grep '"gcc"' | sed '/"-c"/d; >> s/^.*"gcc"/"gcc"/; s/"//g' ;; >> > What if the user builds in a directory name containing "gcc" or TMPDIR > contains that? Can we tighten the regex a bit? Also, 'grep | sed' is > often superflous grep and can be replaced with > sed -n '/regex/{ > ... > }' > > but replacing semi-colons with newlines in the ... part. > I tried to take care about your comments in this new patch. I avoided grep and made the regex more robust against the TMPDIR. The building directory is not a problem. If the TMPDIR contains '"gcc"' or a space, fort77 fails, so it should not be a problem either. With the attached patch we should have no problem with the TMPDIR (I am removing all the lines ending by '.c' or '.c"', that is where TMPDIR appears) even if fort77 get fixed. However I am not able to test it. I also added a ChangeLog entry inside the patch. Bests, Giulio.
diff --git a/ChangeLog b/ChangeLog index 62358ea..408a910 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-12-07 Giulio Paci <giuliop...@interfree.it> + + * lib/autoconf/fortran.m4 (_AC_PROG_FC_V_OUTPUT): Properly detect + the fort77 (f2c wrapper) compiler verbose linking output flag. + Fixes also AC_F77_LIBRARY_LDFLAGS and AC_F77_DUMMY_MAIN + + 2010-11-20 Paul Eggert <egg...@cs.ucla.edu> autoconf: don't assume sys/stat.h and sys/types.h when testing C89 diff --git a/lib/autoconf/fortran.m4 b/lib/autoconf/fortran.m4 index 82a7a5d..d9979ea 100644 --- a/lib/autoconf/fortran.m4 +++ b/lib/autoconf/fortran.m4 @@ -541,6 +541,10 @@ case $ac_[]_AC_LANG_ABBREV[]_v_output in s/-ignore *'[[^']]*'/ /g; s/-ignore *\"[[^\"]]*\"/ /g s/-def *'[[^']]*'/ /g; s/-def *\"[[^\"]]*\"/ /g"` ;; + # If we are using fort77 (the f2c wrapper) then filter output and delete quotes. + *fort77*f2c*gcc*) + ac_[]_AC_LANG_ABBREV[]_v_output=`echo "$ac_[]_AC_LANG_ABBREV[]_v_output" | sed -n '/:[[[:space:]]]\+Running[[[:space:]]]\+"gcc"/{ /"-c"/d ; /[[.]]c"\?/d ; s/^.*"gcc"/"gcc"/ ; s/"//gp }'` ;; + # If we are using Cray Fortran then delete quotes. *cft90*) ac_[]_AC_LANG_ABBREV[]_v_output=`echo $ac_[]_AC_LANG_ABBREV[]_v_output | sed 's/"//g'` ;;