config0.m4 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. dnl config.m4 for extension zlib
  2. PHP_ARG_WITH(zlib,for ZLIB support,
  3. [ --with-zlib[=DIR] Include ZLIB support (requires zlib >= 1.2.0.4)])
  4. PHP_ARG_WITH(zlib-dir,if the location of ZLIB install directory is defined,
  5. [ --with-zlib-dir=<DIR> Define the location of zlib install directory], no, no)
  6. if test "$PHP_ZLIB" != "no" || test "$PHP_ZLIB_DIR" != "no"; then
  7. PHP_NEW_EXTENSION(zlib, zlib.c zlib_fopen_wrapper.c zlib_filter.c, $ext_shared,, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
  8. PHP_SUBST(ZLIB_SHARED_LIBADD)
  9. if test "$PHP_ZLIB" != "yes" -a "$PHP_ZLIB" != "no"; then
  10. if test -f $PHP_ZLIB/include/zlib/zlib.h; then
  11. ZLIB_DIR=$PHP_ZLIB
  12. ZLIB_INCDIR=$ZLIB_DIR/include/zlib
  13. elif test -f $PHP_ZLIB/include/zlib.h; then
  14. ZLIB_DIR=$PHP_ZLIB
  15. ZLIB_INCDIR=$ZLIB_DIR/include
  16. fi
  17. else
  18. for i in /usr/local /usr $PHP_ZLIB_DIR; do
  19. if test -f $i/include/zlib/zlib.h; then
  20. ZLIB_DIR=$i
  21. ZLIB_INCDIR=$i/include/zlib
  22. elif test -f $i/include/zlib.h; then
  23. ZLIB_DIR=$i
  24. ZLIB_INCDIR=$i/include
  25. fi
  26. done
  27. fi
  28. if test -z "$ZLIB_DIR"; then
  29. AC_MSG_ERROR(Cannot find zlib)
  30. fi
  31. case $ZLIB_DIR in
  32. /usr) ac_extra= ;;
  33. *) ac_extra=-L$ZLIB_DIR/$PHP_LIBDIR ;;
  34. esac
  35. AC_MSG_CHECKING([for zlib version >= 1.2.0.4])
  36. ZLIB_VERSION=`$EGREP "define ZLIB_VERSION" $ZLIB_INCDIR/zlib.h | $SED -e 's/[[^0-9\.]]//g'`
  37. AC_MSG_RESULT([$ZLIB_VERSION])
  38. if test `echo $ZLIB_VERSION | $SED -e 's/[[^0-9]]/ /g' | $AWK '{print $1*1000000 + $2*10000 + $3*100 + $4}'` -lt 1020004; then
  39. AC_MSG_ERROR([zlib version greater or equal to 1.2.0.4 required])
  40. fi
  41. PHP_CHECK_LIBRARY(z, gzgets, [
  42. AC_DEFINE(HAVE_ZLIB,1,[ ])
  43. ],[
  44. AC_MSG_ERROR(ZLIB extension requires gzgets in zlib)
  45. ],[
  46. $ac_extra
  47. ])
  48. PHP_ADD_LIBPATH($ZLIB_DIR/$PHP_LIBDIR, ZLIB_SHARED_LIBADD)
  49. PHP_ZLIB_DIR=$ZLIB_DIR
  50. PHP_ADD_LIBRARY(z,, ZLIB_SHARED_LIBADD)
  51. PHP_ADD_INCLUDE($ZLIB_INCDIR)
  52. fi