zconf.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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. #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 MAX_WBITS
  32. # define MAX_WBITS 15 /* 32K LZ77 window */
  33. #endif
  34. /* The memory requirements for deflate are (in bytes):
  35. (1 << (windowBits+2)) + (1 << (memLevel+9))
  36. that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
  37. plus a few kilobytes for small objects. For example, if you want to reduce
  38. the default memory requirements from 256K to 128K, compile with
  39. make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
  40. Of course this will generally degrade compression (there's no free lunch).
  41. The memory requirements for inflate are (in bytes) 1 << windowBits
  42. that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
  43. for small objects.
  44. */
  45. /* Type declarations */
  46. #ifndef OF /* function prototypes */
  47. # define OF(args) args
  48. #endif
  49. #ifdef ZLIB_INTERNAL
  50. # define Z_INTERNAL ZLIB_INTERNAL
  51. #endif
  52. /* If building or using zlib as a DLL, define ZLIB_DLL.
  53. * This is not mandatory, but it offers a little performance increase.
  54. */
  55. #if defined(ZLIB_DLL) && (defined(_WIN32) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport)))
  56. # ifdef Z_INTERNAL
  57. # define Z_EXTERN extern __declspec(dllexport)
  58. # else
  59. # define Z_EXTERN extern __declspec(dllimport)
  60. # endif
  61. #endif
  62. /* If building or using zlib with the WINAPI/WINAPIV calling convention,
  63. * define ZLIB_WINAPI.
  64. * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
  65. */
  66. #if defined(ZLIB_WINAPI) && defined(_WIN32)
  67. # include <windows.h>
  68. /* No need for _export, use ZLIB.DEF instead. */
  69. /* For complete Windows compatibility, use WINAPI, not __stdcall. */
  70. # define Z_EXPORT WINAPI
  71. # define Z_EXPORTVA WINAPIV
  72. #endif
  73. #ifndef Z_EXTERN
  74. # define Z_EXTERN extern
  75. #endif
  76. #ifndef Z_EXPORT
  77. # define Z_EXPORT
  78. #endif
  79. #ifndef Z_EXPORTVA
  80. # define Z_EXPORTVA
  81. #endif
  82. /* Conditional exports */
  83. #define ZNG_CONDEXPORT Z_INTERNAL
  84. /* For backwards compatibility */
  85. #ifndef ZEXTERN
  86. # define ZEXTERN Z_EXTERN
  87. #endif
  88. #ifndef ZEXPORT
  89. # define ZEXPORT Z_EXPORT
  90. #endif
  91. #ifndef ZEXPORTVA
  92. # define ZEXPORTVA Z_EXPORTVA
  93. #endif
  94. /* Fallback for something that includes us. */
  95. typedef unsigned char Byte;
  96. typedef Byte Bytef;
  97. typedef unsigned int uInt; /* 16 bits or more */
  98. typedef unsigned long uLong; /* 32 bits or more */
  99. typedef char charf;
  100. typedef int intf;
  101. typedef uInt uIntf;
  102. typedef uLong uLongf;
  103. typedef void const *voidpc;
  104. typedef void *voidpf;
  105. typedef void *voidp;
  106. typedef uint32_t z_crc_t;
  107. #if 0 /* was set to #if 0 by configure/cmake/etc */
  108. # define Z_HAVE_UNISTD_H
  109. #endif
  110. #ifdef NEED_PTRDIFF_T /* may be set to #if 1 by configure/cmake/etc */
  111. typedef PTRDIFF_TYPE ptrdiff_t;
  112. #endif
  113. #include <sys/types.h> /* for off_t */
  114. #include <stddef.h> /* for wchar_t and NULL */
  115. /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
  116. * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
  117. * though the former does not conform to the LFS document), but considering
  118. * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
  119. * equivalently requesting no 64-bit operations
  120. */
  121. #if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
  122. # undef _LARGEFILE64_SOURCE
  123. #endif
  124. #if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
  125. # include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
  126. # ifndef z_off_t
  127. # define z_off_t off_t
  128. # endif
  129. #endif
  130. #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
  131. # define Z_LFS64
  132. #endif
  133. #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
  134. # define Z_LARGE64
  135. #endif
  136. #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
  137. # define Z_WANT64
  138. #endif
  139. #if !defined(SEEK_SET)
  140. # define SEEK_SET 0 /* Seek from beginning of file. */
  141. # define SEEK_CUR 1 /* Seek from current position. */
  142. # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
  143. #endif
  144. #ifndef z_off_t
  145. # define z_off_t long
  146. #endif
  147. #if !defined(_WIN32) && defined(Z_LARGE64)
  148. # define z_off64_t off64_t
  149. #else
  150. # if defined(__MSYS__)
  151. # define z_off64_t _off64_t
  152. # elif defined(_WIN32) && !defined(__GNUC__)
  153. # define z_off64_t __int64
  154. # else
  155. # define z_off64_t z_off_t
  156. # endif
  157. #endif
  158. #endif /* ZCONF_H */