view m4/zlib.m4 @ 0:d39e1d0d75b6

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