diff -r 6a2b0456259a gzlib.c --- a/gzlib.c Fri Mar 26 11:41:01 2010 -0700 +++ b/gzlib.c Fri Mar 26 11:54:06 2010 -0700 @@ -5,7 +5,7 @@ #include "gzguts.h" -#ifdef _LARGEFILE64_SOURCE +#ifdef ZLIB_LARGEFILE64_SOURCE # define LSEEK lseek64 #else # define LSEEK lseek diff -r 6a2b0456259a zconf.h --- a/zconf.h Fri Mar 26 11:41:01 2010 -0700 +++ b/zconf.h Fri Mar 26 11:54:06 2010 -0700 @@ -197,6 +197,17 @@ # endif #endif +#if defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__) || defined(__DragonFly__) +# define ZLIB_FILE_OFFSET_BITS 64 +#else +# if defined(_FILE_OFFSET_BITS) +# define ZLIB_FILE_OFFSET_BITS _FILE_OFFSET_BITS +# endif +# if defined(_LARGEFILE64_SOURCE) +# define ZLIB_LARGEFILE64_SOURCE +# endif +#endif + /* Some Mac compilers merge all .h files incorrectly: */ #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) # define NO_DUMMY_DECL @@ -375,7 +386,7 @@ # endif #endif -#ifdef _LARGEFILE64_SOURCE +#ifdef ZLIB_LARGEFILE64_SOURCE # include #endif diff -r 6a2b0456259a zconf.h.in --- a/zconf.h.in Fri Mar 26 11:41:01 2010 -0700 +++ b/zconf.h.in Fri Mar 26 11:54:06 2010 -0700 @@ -197,6 +197,17 @@ # endif #endif +#if defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) || defined (__APPLE__) || defined(__DragonFly__) +# define ZLIB_FILE_OFFSET_BITS 64 +#else +# if defined(_FILE_OFFSET_BITS) +# define ZLIB_FILE_OFFSET_BITS _FILE_OFFSET_BITS +# endif +# if defined(_LARGEFILE64_SOURCE) +# define ZLIB_LARGEFILE64_SOURCE +# endif +#endif + /* Some Mac compilers merge all .h files incorrectly: */ #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) # define NO_DUMMY_DECL @@ -375,7 +386,7 @@ # endif #endif -#ifdef _LARGEFILE64_SOURCE +#ifdef ZLIB_LARGEFILE64_SOURCE # include #endif diff -r 6a2b0456259a zlib.h --- a/zlib.h Fri Mar 26 11:41:01 2010 -0700 +++ b/zlib.h Fri Mar 26 11:54:06 2010 -0700 @@ -1556,7 +1556,7 @@ inflateBackInit_((strm), (windowBits), (window), \ ZLIB_VERSION, sizeof(z_stream)) -#ifdef _LARGEFILE64_SOURCE +#ifdef ZLIB_LARGEFILE64_SOURCE ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); ZEXTERN off64_t ZEXPORT gzseek64 OF((gzFile, off64_t, int)); ZEXTERN off64_t ZEXPORT gztell64 OF((gzFile)); @@ -1565,14 +1565,14 @@ ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, off64_t)); #endif -#if !defined(ZLIB_INTERNAL) && _FILE_OFFSET_BITS == 64 +#if !defined(ZLIB_INTERNAL) && ZLIB_FILE_OFFSET_BITS == 64 # define gzopen gzopen64 # define gzseek gzseek64 # define gztell gztell64 # define gzoffset gzoffset64 # define adler32_combine adler32_combine64 # define crc32_combine crc32_combine64 -# ifndef _LARGEFILE64_SOURCE +# ifndef ZLIB_LARGEFILE64_SOURCE ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); ZEXTERN off_t ZEXPORT gzseek64 OF((gzFile, off_t, int)); ZEXTERN off_t ZEXPORT gztell64 OF((gzFile));