sdl12-compat: SDL_endian.h: use endian predefs from newer gcc and clang versions.

From 06d554b9d1f5fd8d73072331f33ed8ff0bad66c2 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Mon, 14 Mar 2022 10:20:02 +0300
Subject: [PATCH] SDL_endian.h: use endian predefs from newer gcc and clang
 versions.

---
 include/SDL/SDL_endian.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/SDL/SDL_endian.h b/include/SDL/SDL_endian.h
index 872f310..fb27d37 100644
--- a/include/SDL/SDL_endian.h
+++ b/include/SDL/SDL_endian.h
@@ -47,6 +47,15 @@ real SDL-1.2 available to you. */
 #elif defined(__FreeBSD__) || defined(__NetBSD__)
 #include <sys/endian.h>
 #define SDL_BYTEORDER  BYTE_ORDER
+/* predefs from newer gcc and clang versions: */
+#elif defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) && defined(__BYTE_ORDER__)
+#if (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
+#define SDL_BYTEORDER   SDL_LIL_ENDIAN
+#elif (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
+#define SDL_BYTEORDER   SDL_BIG_ENDIAN
+#else
+#error Unsupported endianness
+#endif /**/
 #else
 #if defined(__hppa__) || \
     defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \