zconf.h.in 14.5 KB
Newer Older
M
Mark Adler 已提交
1
/* zconf.h -- configuration of the zlib compression library
M
Mark Adler 已提交
2
 * Copyright (C) 1995-2012 Jean-loup Gailly.
M
Mark Adler 已提交
3
 * For conditions of distribution and use, see copyright notice in zlib.h
M
Mark Adler 已提交
4 5
 */

M
Mark Adler 已提交
6
/* @(#) $Id$ */
M
Mark Adler 已提交
7

M
Mark Adler 已提交
8 9
#ifndef ZCONF_H
#define ZCONF_H
M
Mark Adler 已提交
10 11

/*
M
Mark Adler 已提交
12 13
 * If you *really* need a unique prefix for all types and library functions,
 * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
M
Mark Adler 已提交
14 15
 * Even better than compiling with -DZ_PREFIX would be to use configure to set
 * this permanently in zconf.h using "./configure --zprefix".
M
Mark Adler 已提交
16
 */
M
Mark Adler 已提交
17
#ifdef Z_PREFIX     /* may be set to #if 1 by ./configure */
M
Mark Adler 已提交
18
#  define Z_PREFIX_SET
M
Mark Adler 已提交
19 20 21 22 23 24 25 26 27 28 29

/* all linked symbols */
#  define _dist_code            z__dist_code
#  define _length_code          z__length_code
#  define _tr_align             z__tr_align
#  define _tr_flush_block       z__tr_flush_block
#  define _tr_init              z__tr_init
#  define _tr_stored_block      z__tr_stored_block
#  define _tr_tally             z__tr_tally
#  define adler32               z_adler32
#  define adler32_combine       z_adler32_combine
M
Mark Adler 已提交
30
#  define adler32_combine64     z_adler32_combine64
31 32 33 34 35
#  ifndef Z_SOLO
#    define compress              z_compress
#    define compress2             z_compress2
#    define compressBound         z_compressBound
#  endif
M
Mark Adler 已提交
36 37
#  define crc32                 z_crc32
#  define crc32_combine         z_crc32_combine
M
Mark Adler 已提交
38
#  define crc32_combine64       z_crc32_combine64
M
Mark Adler 已提交
39
#  define deflate               z_deflate
M
Mark Adler 已提交
40 41
#  define deflateBound          z_deflateBound
#  define deflateCopy           z_deflateCopy
M
Mark Adler 已提交
42 43
#  define deflateEnd            z_deflateEnd
#  define deflateInit2_         z_deflateInit2_
M
Mark Adler 已提交
44
#  define deflateInit_          z_deflateInit_
M
Mark Adler 已提交
45
#  define deflateParams         z_deflateParams
M
Mark Adler 已提交
46
#  define deflatePending        z_deflatePending
M
Mark Adler 已提交
47
#  define deflatePrime          z_deflatePrime
M
Mark Adler 已提交
48
#  define deflateReset          z_deflateReset
49
#  define deflateResetKeep      z_deflateResetKeep
M
Mark Adler 已提交
50 51 52 53 54
#  define deflateSetDictionary  z_deflateSetDictionary
#  define deflateSetHeader      z_deflateSetHeader
#  define deflateTune           z_deflateTune
#  define deflate_copyright     z_deflate_copyright
#  define get_crc_table         z_get_crc_table
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
#  ifndef Z_SOLO
#    define gz_error              z_gz_error
#    define gz_intmax             z_gz_intmax
#    define gz_strwinerror        z_gz_strwinerror
#    define gzbuffer              z_gzbuffer
#    define gzclearerr            z_gzclearerr
#    define gzclose               z_gzclose
#    define gzclose_r             z_gzclose_r
#    define gzclose_w             z_gzclose_w
#    define gzdirect              z_gzdirect
#    define gzdopen               z_gzdopen
#    define gzeof                 z_gzeof
#    define gzerror               z_gzerror
#    define gzflush               z_gzflush
#    define gzgetc                z_gzgetc
70
#    define gzgetc_               z_gzgetc_
71 72 73 74 75
#    define gzgets                z_gzgets
#    define gzoffset              z_gzoffset
#    define gzoffset64            z_gzoffset64
#    define gzopen                z_gzopen
#    define gzopen64              z_gzopen64
76 77 78
#    ifdef _WIN32
#      define gzopen_w              z_gzopen_w
#    endif
79 80 81 82 83 84 85 86 87 88 89 90 91
#    define gzprintf              z_gzprintf
#    define gzputc                z_gzputc
#    define gzputs                z_gzputs
#    define gzread                z_gzread
#    define gzrewind              z_gzrewind
#    define gzseek                z_gzseek
#    define gzseek64              z_gzseek64
#    define gzsetparams           z_gzsetparams
#    define gztell                z_gztell
#    define gztell64              z_gztell64
#    define gzungetc              z_gzungetc
#    define gzwrite               z_gzwrite
#  endif
M
Mark Adler 已提交
92 93 94 95 96 97 98
#  define inflate               z_inflate
#  define inflateBack           z_inflateBack
#  define inflateBackEnd        z_inflateBackEnd
#  define inflateBackInit_      z_inflateBackInit_
#  define inflateCopy           z_inflateCopy
#  define inflateEnd            z_inflateEnd
#  define inflateGetHeader      z_inflateGetHeader
M
Mark Adler 已提交
99
#  define inflateInit2_         z_inflateInit2_
M
Mark Adler 已提交
100
#  define inflateInit_          z_inflateInit_
M
Mark Adler 已提交
101
#  define inflateMark           z_inflateMark
M
Mark Adler 已提交
102 103
#  define inflatePrime          z_inflatePrime
#  define inflateReset          z_inflateReset
M
Mark Adler 已提交
104
#  define inflateReset2         z_inflateReset2
M
Mark Adler 已提交
105 106 107
#  define inflateSetDictionary  z_inflateSetDictionary
#  define inflateSync           z_inflateSync
#  define inflateSyncPoint      z_inflateSyncPoint
M
Mark Adler 已提交
108
#  define inflateUndermine      z_inflateUndermine
109
#  define inflateResetKeep      z_inflateResetKeep
M
Mark Adler 已提交
110 111 112
#  define inflate_copyright     z_inflate_copyright
#  define inflate_fast          z_inflate_fast
#  define inflate_table         z_inflate_table
113 114 115
#  ifndef Z_SOLO
#    define uncompress            z_uncompress
#  endif
M
Mark Adler 已提交
116
#  define zError                z_zError
117 118 119 120
#  ifndef Z_SOLO
#    define zcalloc               z_zcalloc
#    define zcfree                z_zcfree
#  endif
M
Mark Adler 已提交
121 122
#  define zlibCompileFlags      z_zlibCompileFlags
#  define zlibVersion           z_zlibVersion
M
Mark Adler 已提交
123

