1 /****************************************************************************
5 * VMS-specific configuration file (specification only).
7 * Copyright (C) 1996-2019 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.
19 /**************************************************************************
21 * This header file contains a number of macro definitions that are used by
22 * 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 port
24 * FreeType, except to compile the library with a non-ANSI compiler.
26 * Note however that if some specific modifications are needed, we advise
27 * you to place a modified copy in your build directory.
29 * The build directory is usually `builds/<system>`, and contains
30 * system-specific files that are always included first when building the
39 #include FT_CONFIG_OPTIONS_H
40 #include FT_CONFIG_STANDARD_LIBRARY_H
46 /**************************************************************************
48 * PLATFORM-SPECIFIC CONFIGURATION MACROS
50 * These macros can be toggled to suit a specific system. The current ones
51 * are defaults used to compile FreeType in an ANSI C environment (16bit
52 * compilers are also supported). Copy this file to your own
53 * `builds/<system>` directory, and edit it to port the engine.
57 #define HAVE_UNISTD_H 1
58 #define HAVE_FCNTL_H 1
63 #define FT_SIZEOF_INT 4
64 #define FT_SIZEOF_LONG 4
67 /* `FT_UNUSED` indicates that a given parameter is not used -- */
68 /* this is only used to get rid of unpleasant compiler warnings. */
70 #define FT_UNUSED( arg ) ( (arg) = (arg) )
74 /**************************************************************************
76 * AUTOMATIC CONFIGURATION MACROS
78 * These macros are computed from the ones defined above. Don't touch
79 * their definition, unless you know precisely what you are doing. No
80 * porter should need to mess with them.
85 /**************************************************************************
89 * This is the only necessary change, so it is defined here instead
90 * providing a new configuration file.
92 #if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
93 /* No Carbon frameworks for 64bit 10.4.x. */
94 /* `AvailabilityMacros.h` is available since Mac OS X 10.2, */
95 /* so guess the system version by maximum errno before inclusion. */
97 #ifdef ECANCELED /* defined since 10.2 */
98 #include "AvailabilityMacros.h"
100 #if defined( __LP64__ ) && \
101 ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
105 #elif defined( __SC__ ) || defined( __MRC__ )
106 /* Classic MacOS compilers */
107 #include "ConditionalMacros.h"
109 #define FT_MACINTOSH 1
115 /* Fix compiler warning with sgi compiler. */
116 #if defined( __sgi ) && !defined( __GNUC__ )
117 #if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )
118 #pragma set woff 3505
123 /**************************************************************************
131 /**************************************************************************
137 * A typedef for a 16bit signed integer type.
139 typedef signed short FT_Int16;
142 /**************************************************************************
148 * A typedef for a 16bit unsigned integer type.
150 typedef unsigned short FT_UInt16;
155 /* this #if 0 ... #endif clause is for documentation purposes */
158 /**************************************************************************
164 * A typedef for a 32bit signed integer type. The size depends on the
167 typedef signed XXX FT_Int32;
170 /**************************************************************************
175 * A typedef for a 32bit unsigned integer type. The size depends on the
178 typedef unsigned XXX FT_UInt32;
181 /**************************************************************************
186 * A typedef for a 64bit signed integer type. The size depends on the
187 * configuration. Only defined if there is real 64bit support;
188 * otherwise, it gets emulated with a structure (if necessary).
190 typedef signed XXX FT_Int64;
193 /**************************************************************************
198 * A typedef for a 64bit unsigned integer type. The size depends on the
199 * configuration. Only defined if there is real 64bit support;
200 * otherwise, it gets emulated with a structure (if necessary).
202 typedef unsigned XXX FT_UInt64;
208 #if FT_SIZEOF_INT == 4
210 typedef signed int FT_Int32;
211 typedef unsigned int FT_UInt32;
213 #elif FT_SIZEOF_LONG == 4
215 typedef signed long FT_Int32;
216 typedef unsigned long FT_UInt32;
219 #error "no 32bit type found -- please check your configuration files"
223 /* look up an integer type that is at least 32~bits */
224 #if FT_SIZEOF_INT >= 4
227 typedef unsigned int FT_UFast;
229 #elif FT_SIZEOF_LONG >= 4
231 typedef long FT_Fast;
232 typedef unsigned long FT_UFast;
237 /* determine whether we have a 64-bit `int` type for platforms without */
239 #if FT_SIZEOF_LONG == 8
241 /* `FT_LONG64` must be defined if a 64-bit type is available */
243 #define FT_INT64 long
244 #define FT_UINT64 unsigned long
246 /* we handle the LLP64 scheme separately for GCC and clang, */
247 /* suppressing the `long long` warning */
248 #elif ( FT_SIZEOF_LONG == 4 ) && \
249 defined( HAVE_LONG_LONG_INT ) && \
251 #pragma GCC diagnostic ignored "-Wlong-long"
253 #define FT_INT64 long long int
254 #define FT_UINT64 unsigned long long int
256 /**************************************************************************
258 * A 64-bit data type may create compilation problems if you compile in
259 * strict ANSI mode. To avoid them, we disable other 64-bit data types if
260 * `__STDC__` is defined. You can however ignore this rule by defining the
261 * `FT_CONFIG_OPTION_FORCE_INT64` configuration macro.
263 #elif !defined( __STDC__ ) || defined( FT_CONFIG_OPTION_FORCE_INT64 )
265 #if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L
268 #define FT_INT64 long long int
269 #define FT_UINT64 unsigned long long int
271 #elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
273 /* this compiler provides the `__int64` type */
275 #define FT_INT64 __int64
276 #define FT_UINT64 unsigned __int64
278 #elif defined( __BORLANDC__ ) /* Borland C++ */
280 /* XXXX: We should probably check the value of `__BORLANDC__` in order */
281 /* to test the compiler version. */
283 /* this compiler provides the `__int64` type */
285 #define FT_INT64 __int64
286 #define FT_UINT64 unsigned __int64
288 #elif defined( __WATCOMC__ ) /* Watcom C++ */
290 /* Watcom doesn't provide 64-bit data types */
292 #elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
295 #define FT_INT64 long long int
296 #define FT_UINT64 unsigned long long int
298 #elif defined( __GNUC__ )
300 /* GCC provides the `long long` type */
302 #define FT_INT64 long long int
303 #define FT_UINT64 unsigned long long int
305 #endif /* __STDC_VERSION__ >= 199901L */
307 #endif /* FT_SIZEOF_LONG == 8 */
310 typedef FT_INT64 FT_Int64;
311 typedef FT_UINT64 FT_UInt64;
316 /* only 64bit Windows uses the LLP64 data model, i.e., */
317 /* 32bit integers, 64bit pointers */
318 #define FT_UINT_TO_POINTER( x ) (void*)(unsigned __int64)(x)
320 #define FT_UINT_TO_POINTER( x ) (void*)(unsigned long)(x)
324 /**************************************************************************
331 #define FT_BEGIN_STMNT do {
332 #define FT_END_STMNT } while ( 0 )
333 #define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
336 /* `typeof` condition taken from gnulib's `intprops.h` header file */
337 #if ( ( defined( __GNUC__ ) && __GNUC__ >= 2 ) || \
338 ( defined( __IBMC__ ) && __IBMC__ >= 1210 && \
339 defined( __IBM__TYPEOF__ ) ) || \
340 ( defined( __SUNPRO_C ) && __SUNPRO_C >= 0x5110 && !__STDC__ ) )
341 #define FT_TYPEOF( type ) ( __typeof__ ( type ) )
343 #define FT_TYPEOF( type ) /* empty */
347 /* Use `FT_LOCAL` and `FT_LOCAL_DEF` to declare and define, */
348 /* respectively, a function that gets used only within the scope of a */
349 /* module. Normally, both the header and source code files for such a */
350 /* function are within a single module directory. */
352 /* Intra-module arrays should be tagged with `FT_LOCAL_ARRAY` and */
353 /* `FT_LOCAL_ARRAY_DEF`. */
355 #ifdef FT_MAKE_OPTION_SINGLE_OBJECT
357 #define FT_LOCAL( x ) static x
358 #define FT_LOCAL_DEF( x ) static x
363 #define FT_LOCAL( x ) extern "C" x
364 #define FT_LOCAL_DEF( x ) extern "C" x
366 #define FT_LOCAL( x ) extern x
367 #define FT_LOCAL_DEF( x ) x
370 #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
372 #define FT_LOCAL_ARRAY( x ) extern const x
373 #define FT_LOCAL_ARRAY_DEF( x ) const x
376 /* Use `FT_BASE` and `FT_BASE_DEF` to declare and define, respectively, */
377 /* functions that are used in more than a single module. In the */
378 /* current setup this implies that the declaration is in a header file */
379 /* in the `include/freetype/internal` directory, and the function body */
380 /* is in a file in `src/base`. */
385 #define FT_BASE( x ) extern "C" x
387 #define FT_BASE( x ) extern x
390 #endif /* !FT_BASE */
396 #define FT_BASE_DEF( x ) x
398 #define FT_BASE_DEF( x ) x
401 #endif /* !FT_BASE_DEF */
404 /* When compiling FreeType as a DLL or DSO with hidden visibility */
405 /* some systems/compilers need a special attribute in front OR after */
406 /* the return type of function declarations. */
408 /* Two macros are used within the FreeType source code to define */
409 /* exported library functions: `FT_EXPORT` and `FT_EXPORT_DEF`. */
411 /* - `FT_EXPORT( return_type )` */
413 /* is used in a function declaration, as in */
416 /* FT_EXPORT( FT_Error ) */
417 /* FT_Init_FreeType( FT_Library* alibrary ); */
420 /* - `FT_EXPORT_DEF( return_type )` */
422 /* is used in a function definition, as in */
425 /* FT_EXPORT_DEF( FT_Error ) */
426 /* FT_Init_FreeType( FT_Library* alibrary ) */
428 /* ... some code ... */
429 /* return FT_Err_Ok; */
433 /* You can provide your own implementation of `FT_EXPORT` and */
434 /* `FT_EXPORT_DEF` here if you want. */
436 /* To export a variable, use `FT_EXPORT_VAR`. */
440 #ifdef FT2_BUILD_LIBRARY
442 #if defined( _WIN32 ) && defined( DLL_EXPORT )
443 #define FT_EXPORT( x ) __declspec( dllexport ) x
444 #elif defined( __GNUC__ ) && __GNUC__ >= 4
445 #define FT_EXPORT( x ) __attribute__(( visibility( "default" ) )) x
446 #elif defined( __SUNPRO_C ) && __SUNPRO_C >= 0x550
447 #define FT_EXPORT( x ) __global x
448 #elif defined( __cplusplus )
449 #define FT_EXPORT( x ) extern "C" x
451 #define FT_EXPORT( x ) extern x
456 #if defined( _WIN32 ) && defined( DLL_IMPORT )
457 #define FT_EXPORT( x ) __declspec( dllimport ) x
458 #elif defined( __cplusplus )
459 #define FT_EXPORT( x ) extern "C" x
461 #define FT_EXPORT( x ) extern x
466 #endif /* !FT_EXPORT */
469 #ifndef FT_EXPORT_DEF
472 #define FT_EXPORT_DEF( x ) extern "C" x
474 #define FT_EXPORT_DEF( x ) extern x
477 #endif /* !FT_EXPORT_DEF */
480 #ifndef FT_EXPORT_VAR
483 #define FT_EXPORT_VAR( x ) extern "C" x
485 #define FT_EXPORT_VAR( x ) extern x
488 #endif /* !FT_EXPORT_VAR */
491 /* The following macros are needed to compile the library with a */
492 /* C++ compiler and with 16bit compilers. */
495 /* This is special. Within C++, you must specify `extern "C"` for */
496 /* functions which are used via function pointers, and you also */
497 /* must do that for structures which contain function pointers to */
498 /* assure C linkage -- it's not possible to have (local) anonymous */
499 /* functions which are accessed by (global) function pointers. */
502 /* FT_CALLBACK_DEF is used to _define_ a callback function, */
503 /* located in the same source code file as the structure that uses */
506 /* FT_BASE_CALLBACK and FT_BASE_CALLBACK_DEF are used to declare */
507 /* and define a callback function, respectively, in a similar way */
508 /* as FT_BASE and FT_BASE_DEF work. */
510 /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
511 /* contains pointers to callback functions. */
513 /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */
514 /* that contains pointers to callback functions. */
517 /* Some 16bit compilers have to redefine these macros to insert */
518 /* the infamous `_cdecl` or `__fastcall` declarations. */
520 #ifndef FT_CALLBACK_DEF
522 #define FT_CALLBACK_DEF( x ) extern "C" x
524 #define FT_CALLBACK_DEF( x ) static x
526 #endif /* FT_CALLBACK_DEF */
528 #ifndef FT_BASE_CALLBACK
530 #define FT_BASE_CALLBACK( x ) extern "C" x
531 #define FT_BASE_CALLBACK_DEF( x ) extern "C" x
533 #define FT_BASE_CALLBACK( x ) extern x
534 #define FT_BASE_CALLBACK_DEF( x ) x
536 #endif /* FT_BASE_CALLBACK */
538 #ifndef FT_CALLBACK_TABLE
540 #define FT_CALLBACK_TABLE extern "C"
541 #define FT_CALLBACK_TABLE_DEF extern "C"
543 #define FT_CALLBACK_TABLE extern
544 #define FT_CALLBACK_TABLE_DEF /* nothing */
546 #endif /* FT_CALLBACK_TABLE */
552 #endif /* FTCONFIG_H_ */