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-2018 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/***************************************************************************/
18
19
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 `builds/<system>', and contains */
32 /* system-specific files that are always included first when building */
33 /* the library. */
34 /* */
35 /*************************************************************************/
36
37
38#ifndef FTCONFIG_H_
39#define FTCONFIG_H_
40
41#include <ft2build.h>
42#include FT_CONFIG_OPTIONS_H
43#include FT_CONFIG_STANDARD_LIBRARY_H
44
45
46FT_BEGIN_HEADER
47
48
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 /* `builds/<system>' directory, and edit it to port the engine. */
57 /* */
58 /*************************************************************************/
59
60
61#define HAVE_UNISTD_H 1
62#define HAVE_FCNTL_H 1
63#define HAVE_STDINT_H 1
64
65
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. */
73
74#ifndef FT_CHAR_BIT
75#define FT_CHAR_BIT CHAR_BIT
76#endif
77
78
79/* #undef FT_USE_AUTOCONF_SIZEOF_TYPES */
80#ifdef FT_USE_AUTOCONF_SIZEOF_TYPES
81
82#define SIZEOF_INT 4
83#define SIZEOF_LONG __SIZEOF_LONG__
84#define FT_SIZEOF_INT SIZEOF_INT
85#define FT_SIZEOF_LONG SIZEOF_LONG
86
87#else /* !FT_USE_AUTOCONF_SIZEOF_TYPES */
88
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 /* do not use configure script. */
94
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
105
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
117
118#endif /* !FT_USE_AUTOCONF_SIZEOF_TYPES */
119
120
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
126
127
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 /*************************************************************************/
137
138
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( __MWERKS__ ) && defined( macintosh ) )
147 /* no Carbon frameworks for 64bit 10.4.x */
148 /* AvailabilityMacros.h is available since Mac OS X 10.2, */
149 /* so guess the system version by maximum errno before inclusion */
150#include <errno.h>
151#ifdef ECANCELED /* defined since 10.2 */
152#include "AvailabilityMacros.h"
153#endif
154#if defined( __LP64__ ) && \
155 ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
156#undef FT_MACINTOSH
157#endif
158
159#elif defined( __SC__ ) || defined( __MRC__ )
160 /* Classic MacOS compilers */
161#include "ConditionalMacros.h"
162#if TARGET_OS_MAC
163#define FT_MACINTOSH 1
164#endif
165
166#endif
167
168
169 /* Fix compiler warning with sgi compiler */
170#if defined( __sgi ) && !defined( __GNUC__ )
171#if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )
172#pragma set woff 3505
173#endif
174#endif
175
176
177 /*************************************************************************/
178 /* */
179 /* <Section> */
180 /* basic_types */
181 /* */
182 /*************************************************************************/
183
184
185 /*************************************************************************/
186 /* */
187 /* <Type> */
188 /* FT_Int16 */
189 /* */
190 /* <Description> */
191 /* A typedef for a 16bit signed integer type. */
192 /* */
193 typedef signed short FT_Int16;
194
195
196 /*************************************************************************/
197 /* */
198 /* <Type> */
199 /* FT_UInt16 */
200 /* */
201 /* <Description> */
202 /* A typedef for a 16bit unsigned integer type. */
203 /* */
204 typedef unsigned short FT_UInt16;
205
206 /* */
207
208
209 /* this #if 0 ... #endif clause is for documentation purposes */
210#if 0
211
212 /*************************************************************************/
213 /* */
214 /* <Type> */
215 /* FT_Int32 */
216 /* */
217 /* <Description> */
218 /* A typedef for a 32bit signed integer type. The size depends on */
219 /* the configuration. */
220 /* */
221 typedef signed XXX FT_Int32;
222
223
224 /*************************************************************************/
225 /* */
226 /* <Type> */
227 /* FT_UInt32 */
228 /* */
229 /* A typedef for a 32bit unsigned integer type. The size depends on */
230 /* the configuration. */
231 /* */
232 typedef unsigned XXX FT_UInt32;
233
234
235 /*************************************************************************/
236 /* */
237 /* <Type> */
238 /* FT_Int64 */
239 /* */
240 /* A typedef for a 64bit signed integer type. The size depends on */
241 /* the configuration. Only defined if there is real 64bit support; */
242 /* otherwise, it gets emulated with a structure (if necessary). */
243 /* */
244 typedef signed XXX FT_Int64;
245
246
247 /*************************************************************************/
248 /* */
249 /* <Type> */
250 /* FT_UInt64 */
251 /* */
252 /* A typedef for a 64bit unsigned integer type. The size depends on */
253 /* the configuration. Only defined if there is real 64bit support; */
254 /* otherwise, it gets emulated with a structure (if necessary). */
255 /* */
256 typedef unsigned XXX FT_UInt64;
257
258 /* */
259
260#endif
261
262#if FT_SIZEOF_INT == 4
263
264 typedef signed int FT_Int32;
265 typedef unsigned int FT_UInt32;
266
267#elif FT_SIZEOF_LONG == 4
268
269 typedef signed long FT_Int32;
270 typedef unsigned long FT_UInt32;
271
272#else
273#error "no 32bit type found -- please check your configuration files"
274#endif
275
276
277 /* look up an integer type that is at least 32 bits */
278#if FT_SIZEOF_INT >= 4
279
280 typedef int FT_Fast;
281 typedef unsigned int FT_UFast;
282
283#elif FT_SIZEOF_LONG >= 4
284
285 typedef long FT_Fast;
286 typedef unsigned long FT_UFast;
287
288#endif
289
290
291 /* determine whether we have a 64-bit int type */
292 /* (mostly for environments without `autoconf') */
293#if FT_SIZEOF_LONG == 8
294
295 /* FT_LONG64 must be defined if a 64-bit type is available */
296#define FT_LONG64
297#define FT_INT64 long
298#define FT_UINT64 unsigned long
299
300 /* we handle the LLP64 scheme separately for GCC and clang, */
301 /* suppressing the `long long' warning */
302#elif ( FT_SIZEOF_LONG == 4 ) && \
303 defined( HAVE_LONG_LONG_INT ) && \
304 defined( __GNUC__ )
305#pragma GCC diagnostic ignored "-Wlong-long"
306#define FT_LONG64
307#define FT_INT64 long long int
308#define FT_UINT64 unsigned long long int
309
310 /*************************************************************************/
311 /* */
312 /* A 64-bit data type may create compilation problems if you compile */
313 /* in strict ANSI mode. To avoid them, we disable other 64-bit data */
314 /* types if __STDC__ is defined. You can however ignore this rule */
315 /* by defining the FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
316 /* */
317#elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )
318
319#if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L
320
321#define FT_LONG64
322#define FT_INT64 long long int
323#define FT_UINT64 unsigned long long int
324
325#elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
326
327 /* this compiler provides the __int64 type */
328#define FT_LONG64
329#define FT_INT64 __int64
330#define FT_UINT64 unsigned __int64
331
332#elif defined( __BORLANDC__ ) /* Borland C++ */
333
334 /* XXXX: We should probably check the value of __BORLANDC__ in order */
335 /* to test the compiler version. */
336
337 /* this compiler provides the __int64 type */
338#define FT_LONG64
339#define FT_INT64 __int64
340#define FT_UINT64 unsigned __int64
341
342#elif defined( __WATCOMC__ ) /* Watcom C++ */
343
344 /* Watcom doesn't provide 64-bit data types */
345
346#elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
347
348#define FT_LONG64
349#define FT_INT64 long long int
350#define FT_UINT64 unsigned long long int
351
352#elif defined( __GNUC__ )
353
354 /* GCC provides the `long long' type */
355#define FT_LONG64
356#define FT_INT64 long long int
357#define FT_UINT64 unsigned long long int
358
359#endif /* __STDC_VERSION__ >= 199901L */
360
361#endif /* FT_SIZEOF_LONG == 8 */
362
363#ifdef FT_LONG64
364 typedef FT_INT64 FT_Int64;
365 typedef FT_UINT64 FT_UInt64;
366#endif
367
368
369#ifdef _WIN64
370 /* only 64bit Windows uses the LLP64 data model, i.e., */
371 /* 32bit integers, 64bit pointers */
372#define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x)
373#else
374#define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x)
375#endif
376
377
378 /*************************************************************************/
379 /* */
380 /* miscellaneous */
381 /* */
382 /*************************************************************************/
383
384
385#define FT_BEGIN_STMNT do {
386#define FT_END_STMNT } while ( 0 )
387#define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
388
389
390 /* typeof condition taken from gnulib's `intprops.h' header file */
391#if ( ( defined( __GNUC__ ) && __GNUC__ >= 2 ) || \
392 ( defined( __IBMC__ ) && __IBMC__ >= 1210 && \
393 defined( __IBM__TYPEOF__ ) ) || \
394 ( defined( __SUNPRO_C ) && __SUNPRO_C >= 0x5110 && !__STDC__ ) )
395#define FT_TYPEOF( type ) ( __typeof__ ( type ) )
396#else
397#define FT_TYPEOF( type ) /* empty */
398#endif
399
400
401 /* Use FT_LOCAL and FT_LOCAL_DEF to declare and define, respectively, */
402 /* a function that gets used only within the scope of a module. */
403 /* Normally, both the header and source code files for such a */
404 /* function are within a single module directory. */
405 /* */
406 /* Intra-module arrays should be tagged with FT_LOCAL_ARRAY and */
407 /* FT_LOCAL_ARRAY_DEF. */
408 /* */
409#ifdef FT_MAKE_OPTION_SINGLE_OBJECT
410
411#define FT_LOCAL( x ) static x
412#define FT_LOCAL_DEF( x ) static x
413
414#else
415
416#ifdef __cplusplus
417#define FT_LOCAL( x ) extern "C" x
418#define FT_LOCAL_DEF( x ) extern "C" x
419#else
420#define FT_LOCAL( x ) extern x
421#define FT_LOCAL_DEF( x ) x
422#endif
423
424#endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
425
426#define FT_LOCAL_ARRAY( x ) extern const x
427#define FT_LOCAL_ARRAY_DEF( x ) const x
428
429
430 /* Use FT_BASE and FT_BASE_DEF to declare and define, respectively, */
431 /* functions that are used in more than a single module. In the */
432 /* current setup this implies that the declaration is in a header */
433 /* file in the `include/freetype/internal' directory, and the */
434 /* function body is in a file in `src/base'. */
435 /* */
436#ifndef FT_BASE
437
438#ifdef __cplusplus
439#define FT_BASE( x ) extern "C" x
440#else
441#define FT_BASE( x ) extern x
442#endif
443
444#endif /* !FT_BASE */
445
446
447#ifndef FT_BASE_DEF
448
449#ifdef __cplusplus
450#define FT_BASE_DEF( x ) x
451#else
452#define FT_BASE_DEF( x ) x
453#endif
454
455#endif /* !FT_BASE_DEF */
456
457
458 /* When compiling FreeType as a DLL or DSO with hidden visibility */
459 /* some systems/compilers need a special attribute in front OR after */
460 /* the return type of function declarations. */
461 /* */
462 /* Two macros are used within the FreeType source code to define */
463 /* exported library functions: FT_EXPORT and FT_EXPORT_DEF. */
464 /* */
465 /* FT_EXPORT( return_type ) */
466 /* */
467 /* is used in a function declaration, as in */
468 /* */
469 /* FT_EXPORT( FT_Error ) */
470 /* FT_Init_FreeType( FT_Library* alibrary ); */
471 /* */
472 /* */
473 /* FT_EXPORT_DEF( return_type ) */
474 /* */
475 /* is used in a function definition, as in */
476 /* */
477 /* FT_EXPORT_DEF( FT_Error ) */
478 /* FT_Init_FreeType( FT_Library* alibrary ) */
479 /* { */
480 /* ... some code ... */
481 /* return FT_Err_Ok; */
482 /* } */
483 /* */
484 /* You can provide your own implementation of FT_EXPORT and */
485 /* FT_EXPORT_DEF here if you want. */
486 /* */
487 /* To export a variable, use FT_EXPORT_VAR. */
488 /* */
489#ifndef FT_EXPORT
490
491#ifdef FT2_BUILD_LIBRARY
492
493#if defined( _WIN32 ) && ( defined( _DLL ) || defined( DLL_EXPORT ) )
494#define FT_EXPORT( x ) __declspec( dllexport ) x
495#elif defined( __GNUC__ ) && __GNUC__ >= 4
496#define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x
497#elif defined( __cplusplus )
498#define FT_EXPORT( x ) extern "C" x
499#else
500#define FT_EXPORT( x ) extern x
501#endif
502
503#else
504
505#if defined( FT2_DLLIMPORT )
506#define FT_EXPORT( x ) __declspec( dllimport ) x
507#elif defined( __cplusplus )
508#define FT_EXPORT( x ) extern "C" x
509#else
510#define FT_EXPORT( x ) extern x
511#endif
512
513#endif
514
515#endif /* !FT_EXPORT */
516
517
518#ifndef FT_EXPORT_DEF
519
520#ifdef __cplusplus
521#define FT_EXPORT_DEF( x ) extern "C" x
522#else
523#define FT_EXPORT_DEF( x ) extern x
524#endif
525
526#endif /* !FT_EXPORT_DEF */
527
528
529#ifndef FT_EXPORT_VAR
530
531#ifdef __cplusplus
532#define FT_EXPORT_VAR( x ) extern "C" x
533#else
534#define FT_EXPORT_VAR( x ) extern x
535#endif
536
537#endif /* !FT_EXPORT_VAR */
538
539 /* The following macros are needed to compile the library with a */
540 /* C++ compiler and with 16bit compilers. */
541 /* */
542
543 /* This is special. Within C++, you must specify `extern "C"' for */
544 /* functions which are used via function pointers, and you also */
545 /* must do that for structures which contain function pointers to */
546 /* assure C linkage -- it's not possible to have (local) anonymous */
547 /* functions which are accessed by (global) function pointers. */
548 /* */
549 /* */
550 /* FT_CALLBACK_DEF is used to _define_ a callback function, */
551 /* located in the same source code file as the structure that uses */
552 /* it. */
553 /* */
554 /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare */
555 /* and define a callback function, respectively, in a similar way */
556 /* as FT_BASE and FT_BASE_DEF work. */
557 /* */
558 /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
559 /* contains pointers to callback functions. */
560 /* */
561 /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */
562 /* that contains pointers to callback functions. */
563 /* */
564 /* */
565 /* Some 16bit compilers have to redefine these macros to insert */
566 /* the infamous `_cdecl' or `__fastcall' declarations. */
567 /* */
568#ifndef FT_CALLBACK_DEF
569#ifdef __cplusplus
570#define FT_CALLBACK_DEF( x ) extern "C" x
571#else
572#define FT_CALLBACK_DEF( x ) static x
573#endif
574#endif /* FT_CALLBACK_DEF */
575
576#ifndef FT_BASE_CALLBACK
577#ifdef __cplusplus
578#define FT_BASE_CALLBACK( x ) extern "C" x
579#define FT_BASE_CALLBACK_DEF( x ) extern "C" x
580#else
581#define FT_BASE_CALLBACK( x ) extern x
582#define FT_BASE_CALLBACK_DEF( x ) x
583#endif
584#endif /* FT_BASE_CALLBACK */
585
586#ifndef FT_CALLBACK_TABLE
587#ifdef __cplusplus
588#define FT_CALLBACK_TABLE extern "C"
589#define FT_CALLBACK_TABLE_DEF extern "C"
590#else
591#define FT_CALLBACK_TABLE extern
592#define FT_CALLBACK_TABLE_DEF /* nothing */
593#endif
594#endif /* FT_CALLBACK_TABLE */
595
596
597FT_END_HEADER
598
599
600#endif /* FTCONFIG_H_ */
601
602
603/* END */
604