zlib is now mandatory.
authorArt Cancro <ajc@uncensored.citadel.org>
Tue, 27 Dec 2011 19:11:18 +0000 (14:11 -0500)
committerArt Cancro <ajc@uncensored.citadel.org>
Tue, 27 Dec 2011 19:11:18 +0000 (14:11 -0500)
citadel/configure.ac
citadel/database.c
webcit/configure.ac
webcit/webcit.h

index 4e0982cbe018a3283d9bb5e527bb777bb31d51e2..8401e58b0e8013a162da797390595433b7fd3413 100644 (file)
@@ -171,20 +171,23 @@ AC_SUBST(LOCALEDIR)
 
 
 dnl Checks for the zlib compression library.
-if test "x$with_zlib" != xno ; then
-       AC_CHECK_HEADERS(zlib.h,
-               [AC_CHECK_LIB(z, zlibVersion,
-                       [ok_zlib=yes],,
-       )])
-fi
-
-if test "x$ok_zlib" = xyes ; then
-       LDFLAGS="-lz $LDFLAGS" 
-       AC_DEFINE(HAVE_ZLIB, [], [define this if you have zlib compression available])
-fi
-
-
-
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $SERVER_LIBS"
+AC_CHECK_HEADER(zlib.h,
+       [AC_CHECK_LIB(z, zlibVersion,
+               [
+                       LIBS="-lz $LIBS $SERVER_LIBS"
+               ],
+               [
+                       AC_MSG_ERROR(zlib was not found or is not usable.  Please install zlib.)
+               ]
+       ,
+       )],
+       [
+               AC_MSG_ERROR(zlib.h was not found or is not usable.  Please install zlib.)
+       ]
+)
+CFLAGS="$saved_CFLAGS"
 
 dnl Here is the check for a libc integrated iconv
 AC_ARG_ENABLE(iconv,
index 141e74bf75bb1cf3cf2311a3b751b76390f97bf3..4eb34cdd7a593fef68419b46bef176a93878d361 100644 (file)
@@ -1,22 +1,16 @@
 /*
  * This is a data store backend for the Citadel server which uses Berkeley DB.
  *
- * Copyright (c) 1987-2011 by the citadel.org team
+ * Copyright (c) 1987-2012 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
+ * modify it under the terms of the GNU General Public License version 3.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
  */
 
 /*****************************************************************************
@@ -43,6 +37,7 @@
 #include <sys/stat.h>
 #include <dirent.h>
 #include <syslog.h>
+#include <zlib.h>
 
 #ifdef HAVE_DB_H
 #include <db.h>
@@ -76,10 +71,6 @@ static DB *dbp[MAXCDB];              /* One DB handle for each Citadel database */
 static DB_ENV *dbenv;          /* The DB environment (global) */
 
 
-#ifdef HAVE_ZLIB
-#include <zlib.h>
-#endif
-
 
 /* Verbose logging callback */
 void cdb_verbose_log(const DB_ENV *dbenv, const char *msg)
@@ -283,9 +274,7 @@ void open_databases(void)
        CitControl.MMdbversion = current_dbversion;
        put_control();
 
-#ifdef HAVE_ZLIB
        syslog(LOG_INFO, "Linked zlib: %s\n", zlibVersion());
-#endif
 
        /*
         * Silently try to create the database subdirectory.  If it's
@@ -473,7 +462,7 @@ void close_databases(void)
 
 
 /*
- * Compression functions only used if we have zlib
+ * Decompress a database item if it was compressed on disk
  */
 void cdb_decompress_if_necessary(struct cdbdata *cdb)
 {
@@ -485,7 +474,6 @@ void cdb_decompress_if_necessary(struct cdbdata *cdb)
            (memcmp(cdb->ptr, &magic, sizeof(magic))))
            return;
 
-#ifdef HAVE_ZLIB
        /* At this point we know we're looking at a compressed item. */
 
        struct CtdlCompressHeader zheader;
@@ -518,11 +506,6 @@ void cdb_decompress_if_necessary(struct cdbdata *cdb)
        free(cdb->ptr);
        cdb->len = (size_t) destLen;
        cdb->ptr = uncompressed_data;
-#else                          /* HAVE_ZLIB */
-       syslog(LOG_EMERG, "Database contains compressed data, but this citserver was built without compression support.");
-       syslog(LOG_EMERG, "Please see http://www.citadel.org/doku.php/faq:installation:zlib for more information.");
-       exit(CTDLEXIT_DB);
-#endif                         /* HAVE_ZLIB */
 }
 
 
