1 /* ftconfig.h. Generated from ftconfig.in by configure. */
2 /***************************************************************************/
6 /* UNIX-specific configuration file (specification only). */
8 /* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007, 2008, 2009 by */
9 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
17 /***************************************************************************/
20 /*************************************************************************/
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 */
28 /* Note however that if some specific modifications are needed, we */
29 /* advise you to place a modified copy in your build directory. */
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. */
35 /*************************************************************************/
38 #ifndef __FTCONFIG_H__
39 #define __FTCONFIG_H__
42 #include FT_CONFIG_OPTIONS_H
43 #include FT_CONFIG_STANDARD_LIBRARY_H
49 /*************************************************************************/
51 /* PLATFORM-SPECIFIC CONFIGURATION MACROS */
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. */
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. */
71 /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */
75 #define FT_CHAR_BIT CHAR_BIT
79 /* #undef FT_USE_AUTOCONF_SIZEOF_TYPES */
80 #ifdef FT_USE_AUTOCONF_SIZEOF_TYPES
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)
103 #error "Unsupported size of `int' type!"
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)
115 #error "Unsupported size of `long' type!"
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 */
128 #define FT_UNUSED( arg ) ( (arg) = (arg) )
132 /*************************************************************************/
134 /* AUTOMATIC CONFIGURATION MACROS */
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. */
140 /*************************************************************************/
143 /*************************************************************************/
147 /* This is the only necessary change, so it is defined here instead */
148 /* providing a new configuration file. */
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
158 #define FT_MACINTOSH 1
161 #elif defined( __SC__ ) || defined( __MRC__ )
162 /* Classic MacOS compilers */
163 #include "ConditionalMacros.h"
165 #define FT_MACINTOSH 1
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
179 /*************************************************************************/
183 /* Used to guarantee the size of some specific integers. */
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
;
199 #error "no 32bit type found -- please check your configuration files"
203 /* look up an integer type that is at least 32 bits */
204 #if FT_SIZEOF_INT >= 4
207 typedef unsigned int FT_UFast
;
209 #elif FT_SIZEOF_LONG >= 4
211 typedef long FT_Fast
;
212 typedef unsigned long FT_UFast
;
217 /* determine whether we have a 64-bit int type for platforms without */
219 #if FT_SIZEOF_LONG == 8
221 /* FT_LONG64 must be defined if a 64-bit type is available */
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 */
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 */
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 */
247 #define FT_INT64 long long int
249 #elif defined( __GNUC__ )
251 /* GCC provides the `long long' type */
253 #define FT_INT64 long long int
255 #endif /* FT_SIZEOF_LONG == 8 */
258 /*************************************************************************/
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. */
265 #if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
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 `#'. */
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. */
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
,
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
)
315 #endif /* __arm__ && !__thumb__ */
318 #define FT_MULFIX_ASSEMBLER FT_MulFix_i386
320 static __inline__ FT_Int32
321 FT_MulFix_i386( FT_Int32 a
,
324 register FT_Int32 result
;
327 __asm__
__volatile__ (
329 "movl %%edx, %%ecx\n"
331 "addl $0x8000, %%ecx\n"
332 "addl %%ecx, %%eax\n"
336 "addl %%edx, %%eax\n"
337 : "=a"(result
), "+d"(b
)
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
357 #ifdef FT_MAKE_OPTION_SINGLE_OBJECT
359 #define FT_LOCAL( x ) static x
360 #define FT_LOCAL_DEF( x ) static x
365 #define FT_LOCAL( x ) extern "C" x
366 #define FT_LOCAL_DEF( x ) extern "C" x
368 #define FT_LOCAL( x ) extern x
369 #define FT_LOCAL_DEF( x ) x
372 #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
378 #define FT_BASE( x ) extern "C" x
380 #define FT_BASE( x ) extern x
383 #endif /* !FT_BASE */
389 #define FT_BASE_DEF( x ) x
391 #define FT_BASE_DEF( x ) x
394 #endif /* !FT_BASE_DEF */
400 #define FT_EXPORT( x ) __attribute__((visibility("default"))) extern "C" x
402 #define FT_EXPORT( x ) __attribute__((visibility("default"))) extern x
405 #endif /* !FT_EXPORT */
408 #ifndef FT_EXPORT_DEF
411 #define FT_EXPORT_DEF( x ) __attribute__((visibility("default"))) extern "C" x
413 #define FT_EXPORT_DEF( x ) __attribute__((visibility("default"))) extern x
416 #endif /* !FT_EXPORT_DEF */
419 #ifndef FT_EXPORT_VAR
422 #define FT_EXPORT_VAR( x ) extern "C" x
424 #define FT_EXPORT_VAR( x ) extern x
427 #endif /* !FT_EXPORT_VAR */
429 /* The following macros are needed to compile the library with a */
430 /* C++ compiler and with 16bit compilers. */
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. */
440 /* FT_CALLBACK_DEF is used to _define_ a callback function. */
442 /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
443 /* contains pointers to callback functions. */
445 /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */
446 /* that contains pointers to callback functions. */
449 /* Some 16bit compilers have to redefine these macros to insert */
450 /* the infamous `_cdecl' or `__fastcall' declarations. */
452 #ifndef FT_CALLBACK_DEF
454 #define FT_CALLBACK_DEF( x ) extern "C" x
456 #define FT_CALLBACK_DEF( x ) static x
458 #endif /* FT_CALLBACK_DEF */
460 #ifndef FT_CALLBACK_TABLE
462 #define FT_CALLBACK_TABLE extern "C"
463 #define FT_CALLBACK_TABLE_DEF extern "C"
465 #define FT_CALLBACK_TABLE extern
466 #define FT_CALLBACK_TABLE_DEF /* nothing */
468 #endif /* FT_CALLBACK_TABLE */
474 #endif /* __FTCONFIG_H__ */