SDL_image: Need to turn off optimizations so weak framework load check works (25a57)

From 25a57e23071b0d5a70c1a417966fb37bb6e78033 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 29 Nov 2023 17:21:16 -0800
Subject: [PATCH] Need to turn off optimizations so weak framework load check
 works

(cherry picked from commit a9564af3ca69a23dc7d48fdcf832e0d4b109237e)
---
 src/IMG_avif.c | 4 ++++
 src/IMG_jxl.c  | 4 ++++
 src/IMG_webp.c | 4 ++++
 3 files changed, 12 insertions(+)

diff --git a/src/IMG_avif.c b/src/IMG_avif.c
index 3eab716b..ccd7dd63 100644
--- a/src/IMG_avif.c
+++ b/src/IMG_avif.c
@@ -54,6 +54,10 @@ static struct {
 #endif
 
 int IMG_InitAVIF(void)
+#ifdef __APPLE__
+    /* Need to turn off optimizations so weak framework load check works */
+    __attribute__ ((optnone))
+#endif
 {
     if ( lib.loaded == 0 ) {
 #ifdef LOAD_AVIF_DYNAMIC
diff --git a/src/IMG_jxl.c b/src/IMG_jxl.c
index d08d924f..4523ef87 100644
--- a/src/IMG_jxl.c
+++ b/src/IMG_jxl.c
@@ -53,6 +53,10 @@ static struct {
 #endif
 
 int IMG_InitJXL(void)
+#ifdef __APPLE__
+    /* Need to turn off optimizations so weak framework load check works */
+    __attribute__ ((optnone))
+#endif
 {
     if ( lib.loaded == 0 ) {
 #ifdef LOAD_JXL_DYNAMIC
diff --git a/src/IMG_webp.c b/src/IMG_webp.c
index bb862061..33f35274 100644
--- a/src/IMG_webp.c
+++ b/src/IMG_webp.c
@@ -73,6 +73,10 @@ static struct {
 #endif
 
 int IMG_InitWEBP(void)
+#ifdef __APPLE__
+    /* Need to turn off optimizations so weak framework load check works */
+    __attribute__ ((optnone))
+#endif
 {
     if (lib.loaded == 0) {
 #if defined(LOAD_WEBP_DYNAMIC) && defined(LOAD_WEBPDEMUX_DYNAMIC)