Commit 714ee56ab152ae364eb49260acf2c9a114b44825

suzuki toshiya 2011-12-02T21:14:18

[mac] Unify DARWIN_NO_CARBON with FT_MACINTOSH. Originally FT_MACINTOSH was a pure auto macro and DARWIN_NO_CARBON was a configurable macro to disable Carbon-dependent code. Because now configure script sets DARWIN_NO_CARBON by default and disables Darwin & Carbon-dependent codes, these macros can be unified. FT_MACINTOSH (undefined by default) is kept and DARWIN_NO_CARBON (defined by default) is removed, because DARWIN_NO_CARBON violates FT_XXX naming convention of public macros, and a macro configured by default is not portable for the building without configure (e.g. make devel). * builds/unix/configure.raw: Define FT_MACINTOSH if Carbon-based old Mac font support is requested and Carbon is available. * builds/unix/ftconfig.in: Undefine FT_MACINTOSH when the support for Mac OS X without Carbon (e.g. Mac OS X 10.4 for ppc64) is requested. * include/freetype/config/ftconfig.in: Ditto. * builds/vms/ftconfig.h: Ditto. * src/base/ftbase.h: Remove DARWIN_NO_CARBON. * src/base/ftbase.c: Ditto. * src/base/ftobjs.c: Ditto. * src/base/ftrfork.c: Ditto. * src/base/ftmac.c: Compile the body if FT_MACINTOSH is defined (same with TT_USE_BYTECODE_INTERPRETER in ttinterp.c). * builds/mac/ftmac.c: Ditto. * builds/mac/FreeType.m68k_cfm.make.txt: Define FT_MACINTOSH. * builds/mac/FreeType.m68k_far.make.txt: Ditto. * builds/mac/FreeType.ppc_classic.make.txt: Ditto. * builds/mac/FreeType.ppc_carbon.make.txt: Ditto.

diff --git a/ChangeLog b/ChangeLog
index ad8469e..ab308cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,39 @@
+2011-12-02  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+	[mac] Unify DARWIN_NO_CARBON with FT_MACINTOSH.
+
+	Originally FT_MACINTOSH was a pure auto macro and DARWIN_NO_CARBON
+	was a configurable macro to disable Carbon-dependent code.  Because
+	now configure script sets DARWIN_NO_CARBON by default and disables
+	Darwin & Carbon-dependent codes, these macros can be unified.
+	FT_MACINTOSH (undefined by default) is kept and DARWIN_NO_CARBON
+	(defined by default) is removed, because DARWIN_NO_CARBON violates
+	FT_XXX naming convention of public macros, and a macro configured by 
+	default is not portable for the building without configure (e.g.
+	make devel).
+
+	* builds/unix/configure.raw: Define FT_MACINTOSH if Carbon-based
+	old Mac font support is requested and Carbon is available.
+	* builds/unix/ftconfig.in: Undefine FT_MACINTOSH when the support
+	for Mac OS X without Carbon (e.g.  Mac OS X 10.4 for ppc64) is
+	requested.
+	* include/freetype/config/ftconfig.in: Ditto.
+	* builds/vms/ftconfig.h: Ditto.
+
+	* src/base/ftbase.h: Remove DARWIN_NO_CARBON.
+	* src/base/ftbase.c: Ditto.
+	* src/base/ftobjs.c: Ditto.
+	* src/base/ftrfork.c: Ditto.
+
+	* src/base/ftmac.c: Compile the body if FT_MACINTOSH is defined
+	(same with TT_USE_BYTECODE_INTERPRETER in ttinterp.c).
+	* builds/mac/ftmac.c: Ditto.
+
+	* builds/mac/FreeType.m68k_cfm.make.txt: Define FT_MACINTOSH.
+	* builds/mac/FreeType.m68k_far.make.txt: Ditto.
+	* builds/mac/FreeType.ppc_classic.make.txt: Ditto.
+	* builds/mac/FreeType.ppc_carbon.make.txt: Ditto.
+
 2011-11-30  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
 
 	Fix Savannah bug #34728 (`make devel' on Mac OS X).
diff --git a/builds/mac/FreeType.m68k_cfm.make.txt b/builds/mac/FreeType.m68k_cfm.make.txt
index 0bd1452..425f9f9 100644
--- a/builds/mac/FreeType.m68k_cfm.make.txt
+++ b/builds/mac/FreeType.m68k_cfm.make.txt
@@ -17,6 +17,7 @@ Includes        =  \xB6
 Sym-68K         = -sym off
 
 COptions        = \xB6
+			-d FT_MACINTOSH=1 \xB6
 			-d HAVE_FSSPEC=1 \xB6
 			-d HAVE_FSREF=0 \xB6
 			-d HAVE_QUICKDRAW_TOOLBOX=1 \xB6
