If you are using a Debian based system you could try:

sudo apt-get install libgd2-xpm-dev

In general look at the package description: http://hackage.haskell.org/package/gd-3000.7.3/gd.cabal

> Extra-libraries: gd, png, z, jpeg, m, fontconfig, freetype, expat
These extra libraries are required by the package and have to be installed using the system package manager, as Emanuel pointed out.