From cab0a7679552ee4a56e59ec5ccf8a245cc84b67e Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 18 Dec 2016 00:20:30 +0900 Subject: [PATCH] Use pkg-config to detect libxml2 --- configure.ac | 17 +++++++---------- src/Makefile.am | 4 ++-- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index dbfe62fc..04b6e5a1 100644 --- a/configure.ac +++ b/configure.ac @@ -396,15 +396,12 @@ else fi # libxml2 (for src/nghttp) -have_libxml2=no -if test "x${request_libxml2}" != "xno"; then - m4_ifdef([AM_PATH_XML2], - [AM_PATH_XML2(2.7.7, [have_libxml2=yes], [have_libxml2=no])], - [AC_MSG_WARN([configure was created without libxml2 detection macro; libxml2 detection is disabled])]) - - if test "x${have_libxml2}" = "xyes"; then - AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have `libxml2` library.]) - fi +PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.7.7], + [have_libxml2=yes], [have_libxml2=no]) +if test "x${have_libxml2}" = "xyes"; then + AC_DEFINE([HAVE_LIBXML2], [1], [Define to 1 if you have `libxml2` library.]) +else + AC_MSG_NOTICE($LIBXML2_PKG_ERRORS) fi if test "x${request_libxml2}" = "xyes" && @@ -909,7 +906,7 @@ AC_MSG_NOTICE([summary of build options: Failmalloc: ${enable_failmalloc} Libs: OpenSSL: ${have_openssl} (CFLAGS='${OPENSSL_CFLAGS}' LIBS='${OPENSSL_LIBS}') - Libxml2: ${have_libxml2} (CFLAGS='${XML_CPPFLAGS}' LIBS='${XML_LIBS}') + Libxml2: ${have_libxml2} (CFLAGS='${LIBXML2_CPPFLAGS}' LIBS='${LIBXML2_LIBS}') Libev: ${have_libev} (CFLAGS='${LIBEV_CFLAGS}' LIBS='${LIBEV_LIBS}') Libc-ares ${have_libcares} (CFLAGS='${LIBCARES_CFLAGS}' LIBS='${LIBCARES_LIBS}') Libevent(SSL): ${have_libevent_openssl} (CFLAGS='${LIBEVENT_OPENSSL_CFLAGS}' LIBS='${LIBEVENT_OPENSSL_LIBS}') diff --git a/src/Makefile.am b/src/Makefile.am index 6f60faed..a35df85f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -41,7 +41,7 @@ AM_CPPFLAGS = \ -I$(top_srcdir)/src/includes \ -I$(top_srcdir)/third-party \ @LIBSPDYLAY_CFLAGS@ \ - @XML_CPPFLAGS@ \ + @LIBXML2_CFLAGS@ \ @LIBEV_CFLAGS@ \ @OPENSSL_CFLAGS@ \ @LIBCARES_CFLAGS@ \ @@ -53,7 +53,7 @@ LDADD = $(top_builddir)/lib/libnghttp2.la \ $(top_builddir)/third-party/libhttp-parser.la \ @JEMALLOC_LIBS@ \ @LIBSPDYLAY_LIBS@ \ - @XML_LIBS@ \ + @LIBXML2_LIBS@ \ @LIBEV_LIBS@ \ @OPENSSL_LIBS@ \ @LIBCARES_LIBS@ \