1 /***************************************************************************/
5 /* UNIX-specific configuration file (specification only). */
7 /* Copyright 1996-2001, 2002, 2003, 2004, 2006, 2007 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
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. */
16 /***************************************************************************/
19 /*************************************************************************/
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 */
27 /* Note however that if some specific modifications are needed, we */
28 /* advise you to place a modified copy in your build directory. */
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. */
34 /*************************************************************************/
37 #ifndef __FTCONFIG_H__
38 #define __FTCONFIG_H__
41 #include FT_CONFIG_OPTIONS_H
42 #include FT_CONFIG_STANDARD_LIBRARY_H
48 /*************************************************************************/
50 /* PLATFORM-SPECIFIC CONFIGURATION MACROS */
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. */
57 /*************************************************************************/
67 #define FT_SIZEOF_INT SIZEOF_INT
68 #define FT_SIZEOF_LONG SIZEOF_LONG
70 #define FT_CHAR_BIT CHAR_BIT
72 /* Preferred alignment of data */
73 #define FT_ALIGNMENT 8
76 /* FT_UNUSED is a macro used to indicate that a given parameter is not */
77 /* used -- this is only used to get rid of unpleasant compiler warnings */
79 #define FT_UNUSED( arg ) ( (arg) = (arg) )
83 /*************************************************************************/
85 /* AUTOMATIC CONFIGURATION MACROS */
87 /* These macros are computed from the ones defined above. Don't touch */
88 /* their definition, unless you know precisely what you are doing. No */
89 /* porter should need to mess with them. */
91 /*************************************************************************/
94 /*************************************************************************/
98 /* This is the only necessary change, so it is defined here instead */
99 /* providing a new configuration file. */
101 #if ( defined( __APPLE__ ) && !defined( DARWIN_NO_CARBON ) ) || \
102 ( defined( __MWERKS__ ) && defined( macintosh ) )
103 /* no Carbon frameworks for 64bit 10.4.x */
104 #include "AvailabilityMacros.h"
105 #if defined( __LP64__ ) && \
106 ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
107 #define DARWIN_NO_CARBON 1
109 #define FT_MACINTOSH 1
114 /* Fix compiler warning with sgi compiler */
115 #if defined( __sgi ) && !defined( __GNUC__ )
116 #if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )
117 #pragma set woff 3505
122 /*************************************************************************/
126 /* Used to guarantee the size of some specific integers. */
128 typedef signed short FT_Int16;
129 typedef unsigned short FT_UInt16;
131 #if FT_SIZEOF_INT == 4
133 typedef signed int FT_Int32;
134 typedef unsigned int FT_UInt32;
136 #elif FT_SIZEOF_LONG == 4
138 typedef signed long FT_Int32;
139 typedef unsigned long FT_UInt32;
142 #error "no 32bit type found -- please check your configuration files"
146 /* look up an integer type that is at least 32 bits */
147 #if FT_SIZEOF_INT >= 4
150 typedef unsigned int FT_UFast;
152 #elif FT_SIZEOF_LONG >= 4
154 typedef long FT_Fast;
155 typedef unsigned long FT_UFast;
160 /* determine whether we have a 64-bit int type for platforms without */
162 #if FT_SIZEOF_LONG == 8
164 /* FT_LONG64 must be defined if a 64-bit type is available */
166 #define FT_INT64 long
168 #elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
170 /* this compiler provides the __int64 type */
172 #define FT_INT64 __int64
174 #elif defined( __BORLANDC__ ) /* Borland C++ */
176 /* XXXX: We should probably check the value of __BORLANDC__ in order */
177 /* to test the compiler version. */
179 /* this compiler provides the __int64 type */
181 #define FT_INT64 __int64
183 #elif defined( __WATCOMC__ ) /* Watcom C++ */
185 /* Watcom doesn't provide 64-bit data types */
187 #elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
190 #define FT_INT64 long long int
192 #elif defined( __GNUC__ )
194 /* GCC provides the `long long' type */
196 #define FT_INT64 long long int
198 #endif /* FT_SIZEOF_LONG == 8 */
201 #define FT_BEGIN_STMNT do {
202 #define FT_END_STMNT } while ( 0 )
203 #define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
206 /*************************************************************************/
208 /* A 64-bit data type will create compilation problems if you compile */
209 /* in strict ANSI mode. To avoid them, we disable their use if */
210 /* __STDC__ is defined. You can however ignore this rule by */
211 /* defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
213 #if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
217 /* Undefine the 64-bit macros in strict ANSI compilation mode. */
218 /* Since `#undef' doesn't survive in configuration header files */
219 /* we use the postprocessing facility of AC_CONFIG_HEADERS to */
220 /* replace the leading `/' with `#'. */
224 #endif /* __STDC__ */
226 #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
229 #ifdef FT_MAKE_OPTION_SINGLE_OBJECT
231 #define FT_LOCAL( x ) static x
232 #define FT_LOCAL_DEF( x ) static x
237 #define FT_LOCAL( x ) extern "C" x
238 #define FT_LOCAL_DEF( x ) extern "C" x
240 #define FT_LOCAL( x ) extern x
241 #define FT_LOCAL_DEF( x ) x
244 #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
250 #define FT_BASE( x ) extern "C" x
252 #define FT_BASE( x ) extern x
255 #endif /* !FT_BASE */
261 #define FT_BASE_DEF( x ) x
263 #define FT_BASE_DEF( x ) x
266 #endif /* !FT_BASE_DEF */
272 #define FT_EXPORT( x ) extern "C" x
274 #define FT_EXPORT( x ) extern x
277 #endif /* !FT_EXPORT */
280 #ifndef FT_EXPORT_DEF
283 #define FT_EXPORT_DEF( x ) extern "C" x
285 #define FT_EXPORT_DEF( x ) extern x
288 #endif /* !FT_EXPORT_DEF */
291 #ifndef FT_EXPORT_VAR
294 #define FT_EXPORT_VAR( x ) extern "C" x
296 #define FT_EXPORT_VAR( x ) extern x
299 #endif /* !FT_EXPORT_VAR */
301 /* The following macros are needed to compile the library with a */
302 /* C++ compiler and with 16bit compilers. */
305 /* This is special. Within C++, you must specify `extern "C"' for */
306 /* functions which are used via function pointers, and you also */
307 /* must do that for structures which contain function pointers to */
308 /* assure C linkage -- it's not possible to have (local) anonymous */
309 /* functions which are accessed by (global) function pointers. */
312 /* FT_CALLBACK_DEF is used to _define_ a callback function. */
314 /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
315 /* contains pointers to callback functions. */
317 /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */
318 /* that contains pointers to callback functions. */
321 /* Some 16bit compilers have to redefine these macros to insert */
322 /* the infamous `_cdecl' or `__fastcall' declarations. */
324 #ifndef FT_CALLBACK_DEF
326 #define FT_CALLBACK_DEF( x ) extern "C" x
328 #define FT_CALLBACK_DEF( x ) static x
330 #endif /* FT_CALLBACK_DEF */
332 #ifndef FT_CALLBACK_TABLE
334 #define FT_CALLBACK_TABLE extern "C"
335 #define FT_CALLBACK_TABLE_DEF extern "C"
337 #define FT_CALLBACK_TABLE extern
338 #define FT_CALLBACK_TABLE_DEF /* nothing */
340 #endif /* FT_CALLBACK_TABLE */
346 #endif /* __FTCONFIG_H__ */