automake: Mixing Fortran 77 With C and C++

1 
1 8.14.3 Mixing Fortran 77 With C and C++
1 ---------------------------------------
1 
1 Automake currently provides _limited_ support for creating programs and
1 shared libraries that are a mixture of Fortran 77 and C and/or C++.
1 However, there are many other issues related to mixing Fortran 77 with
1 other languages that are _not_ (currently) handled by Automake, but that
1 are handled by other packages(1).
1 
1    Automake can help in two ways:
1 
1   1. Automatic selection of the linker depending on which combinations
1      of source code.
1 
1   2. Automatic selection of the appropriate linker flags (e.g., ‘-L’ and
1      ‘-l’) to pass to the automatically selected linker in order to link
1      in the appropriate Fortran 77 intrinsic and run-time libraries.
1 
1      These extra Fortran 77 linker flags are supplied in the output
1      variable ‘FLIBS’ by the ‘AC_F77_LIBRARY_LDFLAGS’ Autoconf macro.
1      ⇒Fortran Compiler Characteristics (autoconf)Fortran Compiler.
1 
1    If Automake detects that a program or shared library (as mentioned in
1 some ‘_PROGRAMS’ or ‘_LTLIBRARIES’ primary) contains source code that is
1 a mixture of Fortran 77 and C and/or C++, then it requires that the
1 macro ‘AC_F77_LIBRARY_LDFLAGS’ be called in ‘configure.ac’, and that
1 either ‘$(FLIBS)’ appear in the appropriate ‘_LDADD’ (for programs) or
1 ‘_LIBADD’ (for shared libraries) variables.  It is the responsibility of
1 the person writing the ‘Makefile.am’ to make sure that ‘$(FLIBS)’
1 appears in the appropriate ‘_LDADD’ or ‘_LIBADD’ variable.
1 
1    For example, consider the following ‘Makefile.am’:
1 
1      bin_PROGRAMS = foo
1      foo_SOURCES  = main.cc foo.f
1      foo_LDADD    = libfoo.la $(FLIBS)
1 
1      pkglib_LTLIBRARIES = libfoo.la
1      libfoo_la_SOURCES  = bar.f baz.c zardoz.cc
1      libfoo_la_LIBADD   = $(FLIBS)
1 
1    In this case, Automake will insist that ‘AC_F77_LIBRARY_LDFLAGS’ is
1 mentioned in ‘configure.ac’.  Also, if ‘$(FLIBS)’ hadn’t been mentioned
1 in ‘foo_LDADD’ and ‘libfoo_la_LIBADD’, then Automake would have issued a
1 warning.
1 

Menu