zconf.h.in 14.3 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 76 77 78 79 80 81 82 83 84 85 86 87 88
#    define gzgets                z_gzgets
#    define gzoffset              z_gzoffset
#    define gzoffset64            z_gzoffset64
#    define gzopen                z_gzopen
#    define gzopen64              z_gzopen64
#    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 已提交
89 90 91 92 93 94 95
#  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 已提交
96
#  define inflateInit2_         z_inflateInit2_
M
Mark Adler 已提交
97
#  define inflateInit_          z_inflateInit_
M
Mark Adler 已提交
98
#  define inflateMark           z_inflateMark
M
Mark Adler 已提交
99 100
#  define inflatePrime          z_inflatePrime
#  define inflateReset          z_inflateReset
M
Mark Adler 已提交
101
#  define inflateReset2         z_inflateReset2
M
Mark Adler 已提交
102 103 104
#  define inflateSetDictionary  z_inflateSetDictionary
#  define inflateSync           z_inflateSync
#  define inflateSyncPoint      z_inflateSyncPoint
M
Mark Adler 已提交
105
#  define inflateUndermine      z_inflateUndermine
106
#  define inflateResetKeep      z_inflateResetKeep
M
Mark Adler 已提交
107 108 109
#  define inflate_copyright     z_inflate_copyright
#  define inflate_fast          z_inflate_fast
#  define inflate_table         z_inflate_table
110 111 112
#  ifndef Z_SOLO
#    define uncompress            z_uncompress
#  endif
M
Mark Adler 已提交
113
#  define zError                z_zError
114 115 116 117
#  ifndef Z_SOLO
#    define zcalloc               z_zcalloc
#    define zcfree                z_zcfree
#  endif
M
Mark Adler 已提交
118 119
#  define zlibCompileFlags      z_zlibCompileFlags
#  define zlibVersion           z_zlibVersion
M
Mark Adler 已提交
120

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

/* all zlib structs in zlib.h and zconf.h */
144
#  define gz_header_s           z_gz_header_s
M
Mark Adler 已提交
145 146
#  define internal_state        z_internal_state

M
Mark Adler 已提交
147
#endif
M
Mark Adler 已提交
148

M
Mark Adler 已提交
149 150 151 152 153 154 155 156 157
#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 已提交
158 159 160 161
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
#  ifndef WIN32
#    define WIN32
#  endif
M
Mark Adler 已提交
162
#endif
M
Mark Adler 已提交
163 164 165 166 167
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
#  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
#    ifndef SYS16BIT
#      define SYS16BIT
#    endif
M
Mark Adler 已提交
168
#  endif
M
Mark Adler 已提交
169
#endif
M
Mark Adler 已提交
170 171 172 173 174

/*
 * 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 已提交
175
#ifdef SYS16BIT
M
Mark Adler 已提交
176 177
#  define MAXSEG_64K
#endif
M
Mark Adler 已提交
178 179 180 181
#ifdef MSDOS
#  define UNALIGNED_OK
#endif

M
Mark Adler 已提交
182
#ifdef __STDC_VERSION__
M
Mark Adler 已提交
183 184 185
#  ifndef STDC
#    define STDC
#  endif
M
Mark Adler 已提交
186 187 188 189
#  if __STDC_VERSION__ >= 199901L
#    ifndef STDC99
#      define STDC99
#    endif
M
Mark Adler 已提交
190 191
#  endif
#endif
M
Mark Adler 已提交
192 193 194 195 196 197 198 199 200 201 202 203
#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 已提交
204

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

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

215 216 217 218 219 220
#if defined(ZLIB_CONST) && !defined(z_const)
#  define z_const const
#else
#  define z_const
#endif

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

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

M
Mark Adler 已提交
235 236 237 238 239
/* 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 已提交
240 241
#ifndef MAX_WBITS
#  define MAX_WBITS   15 /* 32K LZ77 window */
M
Mark Adler 已提交
242 243
#endif

M
Mark Adler 已提交
244
/* The memory requirements for deflate are (in bytes):
M
Mark Adler 已提交
245
            (1 << (windowBits+2)) +  (1 << (memLevel+9))
M
Mark Adler 已提交
246 247 248 249 250 251 252 253 254 255 256
 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 已提交
257
                        /* Type declarations */
M
Mark Adler 已提交
258

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

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

