1 /***************************************************************************/ |
|
2 /* */ |
|
3 /* ftconfig.in */ |
|
4 /* */ |
|
5 /* UNIX-specific configuration file (specification only). */ |
|
6 /* */ |
|
7 /* Copyright 1996-2004, 2006-2009, 2011 by */ |
|
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
|
9 /* */ |
|
10 /* This file is part of the FreeType project, and may only be used, */ |
|
11 /* modified, and distributed under the terms of the FreeType project */ |
|
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
|
13 /* this file you indicate that you have read the license and */ |
|
14 /* understand and accept it fully. */ |
|
15 /* */ |
|
16 /***************************************************************************/ |
|
17 |
|
18 |
|
19 /*************************************************************************/ |
|
20 /* */ |
|
21 /* This header file contains a number of macro definitions that are used */ |
|
22 /* by the rest of the engine. Most of the macros here are automatically */ |
|
23 /* determined at compile time, and you should not need to change it to */ |
|
24 /* port FreeType, except to compile the library with a non-ANSI */ |
|
25 /* compiler. */ |
|
26 /* */ |
|
27 /* Note however that if some specific modifications are needed, we */ |
|
28 /* advise you to place a modified copy in your build directory. */ |
|
29 /* */ |
|
30 /* The build directory is usually `freetype/builds/<system>', and */ |
|
31 /* contains system-specific files that are always included first when */ |
|
32 /* building the library. */ |
|
33 /* */ |
|
34 /*************************************************************************/ |
|
35 |
|
36 |
|
37 #ifndef __FTCONFIG_H__ |
|
38 #define __FTCONFIG_H__ |
|
39 |
|
40 #include <ft2build.h> |
|
41 #include FT_CONFIG_OPTIONS_H |
|
42 #include FT_CONFIG_STANDARD_LIBRARY_H |
|
43 |
|
44 |
|
45 FT_BEGIN_HEADER |
|
46 |
|
47 |
|
48 /*************************************************************************/ |
|
49 /* */ |
|
50 /* PLATFORM-SPECIFIC CONFIGURATION MACROS */ |
|
51 /* */ |
|
52 /* These macros can be toggled to suit a specific system. The current */ |
|
53 /* ones are defaults used to compile FreeType in an ANSI C environment */ |
|
54 /* (16bit compilers are also supported). Copy this file to your own */ |
|
55 /* `freetype/builds/<system>' directory, and edit it to port the engine. */ |
|
56 /* */ |
|
57 /*************************************************************************/ |
|
58 |
|
59 |
|
60 #undef HAVE_UNISTD_H |
|
61 #undef HAVE_FCNTL_H |
|
62 #undef HAVE_STDINT_H |
|
63 |
|
64 |
|
65 /* There are systems (like the Texas Instruments 'C54x) where a `char' */ |
|
66 /* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */ |
|
67 /* `int' has 16 bits also for this system, sizeof(int) gives 1 which */ |
|
68 /* is probably unexpected. */ |
|
69 /* */ |
|
70 /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */ |
|
71 /* `char' type. */ |
|
72 |
|
73 #ifndef FT_CHAR_BIT |
|
74 #define FT_CHAR_BIT CHAR_BIT |
|
75 #endif |
|
76 |
|
77 |
|
78 #undef FT_USE_AUTOCONF_SIZEOF_TYPES |
|
79 #ifdef FT_USE_AUTOCONF_SIZEOF_TYPES |
|
80 |
|
81 #undef SIZEOF_INT |
|
82 #undef SIZEOF_LONG |
|
83 #define FT_SIZEOF_INT SIZEOF_INT |
|
84 #define FT_SIZEOF_LONG SIZEOF_LONG |
|
85 |
|
86 #else /* !FT_USE_AUTOCONF_SIZEOF_TYPES */ |
|
87 |
|
88 /* Following cpp computation of the bit length of int and long */ |
|
89 /* is copied from default include/freetype/config/ftconfig.h. */ |
|
90 /* If any improvement is required for this file, it should be */ |
|
91 /* applied to the original header file for the builders that */ |
|
92 /* does not use configure script. */ |
|
93 |
|
94 /* The size of an `int' type. */ |
|
95 #if FT_UINT_MAX == 0xFFFFUL |
|
96 #define FT_SIZEOF_INT (16 / FT_CHAR_BIT) |
|
97 #elif FT_UINT_MAX == 0xFFFFFFFFUL |
|
98 #define FT_SIZEOF_INT (32 / FT_CHAR_BIT) |
|
99 #elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL |
|
100 #define FT_SIZEOF_INT (64 / FT_CHAR_BIT) |
|
101 #else |
|
102 #error "Unsupported size of `int' type!" |
|
103 #endif |
|
104 |
|
105 /* The size of a `long' type. A five-byte `long' (as used e.g. on the */ |
|
106 /* DM642) is recognized but avoided. */ |
|
107 #if FT_ULONG_MAX == 0xFFFFFFFFUL |
|
108 #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) |
|
109 #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL |
|
110 #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT) |
|
111 #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL |
|
112 #define FT_SIZEOF_LONG (64 / FT_CHAR_BIT) |
|
113 #else |
|
114 #error "Unsupported size of `long' type!" |
|
115 #endif |
|
116 |
|
117 #endif /* !FT_USE_AUTOCONF_SIZEOF_TYPES */ |
|
118 |
|
119 |
|
120 /* Preferred alignment of data */ |
|
121 #define FT_ALIGNMENT 8 |
|
122 |
|
123 |
|
124 /* FT_UNUSED is a macro used to indicate that a given parameter is not */ |
|
125 /* used -- this is only used to get rid of unpleasant compiler warnings */ |
|
126 #ifndef FT_UNUSED |
|
127 #define FT_UNUSED( arg ) ( (arg) = (arg) ) |
|
128 #endif |
|
129 |
|
130 |
|
131 /*************************************************************************/ |
|
132 /* */ |
|
133 /* AUTOMATIC CONFIGURATION MACROS */ |
|
134 /* */ |
|
135 /* These macros are computed from the ones defined above. Don't touch */ |
|
136 /* their definition, unless you know precisely what you are doing. No */ |
|
137 /* porter should need to mess with them. */ |
|
138 /* */ |
|
139 /*************************************************************************/ |
|
140 |
|
141 |
|
142 /*************************************************************************/ |
|
143 /* */ |
|
144 /* Mac support */ |
|
145 /* */ |
|
146 /* This is the only necessary change, so it is defined here instead */ |
|
147 /* providing a new configuration file. */ |
|
148 /* */ |
|
149 #if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \ |
|
150 ( defined( __MWERKS__ ) && defined( macintosh ) ) |
|
151 /* no Carbon frameworks for 64bit 10.4.x */ |
|
152 #include "AvailabilityMacros.h" |
|
153 #if defined( __LP64__ ) && \ |
|
154 ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 ) |
|
155 #define DARWIN_NO_CARBON 1 |
|
156 #else |
|
157 #define FT_MACINTOSH 1 |
|
158 #endif |
|
159 |
|
160 #elif defined( __SC__ ) || defined( __MRC__ ) |
|
161 /* Classic MacOS compilers */ |
|
162 #include "ConditionalMacros.h" |
|
163 #if TARGET_OS_MAC |
|
164 #define FT_MACINTOSH 1 |
|
165 #endif |
|
166 |
|
167 #endif |
|
168 |
|
169 |
|
170 /* Fix compiler warning with sgi compiler */ |
|
171 #if defined( __sgi ) && !defined( __GNUC__ ) |
|
172 #if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 ) |
|
173 #pragma set woff 3505 |
|
174 #endif |
|
175 #endif |
|
176 |
|
177 |
|
178 /*************************************************************************/ |
|
179 /* */ |
|
180 /* IntN types */ |
|
181 /* */ |
|
182 /* Used to guarantee the size of some specific integers. */ |
|
183 /* */ |
|
184 typedef signed short FT_Int16; |
|
185 typedef unsigned short FT_UInt16; |
|
186 |
|
187 #if FT_SIZEOF_INT == 4 |
|
188 |
|
189 typedef signed int FT_Int32; |
|
190 typedef unsigned int FT_UInt32; |
|
191 |
|
192 #elif FT_SIZEOF_LONG == 4 |
|
193 |
|
194 typedef signed long FT_Int32; |
|
195 typedef unsigned long FT_UInt32; |
|
196 |
|
197 #else |
|
198 #error "no 32bit type found -- please check your configuration files" |
|
199 #endif |
|
200 |
|
201 |
|
202 /* look up an integer type that is at least 32 bits */ |
|
203 #if FT_SIZEOF_INT >= 4 |
|
204 |
|
205 typedef int FT_Fast; |
|
206 typedef unsigned int FT_UFast; |
|
207 |
|
208 #elif FT_SIZEOF_LONG >= 4 |
|
209 |
|
210 typedef long FT_Fast; |
|
211 typedef unsigned long FT_UFast; |
|
212 |
|
213 #endif |
|
214 |
|
215 |
|
216 /* determine whether we have a 64-bit int type for platforms without */ |
|
217 /* Autoconf */ |
|
218 #if FT_SIZEOF_LONG == 8 |
|
219 |
|
220 /* FT_LONG64 must be defined if a 64-bit type is available */ |
|
221 #define FT_LONG64 |
|
222 #define FT_INT64 long |
|
223 |
|
224 #elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */ |
|
225 |
|
226 /* this compiler provides the __int64 type */ |
|
227 #define FT_LONG64 |
|
228 #define FT_INT64 __int64 |
|
229 |
|
230 #elif defined( __BORLANDC__ ) /* Borland C++ */ |
|
231 |
|
232 /* XXXX: We should probably check the value of __BORLANDC__ in order */ |
|
233 /* to test the compiler version. */ |
|
234 |
|
235 /* this compiler provides the __int64 type */ |
|
236 #define FT_LONG64 |
|
237 #define FT_INT64 __int64 |
|
238 |
|
239 #elif defined( __WATCOMC__ ) /* Watcom C++ */ |
|
240 |
|
241 /* Watcom doesn't provide 64-bit data types */ |
|
242 |
|
243 #elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */ |
|
244 |
|
245 #define FT_LONG64 |
|
246 #define FT_INT64 long long int |
|
247 |
|
248 #elif defined( __GNUC__ ) |
|
249 |
|
250 /* GCC provides the `long long' type */ |
|
251 #define FT_LONG64 |
|
252 #define FT_INT64 long long int |
|
253 |
|
254 #endif /* FT_SIZEOF_LONG == 8 */ |
|
255 |
|
256 |
|
257 /*************************************************************************/ |
|
258 /* */ |
|
259 /* A 64-bit data type will create compilation problems if you compile */ |
|
260 /* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */ |
|
261 /* is defined. You can however ignore this rule by defining the */ |
|
262 /* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */ |
|
263 /* */ |
|
264 #if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 ) |
|
265 |
|
266 #ifdef __STDC__ |
|
267 |
|
268 /* Undefine the 64-bit macros in strict ANSI compilation mode. */ |
|
269 /* Since `#undef' doesn't survive in configuration header files */ |
|
270 /* we use the postprocessing facility of AC_CONFIG_HEADERS to */ |
|
271 /* replace the leading `/' with `#'. */ |
|
272 /undef FT_LONG64 |
|
273 /undef FT_INT64 |
|
274 |
|
275 #endif /* __STDC__ */ |
|
276 |
|
277 #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */ |
|
278 |
|
279 |
|
280 #define FT_BEGIN_STMNT do { |
|
281 #define FT_END_STMNT } while ( 0 ) |
|
282 #define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT |
|
283 |
|
284 |
|
285 #ifndef FT_CONFIG_OPTION_NO_ASSEMBLER |
|
286 /* Provide assembler fragments for performance-critical functions. */ |
|
287 /* These must be defined `static __inline__' with GCC. */ |
|
288 |
|
289 #if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */ |
|
290 #define FT_MULFIX_ASSEMBLER FT_MulFix_arm |
|
291 |
|
292 /* documentation is in freetype.h */ |
|
293 |
|
294 static __inline FT_Int32 |
|
295 FT_MulFix_arm( FT_Int32 a, |
|
296 FT_Int32 b ) |
|
297 { |
|
298 register FT_Int32 t, t2; |
|
299 |
|
300 |
|
301 __asm |
|
302 { |
|
303 smull t2, t, b, a /* (lo=t2,hi=t) = a*b */ |
|
304 mov a, t, asr #31 /* a = (hi >> 31) */ |
|
305 add a, a, #0x8000 /* a += 0x8000 */ |
|
306 adds t2, t2, a /* t2 += a */ |
|
307 adc t, t, #0 /* t += carry */ |
|
308 mov a, t2, lsr #16 /* a = t2 >> 16 */ |
|
309 orr a, a, t, lsl #16 /* a |= t << 16 */ |
|
310 } |
|
311 return a; |
|
312 } |
|
313 |
|
314 #endif /* __CC_ARM || __ARMCC__ */ |
|
315 |
|
316 |
|
317 #ifdef __GNUC__ |
|
318 |
|
319 #if defined( __arm__ ) && !defined( __thumb__ ) && \ |
|
320 !( defined( __CC_ARM ) || defined( __ARMCC__ ) ) |
|
321 #define FT_MULFIX_ASSEMBLER FT_MulFix_arm |
|
322 |
|
323 /* documentation is in freetype.h */ |
|
324 |
|
325 static __inline__ FT_Int32 |
|
326 FT_MulFix_arm( FT_Int32 a, |
|
327 FT_Int32 b ) |
|
328 { |
|
329 register FT_Int32 t, t2; |
|
330 |
|
331 |
|
332 __asm__ __volatile__ ( |
|
333 "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */ |
|
334 "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */ |
|
335 "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */ |
|
336 "adds %1, %1, %0\n\t" /* %1 += %0 */ |
|
337 "adc %2, %2, #0\n\t" /* %2 += carry */ |
|
338 "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */ |
|
339 "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */ |
|
340 : "=r"(a), "=&r"(t2), "=&r"(t) |
|
341 : "r"(a), "r"(b) ); |
|
342 return a; |
|
343 } |
|
344 |
|
345 #endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */ |
|
346 |
|
347 #if defined( __i386__ ) |
|
348 #define FT_MULFIX_ASSEMBLER FT_MulFix_i386 |
|
349 |
|
350 /* documentation is in freetype.h */ |
|
351 |
|
352 static __inline__ FT_Int32 |
|
353 FT_MulFix_i386( FT_Int32 a, |
|
354 FT_Int32 b ) |
|
355 { |
|
356 register FT_Int32 result; |
|
357 |
|
358 |
|
359 __asm__ __volatile__ ( |
|
360 "imul %%edx\n" |
|
361 "movl %%edx, %%ecx\n" |
|
362 "sarl $31, %%ecx\n" |
|
363 "addl $0x8000, %%ecx\n" |
|
364 "addl %%ecx, %%eax\n" |
|
365 "adcl $0, %%edx\n" |
|
366 "shrl $16, %%eax\n" |
|
367 "shll $16, %%edx\n" |
|
368 "addl %%edx, %%eax\n" |
|
369 : "=a"(result), "=d"(b) |
|
370 : "a"(a), "d"(b) |
|
371 : "%ecx", "cc" ); |
|
372 return result; |
|
373 } |
|
374 |
|
375 #endif /* i386 */ |
|
376 |
|
377 #endif /* __GNUC__ */ |
|
378 |
|
379 |
|
380 #ifdef _MSC_VER /* Visual C++ */ |
|
381 |
|
382 #ifdef _M_IX86 |
|
383 |
|
384 #define FT_MULFIX_ASSEMBLER FT_MulFix_i386 |
|
385 |
|
386 /* documentation is in freetype.h */ |
|
387 |
|
388 static __inline FT_Int32 |
|
389 FT_MulFix_i386( FT_Int32 a, |
|
390 FT_Int32 b ) |
|
391 { |
|
392 register FT_Int32 result; |
|
393 |
|
394 __asm |
|
395 { |
|
396 mov eax, a |
|
397 mov edx, b |
|
398 imul edx |
|
399 mov ecx, edx |
|
400 sar ecx, 31 |
|
401 add ecx, 8000h |
|
402 add eax, ecx |
|
403 adc edx, 0 |
|
404 shr eax, 16 |
|
405 shl edx, 16 |
|
406 add eax, edx |
|
407 mov result, eax |
|
408 } |
|
409 return result; |
|
410 } |
|
411 |
|
412 #endif /* _M_IX86 */ |
|
413 |
|
414 #endif /* _MSC_VER */ |
|
415 |
|
416 #endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */ |
|
417 |
|
418 |
|
419 #ifdef FT_CONFIG_OPTION_INLINE_MULFIX |
|
420 #ifdef FT_MULFIX_ASSEMBLER |
|
421 #define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER |
|
422 #endif |
|
423 #endif |
|
424 |
|
425 |
|
426 #ifdef FT_MAKE_OPTION_SINGLE_OBJECT |
|
427 |
|
428 #define FT_LOCAL( x ) static x |
|
429 #define FT_LOCAL_DEF( x ) static x |
|
430 |
|
431 #else |
|
432 |
|
433 #ifdef __cplusplus |
|
434 #define FT_LOCAL( x ) extern "C" x |
|
435 #define FT_LOCAL_DEF( x ) extern "C" x |
|
436 #else |
|
437 #define FT_LOCAL( x ) extern x |
|
438 #define FT_LOCAL_DEF( x ) x |
|
439 #endif |
|
440 |
|
441 #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */ |
|
442 |
|
443 |
|
444 #ifndef FT_BASE |
|
445 |
|
446 #ifdef __cplusplus |
|
447 #define FT_BASE( x ) extern "C" x |
|
448 #else |
|
449 #define FT_BASE( x ) extern x |
|
450 #endif |
|
451 |
|
452 #endif /* !FT_BASE */ |
|
453 |
|
454 |
|
455 #ifndef FT_BASE_DEF |
|
456 |
|
457 #ifdef __cplusplus |
|
458 #define FT_BASE_DEF( x ) x |
|
459 #else |
|
460 #define FT_BASE_DEF( x ) x |
|
461 #endif |
|
462 |
|
463 #endif /* !FT_BASE_DEF */ |
|
464 |
|
465 |
|
466 #ifndef FT_EXPORT |
|
467 |
|
468 #ifdef __cplusplus |
|
469 #define FT_EXPORT( x ) extern "C" x |
|
470 #else |
|
471 #define FT_EXPORT( x ) extern x |
|
472 #endif |
|
473 |
|
474 #endif /* !FT_EXPORT */ |
|
475 |
|
476 |
|
477 #ifndef FT_EXPORT_DEF |
|
478 |
|
479 #ifdef __cplusplus |
|
480 #define FT_EXPORT_DEF( x ) extern "C" x |
|
481 #else |
|
482 #define FT_EXPORT_DEF( x ) extern x |
|
483 #endif |
|
484 |
|
485 #endif /* !FT_EXPORT_DEF */ |
|
486 |
|
487 |
|
488 #ifndef FT_EXPORT_VAR |
|
489 |
|
490 #ifdef __cplusplus |
|
491 #define FT_EXPORT_VAR( x ) extern "C" x |
|
492 #else |
|
493 #define FT_EXPORT_VAR( x ) extern x |
|
494 #endif |
|
495 |
|
496 #endif /* !FT_EXPORT_VAR */ |
|
497 |
|
498 /* The following macros are needed to compile the library with a */ |
|
499 /* C++ compiler and with 16bit compilers. */ |
|
500 /* */ |
|
501 |
|
502 /* This is special. Within C++, you must specify `extern "C"' for */ |
|
503 /* functions which are used via function pointers, and you also */ |
|
504 /* must do that for structures which contain function pointers to */ |
|
505 /* assure C linkage -- it's not possible to have (local) anonymous */ |
|
506 /* functions which are accessed by (global) function pointers. */ |
|
507 /* */ |
|
508 /* */ |
|
509 /* FT_CALLBACK_DEF is used to _define_ a callback function. */ |
|
510 /* */ |
|
511 /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */ |
|
512 /* contains pointers to callback functions. */ |
|
513 /* */ |
|
514 /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */ |
|
515 /* that contains pointers to callback functions. */ |
|
516 /* */ |
|
517 /* */ |
|
518 /* Some 16bit compilers have to redefine these macros to insert */ |
|
519 /* the infamous `_cdecl' or `__fastcall' declarations. */ |
|
520 /* */ |
|
521 #ifndef FT_CALLBACK_DEF |
|
522 #ifdef __cplusplus |
|
523 #define FT_CALLBACK_DEF( x ) extern "C" x |
|
524 #else |
|
525 #define FT_CALLBACK_DEF( x ) static x |
|
526 #endif |
|
527 #endif /* FT_CALLBACK_DEF */ |
|
528 |
|
529 #ifndef FT_CALLBACK_TABLE |
|
530 #ifdef __cplusplus |
|
531 #define FT_CALLBACK_TABLE extern "C" |
|
532 #define FT_CALLBACK_TABLE_DEF extern "C" |
|
533 #else |
|
534 #define FT_CALLBACK_TABLE extern |
|
535 #define FT_CALLBACK_TABLE_DEF /* nothing */ |
|
536 #endif |
|
537 #endif /* FT_CALLBACK_TABLE */ |
|
538 |
|
539 |
|
540 FT_END_HEADER |
|
541 |
|
542 |
|
543 #endif /* __FTCONFIG_H__ */ |
|
544 |
|
545 |
|
546 /* END */ |
|