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