Compiling PECL extensions statically into PHP

To statically include the extension within the PHP build, put the extensions source into the ext/ directory found in the PHP source. For example:

$ cd /your/phpsrcdir/ext
$ pear download extname
$ gzip -d < extname.tgz | tar -xvf -
$ mv extname-x.x.x extname
$ rm package.xml

This will result in the following directory:

/your/phpsrcdir/ext/extname

From here, build PHP as normal:

$ cd /your/phpsrcdir 
$ ./buildconf
$ ./configure --help
$ ./configure --with-extname --enable-someotherext --with-foobar
$ make
$ make install

Whether --enable-extname or --with-extname is used depends on the extension. Typically an extension that does not require external libraries uses --enable. To be sure, run the following after buildconf:

$ ./configure --help | grep extname