File 1004-Allow-explicit-enabling-the-JIT-on-Intel-Macs.patch of Package erlang

From 5c040dc162ded7c794dfab7eb53db881f57d9c43 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Mon, 4 Mar 2024 12:49:02 +0100
Subject: [PATCH] Allow explicit enabling the JIT on Intel Macs

5c9581eb409f5e disabled the JIT on Intel Macs because of annoying
popups on macOS Sonoma. The previous major version, macOS Ventura,
does not have the popup problem. Therefore, this commit makes it
possible to explicitly enable the JIT for Intel Macs. Here is how:

    ./configure --enable-jit
---
 erts/configure    | 19 ++++++++++++++-----
 erts/configure.ac | 17 +++++++++++++----
 2 files changed, 27 insertions(+), 9 deletions(-)

diff --git a/erts/configure b/erts/configure
index 8d2083aa48..03de87e291 100755
--- a/erts/configure
+++ b/erts/configure
@@ -24558,16 +24558,25 @@ then :
         amd64)
            case "$OPSYS" in
               darwin)
-                # MacOS Sonoma introduced some very annoying popups when
+                # macOS Sonoma introduced some very annoying popups when
                 # dual-mapping memory through the documented APIs, and we did
                 # not wish to start using undocumented functionality in a patch
-                # release, so we have disabled the JIT on this platform.
+                # release, so we have disabled the JIT by default on this
+                # platform.
+                #
+                # The previous version, macOS Ventura, does not have the
+                # annoying popups, so it is still possible to explicitly
+                # enable the JIT.
                 #
                 # The ARM JIT is unaffected because it uses per-thread
                 # permissions instead of dual-mapped memory.
-                enable_jit=no
-                { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: JIT disabled due to lack to support on x86 Macs" >&5
-printf "%s\n" "$as_me: WARNING: JIT disabled due to lack to support on x86 Macs" >&2;}
+                if test ${enable_jit} = yes; then
+                  JIT_ARCH=x86
+                else
+                  enable_jit=no
+                  { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: JIT disabled due to annoying popus on x86 Macs with Sononma" >&5
+printf "%s\n" "$as_me: WARNING: JIT disabled due to annoying popus on x86 Macs with Sononma" >&2;}
+                fi
                 ;;
               *)
                 JIT_ARCH=x86
diff --git a/erts/configure.in b/erts/configure.in
index c591393fcd..fcf79b01e4 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -2867,15 +2867,24 @@ AS_IF([test ${enable_jit} != no],
         amd64)
            case "$OPSYS" in
               darwin)
-                # MacOS Sonoma introduced some very annoying popups when
+                # macOS Sonoma introduced some very annoying popups when
                 # dual-mapping memory through the documented APIs, and we did
                 # not wish to start using undocumented functionality in a patch
-                # release, so we have disabled the JIT on this platform.
+                # release, so we have disabled the JIT by default on this
+                # platform.
+                #
+                # The previous version, macOS Ventura, does not have the
+                # annoying popups, so it is still possible to explicitly
+                # enable the JIT.
                 #
                 # The ARM JIT is unaffected because it uses per-thread
                 # permissions instead of dual-mapped memory.
-                enable_jit=no
-                AC_MSG_WARN([JIT disabled due to lack to support on x86 Macs])
+                if test ${enable_jit} = yes; then
+                  JIT_ARCH=x86
+                else
+                  enable_jit=no
+                  AC_MSG_WARN([JIT disabled due to annoying popus on x86 Macs with Sononma])
+                fi
                 ;;
               *)
                 JIT_ARCH=x86
-- 
2.35.3

openSUSE Build Service is sponsored by