M
Mark Adler 已提交
124 125 126
/* all zlib typedefs in zlib.h and zconf.h */
#  define Byte                  z_Byte
#  define Bytef                 z_Bytef
M
Mark Adler 已提交
127
#  define alloc_func            z_alloc_func
M
Mark Adler 已提交
128
#  define charf                 z_charf
M
Mark Adler 已提交
129
#  define free_func             z_free_func
130 131 132
#  ifndef Z_SOLO
#    define gzFile                z_gzFile
#  endif
133 134
#  define gz_header             z_gz_header
#  define gz_headerp            z_gz_headerp
M
Mark Adler 已提交
135
#  define in_func               z_in_func
M
Mark Adler 已提交
136
#  define intf                  z_intf
M
Mark Adler 已提交
137
#  define out_func              z_out_func
M
Mark Adler 已提交
138 139
#  define uInt                  z_uInt
#  define uIntf                 z_uIntf
M
Mark Adler 已提交
140
#  define uLong                 z_uLong
M
Mark Adler 已提交
141 142
#  define uLongf                z_uLongf
#  define voidp                 z_voidp
M
Mark Adler 已提交
143 144 145 146
#  define voidpc                z_voidpc
#  define voidpf                z_voidpf

/* all zlib structs in zlib.h and zconf.h */
147
#  define gz_header_s           z_gz_header_s
M
Mark Adler 已提交
148 149
#  define internal_state        z_internal_state

M
Mark Adler 已提交
150
#endif
M
Mark Adler 已提交
151

M
Mark Adler 已提交
152 153 154 155 156 157 158 159 160
#if defined(__MSDOS__) && !defined(MSDOS)
#  define MSDOS
#endif
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
#  define OS2
#endif
#if defined(_WINDOWS) && !defined(WINDOWS)
#  define WINDOWS
#endif
M
Mark Adler 已提交
161 162 163 164
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
#  ifndef WIN32
#    define WIN32
#  endif
M
Mark Adler 已提交
165
#endif
M
Mark Adler 已提交
166 167 168 169 170
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
#  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
#    ifndef SYS16BIT
#      define SYS16BIT
#    endif
M
Mark Adler 已提交
171
#  endif
M
Mark Adler 已提交
172
#endif
M
Mark Adler 已提交
173 174 175 176 177

