]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Make zlib support required for compilation
authorKarl Fleischmann <karl.fleischmann@open-xchange.com>
Thu, 4 Aug 2022 15:14:40 +0000 (17:14 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 15 Aug 2022 07:34:57 +0000 (07:34 +0000)
As zlib is virtually universally available and with version v3.0 dovecot
will require important libraries by default it makes sense to start
requiring this particular library as well.

configure.ac
m4/want_zlib.m4 [deleted file]
m4/zlib.m4 [new file with mode: 0644]
src/doveadm/doveadm-zlib.c
src/lib-compression/compression.c
src/lib-compression/istream-zlib.c
src/lib-compression/ostream-zlib.c
src/plugins/Makefile.am

index fda8cbddf12710e376ad8d75d41c5aad8a45de5e..57c5d4f00e04ec69c3bdec8e95b6737401dd11fb 100644 (file)
@@ -164,11 +164,6 @@ AS_HELP_STRING([--with-sodium], [Build with libsodium support (enables argon2, d
   TEST_WITH(sodium, $withval),
   want_sodium=auto)
 
-AC_ARG_WITH(zlib,
-AS_HELP_STRING([--with-zlib], [Build with zlib compression support (auto)]),
-  TEST_WITH(zlib, $withval),
-  want_zlib=auto)
-
 AC_ARG_WITH(bzlib,
 AS_HELP_STRING([--with-bzlib], [Build with bzlib compression support (auto)]),
   TEST_WITH(bzlib, $withval),
@@ -657,15 +652,13 @@ dnl **
 
 COMPRESS_LIBS=
 
-DOVECOT_WANT_ZLIB
+DOVECOT_ZLIB
 DOVECOT_WANT_BZLIB
 DOVECOT_WANT_LZ4
 DOVECOT_WANT_ZSTD
 
 AC_SUBST(COMPRESS_LIBS)
 
-AM_CONDITIONAL(BUILD_ZLIB_PLUGIN, test "$have_compress_lib" = "yes")
-
 DOVECOT_RPCGEN
 DOVECOT_QUOTA
 
diff --git a/m4/want_zlib.m4 b/m4/want_zlib.m4
deleted file mode 100644 (file)
index 242e5a5..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-AC_DEFUN([DOVECOT_WANT_ZLIB], [
-  have_zlib=no
-
-  AS_IF([test "$want_zlib" != "no"], [
-    PKG_CHECK_MODULES([ZLIB], [zlib], [have_zlib=yes], [
-      have_zlib=no
-
-      AS_IF([test "$want_zlib" = "yes"], [
-        AC_MSG_ERROR([cannot build with zlib support: zlib library not found])
-      ])
-    ])
-  ])
-
-  AS_IF([test "$have_zlib" != "no"], [
-    have_compress_lib=yes
-    COMPRESS_LIBS="$COMPRESS_LIBS $ZLIB_LIBS"
-    AC_DEFINE(HAVE_ZLIB,, [Define if you have zlib library])
-  ])
-])
diff --git a/m4/zlib.m4 b/m4/zlib.m4
new file mode 100644 (file)
index 0000000..0973d27
--- /dev/null
@@ -0,0 +1,8 @@
+AC_DEFUN([DOVECOT_ZLIB], [
+  PKG_CHECK_MODULES([ZLIB], [zlib], [
+    have_compress_lib=yes
+    COMPRESS_LIBS="$COMPRESS_LIBS $ZLIB_LIBS"
+  ], [
+    AC_MSG_ERROR([cannot build with zlib support: zlib library not found])
+  ])
+])
index d205f417b74ebc3186a075219b7017c16d329d16..a370917a24cb4962aea94668ea3b25a93557f48b 100644 (file)
@@ -41,7 +41,6 @@ static bool test_dump_imapzlib(const char *path)
        return match;
 }
 
-#ifdef HAVE_ZLIB
 static void
 cmd_dump_imapzlib(const char *path, const char *const *args ATTR_UNUSED)
 {
@@ -268,19 +267,6 @@ static void cmd_zlibconnect(struct doveadm_cmd_context *cctx)
        if (close(fd) < 0)
                i_fatal("close() failed: %m");
 }
-#else
-static void
-cmd_dump_imapzlib(const char *path ATTR_UNUSED,
-                 const char *const *args ATTR_UNUSED)
-{
-       i_fatal("Dovecot compiled without zlib support");
-}
-
-static void cmd_zlibconnect(struct doveadm_cmd_context *cctx ATTR_UNUSED)
-{
-       i_fatal("Dovecot compiled without zlib support");
-}
-#endif
 
 struct doveadm_cmd_dump doveadm_cmd_dump_zlib = {
        "imapzlib",
index dee9110b6689eeff0c87b97337cdd90fd579d349..13f6191bff27946e998f4f543241760e9ee6a8f7 100644 (file)
@@ -7,15 +7,6 @@
 #include "iostream-lz4.h"
 #include "compression.h"
 
-#ifndef HAVE_ZLIB
-#  define i_stream_create_gz NULL
-#  define o_stream_create_gz NULL
-#  define i_stream_create_deflate NULL
-#  define o_stream_create_deflate NULL
-#  define compression_get_min_level_gz NULL
-#  define compression_get_default_level_gz NULL
-#  define compression_get_max_level_gz NULL
-#endif
 #ifndef HAVE_BZLIB
 #  define i_stream_create_bz2 NULL
 #  define o_stream_create_bz2 NULL
index 3a975c34b0f826a968c4ea229e34fc68aac7f4c8..123d7d67eabf125508262b90daab59f488330dbf 100644 (file)
@@ -1,9 +1,6 @@
 /* Copyright (c) 2010-2018 Dovecot authors, see the included COPYING file */
 
 #include "lib.h"
-
-#ifdef HAVE_ZLIB
-
 #include "crc32.h"
 #include "istream-private.h"
 #include "istream-zlib.h"
@@ -428,4 +425,3 @@ struct istream *i_stream_create_deflate(struct istream *input)
 {
        return i_stream_create_zlib(input, FALSE);
 }
-#endif
index 72679174a3c682b94688dd5c5042593c7af67f3e..d429ad263c4f70391d4cacc1a8310705023673e4 100644 (file)
@@ -1,9 +1,6 @@
 /* Copyright (c) 2010-2018 Dovecot authors, see the included COPYING file */
 
 #include "lib.h"
-
-#ifdef HAVE_ZLIB
-
 #include "crc32.h"
 #include "ostream-private.h"
 #include "ostream-zlib.h"
@@ -389,4 +386,3 @@ struct ostream *o_stream_create_deflate(struct ostream *output, int level)
 {
        return o_stream_create_zlib(output, level, FALSE);
 }
-#endif
index 2be974271fd88fdcbfd939fd96864de5ea9839eb..9563f94e22de3f55a14266c1d318f0fd7a2e4af9 100644 (file)
@@ -1,7 +1,3 @@
-if BUILD_ZLIB_PLUGIN
-ZLIB = zlib imap-zlib
-endif
-
 if BUILD_SOLR
 FTS_SOLR = fts-solr
 endif
@@ -39,7 +35,8 @@ SUBDIRS = \
        trash \
        virtual \
        welcome \
-       $(ZLIB) \
+       zlib \
+       imap-zlib \
        $(FTS_SOLR) \
        $(FTS_FLATCURVE) \
        $(DICT_LDAP) \