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