xref: /PHP-5.3/ext/zlib/config0.m4 (revision af49e58f)
1dnl
2dnl $Id$
3dnl
4
5PHP_ARG_WITH(zlib,for ZLIB support,
6[  --with-zlib[=DIR]       Include ZLIB support (requires zlib >= 1.0.9)])
7
8PHP_ARG_WITH(zlib-dir,if the location of ZLIB install directory is defined,
9[  --with-zlib-dir=<DIR>   Define the location of zlib install directory], no, no)
10
11if test "$PHP_ZLIB" != "no" || test "$PHP_ZLIB_DIR" != "no"; then
12  PHP_NEW_EXTENSION(zlib, zlib.c zlib_fopen_wrapper.c zlib_filter.c, $ext_shared)
13  PHP_SUBST(ZLIB_SHARED_LIBADD)
14
15  if test "$PHP_ZLIB" != "yes" -a "$PHP_ZLIB" != "no"; then
16    if test -f $PHP_ZLIB/include/zlib/zlib.h; then
17      ZLIB_DIR=$PHP_ZLIB
18      ZLIB_INCDIR=$ZLIB_DIR/include/zlib
19    elif test -f $PHP_ZLIB/include/zlib.h; then
20      ZLIB_DIR=$PHP_ZLIB
21      ZLIB_INCDIR=$ZLIB_DIR/include
22    fi
23  else
24    for i in /usr/local /usr $PHP_ZLIB_DIR; do
25      if test -f $i/include/zlib/zlib.h; then
26        ZLIB_DIR=$i
27        ZLIB_INCDIR=$i/include/zlib
28      elif test -f $i/include/zlib.h; then
29        ZLIB_DIR=$i
30        ZLIB_INCDIR=$i/include
31      fi
32    done
33  fi
34
35  if test -z "$ZLIB_DIR"; then
36    AC_MSG_ERROR(Cannot find libz)
37  fi
38
39  case $ZLIB_DIR in
40  /usr) ac_extra= ;;
41  *) ac_extra=-L$ZLIB_DIR/$PHP_LIBDIR ;;
42  esac
43
44  PHP_CHECK_LIBRARY(z, gzgets, [
45    AC_DEFINE(HAVE_ZLIB,1,[ ])
46  ],[
47    AC_MSG_ERROR(ZLIB extension requires zlib >= 1.0.9)
48  ],[
49    $ac_extra
50  ])
51
52  PHP_ADD_LIBPATH($ZLIB_DIR/$PHP_LIBDIR, ZLIB_SHARED_LIBADD)
53
54  PHP_ZLIB_DIR=$ZLIB_DIR
55  PHP_ADD_LIBRARY(z,, ZLIB_SHARED_LIBADD)
56  PHP_ADD_INCLUDE($ZLIB_INCDIR)
57
58fi
59