Are you trying to get GD to work within PHP, or are you simply trying to get GD to work, period? PHP has an internal GD kit, that may be all your need if you are looking to use it within PHP. When you compile, you would need the --with-gd switch, when you run ./configure
Once you get done running ./configure, make, make test, make install, the create a small php script like this:
<?php phpinfo(); ?>
Put it in your webserver root, then run it through the browser. Look for the GD section. It will tell you what it all supports.
Depending on how lucky you are, you could find every image type library you need installed. Otherwise, it gets a lot trickier...