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.
This commit is contained in:
Hugh McMaster 2019-07-01 22:22:14 +10:00
parent 87125732cc
commit 1fc410d3d3
5 changed files with 20 additions and 14 deletions

View File

@ -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

View File

@ -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)

View File

@ -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.

View File

@ -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

View File

@ -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@"