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