automake-patches
[Top][All Lists]
Advanced

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

FYI: document linker selection for libtool convenience libraries


From: Alexandre Duret-Lutz
Subject: FYI: document linker selection for libtool convenience libraries
Date: Fri, 22 Oct 2004 21:59:53 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

I'm installing this on HEAD and branch-1-9.

2004-10-22  Alexandre Duret-Lutz  <address@hidden>

        * doc/automake.texi (Libtool Convenience Libraries): Explain how
        to force the linker selection.

Index: doc/automake.texi
===================================================================
RCS file: /cvs/automake/automake/doc/automake.texi,v
retrieving revision 1.44.2.13
diff -u -r1.44.2.13 automake.texi
--- doc/automake.texi   12 Oct 2004 19:56:25 -0000      1.44.2.13
+++ doc/automake.texi   22 Oct 2004 19:56:25 -0000
@@ -3210,6 +3210,43 @@
   @dots{}
 @end example
 
+When using such setup, beware that @command{automake} will assume
address@hidden is to be linked with the C linker.  This is because
address@hidden is empty, so @command{automake} picks C as
+default language.  If @code{libtop_la_SOURCES} was not empty,
address@hidden 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.
+
address@hidden
+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{}
address@hidden example
+
address@hidden 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
address@hidden
+
+
 @node Libtool Modules
 @subsection Libtool Modules
 @cindex modules, libtool
-- 
Alexandre Duret-Lutz





reply via email to

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