关于PHP配置: - with-zlib = DIR和--with-zlib-dir = DIR

from ./configure --help:

--with-zlib=DIR    Include ZLIB support (requires zlib >= 1.0.9)

--with-zlib-dir=<DIR>   Define the location of zlib install directory

first one: Why "--with-zlib" need a DIR ?

second one: does "Define the location of zlib install directory " mean "Define the location of directory of zlib which you have already installed in system" ?

what's the difference between "--with-zlib" and "--with-zlib-dir" ?

Well, first I think that you only have browsed the first part of ./confiure --help , because you may wonder when you figure out that:

hassan@hassan:/php/php-src$ ./configure --help | grep "zlib"
  --with-zlib=DIR         Include ZLIB support (requires zlib >= 1.0.9)
  --with-zlib-dir=<DIR>   Define the location of zlib install directory
  --with-zlib-dir=DIR     GD: Set the path to libz install prefix
  --with-zlib-dir=DIR     PDO_MySQL: Set the path to libz install prefix
  --with-zlib-dir=DIR     ZIP: Set the path to libz install prefix
  --with-zlib-dir=DIR     mysqlnd: Set the path to libz install prefix

so, --with-zlib[=DIR] is coming when you are willing to compile the zlib extension :

Zlib support in PHP is not enabled by default. You will need to configure PHP --with-zlib[=DIR]

otherwise --with-zlib-dir is used when you want to compile another extension which is need zlib , for example, when are you trying to compile PDO Mysql Driver from source :

Optionally, the --with-zlib-dir[=DIR] is used to set the path to the libz install prefix.