Problems with undefined function during install

I am trying to install Nagios on a Redhat Enterprise 3 server and have installed all the necessary packages. I have made sure that gd was installed in /usr as to over-ride the older version already installed but I am still having a problem during install. Here is the error:

gcc -g -O2 -DHAVE_CONFIG_H -DNSCGI -o statusmap.cgi statusmap.c getcgi.o cgiutils.o cgiauth.o objects-cgi.o xobjects-cgi.o statusdata-cgi.o xstatusdata-cgi.o -lgd -lz -lm -lpng
/tmp/ccDVZeNt.o(.text+0x35d5): In function load_image_from_file': /usr/local/src/nagios-2.0rc2/cgi/statusmap.c:2215: undefined reference togdImageCreateFromJpeg’
collect2: ld returned 1 exit status
make[1]: *** [statusmap.cgi] Error 1
make[1]: Leaving directory `/usr/local/src/nagios-2.0rc2/cgi’
make: *** [all] Error 2

Any help would be greatly appreciated.

but what was your ./configure options set to?
./configure --???
libjpeg is installed?