xref: /PHP-7.2/ext/zlib/config0.m4 (revision 902d39a3)
1dnl
2dnl $Id$
3dnl
4
5PHP_ARG_WITH(zlib,for ZLIB support,
6[  --with-zlib[=DIR]         Include ZLIB support (requires zlib >= 1.2.0.4)])
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,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
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 zlib)
37  fi
38
39  case $ZLIB_DIR in
40  /usr) ac_extra= ;;
41  *) ac_extra=-L$ZLIB_DIR/$PHP_LIBDIR ;;
42  esac
43
44  AC_MSG_CHECKING([for zlib version >= 1.2.0.4])
45  ZLIB_VERSION=`$EGREP "define ZLIB_VERSION" $ZLIB_INCDIR/zlib.h | $SED -e 's/[[^0-9\.]]//g'`
46  AC_MSG_RESULT([$ZLIB_VERSION])
47  if test `echo $ZLIB_VERSION | $SED -e 's/[[^0-9]]/ /g' | $AWK '{print $1*1000000 + $2*10000 + $3*100 + $4}'` -lt 1020004; then
48    AC_MSG_ERROR([zlib version greater or equal to 1.2.0.4 required])
49  fi
50
51  PHP_CHECK_LIBRARY(z, gzgets, [
52    AC_DEFINE(HAVE_ZLIB,1,[ ])
53  ],[
54    AC_MSG_ERROR(ZLIB extension requires gzgets in zlib)
55  ],[
56    $ac_extra
57  ])
58
59  PHP_ADD_LIBPATH($ZLIB_DIR/$PHP_LIBDIR, ZLIB_SHARED_LIBADD)
60
61  PHP_ZLIB_DIR=$ZLIB_DIR
62  PHP_ADD_LIBRARY(z,, ZLIB_SHARED_LIBADD)
63  PHP_ADD_INCLUDE($ZLIB_INCDIR)
64
65fi
66