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,
/*
* 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
- *
*/
/*****************************************************************************
#include <sys/stat.h>
#include <dirent.h>
#include <syslog.h>
+#include <zlib.h>
#ifdef HAVE_DB_H
#include <db.h>
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)
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
/*
- * 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)
{
(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;
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 */
}
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));
ddata.size = cdatalen;
ddata.data = cdata;
-#ifdef HAVE_ZLIB
/* Only compress Visit records. Everything else is uncompressed. */
if (cdb == CDB_VISIT) {
compressing = 1;
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 */
syslog(LOG_EMERG, "cdb_store(%d): %s", cdb, db_strerror(ret));
abort();
}
-#ifdef HAVE_ZLIB
if (compressing)
free(compressed_data);
-#endif
return ret;
} else {
}
} else {
txcommit(tid);
-#ifdef HAVE_ZLIB
if (compressing) {
free(compressed_data);
}
-#endif
return ret;
}
}
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,
echo ------------------------------------------------------------------------
echo 'Character set conversion support:' $ok_iconv
echo 'National language support: ' $ok_nls
-echo 'Compression support: ' $ok_zlib
echo