Commit 9e2b9900dc5d764c31f8c9ae998a0f94f5c4d3b5

Suzuki, Toshiya (鈴木俊哉) 2008-10-03T11:52:22

* Remove duplicated functions from builds/mac/ftmac.c. Now MPW builds builds/mac/ftmac.c as a part of ftbase.c

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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
diff --git a/ChangeLog b/ChangeLog
index 4655391..83b032b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,32 @@
+2008-10-03  suzuki toshiya  <mpsuzuki@hiroshima-u.ac.jp>
+
+	* include/freetype/config/ftconfig.h: Define FT_MACINTOSH when
+	SC or MrC compiler of MPW is used. These compilers do not
+	define the macro __APPLE__ by themselves.
+	* builds/unix/ftconfig.in: Ditto.
+	* builds/vms/ftconfig.h: Ditto.
+	* src/base/ftbase.c: Use FT_MACINTOSH instead of __APPLE__,
+	to include ftmac.c when FreeType2 is built by MPW.
+	* src/base/ftobjs.c: Use FT_MACINTOSH instead of __APPLE__,
+	to enable shared functions for ftmac.c when FreeType2 is
+	built by MPW.
+
+	* builds/mac/ftmac.c: Include ftbase.h.
+	(memory_stream_close): Removed.
+	(new_memory_stream): Ditto.
+	(open_face_from_buffer): Removed.  Use the implementation in
+	ftobjs.c.
+	(ft_lookup_PS_in_sfnt): Ditto.
+
+	* builds/mac/FreeType.m68k_far.make.txt: Build ftmac.c as an
+	included part of ftbase.c, to share the functions in ftobjs.c.
+	The rule compiling ftmac.c separately is removed and the rule
+	copying ftbase.c from src/base/ftbase.c to builds/mac/ftbase.c
+	is added.
+	* builds/mac/FreeType.m68k_cfm.make.txt: Ditto.
+	* builds/mac/FreeType.ppc_classic.make.txt: Ditto.
+	* builds/mac/FreeType.ppc_carbon.make.txt: Ditto.
+
 2008-10-02  Bram Tassyns  <bramt@enfocus.be>
 
 	* src/cff/cffgload.c (cff_slot_load): Map CID 0 to GID 0.  This
diff --git a/builds/mac/FreeType.m68k_cfm.make.txt b/builds/mac/FreeType.m68k_cfm.make.txt
index 78d65d2..de28a11 100644
--- a/builds/mac/FreeType.m68k_cfm.make.txt
+++ b/builds/mac/FreeType.m68k_cfm.make.txt
@@ -31,9 +31,8 @@ COptions        = \xB6
 ### Source Files ###
 
 SrcFiles        =  \xB6
-				  :builds:mac:ftmac.c \xB6
 				  :src:autofit:autofit.c \xB6
-				  :src:base:ftbase.c \xB6
+				  :builds:mac:ftbase.c \xB6
 				  :src:base:ftbbox.c \xB6
 				  :src:base:ftbdf.c \xB6
 				  :src:base:ftbitmap.c \xB6
@@ -75,7 +74,6 @@ SrcFiles        =  \xB6
 ### Object Files ###
 
 ObjFiles-68K    =  \xB6
-				  "{ObjDir}ftmac.c.o" \xB6
 				  "{ObjDir}autofit.c.o" \xB6
 				  "{ObjDir}ftbase.c.o" \xB6
 				  "{ObjDir}ftbbox.c.o" \xB6
@@ -129,8 +127,14 @@ LibFiles-68K    =
 
 ### Build Rules ###
 
-"{ObjDir}ftmac.c.o" \xC4\xC4 :builds:mac:ftmac.c
-	{C} :builds:mac:ftmac.c -o "{ObjDir}ftmac.c.o" {COptions}
+:builds:mac:ftbase.c \xC4\xC4 :src:base:ftbase.c
+	Duplicate :src:base:ftbase.c :builds:mac:ftbase.c
+
+"{ObjDir}ftbase.c.o" \xC4\xC4 :builds:mac:ftbase.c
+	{C} :builds:mac:ftbase.c -o "{ObjDir}ftbase.c.o" \xB6
+		-i :builds:mac: \xB6
+		-i :src:base: \xB6
+		{COptions}
 
 FreeType.m68k_cfm    \xC4\xC4  FreeType.m68k_cfm.o
 
@@ -147,7 +151,7 @@ FreeType.m68k_cfm.o  \xC4\xC4  {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5
 ### Required Dependencies ###
 
 "{ObjDir}autofit.c.o" \xC4 :src:autofit:autofit.c
-"{ObjDir}ftbase.c.o" \xC4 :src:base:ftbase.c
+# "{ObjDir}ftbase.c.o" \xC4 :src:base:ftbase.c
 "{ObjDir}ftbbox.c.o" \xC4 :src:base:ftbbox.c
 "{ObjDir}ftbdf.c.o" \xC4 :src:base:ftbdf.c
 "{ObjDir}ftbitmap.c.o" \xC4 :src:base:ftbitmap.c
@@ -155,7 +159,6 @@ FreeType.m68k_cfm.o  \xC4\xC4  {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5
 "{ObjDir}ftglyph.c.o" \xC4 :src:base:ftglyph.c
 "{ObjDir}ftgxval.c.o" \xC4 :src:base:ftgxval.c
 "{ObjDir}ftinit.c.o" \xC4 :src:base:ftinit.c
-# "{ObjDir}ftmac.c.o" \xC4 :builds:mac:ftmac.c
 "{ObjDir}ftmm.c.o" \xC4 :src:base:ftmm.c
 "{ObjDir}ftotval.c.o" \xC4 :src:base:ftotval.c
 "{ObjDir}ftpfr.c.o" \xC4 :src:base:ftpfr.c
diff --git a/builds/mac/FreeType.m68k_far.make.txt b/builds/mac/FreeType.m68k_far.make.txt
index c23dead..e02adfa 100644
--- a/builds/mac/FreeType.m68k_far.make.txt
+++ b/builds/mac/FreeType.m68k_far.make.txt
@@ -30,9 +30,8 @@ COptions        = \xB6
 ### Source Files ###
 
 SrcFiles        =  \xB6
-				  :builds:mac:ftmac.c \xB6
 				  :src:autofit:autofit.c \xB6
-				  :src:base:ftbase.c \xB6
+				  :builds:mac:ftbase.c \xB6
 				  :src:base:ftbbox.c \xB6
 				  :src:base:ftbdf.c \xB6
 				  :src:base:ftbitmap.c \xB6
@@ -83,7 +82,6 @@ ObjFiles-68K    =  \xB6
 				  "{ObjDir}ftglyph.c.o" \xB6
 				  "{ObjDir}ftgxval.c.o" \xB6
 				  "{ObjDir}ftinit.c.o" \xB6
-				  "{ObjDir}ftmac.c.o" \xB6
 				  "{ObjDir}ftmm.c.o" \xB6
 				  "{ObjDir}ftotval.c.o" \xB6
 				  "{ObjDir}ftpfr.c.o" \xB6
@@ -128,8 +126,14 @@ LibFiles-68K    =
 
 ### Build Rules ###
 
-"{ObjDir}ftmac.c.o" \xC4\xC4 :builds:mac:ftmac.c
-	{C} :builds:mac:ftmac.c -o "{ObjDir}ftmac.c.o" {COptions}
+:builds:mac:ftbase.c \xC4\xC4 :src:base:ftbase.c
+	Duplicate :src:base:ftbase.c :builds:mac:ftbase.c
+
+"{ObjDir}ftbase.c.o" \xC4\xC4 :builds:mac:ftbase.c
+	{C} :builds:mac:ftbase.c -o "{ObjDir}ftbase.c.o" \xB6
+				-i :builds:mac: \xB6
+				-i :src:base: \xB6
+				{COptions}
 
 FreeType.m68k_far    \xC4\xC4  FreeType.m68k_far.o
 
@@ -146,7 +150,7 @@ FreeType.m68k_far.o  \xC4\xC4  {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5
 ### Required Dependencies ###
 
 "{ObjDir}autofit.c.o" \xC4 :src:autofit:autofit.c
-"{ObjDir}ftbase.c.o" \xC4 :src:base:ftbase.c
+# "{ObjDir}ftbase.c.o" \xC4 :src:base:ftbase.c
 "{ObjDir}ftbbox.c.o" \xC4 :src:base:ftbbox.c
 "{ObjDir}ftbdf.c.o" \xC4 :src:base:ftbdf.c
 "{ObjDir}ftbitmap.c.o" \xC4 :src:base:ftbitmap.c
@@ -154,7 +158,6 @@ FreeType.m68k_far.o  \xC4\xC4  {ObjFiles-68K} {LibFiles-68K} {\xA5MondoBuild\xA5
 "{ObjDir}ftglyph.c.o" \xC4 :src:base:ftglyph.c
 "{ObjDir}ftgxval.c.o" \xC4 :src:base:ftgxval.c
 "{ObjDir}ftinit.c.o" \xC4 :src:base:ftinit.c
-# "{ObjDir}ftmac.c.o" \xC4 :src:base:ftmac.c
 "{ObjDir}ftmm.c.o" \xC4 :src:base:ftmm.c
 "{ObjDir}ftotval.c.o" \xC4 :src:base:ftotval.c
 "{ObjDir}ftpfr.c.o" \xC4 :src:base:ftpfr.c
diff --git a/builds/mac/FreeType.ppc_carbon.make.txt b/builds/mac/FreeType.ppc_carbon.make.txt
index f8e2d66..debd0d1 100644
--- a/builds/mac/FreeType.ppc_carbon.make.txt
+++ b/builds/mac/FreeType.ppc_carbon.make.txt
@@ -31,9 +31,8 @@ PPCCOptions     = \xB6
 ### Source Files ###
 
 SrcFiles        =  \xB6
-				  :builds:mac:ftmac.c \xB6
 				  :src:autofit:autofit.c \xB6
-				  :src:base:ftbase.c \xB6
+				  :builds:mac:ftbase.c \xB6
 				  :src:base:ftbbox.c \xB6
 				  :src:base:ftbdf.c \xB6
 				  :src:base:ftbitmap.c \xB6
@@ -84,7 +83,6 @@ ObjFiles-PPC    =  \xB6
 				  "{ObjDir}ftglyph.c.x" \xB6
 				  "{ObjDir}ftgxval.c.x" \xB6
 				  "{ObjDir}ftinit.c.x" \xB6
-				  "{ObjDir}ftmac.c.x" \xB6
 				  "{ObjDir}ftmm.c.x" \xB6
 				  "{ObjDir}ftotval.c.x" \xB6
 				  "{ObjDir}ftpfr.c.x" \xB6
@@ -129,6 +127,15 @@ LibFiles-PPC    =
 
 ### Build Rules ###
 
+:builds:mac:ftbase.c \xC4\xC4 :src:base:ftbase.c
+	Duplicate :src:base:ftbase.c :builds:mac:ftbase.c
+
+"{ObjDir}ftbase.c.x"  \xC4\xC4  :builds:mac:ftbase.c
+	{PPCC} :builds:mac:ftbase.c -o {ObjDir}ftbase.c.x \xB6
+		-i :builds:mac: \xB6
+		-i :src:base: \xB6
+		{PPCCOptions}
+
 FreeType.ppc_carbon    \xC4\xC4  FreeType.ppc_carbon.o
 
 FreeType.ppc_carbon.o  \xC4\xC4  {ObjFiles-PPC} {LibFiles-PPC} {\xA5MondoBuild\xA5}
@@ -146,9 +153,8 @@ FreeType.ppc_carbon.o  \xC4\xC4  {ObjFiles-PPC} {LibFiles-PPC} {\xA5MondoBuild\x
 
 ### Required Dependencies ###
 
-"{ObjDir}ftmac.c.x" \xC4 :builds:mac:ftmac.c
 "{ObjDir}autofit.c.x" \xC4 :src:autofit:autofit.c
-"{ObjDir}ftbase.c.x" \xC4 :src:base:ftbase.c
+# "{ObjDir}ftbase.c.x" \xC4 :builds:mac:ftbase.c
 "{ObjDir}ftbbox.c.x" \xC4 :src:base:ftbbox.c
 "{ObjDir}ftbdf.c.x" \xC4 :src:base:ftbdf.c
 "{ObjDir}ftbitmap.c.x" \xC4 :src:base:ftbitmap.c
diff --git a/builds/mac/FreeType.ppc_classic.make.txt b/builds/mac/FreeType.ppc_classic.make.txt
index 5c743fd..582166f 100644
--- a/builds/mac/FreeType.ppc_classic.make.txt
+++ b/builds/mac/FreeType.ppc_classic.make.txt
@@ -31,9 +31,8 @@ PPCCOptions     = \xB6
 ### Source Files ###
 
 SrcFiles        =  \xB6
-				  :builds:mac:ftmac.c \xB6
 				  :src:autofit:autofit.c \xB6
-				  :src:base:ftbase.c \xB6
+				  :builds:mac:ftbase.c \xB6
 				  :src:base:ftbbox.c \xB6
 				  :src:base:ftbdf.c \xB6
 				  :src:base:ftbitmap.c \xB6
@@ -84,7 +83,6 @@ ObjFiles-PPC    =  \xB6
 				  "{ObjDir}ftglyph.c.x" \xB6
 				  "{ObjDir}ftgxval.c.x" \xB6
 				  "{ObjDir}ftinit.c.x" \xB6
-				  "{ObjDir}ftmac.c.x" \xB6
 				  "{ObjDir}ftmm.c.x" \xB6
 				  "{ObjDir}ftotval.c.x" \xB6
 				  "{ObjDir}ftpfr.c.x" \xB6
@@ -129,6 +127,15 @@ LibFiles-PPC    =
 
 ### Build Rules ###
 
+:builds:mac:ftbase.c \xC4\xC4 :src:base:ftbase.c
+	Duplicate :src:base:ftbase.c :builds:mac:ftbase.c
+
+"{ObjDir}ftbase.c.x"  \xC4\xC4  :builds:mac:ftbase.c
+	{PPCC} :builds:mac:ftbase.c -o "{ObjDir}ftbase.c.x" \xB6
+		-i :builds:mac: \xB6
+		-i :src:base: \xB6
+		{PPCCOptions}
+
 FreeType.ppc_classic    \xC4\xC4  FreeType.ppc_classic.o
 
 FreeType.ppc_classic.o  \xC4\xC4  {ObjFiles-PPC} {LibFiles-PPC} {\xA5MondoBuild\xA5}
@@ -146,9 +153,8 @@ FreeType.ppc_classic.o  \xC4\xC4  {ObjFiles-PPC} {LibFiles-PPC} {\xA5MondoBuild\
 
 ### Required Dependencies ###
 
-"{ObjDir}ftmac.c.x" \xC4 :builds:mac:ftmac.c
 "{ObjDir}autofit.c.x" \xC4 :src:autofit:autofit.c
-"{ObjDir}ftbase.c.x" \xC4 :src:base:ftbase.c
+# "{ObjDir}ftbase.c.x" \xC4 :builds:mac:ftbase.c
 "{ObjDir}ftbbox.c.x" \xC4 :src:base:ftbbox.c
 "{ObjDir}ftbdf.c.x" \xC4 :src:base:ftbdf.c
 "{ObjDir}ftbitmap.c.x" \xC4 :src:base:ftbitmap.c
diff --git a/builds/mac/ftmac.c b/builds/mac/ftmac.c
index 2484434..77f025e 100644
--- a/builds/mac/ftmac.c
+++ b/builds/mac/ftmac.c
@@ -65,6 +65,7 @@
 #include <ft2build.h>
 #include FT_FREETYPE_H
 #include FT_INTERNAL_STREAM_H
+#include "ftbase.h"
 
 #if defined( __GNUC__ ) || defined( __IBMC__ )
   /* This is for Mac OS X.  Without redefinition, OS_INLINE */
@@ -1073,109 +1074,6 @@ typedef short ResourceIndex;
   }
 
 
-  /* Finalizer for a memory stream; gets called by FT_Done_Face().
-     It frees the memory it uses. */
-  static void
-  memory_stream_close( FT_Stream  stream )
-  {
-    FT_Memory  memory = stream->memory;
-
-
-    FT_FREE( stream->base );
-
-    stream->size  = 0;
-    stream->base  = 0;
-    stream->close = 0;
-  }
-
-
-  /* Create a new memory stream from a buffer and a size. */
-  static FT_Error
-  new_memory_stream( FT_Library           library,
-                     FT_Byte*             base,
-                     FT_ULong             size,
-                     FT_Stream_CloseFunc  close,
-                     FT_Stream*           astream )
-  {
-    FT_Error   error;
-    FT_Memory  memory;
-    FT_Stream  stream;
-
-
-    if ( !library )
-      return FT_Err_Invalid_Library_Handle;
-
-    if ( !base )
-      return FT_Err_Invalid_Argument;
-
-    *astream = 0;
-    memory = library->memory;
-    if ( FT_NEW( stream ) )
-      goto Exit;
-
-    FT_Stream_OpenMemory( stream, base, size );
-
-    stream->close = close;
-
-    *astream = stream;
-
-  Exit:
-    return error;
-  }
-
-
-  /* Create a new FT_Face given a buffer and a driver name. */
-  static FT_Error
-  open_face_from_buffer( FT_Library  library,
-                         FT_Byte*    base,
-                         FT_ULong    size,
-                         FT_Long     face_index,
-                         char*       driver_name,
-                         FT_Face*    aface )
-  {
-    FT_Open_Args  args;
-    FT_Error      error;
-    FT_Stream     stream;
-    FT_Memory     memory = library->memory;
-
-
-    error = new_memory_stream( library,
-                               base,
-                               size,
-                               memory_stream_close,
-                               &stream );
-    if ( error )
-    {
-      FT_FREE( base );
-      return error;
-    }
-
-    args.flags  = FT_OPEN_STREAM;
-    args.stream = stream;
-    if ( driver_name )
-    {
-      args.flags  = args.flags | FT_OPEN_DRIVER;
-      args.driver = FT_Get_Module( library, driver_name );
-    }
-
-    /* At this point, face_index has served its purpose;      */
-    /* whoever calls this function has already used it to     */
-    /* locate the correct font data.  We should not propagate */
-    /* this index to FT_Open_Face() (unless it is negative).  */
-
-    if ( face_index > 0 )
-      face_index = 0;
-
-    error = FT_Open_Face( library, &args, face_index, aface );
-    if ( error == FT_Err_Ok )
-      (*aface)->face_flags &= ~FT_FACE_FLAG_EXTERNAL_STREAM;
-    else
-      FT_Stream_Free( stream, 0 );
-
-    return error;
-  }
-
-
   /* Create a new FT_Face from a file spec to an LWFN file. */
   static FT_Error
   FT_New_Face_From_LWFN( FT_Library    library,
@@ -1208,59 +1106,6 @@ typedef short ResourceIndex;
   }
 
 
-  /* Look up `TYP1' or `CID ' table from sfnt table directory. */
-  /* offset & length must exclude the binary header in tables. */
-
-  /* For proper support, PS Type1 and CID-keyed font drivers  */
-  /* should recognize sfnt-wrapped format. Here, yet TrueType */
-  /* font driver is not loaded, we must parse by ourselves.   */
-  /* We only care the name of table and offset. */
-
-  static FT_Error
-  ft_lookup_PS_in_sfnt( FT_Byte*   sfnt,
-                        FT_ULong*  offset,
-                        FT_ULong*  length,
-                        FT_Bool*   is_sfnt_cid )
-  {
-    FT_Byte*   p = sfnt + 4; /* skip version `typ1' */
-    FT_UShort  numTables = FT_NEXT_USHORT( p );
-
-
-    p += ( 2 * 3 ); /* skip binary search header */
-    for ( ; numTables > 0 ; numTables -- )
-    {
-      FT_ULong  tag = FT_NEXT_ULONG( p );
-
-
-      p += 4; /* skip checkSum */
-      *offset = FT_NEXT_ULONG( p );
-      *length = FT_NEXT_ULONG( p );
-
-      /* see Adobe TN# 5180 for binary header in CID table */
-      if ( tag == FT_MAKE_TAG( 'C', 'I', 'D', ' ' ) )
-      {
-        *offset += 22;
-        *length -= 22;
-        *is_sfnt_cid = TRUE;
-        return FT_Err_Ok;
-      }
-
-      /* see Apple "The Type 1 GX Font Format" */
-      if ( tag == FT_MAKE_TAG( 'T', 'Y', 'P', '1' ) )
-      {
-        *offset += 24;
-        *length -= 24;
-        *is_sfnt_cid = FALSE;
-        return FT_Err_Ok;
-      }
-    }
-
-    *offset = 0;
-    *length = 0;
-    return FT_Err_Invalid_Table;
-  }
-
-
   /* Create a new FT_Face from an SFNT resource, specified by res ID. */
   static FT_Error
   FT_New_Face_From_SFNT( FT_Library  library,
diff --git a/builds/unix/ftconfig.in b/builds/unix/ftconfig.in
index 868189e..b16d894 100644
--- a/builds/unix/ftconfig.in
+++ b/builds/unix/ftconfig.in
@@ -156,6 +156,14 @@ FT_BEGIN_HEADER
 #else
 #define FT_MACINTOSH 1
 #endif
+
+#elif  defined( __SC__ ) || defined( __MRC__ )
+  /* Classic MacOS compilers */
+#include "ConditionalMacros.h"
+#if TARGET_OS_MAC
+#define FT_MACINTOSH 1
+#endif
+
 #endif
 
 
diff --git a/builds/vms/ftconfig.h b/builds/vms/ftconfig.h
index 185c334..8026971 100644
--- a/builds/vms/ftconfig.h
+++ b/builds/vms/ftconfig.h
@@ -109,6 +109,14 @@ FT_BEGIN_HEADER
 #else
 #define FT_MACINTOSH 1
 #endif
+
+#elif  defined( __SC__ ) || defined( __MRC__ )
+  /* Classic MacOS compilers */
+#include "ConditionalMacros.h"
+#if TARGET_OS_MAC
+#define FT_MACINTOSH 1
+#endif
+
 #endif
 
 
diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h
index 9e92e70..214cec2 100644
--- a/include/freetype/config/ftconfig.h
+++ b/include/freetype/config/ftconfig.h
@@ -135,6 +135,14 @@ FT_BEGIN_HEADER
 #else
 #define FT_MACINTOSH 1
 #endif
+
+#elif  defined( __SC__ ) || defined( __MRC__ )
+  /* Classic MacOS compilers */
+#include "ConditionalMacros.h"
+#if TARGET_OS_MAC
+#define FT_MACINTOSH 1
+#endif
+
 #endif
 
 
diff --git a/src/base/ftbase.c b/src/base/ftbase.c
index 97bc10e..d1fe6e6 100644
--- a/src/base/ftbase.c
+++ b/src/base/ftbase.c
@@ -32,7 +32,7 @@
 #include "fttrigon.c"
 #include "ftutil.c"
 
-#if defined( __APPLE__ ) && !defined ( DARWIN_NO_CARBON )
+#if defined( FT_MACINTOSH ) && !defined ( DARWIN_NO_CARBON )
 #include "ftmac.c"
 #endif
 
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index b74f86e..3ae5a85 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -1119,7 +1119,7 @@
   /* there's a Mac-specific extended implementation of FT_New_Face() */
   /* in src/base/ftmac.c                                             */
 
-#if !defined( __APPLE__ ) || defined( DARWIN_NO_CARBON )
+#if !defined( FT_MACINTOSH ) || defined( DARWIN_NO_CARBON )
 
   /* documentation is in freetype.h */
 
@@ -1142,7 +1142,7 @@
     return FT_Open_Face( library, &args, face_index, aface );
   }
 
-#endif  /* defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) */
+#endif  /* defined( FT_MACINTOSH ) && !defined( DARWIN_NO_CARBON ) */
 
 
   /* documentation is in freetype.h */