Introduced common/zlib/{configure.ac,Makefile.am}. Renamed macros
generated by old configure to same as generated by new configure
and add config.h include where needed.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/branches/1.5-xserver@2454 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/zlib/Makefile.am b/common/zlib/Makefile.am
new file mode 100644
index 0000000..5da5a6e
--- /dev/null
+++ b/common/zlib/Makefile.am
@@ -0,0 +1,7 @@
+noinst_LTLIBRARIES = libz.la
+
+libz_la_SOURCES = adler32.c compress.c crc32.c deflate.c deflate.h example.c \
+ gzio.c infblock.c infblock.h infcodes.c infcodes.h inffast.c \
+ inffast.h inffixed.h inflate.c inftrees.c inftrees.h infutil.c \
+ infutil.h maketree.c minigzip.c trees.c trees.h uncompr.c zconf.h \
+ zlib.h zutil.c zutil.h
diff --git a/common/zlib/configure b/common/zlib/configure
index 7c66e10..a19ff2e 100755
--- a/common/zlib/configure
+++ b/common/zlib/configure
@@ -162,9 +162,9 @@
EOF
if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
echo "Checking for errno.h... Yes."
+ CFLAGS="$CFLAGS -DHAVE_ERRNO_H"
else
echo "Checking for errno.h... No."
- CFLAGS="$CFLAGS -DNO_ERRNO_H"
fi
cat > $test.c <<EOF
@@ -176,7 +176,7 @@
}
EOF
if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
- CFLAGS="$CFLAGS -DUSE_MMAP"
+ CFLAGS="$CFLAGS -DHAVE_MMAP"
echo Checking for mmap support... Yes.
else
echo Checking for mmap support... No.
diff --git a/common/zlib/configure.ac b/common/zlib/configure.ac
new file mode 100644
index 0000000..2befc77
--- /dev/null
+++ b/common/zlib/configure.ac
@@ -0,0 +1,20 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.61])
+AC_INIT([zlib], [1.1.4])
+AM_INIT_AUTOMAKE([-Wall foreign dist-bzip2])
+
+# Checks for programs.
+AC_PROG_CC
+AC_PROG_LIBTOOL
+
+# Checks for header files.
+AC_CHECK_HEADERS([unistd.h errno.h])
+
+# Checks for library functions.
+AC_FUNC_MMAP
+
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/common/zlib/minigzip.c b/common/zlib/minigzip.c
index 8be02bd..4050878 100644
--- a/common/zlib/minigzip.c
+++ b/common/zlib/minigzip.c
@@ -15,6 +15,10 @@
/* @(#) $Id: minigzip.c,v 1.1 2004/10/08 09:44:26 const_k Exp $ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <stdio.h>
#include "zlib.h"
@@ -25,7 +29,7 @@
extern void exit OF((int));
#endif
-#ifdef USE_MMAP
+#ifdef HAVE_MMAP
# include <sys/types.h>
# include <sys/mman.h>
# include <sys/stat.h>
@@ -75,7 +79,7 @@
void error OF((const char *msg));
void gz_compress OF((FILE *in, gzFile out));
-#ifdef USE_MMAP
+#ifdef HAVE_MMAP
int gz_compress_mmap OF((FILE *in, gzFile out));
#endif
void gz_uncompress OF((gzFile in, FILE *out));
@@ -105,7 +109,7 @@
int len;
int err;
-#ifdef USE_MMAP
+#ifdef HAVE_MMAP
/* Try first compressing with mmap. If mmap fails (minigzip used in a
* pipe), use the normal fread loop.
*/
@@ -125,7 +129,7 @@
if (gzclose(out) != Z_OK) error("failed gzclose");
}
-#ifdef USE_MMAP /* MMAP version, Miguel Albrecht <malbrech@eso.org> */
+#ifdef HAVE_MMAP /* MMAP version, Miguel Albrecht <malbrech@eso.org> */
/* Try compressing the input file at once using mmap. Return Z_OK if
* if success, Z_ERRNO otherwise.
@@ -160,7 +164,7 @@
if (gzclose(out) != Z_OK) error("failed gzclose");
return Z_OK;
}
-#endif /* USE_MMAP */
+#endif /* HAVE_MMAP */
/* ===========================================================================
* Uncompress input to output then close both files.
diff --git a/common/zlib/zconf.h b/common/zlib/zconf.h
index c8d6ce9..d1705ae 100644
--- a/common/zlib/zconf.h
+++ b/common/zlib/zconf.h
@@ -8,6 +8,10 @@
#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.
diff --git a/common/zlib/zutil.h b/common/zlib/zutil.h
index 17eb77f..8208498 100644
--- a/common/zlib/zutil.h
+++ b/common/zlib/zutil.h
@@ -13,6 +13,10 @@
#ifndef _Z_UTIL_H
#define _Z_UTIL_H
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "zlib.h"
#ifdef STDC
@@ -20,10 +24,10 @@
# include <string.h>
# include <stdlib.h>
#endif
-#ifdef NO_ERRNO_H
- extern int errno;
-#else
+#ifdef HAVE_ERRNO_H
# include <errno.h>
+#else
+ extern int errno;
#endif
#ifndef local