[libxml2] Fix libz and liblzma detection
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Fix libz and liblzma detection
- Date: Mon, 27 Nov 2017 13:50:40 +0000 (UTC)
commit cb5541c9f34fc29b0d7b8d89a3122c3fa46a6068
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Mon Nov 13 17:08:38 2017 +0100
Fix libz and liblzma detection
If libz or liblzma are detected with pkg-config, AC_CHECK_HEADERS must
not be run because the correct CPPFLAGS aren't set. It is actually not
required have separate checks for LIBXML_ZLIB_ENABLED and HAVE_ZLIB_H.
Only check for LIBXML_ZLIB_ENABLED and remove HAVE_ZLIB_H macro.
Fixes bug 764657, bug 787041.
HTMLparser.c | 2 +-
bakefile/libxml2.bkl | 1 -
c14n.c | 2 +-
configure.ac | 72 ++++++++++++++++++-----------------------------
macos/src/config-mac.h | 3 --
nanohttp.c | 16 +++++-----
os400/os400config.h.in | 14 ---------
os400/wrappers.c | 2 +-
os400/wrappers.h | 2 +-
parser.c | 6 ----
parserInternals.c | 2 +-
tree.c | 2 +-
vms/config.vms | 3 --
win32/Makefile.bcb | 6 ----
win32/Makefile.mingw | 6 ----
win32/Makefile.msvc | 6 ----
xlink.c | 2 +-
xmlIO.c | 42 ++++++++++++++--------------
xmllint.c | 4 +-
xmlsave.c | 2 +-
xzlib.c | 24 ++++++++--------
21 files changed, 79 insertions(+), 140 deletions(-)
---
diff --git a/HTMLparser.c b/HTMLparser.c
index d6971b5..7e243e6 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -26,7 +26,7 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
#include <zlib.h>
#endif
diff --git a/bakefile/libxml2.bkl b/bakefile/libxml2.bkl
index f314465..dd6ce2c 100644
--- a/bakefile/libxml2.bkl
+++ b/bakefile/libxml2.bkl
@@ -406,7 +406,6 @@
<!-- some other conditional defines -->
- <set var="ZLIB_DEF"><if cond="WITH_ZLIB=='1'">HAVE_ZLIB_H</if></set>
<set var="DEBUG_DEF"><if cond="BUILD=='debug'">_DEBUG</if></set>
<set var="DEBUG_DEF"><if cond="BUILD=='release'">NDEBUG</if></set>
diff --git a/c14n.c b/c14n.c
index a0f2c19..c04ce66 100644
--- a/c14n.c
+++ b/c14n.c
@@ -2089,7 +2089,7 @@ xmlC14NDocSave(xmlDocPtr doc, xmlNodeSetPtr nodes,
xmlC14NErrParam("saving doc");
return (-1);
}
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if (compression < 0)
compression = xmlGetCompressMode();
#endif
diff --git a/configure.ac b/configure.ac
index 964dd93..7bae7ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -389,18 +389,20 @@ dnl Checks for zlib library.
WITH_ZLIB=0
if test "$with_zlib" = "no"; then
- echo "Disabling compression support"
+ echo "Disabling zlib compression support"
else
- # Try pkg-config first so that static linking works.
- # If this succeeeds, we ignore the WITH_ZLIB directory.
- PKG_CHECK_MODULES([Z],[zlib],
- [have_libz=yes],
- [have_libz=no])
+ # Don't run pkg-config if with_zlib contains a path.
+ if test "x$Z_DIR" = "x"; then
+ # Try pkg-config first so that static linking works.
+ PKG_CHECK_MODULES([Z],[zlib],
+ [WITH_ZLIB=1],
+ [ ])
+ fi
- if test "x$have_libz" = "xno"; then
+ if test "$WITH_ZLIB" = "0"; then
AC_CHECK_HEADERS(zlib.h,
AC_CHECK_LIB(z, gzread,[
- have_libz=yes
+ WITH_ZLIB=1
if test "x${Z_DIR}" != "x"; then
Z_CFLAGS="-I${Z_DIR}/include"
Z_LIBS="-L${Z_DIR}/lib -lz"
@@ -411,18 +413,8 @@ else
esac]
else
Z_LIBS="-lz"
- fi],
- [have_libz=no])
- )
- else
- # we still need to check for zlib.h header
- AC_CHECK_HEADERS([zlib.h])
- fi
-
- # Found the library via either method?
- if test "x$have_libz" = "xyes"; then
- AC_DEFINE([HAVE_LIBZ], [1], [Have compression library])
- WITH_ZLIB=1
+ fi])
+ )
fi
fi
@@ -436,38 +428,30 @@ dnl Checks for lzma library.
WITH_LZMA=0
if test "$with_lzma" = "no"; then
- echo "Disabling compression support"
+ echo "Disabling lzma compression support"
else
- # Try pkg-config first so that static linking works.
- # If this succeeeds, we ignore the WITH_LZMA directory.
- PKG_CHECK_MODULES([LZMA],[liblzma],
- [have_liblzma=yes],
- [have_liblzma=no])
-
- # If pkg-config failed, fall back to AC_CHECK_LIB. This
- # will not pick up the necessary LIBS flags for liblzma's
- # private dependencies, though, so static linking may fail.
- if test "x$have_liblzma" = "xno"; then
- AC_CHECK_HEADERS(lzma.h,
+ # Don't run pkg-config if with_lzma contains a path.
+ if test "x$LZMA_DIR" = "x"; then
+ # Try pkg-config first so that static linking works.
+ PKG_CHECK_MODULES([LZMA],[liblzma],
+ [WITH_LZMA=1],
+ [ ])
+ fi
+
+ # If pkg-config failed, fall back to AC_CHECK_LIB. This
+ # will not pick up the necessary LIBS flags for liblzma's
+ # private dependencies, though, so static linking may fail.
+ if test "$WITH_LZMA" = "0"; then
+ AC_CHECK_HEADERS(lzma.h,
AC_CHECK_LIB(lzma, lzma_code,[
- have_liblzma=yes
+ WITH_LZMA=1
if test "x${LZMA_DIR}" != "x"; then
LZMA_CFLAGS="-I${LZMA_DIR}/include"
LZMA_LIBS="-L${LZMA_DIR}/lib -llzma"
else
LZMA_LIBS="-llzma"
- fi],
- [have_liblzma=no])
- )
- else
- # we still need to check for lzma,h header
- AC_CHECK_HEADERS([lzma.h])
- fi
-
- # Found the library via either method?
- if test "x$have_liblzma" = "xyes"; then
- AC_DEFINE([HAVE_LIBLZMA], [1], [Have compression library])
- WITH_LZMA=1
+ fi])
+ )
fi
fi
diff --git a/macos/src/config-mac.h b/macos/src/config-mac.h
index e9a8f9d..4949bdd 100644
--- a/macos/src/config-mac.h
+++ b/macos/src/config-mac.h
@@ -174,9 +174,6 @@
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H
-/* Define if you have the <zlib.h> header file. */
-#undef HAVE_ZLIB_H
-
/* Name of package */
#define PACKAGE
diff --git a/nanohttp.c b/nanohttp.c
index 9cd2292..2143718 100644
--- a/nanohttp.c
+++ b/nanohttp.c
@@ -63,7 +63,7 @@
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
#include <zlib.h>
#endif
@@ -145,7 +145,7 @@ typedef struct xmlNanoHTTPCtxt {
char *authHeader; /* contents of {WWW,Proxy}-Authenticate header */
char *encoding; /* encoding extracted from the contentType */
char *mimeType; /* Mime-Type extracted from the contentType */
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
z_stream *strm; /* Zlib stream object */
int usesGzip; /* "Content-Encoding: gzip" was detected */
#endif
@@ -434,7 +434,7 @@ xmlNanoHTTPFreeCtxt(xmlNanoHTTPCtxtPtr ctxt) {
if (ctxt->mimeType != NULL) xmlFree(ctxt->mimeType);
if (ctxt->location != NULL) xmlFree(ctxt->location);
if (ctxt->authHeader != NULL) xmlFree(ctxt->authHeader);
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if (ctxt->strm != NULL) {
inflateEnd(ctxt->strm);
xmlFree(ctxt->strm);
@@ -817,7 +817,7 @@ xmlNanoHTTPScanAnswer(xmlNanoHTTPCtxtPtr ctxt, const char *line) {
if (ctxt->authHeader != NULL)
xmlFree(ctxt->authHeader);
ctxt->authHeader = xmlMemStrdup(cur);
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
} else if ( !xmlStrncasecmp( BAD_CAST line, BAD_CAST"Content-Encoding:", 17) ) {
cur += 17;
while ((*cur == ' ') || (*cur == '\t')) cur++;
@@ -1273,7 +1273,7 @@ xmlNanoHTTPOpenRedir(const char *URL, char **contentType, char **redir) {
int
xmlNanoHTTPRead(void *ctx, void *dest, int len) {
xmlNanoHTTPCtxtPtr ctxt = (xmlNanoHTTPCtxtPtr) ctx;
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
int bytes_read = 0;
int orig_avail_in;
int z_ret;
@@ -1283,7 +1283,7 @@ xmlNanoHTTPRead(void *ctx, void *dest, int len) {
if (dest == NULL) return(-1);
if (len <= 0) return(0);
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if (ctxt->usesGzip == 1) {
if (ctxt->strm == NULL) return(0);
@@ -1424,7 +1424,7 @@ retry:
/* 1 for '?' */
blen += strlen(ctxt->query) + 1;
blen += strlen(method) + strlen(ctxt->path) + 24;
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
/* reserve for possible 'Accept-Encoding: gzip' string */
blen += 23;
#endif
@@ -1468,7 +1468,7 @@ retry:
ctxt->hostname, ctxt->port);
}
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
p += snprintf(p, blen - (p - bp), "Accept-Encoding: gzip\r\n");
#endif
diff --git a/os400/os400config.h.in b/os400/os400config.h.in
index ad5abb7..8ef477b 100644
--- a/os400/os400config.h.in
+++ b/os400/os400config.h.in
@@ -90,9 +90,6 @@
/* Define if history library is there (-lhistory) */
#undef HAVE_LIBHISTORY
-/* Have compression library */
-#undef HAVE_LIBLZMA
-
/* Define if pthread library is there (-lpthread) */
#undef HAVE_LIBPTHREAD
@@ -108,9 +105,6 @@
/* Define to 1 if you have the `localtime' function. */
#define HAVE_LOCALTIME 1
-/* Define to 1 if you have the <lzma.h> header file. */
-#undef HAVE_LZMA_H
-
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
@@ -274,14 +268,6 @@
/* Define to 1 if you have the `vsprintf' function. */
#undef HAVE_VSPRINTF /* Use trio. */
-/* Define to 1 if you have the <zlib.h> header file. */
-/* Actually dependent on the compilation script. */
-#if @WITH_ZLIB@
-#define HAVE_ZLIB_H 1
-#else
-#undef HAVE_ZLIB_H
-#endif
-
/* Define to 1 if you have the `_stat' function. */
#undef HAVE__STAT
diff --git a/os400/wrappers.c b/os400/wrappers.c
index 9f592b7..06f6c26 100644
--- a/os400/wrappers.c
+++ b/os400/wrappers.c
@@ -110,7 +110,7 @@ _lx_dlerror(void)
}
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
#include <zlib.h>
gzFile
diff --git a/os400/wrappers.h b/os400/wrappers.h
index 388ec8c..6f3e6c9 100644
--- a/os400/wrappers.h
+++ b/os400/wrappers.h
@@ -43,7 +43,7 @@ extern void * _lx_dlsym(void * handle, const char * symbol);
extern char * _lx_dlerror(void);
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
#include <zlib.h>
diff --git a/parser.c b/parser.c
index 04aa717..51264e6 100644
--- a/parser.c
+++ b/parser.c
@@ -83,12 +83,6 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef HAVE_ZLIB_H
-#include <zlib.h>
-#endif
-#ifdef HAVE_LZMA_H
-#include <lzma.h>
-#endif
#include "buf.h"
#include "enc.h"
diff --git a/parserInternals.c b/parserInternals.c
index e75e547..09876ab 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -32,7 +32,7 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
#include <zlib.h>
#endif
diff --git a/tree.c b/tree.c
index 86a8da7..959421b 100644
--- a/tree.c
+++ b/tree.c
@@ -27,7 +27,7 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
#include <zlib.h>
#endif
diff --git a/vms/config.vms b/vms/config.vms
index d1cd7f3..7f0f61c 100755
--- a/vms/config.vms
+++ b/vms/config.vms
@@ -150,9 +150,6 @@
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
-/* Define if you have the <zlib.h> header file. */
-#undef HAVE_ZLIB_H
-
/* Name of package */
#undef PACKAGE
diff --git a/win32/Makefile.bcb b/win32/Makefile.bcb
index 7129c61..41002da 100644
--- a/win32/Makefile.bcb
+++ b/win32/Makefile.bcb
@@ -65,12 +65,6 @@ CFLAGS = $(CFLAGS) -DHAVE_WIN32_THREADS
!else if "$(WITH_THREADS)" == "posix"
CFLAGS = $(CFLAGS) -DHAVE_PTHREAD_H
!endif
-!if "$(WITH_ZLIB)" == "1"
-CFLAGS = $(CFLAGS) -DHAVE_ZLIB_H
-!endif
-!if "$(WITH_LZMA)" == "1"
-CFLAGS = $(CFLAGS) -DHAVE_LZMA_H
-!endif
# The linker and its options.
LD = ilink32.exe
diff --git a/win32/Makefile.mingw b/win32/Makefile.mingw
index f579923..3d4cb88 100644
--- a/win32/Makefile.mingw
+++ b/win32/Makefile.mingw
@@ -57,12 +57,6 @@ endif
ifeq ($(WITH_THREADS),posix)
CFLAGS += -DHAVE_PTHREAD_H
endif
-ifeq ($(WITH_ZLIB),1)
-CFLAGS += -DHAVE_ZLIB_H
-endif
-ifeq ($(WITH_LZMA),1)
-CFLAGS += -DHAVE_LZMA_H
-endif
# The linker and its options.
LD = gcc.exe
diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc
index 115a451..ff8378e 100644
--- a/win32/Makefile.msvc
+++ b/win32/Makefile.msvc
@@ -55,12 +55,6 @@ CFLAGS = $(CFLAGS) /D "HAVE_WIN32_THREADS"
!else if "$(WITH_THREADS)" == "posix"
CFLAGS = $(CFLAGS) /D "HAVE_PTHREAD_H"
!endif
-!if "$(WITH_ZLIB)" == "1"
-CFLAGS = $(CFLAGS) /D "HAVE_ZLIB_H"
-!endif
-!if "$(WITH_LZMA)" == "1"
-CFLAGS = $(CFLAGS) /D "HAVE_LZMA_H"
-!endif
CFLAGS = $(CFLAGS) /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE
# The linker and its options.
diff --git a/xlink.c b/xlink.c
index c0e4ff3..ecf9f96 100644
--- a/xlink.c
+++ b/xlink.c
@@ -28,7 +28,7 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
#include <zlib.h>
#endif
diff --git a/xmlIO.c b/xmlIO.c
index e61e780..f61dd05 100644
--- a/xmlIO.c
+++ b/xmlIO.c
@@ -33,10 +33,10 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
#include <zlib.h>
#endif
-#ifdef HAVE_LZMA_H
+#ifdef LIBXML_LZMA_ENABLED
#include <lzma.h>
#endif
@@ -597,7 +597,7 @@ xmlWrapOpenUtf8(const char *path,int mode)
return fd;
}
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
static gzFile
xmlWrapGzOpenUtf8(const char *path, const char *mode)
{
@@ -1038,7 +1038,7 @@ xmlBufferWrite (void * context, const char * buffer, int len) {
}
#endif
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
/************************************************************************
* *
* I/O for compressed file accesses *
@@ -1241,7 +1241,7 @@ xmlGzfileClose (void * context) {
if (ret < 0) xmlIOErr(0, "gzclose()");
return(ret);
}
-#endif /* HAVE_ZLIB_H */
+#endif /* LIBXML_ZLIB_ENABLED */
#ifdef LIBXML_LZMA_ENABLED
/************************************************************************
@@ -1380,7 +1380,7 @@ typedef struct xmlIOHTTPWriteCtxt_
} xmlIOHTTPWriteCtxt, *xmlIOHTTPWriteCtxtPtr;
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
#define DFLT_WBITS ( -15 )
#define DFLT_MEM_LVL ( 8 )
@@ -1708,7 +1708,7 @@ xmlZMemBuffGetContent( xmlZMemBuffPtr buff, char ** data_ref ) {
return ( zlgth );
}
#endif /* LIBXML_OUTPUT_ENABLED */
-#endif /* HAVE_ZLIB_H */
+#endif /* LIBXML_ZLIB_ENABLED */
#ifdef LIBXML_OUTPUT_ENABLED
/**
@@ -1727,7 +1727,7 @@ xmlFreeHTTPWriteCtxt( xmlIOHTTPWriteCtxtPtr ctxt )
if ( ctxt->doc_buff != NULL ) {
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if ( ctxt->compression > 0 ) {
xmlFreeZMemBuff( ctxt->doc_buff );
}
@@ -1814,7 +1814,7 @@ xmlIOHTTPOpenW(const char *post_uri, int compression ATTRIBUTE_UNUSED)
* ** is being used to avoid pushing the data to disk and back.
*/
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if ((compression > 0) && (compression <= 9)) {
ctxt->compression = compression;
@@ -1894,7 +1894,7 @@ xmlIOHTTPWrite( void * context, const char * buffer, int len ) {
/* Use gzwrite or fwrite as previously setup in the open call */
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if ( ctxt->compression > 0 )
len = xmlZMemBuffAppend( ctxt->doc_buff, buffer, len );
@@ -1958,7 +1958,7 @@ xmlIOHTTPCloseWrite( void * context, const char * http_mthd ) {
/* Retrieve the content from the appropriate buffer */
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if ( ctxt->compression > 0 ) {
content_lgth = xmlZMemBuffGetContent( ctxt->doc_buff, &http_content );
@@ -2229,10 +2229,10 @@ xmlRegisterDefaultInputCallbacks(void) {
xmlRegisterInputCallbacks(xmlFileMatch, xmlFileOpen,
xmlFileRead, xmlFileClose);
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
xmlRegisterInputCallbacks(xmlGzfileMatch, xmlGzfileOpen,
xmlGzfileRead, xmlGzfileClose);
-#endif /* HAVE_ZLIB_H */
+#endif /* LIBXML_ZLIB_ENABLED */
#ifdef LIBXML_LZMA_ENABLED
xmlRegisterInputCallbacks(xmlXzfileMatch, xmlXzfileOpen,
xmlXzfileRead, xmlXzfileClose);
@@ -2274,7 +2274,7 @@ xmlRegisterDefaultOutputCallbacks (void) {
uncompressed ones except opening if existing then closing
and saving with same compression ratio ... a pain.
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
xmlRegisterOutputCallbacks(xmlGzfileMatch, xmlGzfileOpen,
xmlGzfileWrite, xmlGzfileClose);
#endif
@@ -2564,7 +2564,7 @@ __xmlParserInputBufferCreateFilename(const char *URI, xmlCharEncoding enc) {
ret->context = context;
ret->readcallback = xmlInputCallbackTable[i].readcallback;
ret->closecallback = xmlInputCallbackTable[i].closecallback;
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if ((xmlInputCallbackTable[i].opencallback == xmlGzfileOpen) &&
(strcmp(URI, "-") != 0)) {
#if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1230
@@ -2628,7 +2628,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
int i = 0;
void *context = NULL;
char *unescaped = NULL;
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
int is_file_uri = 1;
#endif
@@ -2639,7 +2639,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
puri = xmlParseURI(URI);
if (puri != NULL) {
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if ((puri->scheme != NULL) &&
(!xmlStrEqual(BAD_CAST puri->scheme, BAD_CAST "file")))
is_file_uri = 0;
@@ -2659,7 +2659,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
* try with an unescaped version of the URI
*/
if (unescaped != NULL) {
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if ((compression > 0) && (compression <= 9) && (is_file_uri == 1)) {
context = xmlGzfileOpenW(unescaped, compression);
if (context != NULL) {
@@ -2677,7 +2677,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
for (i = xmlOutputCallbackNr - 1;i >= 0;i--) {
if ((xmlOutputCallbackTable[i].matchcallback != NULL) &&
(xmlOutputCallbackTable[i].matchcallback(unescaped) != 0)) {
-#if defined(LIBXML_HTTP_ENABLED) && defined(HAVE_ZLIB_H)
+#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_ZLIB_ENABLED)
/* Need to pass compression parameter into HTTP open calls */
if (xmlOutputCallbackTable[i].matchcallback == xmlIOHTTPMatch)
context = xmlIOHTTPOpenW(unescaped, compression);
@@ -2696,7 +2696,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
* filename
*/
if (context == NULL) {
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if ((compression > 0) && (compression <= 9) && (is_file_uri == 1)) {
context = xmlGzfileOpenW(URI, compression);
if (context != NULL) {
@@ -2713,7 +2713,7 @@ __xmlOutputBufferCreateFilename(const char *URI,
for (i = xmlOutputCallbackNr - 1;i >= 0;i--) {
if ((xmlOutputCallbackTable[i].matchcallback != NULL) &&
(xmlOutputCallbackTable[i].matchcallback(URI) != 0)) {
-#if defined(LIBXML_HTTP_ENABLED) && defined(HAVE_ZLIB_H)
+#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_ZLIB_ENABLED)
/* Need to pass compression parameter into HTTP open calls */
if (xmlOutputCallbackTable[i].matchcallback == xmlIOHTTPMatch)
context = xmlIOHTTPOpenW(URI, compression);
diff --git a/xmllint.c b/xmllint.c
index 75d2f9b..6512540 100644
--- a/xmllint.c
+++ b/xmllint.c
@@ -3015,7 +3015,7 @@ static void usage(FILE *f, const char *name) {
fprintf(f, "\t--repeat : repeat 100 times, for timing or profiling\n");
fprintf(f, "\t--insert : ad-hoc test for valid insertions\n");
#ifdef LIBXML_OUTPUT_ENABLED
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
fprintf(f, "\t--compress : turn on gzip compression of output\n");
#endif
#endif /* LIBXML_OUTPUT_ENABLED */
@@ -3295,7 +3295,7 @@ main(int argc, char **argv) {
}
#endif
#ifdef LIBXML_OUTPUT_ENABLED
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
else if ((!strcmp(argv[i], "-compress")) ||
(!strcmp(argv[i], "--compress"))) {
compress++;
diff --git a/xmlsave.c b/xmlsave.c
index 85d79cd..6c7418e 100644
--- a/xmlsave.c
+++ b/xmlsave.c
@@ -2704,7 +2704,7 @@ xmlSaveFormatFileEnc( const char * filename, xmlDocPtr cur,
return(-1);
}
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if (cur->compression < 0) cur->compression = xmlGetCompressMode();
#endif
/*
diff --git a/xzlib.c b/xzlib.c
index 8bafbd3..a839169 100644
--- a/xzlib.c
+++ b/xzlib.c
@@ -31,10 +31,10 @@
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
#include <zlib.h>
#endif
-#ifdef HAVE_LZMA_H
+#ifdef LIBXML_LZMA_ENABLED
#include <lzma.h>
#endif
@@ -76,7 +76,7 @@ typedef struct {
char padding1[32]; /* padding allowing to cope with possible
extensions of above structure without
too much side effect */
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
/* zlib inflate or deflate stream */
z_stream zstrm; /* stream structure in-place (not a pointer) */
#endif
@@ -130,7 +130,7 @@ xz_reset(xz_statep state)
xz_error(state, LZMA_OK, NULL); /* clear error */
state->pos = 0; /* no uncompressed data yet */
state->strm.avail_in = 0; /* no input data yet */
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
state->zstrm.avail_in = 0; /* no input data yet */
#endif
}
@@ -272,7 +272,7 @@ xz_avail(xz_statep state)
return 0;
}
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
static int
xz_avail_zstrm(xz_statep state)
{
@@ -349,7 +349,7 @@ is_format_lzma(xz_statep state)
return 1;
}
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
/* Get next byte from input, or -1 if end or error. */
#define NEXT() ((strm->avail_in == 0 && xz_avail(state) == -1) ? -1 : \
@@ -415,7 +415,7 @@ xz_head(xz_statep state)
xz_error(state, LZMA_MEM_ERROR, "out of memory");
return -1;
}
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
/* allocate inflate memory */
state->zstrm.zalloc = Z_NULL;
state->zstrm.zfree = Z_NULL;
@@ -449,7 +449,7 @@ xz_head(xz_statep state)
state->direct = 0;
return 0;
}
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
/* look for the gzip magic header bytes 31 and 139 */
if (strm->next_in[0] == 31) {
strm->avail_in--;
@@ -550,7 +550,7 @@ xz_decomp(xz_statep state)
action = LZMA_FINISH;
/* decompress and handle errors */
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if (state->how == GZIP) {
state->zstrm.avail_in = (uInt) state->strm.avail_in;
state->zstrm.next_in = (Bytef *) state->strm.next_in;
@@ -592,13 +592,13 @@ xz_decomp(xz_statep state)
/* update available output and crc check value */
state->have = had - strm->avail_out;
state->next = strm->next_out - state->have;
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
state->zstrm.adler =
crc32(state->zstrm.adler, state->next, state->have);
#endif
if (ret == LZMA_STREAM_END) {
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if (state->how == GZIP) {
if (gz_next4(state, &crc) == -1 || gz_next4(state, &len) == -1) {
xz_error(state, LZMA_DATA_ERROR, "unexpected end of file");
@@ -788,7 +788,7 @@ __libxml2_xzclose(xzFile file)
/* free memory and close file */
if (state->size) {
lzma_end(&(state->strm));
-#ifdef HAVE_ZLIB_H
+#ifdef LIBXML_ZLIB_ENABLED
if (state->init == 1)
inflateEnd(&(state->zstrm));
state->init = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]