From 00b9d62a83e85fbedbbf124f4496f754a974889c Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Fri, 22 Oct 2004 20:00:05 +0000 Subject: [PATCH] * doc/automake.texi (Libtool Convenience Libraries): Explain how to force the linker selection. --- ChangeLog | 3 +++ doc/automake.texi | 37 +++++++++++++++++++++++++++++++++++++ doc/stamp-vti | 2 +- doc/version.texi | 2 +- 4 files changed, 42 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 35a0bb0a7..edc63c4f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2004-10-22 Alexandre Duret-Lutz + * 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. diff --git a/doc/automake.texi b/doc/automake.texi index c555a3c89..43f920b1f 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -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 diff --git a/doc/stamp-vti b/doc/stamp-vti index 32f8bea41..54cd093c3 100644 --- a/doc/stamp-vti +++ b/doc/stamp-vti @@ -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 diff --git a/doc/version.texi b/doc/version.texi index 32f8bea41..54cd093c3 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -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 -- 2.47.2