sdl12-compat: make sure we have gcc >= 4.2.x before enabling force_align_arg_pointer

From d4a40827b99afef0d7b90ef7129cc0984b634930 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sun, 4 Sep 2022 18:11:40 +0300
Subject: [PATCH] make sure we have gcc >= 4.2.x before enabling
 force_align_arg_pointer

---
 src/SDL12_compat.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c
index a8237469..1a2b35fe 100644
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -83,8 +83,15 @@ extern "C" {
 /* on x86 Linux builds, we have the public entry points force stack alignment to 16 bytes
    on entry. This won't be a massive performance hit, but it might help extremely old
    binaries that want to call into SDL to not crash in hard-to-diagnose ways. It's not a
-   panacea to the stack alignment problem, but it might help a little. */
-#if defined(__linux__) && defined(__i386__) && (defined(__GNUC__) || defined(__clang__))
+   panacea to the stack alignment problem, but it might help a little.
+
+   The force_align_arg_pointer attribute requires gcc >= 4.2.x. */
+#if defined(__clang__)
+#define HAVE_FORCE_ALIGN_ARG_POINTER
+#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2))
+#define HAVE_FORCE_ALIGN_ARG_POINTER
+#endif
+#if defined(__linux__) && defined(__i386__) && defined(HAVE_FORCE_ALIGN_ARG_POINTER)
 #define FORCEALIGNATTR __attribute__((force_align_arg_pointer))
 #else
 #define FORCEALIGNATTR