Correctly add weak-linked frameworks for increasingly high macOS versions

This commit is contained in:
ManoloFLTK 2024-11-04 13:06:36 +01:00
parent 5e91ecfd58
commit afe87de013

View File

@ -1023,13 +1023,29 @@ AS_CASE([$host_os_gui], [cygwin* | mingw*], [
# MacOS X uses Cocoa for graphics. # MacOS X uses Cocoa for graphics.
LIBS="$LIBS -framework Cocoa" LIBS="$LIBS -framework Cocoa"
macosversion_maj=$(sw_vers -productVersion | cut -d. -f1) # Add weak-linked additional frameworks for increasingly high macOS versions
AS_IF([test $macosversion_maj -ge 11], [ AC_LANG_PUSH([C])
LIBS="$LIBS -weak_framework UniformTypeIdentifiers" AC_COMPILE_IFELSE(
]) [AC_LANG_PROGRAM(
AS_IF([test $macosversion_maj -ge 15], [ [[#include <AvailabilityMacros.h>
LIBS="$LIBS -weak_framework ScreenCaptureKit" #if __MAC_OS_X_VERSION_MAX_ALLOWED < 110000
]) #error __MAC_OS_X_VERSION_MAX_ALLOWED < 110000
#endif
]], [[
]])],
[LIBS="$LIBS -weak_framework UniformTypeIdentifiers"],
[])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <AvailabilityMacros.h>
#if __MAC_OS_X_VERSION_MAX_ALLOWED < 150000
#error __MAC_OS_X_VERSION_MAX_ALLOWED < 150000
#endif
]], [[
]])],
[LIBS="$LIBS -weak_framework ScreenCaptureKit"],
[])
AC_LANG_POP([])
AS_IF([test x$have_pthread = xyes], [ AS_IF([test x$have_pthread = xyes], [
AC_DEFINE([HAVE_PTHREAD]) AC_DEFINE([HAVE_PTHREAD])