SDL: SDL_endian.h: Fix byte order detection on Solaris (and some SPARC compilers). (d7ee9)

From d7ee9ce455e7df2b562fe1ac7245d60dab1aaf18 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Fri, 28 Jun 2024 00:14:26 -0400
Subject: [PATCH] SDL_endian.h: Fix byte order detection on Solaris (and some
 SPARC compilers).

Fixes #10093.

(Sort of cherry-picked from 14183f8ecac099982883331ae7e405f82e42aa6b.)
---
 include/SDL3/SDL_endian.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/SDL3/SDL_endian.h b/include/SDL3/SDL_endian.h
index 2f9583e20c22f..cb3d7f34e4f35 100644
--- a/include/SDL3/SDL_endian.h
+++ b/include/SDL3/SDL_endian.h
@@ -59,6 +59,15 @@ _m_prefetch(void *__P)
 #ifdef SDL_PLATFORM_LINUX
 #include <endian.h>
 #define SDL_BYTEORDER  __BYTE_ORDER
+#elif defined(SDL_PLATFORM_SOLARIS)
+#include <sys/byteorder.h>
+#if defined(_LITTLE_ENDIAN)
+#define SDL_BYTEORDER   SDL_LIL_ENDIAN
+#elif defined(_BIG_ENDIAN)
+#define SDL_BYTEORDER   SDL_BIG_ENDIAN
+#else
+#error Unsupported endianness
+#endif
 #elif defined(SDL_PLATFORM_OPENBSD) || defined(__DragonFly__)
 #include <endian.h>
 #define SDL_BYTEORDER  BYTE_ORDER
@@ -79,7 +88,7 @@ _m_prefetch(void *__P)
     defined(__m68k__) || defined(mc68000) || defined(_M_M68K) || \
     (defined(__MIPS__) && defined(__MIPSEB__)) || \
     defined(__ppc__) || defined(__POWERPC__) || defined(__powerpc__) || defined(__PPC__) || \
-    defined(__sparc__)
+    defined(__sparc__) || defined(__sparc)
 #define SDL_BYTEORDER   SDL_BIG_ENDIAN
 #else
 #define SDL_BYTEORDER   SDL_LIL_ENDIAN