Skip to content

Commit

Permalink
Avoid AC_CHECK_LIB(deflate)'s default ACTION-IF-FOUND behaviour
Browse files Browse the repository at this point in the history
The other foo_devel=ok/etc tests that do separate AC_CHECK_HEADER/
AC_CHECK_LIB checks with the default AC_CHECK_LIB ACTION-IF-FOUND
always instantly fail if either header or library is missing.

However for libdeflate this is only the case for --with-libdeflate=yes.
By default or with --with-libdeflate=check, the intention is to carry on
as per --without-libdeflate when either header or library is missing.

For the case when libdeflate.h is missing but the library is found
(admittedly an odd case!), the default AC_CHECK_LIB ACTION-IF-FOUND
also defines HAVE_LIBDEFLATE -- leading to later build failures as we
(ab)use that macro to mean both HAVE_LIBDEFLATE_H and HAVE_LIBDEFLATE.

Instead use a no-op found action, and only AC_DEFINE(HAVE_LIBDEFLATE)
and add to $LIBS when *both* checks have succeeded.
  • Loading branch information
jmarshall committed Jul 28, 2019
1 parent 49058f4 commit 3472494
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,10 @@ fi
AS_IF([test "x$with_libdeflate" != "xno"],
[libdeflate=ok
AC_CHECK_HEADER([libdeflate.h],[],[libdeflate='missing header'],[;])
AC_CHECK_LIB([deflate], [libdeflate_deflate_compress],[],[libdeflate='missing library'])
AC_CHECK_LIB([deflate], [libdeflate_deflate_compress],[:],[libdeflate='missing library'])
AS_IF([test "$libdeflate" = "ok"],
[AC_DEFINE([HAVE_LIBDEFLATE], 1, [Define if libdeflate is available.])
LIBS="-ldeflate $LIBS"
private_LIBS="$private_LIBS -ldeflate"
static_LIBS="$static_LIBS -ldeflate"],
[AS_IF([test "x$with_libdeflate" != "xcheck"],
Expand Down

0 comments on commit 3472494

Please sign in to comment.