From 7bf25ee2de5c3e5a7b956f69bc3bcd8ac2e43d4f Mon Sep 17 00:00:00 2001 From: Tobias Taschner Date: Fri, 21 Oct 2016 11:13:04 +0200 Subject: [PATCH] Check deployment target for usage of AVKit The AVKit framework should only be linked for OS X 10.9+ --- configure | 30 ++++++++++++++++++++++++------ configure.in | 22 ++++++++++++++++------ src/osx/cocoa/mediactrl.mm | 2 +- 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/configure b/configure index 086475be92..5bf98b9613 100755 --- a/configure +++ b/configure @@ -37523,22 +37523,40 @@ else $as_echo "#define wxOSX_USE_QTKIT 0" >>confdefs.h + wxOSX_USE_QTKIT=no GST_LIBS="-framework AVFoundation -framework CoreMedia" fi fi - ac_fn_c_check_header_mongrel "$LINENO" "AVKit/AVKit.h" "ac_cv_header_AVKit_AVKit_h" "$ac_includes_default" -if test "x$ac_cv_header_AVKit_AVKit_h" = xyes; then : + if test "$wxOSX_USE_QTKIT" = "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if AVKit is availble" >&5 +$as_echo_n "checking if AVKit is availble... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include "AvailabilityMacros.h" +int +main () +{ - GST_LIBS="$GST_LIBS -framework AVKit" + #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9 + // AVKit available + #else + choke me + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + GST_LIBS="$GST_LIBS -framework AVKit" fi - - +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi CPPFLAGS="$old_CPPFLAGS" - fi fi diff --git a/configure.in b/configure.in index 6913f7cf1d..f1b79e1397 100644 --- a/configure.in +++ b/configure.in @@ -7615,16 +7615,26 @@ if test "$wxUSE_MEDIACTRL" = "yes" -o "$wxUSE_MEDIACTRL" = "auto"; then ], [ AC_DEFINE(wxOSX_USE_QTKIT,0) + wxOSX_USE_QTKIT=no GST_LIBS="-framework AVFoundation -framework CoreMedia" ]) fi - dnl AVKit is only available since OS X 10.9 - AC_CHECK_HEADER([AVKit/AVKit.h], - [ - GST_LIBS="$GST_LIBS -framework AVKit" - ]) + if test "$wxOSX_USE_QTKIT" = "no"; then + dnl AVKit is only available since OS X 10.9 + AC_MSG_CHECKING([if AVKit is availble]) + AC_TRY_COMPILE( + [#include "AvailabilityMacros.h"], + [ + #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9 + // AVKit available + #else + choke me + #endif + ], + GST_LIBS="$GST_LIBS -framework AVKit" + ) + fi CPPFLAGS="$old_CPPFLAGS" - fi fi diff --git a/src/osx/cocoa/mediactrl.mm b/src/osx/cocoa/mediactrl.mm index 90bfe37d79..da85276e53 100644 --- a/src/osx/cocoa/mediactrl.mm +++ b/src/osx/cocoa/mediactrl.mm @@ -52,7 +52,7 @@ #endif #endif -#if wxOSX_USE_AVFOUNDATION && wxOSX_USE_COCOA && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9 +#if wxOSX_USE_AVFOUNDATION && wxOSX_USE_COCOA && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_9 #define wxOSX_USE_AVKIT 1 #else #define wxOSX_USE_AVKIT 0