From f7b0a9f3f6dd0cdaa7a097623896b0a1f56ee249 Mon Sep 17 00:00:00 2001 From: Kylie McClain Date: Sat, 25 Jul 2015 20:14:23 -0400 Subject: [PATCH] configure.ac: Use pkg-config to find libxml2. Fixes cross compilation 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 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 2fd994b64..ea2c5d77a 100644 --- a/configure.ac +++ b/configure.ac @@ -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 -- 2.47.2