From 03fad42e1d40ca3450e9a77578ee4858e30f9667 Mon Sep 17 00:00:00 2001
From: Matthew Pickering <matthewtpickering@gmail.com>
Date: Fri, 18 Aug 2023 14:54:51 +0100
Subject: [PATCH] configure: Set WindresCmd directly and removed unused
 variables

For some reason there was an indirection via the Windres variable before
setting WindresCmd. That indirection led to #23855.

I then also noticed that these other variables were just not used
anywhere when trying to work out what the correct condition was for this
bit of the configure script.
---
 configure.ac                     | 13 ++-----------
 distrib/configure.ac.in          |  7 -------
 m4/fp_setup_windows_toolchain.m4 |  2 +-
 3 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/configure.ac b/configure.ac
index 45a693d2a0b5..57a5c24b4faa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -357,28 +357,19 @@ else
     AC_PATH_TOOL([AR],[ar])
     AC_PATH_TOOL([RANLIB],[ranlib])
     AC_PATH_TOOL([OBJDUMP],[objdump])
-    AC_PATH_TOOL([Windres],[windres])
+    AC_PATH_TOOL([WindresCmd],[windres])
     AC_PATH_TOOL([Genlib],[genlib])
 
-    HAVE_GENLIB=False
     if test "$HostOS" = "mingw32"; then
-        AC_CHECK_TARGET_TOOL([Windres],[windres])
+        AC_CHECK_TARGET_TOOL([WindresCmd],[windres])
         AC_CHECK_TARGET_TOOL([OBJDUMP],[objdump])
 
         if test "$Genlib" != ""; then
             GenlibCmd="$(cygpath -m $Genlib)"
-            HAVE_GENLIB=True
         fi
     fi
 fi
 
-if test "$HostOS" = "mingw32"; then
-    WindresCmd="$Windres"
-    AC_SUBST([WindresCmd])
-    AC_SUBST([GenlibCmd])
-    AC_SUBST([HAVE_GENLIB])
-fi
-
 FP_ICONV
 FP_GMP
 FP_CURSES
diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in
index 5095af3ac2ff..d1493fff4591 100644
--- a/distrib/configure.ac.in
+++ b/distrib/configure.ac.in
@@ -107,13 +107,6 @@ if test "$HostOS" = "mingw32" -a "$EnableDistroToolchain" = "NO"; then
   FP_SETUP_WINDOWS_TOOLCHAIN([$hardtop/mingw/], [\$\$topdir/../mingw/])
 fi
 
-if test "$HostOS" = "mingw32"; then
-    WindresCmd="$Windres"
-    AC_SUBST([WindresCmd])
-    AC_SUBST([GenlibCmd])
-    AC_SUBST([HAVE_GENLIB])
-fi
-
 dnl ** Which gcc to use?
 dnl --------------------------------------------------------------
 AC_PROG_CC([gcc clang])
diff --git a/m4/fp_setup_windows_toolchain.m4 b/m4/fp_setup_windows_toolchain.m4
index ac79f2977dd4..7efd1fd57bbb 100644
--- a/m4/fp_setup_windows_toolchain.m4
+++ b/m4/fp_setup_windows_toolchain.m4
@@ -132,7 +132,7 @@ AC_DEFUN([FP_SETUP_WINDOWS_TOOLCHAIN],[
     RANLIB="${mingwbin}llvm-ranlib.exe"
     OBJDUMP="${mingwbin}llvm-objdump.exe"
     DLLTOOL="${mingwbin}llvm-dlltool.exe"
-    Windres="${mingwbin}llvm-windres.exe"
+    WindresCmd="${mingwbin}llvm-windres.exe"
 
     # N.B. LLD does not support -r
     MergeObjsCmd=""
-- 
GitLab