Yeah well i had the same problem too. I'm not sure about you, but when I installed php 5 i didn't get any extensions. So i just needed to enable gd in ./configure. I did it with ./configure --with-gd, but if you want to see all specific gd flags you should try ./configure --help | grep -i gd.
If you're interested, this is the full command i used to configure my PHP 5:
./configure --enable-sockets --with-gd --enable-pcntl --with-mysql=/usr/local/www/mysql --with-apxs2=/usr/local/httpd/bin/apxs --with-zlib-dir=/usr --with-freetype-dir=/usr
Hope this helps you