summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorOleg Oshmyan <chortos@inbox.lv>2017-10-26 22:38:49 +0300
committerOleg Oshmyan <chortos@inbox.lv>2017-10-31 14:00:07 +0200
commitb2bc09603dd90379f13c153cd950d9ab0604e99b (patch)
tree8818c9959ba0be16976cd327a12110c073e235f2 /configure.ac
parent0b232482a4ad0c82aede8ebd346b3148174b3177 (diff)
downloadlibass-b2bc09603dd90379f13c153cd950d9ab0604e99b.tar.bz2
libass-b2bc09603dd90379f13c153cd950d9ab0604e99b.tar.xz
Support Core Text on earlier versions of Mac OS X
Loosely based on behdad/harfbuzz@b96af03c20e46105982b3608b608614403540661. Prefer to link against ApplicationServices to maximize the portability of binaries built on newer versions of macOS. The symbol kCTFontURLAttribute, which is checked in this commit, was introduced in Mac OS X 10.6, the latest of any Core Text symbols that we use. It is essential to our Core Text font provider, so this is the earliest version of Mac OS X where we can support this font provider. The TARGET_OS_IPHONE conditional that this commit adds is necessary to continue supporting iOS in addition to supporting old Mac OS X. On iOS, CoreText.h *must* be included to use Core Text, whereas on old Mac OS X, CoreText.h is not directly accessible and ApplicationServices.h must be used. On modern macOS, either header works. This conditional is also used in HarfBuzz.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac33
1 files changed, 21 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac
index 8280beb..811533a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -159,24 +159,33 @@ fi
AM_CONDITIONAL([FONTCONFIG], [test x$fontconfig = xtrue])
if test x$enable_coretext != xno; then
-OLDLIBS="$LIBS"
-# Linking to CoreText directly only works from Mountain Lion and iOS6. In
-# earlier OS releases CoreText was part of the ApplicationServices umbrella
-# framework.
-LIBS="$LIBS -framework CoreText -framework CoreFoundation"
+# Linking to CoreText directly only works from Mountain Lion and iOS.
+# In earlier OS X releases CoreText was part of the ApplicationServices
+# umbrella framework.
AC_MSG_CHECKING([for CORETEXT])
-AC_LINK_IFELSE([
+AC_COMPILE_IFELSE([
AC_LANG_PROGRAM(
- [[#include <CoreText/CoreText.h>]],
- [[CTFontCreateWithFontDescriptor(NULL, 0.0, NULL);]],)
+ [[#include <ApplicationServices/ApplicationServices.h>]],
+ [[CTFontDescriptorCopyAttribute(NULL, kCTFontURLAttribute);]])
], [
- AC_DEFINE(CONFIG_CORETEXT, 1, [found CoreText in System library])
+ LIBS="$LIBS -framework ApplicationServices -framework CoreFoundation"
+ AC_DEFINE(CONFIG_CORETEXT, 1, [found CoreText in ApplicationServices framework])
coretext=true
AC_MSG_RESULT([yes])
], [
- LIBS="$OLDLIBS"
- coretext=false
- AC_MSG_RESULT([no])
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM(
+ [[#include <CoreText/CoreText.h>]],
+ [[CTFontDescriptorCopyAttribute(NULL, kCTFontURLAttribute);]])
+ ], [
+ LIBS="$LIBS -framework CoreText -framework CoreFoundation"
+ AC_DEFINE(CONFIG_CORETEXT, 1, [found CoreText framework])
+ coretext=true
+ AC_MSG_RESULT([yes])
+ ], [
+ coretext=false
+ AC_MSG_RESULT([no])
+ ])
])
fi
AM_CONDITIONAL([CORETEXT], [test x$coretext = xtrue])