@@ -538,13 +521,11 @@ int cdb_store(int cdb, const void *ckey, int ckeylen, void *cdata, int cdatalen)
        DB_TXN *tid;
        int ret = 0;
 
-#ifdef HAVE_ZLIB
        struct CtdlCompressHeader zheader;
        char *compressed_data = NULL;
        int compressing = 0;
        size_t buffer_len = 0;
        uLongf destLen = 0;
-#endif
 
        memset(&dkey, 0, sizeof(DBT));
        memset(&ddata, 0, sizeof(DBT));
@@ -553,7 +534,6 @@ int cdb_store(int cdb, const void *ckey, int ckeylen, void *cdata, int cdatalen)
        ddata.size = cdatalen;
        ddata.data = cdata;
 
-#ifdef HAVE_ZLIB
        /* Only compress Visit records.  Everything else is uncompressed. */
        if (cdb == CDB_VISIT) {
                compressing = 1;
@@ -574,7 +554,6 @@ int cdb_store(int cdb, const void *ckey, int ckeylen, void *cdata, int cdatalen)
                ddata.size = (size_t) (sizeof(struct CtdlCompressHeader) + zheader.compressed_len);
                ddata.data = compressed_data;
        }
-#endif
 
        if (TSD->tid != NULL) {
                ret = dbp[cdb]->put(dbp[cdb],   /* db */
@@ -586,10 +565,8 @@ int cdb_store(int cdb, const void *ckey, int ckeylen, void *cdata, int cdatalen)
                        syslog(LOG_EMERG, "cdb_store(%d): %s", cdb, db_strerror(ret));
                        abort();
                }
-#ifdef HAVE_ZLIB
                if (compressing)
                        free(compressed_data);
-#endif
                return ret;
 
        } else {
@@ -612,11 +589,9 @@ int cdb_store(int cdb, const void *ckey, int ckeylen, void *cdata, int cdatalen)
                        }
                } else {
                        txcommit(tid);
-#ifdef HAVE_ZLIB
                        if (compressing) {
                                free(compressed_data);
                        }
-#endif
                        return ret;
                }
        }
index 6819bb28a03ad48f3558cec5b3cfec23492aa434..ba0d46d31d1a404be8e95ab624f9dd70f2677a97 100644 (file)
@@ -140,18 +140,23 @@ AC_CHECK_HEADER(CUnit/CUnit.h, [AC_DEFINE(ENABLE_TESTS, [], [whether we should c
 AC_CHECK_HEADERS(fcntl.h limits.h sys/time.h unistd.h iconv.h xlocale.h)
 
 dnl Checks for the zlib compression library.
-if test "x$with_zlib" != xno ; then
-       AC_CHECK_HEADERS(zlib.h,
-               [AC_CHECK_LIB(z, zlibVersion,
-                       [ok_zlib=yes],,
-       )])
-fi
-
-if test "x$ok_zlib" = xyes ; then
-dnl  libcitadel will bring libz, so we don't need it here.     LDFLAGS="-lz $LDFLAGS" 
-       AC_DEFINE(HAVE_ZLIB, [], [define this if you have zlib compression available])
-fi
-
+saved_CFLAGS="$CFLAGS"
+CFLAGS="$CFLAGS $SERVER_LIBS"
+AC_CHECK_HEADER(zlib.h,
+       [AC_CHECK_LIB(z, zlibVersion,
+               [
+                       LIBS="-lz $LIBS $SERVER_LIBS"
+               ],
+               [
+                       AC_MSG_ERROR(zlib was not found or is not usable.  Please install zlib.)
+               ]
+       ,
+       )],
+       [
+               AC_MSG_ERROR(zlib.h was not found or is not usable.  Please install zlib.)
+       ]
+)
+CFLAGS="$saved_CFLAGS"
 
 dnl Here is the check for a libc integrated iconv
 AC_ARG_ENABLE(iconv,
@@ -547,5 +552,4 @@ fi
 echo ------------------------------------------------------------------------
 echo 'Character set conversion support:' $ok_iconv
 echo 'National language support:       ' $ok_nls
-echo 'Compression support:             ' $ok_zlib
 echo 
index de01cf42b156ab51d80c66909094660767bc5362..c46e8b4b52d6ce8146d620694b4f3c7c94a316a2 100644 (file)
@@ -76,9 +76,7 @@
 #define DBG_QR(x) if(DO_DBG_QR) _DBG_QR(x)
 #define DBG_QR2(x) if(DO_DBG_QR) _DBG_QR2(x)
 
-#ifdef HAVE_ZLIB_H
 #include <zlib.h>
-#endif
 
 #include <libical/ical.h>