The config.m4 file
contains the code that will go into the configure script. This includes
the switch that enables the extension (e.g.,
--with-rot13), the name of the shared library
to build, code to search for prerequisite libraries, and much more. The
skeletal config.m4 file contains
sample code for the various things you might want to do, but it is
There are conventions governing the configure switch to enable
your extension. If your extension does not rely on any external
--enable-foo. If it
does have some non-bundled dependencies , such as a library, use
--with-foo. Optionally, you can specify a base
which helps configure find the dependencies.
PHP uses the grand unifying scheme of autoconf, automake, and libtool to build extensions. These three tools, used together, can be extremely powerful, but they can also be extremely frustrating. Getting this stuff right is a bit of a black art. When an extension is part of the PHP source tree and you run the buildconf script in the top directory of the tree, it scans through all its subdirectories looking for config.m4 files. It grabs all the config.m4 files and creates a single configure script that contains all the configure switches. This means that each extension needs to implement its own configure checks to check for whatever dependencies and system-level features might be needed to build the extension.
These checks are done through ...