/*
 * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
 * than 64k bytes at a time (needed on systems with 16-bit int).
 */
M
Mark Adler 已提交
178
#ifdef SYS16BIT
M
Mark Adler 已提交
179 180
#  define MAXSEG_64K
#endif
M
Mark Adler 已提交
181 182 183 184
#ifdef MSDOS
#  define UNALIGNED_OK
#endif

M
Mark Adler 已提交
185
#ifdef __STDC_VERSION__
M
Mark Adler 已提交
186 187 188
#  ifndef STDC
#    define STDC
#  endif
M
Mark Adler 已提交
189 190 191 192
#  if __STDC_VERSION__ >= 199901L
#    ifndef STDC99
#      define STDC99
#    endif
M
Mark Adler 已提交
193 194
#  endif
#endif
M
Mark Adler 已提交
195 196 197 198 199 200 201 202 203 204 205 206
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
#  define STDC
#endif
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
#  define STDC
#endif
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
#  define STDC
#endif
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
#  define STDC
#endif
M
Mark Adler 已提交
207

M
Mark Adler 已提交
208 209 210 211
#if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
#  define STDC
#endif

M
Mark Adler 已提交
212 213
#ifndef STDC
#  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
M
Mark Adler 已提交
214
#    define const       /* note: need a more gentle solution here */
M
Mark Adler 已提交
215
#  endif
M
Mark Adler 已提交
216 217
#endif

218 219 220 221 222 223
#if defined(ZLIB_CONST) && !defined(z_const)
#  define z_const const
#else
#  define z_const
#endif

M
Mark Adler 已提交
224
/* Some Mac compilers merge all .h files incorrectly: */
M
Mark Adler 已提交
225
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
M
Mark Adler 已提交
226
#  define NO_DUMMY_DECL
M
Mark Adler 已提交
227
#endif
M
Mark Adler 已提交
228

M
Mark Adler 已提交
229
/* Maximum value for memLevel in deflateInit2 */
M
Mark Adler 已提交
230 231 232 233 234 235 236 237
#ifndef MAX_MEM_LEVEL
#  ifdef MAXSEG_64K
#    define MAX_MEM_LEVEL 8
#  else
#    define MAX_MEM_LEVEL 9
#  endif
#endif

M
Mark Adler 已提交
238 239 240 241 242
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
 * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
 * created by gzip. (Files created by minigzip can still be extracted by
 * gzip.)
 */
M
Mark Adler 已提交
243 244
#ifndef MAX_WBITS
#  define MAX_WBITS   15 /* 32K LZ77 window */
M
Mark Adler 已提交
245 246
#endif

M
Mark Adler 已提交
247
/* The memory requirements for deflate are (in bytes):
M
Mark Adler 已提交
248
            (1 << (windowBits+2)) +  (1 << (memLevel+9))
M
Mark Adler 已提交
249 250 251 252 253 254 255 256 257 258 259
 that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
 plus a few kilobytes for small objects. For example, if you want to reduce
 the default memory requirements from 256K to 128K, compile with
     make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
 Of course this will generally degrade compression (there's no free lunch).

   The memory requirements for inflate are (in bytes) 1 << windowBits
 that is, 32K for windowBits=15 (default value) plus a few kilobytes
 for small objects.
*/

M
Mark Adler 已提交
260
                        /* Type declarations */
M
Mark Adler 已提交
261

M
Mark Adler 已提交
262
#ifndef OF /* function prototypes */
M
Mark Adler 已提交
263
#  ifdef STDC
M
Mark Adler 已提交
264
#    define OF(args)  args
M
Mark Adler 已提交
265
#  else
M
Mark Adler 已提交
266
#    define OF(args)  ()
M
Mark Adler 已提交
267 268 269
#  endif
#endif

270
#ifndef Z_ARG /* function prototypes for stdarg */
M
Mark Adler 已提交
271
#  if defined(STDC) || defined(Z_HAVE_STDARG_H)
272
#    define Z_ARG(args)  args
M
Mark Adler 已提交
273
#  else
274
#    define Z_ARG(args)  ()
M
Mark Adler 已提交
275 276 277
#  endif
#endif

