SDL_mixer: autotools: Eliminate libgcc*.dll dependency in mingw builds.

From cb0d276b869fb8d53826285232a4a49c5a0107be Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Fri, 3 Jan 2025 17:50:50 +0300
Subject: [PATCH] autotools: Eliminate libgcc*.dll dependency in mingw builds.

---
 build-scripts/ltmain.sh | 2 +-
 configure               | 5 +++++
 configure.ac            | 5 +++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/build-scripts/ltmain.sh b/build-scripts/ltmain.sh
index 67d2fd748..5c26903b9 100644
--- a/build-scripts/ltmain.sh
+++ b/build-scripts/ltmain.sh
@@ -4785,7 +4785,7 @@ func_mode_link ()
       # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
       # @file GCC response files
       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
+      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|-static-*|@*)
         func_quote_for_eval "$arg"
 	arg="$func_quote_for_eval_result"
         func_append compile_command " $arg"
diff --git a/configure b/configure
index 8b1083e16..c48e73a9c 100755
--- a/configure
+++ b/configure
@@ -16377,6 +16377,11 @@ printf "%s\n" "$have_no_cygwin" >&6; }
             BASE_LDFLAGS="-mno-cygwin"
         fi
         ;;
+    *-*-mingw*)
+        #Eliminate libgcc*.dll dependency
+        BASE_CFLAGS="-static-libgcc"
+        BASE_LDFLAGS="-Wc,-static-libgcc"
+        ;;
     *-*-os2*)
         # disable static builds on os/2
         enable_static=no
diff --git a/configure.ac b/configure.ac
index ccec258b3..665968863 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,6 +100,11 @@ case "$host" in
             BASE_LDFLAGS="-mno-cygwin"
         fi
         ;;
+    *-*-mingw*)
+        #Eliminate libgcc*.dll dependency
+        BASE_CFLAGS="-static-libgcc"
+        BASE_LDFLAGS="-Wc,-static-libgcc"
+        ;;
     *-*-os2*)
         # disable static builds on os/2
         enable_static=no