[libxslt] Look for libxml2 via pkg-config first



commit abf537ebb2296cd3ae89989a17b0e1b5c79db107
Author: Elliott Sales de Andrade <quantum analyst gmail com>
Date:   Thu May 18 18:20:17 2017 +0200

    Look for libxml2 via pkg-config first
    
    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

 configure.in |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/configure.in b/configure.in
index 019f022..1d14357 100644
--- a/configure.in
+++ b/configure.in
@@ -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
 
@@ -501,6 +502,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
 
@@ -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)
@@ -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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]