diff -urN zlib.orig/crc32.c zlib/crc32.c
--- zlib.orig/crc32.c	2017-04-20 09:47:59.290284148 +0200
+++ zlib/crc32.c	2017-04-20 09:47:59.290284148 +0200
@@ -21,6 +21,8 @@
   DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h.
  */
 
+#define NOBYFOUR
+
 #ifdef MAKECRCH
 #  include <stdio.h>
 #  ifndef DYNAMIC_CRC_TABLE
diff -urN zlib.orig/deflate.c zlib/deflate.c
--- zlib.orig/deflate.c	2017-04-20 09:47:59.302284311 +0200
+++ zlib/deflate.c	2017-04-20 09:47:59.302284311 +0200
@@ -51,6 +51,10 @@
 
 #include "deflate.h"
 
+#ifdef STDC           /* need ANSI C limits.h to determine sizes */
+#  include <limits.h>
+#endif
+
 const char deflate_copyright[] =
    " deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler ";
 /*
@@ -1492,6 +1496,7 @@
         more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart);
 
         /* Deal with !@#$% 64K limit: */
+#if defined( UINT_MAX ) && UINT_MAX <= 0xFFFF
         if (sizeof(int) <= 2) {
             if (more == 0 && s->strstart == 0 && s->lookahead == 0) {
                 more = wsize;
@@ -1503,6 +1508,7 @@
                 more--;
             }
         }
+#endif
 
         /* If the window is almost full and there is insufficient lookahead,
          * move the upper half to the lower one to make room in the upper half.
@@ -2059,7 +2065,7 @@
     int flush;
 {
     int bflush;             /* set if current block must be flushed */
-    uInt prev;              /* byte at distance one to match */
+    Byte prev;              /* byte at distance one to match */
     Bytef *scan, *strend;   /* scan goes up to strend for length of run */
 
     for (;;) {
diff -urN zlib.orig/gzguts.h zlib/gzguts.h
--- zlib.orig/gzguts.h	2017-04-20 09:47:59.306284365 +0200
+++ zlib/gzguts.h	2017-04-20 09:47:59.306284365 +0200
@@ -35,7 +35,8 @@
 #  include <stddef.h>
 #endif
 
-#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)
+#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32) || \
+    defined(__XCC__) || defined(__POCC__)
 #  include <io.h>
 #endif
 
@@ -54,7 +55,8 @@
 #  define NO_GZCOMPRESS
 #endif
 
-#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
+#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) || \
+    defined(__WATCOMC__)
 #  ifndef HAVE_VSNPRINTF
 #    define HAVE_VSNPRINTF
 #  endif
diff -urN zlib.orig/gzlib.c zlib/gzlib.c
--- zlib.orig/gzlib.c	2017-04-20 09:47:59.306284365 +0200
+++ zlib/gzlib.c	2017-04-20 09:47:59.306284365 +0200
@@ -5,7 +5,11 @@
 
 #include "gzguts.h"
 
-#if defined(_WIN32) && !defined(__BORLANDC__) && !defined(__MINGW32__)
+#if defined(__XCC__) || defined(__DMC__) || defined(__MINGW32CE__)
+#  define LSEEK lseek
+#elif defined(__POCC__)
+#  define LSEEK _lseek64
+#elif defined(_WIN32) && !defined(__BORLANDC__)
 #  define LSEEK _lseeki64
 #else
 #if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
diff -urN zlib.orig/inflate.c zlib/inflate.c
--- zlib.orig/inflate.c	2017-04-20 09:47:59.318284528 +0200
+++ zlib/inflate.c	2017-04-20 09:47:59.318284528 +0200
@@ -446,6 +446,7 @@
 /* Macros for inflate(): */
 
 /* check function to use adler32() for zlib or crc32() for gzip */
+#undef UPDATE /* VxWorks defines it */
 #ifdef GUNZIP
 #  define UPDATE(check, buf, len) \
     (state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
diff -urN zlib.orig/zconf.h zlib/zconf.h
--- zlib.orig/zconf.h	2017-04-20 09:47:59.330284692 +0200
+++ zlib/zconf.h	2017-04-20 09:47:59.330284692 +0200
@@ -174,7 +174,18 @@
 #if defined(_WINDOWS) && !defined(WINDOWS)
 #  define WINDOWS
 #endif
-#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
+#if defined(__CEGCC__) || defined(__MINGW32CE__) || \
+    defined(UNDER_CE) || defined(_WIN32_WCE)
+#  ifndef _WINCE
+#    define _WINCE
+#  endif
+#endif
+#if defined(_WINCE)
+#  ifndef NO_ERRNO_H
+#    define NO_ERRNO_H
+#  endif
+#endif
+#if defined(_WIN32) || defined(_WINCE) || defined(__WIN32__)
 #  ifndef WIN32
 #    define WIN32
 #  endif
@@ -372,6 +383,16 @@
 #    endif
 #  endif
 #endif
+
+#if ( defined(__OS2__) || defined(__DOS__) ) && defined(__WATCOMC__)
+#  ifdef ZLIB_DLL
+#    ifdef ZLIB_INTERNAL
+#      define ZEXTERN   extern __declspec(dllexport)
+#    else
+#      define ZEXPORT   extern __declspec(dllimport)
+#    endif
+#  endif
+#endif
 
 #ifndef ZEXTERN
 #  define ZEXTERN extern
diff -urN zlib.orig/zlib.h zlib/zlib.h
--- zlib.orig/zlib.h	2017-04-20 09:47:59.338284799 +0200
+++ zlib/zlib.h	2017-04-20 09:47:59.338284799 +0200
@@ -1875,6 +1875,8 @@
    ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile));
    ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t));
    ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t));
+   ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t));
+   ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t));
 #endif
 
 #else /* Z_SOLO */
diff -urN zlib.orig/zutil.c zlib/zutil.c
--- zlib.orig/zutil.c	2017-04-20 09:47:59.338284799 +0200
+++ zlib/zutil.c	2017-04-20 09:47:59.338284799 +0200
@@ -136,7 +136,7 @@
     return ERR_MSG(err);
 }
 
-#if defined(_WIN32_WCE)
+#if defined(_WINCE) && 0
     /* The Microsoft C Run-Time Library for Windows CE doesn't have
      * errno.  We define it as a global variable to simplify porting.
      * Its value is always 0 and should not be used.
diff -urN zlib.orig/zutil.h zlib/zutil.h
--- zlib.orig/zutil.h	2017-04-20 09:47:59.338284799 +0200
+++ zlib/zutil.h	2017-04-20 09:47:59.338284799 +0200
@@ -22,7 +22,7 @@
 #include "zlib.h"
 
 #if defined(STDC) && !defined(Z_SOLO)
-#  if !(defined(_WIN32_WCE) && defined(_MSC_VER))
+#  if !(defined(_WINCE) && defined(_MSC_VER))
 #    include <stddef.h>
 #  endif
 #  include <string.h>
@@ -168,8 +168,7 @@
 #endif
 
 #if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
-#  if defined(_WIN32_WCE)
-#    define fdopen(fd,mode) NULL /* No fdopen() */
+#  if defined(_WINCE)
 #    ifndef _PTRDIFF_T_DEFINED
        typedef int ptrdiff_t;
 #      define _PTRDIFF_T_DEFINED
