annotate m4/zlib.m4 @ 0:d39e1d0d75b6

initial add
author paulo@hit-nxdomain.opendns.com
date Sat, 20 Feb 2010 21:18:28 -0800
parents
children
rev   line source
paulo@0 1 ###############################################################################
paulo@0 2 ## $Id: zlib.m4,v 1.1 2003/09/17 22:26:07 hipnod Exp $
paulo@0 3 ###############################################################################
paulo@0 4
paulo@0 5 dnl
paulo@0 6 dnl Check for zlib in some bizarre locations...
paulo@0 7 dnl
paulo@0 8 AC_DEFUN([GIFT_PLUGIN_CHECK_ZLIB],
paulo@0 9 [
paulo@0 10 # set the minimum ZLIB_VER we're willing to link against...
paulo@0 11 ZLIB_VER=1.1.4
paulo@0 12
paulo@0 13 # for some reason Darwin has a 1.1.3 version with the 1.1.4 security fix
paulo@0 14 # applied backwards...
paulo@0 15 case "${host}" in
paulo@0 16 *-*-darwin* )
paulo@0 17 ZLIB_VER=1.1.3
paulo@0 18 ;;
paulo@0 19 esac
paulo@0 20
paulo@0 21 if test x"$OPT_ZLIB" = xno; then
paulo@0 22 zlib_ok=no
paulo@0 23 else
paulo@0 24 ZLIB_DIRS="$OPT_ZLIB /usr /usr/local /sw"
paulo@0 25 for ZLIB_DIR in $ZLIB_DIRS;
paulo@0 26 do
paulo@0 27 LIBS_SAVE="$LIBS"
paulo@0 28 CPPFLAGS_SAVE="$CPPFLAGS"
paulo@0 29 LIBS="$LIBS -L${ZLIB_DIR}/lib"
paulo@0 30 CPPFLAGS="$CPPFLAGS -I${ZLIB_DIR}/include"
paulo@0 31 AC_CACHE_CHECK(
paulo@0 32 [for zlib version ${ZLIB_VER}+ in ${ZLIB_DIR}],
paulo@0 33 zlib_ok,
paulo@0 34 AC_TRY_RUN(
paulo@0 35 [#include <zlib.h>
paulo@0 36 #include <string.h>
paulo@0 37 void main() {
paulo@0 38 exit(strcmp(ZLIB_VERSION, "${ZLIB_VER}") < 0);
paulo@0 39 }
paulo@0 40 ],
paulo@0 41 [zlib_ok=yes],
paulo@0 42 [zlib_ok=no],
paulo@0 43 [zlib_ok=yes]))
paulo@0 44
paulo@0 45 if test "$zlib_ok" != "no"; then
paulo@0 46 AC_CHECK_FUNC(gzread, , AC_CHECK_LIB(z, gzread))
paulo@0 47 AC_DEFINE(USE_ZLIB)
paulo@0 48 AC_SUBST(USE_ZLIB)
paulo@0 49 break
paulo@0 50 fi
paulo@0 51 LIBS="$LIBS_SAVE"
paulo@0 52 CPPFLAGS="$CPPFLAGS_SAVE"
paulo@0 53 done
paulo@0 54
paulo@0 55 if test "$zlib_ok" = "no"; then
paulo@0 56 AC_MSG_ERROR([
paulo@0 57 NOTE: The zlib compression library version ${ZLIB_VER} or greater was not found
paulo@0 58 on your system.
paulo@0 59
paulo@0 60 If zlib ${ZLIB_VER}+ is not installed, install it.
paulo@0 61 ])
paulo@0 62 fi
paulo@0 63 fi
paulo@0 64 ])