> I have a case where sometimes I want to compile fortran code with a C
> interface, and sometimes I do not. In this case, I ran into the linker
> problem, and I ended up substituting in the configure script as you
> mention. Here is a snippet of what I do in configure.ac. In this case
> I am using FCLINK because I am not using fortran 77.
>
> dnl
> dnl Without this, the linker line is incorrect on platforms without a
> fortran
> dnl compiler even if we are not using fortran sources
> dnl
> if test "x$enable_fortran" != "xyes" -a "x$enable_seke" != "xyes"; then
> FCLINK='$(LINK)'
> else
> FCLINK='$(LIBTOOL) --mode=link $(FCLD) $(AM_FCFLAGS) $(FCFLAGS)
> $(AM_LDFLAGS) $(LDFLAGS) -o $@'
> fi
> AC_SUBST(FCLINK)
I think I finally found a similar solution. I have this in my configure.ac and
it appears to work okay.
AS_IF([test "x$enable_f77" = xno],
[AC_SUBST([F77LINK], [[\$\(LINK\)]])])