XXX no: there's an better mechanism, as yet undocumented. Watch this space, but don't use this technique.
When building a library or application, automake needs to make a decision about which language to use to do the final link. For example, it must use the Fortran linker to make a library which consists of or includes Fortran modules, and the C linker if it consists of pure C. This matters more on some platforms than others -- the OSX linker has some very fixed ideas on this point (it heartily disapproves of common blocks, and so needs special Fortran juju to make a library from Fortran which uses them).
Automake makes this decision based on the source code which
is listed in the library's _SOURCES
variable.
When you are assembling a library purely from convenience
libraries, however (see section `Linking static libraries'
in the Libtool manual),
the _SOURCES
variable is empty, and automake
ends up using the C linker, for want of any other
information.
You can avoid this problem, and indicate to automake which
langauge it should use, by giving a dummy value for the
_SOURCES
variable as follows:
where thelibsubpar_adam_la_SOURCES = dummy_routine.f libsubpar_adam_la_LIBADD = \ subpar/libsubpar_convenience.la \ parsecon/libparsecon_convenience.la
dummy_fortran.f
module is a trivial
Fortran routine:
As the comment indicates, it is wise to include an explanation of this ... let's not call it a hack ... in theC A dummy Fortran routine. See comments in Makefile.am SUBROUTINE DUMMY END
Makefile.am
.This is currently used in the `pcs', `gks', `astrom' and `pgplot' components.