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