Copyright (C) 2000-2012 |
GNU Info (automake.info)Mixing Fortran 77 With C and C++Mixing Fortran 77 With C and C++ -------------------------------- 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 packages(1). 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 `FLIBS' by the `AC_F77_LIBRARY_LDFLAGS' Autoconf macro supplied with newer versions of Autoconf (Autoconf version 2.13 and later). *Note Fortran 77 Compiler Characteristics: (autoconf)Fortran 77 Compiler Characteristics. If Automake detects that a program or shared library (as mentioned in some `_PROGRAMS' or `_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.in', and that either `$(FLIBS)' or `@FLIBS@' appear in the appropriate `_LDADD' (for programs) or `_LIBADD' (for shared libraries) variables. It is the responsibility of the person writing the `Makefile.am' to make sure that `$(FLIBS)' or `@FLIBS@' appears in the appropriate `_LDADD' or `_LIBADD' variable. 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 `AC_F77_LIBRARY_LDFLAGS' is mentioned in `configure.in'. Also, if `@FLIBS@' hadn't been mentioned in `foo_LDADD' and `libfoo_la_LIBADD', then Automake would have issued a warning. ---------- Footnotes ---------- (1) For example, the cfortran package (http://www-zeus.desy.de/~burow/cfortran/) 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. automatically generated by info2www version 1.2.2.9 |