Subject: [PATCH] * configure.ac: Fix --without-gif for W32, NS, Haiku, and PGTK.

From: Randy Taylor <[email-masked]>
Date: Wed, 30 Mar 2022 01:45:16 +0000

--without-gif was only checked against X11; with this patch it is now checked against all the options.

From 3fa7d851d2e2925132114e4d33edd37f28143812 Mon Sep 17 00:00:00 2001
From: Randy Taylor <[email-masked]>
Date: Tue, 29 Mar 2022 20:59:18 -0400
Subject: [PATCH] * configure.ac: Fix --without-gif for W32, NS, Haiku, and
 PGTK.

Copyright-paperwork-exempt: yes
---
 configure.ac | 38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/configure.ac b/configure.ac
index 10358c2b64..2f998ca4ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4288,25 +4288,27 @@ AC_DEFUN
   if test "${HAVE_GIF}" = "yes"; then
     AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif (or ungif) library.])
   fi
-elif test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no" \
-        || test "${HAVE_W32}" = "yes" || test "${HAVE_NS}" = "yes" \
-	|| test "${HAVE_BE_APP}" = "yes" || test "$window_system" = "pgtk"; then
-  AC_CHECK_HEADER(gif_lib.h,
-# EGifPutExtensionLast only exists from version libungif-4.1.0b1.
-# Earlier versions can crash Emacs, but version 5.0 removes EGifPutExtensionLast.
-    [AC_CHECK_LIB(gif, GifMakeMapObject, HAVE_GIF=yes,
-        [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=maybe)])])
-
-  if test "$HAVE_GIF" = yes; then
-    LIBGIF=-lgif
-  elif test "$HAVE_GIF" = maybe; then
-# If gif_lib.h but no libgif, try libungif.
-    AC_CHECK_LIB(ungif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=no)
-    test "$HAVE_GIF" = yes && LIBGIF=-lungif
-  fi
+elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes" \
+     || test "${HAVE_NS}" = "yes" || test "${HAVE_BE_APP}" = "yes" \
+     || test "$window_system" = "pgtk"; then
+  if test "${with_gif}" != "no"; then
+    AC_CHECK_HEADER(gif_lib.h,
+      # EGifPutExtensionLast only exists from version libungif-4.1.0b1.
+      # Earlier versions can crash Emacs, but version 5.0 removes EGifPutExtensionLast.
+      [AC_CHECK_LIB(gif, GifMakeMapObject, HAVE_GIF=yes,
+          [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=maybe)])])
+
+    if test "$HAVE_GIF" = yes; then
+      LIBGIF=-lgif
+    elif test "$HAVE_GIF" = maybe; then
+      # If gif_lib.h but no libgif, try libungif.
+      AC_CHECK_LIB(ungif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=no)
+      test "$HAVE_GIF" = yes && LIBGIF=-lungif
+    fi
 
-  if test "${HAVE_GIF}" = "yes"; then
-    AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif (or ungif) library.])
+    if test "${HAVE_GIF}" = "yes"; then
+      AC_DEFINE(HAVE_GIF, 1, [Define to 1 if you have a gif (or ungif) library.])
+    fi
   fi
 fi
 AC_SUBST(LIBGIF)
-- 
2.35.1