MRTG Installation and Compilation Error

THESE ARE MY INFORMATION ABOUT MRTG AND LIBERIES.

I have mrtg version �mrtg-2.17.2�

Then after running

:rpm -qa | grep gcc

I got

gcc-4.4.4-13.el6.x86_64
  libgcc-4.4.4-13.el6.x86_64
  libgcc-4.4.4-13.el6.i686

Then after running

:rpm -qa | grep gd

I got

php-gd-5.3.2-6.el6.x86_64
  pulseaudio-gdm-hooks-0.9.21-13.el6.x86_64
  gd-2.0.35-10.el6.x86_64
  gdm-plugin-fingerprint-2.30.4-21.el6.x86_64
  eggdbus-0.6-3.el6.x86_64
  gdbm-1.8.0-36.el6.x86_64
  plymouth-gdm-hooks-0.8.3-17.el6.x86_64
  gdm-user-switch-applet-2.30.4-21.el6.x86_64
  gdb-7.1-29.el6.x86_64
  gdm-2.30.4-21.el6.x86_64
  gdm-libs-2.30.4-21.el6.x86_64

Then after running

:rpm -qa | grep libpng

I got

libpng-1.2.44-1.e16.x86_64

Then after running :

rpm -qa | grep perl

I got

perl-Package-Constants-0.02-115.el6.x86_64
  perl-Log-Message-Simple-0.04-115.el6.x86_64
  perl-Object-Accessor-0.34-115.el6.x86_64
  perl-URI-1.40-2.el6.noarch
  perl-Crypt-OpenSSL-Bignum-0.04-8.1.el6.x86_64
  perl-NetAddr-IP-4.027-3.el6.x86_64
  perl-XML-Twig-3.34-1.el6.noarch
  perl-Net-SSLeay-1.35-9.el6.x86_64
  perl-Config-General-2.44-1.el6.noarch
  perl-TimeDate-1.16-11.1.el6.noarch
  perl-5.10.1-115.el6.x86_64
  perl-Test-Harness-3.17-115.el6.x86_64
  perl-Crypt-SSLeay-0.57-16.el6.x86_64
  perl-Archive-Extract-0.38-115.el6.x86_64
  perl-CPAN-1.9402-115.el6.x86_64
  perl-XML-Dumper-0.81-6.el6.noarch
  perl-HTML-Tagset-3.20-4.el6.noarch
  perl-Pod-Escapes-1.04-115.el6.x86_64
  perl-Compress-Raw-Zlib-2.023-115.el6.x86_64
  perl-Params-Check-0.26-115.el6.x86_64
  perl-ExtUtils-MakeMaker-6.55-115.el6.x86_64
  perl-IPC-Cmd-0.56-115.el6.x86_64
  perl-IO-Zlib-1.09-115.el6.x86_64
  perl-File-Fetch-0.26-115.el6.x86_64
  perl-ExtUtils-CBuilder-0.27-115.el6.x86_64
  perl-Module-CoreList-2.18-115.el6.x86_64
  perl-Crypt-OpenSSL-RSA-0.25-10.1.el6.x86_64
  perl-SGMLSpm-1.03ii-21.el6.noarch
  perl-Module-Build-0.3500-115.el6.x86_64
  perl-BSD-Resource-1.29.03-3.el6.x86_64
  perl-Socket6-0.23-3.el6.x86_64
  perl-ExtUtils-Embed-1.28-115.el6.x86_64
  perl-Net-DNS-0.65-2.el6.x86_64
  perl-DBIx-Simple-1.32-3.el6.noarch
  perl-CPANPLUS-0.88-115.el6.x86_64
  perl-XML-Parser-2.36-7.el6.x86_64
  perl-Mail-DKIM-0.37-2.el6.noarch
  perl-Module-Pluggable-3.90-115.el6.x86_64
  perl-Time-HiRes-1.9721-115.el6.x86_64
  perl-ExtUtils-ParseXS-2.2003.0-115.el6.x86_64
  perl-Module-Load-Conditional-0.30-115.el6.x86_64
  perl-IO-Compress-Base-2.020-115.el6.x86_64
  perl-Compress-Zlib-2.020-115.el6.x86_64
  perl-Newt-1.08-26.el6.x86_64
  perl-Term-UI-0.20-115.el6.x86_64
  perl-Time-Piece-1.15-115.el6.x86_64
  perl-Net-LibIDN-0.12-3.el6.x86_64
  perl-Test-Simple-0.92-115.el6.x86_64
  perl-Digest-HMAC-1.01-22.el6.noarch
  perl-IO-Socket-SSL-1.31-2.el6.noarch
  perl-DBD-SQLite-1.27-3.el6.x86_64
  perl-Parse-CPAN-Meta-1.40-115.el6.x86_64
  perl-libwww-perl-5.833-2.el6.noarch
  perl-MailTools-2.04-4.el6.noarch
  perl-version-0.77-115.el6.x86_64
  perl-DBI-1.609-4.el6.x86_64
  perl-XML-Grove-0.46alpha-40.el6.noarch
  mod_perl-2.0.4-10.el6.x86_64
  perl-devel-5.10.1-115.el6.x86_64
  perl-Module-Load-0.16-115.el6.x86_64
  perl-IO-Compress-Zlib-2.020-115.el6.x86_64
  perl-DBD-MySQL-4.013-3.el6.x86_64
  perl-Digest-SHA1-2.12-2.el6.x86_64
  perl-HTML-Parser-3.64-2.el6.x86_64
  perl-libs-5.10.1-115.el6.x86_64
  perl-Locale-Maketext-Simple-0.18-115.el6.x86_64
  perl-Log-Message-0.02-115.el6.x86_64
  perl-Archive-Tar-1.58-115.el6.x86_64
  perl-Module-Loaded-0.02-115.el6.x86_64
  perl-Crypt-OpenSSL-Random-0.04-9.1.el6.x86_64
  perl-Encode-Detect-1.01-2.el6.x86_64
  perl-core-5.10.1-115.el6.x86_64
  perl-IO-Socket-INET6-2.56-4.el6.noarch
  perl-parent-0.221-115.el6.x86_64
  perl-libxml-perl-0.08-10.el6.noarch
  perl-Pod-Simple-3.13-115.el6.x86_64
  perl-Digest-SHA-5.47-115.el6.x86_64

