Commits

Nick Wellnhofer committed 984f26f

Support libxml2 builds with disabled xmlReader

This should also help when building with really ancient versions of
libxml2. For example:

http://www.cpantesters.org/cpan/report/7d23954e-b932-11e3-9f71-2bc305d1d4ab

(Looks like RHEL4 with libxml2 2.6.16)

Comments (0)

Files changed (4)

 Revision history for Perl extension XML::LibXML
 
+2.0116
+    - Support libxml2 builds with disabled xmlReader
+
 2.0115  2014-04-03
     - Fix double free when calling $node->addSibling with text nodes.
           - https://rt.cpan.org/Ticket/Display.html?id=94149
 
 #if LIBXML_VERSION >= 20621
 #define WITH_SERRORS
+#ifdef LIBXML_READER_ENABLED
 #define HAVE_READER_SUPPORT
 #include <libxml/xmlreader.h>
 #endif
+#endif
 
 #ifdef LIBXML_CATALOG_ENABLED
 #include <libxml/catalog.h>
 #endif
 
+#ifdef HAVE_READER_SUPPORT
+
 typedef enum {
     XML_TEXTREADER_NONE = -1,
     XML_TEXTREADER_START= 0,
     XML_TEXTREADER_VALIDATE_XSD = 4
 } xmlTextReaderValidate;
 
+#endif /* HAVE_READER_SUPPORT */
 
 /* GDOME support
  * libgdome installs only the core functions to the system.
     LibXML_configure_namespaces(ctxt);
 }
 
+#ifdef HAVE_READER_SUPPORT
+
 static void
 LibXML_set_reader_preserve_flag( xmlTextReaderPtr reader ) {
     HV *hash;
     return 0;
 }
 
+#endif /* HAVE_READER_SUPPORT */
+
 extern void boot_XML__LibXML__Devel(pTHX_ CV*);
 
 MODULE = XML::LibXML         PACKAGE = XML::LibXML
   if (1000*$] < 5008) {
      plan skip_all => "Reader interface only supported in Perl >= 5.8";
      exit;
-  } elsif (XML::LibXML::LIBXML_VERSION() <= 20620) {
-     plan skip_all => "Reader not supported for libxml2 <= 2.6.20";
+  } elsif (!XML::LibXML::HAVE_READER()) {
+     plan skip_all => "Reader not supported in this libxml2 build";
      exit;
   } else {
      plan tests => 100;

t/40reader_mem_error.t

 use strict;
 use warnings;
 
-use Test::More tests => 2;
+use Test::More;
 
 use utf8;
 
+use XML::LibXML;
+
+BEGIN {
+    if (!XML::LibXML::HAVE_READER()) {
+        plan skip_all => 'Reader not supported in this libxml2 build';
+        exit;
+    }
+    else {
+        plan tests => 2;
+    }
+}
+
 package Test::XML::Ordered;
 
 use XML::LibXML::Reader;