Hi!
It's a bug in configure, but after looking at config.log seems that workaround for you is different: try to locate libgd.so and add containing directory to /etc/ld.so.conf and then run ldconfig. For example, if libgd.so located in /usr/local/lib, just add a line /usr/local/lib to /etc/ld.so.conf.
Best regards,
Victor