[Sync] Fix namespace for sync_driver component
[chromium-blink-merge.git] / third_party / freetype2 / include / ftconfig.h
blob16f8854e27efb947eb65950c22abaca687160261
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-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 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 /* Preferred alignment of data */
122 #define FT_ALIGNMENT 8
125 /* FT_UNUSED is a macro used to indicate that a given parameter is not */
126 /* used -- this is only used to get rid of unpleasant compiler warnings */
127 #ifndef FT_UNUSED
128 #define FT_UNUSED( arg ) ( (arg) = (arg) )
129 #endif
132 /*************************************************************************/
133 /* */
134 /* AUTOMATIC CONFIGURATION MACROS */
135 /* */
136 /* These macros are computed from the ones defined above. Don't touch */
137 /* their definition, unless you know precisely what you are doing. No */
138 /* porter should need to mess with them. */
139 /* */
140 /*************************************************************************/
143 /*************************************************************************/
144 /* */
145 /* Mac support */
146 /* */
147 /* This is the only necessary change, so it is defined here instead */
148 /* providing a new configuration file. */
149 /* */
150 #if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \
151 ( defined( __MWERKS__ ) && defined( macintosh ) )
152 /* no Carbon frameworks for 64bit 10.4.x */
153 #include "AvailabilityMacros.h"
154 #if defined( __LP64__ ) && \
155 ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
156 #define DARWIN_NO_CARBON 1
157 #else
158 #define FT_MACINTOSH 1
159 #endif
161 #elif defined( __SC__ ) || defined( __MRC__ )
162 /* Classic MacOS compilers */
163 #include "ConditionalMacros.h"
164 #if TARGET_OS_MAC
165 #define FT_MACINTOSH 1
166 #endif
168 #endif
171 /* Fix compiler warning with sgi compiler */
172 #if defined( __sgi ) && !defined( __GNUC__ )
173 #if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )
174 #pragma set woff 3505
175 #endif
176 #endif
179 /*************************************************************************/
180 /* */
181 /* IntN types */
182 /* */
183 /* Used to guarantee the size of some specific integers. */
184 /* */
185 typedef signed short FT_Int16;
186 typedef unsigned short FT_UInt16;
188 #if FT_SIZEOF_INT == 4
190 typedef signed int FT_Int32;
191 typedef unsigned int FT_UInt32;
193 #elif FT_SIZEOF_LONG == 4
195 typedef signed long FT_Int32;
196 typedef unsigned long FT_UInt32;
198 #else
199 #error "no 32bit type found -- please check your configuration files"
200 #endif
203 /* look up an integer type that is at least 32 bits */
204 #if FT_SIZEOF_INT >= 4
206 typedef int FT_Fast;
207 typedef unsigned int FT_UFast;
209 #elif FT_SIZEOF_LONG >= 4
211 typedef long FT_Fast;
212 typedef unsigned long FT_UFast;
214 #endif
217 /* determine whether we have a 64-bit int type for platforms without */
218 /* Autoconf */
219 #if FT_SIZEOF_LONG == 8
221 /* FT_LONG64 must be defined if a 64-bit type is available */
222 #define FT_LONG64
223 #define FT_INT64 long
225 #elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
227 /* this compiler provides the __int64 type */
228 #define FT_LONG64
229 #define FT_INT64 __int64
231 #elif defined( __BORLANDC__ ) /* Borland C++ */
233 /* XXXX: We should probably check the value of __BORLANDC__ in order */
234 /* to test the compiler version. */
236 /* this compiler provides the __int64 type */
237 #define FT_LONG64
238 #define FT_INT64 __int64
240 #elif defined( __WATCOMC__ ) /* Watcom C++ */
242 /* Watcom doesn't provide 64-bit data types */
244 #elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
246 #define FT_LONG64
247 #define FT_INT64 long long int
249 #elif defined( __GNUC__ )
251 /* GCC provides the `long long' type */
252 #define FT_LONG64
253 #define FT_INT64 long long int
255 #endif /* FT_SIZEOF_LONG == 8 */
258 /*************************************************************************/
259 /* */
260 /* A 64-bit data type will create compilation problems if you compile */
261 /* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */
262 /* is defined. You can however ignore this rule by defining the */
263 /* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
264 /* */
265 #if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
267 #ifdef __STDC__
269 /* Undefine the 64-bit macros in strict ANSI compilation mode. */
270 /* Since `#undef' doesn't survive in configuration header files */
271 /* we use the postprocessing facility of AC_CONFIG_HEADERS to */
272 /* replace the leading `/' with `#'. */
273 #undef FT_LONG64
274 #undef FT_INT64
276 #endif /* __STDC__ */
278 #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
281 #define FT_BEGIN_STMNT do {
282 #define FT_END_STMNT } while ( 0 )
283 #define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
286 #ifndef FT_CONFIG_OPTION_NO_ASSEMBLER
287 /* Provide assembler fragments for performance-critical functions. */
288 /* These must be defined `static __inline__' with GCC. */
290 #ifdef __GNUC__
292 #if defined( __arm__ ) && !defined( __thumb__ )
293 #define FT_MULFIX_ASSEMBLER FT_MulFix_arm
295 static __inline__ FT_Int32
296 FT_MulFix_arm( FT_Int32 a,
297 FT_Int32 b )
299 register FT_Int32 t, t2;
302 __asm__ __volatile__ (
303 "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
304 "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
305 "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
306 "adds %1, %1, %0\n\t" /* %1 += %0 */
307 "adc %2, %2, #0\n\t" /* %2 += carry */
308 "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */
309 "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
310 : "=r"(a), "=&r"(t2), "=&r"(t)
311 : "r"(a), "r"(b) );
312 return a;
315 #endif /* __arm__ && !__thumb__ */
317 #if defined( i386 )
318 #define FT_MULFIX_ASSEMBLER FT_MulFix_i386
320 static __inline__ FT_Int32
321 FT_MulFix_i386( FT_Int32 a,
322 FT_Int32 b )
324 register FT_Int32 result;
327 __asm__ __volatile__ (
328 "imul %%edx\n"
329 "movl %%edx, %%ecx\n"
330 "sarl $31, %%ecx\n"
331 "addl $0x8000, %%ecx\n"
332 "addl %%ecx, %%eax\n"
333 "adcl $0, %%edx\n"
334 "shrl $16, %%eax\n"
335 "shll $16, %%edx\n"
336 "addl %%edx, %%eax\n"
337 : "=a"(result), "+d"(b)
338 : "a"(a)
339 : "%ecx" );
340 return result;
343 #endif /* i386 */
345 #endif /* __GNUC__ */
347 #endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
350 #ifdef FT_CONFIG_OPTION_INLINE_MULFIX
351 #ifdef FT_MULFIX_ASSEMBLER
352 #define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER
353 #endif
354 #endif
357 #ifdef FT_MAKE_OPTION_SINGLE_OBJECT
359 #define FT_LOCAL( x ) static x
360 #define FT_LOCAL_DEF( x ) static x
362 #else
364 #ifdef __cplusplus
365 #define FT_LOCAL( x ) extern "C" x
366 #define FT_LOCAL_DEF( x ) extern "C" x
367 #else
368 #define FT_LOCAL( x ) extern x
369 #define FT_LOCAL_DEF( x ) x
370 #endif
372 #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
375 #ifndef FT_BASE
377 #ifdef __cplusplus
378 #define FT_BASE( x ) extern "C" x
379 #else
380 #define FT_BASE( x ) extern x
381 #endif
383 #endif /* !FT_BASE */
386 #ifndef FT_BASE_DEF
388 #ifdef __cplusplus
389 #define FT_BASE_DEF( x ) x
390 #else
391 #define FT_BASE_DEF( x ) x
392 #endif
394 #endif /* !FT_BASE_DEF */
397 #ifndef FT_EXPORT
399 #ifdef __cplusplus
400 #define FT_EXPORT( x ) __attribute__((visibility("default"))) extern "C" x
401 #else
402 #define FT_EXPORT( x ) __attribute__((visibility("default"))) extern x
403 #endif
405 #endif /* !FT_EXPORT */
408 #ifndef FT_EXPORT_DEF
410 #ifdef __cplusplus
411 #define FT_EXPORT_DEF( x ) __attribute__((visibility("default"))) extern "C" x
412 #else
413 #define FT_EXPORT_DEF( x ) __attribute__((visibility("default"))) extern x
414 #endif
416 #endif /* !FT_EXPORT_DEF */
419 #ifndef FT_EXPORT_VAR
421 #ifdef __cplusplus
422 #define FT_EXPORT_VAR( x ) extern "C" x
423 #else
424 #define FT_EXPORT_VAR( x ) extern x
425 #endif
427 #endif /* !FT_EXPORT_VAR */
429 /* The following macros are needed to compile the library with a */
430 /* C++ compiler and with 16bit compilers. */
431 /* */
433 /* This is special. Within C++, you must specify `extern "C"' for */
434 /* functions which are used via function pointers, and you also */
435 /* must do that for structures which contain function pointers to */
436 /* assure C linkage -- it's not possible to have (local) anonymous */
437 /* functions which are accessed by (global) function pointers. */
438 /* */
439 /* */
440 /* FT_CALLBACK_DEF is used to _define_ a callback function. */
441 /* */
442 /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
443 /* contains pointers to callback functions. */
444 /* */
445 /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */
446 /* that contains pointers to callback functions. */
447 /* */
448 /* */
449 /* Some 16bit compilers have to redefine these macros to insert */
450 /* the infamous `_cdecl' or `__fastcall' declarations. */
451 /* */
452 #ifndef FT_CALLBACK_DEF
453 #ifdef __cplusplus
454 #define FT_CALLBACK_DEF( x ) extern "C" x
455 #else
456 #define FT_CALLBACK_DEF( x ) static x
457 #endif
458 #endif /* FT_CALLBACK_DEF */
460 #ifndef FT_CALLBACK_TABLE
461 #ifdef __cplusplus
462 #define FT_CALLBACK_TABLE extern "C"
463 #define FT_CALLBACK_TABLE_DEF extern "C"
464 #else
465 #define FT_CALLBACK_TABLE extern
466 #define FT_CALLBACK_TABLE_DEF /* nothing */
467 #endif
468 #endif /* FT_CALLBACK_TABLE */
471 FT_END_HEADER
474 #endif /* __FTCONFIG_H__ */
477 /* END */