From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: linux-erofs@lists.ozlabs.org
Cc: Gao Xiang <hsiangkao@linux.alibaba.com>
Subject: [PATCH 1/2] erofs-utils: support zlib auto-detection
Date: Wed, 21 Feb 2024 01:16:59 +0800 [thread overview]
Message-ID: <20240220171700.3693176-1-hsiangkao@linux.alibaba.com> (raw)
Fix explicit `--with-zlib` so that it errors out when zlib
is unavailable.
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
---
configure.ac | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/configure.ac b/configure.ac
index bf6e99f..cd14beb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -124,7 +124,7 @@ AC_ARG_ENABLE(lzma,
AC_ARG_WITH(zlib,
[AS_HELP_STRING([--without-zlib],
- [Ignore presence of zlib inflate support @<:@default=enabled@:>@])])
+ [Ignore presence of zlib inflate support @<:@default=auto@:>@])])
AC_ARG_WITH(libdeflate,
[AS_HELP_STRING([--with-libdeflate],
@@ -426,18 +426,29 @@ if test "x$enable_lzma" = "xyes"; then
fi
# Configure zlib
+have_zlib="no"
AS_IF([test "x$with_zlib" != "xno"], [
- PKG_CHECK_MODULES([zlib], [zlib])
- # Paranoia: don't trust the result reported by pkgconfig before trying out
- saved_LIBS="$LIBS"
- saved_CPPFLAGS=${CPPFLAGS}
- CPPFLAGS="${zlib_CFLAGS} ${CPPFLAGS}"
- LIBS="${zlib_LIBS} $LIBS"
- AC_CHECK_LIB(z, inflate, [
- have_zlib="yes" ], [
- AC_MSG_ERROR([zlib doesn't work properly])])
- LIBS="${saved_LIBS}"
- CPPFLAGS="${saved_CPPFLAGS}"], [have_zlib="no"])
+ PKG_CHECK_MODULES([zlib], [zlib], [
+ # Paranoia: don't trust the result reported by pkgconfig before trying out
+ saved_LIBS="$LIBS"
+ saved_CPPFLAGS=${CPPFLAGS}
+ CPPFLAGS="${zlib_CFLAGS} ${CPPFLAGS}"
+ LIBS="${zlib_LIBS} $LIBS"
+ AC_CHECK_HEADERS([zlib.h],[
+ AC_CHECK_LIB(z, inflate, [], [
+ AC_MSG_ERROR([zlib doesn't work properly])])
+ AC_CHECK_DECL(inflate, [have_zlib="yes"],
+ [AC_MSG_ERROR([zlib doesn't work properly])], [[
+#include <zlib.h>
+ ]])
+ ])
+ LIBS="${saved_LIBS}"
+ CPPFLAGS="${saved_CPPFLAGS}"], [
+ AS_IF([test "x$with_zlib" = "xyes"], [
+ AC_MSG_ERROR([Cannot find proper zlib])
+ ])
+ ])
+])
# Configure libdeflate
AS_IF([test "x$with_libdeflate" != "xno"], [
--
2.39.3
next reply other threads:[~2024-02-20 17:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-20 17:16 Gao Xiang [this message]
2024-02-20 17:17 ` [PATCH 2/2] erofs-utils: support liblzma auto-detection Gao Xiang
2024-02-21 5:51 ` [PATCH v2 " Gao Xiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240220171700.3693176-1-hsiangkao@linux.alibaba.com \
--to=hsiangkao@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).