man3dir = ${mandir}/man3
pkgconfigdir = ${libdir}/pkgconfig
-OBJZ = adler32.o crc32.o deflate.o match.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o $(ARCH_STATIC_OBJS)
-OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
+OBJZ = adler32.o compress.o crc32.o deflate.o match.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o $(ARCH_STATIC_OBJS)
+OBJG = gzclose.o gzlib.o gzread.o gzwrite.o
OBJC = $(OBJZ) $(OBJG)
-PIC_OBJZ = adler32.lo crc32.lo deflate.lo match.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo $(ARCH_SHARED_OBJS)
-PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
+PIC_OBJZ = adler32.lo compress.lo crc32.lo deflate.lo match.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo uncompr.lo zutil.lo $(ARCH_SHARED_OBJS)
+PIC_OBJG = gzclose.lo gzlib.lo gzread.lo gzwrite.lo
PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
OBJS = $(OBJC)
mandir=${mandir-'${prefix}/share/man'}
shared_ext='.so'
shared=1
-solo=0
+gzfileops=0
+compat=0
cover=0
zconst=0
build64=0
gcc=0
old_cc="$CC"
old_cflags="$CFLAGS"
-OBJC='$(OBJZ) $(OBJG)'
-PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)'
+OBJC='$(OBJZ)'
+PIC_OBJC='$(PIC_OBJZ)'
# leave this script, optionally in a bad way
leave()
case "$1" in
-h* | --help)
echo 'usage:' | tee -a configure.log
- echo ' configure [--const] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log
+ echo ' configure [--const] [--zlib-compat] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log
echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log
echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log
exit 0 ;;
-i* | --includedir) includedir="$2"; shift; shift ;;
-s* | --shared | --enable-shared) shared=1; shift ;;
-t | --static) shared=0; shift ;;
- --solo) solo=1; shift ;;
+ --zlib-compat) compat=1; shift ;;
--cover) cover=1; shift ;;
-6* | --64) build64=1; shift ;;
-a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;;
echo "Checking for stdarg.h... No." | tee -a configure.log
fi
-# if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists
-if test $solo -eq 1; then
- sed '/#define ZCONF_H/a\
-#define Z_SOLO
-
-' < zconf.h > zconf.temp.h
- mv zconf.temp.h zconf.h
-OBJC='$(OBJZ)'
-PIC_OBJC='$(PIC_OBJZ)'
+# if --zlib-compat was requested
+if test $compat -eq 1; then
+ CFLAGS="${CFLAGS} -DZLIB_COMPAT -DWITH_GZFILEOP"
+ SFLAGS="${SFLAGS} -DZLIB_COMPAT -DWITH_GZFILEOP"
+ OBJC="${OBJC} \$(OBJG)"
+ PIC_OBJC="${PIC_OBJC} \$(PIC_OBJG)"
fi
# if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X
strm->msg = Z_NULL;
if (strm->zalloc == (alloc_func)0) {
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
strm->zalloc = zcalloc;
strm->opaque = (void *)0;
-#endif
}
if (strm->zfree == (free_func)0)
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
strm->zfree = zcfree;
-#endif
if (level == Z_DEFAULT_COMPRESSION) level = 6;
return Z_STREAM_ERROR;
strm->msg = Z_NULL; /* in case we return an error */
if (strm->zalloc == (alloc_func)0) {
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
strm->zalloc = zcalloc;
strm->opaque = (void *)0;
-#endif
}
if (strm->zfree == (free_func)0)
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
strm->zfree = zcfree;
-#endif
state = (struct inflate_state *)ZALLOC(strm, 1,
sizeof(struct inflate_state));
if (state == Z_NULL) return Z_MEM_ERROR;
if (strm == Z_NULL) return Z_STREAM_ERROR;
strm->msg = Z_NULL; /* in case we return an error */
if (strm->zalloc == (alloc_func)0) {
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
strm->zalloc = zcalloc;
strm->opaque = (void *)0;
-#endif
}
if (strm->zfree == (free_func)0)
-#ifdef Z_SOLO
- return Z_STREAM_ERROR;
-#else
strm->zfree = zcfree;
-#endif
state = (struct inflate_state *)
ZALLOC(strm, 1, sizeof(struct inflate_state));
if (state == Z_NULL) return Z_MEM_ERROR;
int main (int argc, char *argv[]);
-#ifdef Z_SOLO
-
-void *myalloc (void *, unsigned, unsigned);
-void myfree (void *, void *);
-
-void *myalloc(void *q, unsigned n, unsigned m)
-{
- q = Z_NULL;
- return calloc(n, m);
-}
-
-void myfree(void *q, void *p)
-{
- q = Z_NULL;
- free(p);
-}
-
-static alloc_func zalloc = myalloc;
-static free_func zfree = myfree;
-
-#else /* !Z_SOLO */
-
static alloc_func zalloc = (alloc_func)0;
static free_func zfree = (free_func)0;
void test_compress (Byte *compr, uLong comprLen,
Byte *uncompr, uLong uncomprLen);
-void test_gzio (const char *fname,
- Byte *uncompr, uLong uncomprLen);
/* ===========================================================================
* Test compress() and uncompress()
}
}
+#ifdef WITH_GZFILEOP
+void test_gzio (const char *fname,
+ Byte *uncompr, uLong uncomprLen);
+
/* ===========================================================================
* Test read/write of .gz files
*/
#endif
}
-#endif /* Z_SOLO */
+#endif /* WITH_GZFILEOP */
/* ===========================================================================
* Test deflate() with small buffers
exit(1);
}
-#ifdef Z_SOLO
- argc = strlen(argv[0]);
-#else
test_compress(compr, comprLen, uncompr, uncomprLen);
+#ifdef WITH_GZFILEOP
test_gzio((argc > 1 ? argv[1] : TESTFILE),
uncompr, uncomprLen);
#endif
#define BUFLEN 16384
#define MAX_NAME_LEN 1024
-#ifdef Z_SOLO
-/* for Z_SOLO, create simplified gz* functions using deflate and inflate */
+#ifndef WITH_GZFILEOP
+/* without WITH_GZFILEOP, create simplified gz* functions using deflate and inflate */
#if defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE)
# include <unistd.h> /* for unlink() */
return gz->msg;
}
-#endif
+#endif
char *prog;
typedef void *voidpf;
typedef void *voidp;
-#if !defined(Z_U4) && !defined(Z_SOLO)
+#if !defined(Z_U4)
# include <limits.h>
# if (UINT_MAX == 0xffffffffUL)
# define Z_U4 unsigned
# define Z_HAVE_STDARG_H
#endif
-#ifndef Z_SOLO
-# include <sys/types.h> /* for off_t */
-# include <stdarg.h> /* for va_list */
-#endif
+#include <sys/types.h> /* for off_t */
+#include <stdarg.h> /* for va_list */
#ifdef _WIN32
-# ifndef Z_SOLO
-# include <stddef.h> /* for wchar_t */
-# endif
+# include <stddef.h> /* for wchar_t */
#endif
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
# undef _LARGEFILE64_SOURCE
#endif
-#ifndef Z_SOLO
-# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
-# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
-# ifndef z_off_t
-# define z_off_t off_t
-# endif
+#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
+# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
+# ifndef z_off_t
+# define z_off_t off_t
# endif
#endif
# define Z_WANT64
#endif
-#if !defined(SEEK_SET) && !defined(Z_SOLO)
+#if !defined(SEEK_SET) && defined(WITH_GZFILEOP)
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#if !defined(_WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
-# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
+# if defined(_WIN32) && !defined(__GNUC__)
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
27-31: 0 (reserved)
*/
-#ifndef Z_SOLO
/* utility functions */
buffer with the uncompressed data up to that point.
*/
+#ifdef WITH_GZFILEOP
/* gzip file access functions */
/*
file that is being written concurrently.
*/
-#endif /* !Z_SOLO */
+#endif /* WITH_GZFILEOP */
/* checksum functions */
inflateBackInit_((strm), (windowBits), (window), \
ZLIB_VERSION, (int)sizeof(z_stream))
-#ifndef Z_SOLO
+#ifdef WITH_GZFILEOP
/* gzgetc() macro and its supporting function and exposed data structure. Note
* that the real internal state is much larger than the exposed structure.
ZEXTERN uint32_t ZEXPORT crc32_combine (uint32_t, uint32_t, z_off_t);
#endif
-#else /* Z_SOLO */
+#else /* !WITH_GZFILEOP */
ZEXTERN uLong ZEXPORT adler32_combine (uLong, uLong, z_off_t);
ZEXTERN uLong ZEXPORT crc32_combine (uLong, uLong, z_off_t);
-#endif /* !Z_SOLO */
+#endif /* WITH_GZFILEOP */
/* undocumented functions */
ZEXTERN const char * ZEXPORT zError (int);
ZEXTERN int ZEXPORT inflateUndermine (z_stream *, int);
ZEXTERN int ZEXPORT inflateResetKeep (z_stream *);
ZEXTERN int ZEXPORT deflateResetKeep (z_stream *);
-#if defined(_WIN32) && !defined(Z_SOLO)
+#if defined(_WIN32) && defined(WITH_GZFILEOP)
ZEXTERN gzFile ZEXPORT gzopen_w (const wchar_t *path, const char *mode);
#endif
-#ifndef Z_SOLO
+#ifdef WITH_GZFILEOP
ZEXTERN int ZEXPORTVA gzvprintf (gzFile file, const char *format, va_list va);
#endif
/* @(#) $Id$ */
#include "zutil.h"
-#ifndef Z_SOLO
+#ifdef WITH_GZFILEOP
# include "gzguts.h"
#endif
return ERR_MSG(err);
}
-#ifndef Z_SOLO
-
#ifndef MY_ZCALLOC /* Any system without a special alloc function */
void ZLIB_INTERNAL *zcalloc (void *opaque, unsigned items, unsigned size)
}
#endif /* MY_ZCALLOC */
-
-#endif /* !Z_SOLO */
#endif
#include "zlib.h"
-
-#ifndef Z_SOLO
-# include <stddef.h>
-# include <string.h>
-# include <stdlib.h>
-#endif
-
-#ifdef Z_SOLO
- typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */
-#endif
+#include <stddef.h>
+#include <string.h>
+#include <stdlib.h>
#ifndef local
# define local static
# define Tracecv(c,x)
#endif
-#ifndef Z_SOLO
- void ZLIB_INTERNAL *zcalloc (void *opaque, unsigned items, unsigned size);
- void ZLIB_INTERNAL zcfree (void *opaque, void *ptr);
-#endif
+void ZLIB_INTERNAL *zcalloc (void *opaque, unsigned items, unsigned size);
+void ZLIB_INTERNAL zcfree (void *opaque, void *ptr);
#define ZALLOC(strm, items, size) \
(*((strm)->zalloc))((strm)->opaque, (items), (size))