From f40dc8f71e08798039f7285f38f328485972bd60 Mon Sep 17 00:00:00 2001
From: Costas Argyris <costas.argyris@gmail.com>
Date: Mon, 20 Nov 2023 17:58:16 +0000
Subject: [PATCH] mingw: Exclude utf8 manifest [PR111170, PR108865]

Make the utf8 manifest optional (on by default and
explicitly off with --disable-win32-utf8-manifest)
in the mingw hosts.

Also eliminate duplication between the 32-bit and
64-bit mingw hosts by putting them both in the
same branch and special-case only the 64-bit long
long setting.

PR mingw/111170
PR mingw/108865

Signed-off-by: Costas Argyris <costas.argyris@gmail.com>
---
 gcc/config.host | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/gcc/config.host b/gcc/config.host
index 5df85752ed4..ce4aeb0e7b1 100644
--- a/gcc/config.host
+++ b/gcc/config.host
@@ -230,24 +230,23 @@ case ${host} in
     host_exeext=.exe
     host_lto_plugin_soname=cyglto_plugin.dll
     ;;
-  i[34567]86-*-mingw32*)
+  i[34567]86-*-mingw32* | x86_64-*-mingw*)
     host_xm_file=i386/xm-mingw32.h
-    host_xmake_file="${host_xmake_file} i386/x-mingw32 i386/x-mingw32-utf8"
+    host_xmake_file="${host_xmake_file} i386/x-mingw32"
+    host_extra_gcc_objs="${host_extra_gcc_objs} driver-mingw32.o"
     host_exeext=.exe
     out_host_hook_obj=host-mingw32.o
-    host_extra_objs="${host_extra_objs} utf8-mingw32.o"
-    host_extra_gcc_objs="${host_extra_gcc_objs} driver-mingw32.o utf8rc-mingw32.o"
-    host_lto_plugin_soname=liblto_plugin.dll
-    ;;
-  x86_64-*-mingw*)
-    use_long_long_for_widest_fast_int=yes
-    host_xm_file=i386/xm-mingw32.h
-    host_xmake_file="${host_xmake_file} i386/x-mingw32 i386/x-mingw32-utf8"
-    host_exeext=.exe
-    out_host_hook_obj=host-mingw32.o
-    host_extra_objs="${host_extra_objs} utf8-mingw32.o"
-    host_extra_gcc_objs="${host_extra_gcc_objs} driver-mingw32.o utf8rc-mingw32.o"
     host_lto_plugin_soname=liblto_plugin.dll
+    case ${host} in
+      x86_64-*-*)
+        use_long_long_for_widest_fast_int=yes
+        ;;
+    esac
+    if test x$enable_win32_utf8_manifest != xno; then
+      host_xmake_file="${host_xmake_file} i386/x-mingw32-utf8"
+      host_extra_gcc_objs="${host_extra_gcc_objs} utf8rc-mingw32.o"
+      host_extra_objs="${host_extra_objs} utf8-mingw32.o"
+    fi
     ;;
   aarch64*-*-darwin*)
     out_host_hook_obj="${out_host_hook_obj} host-aarch64-darwin.o"
-- 
2.42.1

