From 968b830d142d8ece6510912d0a50031d88f6cc21 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 15 Jul 2020 16:12:44 -0700 Subject: [PATCH] Fixed bug 5232 - SDL2 configure script detects Apple Silicon Macs as iPhones; fails to build due to missing components jackmacwindowslinux I'm testing my application that uses SDL2 on the new Apple Silicon Macs. I set up the SDL 2.0.12 source code from the website and tried to build it. The first issue I ran into was that it was always building OpenGL ES, even if --disable-video-opengles was passed to configure. OpenGL ES headers do not seem to be present on the Apple Silicon macOS SDK, except for the iOS SDK headers. Then I had problems with the joystick driver, where some classes used on iOS were not available on macOS. After looking through the configure.ac script a bit, I found that iOS targets are selected when the build host matches "arm*-apple-darwin*". Clang on macOS 11.0 on arm64 reports the host as "arm64-apple-darwin20.0.0", which matches the iOS target. This means that ARM Mac compilation will always be detected as iOS. Unfortunately, there doesn't seem to be an easy way to detect Mac vs. iOS targets, since they now both use the same triplet & compiler for building. I'm not sure what the best way to fix this is, but maybe there could be an additional target flag to specify whether to build for macOS or iOS? This might break compatibility, though: with this approach, either all old scripts that used configure to build for iOS fail, or all new builds on macOS without a flag fail (silently?). --- configure | 8 ++------ configure.ac | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 6590ae363..cb1423e4b 100755 --- a/configure +++ b/configure @@ -21775,10 +21775,6 @@ $as_echo_n "checking for Metal framework... " >&6; } #import #import - #if !TARGET_CPU_X86_64 - #error Metal doesn't work on this configuration - #endif - int main () { @@ -24254,7 +24250,7 @@ CheckHIDAPI() # so we'll just use libusb when it's available. case "$host" in # libusb does not support iOS - arm*-apple-darwin* | *-ios-* ) + *-ios-* ) skiplibusb=yes ;; # On the other hand, *BSD specifically uses libusb only @@ -25154,7 +25150,7 @@ else fi ;; - arm*-apple-darwin*|*-ios-*) + *-ios-*) ARCH=ios CheckVisibilityHidden diff --git a/configure.ac b/configure.ac index c767bb490..6018a6db2 100644 --- a/configure.ac +++ b/configure.ac @@ -2156,10 +2156,6 @@ AS_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[defaul #import #import #import - - #if !TARGET_CPU_X86_64 - #error Metal doesn't work on this configuration - #endif ],[ ],[ have_metal=yes @@ -3289,7 +3285,7 @@ CheckHIDAPI() # so we'll just use libusb when it's available. case "$host" in # libusb does not support iOS - arm*-apple-darwin* | *-ios-* ) + *-ios-* ) skiplibusb=yes ;; # On the other hand, *BSD specifically uses libusb only @@ -3872,7 +3868,7 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau # other spins, like x86-64, use a more standard "libstdc++.so.*" AC_CHECK_FILE("/boot/system/lib/libstdc++.r4.so", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++.r4", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++") ;; - arm*-apple-darwin*|*-ios-*) + *-ios-*) ARCH=ios CheckVisibilityHidden