Skip to content

Commit

Permalink
Look for libxml2 via pkg-config first
Browse files Browse the repository at this point in the history
If no explicit path is specified, try pkg-config first, before
xml2-config. The reason is that pkg-config knows the difference between
static and shared dependencies and thus doesn't cause libxslt to be
linked against a bunch of extra stuff.

Say for example that libxml2 is compiled --with-icu, then it will be
linked against various libicu shared libraries. xml2-config will _also_
specify those libraries (because it doesn't know whether you are doing
static or shared linking) and thus libxslt is also linked against libicu
even though it does not use it.

On the other hand, pkg-config has Libs/Libs.private which separates
shared&static dependencies and so you can get libxslt to link to _only_
libxml2 without any other things.

Fixes bug #778549:

    https://bugzilla.gnome.org/show_bug.cgi?id=778549
  • Loading branch information
QuLogic authored and nwellnhof committed May 18, 2017
1 parent 896caef commit abf537e
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ AC_PATH_PROG(MV, mv, /bin/mv)
AC_PATH_PROG(TAR, tar, /bin/tar)
AC_PATH_PROG(XMLLINT, xmllint, /usr/bin/xmllint)
AC_PATH_PROG(XSLTPROC, xsltproc, /usr/bin/xsltproc)
PKG_PROG_PKG_CONFIG

AC_HEADER_STDC

Expand Down Expand Up @@ -500,6 +501,26 @@ AC_ARG_WITH(libxml-src,
)
AC_SUBST(LIBXML_SRC)

dnl
dnl Try pkg-config first if nothing is set
dnl

if test "x$LIBXML_CONFIG_PREFIX" == "x" -a "x$LIBXML_SRC" == "x"
then
PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= $LIBXML_REQUIRED_VERSION], [
LIBXML_MANUAL_SEARCH=no
WITH_MODULES="`$PKG_CONFIG --variable=modules libxml-2.0`"
],
[
LIBXML_MANUAL_SEARCH=yes
])
else
LIBXML_MANUAL_SEARCH=yes
fi

if test "x$LIBXML_MANUAL_SEARCH" != "xno"
then

dnl
dnl where is xml2-config
dnl
Expand Down Expand Up @@ -578,6 +599,10 @@ else
AC_MSG_ERROR([Could not find libxml2 anywhere, check ftp://xmlsoft.org/.])
fi

WITH_MODULES="`$XML_CONFIG --modules`"

fi # LIBXML_MANUAL_SEARCH


AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
Expand All @@ -602,7 +627,6 @@ fi

if test "$with_plugins" = "yes" ; then
AC_MSG_CHECKING([libxml2 module support])
WITH_MODULES="`$XML_CONFIG --modules`"
if test "${WITH_MODULES}" = "1"; then
AC_MSG_RESULT(yes)
else
Expand Down

0 comments on commit abf537e

Please sign in to comment.