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 The LT_INIT macro). Here is the correspondence between language names and tags names.

Language nameTag name
CCC
C++CXX
JavaGCJ
Fortran 77F77
FortranFC
GoGO
Windows ResourceRC

libtool tries to automatically infer what 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 Libtool’s trace interface).