From: Karl Fleischmann Date: Thu, 4 Aug 2022 15:14:40 +0000 (+0200) Subject: global: Make zlib support required for compilation X-Git-Tag: 2.4.0~3661 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d666521754b024ce4f1cfee322fcc492673c00a5;p=thirdparty%2Fdovecot%2Fcore.git global: Make zlib support required for compilation 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. --- diff --git a/configure.ac b/configure.ac index fda8cbddf1..57c5d4f00e 100644 --- a/configure.ac +++ b/configure.ac @@ -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 index 242e5a537e..0000000000 --- a/m4/want_zlib.m4 +++ /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 index 0000000000..0973d27812 --- /dev/null +++ b/m4/zlib.m4 @@ -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]) + ]) +]) diff --git a/src/doveadm/doveadm-zlib.c b/src/doveadm/doveadm-zlib.c index d205f417b7..a370917a24 100644 --- a/src/doveadm/doveadm-zlib.c +++ b/src/doveadm/doveadm-zlib.c @@ -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", diff --git a/src/lib-compression/compression.c b/src/lib-compression/compression.c index dee9110b66..13f6191bff 100644 --- a/src/lib-compression/compression.c +++ b/src/lib-compression/compression.c @@ -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 diff --git a/src/lib-compression/istream-zlib.c b/src/lib-compression/istream-zlib.c index 3a975c34b0..123d7d67ea 100644 --- a/src/lib-compression/istream-zlib.c +++ b/src/lib-compression/istream-zlib.c @@ -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 diff --git a/src/lib-compression/ostream-zlib.c b/src/lib-compression/ostream-zlib.c index 72679174a3..d429ad263c 100644 --- a/src/lib-compression/ostream-zlib.c +++ b/src/lib-compression/ostream-zlib.c @@ -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 diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index 2be974271f..9563f94e22 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -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) \