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