]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Driver: Implement --with-windres= argument to configure script [PR108866]
authorPeter Damianov <peter0x44@disroot.org>
Thu, 11 Dec 2025 01:52:43 +0000 (01:52 +0000)
committerJonathan Yong <10walls@gmail.com>
Mon, 15 Dec 2025 14:56:43 +0000 (14:56 +0000)
To align with the rest of the options (--with-ld, --with-as, --with-dsymutil),
implement --with-windres for overriding the windres binary the driver invokes
with an absolute path to a windres binary.

gcc/
PR target/108866
* gcc.cc (find_a_program): Add check for DEFAULT_WINDRES.
* configure.ac: Add --with-windres= option.
* config.in: Regenerate.
* configure: Regenerate.

Signed-off-by: Peter Damianov <peter0x44@disroot.org>
Signed-off-by: Jonathan Yong <10walls@gmail.com>
gcc/config.in
gcc/configure
gcc/configure.ac
gcc/gcc.cc

index 7101286a9fb106eade1be175c4462e035254c02a..0c0ff0763619a4a9cbb7923d4f11f8ec53e3c803 100644 (file)
 #endif
 
 
+/* Define to enable the use of a default windres. */
+#ifndef USED_FOR_TARGET
+#undef DEFAULT_WINDRES
+#endif
+
+
 /* The default for -fdiagnostics-color option */
 #ifndef USED_FOR_TARGET
 #undef DIAGNOSTICS_COLOR_DEFAULT
index f349c1dc4c12814b903691d16627d20390d2ff2a..21d9cfd27cb53ab9e52b1217510edfd5e8f7334d 100755 (executable)
@@ -974,6 +974,7 @@ with_demangler_in_ld
 with_dsymutil
 with_gnu_as
 with_as
+with_windres
 enable_largefile
 enable_build_format_warnings
 enable_werror_always
@@ -1872,6 +1873,7 @@ Optional Packages:
                           pathname)
   --with-gnu-as           arrange to work with GNU as
   --with-as               arrange to use the specified as (full pathname)
+  --with-windres          arrange to use the specified windres (full pathname)
   --with-stack-clash-protection-guard-size=size
                           Set the default stack clash protection guard size
                           for specific targets as a power of two in bytes.
@@ -4069,6 +4071,38 @@ else
 $as_echo "no" >&6; }
 fi
 
+# --------------------
+# Find default windres
+# --------------------
+
+
+# Check whether --with-windres was given.
+if test "${with_windres+set}" = set; then :
+  withval=$with_windres; DEFAULT_WINDRES="$with_windres"
+fi
+
+if test x"${DEFAULT_WINDRES+set}" = x"set"; then
+  if test ! -x "$DEFAULT_WINDRES"; then
+    as_fn_error $? "cannot execute: $DEFAULT_WINDRES: check --with-windres or env. var. DEFAULT_WINDRES" "$LINENO" 5
+  fi
+
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_WINDRES "$DEFAULT_WINDRES"
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a default windres was specified" >&5
+$as_echo_n "checking whether a default windres was specified... " >&6; }
+if test x"${DEFAULT_WINDRES+set}" = x"set"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($DEFAULT_WINDRES)" >&5
+$as_echo "yes ($DEFAULT_WINDRES)" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
 # ---------------
 # Find C compiler
 # ---------------
@@ -21876,7 +21910,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 21879 "configure"
+#line 21913 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -21982,7 +22016,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 21985 "configure"
+#line 22019 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
index c652257f29eb15f21cc56a5d6428b386227a6f01..86fb90176d17fba367762c4870dad0eb6803afc9 100644 (file)
@@ -441,6 +441,29 @@ else
   AC_MSG_RESULT(no)
 fi
 
+# --------------------
+# Find default windres
+# --------------------
+
+AC_ARG_WITH(windres,
+[AS_HELP_STRING([--with-windres], [arrange to use the specified windres (full pathname)])],
+DEFAULT_WINDRES="$with_windres")
+if test x"${DEFAULT_WINDRES+set}" = x"set"; then
+  if test ! -x "$DEFAULT_WINDRES"; then
+    AC_MSG_ERROR([cannot execute: $DEFAULT_WINDRES: check --with-windres or env. var. DEFAULT_WINDRES])
+  fi
+  AC_DEFINE_UNQUOTED(DEFAULT_WINDRES,"$DEFAULT_WINDRES",
+       [Define to enable the use of a default windres.])
+fi
+
+AC_MSG_CHECKING([whether a default windres was specified])
+if test x"${DEFAULT_WINDRES+set}" = x"set"; then
+  AC_MSG_RESULT([yes ($DEFAULT_WINDRES)])
+else
+  AC_MSG_RESULT(no)
+fi
+
+
 # ---------------
 # Find C compiler
 # ---------------
index e6e28b17a072a199579573783fb7df500eb0be0f..96d5ef2e64b4d02ba628ac3965390728058aef5b 100644 (file)
@@ -3097,6 +3097,11 @@ find_a_program (const char *name)
     return xstrdup (DEFAULT_DSYMUTIL);
 #endif
 
+#ifdef DEFAULT_WINDRES
+  if (! strcmp (name, "windres") && access (DEFAULT_WINDRES, X_OK) == 0)
+    return xstrdup (DEFAULT_WINDRES);
+#endif
+
   return find_a_file (&exec_prefixes, name, X_OK, false);
 }