Support for giflib 5+

Not thoroughly tested but should work for giflib version 4.x and 5.x