configure.ac (CheckJoystickMFI): changed AC_TRY_COMPILE to AC_TRY_LINK

so as to discover GameController and CoreHaptics frameworks at compile
time.
This commit is contained in:
Sam Lantinga 2020-12-09 20:31:00 -08:00
parent 797a6910fd
commit eec73dfd20
2 changed files with 17 additions and 10 deletions

18
configure vendored
View File

@ -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

View File

@ -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, [ ])