Commit 0771dd3b authored by Ondřej Surý's avatar Ondřej Surý

Make the usage of libxml2 opaque to the caller

The libxml2 have previously leaked into the global namespace leading
to forced -I<include_path> for every compilation unit using isc/xml.h
header.  This MR fixes the usage making the caller object opaque.
parent 11db6399
......@@ -23,8 +23,8 @@ CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
BIND9LIBS = ../../lib/bind9/libbind9.@A@
NSLIBS = ../../lib/ns/libns.@A@
......
......@@ -27,8 +27,8 @@ CWARNINGS =
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCCCLIBS = ../../lib/isccc/libisccc.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
......
......@@ -24,8 +24,8 @@ CWARNINGS =
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
IRSLIBS = ../../lib/irs/libirs.@A@
ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@
......
......@@ -27,8 +27,8 @@ CWARNINGS =
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
IRSLIBS = ../../lib/irs/libirs.@A@
ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@
......
......@@ -21,8 +21,8 @@ CDEFINES = -DVERSION=\"${VERSION}\"
CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
DNSDEPLIBS = ../../lib/dns/libdns.@A@
ISCDEPLIBS = ../../lib/isc/libisc.@A@
......
......@@ -46,7 +46,8 @@ CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include -I. \
${NS_INCLUDES} ${DNS_INCLUDES} \
${BIND9_INCLUDES} ${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} \
${ISC_INCLUDES} ${DLZDRIVER_INCLUDES} \
${DBDRIVER_INCLUDES} @OPENSSL_INCLUDES@ @JSON_C_CFLAGS@
${DBDRIVER_INCLUDES} @OPENSSL_INCLUDES@ @JSON_C_CFLAGS@ \
${LIBXML2_CFLAGS}
CDEFINES = @CONTRIB_DLZ@
......@@ -55,8 +56,8 @@ CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCCCLIBS = ../../lib/isccc/libisccc.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
BIND9LIBS = ../../lib/bind9/libbind9.@A@
NSLIBS = ../../lib/ns/libns.@A@
......
......@@ -22,7 +22,6 @@
#include <isc/quota.h>
#include <isc/sockaddr.h>
#include <isc/types.h>
#include <isc/xml.h>
#include <dns/acl.h>
#include <dns/dnstap.h>
......
......@@ -79,6 +79,7 @@
#include <openssl/crypto.h>
#ifdef HAVE_LIBXML2
#include <libxml/xmlversion.h>
#include <libxml/parser.h>
#endif
#ifdef HAVE_ZLIB
#include <zlib.h>
......
......@@ -47,7 +47,6 @@
#include <isc/task.h>
#include <isc/timer.h>
#include <isc/util.h>
#include <isc/xml.h>
#include <isccfg/grammar.h>
#include <isccfg/namedconf.h>
......
......@@ -43,6 +43,11 @@
#include <named/server.h>
#include <named/statschannel.h>
#if HAVE_LIBXML2
#include <libxml/xmlwriter.h>
#define ISC_XMLCHAR (const xmlChar *)
#endif /* HAVE_LIBXML2 */
#include "bind9.xsl.h"
struct named_statschannel {
......@@ -1067,7 +1072,7 @@ dump_counters(isc_stats_t *stats, isc_statsformat_t type, void *arg,
stats_dumparg_t dumparg;
FILE *fp;
#ifdef HAVE_LIBXML2
xmlTextWriterPtr writer;
void *writer;
int xmlrc;
#endif
#ifdef HAVE_JSON_C
......@@ -1113,7 +1118,7 @@ dump_counters(isc_stats_t *stats, isc_statsformat_t type, void *arg,
break;
case isc_statsformat_xml:
#ifdef HAVE_LIBXML2
writer = (xmlTextWriterPtr) arg;
writer = arg;
if (category != NULL) {
/* <NameOfCategory> */
......@@ -1187,7 +1192,7 @@ rdtypestat_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
stats_dumparg_t *dumparg = arg;
FILE *fp;
#ifdef HAVE_LIBXML2
xmlTextWriterPtr writer;
void *writer;
int xmlrc;
#endif
#ifdef HAVE_JSON_C
......@@ -1253,7 +1258,7 @@ rdatasetstats_dump(dns_rdatastatstype_t type, uint64_t val, void *arg) {
bool nxrrset = false;
bool stale = false;
#ifdef HAVE_LIBXML2
xmlTextWriterPtr writer;
void *writer;
int xmlrc;
#endif
#ifdef HAVE_JSON_C
......@@ -1337,7 +1342,7 @@ opcodestat_dump(dns_opcode_t code, uint64_t val, void *arg) {
char codebuf[64];
stats_dumparg_t *dumparg = arg;
#ifdef HAVE_LIBXML2
xmlTextWriterPtr writer;
void *writer;
int xmlrc;
#endif
#ifdef HAVE_JSON_C
......@@ -1394,7 +1399,7 @@ rcodestat_dump(dns_rcode_t code, uint64_t val, void *arg) {
char codebuf[64];
stats_dumparg_t *dumparg = arg;
#ifdef HAVE_LIBXML2
xmlTextWriterPtr writer;
void *writer;
int xmlrc;
#endif
#ifdef HAVE_JSON_C
......
......@@ -28,8 +28,8 @@ CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
IRSLIBS = ../../lib/irs/libirs.@A@
......
......@@ -17,7 +17,7 @@ CINCLUDES = ${ISC_INCLUDES} @JSON_C_CFLAGS@
CDEFINES =
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
ISCDEPLIBS = ../../lib/isc/libisc.@A@
......
......@@ -19,7 +19,7 @@ CINCLUDES = -I${srcdir}/include -I${srcdir}/unix/include -I. \
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
NSLIBS = ../../lib/ns/libns.@A@
LIBS =
......
......@@ -23,8 +23,8 @@ CWARNINGS =
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
ISCCCLIBS = ../../lib/isccc/libisccc.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
......
......@@ -21,8 +21,8 @@ CWARNINGS =
BACKTRACECFLAGS = @BACKTRACECFLAGS@
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
DNSDEPLIBS = ../../lib/dns/libdns.@A@
......
......@@ -23,8 +23,8 @@ BACKTRACECFLAGS = @BACKTRACECFLAGS@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
DNSLIBS = ../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
ISCLIBS = ../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCNOSYMLIBS = ../../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
ISCCFGLIBS = ../../../lib/isccfg/libisccfg.@A@
DNSDEPLIBS = ../../../lib/dns/libdns.@A@
......
......@@ -16,7 +16,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${ISC_INCLUDES}
CDEFINES =
ISCLIBS = ../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
LIBS = ${ISCLIBS} @LIBS@
......
......@@ -16,7 +16,7 @@ top_srcdir = @top_srcdir@
CINCLUDES = ${ISC_INCLUDES}
CDEFINES =
ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
LIBS = ${ISCLIBS} @LIBS@
......
......@@ -23,7 +23,7 @@ CDEFINES = @USE_GSSAPI@ @CONTRIB_DLZ@
CWARNINGS =
DNSLIBS =
ISCLIBS = ../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
DNSDEPLIBS =
ISCDEPLIBS =
......
......@@ -111,7 +111,8 @@ PYTHON=@PYTHON@
#
# Determine if we support various optional features.
#
HAVEXMLSTATS=@XMLSTATS@
LIBXML2_LIBS="@LIBXML2_LIBS@"
HAVEXMLSTATS=${LIBXML2_LIBS:+1}
JSON_C_LIBS="@JSON_C_LIBS@"
HAVEJSONSTATS=${JSON_C_LIBS:+1}
ZLIB=@ZLIB@
......
......@@ -19,7 +19,7 @@ CDEFINES =
CWARNINGS =
DNSLIBS = ../../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
ISCLIBS = ../../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
DNSDEPLIBS = ../../../../../lib/dns/libdns.@A@
ISCDEPLIBS = ../../../../../lib/isc/libisc.@A@
......
......@@ -21,7 +21,7 @@ CDEFINES =
CWARNINGS =
DNSLIBS = ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
DNSDEPLIBS = ../../../../lib/dns/libdns.@A@
ISCDEPLIBS = ../../../../lib/isc/libisc.@A@
......
......@@ -20,7 +20,7 @@ CINCLUDES = ${ISC_INCLUDES}
CDEFINES =
CWARNINGS =
ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
DNSDEPLIBS =
ISCDEPLIBS = ../../../../lib/isc/libisc.@A@
......
......@@ -21,7 +21,7 @@ CDEFINES =
CWARNINGS =
DNSLIBS =
ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
DNSDEPLIBS =
ISCDEPLIBS = ../../../../lib/isc/libisc.@A@
......
......@@ -21,7 +21,7 @@ CDEFINES =
CWARNINGS =
DNSLIBS = ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
DNSDEPLIBS = ../../../../lib/dns/libdns.@A@
ISCDEPLIBS = ../../../../lib/isc/libisc.@A@
......
......@@ -21,7 +21,7 @@ CDEFINES =
CWARNINGS =
DNSLIBS = ../../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
DNSDEPLIBS = ../../../../lib/dns/libdns.@A@
ISCDEPLIBS = ../../../../lib/isc/libisc.@A@
......
......@@ -23,8 +23,8 @@ CWARNINGS =
DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
BIND9LIBS = ../../lib/bind9/libbind9.@A@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@
ISCLIBS = ../../lib/isc/libisc.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @OPENSSL_LIBS@ ${LIBXML2_LIBS}
ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@
DNSDEPLIBS = ../../lib/dns/libdns.@A@
......
......@@ -252,7 +252,7 @@
/* Define to 1 if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define if libxml2 was found */
/* Use libxml2 library */
#undef HAVE_LIBXML2
/* Define to 1 if you have the <linux/netlink.h> header file. */
......
......@@ -728,7 +728,8 @@ MKDEPCC
ZLIB
JSON_C_LIBS
JSON_C_CFLAGS
XMLSTATS
LIBXML2_LIBS
LIBXML2_CFLAGS
NZDTARGETS
NZDSRCS
NZD_TOOLS
......@@ -964,6 +965,8 @@ PKG_CONFIG_PATH
PKG_CONFIG_LIBDIR
OPENSSL_CFLAGS
OPENSSL_LIBS
LIBXML2_CFLAGS
LIBXML2_LIBS
JSON_C_CFLAGS
JSON_C_LIBS
LIBIDN2_CFLAGS
......@@ -1653,7 +1656,8 @@ Optional Packages:
Specify path for system-supplied GSSAPI
[default=auto]
--with-lmdb=PATH build with LMDB library [yes|no|path]
--with-libxml2=PATH build with libxml2 library [yes|no|path]
--with-libxml2 build with libxml2 library [yes|no|auto] (default is
auto)
--with-libjson deprecated, use --with-json-c
--with-json-c build with json-c library [yes|no|detect] (default
is detect)
......@@ -1710,6 +1714,10 @@ Some influential environment variables:
C compiler flags for OPENSSL, overriding pkg-config
OPENSSL_LIBS
linker flags for OPENSSL, overriding pkg-config
LIBXML2_CFLAGS
C compiler flags for LIBXML2, overriding pkg-config
LIBXML2_LIBS
linker flags for LIBXML2, overriding pkg-config
JSON_C_CFLAGS
C compiler flags for JSON_C, overriding pkg-config
JSON_C_LIBS linker flags for JSON_C, overriding pkg-config
......@@ -12653,8 +12661,6 @@ fi
#
# expanded_sysconfdir is needed for replacement in the python utilities
#
# TODO: use sed in the Makefile instead of autoconf to do the replacement
#
expanded_sysconfdir=`eval echo $sysconfdir`
......@@ -17029,82 +17035,189 @@ fi
#
# was --with-libxml2 specified?
#
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxml2 library" >&5
$as_echo_n "checking for libxml2 library... " >&6; }
# Check whether --with-libxml2 was given.
if test "${with_libxml2+set}" = set; then :
withval=$with_libxml2; use_libxml2="$withval"
withval=$with_libxml2;
else
use_libxml2="auto"
with_libxml2="auto"
fi
case "$use_libxml2" in
no)
DST_LIBXML2_INC=""
;;
auto|yes)
case X`(xml2-config --version) 2>/dev/null` in
X2.[6789].*)
libxml2_libs=`xml2-config --libs`
libxml2_cflags=`xml2-config --cflags`
;;
*)
if test "yes" = "$use_libxml2" ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
case $with_libxml2 in #(
no) :
;; #(
auto) :
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxml-2.0 >= 2.6.0" >&5
$as_echo_n "checking for libxml-2.0 >= 2.6.0... " >&6; }
if test -n "$LIBXML2_CFLAGS"; then
pkg_cv_LIBXML2_CFLAGS="$LIBXML2_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= 2.6.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libxml-2.0 >= 2.6.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBXML2_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0 >= 2.6.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$LIBXML2_LIBS"; then
pkg_cv_LIBXML2_LIBS="$LIBXML2_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= 2.6.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libxml-2.0 >= 2.6.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBXML2_LIBS=`$PKG_CONFIG --libs "libxml-2.0 >= 2.6.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
as_fn_error $? "required libxml2 version not available" "$LINENO" 5
else
libxml2_libs=
libxml2_cflags=
fi
;;
esac
;;
*)
if test -f "$use_libxml2/bin/xml2-config" ; then
libxml2_libs=`$use_libxml2/bin/xml2-config --libs`
libxml2_cflags=`$use_libxml2/bin/xml2-config --cflags`
fi
;;
esac
if test "X$libxml2_libs" != "X"
then
CFLAGS="$CFLAGS $libxml2_cflags"
LIBS="$LIBS $libxml2_libs"
#
# Sanity check xml2-config output.
#
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <libxml/xmlwriter.h>
int
main ()
{
return(xmlTextWriterStartElement(NULL, NULL));
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
as_fn_error $? "xml2-config returns badness" "$LINENO" 5
_pkg_short_errors_supported=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
if test $_pkg_short_errors_supported = yes; then
LIBXML2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxml-2.0 >= 2.6.0" 2>&1`
else
LIBXML2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxml-2.0 >= 2.6.0" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LIBXML2_PKG_ERRORS" >&5
:
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
:
else
LIBXML2_CFLAGS=$pkg_cv_LIBXML2_CFLAGS
LIBXML2_LIBS=$pkg_cv_LIBXML2_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define HAVE_LIBXML2 1" >>confdefs.h
XMLSTATS=1
fi ;; #(
yes) :
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for libxml-2.0 >= 2.6.0" >&5
$as_echo_n "checking for libxml-2.0 >= 2.6.0... " >&6; }
if test -n "$LIBXML2_CFLAGS"; then
pkg_cv_LIBXML2_CFLAGS="$LIBXML2_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= 2.6.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libxml-2.0 >= 2.6.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBXML2_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0 >= 2.6.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test -n "$LIBXML2_LIBS"; then
pkg_cv_LIBXML2_LIBS="$LIBXML2_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0 >= 2.6.0\""; } >&5
($PKG_CONFIG --exists --print-errors "libxml-2.0 >= 2.6.0") 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; then
pkg_cv_LIBXML2_LIBS=`$PKG_CONFIG --libs "libxml-2.0 >= 2.6.0" 2>/dev/null`
test "x$?" != "x0" && pkg_failed=yes
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
if test $pkg_failed = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
LIBXML2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxml-2.0 >= 2.6.0" 2>&1`
else
LIBXML2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxml-2.0 >= 2.6.0" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
echo "$LIBXML2_PKG_ERRORS" >&5
as_fn_error $? "Package requirements (libxml-2.0 >= 2.6.0) were not met:
$LIBXML2_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables LIBXML2_CFLAGS
and LIBXML2_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details." "$LINENO" 5
elif test $pkg_failed = untried; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables LIBXML2_CFLAGS
and LIBXML2_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See \`config.log' for more details" "$LINENO" 5; }
else
LIBXML2_CFLAGS=$pkg_cv_LIBXML2_CFLAGS
LIBXML2_LIBS=$pkg_cv_LIBXML2_LIBS
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
$as_echo "#define HAVE_LIBXML2 1" >>confdefs.h
fi ;; #(
*) :
as_fn_error $? "Specifying libxml2 installation path is not supported, adjust PKG_CONFIG_PATH instead" "$LINENO" 5 ;;
esac
#
# DEPRECATED
......
......@@ -1260,58 +1260,19 @@ AC_SUBST(NZDTARGETS)
#
# was --with-libxml2 specified?
#
AC_MSG_CHECKING(for libxml2 library)
AC_ARG_WITH(libxml2,
AS_HELP_STRING([--with-libxml2[=PATH]],
[build with libxml2 library [yes|no|path]]),
use_libxml2="$withval", use_libxml2="auto")
AC_ARG_WITH([libxml2],
[AS_HELP_STRING([--with-libxml2],
[build with libxml2 library [yes|no|auto] (default is auto)])],
[], [with_libxml2="auto"])
case "$use_libxml2" in
no)
DST_LIBXML2_INC=""
;;
auto|yes)
case X`(xml2-config --version) 2>/dev/null` in
X2.[[6789]].*)
libxml2_libs=`xml2-config --libs`
libxml2_cflags=`xml2-config --cflags`
;;
*)
if test "yes" = "$use_libxml2" ; then
AC_MSG_RESULT(no)
AC_MSG_ERROR(required libxml2 version not available)
else
libxml2_libs=
libxml2_cflags=
fi
;;
esac
;;
*)
if test -f "$use_libxml2/bin/xml2-config" ; then
libxml2_libs=`$use_libxml2/bin/xml2-config --libs`
libxml2_cflags=`$use_libxml2/bin/xml2-config --cflags`
fi
;;
esac
if test "X$libxml2_libs" != "X"
then
CFLAGS="$CFLAGS $libxml2_cflags"
LIBS="$LIBS $libxml2_libs"
#
# Sanity check xml2-config output.
#
AC_TRY_LINK([#include <libxml/xmlwriter.h>],
[return(xmlTextWriterStartElement(NULL, NULL));],
AC_MSG_RESULT(yes),
AC_MSG_ERROR(xml2-config returns badness))
AC_DEFINE(HAVE_LIBXML2, 1, [Define if libxml2 was found])
XMLSTATS=1
else
AC_MSG_RESULT(no)
fi
AC_SUBST(XMLSTATS)
AS_CASE([$with_libxml2],
[no],[],
[auto],[PKG_CHECK_MODULES([LIBXML2], [libxml-2.0 >= 2.6.0],
[AC_DEFINE([HAVE_LIBXML2], [1], [Use libxml2 library])],