configure: try to detect zlib simply via -lz if no pkg-config module installed for it

This can happen e.g. on Mac OS.
This commit is contained in:
Moritz Bunkus 2015-04-29 21:50:47 +02:00
parent 86ee6ce6a9
commit cbdef0301a

View File

@ -2,7 +2,20 @@ dnl
dnl Check for zlib
dnl
PKG_CHECK_MODULES([ZLIB],[zlib],[zlib_found=yes])
PKG_CHECK_EXISTS([zlib],[zlib_found=yes],[zlib_found=no])
if test x"$zlib_found" = xyes; then
PKG_CHECK_MODULES([ZLIB],[zlib],[zlib_found=yes])
else
AC_MSG_CHECKING(for ZLIB)
save_LIBS="$LIBS"
LIBS="$LIBS -lz"
AC_TRY_LINK(
[#include <zlib.h>],
[inflate(0, 0);],
[zlib_found=yes; ZLIB_LIBS=-lz])
LIBS="$save_LIBS"
AC_MSG_RESULT($zlib_found)
fi
if test x"$zlib_found" != xyes; then
AC_MSG_ERROR([Could not find the zlib library])