It doesn't seem to be a problem with your distribution but rather with the libraries you installed by hand.
/usr/local/include/jmorecfg.h /usr/local/include/gif_lib.h /usr/local/include/gif_lib.h
Are all in /usr/local which is never touched by any distribution but kept for your own personal binaries. It seems there is an incompatibility with the libgif headers you installed by hand.
Please try
./configure --without-gif
to verify and post your output again.