[libxml2] xml2-config: Add a --dynamic switch to print only shared libraries
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] xml2-config: Add a --dynamic switch to print only shared libraries
- Date: Tue, 30 Jul 2019 11:00:24 +0000 (UTC)
commit 1fc410d3d3cb7cf8ec4181f39dfdd66d39c240eb
Author: Hugh McMaster <hugh mcmaster outlook com>
Date: Mon Jul 1 22:22:14 2019 +1000
xml2-config: Add a --dynamic switch to print only shared libraries
`xml2-config --libs` prints static library linking information by default.
This is un-necessary for most programs, so introduce a new option, --dynamic,
which, when combined with --libs, only prints shared library linking information.
Makefile.am | 1 +
configure.ac | 4 +++-
xml2-config.1 | 1 +
xml2-config.in | 26 ++++++++++++++------------
xml2Conf.sh.in | 2 +-
5 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 174b9843..d43149fb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1231,6 +1231,7 @@ xml2Conf.sh: xml2Conf.sh.in Makefile
-e 's?\@XML_INCLUDEDIR\@?$(XML_INCLUDEDIR)?g' \
-e 's?\@VERSION\@?$(VERSION)?g' \
-e 's?\@XML_LIBS\@?$(XML_LIBS)?g' \
+ -e 's?\@XML_PRIVATE_LIBS\@?$(XML_PRIVATE_LIBS)?g' \
< $(srcdir)/xml2Conf.sh.in > xml2Conf.tmp \
&& mv xml2Conf.tmp xml2Conf.sh
diff --git a/configure.ac b/configure.ac
index 9ed3e635..7a76b459 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1533,7 +1533,8 @@ else
WITH_ICU=1
fi
fi
-XML_LIBS="-lxml2 $Z_LIBS $LZMA_LIBS $THREAD_LIBS $ICONV_LIBS $ICU_LIBS $M_LIBS $LIBS"
+XML_LIBS="-lxml2"
+XML_PRIVATE_LIBS="$Z_LIBS $LZMA_LIBS $THREAD_LIBS $ICONV_LIBS $ICU_LIBS $M_LIBS $LIBS"
XML_LIBTOOLLIBS="libxml2.la"
AC_SUBST(WITH_ICU)
@@ -1678,6 +1679,7 @@ AC_SUBST(XML_CFLAGS)
AC_SUBST(XML_LIBDIR)
AC_SUBST(XML_LIBS)
+AC_SUBST(XML_PRIVATE_LIBS)
AC_SUBST(XML_LIBTOOLLIBS)
AC_SUBST(ICONV_LIBS)
AC_SUBST(ICU_LIBS)
diff --git a/xml2-config.1 b/xml2-config.1
index 8cf9858b..4dec38f9 100644
--- a/xml2-config.1
+++ b/xml2-config.1
@@ -16,6 +16,7 @@ Print the currently installed version of \fIGNOME-XML\fP on the standard output.
.TP 8
.B \-\-libs
Print the linker flags that are necessary to link a \fIGNOME-XML\fP program.
+Add \-\-dynamic after --libs to print only shared library linking information.
.TP 8
.B \-\-cflags
Print the compiler flags that are necessary to compile a \fIGNOME-XML\fP program.
diff --git a/xml2-config.in b/xml2-config.in
index 19574864..6b87fc8c 100644
--- a/xml2-config.in
+++ b/xml2-config.in
@@ -15,6 +15,7 @@ Known values for OPTION are:
--prefix=DIR change libxml prefix [default $prefix]
--exec-prefix=DIR change libxml exec prefix [default $exec_prefix]
--libs print library linking information
+ add --dynamic to print only shared libraries
--cflags print pre-processor and compiler flags
--modules module support enabled
--help display this help and exit
@@ -82,18 +83,19 @@ while test $# -gt 0; do
;;
--libs)
- if [ "`uname`" = "Linux" ]
- then
- if [ "@XML_LIBDIR@" = "-L/usr/lib" -o "@XML_LIBDIR@" = "-L/usr/lib64" ]
- then
- echo @XML_LIBS@ @MODULE_PLATFORM_LIBS@
- else
- echo @XML_LIBDIR@ @XML_LIBS@ @MODULE_PLATFORM_LIBS@
- fi
- else
- echo @XML_LIBDIR@ @XML_LIBS@ @MODULE_PLATFORM_LIBS@ @WIN32_EXTRA_LIBADD@
- fi
- ;;
+ if [ "$2" = "--dynamic" ]; then
+ shift
+ LIBS="@XML_LIBS@"
+ else
+ LIBS="@XML_LIBS@ @XML_PRIVATE_LIBS@ @MODULE_PLATFORM_LIBS@"
+ fi
+
+ if [ "@XML_LIBDIR@" != "-L/usr/lib" -a "@XML_LIBDIR@" != "-L/usr/lib64" ]; then
+ LIBS="@XML_LIBDIR@ $LIBS"
+ fi
+
+ echo ${LIBS} @WIN32_EXTRA_LIBADD@
+ ;;
*)
usage
diff --git a/xml2Conf.sh.in b/xml2Conf.sh.in
index 08cb2334..31228c0b 100644
--- a/xml2Conf.sh.in
+++ b/xml2Conf.sh.in
@@ -2,7 +2,7 @@
# Configuration file for using the XML library in GNOME applications
#
XML2_LIBDIR="@XML_LIBDIR@"
-XML2_LIBS="@XML_LIBS@"
+XML2_LIBS="@XML_LIBS@ @XML_PRIVATE_LIBS@"
XML2_INCLUDEDIR="@XML_INCLUDEDIR@"
MODULE_VERSION="xml2-@VERSION@"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]