2017-01-22  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* Makefile.in:  Adaptions required to use zlib with cvs sources.

	* configure: prefix default set to /dev/env/DJDIR.

	* gzguts.h [HAVE_VSNPRINTF]:  DJGPP provides vsnprintf.






diff -aprNU5 zlib-1.2.11.orig/configure zlib-1.2.11/configure
--- zlib-1.2.11.orig/configure	2016-12-31 18:06:36 +0000
+++ zlib-1.2.11/configure	2017-01-22 18:13:34 +0000
@@ -69,11 +69,11 @@ fi
 
 # set defaults before processing command line options
 LDCONFIG=${LDCONFIG-"ldconfig"}
 LDSHAREDLIBC="${LDSHAREDLIBC--lc}"
 ARCHS=
-prefix=${prefix-/usr/local}
+prefix=${prefix-'/dev/env/DJDIR'}
 exec_prefix=${exec_prefix-'${prefix}'}
 libdir=${libdir-'${exec_prefix}/lib'}
 sharedlibdir=${sharedlibdir-'${libdir}'}
 includedir=${includedir-'${prefix}/include'}
 mandir=${mandir-'${prefix}/share/man'}
@@ -210,11 +210,11 @@ if test "$gcc" -eq 1 && ($cc -c $test.c)
   Linux* | linux* | GNU | GNU/* | solaris*)
         LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"} ;;
   *BSD | *bsd* | DragonFly)
         LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,${SRCDIR}zlib.map"}
         LDCONFIG="ldconfig -m" ;;
-  CYGWIN* | Cygwin* | cygwin* | OS/2*)
+  CYGWIN* | Cygwin* | cygwin* | MS-DOS* | OS/2*)
         EXE='.exe' ;;
   MINGW* | mingw*)
 # temporary bypass
         rm -f $test.[co] $test $test$shared_ext
         echo "Please use win32/Makefile.gcc instead." | tee -a configure.log
diff -aprNU5 zlib-1.2.11.orig/gzguts.h zlib-1.2.11/gzguts.h
--- zlib-1.2.11.orig/gzguts.h	2017-01-01 07:37:06 +0000
+++ zlib-1.2.11/gzguts.h	2017-01-22 18:15:52 +0000
@@ -70,12 +70,17 @@
 #  ifndef HAVE_VSNPRINTF
 #    define HAVE_VSNPRINTF
 #  endif
 #endif
 
+#if defined(__DJGPP__)
+/* Provide prototypes for lseek, read, write and close.  */
+#  include <unistd.h>
+#endif
+
 #ifndef HAVE_VSNPRINTF
-#  ifdef MSDOS
+#  if defined(MSDOS) && !defined(__DJGPP__)
 /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
    but for now we just assume it doesn't. */
 #    define NO_vsnprintf
 #  endif
 #  ifdef __TURBOC__
diff -aprNU5 zlib-1.2.11.orig/Makefile.in zlib-1.2.11/Makefile.in
--- zlib-1.2.11.orig/Makefile.in	2017-01-15 17:29:36 +0000
+++ zlib-1.2.11/Makefile.in	2017-01-22 18:10:02 +0000
@@ -14,20 +14,27 @@
 # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
 #    make install
 # To install in $HOME instead of /usr/local, use:
 #    make install prefix=$HOME
 
-CC=cc
+SHELL=/bin/sh
+
+srcdir       = @srcdir@
+top_srcdir   = @top_srcdir@
+top_builddir = @top_builddir@
+VPATH        = @srcdir@
 
-CFLAGS=-O
+CC = @CC@
+
+CFLAGS = @CFLAGS@ -I. -I$(top_builddir) -I$(top_srcdir)/djgpp
 #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
 #CFLAGS=-g -DZLIB_DEBUG
 #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
 #           -Wstrict-prototypes -Wmissing-prototypes
 
 SFLAGS=-O
-LDFLAGS=
+LDFLAGS=@LDFLAGS@
 TEST_LDFLAGS=-L. libz.a
 LDSHARED=$(CC)
 CPP=$(CC) -E
 
 STATICLIB=libz.a
@@ -36,26 +43,26 @@ SHAREDLIBV=libz.so.1.2.11
 SHAREDLIBM=libz.so.1
 LIBS=$(STATICLIB) $(SHAREDLIBV)
 
 AR=ar
 ARFLAGS=rc
-RANLIB=ranlib
+RANLIB=@RANLIB@
 LDCONFIG=ldconfig
 LDSHAREDLIBC=-lc
 TAR=tar
 SHELL=/bin/sh
 EXE=
 
-prefix = /usr/local
-exec_prefix = ${prefix}
+prefix = @prefix@
+exec_prefix = @exec_prefix@
 libdir = ${exec_prefix}/lib
 sharedlibdir = ${libdir}
 includedir = ${prefix}/include
 mandir = ${prefix}/share/man
 man3dir = ${mandir}/man3
 pkgconfigdir = ${libdir}/pkgconfig
-SRCDIR=
+SRCDIR=$(srcdir)/
 ZINC=
 ZINCOUT=-I.
 
 OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
 OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
@@ -71,21 +78,24 @@ PIC_OBJA =
 
 OBJS = $(OBJC) $(OBJA)
 
 PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
 
-all: static shared
+# for CVS's distdir & Makefile targets
+subdir = zlib
+
+all: zconf $(STATICLIB)
 
 static: example$(EXE) minigzip$(EXE)
 
 shared: examplesh$(EXE) minigzipsh$(EXE)
 
 all64: example64$(EXE) minigzip64$(EXE)
 
-check: test
+# check: test
 
-test: all teststatic testshared
+# test: all teststatic testshared
 
 teststatic: static
 	@TMPST=tmpst_$$; \
 	if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \
 	  echo '		*** zlib test OK ***'; \
