zconf.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  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. /* @(#) $Id$ */
  6. #ifndef ZCONF_H
  7. #define ZCONF_H
  8. /*
  9. * If you *really* need a unique prefix for all types and library functions,
  10. * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
  11. * Even better than compiling with -DZ_PREFIX would be to use configure to set
  12. * this permanently in zconf.h using "./configure --zprefix".
  13. */
  14. #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
  15. # define Z_PREFIX_SET
  16. /* all linked symbols and init macros */
  17. # define _dist_code z__dist_code
  18. # define _length_code z__length_code
  19. # define _tr_align z__tr_align
  20. # define _tr_flush_bits z__tr_flush_bits
  21. # define _tr_flush_block z__tr_flush_block
  22. # define _tr_init z__tr_init
  23. # define _tr_stored_block z__tr_stored_block
  24. # define _tr_tally z__tr_tally
  25. # define adler32 z_adler32
  26. # define adler32_combine z_adler32_combine
  27. # define adler32_combine64 z_adler32_combine64
  28. # define adler32_z z_adler32_z
  29. # ifndef Z_SOLO
  30. # define compress z_compress
  31. # define compress2 z_compress2
  32. # define compressBound z_compressBound
  33. # endif
  34. # define crc32 z_crc32
  35. # define crc32_combine z_crc32_combine
  36. # define crc32_combine64 z_crc32_combine64
  37. # define crc32_combine_gen z_crc32_combine_gen
  38. # define crc32_combine_gen64 z_crc32_combine_gen64
  39. # define crc32_combine_op z_crc32_combine_op
  40. # define crc32_z z_crc32_z
  41. # define deflate z_deflate
  42. # define deflateBound z_deflateBound
  43. # define deflateCopy z_deflateCopy
  44. # define deflateEnd z_deflateEnd
  45. # define deflateGetDictionary z_deflateGetDictionary
  46. # define deflateInit z_deflateInit
  47. # define deflateInit2 z_deflateInit2
  48. # define deflateInit2_ z_deflateInit2_
  49. # define deflateInit_ z_deflateInit_
  50. # define deflateParams z_deflateParams
  51. # define deflatePending z_deflatePending
  52. # define deflatePrime z_deflatePrime
  53. # define deflateReset z_deflateReset
  54. # define deflateResetKeep z_deflateResetKeep
  55. # define deflateSetDictionary z_deflateSetDictionary
  56. # define deflateSetHeader z_deflateSetHeader
  57. # define deflateTune z_deflateTune
  58. # define deflate_copyright z_deflate_copyright
  59. # define get_crc_table z_get_crc_table
  60. # ifndef Z_SOLO
  61. # define gz_error z_gz_error
  62. # define gz_intmax z_gz_intmax
  63. # define gz_strwinerror z_gz_strwinerror
  64. # define gzbuffer z_gzbuffer
  65. # define gzclearerr z_gzclearerr
  66. # define gzclose z_gzclose
  67. # define gzclose_r z_gzclose_r
  68. # define gzclose_w z_gzclose_w
  69. # define gzdirect z_gzdirect
  70. # define gzdopen z_gzdopen
  71. # define gzeof z_gzeof
  72. # define gzerror z_gzerror
  73. # define gzflush z_gzflush
  74. # define gzfread z_gzfread
  75. # define gzfwrite z_gzfwrite
  76. # define gzgetc z_gzgetc
  77. # define gzgetc_ z_gzgetc_
  78. # define gzgets z_gzgets
  79. # define gzoffset z_gzoffset
  80. # define gzoffset64 z_gzoffset64
  81. # define gzopen z_gzopen
  82. # define gzopen64 z_gzopen64
  83. # ifdef _WIN32
  84. # define gzopen_w z_gzopen_w
  85. # endif
  86. # define gzprintf z_gzprintf
  87. # define gzputc z_gzputc
  88. # define gzputs z_gzputs
  89. # define gzread z_gzread
  90. # define gzrewind z_gzrewind
  91. # define gzseek z_gzseek
  92. # define gzseek64 z_gzseek64
  93. # define gzsetparams z_gzsetparams
  94. # define gztell z_gztell
  95. # define gztell64 z_gztell64
  96. # define gzungetc z_gzungetc
  97. # define gzvprintf z_gzvprintf
  98. # define gzwrite z_gzwrite
  99. # endif
  100. # define inflate z_inflate
  101. # define inflateBack z_inflateBack
  102. # define inflateBackEnd z_inflateBackEnd
  103. # define inflateBackInit z_inflateBackInit
  104. # define inflateBackInit_ z_inflateBackInit_
  105. # define inflateCodesUsed z_inflateCodesUsed
  106. # define inflateCopy z_inflateCopy
  107. # define inflateEnd z_inflateEnd
  108. # define inflateGetDictionary z_inflateGetDictionary
  109. # define inflateGetHeader z_inflateGetHeader
  110. # define inflateInit z_inflateInit
  111. # define inflateInit2 z_inflateInit2
  112. # define inflateInit2_ z_inflateInit2_
  113. # define inflateInit_ z_inflateInit_
  114. # define inflateMark z_inflateMark
  115. # define inflatePrime z_inflatePrime
  116. # define inflateReset z_inflateReset
  117. # define inflateReset2 z_inflateReset2
  118. # define inflateResetKeep z_inflateResetKeep
  119. # define inflateSetDictionary z_inflateSetDictionary
  120. # define inflateSync z_inflateSync
  121. # define inflateSyncPoint z_inflateSyncPoint
  122. # define inflateUndermine z_inflateUndermine
  123. # define inflateValidate z_inflateValidate
  124. # define inflate_copyright z_inflate_copyright
  125. # define inflate_fast z_inflate_fast
  126. # define inflate_table z_inflate_table
  127. # ifndef Z_SOLO
  128. # define uncompress z_uncompress
  129. # define uncompress2 z_uncompress2
  130. # endif
  131. # define zError z_zError
  132. # ifndef Z_SOLO
  133. # define zcalloc z_zcalloc
  134. # define zcfree z_zcfree
  135. # endif
  136. # define zlibCompileFlags z_zlibCompileFlags
  137. # define zlibVersion z_zlibVersion
  138. /* all zlib typedefs in zlib.h and zconf.h */
  139. # define Byte z_Byte
  140. # define Bytef z_Bytef
  141. # define alloc_func z_alloc_func
  142. # define charf z_charf
  143. # define free_func z_free_func
  144. # ifndef Z_SOLO
  145. # define gzFile z_gzFile
  146. # endif
  147. # define gz_header z_gz_header
  148. # define gz_headerp z_gz_headerp
  149. # define in_func z_in_func
  150. # define intf z_intf
  151. # define out_func z_out_func
  152. # define uInt z_uInt
  153. # define uIntf z_uIntf
  154. # define uLong z_uLong
  155. # define uLongf z_uLongf
  156. # define voidp z_voidp
  157. # define voidpc z_voidpc
  158. # define voidpf z_voidpf
  159. /* all zlib structs in zlib.h and zconf.h */
  160. # define gz_header_s z_gz_header_s
  161. # define internal_state z_internal_state
  162. #endif
  163. #if defined(__MSDOS__) && !defined(MSDOS)
  164. # define MSDOS
  165. #endif
  166. #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
  167. # define OS2
  168. #endif
  169. #if defined(_WINDOWS) && !defined(WINDOWS)
  170. # define WINDOWS
  171. #endif
  172. #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
  173. # ifndef WIN32
  174. # define WIN32
  175. # endif
  176. #endif
  177. #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
  178. # if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
  179. # ifndef SYS16BIT
  180. # define SYS16BIT
  181. # endif
  182. # endif
  183. #endif
  184. /*
  185. * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
  186. * than 64k bytes at a time (needed on systems with 16-bit int).
  187. */
  188. #ifdef SYS16BIT
  189. # define MAXSEG_64K
  190. #endif
  191. #if defined(MSDOS) || defined(_i386_) || defined(_x86_64_)
  192. # define UNALIGNED_OK
  193. #endif
  194. #ifdef __STDC_VERSION__
  195. # ifndef STDC
  196. # define STDC
  197. # endif
  198. # if __STDC_VERSION__ >= 199901L
  199. # ifndef STDC99
  200. # define STDC99
  201. # endif
  202. # endif
  203. #endif
  204. #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
  205. # define STDC
  206. #endif
  207. #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
  208. # define STDC
  209. #endif
  210. #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
  211. # define STDC
  212. #endif
  213. #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
  214. # define STDC
  215. #endif
  216. #if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
  217. # define STDC
  218. #endif
  219. #ifndef STDC
  220. # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
  221. # define const /* note: need a more gentle solution here */
  222. # endif
  223. #endif
  224. #if defined(ZLIB_CONST) && !defined(z_const)
  225. # define z_const const
  226. #else
  227. # define z_const
  228. #endif
  229. #ifdef Z_SOLO
  230. # ifdef _WIN64
  231. typedef unsigned long long z_size_t;
  232. # else
  233. typedef unsigned long z_size_t;
  234. # endif
  235. #else
  236. # define z_longlong long long
  237. # if defined(NO_SIZE_T)
  238. typedef unsigned NO_SIZE_T z_size_t;
  239. # elif defined(STDC)
  240. # include <stddef.h>
  241. typedef size_t z_size_t;
  242. # else
  243. typedef unsigned long z_size_t;
  244. # endif
  245. # undef z_longlong
  246. #endif
  247. /* Maximum value for memLevel in deflateInit2 */
  248. #ifndef MAX_MEM_LEVEL
  249. # ifdef MAXSEG_64K
  250. # define MAX_MEM_LEVEL 8
  251. # else
  252. # define MAX_MEM_LEVEL 9
  253. # endif
  254. #endif
  255. /* Maximum value for windowBits in deflateInit2 and inflateInit2.
  256. * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
  257. * created by gzip. (Files created by minigzip can still be extracted by
  258. * gzip.)
  259. */
  260. #ifndef MAX_WBITS
  261. # define MAX_WBITS 15 /* 32K LZ77 window */
  262. #endif
  263. /* The memory requirements for deflate are (in bytes):
  264. (1 << (windowBits+2)) + (1 << (memLevel+9))
  265. that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
  266. plus a few kilobytes for small objects. For example, if you want to reduce
  267. the default memory requirements from 256K to 128K, compile with
  268. make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
  269. Of course this will generally degrade compression (there's no free lunch).
  270. The memory requirements for inflate are (in bytes) 1 << windowBits
  271. that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
  272. for small objects.
  273. */
  274. /* Type declarations */
  275. #ifndef OF /* function prototypes */
  276. # ifdef STDC
  277. # define OF(args) args
  278. # else
  279. # define OF(args) ()
  280. # endif
  281. #endif
  282. /* The following definitions for FAR are needed only for MSDOS mixed
  283. * model programming (small or medium model with some far allocations).
  284. * This was tested only with MSC; for other MSDOS compilers you may have
  285. * to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
  286. * just define FAR to be empty.
  287. */
  288. #ifdef SYS16BIT
  289. # if defined(M_I86SM) || defined(M_I86MM)
  290. /* MSC small or medium model */
  291. # define SMALL_MEDIUM
  292. # ifdef _MSC_VER
  293. # define FAR _far
  294. # else
  295. # define FAR far
  296. # endif
  297. # endif
  298. # if (defined(__SMALL__) || defined(__MEDIUM__))
  299. /* Turbo C small or medium model */
  300. # define SMALL_MEDIUM
  301. # ifdef __BORLANDC__
  302. # define FAR _far
  303. # else
  304. # define FAR far
  305. # endif
  306. # endif
  307. #endif
  308. #if defined(WINDOWS) || defined(WIN32)
  309. /* If building or using zlib as a DLL, define ZLIB_DLL.
  310. * This is not mandatory, but it offers a little performance increase.
  311. */
  312. # ifdef ZLIB_DLL
  313. # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
  314. # ifdef ZLIB_INTERNAL
  315. # define ZEXTERN extern __declspec(dllexport)
  316. # else
  317. # define ZEXTERN extern __declspec(dllimport)
  318. # endif
  319. # endif
  320. # endif /* ZLIB_DLL */
  321. /* If building or using zlib with the WINAPI/WINAPIV calling convention,
  322. * define ZLIB_WINAPI.
  323. * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
  324. */
  325. # ifdef ZLIB_WINAPI
  326. # ifdef FAR
  327. # undef FAR
  328. # endif
  329. # ifndef WIN32_LEAN_AND_MEAN
  330. # define WIN32_LEAN_AND_MEAN
  331. # endif
  332. # include <windows.h>
  333. /* No need for _export, use ZLIB.DEF instead. */
  334. /* For complete Windows compatibility, use WINAPI, not __stdcall. */
  335. # define ZEXPORT WINAPI
  336. # ifdef WIN32
  337. # define ZEXPORTVA WINAPIV
  338. # else
  339. # define ZEXPORTVA FAR CDECL
  340. # endif
  341. # endif
  342. #endif
  343. #if defined (__BEOS__)
  344. # ifdef ZLIB_DLL
  345. # ifdef ZLIB_INTERNAL
  346. # define ZEXPORT __declspec(dllexport)
  347. # define ZEXPORTVA __declspec(dllexport)
  348. # else
  349. # define ZEXPORT __declspec(dllimport)
  350. # define ZEXPORTVA __declspec(dllimport)
  351. # endif
  352. # endif
  353. #endif
  354. #if !defined(WINDOWS) && !defined(WIN32) && !defined(__BEOS__)
  355. # ifdef ZLIB_DLL
  356. # define ZEXPORT __attribute__((visibility("default")))
  357. # define ZEXPORTVA __attribute__((visibility("default")))
  358. # endif
  359. #endif
  360. #ifndef ZEXTERN
  361. # define ZEXTERN extern
  362. #endif
  363. #ifndef ZEXPORT
  364. # define ZEXPORT
  365. #endif
  366. #ifndef ZEXPORTVA
  367. # define ZEXPORTVA
  368. #endif
  369. #ifndef FAR
  370. # define FAR
  371. #endif
  372. #if !defined(__MACTYPES__)
  373. typedef unsigned char Byte; /* 8 bits */
  374. #endif
  375. typedef unsigned int uInt; /* 16 bits or more */
  376. typedef unsigned long uLong; /* 32 bits or more */
  377. #ifdef SMALL_MEDIUM
  378. /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
  379. # define Bytef Byte FAR
  380. #else
  381. typedef Byte FAR Bytef;
  382. #endif
  383. typedef char FAR charf;
  384. typedef int FAR intf;
  385. typedef uInt FAR uIntf;
  386. typedef uLong FAR uLongf;
  387. #ifdef STDC
  388. typedef void const *voidpc;
  389. typedef void FAR *voidpf;
  390. typedef void *voidp;
  391. #else
  392. typedef Byte const *voidpc;
  393. typedef Byte FAR *voidpf;
  394. typedef Byte *voidp;
  395. #endif
  396. #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
  397. # include <limits.h>
  398. # if (UINT_MAX == 0xffffffffUL)
  399. # define Z_U4 unsigned
  400. # elif (ULONG_MAX == 0xffffffffUL)
  401. # define Z_U4 unsigned long
  402. # elif (USHRT_MAX == 0xffffffffUL)
  403. # define Z_U4 unsigned short
  404. # endif
  405. #endif
  406. #ifdef Z_U4
  407. typedef Z_U4 z_crc_t;
  408. #else
  409. typedef unsigned long z_crc_t;
  410. #endif
  411. #ifdef __GNUC__
  412. # define Z_HAVE_UNISTD_H
  413. #else
  414. # if __has_include(<unistd.h>)
  415. # define Z_HAVE_UNISTD_H
  416. # endif
  417. #endif
  418. #ifdef __GNUC__
  419. # define Z_HAVE_UNISTD_H
  420. #else
  421. # if __has_include(<stdarg.h>)
  422. # define Z_HAVE_STDARG_H
  423. # endif
  424. #endif
  425. #ifdef STDC
  426. # ifndef Z_SOLO
  427. # include <sys/types.h> /* for off_t */
  428. # endif
  429. #endif
  430. #if defined(STDC) || defined(Z_HAVE_STDARG_H)
  431. # ifndef Z_SOLO
  432. # include <stdarg.h> /* for va_list */
  433. # endif
  434. #endif
  435. #ifdef _WIN32
  436. # ifndef Z_SOLO
  437. # include <stddef.h> /* for wchar_t */
  438. # endif
  439. #endif
  440. /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
  441. * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
  442. * though the former does not conform to the LFS document), but considering
  443. * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
  444. * equivalently requesting no 64-bit operations
  445. */
  446. #if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
  447. # undef _LARGEFILE64_SOURCE
  448. #endif
  449. #ifndef Z_HAVE_UNISTD_H
  450. # ifdef __WATCOMC__
  451. # define Z_HAVE_UNISTD_H
  452. # endif
  453. #endif
  454. #ifndef Z_HAVE_UNISTD_H
  455. # if defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)
  456. # define Z_HAVE_UNISTD_H
  457. # endif
  458. #endif
  459. #ifndef Z_SOLO
  460. # if defined(Z_HAVE_UNISTD_H)
  461. # include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
  462. # ifdef VMS
  463. # error #include <unixio.h> /* for off_t */
  464. # endif
  465. # ifndef z_off_t
  466. # define z_off_t off_t
  467. # endif
  468. # endif
  469. #endif
  470. #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
  471. # define Z_LFS64
  472. #endif
  473. #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
  474. # define Z_LARGE64
  475. #endif
  476. #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
  477. # define Z_WANT64
  478. #endif
  479. #if !defined(SEEK_SET) && !defined(Z_SOLO)
  480. # define SEEK_SET 0 /* Seek from beginning of file. */
  481. # define SEEK_CUR 1 /* Seek from current position. */
  482. # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
  483. #endif
  484. #ifndef z_off_t
  485. # define z_off_t long
  486. #endif
  487. #if !defined(_WIN32) && defined(Z_LARGE64)
  488. # define z_off64_t off64_t
  489. #else
  490. # if defined(_WIN32) && !defined(__GNUC__)
  491. # define z_off64_t __int64
  492. # else
  493. # define z_off64_t z_off_t
  494. # endif
  495. #endif
  496. /* MVS linker does not support external names larger than 8 bytes */
  497. #if defined(__MVS__)
  498. #pragma map(deflateInit_,"DEIN")
  499. #pragma map(deflateInit2_,"DEIN2")
  500. #pragma map(deflateEnd,"DEEND")
  501. #pragma map(deflateBound,"DEBND")
  502. #pragma map(inflateInit_,"ININ")
  503. #pragma map(inflateInit2_,"ININ2")
  504. #pragma map(inflateEnd,"INEND")
  505. #pragma map(inflateSync,"INSY")
  506. #pragma map(inflateSetDictionary,"INSEDI")
  507. #pragma map(compressBound,"CMBND")
  508. #pragma map(inflate_table,"INTABL")
  509. #pragma map(inflate_fast,"INFA")
  510. #pragma map(inflate_copyright,"INCOPY")
  511. #endif
  512. #endif /* ZCONF_H */