*** further changes made in November 2006 ***

There are a very few to the source code of zlib-1.2.3 used here.

- zconf.h includes R's config.h
- gzio.c has been amended to allow LFS using fseeko/ftello where these
  are supported, and fseek64o/ftell64o on Windows.

Makefile.in is ours, not zlib's, and allows us to use PIC flags so this
can be included in libR.so.

diff -u ./gzio.c /data/gannet/ripley/R/svn/R-patched/src/extra/zlib/gzio.c
--- ./gzio.c	2005-07-11 21:31:48.000000000 +0100
+++ /data/gannet/ripley/R/svn/R-patched/src/extra/zlib/gzio.c	2006-09-04 15:41:33.998757000 +0100
@@ -7,10 +7,35 @@
 
 /* @(#) $Id$ */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 
+#if !defined(fdopen) && !defined(HAVE_FDOPEN)
+/* not used in R */
+static FILE *fdopen(int fildes, const char *mode)
+{
+}
+#endif
+
 #include "zutil.h"
 
+/* R ADDITION */
+#if defined(HAVE_OFF_T) && defined(HAVE_FSEEKO)
+#define f_seek fseeko
+#define f_tell ftello
+#else
+#ifdef Win32
+#define f_seek fseeko64
+#define f_tell ftello64
+#else
+#define f_seek fseek
+#define f_tell ftell
+#endif
+#endif
+
 #ifdef NO_DEFLATE       /* for compatibility with old definition */
 #  define NO_GZCOMPRESS
 #endif
@@ -196,7 +221,7 @@
          */
     } else {
         check_header(s); /* skip the .gz header */
-        s->start = ftell(s->file) - s->stream.avail_in;
+        s->start = f_tell(s->file) - s->stream.avail_in;
     }
 
     return (gzFile)s;
@@ -592,6 +617,7 @@
 }
 
 
+#ifdef UNUSED
 /* ===========================================================================
      Converts, formats, and writes the args to the compressed file under
    control of the format string, as in fprintf. gzprintf returns the number of
@@ -670,6 +696,7 @@
     return gzwrite(file, buf, len);
 }
 #endif
+#endif /* UNUSED */
 
 /* ===========================================================================
       Writes c, converted to an unsigned char, into the compressed file.
@@ -816,7 +843,7 @@
         s->back = EOF;
         s->stream.avail_in = 0;
         s->stream.next_in = s->inbuf;
-        if (fseek(s->file, offset, SEEK_SET) < 0) return -1L;
+        if (f_seek(s->file, offset, SEEK_SET) < 0) return -1L;
 
         s->in = s->out = offset;
         return offset;
@@ -870,7 +897,7 @@
     if (!s->transparent) (void)inflateReset(&s->stream);
     s->in = 0;
     s->out = 0;
-    return fseek(s->file, s->start, SEEK_SET);
+    return f_seek(s->file, s->start, SEEK_SET);
 }
 
 /* ===========================================================================
diff -u ./zconf.h /data/gannet/ripley/R/svn/R-patched/src/extra/zlib/zconf.h
--- ./zconf.h	2005-05-28 07:40:35.000000000 +0100
+++ /data/gannet/ripley/R/svn/R-patched/src/extra/zlib/zconf.h	2006-09-04 15:41:34.538753000 +0100
@@ -8,6 +8,9 @@
 #ifndef ZCONF_H
 #define ZCONF_H
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
 /*
  * If you *really* need a unique prefix for all types and library functions,
  * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
@@ -284,7 +287,7 @@
    typedef Byte       *voidp;
 #endif
 
-#if 0           /* HAVE_UNISTD_H -- this line is updated by ./configure */
+#ifdef HAVE_UNISTD_H /* HAVE_UNISTD_H -- this line is updated by ./configure */
 #  include <sys/types.h> /* for off_t */
 #  include <unistd.h>    /* for SEEK_* and off_t */
 #  ifdef VMS
Only in .: zconf.in.h
Only in .: zlib.3
