zconf.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. /* zconf.h -- configuration of the zlib compression library
  2. * Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
  3. * For conditions of distribution and use, see copyright notice in zlib.h
  4. */
  5. #ifndef ZCONF_H
  6. #define ZCONF_H
  7. #if !defined(_WIN32) && defined(__WIN32__)
  8. # define _WIN32
  9. #endif
  10. #ifdef __STDC_VERSION__
  11. # if __STDC_VERSION__ >= 199901L
  12. # ifndef STDC99
  13. # define STDC99
  14. # endif
  15. # endif
  16. #endif
  17. /* Clang macro for detecting declspec support
  18. * https://clang.llvm.org/docs/LanguageExtensions.html#has-declspec-attribute
  19. */
  20. #ifndef __has_declspec_attribute
  21. # define __has_declspec_attribute(x) 0
  22. #endif
  23. #if defined(ZLIB_CONST) && !defined(z_const)
  24. # define z_const const
  25. #else
  26. # define z_const
  27. #endif
  28. /* Maximum value for memLevel in deflateInit2 */
  29. #ifndef MAX_MEM_LEVEL
  30. # define MAX_MEM_LEVEL 9
  31. #endif
  32. /* Maximum value for windowBits in deflateInit2 and inflateInit2.
  33. * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
  34. * created by gzip. (Files created by minigzip can still be extracted by
  35. * gzip.)
  36. */
  37. #ifndef MAX_WBITS
  38. # define MAX_WBITS 15 /* 32K LZ77 window */
  39. #endif
  40. /* The memory requirements for deflate are (in bytes):
  41. (1 << (windowBits+2)) + (1 << (memLevel+9))
  42. that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
  43. plus a few kilobytes for small objects. For example, if you want to reduce
  44. the default memory requirements from 256K to 128K, compile with
  45. make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
  46. Of course this will generally degrade compression (there's no free lunch).
  47. The memory requirements for inflate are (in bytes) 1 << windowBits
  48. that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
  49. for small objects.
  50. */
  51. /* Type declarations */
  52. #ifndef OF /* function prototypes */
  53. # define OF(args) args
  54. #endif
  55. #ifdef ZLIB_INTERNAL
  56. # define Z_INTERNAL ZLIB_INTERNAL
  57. #endif
  58. /* If building or using zlib as a DLL, define ZLIB_DLL.
  59. * This is not mandatory, but it offers a little performance increase.
  60. */
  61. #if defined(ZLIB_DLL) && (defined(_WIN32) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport)))
  62. # ifdef Z_INTERNAL
  63. # define Z_EXTERN extern __declspec(dllexport)
  64. # else
  65. # define Z_EXTERN extern __declspec(dllimport)
  66. # endif
  67. #endif
  68. /* If building or using zlib with the WINAPI/WINAPIV calling convention,
  69. * define ZLIB_WINAPI.
  70. * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
  71. */
  72. #if defined(ZLIB_WINAPI) && defined(_WIN32)
  73. # include <windows.h>
  74. /* No need for _export, use ZLIB.DEF instead. */
  75. /* For complete Windows compatibility, use WINAPI, not __stdcall. */
  76. # define Z_EXPORT WINAPI
  77. # define Z_EXPORTVA WINAPIV
  78. #endif
  79. #ifndef Z_EXTERN
  80. # define Z_EXTERN extern
  81. #endif
  82. #ifndef Z_EXPORT
  83. # define Z_EXPORT
  84. #endif
  85. #ifndef Z_EXPORTVA
  86. # define Z_EXPORTVA
  87. #endif
  88. /* For backwards compatibility */
  89. #ifndef ZEXTERN
  90. # define ZEXTERN Z_EXTERN
  91. #endif
  92. #ifndef ZEXPORT
  93. # define ZEXPORT Z_EXPORT
  94. #endif
  95. #ifndef ZEXPORTVA
  96. # define ZEXPORTVA Z_EXPORTVA
  97. #endif
  98. /* Fallback for something that includes us. */
  99. typedef unsigned char Byte;
  100. typedef Byte Bytef;
  101. typedef unsigned int uInt; /* 16 bits or more */
  102. typedef unsigned long uLong; /* 32 bits or more */
  103. typedef char charf;
  104. typedef int intf;
  105. typedef uInt uIntf;
  106. typedef uLong uLongf;
  107. typedef void const *voidpc;
  108. typedef void *voidpf;
  109. typedef void *voidp;
  110. #if 1 /* was set to #if 1 by configure/cmake/etc */
  111. # define Z_HAVE_UNISTD_H
  112. #endif
  113. #ifdef NEED_PTRDIFF_T /* may be set to #if 1 by configure/cmake/etc */
  114. typedef PTRDIFF_TYPE ptrdiff_t;
  115. #endif
  116. #include <sys/types.h> /* for off_t */
  117. #include <stdarg.h> /* for va_list */
  118. #include <stddef.h> /* for wchar_t and NULL */
  119. /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
  120. * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
  121. * though the former does not conform to the LFS document), but considering
  122. * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
  123. * equivalently requesting no 64-bit operations
  124. */
  125. #if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
  126. # undef _LARGEFILE64_SOURCE
  127. #endif
  128. #if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
  129. # include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
  130. # ifndef z_off_t
  131. # define z_off_t off_t
  132. # endif
  133. #endif
  134. #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
  135. # define Z_LFS64
  136. #endif
  137. #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
  138. # define Z_LARGE64
  139. #endif
  140. #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
  141. # define Z_WANT64
  142. #endif
  143. #if !defined(SEEK_SET)
  144. # define SEEK_SET 0 /* Seek from beginning of file. */
  145. # define SEEK_CUR 1 /* Seek from current position. */
  146. # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
  147. #endif
  148. #ifndef z_off_t
  149. # define z_off_t long
  150. #endif
  151. #if !defined(_WIN32) && defined(Z_LARGE64)
  152. # define z_off64_t off64_t
  153. #else
  154. # if defined(__MSYS__)
  155. # define z_off64_t _off64_t
  156. # elif defined(_WIN32) && !defined(__GNUC__)
  157. # define z_off64_t __int64
  158. # else
  159. # define z_off64_t z_off_t
  160. # endif
  161. #endif
  162. #endif /* ZCONF_H */