Il 26/11/2010 23:17, Giulio Paci ha scritto: > recently I packaged (using autoconf 2.67 on a Debian squeeze system) > a program that mixes Fortran and C++ code. > The problem is also present using the git version. > The configure.ac includes the following macros: > AC_PROG_F77 > AC_F77_LIBRARY_LDFLAGS > AC_F77_DUMMY_MAIN > > Everything is working fine with gfortran, but the configure script fails > to detect proper settings for fort77 (the f2c wrapper). > > The macro fails to parse the following output (and then fails to detect > both the -lf2c -lm flags and the MAIN__ function): > > $ f77 -v test.f > /usr/bin/f77: fort77 Version 1.15 > /usr/bin/f77: Running "/usr/bin/f2c -Nn802 -I. < test.f > > /tmp/fort77-30492-1.c" > MAIN main: > /usr/bin/f77: Running "gcc" "-c" "-o" "test.o" "/tmp/fort77-30492-1.c" > /usr/bin/f77: unlinking /tmp/fort77-30492-1.c > /usr/bin/f77: Running "gcc" "test.o" "-lf2c" "-lm" > /usr/bin/f77: unlinking test.o > > $ fort77 -v test.f > /usr/bin/fort77: fort77 Version 1.15 > /usr/bin/fort77: Running "/usr/bin/f2c -Nn802 -I. < test.f > > /tmp/fort77-30454-1.c" > MAIN main: > /usr/bin/fort77: Running "gcc" "-c" "-o" "test.o" "/tmp/fort77-30454-1.c" > /usr/bin/fort77: unlinking /tmp/fort77-30454-1.c > /usr/bin/fort77: Running "gcc" "test.o" "-lf2c" "-lm" > /usr/bin/fort77: unlinking test.o > > Adding manually the following two lines in the configure script: > > *"Running \"gcc\""*) > ac_f77_v_output=`echo "$ac_f77_v_output" | grep "Running \"gcc\"" | > grep -v '"-c"' | sed 's/^.*Running //' | sed 's/"//g' ` ;; > > solves the problem. > Is it possible to include support for fort77 in the autoconf macros? Is > there a temporary workaround that I can use in the meantime? Here is a patch to fix the issue in fortran.m4. I hope you'll find it useful.
Bests, Giulio.
*** 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' ;; + # 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'` ;;