Previous: Preprocessing Fortran, Up: Fortran Support



7.11.4 Mixing Fortran With C and C++

Automake currently provides limited support for creating programs and shared libraries that are a mixture of Fortran and C and/or C++. However, there are many other issues related to mixing Fortran with other languages that are not (currently) handled by Automake, but that are handled by other packages1.

Automake can help in two ways:

  1. Automatic selection of the linker depending on which combinations of source code.
  2. Automatic selection of the appropriate linker flags (e.g., -L and -l) to pass to the automatically selected linker in order to link in the appropriate Fortran 77 intrinsic and run-time libraries.

    These extra Fortran 77 linker flags are supplied in the output variable FCLIBS by the AC_FC_LIBRARY_LDFLAGS Autoconf macro supplied with newer versions of Autoconf (Autoconf version 2.13 and later; substitute FLIBS and AC_F77_LIBRARY_LDFLAGS for the F77 interface). See Fortran Compiler Characteristics (The Autoconf Manual).


Footnotes

[1] For example, 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 major release.