Automake currently provides limited support for creating programs and shared libraries that are a mixture of Fortran 77 and C and/or C++. However, there are many other issues related to mixing Fortran 77 with other languages that are not (currently) handled by Automake, but that are handled by other packages8.
Automake can help in two ways:
These extra Fortran 77 linker flags are supplied in the output variable
FLIBS by the
AC_F77_LIBRARY_LDFLAGS Autoconf macro.
See Fortran Compiler.
If Automake detects that a program or shared library (as mentioned in
_LTLIBRARIES primary) contains source
code that is a mixture of Fortran 77 and C and/or C++, then it requires
that the macro
AC_F77_LIBRARY_LDFLAGS be called in
configure.ac, and that either
appear in the appropriate
_LDADD (for programs) or
(for shared libraries) variables. It is the responsibility of the
person writing the Makefile.am to make sure that ‘$(FLIBS)’
appears in the appropriate
For example, consider the following Makefile.am:
bin_PROGRAMS = foo foo_SOURCES = main.cc foo.f foo_LDADD = libfoo.la $(FLIBS) pkglib_LTLIBRARIES = libfoo.la libfoo_la_SOURCES = bar.f baz.c zardoz.cc libfoo_la_LIBADD = $(FLIBS)
In this case, Automake will insist that
is mentioned in configure.ac. Also, if ‘$(FLIBS)’ hadn’t
been mentioned in
Automake would have issued a warning.
|• How the Linker is Chosen||Automatic linker selection|
the cfortran package
addresses all of these inter-language issues, and runs under nearly all
Fortran 77, C and C++ compilers on nearly all platforms. However,
cfortran is not yet Free Software, but it will be in the next