[libxml2] Handle ICU_LIBS as LIBADD, not LDFLAGS to prevent linking errors



commit 1f01f49ba6abccc93a1779a05a33c3fb9c6efd4e
Author: Arfrever Frehtes Taifersar Arahesis <arfrever fta gmail com>
Date:   Tue Aug 28 22:16:50 2012 +0800

    Handle ICU_LIBS as LIBADD, not LDFLAGS to prevent linking errors
    
    For https://bugzilla.gnome.org/show_bug.cgi?id=677606
    For https://bugs.gentoo.org/show_bug.cgi?id=417539
    
    If libxml2-2.8.0 is built with --with-icu --with-python on a system that has an
    older version of libxml2 installed, then during "make install", libxml2mod.so
    gets relinked to the systemwide version of libxml2.so.2 instead of libxml2.so.2
    from the build tree, and fails at runtime if symbol versions from the older
    libxml2.so.2 are not available. This effectively makes it impossible to build a
    libxml2-2.8.0 binary package on a system that does not already have
    libxml2-2.8.0 installed.
    
    Investigation by RafaÅ MuÅyÅo and Arfrever Frehtes Taifersar Arahesis revealed
    the cause of the problem to be that libxml2's configure was adding ICU_LIBS to
    LDFLAGS instead of to LIBADD. This resulted in GNU libtool using the wrong
    argument order in its relinking command that gets run during "make install".

 Makefile.am                  |    2 +-
 configure.in                 |   15 ++++++++-------
 libxml-2.0-uninstalled.pc.in |    2 +-
 libxml-2.0.pc.in             |    2 +-
 4 files changed, 11 insertions(+), 10 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 1cca080..911600d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,7 +20,7 @@ bin_PROGRAMS = xmllint xmlcatalog
 bin_SCRIPTS=xml2-config
 
 lib_LTLIBRARIES = libxml2.la
-libxml2_la_LIBADD = $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD)
+libxml2_la_LIBADD = $(ICU_LIBS) $(THREAD_LIBS) $(Z_LIBS) $(LZMA_LIBS) $(ICONV_LIBS) $(M_LIBS) $(WIN32_EXTRA_LIBADD)
 
 if USE_VERSION_SCRIPT
 LIBXML2_VERSION_SCRIPT = $(VERSION_SCRIPT_FLAGS)$(srcdir)/libxml2.syms
diff --git a/configure.in b/configure.in
index 7256224..497fc35 100644
--- a/configure.in
+++ b/configure.in
@@ -98,7 +98,7 @@ dnl
 dnl zlib option might change flags, so we save them initially
 dnl
 _cppflags="${CPPFLAGS}"
-_ldflags="${LDFLAGS}"
+_libs="${LIBS}"
 
 AC_ARG_WITH(c14n,
 [  --with-c14n             add the Canonicalization support (on)])
@@ -155,7 +155,7 @@ AC_ARG_WITH(readline,
   if test "$withval" != "no" -a "$withval" != "yes"; then
     RDL_DIR=$withval
     CPPFLAGS="${CPPFLAGS} -I$withval/include"
-    LDFLAGS="${LDFLAGS} -L$withval/lib"
+    LIBS="${LIBS} -L$withval/lib"
   fi
 ])
 AC_ARG_WITH(regexps,
@@ -191,7 +191,7 @@ AC_ARG_WITH(zlib,
   if test "$withval" != "no" -a "$withval" != "yes"; then
     Z_DIR=$withval
     CPPFLAGS="${CPPFLAGS} -I$withval/include"
-    LDFLAGS="${LDFLAGS} -L$withval/lib"
+    LIBS="${LIBS} -L$withval/lib"
   fi
 ])
 AC_ARG_WITH(lzma,
@@ -199,7 +199,7 @@ AC_ARG_WITH(lzma,
   if test "$withval" != "no" -a "$withval" != "yes"; then
     LZMA_DIR=$withval
     CPPFLAGS="${CPPFLAGS} -I$withval/include"
-    LDFLAGS="${LDFLAGS} -L$withval/lib"
+    LIBS="${LIBS} -L$withval/lib"
   fi
 ])
 AC_ARG_WITH(coverage,
@@ -429,7 +429,7 @@ AC_SUBST(LZMA_LIBS)
 AC_SUBST(WITH_LZMA)
 
 CPPFLAGS=${_cppflags}
-LDFLAGS=${_ldflags}
+LIBS=${_libs}
 
 echo Checking headers
 
@@ -1378,14 +1378,14 @@ XML_LIBTOOLLIBS="libxml2.la"
 AC_SUBST(WITH_ICONV)
 
 WITH_ICU=0
+ICU_LIBS=""
 if test "$with_icu" != "yes" ; then
     echo Disabling ICU support
 else
     ICU_CONFIG=icu-config
     if ${ICU_CONFIG} --cflags >/dev/null 2>&1
     then
-        ICU_LIBS=`icu-config --ldflags`
-        LDFLAGS="$LDFLAGS $ICU_LIBS"
+        ICU_LIBS=`${ICU_CONFIG} --ldflags`
         WITH_ICU=1
         echo Enabling ICU support
     else
@@ -1393,6 +1393,7 @@ else
     fi
 fi
 AC_SUBST(WITH_ICU)
+AC_SUBST(ICU_LIBS)
 
 WITH_ISO8859X=1
 if test "$WITH_ICONV" != "1" ; then
diff --git a/libxml-2.0-uninstalled.pc.in b/libxml-2.0-uninstalled.pc.in
index 0a4c833..cab6834 100644
--- a/libxml-2.0-uninstalled.pc.in
+++ b/libxml-2.0-uninstalled.pc.in
@@ -8,5 +8,5 @@ Name: libXML
 Version: @VERSION@
 Description: libXML library version2.
 Requires:
-Libs: -L${libdir} -lxml2 @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @LIBS@
+Libs: -L${libdir} -lxml2 @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @LIBS@
 Cflags: -I${includedir} @XML_INCLUDEDIR@ @XML_CFLAGS@
diff --git a/libxml-2.0.pc.in b/libxml-2.0.pc.in
index 31a1b8c..f5f5f03 100644
--- a/libxml-2.0.pc.in
+++ b/libxml-2.0.pc.in
@@ -9,5 +9,5 @@ Version: @VERSION@
 Description: libXML library version2.
 Requires:
 Libs: -L${libdir} -lxml2
-Libs.private: @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @WIN32_EXTRA_LIBADD@ @LIBS@
+Libs.private: @ICU_LIBS@ @THREAD_LIBS@ @Z_LIBS@ @ICONV_LIBS@ @M_LIBS@ @WIN32_EXTRA_LIBADD@ @LIBS@
 Cflags: @XML_INCLUDEDIR@ @XML_CFLAGS@



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