https://gcc.gnu.org/g:784fe43e93cdefe1d033195ab43e88d450b5882b
commit r16-6122-g784fe43e93cdefe1d033195ab43e88d450b5882b Author: Peter Damianov <[email protected]> Date: Thu Dec 11 01:52:43 2025 +0000 Driver: Implement --with-windres= argument to configure script [PR108866] 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 <[email protected]> Signed-off-by: Jonathan Yong <[email protected]> Diff: --- gcc/config.in | 6 ++++++ gcc/configure | 38 ++++++++++++++++++++++++++++++++++++-- gcc/configure.ac | 23 +++++++++++++++++++++++ gcc/gcc.cc | 5 +++++ 4 files changed, 70 insertions(+), 2 deletions(-) diff --git a/gcc/config.in b/gcc/config.in index 7101286a9fb1..0c0ff0763619 100644 --- a/gcc/config.in +++ b/gcc/config.in @@ -95,6 +95,12 @@ #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 diff --git a/gcc/configure b/gcc/configure index f349c1dc4c12..21d9cfd27cb5 100755 --- a/gcc/configure +++ b/gcc/configure @@ -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 diff --git a/gcc/configure.ac b/gcc/configure.ac index c652257f29eb..86fb90176d17 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -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 # --------------- diff --git a/gcc/gcc.cc b/gcc/gcc.cc index e6e28b17a072..96d5ef2e64b4 100644 --- a/gcc/gcc.cc +++ b/gcc/gcc.cc @@ -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); }
