2008-06-29 14:29:36 +00:00
|
|
|
AC_DEFUN([AM_PATH_LIBZ],
|
|
|
|
[
|
|
|
|
AC_ARG_WITH([libz-prefix],
|
2011-02-18 13:34:38 +00:00
|
|
|
[ --with-libz-prefix=PREFIX Prefix where zlib installed (optional)],
|
2008-06-29 14:29:36 +00:00
|
|
|
[libz_prefix=$withval],
|
|
|
|
[libz_prefix=""])
|
|
|
|
|
|
|
|
if test "x$libz_prefix" = "x"; then
|
|
|
|
libz_prefix="/usr"
|
|
|
|
fi
|
|
|
|
|
|
|
|
LIBS_save=$LIBS
|
|
|
|
CPPFLAGS_save=$CPPFLAGS
|
2011-02-18 12:51:23 +00:00
|
|
|
PKG_CONFIG_PATH_save=$PKG_CONFIG_PATH
|
|
|
|
|
|
|
|
PKG_CONFIG_PATH="$libz_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
|
2011-02-18 13:34:38 +00:00
|
|
|
PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.3], [have_zlib=yes], [have_zlib=no])
|
2011-02-18 12:51:23 +00:00
|
|
|
|
2011-02-18 13:34:38 +00:00
|
|
|
if test "x$have_zlib" != "xyes"; then
|
2011-02-18 12:51:23 +00:00
|
|
|
libz_prefix_lib=$libz_prefix/lib
|
|
|
|
libz_prefix_include=$libz_prefix/include
|
2008-06-29 14:29:36 +00:00
|
|
|
|
2011-02-18 12:51:23 +00:00
|
|
|
LIBS="-L$libz_prefix_lib $LIBS"
|
|
|
|
CPPFLAGS="-I$libz_prefix_include $CPPFLAGS"
|
|
|
|
|
2011-02-18 13:34:38 +00:00
|
|
|
AC_CHECK_LIB([z], [zlibVersion], [have_zlib=yes])
|
|
|
|
if test "x$have_zlib" = "xyes"; then
|
2011-02-18 12:51:23 +00:00
|
|
|
ZLIB_LIBS="-L$libz_prefix_lib -lz"
|
|
|
|
ZLIB_CFLAGS="-I$libz_prefix_include"
|
|
|
|
fi
|
|
|
|
fi
|
2008-06-29 14:29:36 +00:00
|
|
|
|
2011-02-18 13:34:38 +00:00
|
|
|
if test "x$have_zlib" = "xyes"; then
|
|
|
|
AC_DEFINE([HAVE_ZLIB], [1], [Define to 1 if you have zlib.])
|
2008-06-29 14:29:36 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
LIBS=$LIBS_save
|
|
|
|
CPPFLAGS=$CPPFLAGS_save
|
2011-02-18 12:51:23 +00:00
|
|
|
PKG_CONFIG_PATH=$PKG_CONFIG_PATH_save
|
2008-06-29 14:29:36 +00:00
|
|
|
])
|