Working with i386-redhat-linux-gnu and Apache/1.3.26 (Unix), I found that the following configuration directives would die with an error in php_gd.lib:
./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs --enable-track-vars --enable-exif --with-gd=../gd-1.8.3 --with-jpeg-dir=../jpeg-6b/ --with-png-dir=../libpng-1.2.4 --with-zlib-dir=../zlib-1.1.4
I tried compiling with different versions of GD, but eventually the only solution was to drop from php-4.2.3 to php-4.2.2. The sources appear to be somewhat more stable.
The compilation of an earlier version went just fine and php now lives with GD support as required.