Two issues:
1) you need to remove old versions of libgd before you install new ones.
The message about the undefined gdImageGifAnimAddPtr comes when GD tries
to link to an old version of libgd that doesn't define this function.
2) when you built libgd, you didn't activate either PNG or JPEG
production. This will result in a gd library that can't do very much.
Lincoln