Up: Mixing Fortran 77 With C and C++   [Contents][Index]


8.13.3.1 How the Linker is Chosen

When a program or library mixes several languages, Automake choose the linker according to the following priorities. (The names in parentheses are the variables containing the link command.)

  1. Native Java (GCJLINK)
  2. C++ (CXXLINK)
  3. Fortran 77 (F77LINK)
  4. Fortran (FCLINK)
  5. Objective C (OBJCLINK)
  6. Unified Parallel C (UPCLINK)
  7. C (LINK)

For example, if Fortran 77, C and C++ source code is compiled into a program, then the C++ linker will be used. In this case, if the C or Fortran 77 linkers required any special libraries that weren’t included by the C++ linker, then they must be manually added to an _LDADD or _LIBADD variable by the user writing the Makefile.am.

Automake only looks at the file names listed in _SOURCES variables to choose the linker, and defaults to the C linker. Sometimes this is inconvenient because you are linking against a library written in another language and would like to set the linker more appropriately. See Libtool Convenience Libraries, for a trick with nodist_EXTRA_…_SOURCES.