Bruno Haible <br...@clisp.org> writes: > Vivien Kraus wrote: >> I don’t know how to do it at the moment; the >> configure script automatically gets a --enable-shared=… flag but I >> can’t find a trace of it in config.log, and I don’t know how to use it. >> Could you elaborate on how to get a value for BUILDING_SHARED with >> autoconf? > > A couple of lines in configure.ac should do it: > > if test "$enable_shared" = yes; then > shared=1 > else > shared=0 > fi > AC_DEFINE_UNQUOTED([BUILDING_SHARED], [$shared], [Define when > --enable-shared is used.])
I installed the following to make this easier to use for readers of the manual. I'll update my usage of that code too, it is used in several projects already... /Simon
From ad1f365d71ac8a80b8c83f41d35d35a1ef57378c Mon Sep 17 00:00:00 2001 From: Simon Josefsson <si...@josefsson.org> Date: Fri, 8 Jul 2022 21:39:45 +0200 Subject: [PATCH] lib-symbol-visibility: Improve documentation. * doc/lib-symbol-visibility.texi: Include BUILDING_SHARED snippet suggested by Bruno Haible. --- ChangeLog | 6 ++++++ doc/lib-symbol-visibility.texi | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index 75d24781c2..a82e76ed00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2022-07-08 Simon Josefsson <si...@josefsson.org> + + lib-symbol-visibility: Improve documentation. + * doc/lib-symbol-visibility.texi: Include BUILDING_SHARED snippet + suggested by Bruno Haible. + 2022-07-04 Bruno Haible <br...@clisp.org> havelib: Fix 'configure --help' output. diff --git a/doc/lib-symbol-visibility.texi b/doc/lib-symbol-visibility.texi index 9574e439dd..d8e63895d3 100644 --- a/doc/lib-symbol-visibility.texi +++ b/doc/lib-symbol-visibility.texi @@ -181,3 +181,13 @@ the definition of the macro mentioned above, to something like this: Here @code{BUILDING_SHARED} is a C macro that you have to define. It ought to evaluate to 1 in a build configured with @samp{--enable-shared}, or to 0 in a build configured with @samp{--disable-shared}. +You may use the following @samp{configure.ac} snippet: + +@smallexample + if test "$enable_shared" = yes; then + shared=1 + else + shared=0 + fi + AC_DEFINE_UNQUOTED([BUILDING_SHARED], [$shared], [Define when --enable-shared is used.]) +@end smallexample -- 2.30.2
signature.asc
Description: PGP signature