configure.ac (CheckJoystickMFI): changed AC_TRY_COMPILE to AC_TRY_LINK so as to discover GameController and CoreHaptics frameworks at compile time.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
diff --git a/configure b/configure
index d453c5f..71403d4 100755
--- a/configure
+++ b/configure
@@ -23159,7 +23159,9 @@ fi
if test x$enable_joystick_mfi = xyes; then
save_CFLAGS="$CFLAGS"
+ save_LDFLAGS="$LDFLAGS"
CFLAGS="$CFLAGS -x objective-c -fobjc-weak"
+ LDFLAGS="$LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GameController framework" >&5
$as_echo_n "checking for GameController framework... " >&6; }
enable_joystick_mfi=no
@@ -23170,6 +23172,10 @@ $as_echo_n "checking for GameController framework... " >&6; }
#include <TargetConditionals.h>
#import <GameController/GameController.h>
+int
+main ()
+{
+
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1080
#error GameController framework doesn't work on this configuration
#endif
@@ -23177,22 +23183,20 @@ $as_echo_n "checking for GameController framework... " >&6; }
#error GameController framework doesn't work on this configuration
#endif
-int
-main ()
-{
-
-
;
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+if ac_fn_c_try_link "$LINENO"; then :
enable_joystick_mfi=yes
fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
CFLAGS="$save_CFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_joystick_mfi" >&5
$as_echo "$enable_joystick_mfi" >&6; }
if test x$enable_joystick_mfi = xyes; then
diff --git a/configure.ac b/configure.ac
index 11bbc5c..c3327c3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2800,15 +2800,17 @@ AS_HELP_STRING([--enable-joystick-mfi], [include macOS MFI joystick support [[de
if test x$enable_joystick_mfi = xyes; then
save_CFLAGS="$CFLAGS"
+ save_LDFLAGS="$LDFLAGS"
dnl Work around that we don't have Objective-C support in autoconf
CFLAGS="$CFLAGS -x objective-c -fobjc-weak"
+ LDFLAGS="$LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController"
AC_MSG_CHECKING(for GameController framework)
enable_joystick_mfi=no
- AC_TRY_COMPILE([
+ AC_TRY_LINK([
#include <AvailabilityMacros.h>
#include <TargetConditionals.h>
#import <GameController/GameController.h>
-
+ ],[
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1080
#error GameController framework doesn't work on this configuration
#endif
@@ -2816,10 +2818,11 @@ AS_HELP_STRING([--enable-joystick-mfi], [include macOS MFI joystick support [[de
#error GameController framework doesn't work on this configuration
#endif
],[
- ],[
enable_joystick_mfi=yes
])
CFLAGS="$save_CFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+
AC_MSG_RESULT($enable_joystick_mfi)
if test x$enable_joystick_mfi = xyes; then
AC_DEFINE(SDL_JOYSTICK_MFI, 1, [ ])