libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LT_SUPPORTED_TAG


From: Alexandre Duret-Lutz
Subject: LT_SUPPORTED_TAG
Date: Sun, 16 May 2004 13:46:52 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3 (gnu/linux)

This implements and documents the LT_SUPPORTED_TAG interface discussed
in http://mail.gnu.org/archive/html/libtool-patches/2004-04/msg00117.html.

Beware that the patch contains a new file that should be executable.

2004-05-16  Alexandre Duret-Lutz  <address@hidden>

        * 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.

Index: doc/libtool.texi
===================================================================
RCS file: /cvsroot/libtool/libtool/doc/libtool.texi,v
retrieving revision 1.160
diff -u -r1.160 libtool.texi
--- doc/libtool.texi    22 Apr 2004 22:08:18 -0000      1.160
+++ doc/libtool.texi    16 May 2004 11:44:34 -0000
@@ -92,6 +92,7 @@
 * 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 @@
 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 @@
 
 * 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 Saftey 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 @@
 * 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 uninstalled libraries or executables.
 @end table
 
address@hidden address@hidden
+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 @@
 
 @menu
 * C++ libraries::
+* Tags::                        Using Tags.
 @end menu
 
 @node C++ libraries
@@ -2206,6 +2212,43 @@
 compiled with the C++ compiler for static C++ objects to be properly
 initialized.
 
address@hidden Tags
address@hidden Tags
address@hidden tag names
address@hidden language names
address@hidden inferring tags
+
+Libtool supports multiple language through the use of tags.  Technically
+a tag correspond to a set of configuration variable associated to a
+language.  These variables tell how @command{libtool} 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.
+
address@hidden {Windows Resource} {Tag name}
address@hidden Language name    @tab Tag name
address@hidden C                @tab
address@hidden C++              @tab CXX
address@hidden Java             @tab GCJ
address@hidden Fortran 77       @tab F77
address@hidden Windows Resource @tab RC
address@hidden multitable
+
address@hidden tries to automatically infer from the compiler in use
+which tag it must use for compile or link.  It defaults to the
+configuration for the @code{C} language otherwise.
+
+The tag to use can also be specified using @command{libtool}'s
address@hidden@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 puzzling @command{libtool}.  Note that
+there is no tag for @code{C} because that is the default configuration.
+
+Finally, the set of tag 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 +2971,7 @@
 @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 Saftey 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.
@@ -3785,6 +3828,31 @@
 @end example
 
 
address@hidden Trace interface
address@hidden Libtool's trace interface
address@hidden trace interface
address@hidden autoconf traces
+
+This section describes macros whose sole purpose is the 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's
+internal and should not be called by user code, they should only be
+traced.
+
address@hidden 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:
address@hidden
+autoconf --trace 'LT_SUPPORTED_TAG:$1'
address@hidden example
address@hidden defmac
+
+
 @node Troubleshooting
 @chapter Troubleshooting
 @cindex troubleshooting
@@ -4270,7 +4338,7 @@
 * 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
 
Index: m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/libtool.m4,v
retrieving revision 1.70
diff -u -r1.70 libtool.m4
--- m4/libtool.m4       5 May 2004 13:16:52 -0000       1.70
+++ m4/libtool.m4       16 May 2004 11:44:34 -0000
@@ -554,6 +554,11 @@
 ])# _LT_CONFIG
 
 
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace me to discover what tags are supported by the --tag option
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
 # C support is built-in for now
 m4_define([_LT_LANG_C_enabled], [])
 m4_define([_LT_TAGS], [])
@@ -577,7 +582,8 @@
 # ------------------
 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
Index: tests/Makefile.am
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/Makefile.am,v
retrieving revision 1.37
diff -u -r1.37 Makefile.am
--- tests/Makefile.am   25 Nov 2003 15:48:23 -0000      1.37
+++ tests/Makefile.am   16 May 2004 11:44:34 -0000
@@ -12,7 +12,7 @@
 
 COMMON_TESTS = \
        assign.test link.test link-2.test nomode.test \
-       quote.test sh.test suffix.test \
+       quote.test tagtrace.test sh.test suffix.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 \
Index: tests/defs
===================================================================
RCS file: /cvsroot/libtool/libtool/tests/defs,v
retrieving revision 1.8
diff -u -r1.8 defs
--- tests/defs  24 Nov 2003 15:26:56 -0000      1.8
+++ tests/defs  16 May 2004 11:44:34 -0000
@@ -19,6 +19,7 @@
 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'
Index: tests/tagtrace.test
===================================================================
RCS file: tests/tagtrace.test
diff -N tests/tagtrace.test
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ tests/tagtrace.test 16 May 2004 11:44:34 -0000
@@ -0,0 +1,56 @@
+#! /bin/sh
+# tagtrace.test - check the LT_SUPPORTED_TAGS interface
+
+# Copyright (C) 2004 Free Software Foundation, Inc.
+# This is free software; see the source for copying conditions.  There is NO
+# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, a copy can be downloaded from
+# http://www.gnu.org/copyleft/gpl.html, or by writing to the Free
+# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+# MA 02111-1307, USA.
+
+if test -z "$srcdir"; then
+  srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
+  test "$srcdir" = "$0" && srcdir=.
+fi
+. $srcdir/defs || exit 1
+
+# Abort as soon as something fails.
+set -e
+
+# Retrieve the list of tags supported by our main libtool script.
+traced_tags=`cd "$srcdir/.." && "$AUTOCONF" --trace 'LT_SUPPORTED_TAG:$1'`
+
+test -n "$traced_tags"
+
+# Ensure each of them is accepted by --tag.
+# (We do some useless operation like erasing an empty file, because
+# we are just interested in whether --tag accepts the tag or not.)
+for tag in $traced_tags; do
+  $libtool -n --mode=link --tag=$tag compiler -o liba.la foo.lo >output 2>&1
+  cat output
+  if grep 'ignoring unknown tag' output; then
+    exit $EXIT_FAILURE
+  else
+    :
+  fi
+done
+
+# Ensure the above command would have failed for unknown tags
+$libtool -n --mode=link --tag=UnKnOwN compiler -o liba.la foo.lo >output 2>&1
+cat output
+grep 'ignoring unknown tag' output
+
+rm -f output

-- 
Alexandre Duret-Lutz





reply via email to

[Prev in Thread] Current Thread [Next in Thread]