diff --git a/builds/mac/FreeType.m68k_far.make.txt b/builds/mac/FreeType.m68k_far.make.txt
index e8e2f6e..ebf5a1b 100644
--- a/builds/mac/FreeType.m68k_far.make.txt
+++ b/builds/mac/FreeType.m68k_far.make.txt
@@ -16,6 +16,7 @@ Includes        =  \xB6
 Sym-68K         = -sym off
 
 COptions        = \xB6
+			-d FT_MACINTOSH=1 \xB6
 			-d HAVE_FSSPEC=1 \xB6
 			-d HAVE_FSREF=0 \xB6
 			-d HAVE_QUICKDRAW_TOOLBOX=1 \xB6
diff --git a/builds/mac/FreeType.ppc_carbon.make.txt b/builds/mac/FreeType.ppc_carbon.make.txt
index c37e0f3..2926413 100644
--- a/builds/mac/FreeType.ppc_carbon.make.txt
+++ b/builds/mac/FreeType.ppc_carbon.make.txt
@@ -17,6 +17,7 @@ Includes        =  \xB6
 Sym-PPC         = -sym off
 
 PPCCOptions     = \xB6
+			-d FT_MACINTOSH=1 \xB6
 			-d HAVE_FSSPEC=1 \xB6
                         -d HAVE_FSREF=1 \xB6
 			-d HAVE_QUICKDRAW_TOOLBOX=1 \xB6
diff --git a/builds/mac/FreeType.ppc_classic.make.txt b/builds/mac/FreeType.ppc_classic.make.txt
index 0c0991e..377de9a 100644
--- a/builds/mac/FreeType.ppc_classic.make.txt
+++ b/builds/mac/FreeType.ppc_classic.make.txt
@@ -17,6 +17,7 @@ Includes        =  \xB6
 Sym-PPC         = -sym off
 
 PPCCOptions     = \xB6
+                        -d FT_MACINTOSH=1 \xB6
                         -d HAVE_FSSPEC=1 \xB6
                         -d HAVE_FSREF=0 \xB6
                         -d HAVE_QUICKDRAW_TOOLBOX=1 \xB6
diff --git a/builds/mac/ftmac.c b/builds/mac/ftmac.c
index c974f67..719dd0c 100644
--- a/builds/mac/ftmac.c
+++ b/builds/mac/ftmac.c
@@ -171,6 +171,7 @@ typedef short ResourceIndex;
 #define PREFER_LWFN  1
 #endif
 
+#ifdef FT_MACINTOSH
 
 #if !HAVE_QUICKDRAW_CARBON  /* QuickDraw is deprecated since Mac OS X 10.4 */
 
@@ -1527,5 +1528,7 @@ typedef short ResourceIndex;
 
   }
 
