* doc/automake.texi (Libtool Convenience Libraries): Explain how
authorAlexandre Duret-Lutz <adl@gnu.org>
Fri, 22 Oct 2004 20:00:05 +0000 (20:00 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Fri, 22 Oct 2004 20:00:05 +0000 (20:00 +0000)
to force the linker selection.

ChangeLog
doc/automake.texi
doc/stamp-vti
doc/version.texi

index 35a0bb0..edc63c4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2004-10-22  Alexandre Duret-Lutz  <adl@gnu.org>
 
+       * doc/automake.texi (Libtool Convenience Libraries): Explain how
+       to force the linker selection.
+
        * lib/install-sh: Fix the dirname emulation to ignore trailing
        slashes, i.e., the direname of `a/b/' is `a', not `a/b/'.  This
        caused `install-sh a/b/' to fail.
index c555a3c..43f920b 100644 (file)
@@ -3220,6 +3220,43 @@ libsub2_la_LIBADD = \
   @dots{}
 @end example
 
+When using such setup, beware that @command{automake} will assume
+@file{libtop.la} is to be linked with the C linker.  This is because
+@code{libtop_la_SOURCES} is empty, so @command{automake} picks C as
+default language.  If @code{libtop_la_SOURCES} was not empty,
+@command{automake} would select the linker as explained in @ref{How
+the Linker is Chosen}.
+
+If one of the sublibraries contains non-C source, it is important that
+the appropriate linker be chosen.  One way to achieve this is to
+pretend that there is such a non-C file among the sources of the
+library, thus forcing @command{automake} to select the appropriate
+linker.  Here is the top-level @file{Makefile} of our example updated
+to force C++ linking.
+
+@example
+SUBDIRS = sub1 sub2 @dots{}
+lib_LTLIBRARIES = libtop.la
+libtop_la_SOURCES =
+# Dummy C++ source to cause C++ linking.
+nodist_EXTRA_libtop_la_SOURCES = dummy.cxx
+libtop_la_LIBADD = \
+  sub1/libsub1.la \
+  sub2/libsub2.la \
+  @dots{}
+@end example
+
+@code{EXTRA_*_SOURCES} variables are used to keep track of source
+files that might be compiled (this is mostly useful when doing
+conditional compilation using @code{AC_SUBST}, see @ref{Conditional
+Libtool Sources}), and the @code{nodist_} prefix means the listed
+sources are not to be distributed (@pxref{Program and Library
+Variables}).  In effect the file @file{dummy.cxx} does not need to
+exist in the source tree.  Of course if you have some real source file
+to list in @code{libtop_la_SOURCES} there is no point in cheating with
+@code{nodist_EXTRA_libtop_la_SOURCES}.
+
+
 @node Libtool Modules
 @subsection Libtool Modules
 @cindex modules, libtool
index 32f8bea..54cd093 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 12 October 2004
+@set UPDATED 22 October 2004
 @set UPDATED-MONTH October 2004
 @set EDITION 1.9a
 @set VERSION 1.9a
index 32f8bea..54cd093 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 12 October 2004
+@set UPDATED 22 October 2004
 @set UPDATED-MONTH October 2004
 @set EDITION 1.9a
 @set VERSION 1.9a