M
Mark Adler 已提交
275 276 277 278 279 280
/* 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 已提交
281 282 283 284 285 286 287 288 289
#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 已提交
290
#  endif
M
Mark Adler 已提交
291 292
#  if (defined(__SMALL__) || defined(__MEDIUM__))
     /* Turbo C small or medium model */
M
Mark Adler 已提交
293
#    define SMALL_MEDIUM
M
Mark Adler 已提交
294 295 296 297 298
#    ifdef __BORLANDC__
#      define FAR _far
#    else
#      define FAR far
#    endif
M
Mark Adler 已提交
299
#  endif
M
Mark Adler 已提交
300
#endif
M
Mark Adler 已提交
301

M
Mark Adler 已提交
302 303 304
#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 已提交
305
    */
M
Mark Adler 已提交
306 307
#  ifdef ZLIB_DLL
#    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
M
Mark Adler 已提交
308 309 310 311
#      ifdef ZLIB_INTERNAL
#        define ZEXTERN extern __declspec(dllexport)
#      else
#        define ZEXTERN extern __declspec(dllimport)
M
Mark Adler 已提交
312
#      endif
M
Mark Adler 已提交
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328
#    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 已提交
329
#    else
M
Mark Adler 已提交
330
#      define ZEXPORTVA FAR CDECL
M
Mark Adler 已提交
331 332 333 334 335
#    endif
#  endif
#endif

#if defined (__BEOS__)
M
Mark Adler 已提交
336 337 338 339 340 341 342 343
#  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 已提交
344
#  endif
M
Mark Adler 已提交
345 346
#endif

M
Mark Adler 已提交
347 348 349
#ifndef ZEXTERN
#  define ZEXTERN extern
#endif
M
Mark Adler 已提交
350 351 352 353 354 355
#ifndef ZEXPORT
#  define ZEXPORT
#endif
#ifndef ZEXPORTVA
#  define ZEXPORTVA
#endif
M
Mark Adler 已提交
356

M
Mark Adler 已提交
357
#ifndef FAR
M
Mark Adler 已提交
358
#  define FAR
M
Mark Adler 已提交
359
#endif
M
Mark Adler 已提交
360

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

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

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

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

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

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

402
/* accommodate both "#define _LARGEFILE64_SOURCE" and
M
Mark Adler 已提交
403
 * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
404
 * though the former does not conform to the LFS document), but consider
M
Mark Adler 已提交
405 406 407
 * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
 * equivalently requesting no 64-bit operations
 */
408
#if defined(LARGEFILE64_SOURCE) && _LARGEFILE64_SOURCE == 0
M
Mark Adler 已提交
409 410 411
#  undef _LARGEFILE64_SOURCE
#endif

412 413 414 415 416 417 418 419 420 421
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE == 1
#  define Z_LFS64
#endif

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

#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64 && defined(Z_LFS64)
#  define Z_WANT64
M
Mark Adler 已提交
422 423
#endif

424
#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
M
Mark Adler 已提交
425 426
#  define Z_HAVE_UNISTD_H
#endif
427
#if (defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE64)) && !defined(Z_SOLO)
M
Mark Adler 已提交
428 429 430 431 432 433 434 435
#  include <unistd.h>       /* for SEEK_* and off_t */
#  ifdef VMS
#    include <unixio.h>     /* for off_t */
#  endif
#  ifndef z_off_t
#    define z_off_t off_t
#  endif
#endif
M
Mark Adler 已提交
436

437
#if !defined(SEEK_SET) && !defined(Z_SOLO)
M
Mark Adler 已提交
438 439
#  define SEEK_SET        0       /* Seek from beginning of file.  */
#  define SEEK_CUR        1       /* Seek from current position.  */
M
Mark Adler 已提交
440
#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
M
Mark Adler 已提交
441
#endif
M
Mark Adler 已提交
442

M
Mark Adler 已提交
443
#ifndef z_off_t
M
Mark Adler 已提交
444
#  define z_off_t long
M
Mark Adler 已提交
445
#endif
M
Mark Adler 已提交
446

447
#if !defined(_WIN32) && (defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0)
M
Mark Adler 已提交
448 449
#  define z_off64_t off64_t
#else
450
#  if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
451 452
#    define z_off64_t __int64
#  else
453 454
#    define z_off64_t z_off_t
#  endif
455
#endif
M
Mark Adler 已提交
456

M
Mark Adler 已提交
457 458
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
M
Mark Adler 已提交
459 460 461 462 463 464 465 466 467 468 469 470 471
  #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 已提交
472 473
#endif

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