Plumb WITH_ZLIB into configure.

This allows zlib support to be disabled by ./configure --without-zlib.
This commit is contained in:
Darren Tucker 2020-01-23 22:16:51 +11:00
parent 7f8e66fea8
commit 633a2af47e
1 changed files with 18 additions and 10 deletions

View File

@ -1287,11 +1287,12 @@ AC_CHECK_FUNC([getspnam], ,
AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1], AC_SEARCH_LIBS([basename], [gen], [AC_DEFINE([HAVE_BASENAME], [1],
[Define if you have the basename function.])]) [Define if you have the basename function.])])
dnl zlib is required dnl zlib defaults to enabled
zlib=yes
AC_ARG_WITH([zlib], AC_ARG_WITH([zlib],
[ --with-zlib=PATH Use zlib in PATH], [ --with-zlib=PATH Use zlib in PATH],
[ if test "x$withval" = "xno" ; then [ if test "x$withval" = "xno" ; then
AC_MSG_ERROR([*** zlib is required ***]) zlib=no
elif test "x$withval" != "xyes"; then elif test "x$withval" != "xyes"; then
if test -d "$withval/lib"; then if test -d "$withval/lib"; then
if test -n "${rpath_opt}"; then if test -n "${rpath_opt}"; then
@ -1314,8 +1315,14 @@ AC_ARG_WITH([zlib],
fi ] fi ]
) )
AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])]) AC_MSG_CHECKING([for zlib])
AC_CHECK_LIB([z], [deflate], , if test "x${zlib}" = "xno"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
AC_DEFINE([WITH_ZLIB], [1], [Enable zlib])
AC_CHECK_HEADER([zlib.h], ,[AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***])])
AC_CHECK_LIB([z], [deflate], ,
[ [
saved_CPPFLAGS="$CPPFLAGS" saved_CPPFLAGS="$CPPFLAGS"
saved_LDFLAGS="$LDFLAGS" saved_LDFLAGS="$LDFLAGS"
@ -1334,18 +1341,18 @@ AC_CHECK_LIB([z], [deflate], ,
] ]
) )
] ]
) )
AC_ARG_WITH([zlib-version-check], AC_ARG_WITH([zlib-version-check],
[ --without-zlib-version-check Disable zlib version check], [ --without-zlib-version-check Disable zlib version check],
[ if test "x$withval" = "xno" ; then [ if test "x$withval" = "xno" ; then
zlib_check_nonfatal=1 zlib_check_nonfatal=1
fi fi
] ]
) )
AC_MSG_CHECKING([for possibly buggy zlib]) AC_MSG_CHECKING([for possibly buggy zlib])
AC_RUN_IFELSE([AC_LANG_PROGRAM([[ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <zlib.h> #include <zlib.h>
@ -1383,7 +1390,8 @@ See http://www.gzip.org/zlib/ for details.])
fi fi
], ],
[ AC_MSG_WARN([cross compiling: not checking zlib version]) ] [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
) )
fi
dnl UnixWare 2.x dnl UnixWare 2.x
AC_CHECK_FUNC([strcasecmp], AC_CHECK_FUNC([strcasecmp],