config0.m4 1.9 KB

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