diff --git a/CMakeLists.txt b/CMakeLists.txt index fafb4259..8c5d82d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,7 @@ option(LIBXML2_WITH_TESTS "Build tests" ON) option(LIBXML2_WITH_THREADS "Add multithread support" ON) option(LIBXML2_WITH_TLS "Enable thread-local storage" OFF) option(LIBXML2_WITH_VALID "Add the DTD validation support" ON) +option(LIBXML2_WITH_XINCLUDE "Add the XInclude support" ON) option(LIBXML2_WITH_XPATH "Add the XPATH support" ON) option(LIBXML2_WITH_ZLIB "Use libz" OFF) @@ -71,9 +72,6 @@ cmake_dependent_option( cmake_dependent_option( LIBXML2_WITH_WRITER "Add the xmlWriter saving interface" ON "LIBXML2_WITH_OUTPUT;LIBXML2_WITH_PUSH" OFF) -cmake_dependent_option( - LIBXML2_WITH_XINCLUDE "Add the XInclude support" ON - "LIBXML2_WITH_XPATH" OFF) cmake_dependent_option( LIBXML2_WITH_XPTR "Add the XPointer support" ON "LIBXML2_WITH_XPATH" OFF) diff --git a/configure.ac b/configure.ac index 7c47778d..151ac635 100644 --- a/configure.ac +++ b/configure.ac @@ -194,12 +194,6 @@ if test "$with_writer" = "yes"; then fi with_push=yes fi -if test "$with_xinclude" = "yes"; then - if test "$with_xpath" = "no"; then - echo WARNING: --with-xinclude overrides --without-xpath - fi - with_xpath=yes -fi if test "$with_xptr" = "yes"; then if test "$with_xpath" = "no"; then echo WARNING: --with-xptr overrides --without-xpath @@ -271,7 +265,6 @@ else if test "$with_xpath" = "no"; then with_c14n=no with_schematron=no - with_xinclude=no with_xptr=no fi fi diff --git a/meson.build b/meson.build index fb0acec1..3c305fbf 100644 --- a/meson.build +++ b/meson.build @@ -121,6 +121,9 @@ want_threads = want_minimum ? feature.enabled() : feature.allowed() feature = get_option('valid') want_valid = want_minimum ? feature.enabled() : feature.allowed() +feature = get_option('xinclude') +want_xinclude = want_minimum ? feature.enabled() : feature.allowed() + # default depends on legacy option feature = get_option('http') @@ -165,7 +168,6 @@ feature = get_option('xpath') want_xpath = not want_minimum \ or get_option('c14n').enabled() \ or get_option('schematron').enabled() \ - or get_option('xinclude').enabled() \ or get_option('xptr').enabled() ? \ feature.allowed() : feature.enabled() @@ -197,10 +199,6 @@ feature = get_option('writer') \ .require(want_push, error_message: 'writer requires push') want_writer = want_minimum ? feature.enabled() : feature.allowed() -feature = get_option('xinclude') \ - .require(want_xpath, error_message: 'xinclude requires xpath') -want_xinclude = want_minimum ? feature.enabled() : feature.allowed() - feature = get_option('xptr') \ .require(want_xpath, error_message: 'xptr requires xpath') want_xptr = want_minimum ? feature.enabled() : feature.allowed() diff --git a/xinclude.c b/xinclude.c index 9ea71905..0e9edd4a 100644 --- a/xinclude.c +++ b/xinclude.c @@ -103,7 +103,9 @@ struct _xmlXIncludeCtxt { int depth; /* recursion depth */ int isStream; /* streaming mode */ +#ifdef LIBXML_XPTR_ENABLED xmlXPathContextPtr xpctxt; +#endif xmlStructuredErrorFunc errorHandler; void *errorCtxt; @@ -308,8 +310,10 @@ xmlXIncludeFreeContext(xmlXIncludeCtxtPtr ctxt) { } xmlFree(ctxt->txtTab); } +#ifdef LIBXML_XPTR_ENABLED if (ctxt->xpctxt != NULL) xmlXPathFreeContext(ctxt->xpctxt); +#endif xmlFree(ctxt); } @@ -1331,9 +1335,10 @@ loaded: ref->inc = xmlXIncludeCopyXPointer(ctxt, xptr, ref->base); xmlXPathFreeObject(xptr); } -#endif done: +#endif + ret = 0; error: