If you have multiple PHP versions installed, you may be able to specify for which installation you'd like to build by using the --with-php-config option during configuration.
--with-php-config=[Insert path to proper php-config here]
For example (my case):
./configure --with-php-config=/usr/local/php5/bin/php-config5