summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <Panu Matilainen pmatilai@redhat.com>2011-07-08 10:31:34 +0300
committerPanu Matilainen <Panu Matilainen pmatilai@redhat.com>2011-07-15 12:25:44 +0300
commit36a82f92d8f3446730267256ee51490206afc91a (patch)
treeaafd2a12f4c111f6811acef9663edabd4fed1b77
parentd740b2be6e0e725bfdfba41cb0d3d298c404e40a (diff)
downloadrpm-36a82f92d8f3446730267256ee51490206afc91a.tar.gz
zlib is mandatory, fail at configure if missing + remove conditionals
- Unlike bz2 and xz/lz, zlib compression is not tracked by any rpmlib feature and is part of the original package format really, zlib simply must be always present. (cherry picked from commit 4b7e6cb79f5073fc42ae98e153668e574ebe0388)
-rw-r--r--configure.ac2
-rw-r--r--rpmio/rpmio.c15
2 files changed, 2 insertions, 15 deletions
diff --git a/configure.ac b/configure.ac
index ff0ceb8b4..f41703611 100644
--- a/configure.ac
+++ b/configure.ac
@@ -170,6 +170,8 @@ AC_CHECK_HEADERS([zlib.h],[
dnl zlib-1.0.4 has not gzseek
AC_CHECK_LIB(${zlib}, gzseek, [AC_DEFINE(HAVE_GZSEEK, 1, [Define as 1 if your zlib has gzseek()])])
])
+],[
+ AC_MSG_ERROR([missing required header zlib.h])
])
AC_SUBST(WITH_ZLIB_INCLUDE)
diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c
index 52220fe80..2fbbf9164 100644
--- a/rpmio/rpmio.c
+++ b/rpmio/rpmio.c
@@ -242,10 +242,8 @@ static const char * fdbg(FD_t fd)
sprintf(be, "FD %d fp %p", fps->fdno, fps->fp);
} else if (fps->io == ufdio) {
sprintf(be, "UFD %d fp %p", fps->fdno, fps->fp);
-#if HAVE_ZLIB_H
} else if (fps->io == gzdio) {
sprintf(be, "GZD %p fdno %d", fps->fp, fps->fdno);
-#endif
#if HAVE_BZLIB_H
} else if (fps->io == bzdio) {
sprintf(be, "BZD %p fdno %d", fps->fp, fps->fdno);
@@ -661,8 +659,6 @@ ssize_t timedRead(FD_t fd, void * bufptr, size_t length)
/* =============================================================== */
/* Support for GZIP library.
*/
-#ifdef HAVE_ZLIB_H
-
#include <zlib.h>
static void * gzdFileno(FD_t fd)
@@ -847,8 +843,6 @@ static const struct FDIO_s gzdio_s = {
};
static const FDIO_t gzdio = &gzdio_s ;
-#endif /* HAVE_ZLIB_H */
-
/* =============================================================== */
/* Support for BZIP2 library.
*/
@@ -996,12 +990,9 @@ static const char * getFdErrstr (FD_t fd)
{
const char *errstr = NULL;
-#ifdef HAVE_ZLIB_H
if (fdGetIo(fd) == gzdio) {
errstr = fd->errcookie;
} else
-#endif /* HAVE_ZLIB_H */
-
#ifdef HAVE_BZLIB_H
if (fdGetIo(fd) == bzdio) {
errstr = fd->errcookie;
@@ -1594,11 +1585,9 @@ fprintf(stderr, "*** Fdopen(%p,%s) %s\n", fd, fmode, fdbg(fd));
if (end && *end) {
if (rstreq(end, "fdio")) {
iof = fdio;
-#if HAVE_ZLIB_H
} else if (rstreq(end, "gzdio") || rstreq(end, "gzip")) {
iof = gzdio;
fd = gzdFdopen(fd, zstdio);
-#endif
#if HAVE_BZLIB_H
} else if (rstreq(end, "bzdio") || rstreq(end, "bzip2")) {
iof = bzdio;
@@ -1730,10 +1719,8 @@ int Fflush(FD_t fd)
return fflush(fdGetFILE(fd));
vh = fdGetFp(fd);
-#if HAVE_ZLIB_H
if (vh && fdGetIo(fd) == gzdio)
return gzdFlush(vh);
-#endif
#if HAVE_BZLIB_H
if (vh && fdGetIo(fd) == bzdio)
return bzdFlush(vh);
@@ -1772,11 +1759,9 @@ int Ferror(FD_t fd)
if (fps->io == fpio) {
ec = ferror(fdGetFILE(fd));
-#if HAVE_ZLIB_H
} else if (fps->io == gzdio) {
ec = (fd->syserrno || fd->errcookie != NULL) ? -1 : 0;
i--; /* XXX fdio under gzdio always has fdno == -1 */
-#endif
#if HAVE_BZLIB_H
} else if (fps->io == bzdio) {
ec = (fd->syserrno || fd->errcookie != NULL) ? -1 : 0;