ftconfig.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  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-2004, 2006-2009, 2011, 2013 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. /* This header file contains a number of macro definitions that are used */
  21. /* by the rest of the engine. Most of the macros here are automatically */
  22. /* determined at compile time, and you should not need to change it to */
  23. /* port FreeType, except to compile the library with a non-ANSI */
  24. /* compiler. */
  25. /* */
  26. /* Note however that if some specific modifications are needed, we */
  27. /* advise you to place a modified copy in your build directory. */
  28. /* */
  29. /* The build directory is usually `freetype/builds/<system>', and */
  30. /* contains system-specific files that are always included first when */
  31. /* building the library. */
  32. /* */
  33. /*************************************************************************/
  34. #ifndef __FTCONFIG_H__
  35. #define __FTCONFIG_H__
  36. #include <ft2build.h>
  37. #include FT_CONFIG_OPTIONS_H
  38. #include FT_CONFIG_STANDARD_LIBRARY_H
  39. FT_BEGIN_HEADER
  40. /*************************************************************************/
  41. /* */
  42. /* PLATFORM-SPECIFIC CONFIGURATION MACROS */
  43. /* */
  44. /* These macros can be toggled to suit a specific system. The current */
  45. /* ones are defaults used to compile FreeType in an ANSI C environment */
  46. /* (16bit compilers are also supported). Copy this file to your own */
  47. /* `freetype/builds/<system>' directory, and edit it to port the engine. */
  48. /* */
  49. /*************************************************************************/
  50. //#define HAVE_UNISTD_H 1
  51. //#define HAVE_FCNTL_H 1
  52. //#define HAVE_STDINT_H 1
  53. /* There are systems (like the Texas Instruments 'C54x) where a `char' */
  54. /* has 16 bits. ANSI C says that sizeof(char) is always 1. Since an */
  55. /* `int' has 16 bits also for this system, sizeof(int) gives 1 which */
  56. /* is probably unexpected. */
  57. /* */
  58. /* `CHAR_BIT' (defined in limits.h) gives the number of bits in a */
  59. /* `char' type. */
  60. #ifndef FT_CHAR_BIT
  61. #define FT_CHAR_BIT CHAR_BIT
  62. #endif
  63. /* #undef FT_USE_AUTOCONF_SIZEOF_TYPES */
  64. #ifdef FT_USE_AUTOCONF_SIZEOF_TYPES
  65. #define SIZEOF_INT 4
  66. #define SIZEOF_LONG 4
  67. #define FT_SIZEOF_INT SIZEOF_INT
  68. #define FT_SIZEOF_LONG SIZEOF_LONG
  69. #else /* !FT_USE_AUTOCONF_SIZEOF_TYPES */
  70. /* Following cpp computation of the bit length of int and long */
  71. /* is copied from default include/freetype/config/ftconfig.h. */
  72. /* If any improvement is required for this file, it should be */
  73. /* applied to the original header file for the builders that */
  74. /* does not use configure script. */
  75. /* The size of an `int' type. */
  76. #if FT_UINT_MAX == 0xFFFFUL
  77. #define FT_SIZEOF_INT (16 / FT_CHAR_BIT)
  78. #elif FT_UINT_MAX == 0xFFFFFFFFUL
  79. #define FT_SIZEOF_INT (32 / FT_CHAR_BIT)
  80. #elif FT_UINT_MAX > 0xFFFFFFFFUL && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFUL
  81. #define FT_SIZEOF_INT (64 / FT_CHAR_BIT)
  82. #else
  83. #error "Unsupported size of `int' type!"
  84. #endif
  85. /* The size of a `long' type. A five-byte `long' (as used e.g. on the */
  86. /* DM642) is recognized but avoided. */
  87. #if FT_ULONG_MAX == 0xFFFFFFFFUL
  88. #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
  89. #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFUL
  90. #define FT_SIZEOF_LONG (32 / FT_CHAR_BIT)
  91. #elif FT_ULONG_MAX > 0xFFFFFFFFUL && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFUL
  92. #define FT_SIZEOF_LONG (64 / FT_CHAR_BIT)
  93. #else
  94. #error "Unsupported size of `long' type!"
  95. #endif
  96. #endif /* !FT_USE_AUTOCONF_SIZEOF_TYPES */
  97. /* FT_UNUSED is a macro used to indicate that a given parameter is not */
  98. /* used -- this is only used to get rid of unpleasant compiler warnings */
  99. #ifndef FT_UNUSED
  100. #define FT_UNUSED( arg ) ( (arg) = (arg) )
  101. #endif
  102. /*************************************************************************/
  103. /* */
  104. /* AUTOMATIC CONFIGURATION MACROS */
  105. /* */
  106. /* These macros are computed from the ones defined above. Don't touch */
  107. /* their definition, unless you know precisely what you are doing. No */
  108. /* porter should need to mess with them. */
  109. /* */
  110. /*************************************************************************/
  111. /*************************************************************************/
  112. /* */
  113. /* Mac support */
  114. /* */
  115. /* This is the only necessary change, so it is defined here instead */
  116. /* providing a new configuration file. */
  117. /* */
  118. #if defined( __APPLE__ ) || ( defined( __MWERKS__ ) && defined( macintosh ) )
  119. /* no Carbon frameworks for 64bit 10.4.x */
  120. /* AvailabilityMacros.h is available since Mac OS X 10.2, */
  121. /* so guess the system version by maximum errno before inclusion */
  122. #include <errno.h>
  123. #ifdef ECANCELED /* defined since 10.2 */
  124. #include "AvailabilityMacros.h"
  125. #endif
  126. #if defined( __LP64__ ) && \
  127. ( MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_4 )
  128. #undef FT_MACINTOSH
  129. #endif
  130. #elif defined( __SC__ ) || defined( __MRC__ )
  131. /* Classic MacOS compilers */
  132. #include "ConditionalMacros.h"
  133. #if TARGET_OS_MAC
  134. #define FT_MACINTOSH 1
  135. #endif
  136. #endif
  137. /* Fix compiler warning with sgi compiler */
  138. #if defined( __sgi ) && !defined( __GNUC__ )
  139. #if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION >= 730 )
  140. #pragma set woff 3505
  141. #endif
  142. #endif
  143. /*************************************************************************/
  144. /* */
  145. /* <Section> */
  146. /* basic_types */
  147. /* */
  148. /*************************************************************************/
  149. /*************************************************************************/
  150. /* */
  151. /* <Type> */
  152. /* FT_Int16 */
  153. /* */
  154. /* <Description> */
  155. /* A typedef for a 16bit signed integer type. */
  156. /* */
  157. typedef signed short FT_Int16;
  158. /*************************************************************************/
  159. /* */
  160. /* <Type> */
  161. /* FT_UInt16 */
  162. /* */
  163. /* <Description> */
  164. /* A typedef for a 16bit unsigned integer type. */
  165. /* */
  166. typedef unsigned short FT_UInt16;
  167. /* */
  168. /* this #if 0 ... #endif clause is for documentation purposes */
  169. #if 0
  170. /*************************************************************************/
  171. /* */
  172. /* <Type> */
  173. /* FT_Int32 */
  174. /* */
  175. /* <Description> */
  176. /* A typedef for a 32bit signed integer type. The size depends on */
  177. /* the configuration. */
  178. /* */
  179. typedef signed XXX FT_Int32;
  180. /*************************************************************************/
  181. /* */
  182. /* <Type> */
  183. /* FT_UInt32 */
  184. /* */
  185. /* A typedef for a 32bit unsigned integer type. The size depends on */
  186. /* the configuration. */
  187. /* */
  188. typedef unsigned XXX FT_UInt32;
  189. /*************************************************************************/
  190. /* */
  191. /* <Type> */
  192. /* FT_Int64 */
  193. /* */
  194. /* A typedef for a 64bit signed integer type. The size depends on */
  195. /* the configuration. Only defined if there is real 64bit support; */
  196. /* otherwise, it gets emulated with a structure (if necessary). */
  197. /* */
  198. typedef signed XXX FT_Int64;
  199. /* */
  200. #endif
  201. #if FT_SIZEOF_INT == 4
  202. typedef signed int FT_Int32;
  203. typedef unsigned int FT_UInt32;
  204. #elif FT_SIZEOF_LONG == 4
  205. typedef signed long FT_Int32;
  206. typedef unsigned long FT_UInt32;
  207. #else
  208. #error "no 32bit type found -- please check your configuration files"
  209. #endif
  210. /* look up an integer type that is at least 32 bits */
  211. #if FT_SIZEOF_INT >= 4
  212. typedef int FT_Fast;
  213. typedef unsigned int FT_UFast;
  214. #elif FT_SIZEOF_LONG >= 4
  215. typedef long FT_Fast;
  216. typedef unsigned long FT_UFast;
  217. #endif
  218. /* determine whether we have a 64-bit int type for platforms without */
  219. /* Autoconf */
  220. #if FT_SIZEOF_LONG == 8
  221. /* FT_LONG64 must be defined if a 64-bit type is available */
  222. #define FT_LONG64
  223. #define FT_INT64 long
  224. #elif defined( _MSC_VER ) && _MSC_VER >= 900 /* Visual C++ (and Intel C++) */
  225. /* this compiler provides the __int64 type */
  226. #define FT_LONG64
  227. #define FT_INT64 __int64
  228. #elif defined( __BORLANDC__ ) /* Borland C++ */
  229. /* XXXX: We should probably check the value of __BORLANDC__ in order */
  230. /* to test the compiler version. */
  231. /* this compiler provides the __int64 type */
  232. #define FT_LONG64
  233. #define FT_INT64 __int64
  234. #elif defined( __WATCOMC__ ) /* Watcom C++ */
  235. /* Watcom doesn't provide 64-bit data types */
  236. #elif defined( __MWERKS__ ) /* Metrowerks CodeWarrior */
  237. #define FT_LONG64
  238. #define FT_INT64 long long int
  239. #elif defined( __GNUC__ )
  240. /* GCC provides the `long long' type */
  241. #define FT_LONG64
  242. #define FT_INT64 long long int
  243. #endif /* FT_SIZEOF_LONG == 8 */
  244. /*************************************************************************/
  245. /* */
  246. /* A 64-bit data type will create compilation problems if you compile */
  247. /* in strict ANSI mode. To avoid them, we disable its use if __STDC__ */
  248. /* is defined. You can however ignore this rule by defining the */
  249. /* FT_CONFIG_OPTION_FORCE_INT64 configuration macro. */
  250. /* */
  251. #if defined( FT_LONG64 ) && !defined( FT_CONFIG_OPTION_FORCE_INT64 )
  252. #ifdef __STDC__
  253. /* Undefine the 64-bit macros in strict ANSI compilation mode. */
  254. /* Since `#undef' doesn't survive in configuration header files */
  255. /* we use the postprocessing facility of AC_CONFIG_HEADERS to */
  256. /* replace the leading `/' with `#'. */
  257. #undef FT_LONG64
  258. #undef FT_INT64
  259. #endif /* __STDC__ */
  260. #endif /* FT_LONG64 && !FT_CONFIG_OPTION_FORCE_INT64 */
  261. #ifdef FT_LONG64
  262. typedef FT_INT64 FT_Int64;
  263. #endif
  264. #define FT_BEGIN_STMNT do {
  265. #define FT_END_STMNT } while ( 0 )
  266. #define FT_DUMMY_STMNT FT_BEGIN_STMNT FT_END_STMNT
  267. #ifndef FT_CONFIG_OPTION_NO_ASSEMBLER
  268. /* Provide assembler fragments for performance-critical functions. */
  269. /* These must be defined `static __inline__' with GCC. */
  270. #if defined( __CC_ARM ) || defined( __ARMCC__ ) /* RVCT */
  271. #define FT_MULFIX_ASSEMBLER FT_MulFix_arm
  272. /* documentation is in freetype.h */
  273. static __inline FT_Int32
  274. FT_MulFix_arm( FT_Int32 a,
  275. FT_Int32 b )
  276. {
  277. register FT_Int32 t, t2;
  278. __asm
  279. {
  280. smull t2, t, b, a /* (lo=t2,hi=t) = a*b */
  281. mov a, t, asr #31 /* a = (hi >> 31) */
  282. add a, a, #0x8000 /* a += 0x8000 */
  283. adds t2, t2, a /* t2 += a */
  284. adc t, t, #0 /* t += carry */
  285. mov a, t2, lsr #16 /* a = t2 >> 16 */
  286. orr a, a, t, lsl #16 /* a |= t << 16 */
  287. }
  288. return a;
  289. }
  290. #endif /* __CC_ARM || __ARMCC__ */
  291. #ifdef __GNUC__
  292. #if defined( __arm__ ) && !defined( __thumb__ ) && \
  293. !( defined( __CC_ARM ) || defined( __ARMCC__ ) )
  294. #define FT_MULFIX_ASSEMBLER FT_MulFix_arm
  295. /* documentation is in freetype.h */
  296. static __inline__ FT_Int32
  297. FT_MulFix_arm( FT_Int32 a,
  298. FT_Int32 b )
  299. {
  300. register FT_Int32 t, t2;
  301. __asm__ __volatile__ (
  302. "smull %1, %2, %4, %3\n\t" /* (lo=%1,hi=%2) = a*b */
  303. "mov %0, %2, asr #31\n\t" /* %0 = (hi >> 31) */
  304. "add %0, %0, #0x8000\n\t" /* %0 += 0x8000 */
  305. "adds %1, %1, %0\n\t" /* %1 += %0 */
  306. "adc %2, %2, #0\n\t" /* %2 += carry */
  307. "mov %0, %1, lsr #16\n\t" /* %0 = %1 >> 16 */
  308. "orr %0, %0, %2, lsl #16\n\t" /* %0 |= %2 << 16 */
  309. : "=r"(a), "=&r"(t2), "=&r"(t)
  310. : "r"(a), "r"(b)
  311. : "cc" );
  312. return a;
  313. }
  314. #endif /* __arm__ && !__thumb__ && !( __CC_ARM || __ARMCC__ ) */
  315. #if defined( __i386__ )
  316. #define FT_MULFIX_ASSEMBLER FT_MulFix_i386
  317. /* documentation is in freetype.h */
  318. static __inline__ FT_Int32
  319. FT_MulFix_i386( FT_Int32 a,
  320. FT_Int32 b )
  321. {
  322. register FT_Int32 result;
  323. __asm__ __volatile__ (
  324. "imul %%edx\n"
  325. "movl %%edx, %%ecx\n"
  326. "sarl $31, %%ecx\n"
  327. "addl $0x8000, %%ecx\n"
  328. "addl %%ecx, %%eax\n"
  329. "adcl $0, %%edx\n"
  330. "shrl $16, %%eax\n"
  331. "shll $16, %%edx\n"
  332. "addl %%edx, %%eax\n"
  333. : "=a"(result), "=d"(b)
  334. : "a"(a), "d"(b)
  335. : "%ecx", "cc" );
  336. return result;
  337. }
  338. #endif /* i386 */
  339. #endif /* __GNUC__ */
  340. #ifdef _MSC_VER /* Visual C++ */
  341. #ifdef _M_IX86
  342. #define FT_MULFIX_ASSEMBLER FT_MulFix_i386
  343. /* documentation is in freetype.h */
  344. static __inline FT_Int32
  345. FT_MulFix_i386( FT_Int32 a,
  346. FT_Int32 b )
  347. {
  348. register FT_Int32 result;
  349. __asm
  350. {
  351. mov eax, a
  352. mov edx, b
  353. imul edx
  354. mov ecx, edx
  355. sar ecx, 31
  356. add ecx, 8000h
  357. add eax, ecx
  358. adc edx, 0
  359. shr eax, 16
  360. shl edx, 16
  361. add eax, edx
  362. mov result, eax
  363. }
  364. return result;
  365. }
  366. #endif /* _M_IX86 */
  367. #endif /* _MSC_VER */
  368. #endif /* !FT_CONFIG_OPTION_NO_ASSEMBLER */
  369. #ifdef FT_CONFIG_OPTION_INLINE_MULFIX
  370. #ifdef FT_MULFIX_ASSEMBLER
  371. #define FT_MULFIX_INLINED FT_MULFIX_ASSEMBLER
  372. #endif
  373. #endif
  374. #ifdef FT_MAKE_OPTION_SINGLE_OBJECT
  375. #define FT_LOCAL( x ) static x
  376. #define FT_LOCAL_DEF( x ) static x
  377. #else
  378. #ifdef __cplusplus
  379. #define FT_LOCAL( x ) extern "C" x
  380. #define FT_LOCAL_DEF( x ) extern "C" x
  381. #else
  382. #define FT_LOCAL( x ) extern x
  383. #define FT_LOCAL_DEF( x ) x
  384. #endif
  385. #endif /* FT_MAKE_OPTION_SINGLE_OBJECT */
  386. #ifndef FT_BASE
  387. #ifdef __cplusplus
  388. #define FT_BASE( x ) extern "C" x
  389. #else
  390. #define FT_BASE( x ) extern x
  391. #endif
  392. #endif /* !FT_BASE */
  393. #ifndef FT_BASE_DEF
  394. #ifdef __cplusplus
  395. #define FT_BASE_DEF( x ) x
  396. #else
  397. #define FT_BASE_DEF( x ) x
  398. #endif
  399. #endif /* !FT_BASE_DEF */
  400. #ifndef FT_EXPORT
  401. #ifdef __cplusplus
  402. #define FT_EXPORT( x ) extern "C" x
  403. #else
  404. #define FT_EXPORT( x ) extern x
  405. #endif
  406. #endif /* !FT_EXPORT */
  407. #ifndef FT_EXPORT_DEF
  408. #ifdef __cplusplus
  409. #define FT_EXPORT_DEF( x ) extern "C" x
  410. #else
  411. #define FT_EXPORT_DEF( x ) extern x
  412. #endif
  413. #endif /* !FT_EXPORT_DEF */
  414. #ifndef FT_EXPORT_VAR
  415. #ifdef __cplusplus
  416. #define FT_EXPORT_VAR( x ) extern "C" x
  417. #else
  418. #define FT_EXPORT_VAR( x ) extern x
  419. #endif
  420. #endif /* !FT_EXPORT_VAR */
  421. /* The following macros are needed to compile the library with a */
  422. /* C++ compiler and with 16bit compilers. */
  423. /* */
  424. /* This is special. Within C++, you must specify `extern "C"' for */
  425. /* functions which are used via function pointers, and you also */
  426. /* must do that for structures which contain function pointers to */
  427. /* assure C linkage -- it's not possible to have (local) anonymous */
  428. /* functions which are accessed by (global) function pointers. */
  429. /* */
  430. /* */
  431. /* FT_CALLBACK_DEF is used to _define_ a callback function. */
  432. /* */
  433. /* FT_CALLBACK_TABLE is used to _declare_ a constant variable that */
  434. /* contains pointers to callback functions. */
  435. /* */
  436. /* FT_CALLBACK_TABLE_DEF is used to _define_ a constant variable */
  437. /* that contains pointers to callback functions. */
  438. /* */
  439. /* */
  440. /* Some 16bit compilers have to redefine these macros to insert */
  441. /* the infamous `_cdecl' or `__fastcall' declarations. */
  442. /* */
  443. #ifndef FT_CALLBACK_DEF
  444. #ifdef __cplusplus
  445. #define FT_CALLBACK_DEF( x ) extern "C" x
  446. #else
  447. #define FT_CALLBACK_DEF( x ) static x
  448. #endif
  449. #endif /* FT_CALLBACK_DEF */
  450. #ifndef FT_CALLBACK_TABLE
  451. #ifdef __cplusplus
  452. #define FT_CALLBACK_TABLE extern "C"
  453. #define FT_CALLBACK_TABLE_DEF extern "C"
  454. #else
  455. #define FT_CALLBACK_TABLE extern
  456. #define FT_CALLBACK_TABLE_DEF /* nothing */
  457. #endif
  458. #endif /* FT_CALLBACK_TABLE */
  459. FT_END_HEADER
  460. #endif /* __FTCONFIG_H__ */
  461. /* END */