[Devel] [PATCH 2/8] libvzctl: untangle linking with libxml2

Kir Kolyshkin kir at openvz.org
Tue Jun 2 15:50:20 PDT 2015


This commit:

 * removes xml2-config calls as they are redundant
   (XXX_CFLAGS and XXX_LIBS are already set by PKG_CHECK_MODULES)

 * errors out from configure if libxml2-devel is not installed

 * avoids adding XML_LIBS and XML_CFLAGS to global LIBS and CFLAGS,
   as we don't need to compile everything with those, just libvzctl
   and it is already set so in lib/Makefile.am

 * changes XML_CPPFLAGS to XML_CFLAGS as this is what PKG_CHECK_MODULES
   provides us with.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 configure.ac    | 8 ++------
 lib/Makefile.am | 2 +-
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index c10d3ab..2681fb5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,10 +75,8 @@ AC_SUBST(UTIL_LIBS)
 AC_C_CONST
 AC_C_INLINE
 
-# Checks for library functions.
-PKG_CHECK_MODULES([XML2], [libxml-2.0])
-XML_CPPFLAGS=`xml2-config --cflags`
-XML_LIBS=`xml2-config --libs`
+PKG_CHECK_MODULES([XML], [libxml-2.0 > 2.6.16], ,
+	AC_MSG_ERROR([Please install libxml2 devel package]))
 
 # Compiler settings
 #CFLAGS="${CFLAGS} -Wall -Wpointer-arith -Wcast-qual -Winline -Wextra"
@@ -86,8 +84,6 @@ CFLAGS="${CFLAGS} -Wall -Werror -Wpointer-arith -Winline"
 CFLAGS="${CFLAGS} -Wcast-align -Wno-unused-parameter"
 CFLAGS="${CFLAGS} -Wno-missing-field-initializers"
 CFLAGS="${CFLAGS} -D_FILE_OFFSET_BITS=64"
-CFLAGS="$CFLAGS $XML_CPPFLAGS"
-LIBS="$XML_LIBS $LIBS"
 
 if test x$build_cpu = xppc64 -o x$build_cpu = xpowerpc64; then
 	CFLAGS="${CFLAGS} -m64"
diff --git a/lib/Makefile.am b/lib/Makefile.am
index ea094cb..def1d5a 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -9,7 +9,7 @@ AM_CPPFLAGS = -I. -I./include -I../include \
 	      -DPKGLIBDIR=\"$(pkglibdir)\" \
 	      -DSCRIPTDIR=\"$(scriptdir)\" \
 	      -DDISTCONFDIR=\"$(distconfdir)\" \
-	      $(XML_CPPFLAGS)
+	      $(XML_CFLAGS)
 
 lib_LTLIBRARIES = libvzctl2.la
 
-- 
1.9.3




More information about the Devel mailing list