]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
configure.ac: Use pkg-config to find libxml2. Fixes cross compilation 583/head
authorKylie McClain <somasis@exherbo.org>
Sun, 26 Jul 2015 00:14:23 +0000 (20:14 -0400)
committerKylie McClain <somasis@exherbo.org>
Sun, 26 Jul 2015 00:16:13 +0000 (20:16 -0400)
This was originally submitted to Google Code, and was carried over
during GitHub migration; however, it was in patch form, so I've made
a pull request for it for quicker merging.

Original source: https://github.com/libarchive/libarchive/issues/407
Original author: ambrop7

configure.ac

index 2fd994b64ab26691d5054c8d4e3ce9b51d76f078..ea2c5d77a9a4dbd40663662110b551f6cf09c0f6 100644 (file)
@@ -390,14 +390,14 @@ AC_ARG_WITH([expat],
   AS_HELP_STRING([--without-expat], [Don't build support for xar through expat]))
 
 if test "x$with_xml2" != "xno"; then
-  AC_PATH_PROG([XML2_CONFIG], [xml2-config],, [${PATH}])
-  if test "x$XML2_CONFIG" != "x"; then
-    CPPFLAGS="${CPPFLAGS} `${XML2_CONFIG} --cflags`"
-    LIBS="${LIBS} `${XML2_CONFIG} --libs`"
+  PKG_PROG_PKG_CONFIG
+  PKG_CHECK_MODULES(LIBXML2_PC, [libxml-2.0], [
+    CPPFLAGS="${CPPFLAGS} ${LIBXML2_PC_CFLAGS}"
+    LIBS="${LIBS} ${LIBXML2_PC_LIBS}"
     AC_CHECK_LIB(xml2,xmlInitParser,[true],AC_MSG_FAILURE(Missing xml2 library))
-  else
+  ], [
     AC_CHECK_LIB(xml2,xmlInitParser)
-  fi
+  ])
   AC_CHECK_HEADERS([libxml/xmlreader.h libxml/xmlwriter.h])
 fi
 if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then