M
Mark Adler 已提交
278 279 280 281 282 283
/* The following definitions for FAR are needed only for MSDOS mixed
 * model programming (small or medium model with some far allocations).
 * This was tested only with MSC; for other MSDOS compilers you may have
 * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
 * just define FAR to be empty.
 */
M
Mark Adler 已提交
284 285 286 287 288 289 290 291 292
#ifdef SYS16BIT
#  if defined(M_I86SM) || defined(M_I86MM)
     /* MSC small or medium model */
#    define SMALL_MEDIUM
#    ifdef _MSC_VER
#      define FAR _far
#    else
#      define FAR far
#    endif
M
Mark Adler 已提交
293
#  endif
M
Mark Adler 已提交
294 295
#  if (defined(__SMALL__) || defined(__MEDIUM__))
     /* Turbo C small or medium model */
M
Mark Adler 已提交
296
#    define SMALL_MEDIUM
M
Mark Adler 已提交
297 298 299 300 301
#    ifdef __BORLANDC__
#      define FAR _far
#    else
#      define FAR far
#    endif
M
Mark Adler 已提交
302
#  endif
M
Mark Adler 已提交
303
#endif
M
Mark Adler 已提交
304

M
Mark Adler 已提交
305 306 307
#if defined(WINDOWS) || defined(WIN32)
   /* If building or using zlib as a DLL, define ZLIB_DLL.
    * This is not mandatory, but it offers a little performance increase.
M
Mark Adler 已提交
308
    */
M
Mark Adler 已提交
309 310
#  ifdef ZLIB_DLL
#    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
M
Mark Adler 已提交
311 312 313 314
#      ifdef ZLIB_INTERNAL
#        define ZEXTERN extern __declspec(dllexport)
#      else
#        define ZEXTERN extern __declspec(dllimport)
M
Mark Adler 已提交
315
#      endif
M
Mark Adler 已提交
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331
#    endif
#  endif  /* ZLIB_DLL */
   /* If building or using zlib with the WINAPI/WINAPIV calling convention,
    * define ZLIB_WINAPI.
    * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
    */
#  ifdef ZLIB_WINAPI
#    ifdef FAR
#      undef FAR
#    endif
#    include <windows.h>
     /* No need for _export, use ZLIB.DEF instead. */
     /* For complete Windows compatibility, use WINAPI, not __stdcall. */
#    define ZEXPORT WINAPI
#    ifdef WIN32
#      define ZEXPORTVA WINAPIV
M
Mark Adler 已提交
332
#    else
M
Mark Adler 已提交
333
#      define ZEXPORTVA FAR CDECL
M
Mark Adler 已提交
334 335 336 337 338
#    endif
#  endif
#endif

#if defined (__BEOS__)
M
Mark Adler 已提交
339 340 341 342 343 344 345 346
#  ifdef ZLIB_DLL
#    ifdef ZLIB_INTERNAL
#      define ZEXPORT   __declspec(dllexport)
#      define ZEXPORTVA __declspec(dllexport)
#    else
#      define ZEXPORT   __declspec(dllimport)
#      define ZEXPORTVA __declspec(dllimport)
#    endif
M
Mark Adler 已提交
347
#  endif
M
Mark Adler 已提交
348 349
#endif

M
Mark Adler 已提交
350 351 352
#ifndef ZEXTERN
#  define ZEXTERN extern
#endif
M
Mark Adler 已提交
353 354 355 356 357 358
#ifndef ZEXPORT
#  define ZEXPORT
#endif
#ifndef ZEXPORTVA
#  define ZEXPORTVA
#endif
M
Mark Adler 已提交
359

M
Mark Adler 已提交
360
#ifndef FAR
M
Mark Adler 已提交
361
#  define FAR
M
Mark Adler 已提交
362
#endif
M
Mark Adler 已提交
363

M
Mark Adler 已提交
364
#if !defined(__MACTYPES__)
M
Mark Adler 已提交
365
typedef unsigned char  Byte;  /* 8 bits */
M
Mark Adler 已提交
366
#endif
M
Mark Adler 已提交
367 368 369
typedef unsigned int   uInt;  /* 16 bits or more */
typedef unsigned long  uLong; /* 32 bits or more */

M
Mark Adler 已提交
370 371
#ifdef SMALL_MEDIUM
   /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
M
Mark Adler 已提交
372 373 374 375
#  define Bytef Byte FAR
#else
   typedef Byte  FAR Bytef;