+#endif /* FT_MACINTOSH */
+
 
 /* END */
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index c557480..d51ae90 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -331,7 +331,7 @@ if test x$with_old_mac_fonts = xyes; then
     [AC_MSG_RESULT([ok])
      ftmac_c='ftmac.c'
      AC_MSG_CHECKING([OS_INLINE macro is ANSI compatible])
-     orig_CFLAGS="$CFLAGS"
+     orig_CFLAGS="$CFLAGS -DFT_MACINTOSH"
      CFLAGS="$CFLAGS $XX_CFLAGS $XX_ANSIFLAGS"
      AC_COMPILE_IFELSE([
        AC_LANG_PROGRAM([
diff --git a/builds/unix/ftconfig.in b/builds/unix/ftconfig.in
index fd4a5cd..9531afd 100644
--- a/builds/unix/ftconfig.in
+++ b/builds/unix/ftconfig.in
@@ -142,8 +142,7 @@ FT_BEGIN_HEADER
   /*   This is the only necessary change, so it is defined here instead    */
   /*   providing a new configuration file.                                 */
   /*                                                                       */
-#if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \
-    ( defined( __MWERKS__ ) && defined( macintosh )        )
+#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
   /* no Carbon frameworks for 64bit 10.4.x */
   /* AvailabilityMacros.h is available since Mac OS X 10.2,        */
   /* so guess the system version by maximum errno before inclusion */
@@ -153,9 +152,7 @@ FT_BEGIN_HEADER
 #endif
 #if defined( __LP64__ ) && \
     ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
-#define DARWIN_NO_CARBON 1
-#else
-#define FT_MACINTOSH 1
+/undef FT_MACINTOSH
 #endif
 
 #elif defined( __SC__ ) || defined( __MRC__ )
diff --git a/builds/vms/ftconfig.h b/builds/vms/ftconfig.h
index 99c37db..62fadac 100644
--- a/builds/vms/ftconfig.h
+++ b/builds/vms/ftconfig.h
@@ -95,8 +95,7 @@ FT_BEGIN_HEADER
   /*   This is the only necessary change, so it is defined here instead    */
   /*   providing a new configuration file.                                 */
   /*                                                                       */
-#if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \
-    ( defined( __MWERKS__ ) && defined( macintosh )        )
+#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
   /* no Carbon frameworks for 64bit 10.4.x */
   /* AvailabilityMacros.h is available since Mac OS X 10.2,        */
   /* so guess the system version by maximum errno before inclusion */
@@ -106,9 +105,7 @@ FT_BEGIN_HEADER
 #endif
 #if defined( __LP64__ ) && \
     ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
-#define DARWIN_NO_CARBON 1
-#else
-#define FT_MACINTOSH 1
+#undef FT_MACINTOSH
 #endif
 
 #elif defined( __SC__ ) || defined( __MRC__ )
diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h
index a9e767c..5628569 100644
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -120,8 +120,7 @@ FT_BEGIN_HEADER
   /*   This is the only necessary change, so it is defined here instead    */
   /*   providing a new configuration file.                                 */
   /*                                                                       */
-#if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \
-    ( defined( __MWERKS__ ) && defined( macintosh )        )
+#if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
   /* no Carbon frameworks for 64bit 10.4.x */
   /* AvailabilityMacros.h is available since Mac OS X 10.2,        */
   /* so guess the system version by maximum errno before inclusion */
@@ -131,9 +130,7 @@ FT_BEGIN_HEADER
 #endif
 #if defined( __LP64__ ) && \
     ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
-#define DARWIN_NO_CARBON 1
-#else
-#define FT_MACINTOSH 1
+#undef FT_MACINTOSH
 #endif
 
 #elif defined( __SC__ ) || defined( __MRC__ )
diff --git a/src/base/ftbase.c b/src/base/ftbase.c
index 6a27ea9..5e5d70e 100644
--- a/src/base/ftbase.c
+++ b/src/base/ftbase.c
@@ -34,7 +34,7 @@
 #include "fttrigon.c"
 #include "ftutil.c"
 
-#if defined( FT_MACINTOSH ) && !defined ( DARWIN_NO_CARBON )
+#ifdef FT_MACINTOSH
 #include "ftmac.c"
 #endif
 
diff --git a/src/base/ftbase.h b/src/base/ftbase.h
index 516f4bb..cb55197 100644
--- a/src/base/ftbase.h
+++ b/src/base/ftbase.h
@@ -49,8 +49,8 @@ FT_BEGIN_HEADER
                          FT_Face     *aface );
 
 
-#if defined( FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK ) && \
-    ( !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON ) )
+#if  defined( FT_CONFIG_OPTION_GUESSING_EMBEDDED_RFORK ) && \
+    !defined( FT_MACINTOSH )
   /* Mac OS X/Darwin kernel often changes recommended method to access */
   /* the resource fork and older methods makes the kernel issue the    */
   /* warning of deprecated method.  To calm it down, the methods based */
diff --git a/src/base/ftmac.c b/src/base/ftmac.c
index 63f927d..d892bf1 100644
--- a/src/base/ftmac.c
+++ b/src/base/ftmac.c
@@ -119,6 +119,8 @@
 #endif
 
 
+#ifdef FT_MACINTOSH
+
   /* This function is deprecated because FSSpec is deprecated in Mac OS X  */
   FT_EXPORT_DEF( FT_Error )
   FT_GetFile_From_Mac_Name( const char*  fontName,
@@ -1053,5 +1055,7 @@
 #endif
   }
 
+#endif /* FT_MACINTOSH */
+
 
 /* END */
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index 64575af..1a5a327 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1187,7 +1187,7 @@
   /* there's a Mac-specific extended implementation of FT_New_Face() */
   /* in src/base/ftmac.c                                             */
 
-#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON )
+#ifndef FT_MACINTOSH
 
   /* documentation is in freetype.h */
 
@@ -1211,7 +1211,7 @@
     return FT_Open_Face( library, &args, face_index, aface );
   }
 
-#endif  /* defined( FT_MACINTOSH ) && !defined( DARWIN_NO_CARBON ) */
+#endif
 
 
   /* documentation is in freetype.h */
@@ -1520,7 +1520,7 @@
   }
 
 
-#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON )
+#ifndef FT_MACINTOSH
 
   /* The resource header says we've got resource_cnt `POST' (type1) */
   /* resources in this file.  They all need to be coalesced into    */
diff --git a/src/base/ftrfork.c b/src/base/ftrfork.c
index 33768b0..e58d2fc 100644
--- a/src/base/ftrfork.c
+++ b/src/base/ftrfork.c
@@ -417,7 +417,7 @@
   }
 
 
-#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON )
+#ifndef FT_MACINTOSH
   static FT_RFork_Rule
   raccess_get_rule_type_from_rule_index( FT_UInt  rule_index )
   {