config.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. /*
  2. * Ensure we have C99-style int64_t, etc, all defined.
  3. */
  4. /* First, we need to know if the system has already defined them. */
  5. #define HAVE_INT16_T
  6. #define HAVE_INT32_T
  7. #define HAVE_INT64_T
  8. #define HAVE_INTMAX_T
  9. #define HAVE_UINT8_T
  10. #define HAVE_UINT16_T
  11. #define HAVE_UINT32_T
  12. #define HAVE_UINT64_T
  13. #define HAVE_UINTMAX_T
  14. /* We might have the types we want under other spellings. */
  15. /* #undef HAVE___INT64 */
  16. /* #undef HAVE_U_INT64_T */
  17. /* #undef HAVE_UNSIGNED___INT64 */
  18. /* The sizes of various standard integer types. */
  19. #define SIZE_OF_SHORT 2
  20. #define SIZE_OF_INT 4
  21. #define SIZE_OF_LONG 8
  22. #define SIZE_OF_LONG_LONG 8
  23. #define SIZE_OF_UNSIGNED_SHORT 2
  24. #define SIZE_OF_UNSIGNED 4
  25. #define SIZE_OF_UNSIGNED_LONG 8
  26. #define SIZE_OF_UNSIGNED_LONG_LONG 8
  27. #define SIZE_OF_SIZE_T 8
  28. /*
  29. * If we lack int64_t, define it to the first of __int64, int, long, and long long
  30. * that exists and is the right size.
  31. */
  32. #if !defined(HAVE_INT64_T) && defined(HAVE___INT64)
  33. typedef __int64 int64_t;
  34. #define HAVE_INT64_T
  35. #endif
  36. #if !defined(HAVE_INT64_T) && SIZE_OF_INT == 8
  37. typedef int int64_t;
  38. #define HAVE_INT64_T
  39. #endif
  40. #if !defined(HAVE_INT64_T) && SIZE_OF_LONG == 8
  41. typedef long int64_t;
  42. #define HAVE_INT64_T
  43. #endif
  44. #if !defined(HAVE_INT64_T) && SIZE_OF_LONG_LONG == 8
  45. typedef long long int64_t;
  46. #define HAVE_INT64_T
  47. #endif
  48. #if !defined(HAVE_INT64_T)
  49. #error No 64-bit integer type was found.
  50. #endif
  51. /*
  52. * Similarly for int32_t
  53. */
  54. #if !defined(HAVE_INT32_T) && SIZE_OF_INT == 4
  55. typedef int int32_t;
  56. #define HAVE_INT32_T
  57. #endif
  58. #if !defined(HAVE_INT32_T) && SIZE_OF_LONG == 4
  59. typedef long int32_t;
  60. #define HAVE_INT32_T
  61. #endif
  62. #if !defined(HAVE_INT32_T)
  63. #error No 32-bit integer type was found.
  64. #endif
  65. /*
  66. * Similarly for int16_t
  67. */
  68. #if !defined(HAVE_INT16_T) && SIZE_OF_INT == 2
  69. typedef int int16_t;
  70. #define HAVE_INT16_T
  71. #endif
  72. #if !defined(HAVE_INT16_T) && SIZE_OF_SHORT == 2
  73. typedef short int16_t;
  74. #define HAVE_INT16_T
  75. #endif
  76. #if !defined(HAVE_INT16_T)
  77. #error No 16-bit integer type was found.
  78. #endif
  79. /*
  80. * Similarly for uint64_t
  81. */
  82. #if !defined(HAVE_UINT64_T) && defined(HAVE_UNSIGNED___INT64)
  83. typedef unsigned __int64 uint64_t;
  84. #define HAVE_UINT64_T
  85. #endif
  86. #if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED == 8
  87. typedef unsigned uint64_t;
  88. #define HAVE_UINT64_T
  89. #endif
  90. #if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED_LONG == 8
  91. typedef unsigned long uint64_t;
  92. #define HAVE_UINT64_T
  93. #endif
  94. #if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED_LONG_LONG == 8
  95. typedef unsigned long long uint64_t;
  96. #define HAVE_UINT64_T
  97. #endif
  98. #if !defined(HAVE_UINT64_T)
  99. #error No 64-bit unsigned integer type was found.
  100. #endif
  101. /*
  102. * Similarly for uint32_t
  103. */
  104. #if !defined(HAVE_UINT32_T) && SIZE_OF_UNSIGNED == 4
  105. typedef unsigned uint32_t;
  106. #define HAVE_UINT32_T
  107. #endif
  108. #if !defined(HAVE_UINT32_T) && SIZE_OF_UNSIGNED_LONG == 4
  109. typedef unsigned long uint32_t;
  110. #define HAVE_UINT32_T
  111. #endif
  112. #if !defined(HAVE_UINT32_T)
  113. #error No 32-bit unsigned integer type was found.
  114. #endif
  115. /*
  116. * Similarly for uint16_t
  117. */
  118. #if !defined(HAVE_UINT16_T) && SIZE_OF_UNSIGNED == 2
  119. typedef unsigned uint16_t;
  120. #define HAVE_UINT16_T
  121. #endif
  122. #if !defined(HAVE_UINT16_T) && SIZE_OF_UNSIGNED_SHORT == 2
  123. typedef unsigned short uint16_t;
  124. #define HAVE_UINT16_T
  125. #endif
  126. #if !defined(HAVE_UINT16_T)
  127. #error No 16-bit unsigned integer type was found.
  128. #endif
  129. /*
  130. * Similarly for uint8_t
  131. */
  132. #if !defined(HAVE_UINT8_T)
  133. typedef unsigned char uint8_t;
  134. #define HAVE_UINT8_T
  135. #endif
  136. #if !defined(HAVE_UINT16_T)
  137. #error No 8-bit unsigned integer type was found.
  138. #endif
  139. /* Define intmax_t and uintmax_t if they are not already defined. */
  140. #if !defined(HAVE_INTMAX_T)
  141. typedef int64_t intmax_t;
  142. #define INTMAX_MIN INT64_MIN
  143. #define INTMAX_MAX INT64_MAX
  144. #endif
  145. #if !defined(HAVE_UINTMAX_T)
  146. typedef uint64_t uintmax_t;
  147. #endif
  148. /* #undef uintptr_t */
  149. #define HAVE_RESTRICT
  150. #define HAVE___RESTRICT
  151. #define HAVE_INLINE
  152. #define HAVE___INLINE
  153. #ifndef HAVE_RESTRICT
  154. # ifdef HAVE___RESTRICT
  155. # define LZMA_RESTRICT __restrict
  156. # else
  157. # define LZMA_RESTRICT
  158. # endif
  159. #else
  160. # define LZMA_RESTRICT restrict
  161. #endif /* HAVE_RESTRICT */
  162. #ifndef HAVE_INLINE
  163. # ifdef HAVE___INLINE
  164. # define inline __inline
  165. # else
  166. # define inline
  167. # endif
  168. #endif /* HAVE_INLINE */
  169. /* #undef WORDS_BIGENDIAN */
  170. #define HAVE_BYTESWAP_H 1
  171. #define HAVE_BSWAP_16 1
  172. #define HAVE_BSWAP_32 1
  173. #define HAVE_BSWAP_64 1
  174. #define HAVE_CHECK_CRC32 1
  175. #define HAVE_CHECK_CRC64 1
  176. #define HAVE_CHECK_SHA256 1
  177. #define HAVE_DECODER_ARM 1
  178. #define HAVE_DECODER_ARMTHUMB 1
  179. #define HAVE_DECODER_DELTA 1
  180. #define HAVE_DECODER_IA64 1
  181. #define HAVE_DECODER_LZMA1 1
  182. #define HAVE_DECODER_LZMA2 1
  183. #define HAVE_DECODER_POWERPC 1
  184. #define HAVE_DECODER_SPARC 1
  185. #define HAVE_DECODER_X86 1
  186. #define HAVE_ENCODER_ARM 1
  187. #define HAVE_ENCODER_ARMTHUMB 1
  188. #define HAVE_ENCODER_DELTA 1
  189. #define HAVE_ENCODER_IA64 1
  190. #define HAVE_ENCODER_LZMA1 1
  191. #define HAVE_ENCODER_LZMA2 1
  192. #define HAVE_ENCODER_POWERPC 1
  193. #define HAVE_ENCODER_SPARC 1
  194. #define HAVE_ENCODER_X86 1
  195. #define HAVE_MF_BT2 1
  196. #define HAVE_MF_BT3 1
  197. #define HAVE_MF_BT4 1
  198. #define HAVE_MF_HC3 1
  199. #define HAVE_MF_HC4 1
  200. /* Define to 1 if you have the <inttypes.h> header file. */
  201. #define HAVE_INTTYPES_H 1
  202. /* Define to 1 if you have the <limits.h> header file. */
  203. #define HAVE_LIMITS_H 1
  204. /* Define to 1 if you have the <memory.h> header file. */
  205. #define HAVE_MEMORY_H 1
  206. /* Define to 1 if stdbool.h conforms to C99. */
  207. #define HAVE_STDBOOL_H 1
  208. /* Define to 1 if you have the <stdint.h> header file. */
  209. #define HAVE_STDINT_H 1
  210. /* Define to 1 if you have the <strings.h> header file. */
  211. #define HAVE_STRINGS_H 1
  212. /* Define to 1 if you have the <string.h> header file. */
  213. #define HAVE_STRING_H 1
  214. /* Define to 1 if you have the <sys/byteorder.h> header file. */
  215. /* #undef HAVE_SYS_BYTEORDER_H */
  216. /* Define to 1 if you have the <sys/endian.h> header file. */
  217. /* #undef HAVE_SYS_ENDIAN_H */
  218. /* Define to 1 or 0, depending whether the compiler supports simple visibility
  219. declarations. */
  220. /* #undef HAVE_VISIBILITY */
  221. /* Define to 1 if the system has the type `_Bool'. */
  222. /* #undef HAVE__BOOL */
  223. /* Define to 1 if the system supports fast unaligned access to 16-bit and
  224. 32-bit integers. */
  225. #if defined(__i386) || defined(__i386__) || defined(_M_IX86) \
  226. || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) \
  227. || defined(__amd64) || defined(__amd64__) \
  228. || defined(__powerpc) || defined(__powerpc__) \
  229. || defined(__ppc) || defined(__ppc__) || defined(__POWERPC__)
  230. # define TUKLIB_FAST_UNALIGNED_ACCESS 1
  231. #endif