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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

M
Mark Adler 已提交
411 412 413 414
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
#  define Z_LARGE
#endif

415
#if (defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE)) && !defined(Z_SOLO)
M
Mark Adler 已提交
416 417 418 419 420 421 422 423
#  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 已提交
424

425
#if !defined(SEEK_SET) && !defined(Z_SOLO)
M
Mark Adler 已提交
426 427
#  define SEEK_SET        0       /* Seek from beginning of file.  */
#  define SEEK_CUR        1       /* Seek from current position.  */
M
Mark Adler 已提交
428
#  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
M
Mark Adler 已提交
429
#endif
M
Mark Adler 已提交
430

M
Mark Adler 已提交
431
#ifndef z_off_t
M
Mark Adler 已提交
432
#  define z_off_t long
M
Mark Adler 已提交
433
#endif
M
Mark Adler 已提交
434

435
#if !defined(_WIN32) && (defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0)
M
Mark Adler 已提交
436 437
#  define z_off64_t off64_t
#else
438 439 440
#  if defined(_WIN32)
#    define z_off64_t __int64
#  else
M
Mark Adler 已提交
441 442
#  define z_off64_t z_off_t
#endif
443
#endif
M
Mark Adler 已提交
444

M
Mark Adler 已提交
445 446
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
M
Mark Adler 已提交
447 448 449 450 451 452 453 454 455 456 457 458 459
  #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 已提交
460 461
#endif

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