checking for MySQLi support... yes
checking whether to enable embedded MySQLi support... no
mysql_config not found
configure: error: Please reinstall the mysql distribution
I think it should be a PHP configuration issue, make sure to use the same configuration parameters reported by phpinfo() page produced by mod_php, minus apache related parameters.
/usr/local/lsws/phpbuild/php-5.2.6/main/reentrancy.c: In function `php_readdir_r':
/usr/local/lsws/phpbuild/php-5.2.6/main/reentrancy.c:139: error: too few arguments to function `readdir_r'
make: *** [main/reentrancy.lo] Error 1