giflib 5.1

Compatibility with giflib < 5.1 and giflib >= 5.1
These ought to be inside the `#ifdef HAVE_GIF` block above, as they are not really valid when there is no giflib.