Added -fobjc-arc to support automatic reference counting on macOS

This commit is contained in:
Sam Lantinga 2022-05-11 11:17:58 -07:00
parent 9b75fa0165
commit 737b4fc32c
2 changed files with 56 additions and 0 deletions

35
configure vendored
View File

@ -20385,6 +20385,40 @@ $as_echo "#define SDL_ARM_NEON_BLITTERS 1" >>confdefs.h
fi fi
} }
CheckObjectiveCARC()
{
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for clang -fobjc-arc option" >&5
$as_echo_n "checking for clang -fobjc-arc option... " >&6; }
have_clang_objc_arc=no
save_CFLAGS="$CFLAGS"
CFLAGS="$save_CFLAGS -fobjc-arc"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int x = 0;
int
main ()
{
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
have_clang_objc_arc=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_clang_objc_arc" >&5
$as_echo "$have_clang_objc_arc" >&6; }
CFLAGS="$save_CFLAGS"
if test x$have_clang_objc_arc = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -fobjc-arc"
fi
}
CheckVisibilityHidden() CheckVisibilityHidden()
{ {
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5
@ -26454,6 +26488,7 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h
EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON" EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
CheckObjectiveCARC
CheckVisibilityHidden CheckVisibilityHidden
CheckDeclarationAfterStatement CheckDeclarationAfterStatement
CheckDummyVideo CheckDummyVideo

View File

@ -1432,6 +1432,26 @@ CheckNEON()
fi fi
} }
dnl See if clang's -fobjc-arc supported.
dnl Reference: https://github.com/libsdl-org/SDL/pull/5632
CheckObjectiveCARC()
{
AC_MSG_CHECKING(for clang -fobjc-arc option)
have_clang_objc_arc=no
save_CFLAGS="$CFLAGS"
CFLAGS="$save_CFLAGS -fobjc-arc"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
int x = 0;
]],[])], [have_clang_objc_arc=yes],[])
AC_MSG_RESULT($have_clang_objc_arc)
CFLAGS="$save_CFLAGS"
if test x$have_clang_objc_arc = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -fobjc-arc"
fi
}
dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually). dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
CheckVisibilityHidden() CheckVisibilityHidden()
@ -4197,6 +4217,7 @@ dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan.
EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON" EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX" EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
CheckObjectiveCARC
CheckVisibilityHidden CheckVisibilityHidden
CheckDeclarationAfterStatement CheckDeclarationAfterStatement
CheckDummyVideo CheckDummyVideo