In the autoconf generated configure from a GNU Autoconf 2.61, there is a
big long block starting:
# Compile and link our simple test program by passing a flag (argument
# 1 to this macro) to the Fortran compiler in order to get
# "verbose" output that we can then parse for the Fortran linker
# flags.
it then defines a:
ac_fc_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
and proceeds to filter it heavily. This code gets confused if you have
a --with-stage1-libs='...' option in your compiler config line; in
particular, if you have
--with-stage1-libs='/usr/lib/gcc/i686-redhat-linux/4.4.4/libstdc++.a -lm'
This code puts "-lm'" (with a single quote) into the list of libraries,
which it of course can never find.
I have been patching around this in generated configure scripts by adding:
================
*** configure.orig 2012-09-28 14:12:48.000000000 -0500
--- configure 2012-09-28 14:12:50.000000000 -0500
***************
*** 3307,3312 ****
--- 3307,3315 ----
echo "$ac_fc_v_output" >&5
FCFLAGS=$ac_save_FFLAGS
+ # men...@fnal.gov -- clean out --with-stage1-libs bits...
+ ac_fc_v_output=`echo "$ac_fc_v_output" | sed -e
"s/--with-stage1-libs='[^']*'//"`
+
rm -f conftest*
# On HP/UX there is a line like: "LPATH is: /foo:/bar:/baz" where
=============
but it would be nice to get this additional filter put into the actual
autoconf code base.
It appears this text comes from the macro: _AC_PROG_FC_V_OUTPUT in
fortran.m4
To reproduce:
1) build a gcc with gfortran configured with
--with-stage1-libs='-lm -lm'
(or other pair of libraries) (this is needed if you want to build
--static ,for example)
2) try to configure something with Fortran with that gcc/gfortran.
(for example http://lhapdf.hepforge.org/)
To fix:
Add the line filtering out /--with-stage1-libs='[^']*'/ from
ac_fc_v_output to fortran.m4 above the "rm -rf conftest *" line around
line 560.
Marc Mengel <men...@fnal.gov>