Previous: C++ libraries, Up: Other languages


6.2 Tags

Libtool supports multiple languages through the use of tags. Technically a tag corresponds to a set of configuration variables associated with a language. These variables tell libtool how it should create objects and libraries for each language.

Tags are defined at configure-time for each language activated in the package (see LT_LANG in LT_INIT). Here is the correspondence between language names and tags names.

Language name Tag name
C CC
C++ CXX
Java GCJ
Fortran 77 F77
Fortran FC
Go GO
Windows Resource RC

libtool tries to automatically infer which tag to use from the compiler command being used to compile or link. If it can't infer a tag, then it defaults to the configuration for the C language.

The tag can also be specified using libtool's --tag=tag option (see Invoking libtool). It is a good idea to do so in Makefile rules, because that will allow users to substitute the compiler without relying on libtool inference heuristics. When no tag is specified, libtool will default to CC; this tag always exists.

Finally, the set of tags available in a particular project can be retrieved by tracing for the LT_SUPPORTED_TAG macro (see Trace interface).