From: Alexandre Duret-Lutz Date: Mon, 17 May 2004 17:42:44 +0000 (+0000) Subject: * doc/libtool.texi (Invoking libtool): Mention --tag=TAG. X-Git-Tag: release-1-9b~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=639afd859e316f499cee75e5cffd492c4fc3200f;p=thirdparty%2Flibtool.git * doc/libtool.texi (Invoking libtool): Mention --tag=TAG. (Tags, Trace interface): New nodes. * m4/libtool.m4 (LT_SUPPORTED_TAG): New macro. (_LT_LANG): Call it. * tests/tagtrace.test: New file. * tests/Makefile.am (TESTS): Add tagtrace.test. * tests/defs: Define AUTOCONF. --- diff --git a/ChangeLog b/ChangeLog index 1d5b56ded..d094ba271 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-05-16 Alexandre Duret-Lutz + + * doc/libtool.texi (Invoking libtool): Mention --tag=TAG. + (Tags, Trace interface): New nodes. + * m4/libtool.m4 (LT_SUPPORTED_TAG): New macro. + (_LT_LANG): Call it. + * tests/tagtrace.test: New file. + * tests/Makefile.am + (TESTS): Add tagtrace.test. + * tests/defs: Define AUTOCONF. + 2004-05-14 Mike Gorchak * ltmain.in: Add new qnx version type support. diff --git a/doc/libtool.texi b/doc/libtool.texi index 9634c6d00..a18f7c19b 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -92,6 +92,7 @@ version @value{VERSION}. * Inter-library dependencies:: Libraries that depend on other libraries. * Dlopened modules:: @code{dlopen}ing libtool-created libraries. * Using libltdl:: Libtool's portable @code{dlopen} wrapper library. +* Trace interface:: Libtool's trace interface. * Troubleshooting:: When libtool doesn't work as advertised. * Maintaining:: Information used by the libtool maintainer. * GNU Free Documentation License:: License for this manual. @@ -141,7 +142,12 @@ Configuring libtool Including libtool in your package * Invoking libtoolize:: @code{libtoolize} command line options. -* Autoconf and LTLIBOBJS:: Autoconf automates LTLIBOBJ generation. +* Autoconf and LTLIBOBJS:: Autoconf automates LTLIBOBJS generation. + +Using libtool with other languages + +* C++ libraries:: +* Tags:: Using Tags. Library interface versions @@ -165,15 +171,11 @@ Using libltdl * Libltdl interface:: How to use libltdl in your programs. * Modules for libltdl:: Creating modules that can be @code{dlopen}ed. -* Thread Saftey in libltdl:: Registering callbacks for multi-thread safety. +* Thread Safety in libltdl:: Registering callbacks for multi-thread safety. * User defined module data:: Associating data with loaded modules. * Module loaders for libltdl:: Creating user defined module loaders. * Distributing libltdl:: How to distribute libltdl with your package. -Using libtool with other languages - -* C++ libraries:: - Troubleshooting * Libtool test suite:: Libtool's self-tests. @@ -202,7 +204,7 @@ Platform quirks * References:: Finding more information. * Compilers:: Creating object files from source files. * Reloadable objects:: Binding object files together. -* Multiple dependencies:: Removing duplicate dependent libraries. +* Multiple dependencies:: Removing duplicate dependent libraries. * Archivers:: Programs that create static archives. @end detailmenu @@ -1148,6 +1150,9 @@ Delete installed libraries or executables. Delete uninstalled libraries or executables. @end table +@item --tag=@var{tag} +Use configuration variables from tag @var{tag} (@pxref{Tags}). + @item --preserve-dup-deps Do not remove duplicate dependencies in libraries. When building packages with static libraries, the libraries may depend circularly on each other @@ -2167,6 +2172,7 @@ and what special considerations you need to make if you do not use C. @menu * C++ libraries:: +* Tags:: @end menu @node C++ libraries @@ -2206,6 +2212,44 @@ some instances the @code{main()} function of a program must also be compiled with the C++ compiler for static C++ objects to be properly initialized. +@node Tags +@section Tags +@cindex tag names +@cindex language names +@cindex inferring 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 @command{libtool} how it should create +objects and libraries for each language. + +Tags are defined at @command{configure}-time for each language activated +in the package (see @code{LT_LANG} in @ref{LT_INIT}). Here is the +correspondence between language names and tags names. + +@multitable {Windows Resource} {Tag name} +@item Language name @tab Tag name +@item C @tab +@item C++ @tab CXX +@item Java @tab GCJ +@item Fortran 77 @tab F77 +@item Windows Resource @tab RC +@end multitable + +@command{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 @code{C} language. + +The tag can also be specified using @command{libtool}'s +@code{--tag=@var{tag}} option (@pxref{Invoking libtool}). It is a good +idea to do so in @file{Makefile} rules, because that will allow users to +substitute the compiler without relying on @command{libtool} inference +heuristics. Note that there is no tag for @code{C} because that is +the default configuration. + +Finally, the set of tags available in a particular project can be +retrieved by tracing for the @code{LT_SUPPORTED_TAG} macro (@pxref{Trace +interface}). @node Versioning @chapter Library interface versions @@ -2928,7 +2972,7 @@ distribution terms that you use for the rest of that program. @menu * Libltdl interface:: How to use libltdl in your programs. * Modules for libltdl:: Creating modules that can be @code{dlopen}ed. -* Thread Saftey in libltdl:: Registering callbacks for multi-thread safety. +* Thread Safety in libltdl:: Registering callbacks for multi-thread safety. * User defined module data:: Associating data with loaded modules. * Module loaders for libltdl:: Creating user defined module loaders. * Distributing libltdl:: How to distribute libltdl with your package. @@ -2960,7 +3004,7 @@ your application in order to use this version of libltdl. @noindent Note that libltdl is not well tested in a multithreaded environment, -though the intention is that it should work (@pxref{Thread Saftey +though the intention is that it should work (@pxref{Thread Safety in libltdl, , Using libtldl in a multi threaded environment}). It was reported that @sc{gnu}/Linux's glibc 2.0's @code{dlopen} with @samp{RTLD_LAZY} (which libltdl uses by default) is not thread-safe, @@ -3251,7 +3295,7 @@ foo1_la_LDFLAGS = -module @end example -@node Thread Saftey in libltdl +@node Thread Safety in libltdl @section Using libtldl in a multi threaded environment Libltdl provides a wrapper around whatever dynamic run-time object @@ -3785,6 +3829,31 @@ myprog_DEPENDENCIES = $(LIBLTDL) foo1.la @end example +@node Trace interface +@chapter Libtool's trace interface +@cindex trace interface +@cindex autoconf traces + +This section describes macros whose sole purpose is to be traced using +Autoconf's @code{--trace} option (@pxref{autoconf Invocation, , The +Autoconf Manual, autoconf, The Autoconf Manual}) to query the Libtool +configuration of a project. These macros are called by Libtool +internals and should never be called by user code; they should only be +traced. + +@defmac LT_SUPPORTED_TAG (@var{tag}) +This macro is called once for each language enabled in the package. Its +only argument, @var{tag}, is the tag-name corresponding to the language +(@pxref{Tags}). + +You can therefore retrieve the list of all tags enabled in a project +using the following command: +@example +autoconf --trace 'LT_SUPPORTED_TAG:$1' +@end example +@end defmac + + @node Troubleshooting @chapter Troubleshooting @cindex troubleshooting @@ -4270,7 +4339,7 @@ write your own. * References:: Finding more information. * Compilers:: Creating object files from source files. * Reloadable objects:: Binding object files together. -* Multiple dependencies:: Removing duplicate dependent libraries. +* Multiple dependencies:: Removing duplicate dependent libraries. * Archivers:: Programs that create static archives. @end menu diff --git a/m4/libtool.m4 b/m4/libtool.m4 index f165a61b8..d154ae3b9 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -554,6 +554,14 @@ _LT_EOF ])# _LT_CONFIG +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) @@ -577,7 +585,8 @@ AC_DEFUN([LT_LANG], # ------------------ m4_define([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], - [m4_append([_LT_TAGS], [$1 ])dnl + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG diff --git a/tests/Makefile.am b/tests/Makefile.am index 2e00c6360..5275cc157 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -12,7 +12,7 @@ F77_TESTS = \ COMMON_TESTS = \ assign.test link.test link-2.test nomode.test \ - quote.test sh.test suffix.test \ + quote.test sh.test suffix.test tagtrace.test \ cdemo-static.test cdemo-make.test cdemo-exec.test \ demo-static.test demo-make.test demo-exec.test \ demo-inst.test demo-unst.test \ diff --git a/tests/defs b/tests/defs index 8de9c3acc..d9d2523fe 100644 --- a/tests/defs +++ b/tests/defs @@ -19,6 +19,7 @@ prefix="./_inst" make="${MAKE-make}" SHELL="${CONFIG_SHELL-/bin/sh}" MKDIR="${MKDIR-mkdir}" +AUTOCONF="${AUTOCONF-autoconf}" if echo a | (grep -E '(a|b)') >/dev/null 2>&1; then EGREP='grep -E'