commit 88798740681cdd7a65232490127b8cc337dc7d4f
Author: Peter TB Brett <peter.brett@livecode.com>
Date:   Thu Sep 22 13:08:46 2016 +0100

    Add feature macros for building Quartz font backend for iOS
    
    When building Cairo to run on iOS 10, the ApplicationServices
    framework and `ATSUFontID` type are not available.  However, the
    majority of the Quartz support code works just fine because it
    relies purely on the CoreGraphics and CoreText frameworks.
    
    This patch adds three feature macros:
    
    - `CAIRO_QUARTZ_HAS_CORE_GRAPHICS` - define to 1 to indicate
      availability of the CoreGraphics framework.  It should be
      defined on both iOS and MacOS
    - `CAIRO_QUARTZ_HAS_APPLICATION_SERVICES` - define to 1 to indicate
      availability of the ApplicationSercives framework.  It should be
      defined only on MacOS
    - `CAIRO_QUARTZ_HAS_ATSUFONTID` - define to 1 if the `ATSUFontID`
      type is defined by the ApplicationServices header files.  It
      should normally be defined on MacOS
    
    Signed-Off-By: Peter TB Brett <peter.brett@livecode.com>

diff --git a/src/cairo-quartz-font.c b/src/cairo-quartz-font.c
index feee61a..4b9614d 100644
--- a/src/cairo-quartz-font.c
+++ b/src/cairo-quartz-font.c
@@ -92,8 +92,10 @@ static int (*CGFontGetAscentPtr) (CGFontRef fontRef) = NULL;
 static int (*CGFontGetDescentPtr) (CGFontRef fontRef) = NULL;
 static int (*CGFontGetLeadingPtr) (CGFontRef fontRef) = NULL;
 
+#ifdef CAIRO_HAS_QUARTZ_ATSUFONTID
 /* Not public anymore in 64-bits nor in 10.7 */
-static ATSFontRef (*FMGetATSFontRefFromFontPtr) (FMFont iFont) = NULL;
+static ATSFontRef (*FMGetATSFontRefFromFontPtr) (ATSUFontID iFont) = NULL;
+#endif /* CAIRO_HAS_QUARTZ_ATSUFONTID */
 
 static cairo_bool_t _cairo_quartz_font_symbol_lookup_done = FALSE;
 static cairo_bool_t _cairo_quartz_font_symbols_present = FALSE;
@@ -133,7 +135,9 @@ quartz_font_ensure_symbols(void)
     CGContextGetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextGetAllowsFontSmoothing");
     CGContextSetAllowsFontSmoothingPtr = dlsym(RTLD_DEFAULT, "CGContextSetAllowsFontSmoothing");
 
+#ifdef CAIRO_HAS_QUARTZ_ATSUFONTID
     FMGetATSFontRefFromFontPtr = dlsym(RTLD_DEFAULT, "FMGetATSFontRefFromFont");
+#endif /* CAIRO_HAS_QUARTZ_ATSUFONTID */
 
     if ((CGFontCreateWithFontNamePtr || CGFontCreateWithNamePtr) &&
 	CGFontGetGlyphBBoxesPtr &&
@@ -814,6 +818,7 @@ _cairo_quartz_scaled_font_get_cg_font_ref (cairo_scaled_font_t *abstract_font)
 /*
  * compat with old ATSUI backend
  */
+#ifdef CAIRO_HAS_QUARTZ_ATSUFONTID
 
 /**
  * cairo_quartz_font_face_create_for_atsu_font_id:
@@ -857,3 +862,5 @@ cairo_atsui_font_face_create_for_atsu_font_id (ATSUFontID font_id)
 {
     return cairo_quartz_font_face_create_for_atsu_font_id (font_id);
 }
+
+#endif /* CAIRO_HAS_QUARTZ_ATSUFONTID */
diff --git a/src/cairo-quartz.h b/src/cairo-quartz.h
index 9be5f9a..1201103 100644
--- a/src/cairo-quartz.h
+++ b/src/cairo-quartz.h
@@ -40,7 +40,14 @@
 
 #if CAIRO_HAS_QUARTZ_SURFACE
 
+#if CAIRO_HAS_QUARTZ_CORE_GRAPHICS
+#include <CoreGraphics/CoreGraphics.h>
+#include <CoreText/CoreText.h>
+#endif
+
+#if CAIRO_HAS_QUARTZ_APPLICATION_SERVICES
 #include <ApplicationServices/ApplicationServices.h>
+#endif
 
 CAIRO_BEGIN_DECLS
 
@@ -66,8 +73,10 @@ cairo_quartz_surface_get_cg_context (cairo_surface_t *surface);
 cairo_public cairo_font_face_t *
 cairo_quartz_font_face_create_for_cgfont (CGFontRef font);
 
+#if CAIRO_HAS_QUARTZ_ATSUFONTID
 cairo_public cairo_font_face_t *
 cairo_quartz_font_face_create_for_atsu_font_id (ATSUFontID font_id);
+#endif /* CAIRO_HAS_QUARTZ_ATSUFONTID */
 
 #endif /* CAIRO_HAS_QUARTZ_FONT */
 
