zconf.h 5.4 KB

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