On 10 December 2017 at 12:33, Bruno Haible <[email protected]> wrote:

> Reuben Thomas wrote:
> > For case 1, am I correct in thinking
> > there is no variable that contains this directory, i.e. "the directory
> > where shared libraries are installed"?  As far as I can tell, this
> > directory is computed by libtool, and I can't see a better way than
> > effectively recomputing it, that is, use bindir when the platform is
> > cygwin, mingw or cegcc, and libdir otherwise.
>
> Correct. You need to define it by yourself. An Automake conditional
> based on "$host_os" will do the trick.
>
> AM_CONDITIONAL([SHLIBS_IN_BINDIR], [case "$host_os" in mingw* | cygwin*)
> true;; *) false;; esac])
>
> if SHLIBS_IN_BINDIR
> AM_CPPFLAGS += -DINSTALLDIR=\"$(bindir)\"
> else
> AM_CPPFLAGS += -DINSTALLDIR=\"$(libdir)\"
> endif
>

​Thanks for this, which I have incorporated into a patch for the
relocatable documentation, attached, along with a minor patch to use better
tags in a couple of cases in gnulib.texi.

-- 
https://rrt.sc3d.org
From 60d755a21e86b7700acb64058d556354a7da845d Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email protected]>
Date: Sun, 10 Dec 2017 09:10:13 +0000
Subject: [PATCH 1/2] Use better texinfo tags in a few cases.

* doc/gnulib.texi (Extending Gnulib): Use @option or @command instead of
@samp in a few places.
---
 ChangeLog       | 6 ++++++
 doc/gnulib.texi | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ccb526b..fa5e1d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-12-10  Reuben Thomas  <[email protected]>
+
+	Use better texinfo tags in a few cases.
+	* doc/gnulib.texi (Extending Gnulib): Use @option or @command
+	instead of @samp in a few places.
+
 2017-12-10  Pádraig Brady  <[email protected]>
 
 	test-faccessat.c: unlink temp file to avoid subsequent test failure
diff --git a/doc/gnulib.texi b/doc/gnulib.texi
index 1468c14..76d5720 100644
--- a/doc/gnulib.texi
+++ b/doc/gnulib.texi
@@ -686,21 +686,21 @@ You can add modules of your own, that are not (yet) in Gnulib.
 You can also add unstructured amounts of code to the library, by
 grouping the non-Gnulib files of the library in a single kitchen-sink
 ``module.''  (This kind of kitchen-sink module is not needed when you
-use the @command{gnulib-tool} option @samp{--makefile-name}.)
+use the @command{gnulib-tool} option @option{--makefile-name}.)
 @end itemize
 
 In a release tarball, you can distribute the contents of this
 @option{--local-dir} directory that will be combinable with newer
 versions of Gnulib, barring incompatible changes to Gnulib.
 
-If the @samp{--local-dir=@var{directory}} option is specified, then
+If the @option{--local-dir=@var{directory}} option is specified, then
 @command{gnulib-tool} looks in @file{@var{directory}} whenever it
 reads a file from the Gnulib directory.  Suppose @command{gnulib-tool}
 is looking for @var{file}.  Then:
 
 @itemize @bullet
 @item
-If @file{@var{directory}/@var{file}} exists, then @samp{gnulib-tool} uses
+If @file{@var{directory}/@var{file}} exists, then @command{gnulib-tool} uses
 it instead of the file included in Gnulib.
 
 @item
-- 
2.7.4

From 02dec023bf86dcd5bc4edeb05a5bdc3327efd574 Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email protected]>
Date: Mon, 11 Dec 2017 10:27:52 +0000
Subject: [PATCH 2/2] doc: Improve explanation of supporting relocatable
 libraries.

* doc/relocatable-maint.texi (Supporting Relocation): Explain
properly how to build the relocatable module for
libraries. (Method and example code from Bruno Haible.)
---
 ChangeLog                  |  7 +++++++
 doc/relocatable-maint.texi | 21 +++++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fa5e1d8..6242501 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-12-11  Reuben Thomas  <[email protected]>
+
+	doc: Improve explanation of supporting relocatable libraries.
+	* doc/relocatable-maint.texi (Supporting Relocation): Explain
+	properly how to build the relocatable module for
+	libraries. (Method and example code from Bruno Haible.)
+
 2017-12-10  Reuben Thomas  <[email protected]>
 
 	Use better texinfo tags in a few cases.
diff --git a/doc/relocatable-maint.texi b/doc/relocatable-maint.texi
index edb4d26..c287fca 100644
--- a/doc/relocatable-maint.texi
+++ b/doc/relocatable-maint.texi
@@ -56,6 +56,8 @@ You can make your program relocatable by following these steps:
 @item
 Import the @code{relocatable-prog} module.  For libraries, use the
 @code{relocatable-lib} or @code{relocatable-lib-lgpl} module.
+If you need more than one module, or you need to use them with different
+settings, you will need multiple copies of gnulib (@pxref{Multiple instances}).
 
 @item
 In every program, add to @code{main} as the first statement (even
@@ -190,13 +192,24 @@ foo_LDFLAGS = `$(RELOCATABLE_LDFLAGS) $(bindir)`
 endif
 @end example
 
-Also in @file{Makefile.am}, for each library @code{libfoo}, you add:
+When building gnulib to use with a relocatable library, you need to
+define the preprocessor symbol @code{IN_LIBRARY}.
+You may also want to build with @code{COSTLY_RELOCATABLE}, in which case
+you will also need to define @code{INSTALLDIR}.
+The following fragment can be added to an override @code{Makefile.am} used
+to build gnulib (@pxref{Modified build rules}).
 
 @example
-libfoo_la_CPPFLAGS = -DIN_LIBRARY
-@end example
+AM_CPPFLAGS += -DIN_LIBRARY -DENABLE_COSTLY_RELOCATABLE
+
+AM_CONDITIONAL([SHLIBS_IN_BINDIR], [case "$host_os" in mingw* | cygwin*) true;; *) false;; esac])
 
-(Adjust the suffix @code{la} as necessary if you are not using libtool.)
+if SHLIBS_IN_BINDIR
+AM_CPPFLAGS += -DINSTALLDIR=\"$(bindir)\"
+else
+AM_CPPFLAGS += -DINSTALLDIR=\"$(libdir)\"
+endif
+@end example
 
 @item
 You may also need to add a couple of variable assignments to your
-- 
2.7.4

Reply via email to