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