Then after running

:rpm -qa | grep zlib

I got

zlib-1.2.3-25.el6.x86_64
  zlib-devel-1.2.3-25.el6.x86_64
   

so after extracting mrtg-2.17.2.tar.bz
I try to compile with

./configure -prefix=/usr/local/mrtg-2

which gave me following error:-

checking for gcc... gcc
  checking for C compiler default output file name... a.out
  checking whether the C compiler works... yes
  checking whether we are cross compiling... no
  checking for suffix of executables... 
  checking for suffix of object files... o
  checking whether we are using the GNU C compiler... yes
  checking whether gcc accepts -g... yes
  checking for gcc option to accept ISO C89... none needed
  checking how to run the C preprocessor... gcc -E
  checking whether make sets $(MAKE)... yes
  checking for a BSD-compatible install... /usr/bin/install -c
  checking for perl... /usr/bin/perl
  checking for groff... /usr/bin/groff
  checking for grep that handles long lines and -e... /bin/grep
  checking for egrep... /bin/grep -E
  checking for ANSI C header files... yes
  checking for sys/types.h... yes
  checking for sys/stat.h... yes
  checking for stdlib.h... yes
  checking for string.h... yes
  checking for memory.h... yes
  checking for strings.h... yes
  checking for inttypes.h... yes
  checking for stdint.h... yes
  checking for unistd.h... yes
  checking for inttypes.h... (cached) yes
  checking for unsigned long long... yes
  checking for long long... yes
  checking for strtoll... yes
  checking for printf long long format specifier... %lld
  checking for pow in -lm... yes
  checking for gdImageGif in -lgd... no
  checking for gdImagePng in -lgd... no
  checking for gdImagePng_jpg in -lgd... no
  checking for gdImagePng_jpg_ft in -lgd... no
  checking gd.h usability... no
  checking gd.h presence... no
  checking for gd.h... no
   
  ** Ooops, one of many bad things happened:
   
     a)  You don't have the GD library installed.
         Get it from http://www.boutell.com, compile it and
         use either --with-gd-lib=DIR and --with-gd-inc=DIR to specify
         its location. You might also have to use --with-z-inc,
                   --with-z-lib and --with-png-inc, --with-png-lib for gd
                   versions 1.6 and higher.  Check config.log for more
         information on the problem.
   
     b)  You have the GD library installed, but not the gd.h
         header file.  Download the source (see above) and use
         --with-gd-inc=DIR to specify where the file can be found.
   
     c)  You have the library and the header file installed, but
         you also have a shared GD library in the same directory. 
         Remove the shared library files and/or links (e.g. 
         libgd.so.2.0.0, libgd.so and libgd.so.2).  This is especially
                   likely if you're using a recent (post 1.8.4) version of GD
         and didn't configure it with --disable-shared.
   
     d)  You have gd library installed and also it's headers, but you are
         missing libpng (and headers) or freetype (and headers)
         (mrtg does not use freetype, but if your copy of gd is precompiled
         against it, you have to install it ... 
   
     Consider following the instructions in doc/mrtg-unix-guide.txt
   

Now I don't know where is the problem. What to compile?
What version of libraries should I use with mrtg-2.17.2?
Please guide me
My OS is rhel 6-64bit

---------- Post updated at 01:46 AM ---------- Previous update was at 01:39 AM ----------

 ** Ooops, one of many bad things happened:
   
     a)  You don't have the GD library installed.
         Get it from http://www.boutell.com, compile it and
         use either --with-gd-lib=DIR and --with-gd-inc=DIR to specify
         its location. You might also have to use --with-z-inc,
                   --with-z-lib and --with-png-inc, --with-png-lib for gd
                   versions 1.6 and higher.  Check config.log for more
         information on the problem.
   
     b)  You have the GD library installed, but not the gd.h
         header file.  Download the source (see above) and use
         --with-gd-inc=DIR to specify where the file can be found.
   
     c)  You have the library and the header file installed, but
         you also have a shared GD library in the same directory. 
         Remove the shared library files and/or links (e.g. 
         libgd.so.2.0.0, libgd.so and libgd.so.2).  This is especially
                   likely if you're using a recent (post 1.8.4) version of GD
         and didn't configure it with --disable-shared.
   
     d)  You have gd library installed and also it's headers, but you are
         missing libpng (and headers) or freetype (and headers)
         (mrtg does not use freetype, but if your copy of gd is precompiled
         against it, you have to install it ... 
   
     Consider following the instructions in doc/mrtg-unix-guide.txt

What is this telling?
Please guide me friends. I wan to solve this problems but don't have any idea bout this error. I hopefully have given all the required information about the packages that are installed and the OS type.

please install the

gd-devel rpm

Once installed, run

whereis gd.h

to make sure it installed the header file.

generally you require the corresponding devel packages when compiling stuff etc.