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]>
---
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 7101286a9fb..0c0ff076361 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 d7074355e42..65823041e5a 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -975,6 +975,7 @@ with_demangler_in_ld
with_dsymutil
with_gnu_as
with_as
+with_windres
enable_largefile
enable_build_format_warnings
enable_werror_always
@@ -1873,6 +1874,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.
@@ -4070,6 +4072,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
# ---------------
@@ -21877,7 +21911,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 21880 "configure"
+#line 21914 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -21983,7 +22017,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 21986 "configure"
+#line 22020 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b6d9608d599..f55b8d46c4b 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 bfe262bdc2d..86ad2d9548c 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);
}
--
2.47.3