#endif
M
Mark Adler 已提交
376 377 378
typedef char  FAR charf;
typedef int   FAR intf;
typedef uInt  FAR uIntf;
M
Mark Adler 已提交
379 380 381
typedef uLong FAR uLongf;

#ifdef STDC
M
Mark Adler 已提交
382
   typedef void const *voidpc;
M
Mark Adler 已提交
383 384
   typedef void FAR   *voidpf;
   typedef void       *voidp;
M
Mark Adler 已提交
385
#else
M
Mark Adler 已提交
386
   typedef Byte const *voidpc;
M
Mark Adler 已提交
387 388
   typedef Byte FAR   *voidpf;
   typedef Byte       *voidp;
M
Mark Adler 已提交
389 390
#endif

M
Mark Adler 已提交
391
#ifdef HAVE_UNISTD_H    /* may be set to #if 1 by ./configure */
M
Mark Adler 已提交
392 393 394
#  define Z_HAVE_UNISTD_H
#endif

M
Mark Adler 已提交
395 396 397 398
#ifdef HAVE_STDARG_H    /* may be set to #if 1 by ./configure */
#  define Z_HAVE_STDARG_H
#endif

M
Mark Adler 已提交
399
#ifdef STDC
400 401 402
#  ifndef Z_SOLO
#    include <sys/types.h>      /* for off_t */
#  endif
M
Mark Adler 已提交
403 404
#endif

M
Mark Adler 已提交
405 406 407 408
#ifdef _WIN32
#  include <stddef.h>           /* for wchar_t */
#endif

409
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
M
Mark Adler 已提交
410
 * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
411
 * though the former does not conform to the LFS document), but considering
M
Mark Adler 已提交
412 413 414
 * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
 * equivalently requesting no 64-bit operations
 */
415
#if defined(LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
M
Mark Adler 已提交
416 417 418
#  undef _LARGEFILE64_SOURCE
#endif

419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
#  define Z_HAVE_UNISTD_H
#endif
#ifndef Z_SOLO
#  if defined(Z_HAVE_UNISTD_H) || defined(LARGEFILE64_SOURCE)
#    include <unistd.h>         /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
#    ifdef VMS
#      include <unixio.h>       /* for off_t */
#    endif
#    ifndef z_off_t
#      define z_off_t off_t
#    endif
#  endif
#endif

434
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
435 436 437 438 439 440 441
#  define Z_LFS64
#endif

#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
#  define Z_LARGE64
#endif

442
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
443
#  define Z_WANT64
M
Mark Adler 已提交
444 445
#endif

446
#if !defined(SEEK_SET) && !defined(Z_SOLO)
M
Mark Adler 已提交
447 448
#  define SEEK_SET        0       /* Seek from beginning of file.  */
#  define SEEK_CUR        1       /* Seek from current position.  */
M
Mark Adler 已提交
449
#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
M
Mark Adler 已提交
450
#endif
M
Mark Adler 已提交
451

M
Mark Adler 已提交
452
#ifndef z_off_t
M
Mark Adler 已提交
453
#  define z_off_t long
M
Mark Adler 已提交
454
#endif
M
Mark Adler 已提交
455

456
#if !defined(_WIN32) && defined(Z_LARGE64)
M
Mark Adler 已提交
457 458
#  define z_off64_t off64_t
#else
459
#  if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
460 461
#    define z_off64_t __int64
#  else
462 463
#    define z_off64_t z_off_t
#  endif
464
#endif
M
Mark Adler 已提交
465

M
Mark Adler 已提交
466 467
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
M
Mark Adler 已提交
468 469 470 471 472 473 474 475 476 477 478 479 480
  #pragma map(deflateInit_,"DEIN")
  #pragma map(deflateInit2_,"DEIN2")
  #pragma map(deflateEnd,"DEEND")
  #pragma map(deflateBound,"DEBND")
  #pragma map(inflateInit_,"ININ")
  #pragma map(inflateInit2_,"ININ2")
  #pragma map(inflateEnd,"INEND")
  #pragma map(inflateSync,"INSY")
  #pragma map(inflateSetDictionary,"INSEDI")
  #pragma map(compressBound,"CMBND")
  #pragma map(inflate_table,"INTABL")
  #pragma map(inflate_fast,"INFA")
  #pragma map(inflate_copyright,"INCOPY")
M
Mark Adler 已提交
481 482
#endif

M
Mark Adler 已提交
483
#endif /* ZCONF_H */