Fix for 10.4u SDK bundled to Mac OS X 10.5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
diff --git a/ChangeLog b/ChangeLog
index 9325a60..47fc4e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2008-06-24 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
+ * builds/unix/configure.raw: Check type "ResourceIndex" explicitly
+ and define HAVE_TYPE_RESOURCE_INDEX if it is defined. Mac OS X
+ 10.5 bundles 10.4u SDK with MAC_OS_X_VERSION_10_5 macro but without
+ ResourceIndex type definition. The macro does not inform the type
+ availability.
+ * src/base/ftmac.c: More parentheses are inserted to clarify the
+ conditionals to disable legacy APIs in "10.5 and later" cases.
+ If HAVE_TYPE_RESOURCE_INDEX is not defined, ResourceIndex is
+ defined.
+
2008-06-24 Werner Lemberg <wl@gnu.org>
* src/truetype/ttinterp. (Ins_SCANTYPE): Don't check rendering mode.
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index 939e439..b69e4ae 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -260,7 +260,37 @@ if test x$with_old_mac_fonts = xyes; then
],
[AC_MSG_RESULT([no, ANSI incompatible])
CFLAGS="$orig_CFLAGS"
- ])],
+ ])
+ AC_MSG_CHECKING([type ResourceIndex])
+ orig_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
+ AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM([
+
+#if defined(__GNUC__) && defined(__APPLE_CC__)
+# include <Carbon/Carbon.h>
+# include <ApplicationServices/ApplicationServices.h>
+#else
+# include <ConditionalMacros.h>
+# include <Files.h>
+# include <Resources.h>
+#endif
+
+ ],
+ [
+
+ ResourceIndex i = 0;
+ return i;
+
+ ])],
+ [AC_MSG_RESULT([ok])
+ CFLAGS="$orig_CFLAGS"
+ CFLAGS="$CFLAGS -DHAVE_TYPE_RESOURCE_INDEX"
+ ],
+ [AC_MSG_RESULT([no])
+ CFLAGS="$orig_CFLAGS"
+ ])
+ ],
[AC_MSG_RESULT([not found])
LDFLAGS="${orig_LDFLAGS}"
CFLAGS="$CFLAGS -DDARWIN_NO_CARBON"])
diff --git a/src/base/ftmac.c b/src/base/ftmac.c
index 7f05907..4f4ab9d 100644
--- a/src/base/ftmac.c
+++ b/src/base/ftmac.c
@@ -77,8 +77,8 @@
#define OS_INLINE static __inline__
#endif
- /* The ResourceIndex type was only added in the 10.5 SDK */
-#ifndef MAC_OS_X_VERSION_10_5
+ /* The ResourceIndex type was available SDKs on 10.5 */
+#ifndef HAVE_TYPE_RESOURCE_INDEX
typedef short ResourceIndex;
#endif
@@ -134,7 +134,7 @@ typedef short ResourceIndex;
FSRef* ats_font_ref )
{
#if defined( MAC_OS_X_VERSION_10_5 ) && \
- MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
+ ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )
OSStatus err;
@@ -235,7 +235,7 @@ typedef short ResourceIndex;
FT_Long* face_index )
{
#if ( __LP64__ ) || ( defined( MAC_OS_X_VERSION_10_5 ) && \
- MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )
+ ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) )
FT_UNUSED( fontName );
FT_UNUSED( pathSpec );
FT_UNUSED( face_index );
@@ -1108,7 +1108,7 @@ typedef short ResourceIndex;
FT_Face* aface )
{
#if ( __LP64__ ) || ( defined( MAC_OS_X_VERSION_10_5 ) && \
- MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 )
+ ( MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 ) )
FT_UNUSED( library );
FT_UNUSED( spec );
FT_UNUSED( face_index );