--- src/modules/loaders/loader_gif.c.orig
+++ src/modules/loaders/loader_gif.c
@@ -40,7 +40,11 @@ load(ImlibImage * im, ImlibProgressFunct
 #endif
    if (fd < 0)
       return 0;
+#if defined(GIFLIB_MAJOR) && (GIFLIB_MAJOR >= 5)
+   gif = DGifOpenFileHandle(fd, NULL);
+#else
    gif = DGifOpenFileHandle(fd);
+#endif
    if (!gif)
      {
         close(fd);
