Home | History | Annotate | Line # | Download | only in zlib
zconf.h revision 1.1
      1  1.1  christos /*	$NetBSD: zconf.h,v 1.1 2006/01/14 20:10:34 christos Exp $	*/
      2  1.1  christos 
      3  1.1  christos /* zconf.h -- configuration of the zlib compression library
      4  1.1  christos  * Copyright (C) 1995-2005 Jean-loup Gailly.
      5  1.1  christos  * For conditions of distribution and use, see copyright notice in zlib.h
      6  1.1  christos  */
      7  1.1  christos 
      8  1.1  christos /* @(#) Id */
      9  1.1  christos 
     10  1.1  christos #ifndef ZCONF_H
     11  1.1  christos #define ZCONF_H
     12  1.1  christos 
     13  1.1  christos /*
     14  1.1  christos  * If you *really* need a unique prefix for all types and library functions,
     15  1.1  christos  * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
     16  1.1  christos  */
     17  1.1  christos #ifdef Z_PREFIX
     18  1.1  christos #  define deflateInit_          z_deflateInit_
     19  1.1  christos #  define deflate               z_deflate
     20  1.1  christos #  define deflateEnd            z_deflateEnd
     21  1.1  christos #  define inflateInit_          z_inflateInit_
     22  1.1  christos #  define inflate               z_inflate
     23  1.1  christos #  define inflateEnd            z_inflateEnd
     24  1.1  christos #  define deflateInit2_         z_deflateInit2_
     25  1.1  christos #  define deflateSetDictionary  z_deflateSetDictionary
     26  1.1  christos #  define deflateCopy           z_deflateCopy
     27  1.1  christos #  define deflateReset          z_deflateReset
     28  1.1  christos #  define deflateParams         z_deflateParams
     29  1.1  christos #  define deflateBound          z_deflateBound
     30  1.1  christos #  define deflatePrime          z_deflatePrime
     31  1.1  christos #  define inflateInit2_         z_inflateInit2_
     32  1.1  christos #  define inflateSetDictionary  z_inflateSetDictionary
     33  1.1  christos #  define inflateSync           z_inflateSync
     34  1.1  christos #  define inflateSyncPoint      z_inflateSyncPoint
     35  1.1  christos #  define inflateCopy           z_inflateCopy
     36  1.1  christos #  define inflateReset          z_inflateReset
     37  1.1  christos #  define inflateBack           z_inflateBack
     38  1.1  christos #  define inflateBackEnd        z_inflateBackEnd
     39  1.1  christos #  define compress              z_compress
     40  1.1  christos #  define compress2             z_compress2
     41  1.1  christos #  define compressBound         z_compressBound
     42  1.1  christos #  define uncompress            z_uncompress
     43  1.1  christos #  define adler32               z_adler32
     44  1.1  christos #  define crc32                 z_crc32
     45  1.1  christos #  define get_crc_table         z_get_crc_table
     46  1.1  christos #  define zError                z_zError
     47  1.1  christos 
     48  1.1  christos #  define alloc_func            z_alloc_func
     49  1.1  christos #  define free_func             z_free_func
     50  1.1  christos #  define in_func               z_in_func
     51  1.1  christos #  define out_func              z_out_func
     52  1.1  christos #  define Byte                  z_Byte
     53  1.1  christos #  define uInt                  z_uInt
     54  1.1  christos #  define uLong                 z_uLong
     55  1.1  christos #  define Bytef                 z_Bytef
     56  1.1  christos #  define charf                 z_charf
     57  1.1  christos #  define intf                  z_intf
     58  1.1  christos #  define uIntf                 z_uIntf
     59  1.1  christos #  define uLongf                z_uLongf
     60  1.1  christos #  define voidpf                z_voidpf
     61  1.1  christos #  define voidp                 z_voidp
     62  1.1  christos #endif
     63  1.1  christos 
     64  1.1  christos #if defined(__MSDOS__) && !defined(MSDOS)
     65  1.1  christos #  define MSDOS
     66  1.1  christos #endif
     67  1.1  christos #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
     68  1.1  christos #  define OS2
     69  1.1  christos #endif
     70  1.1  christos #if defined(_WINDOWS) && !defined(WINDOWS)
     71  1.1  christos #  define WINDOWS
     72  1.1  christos #endif
     73  1.1  christos #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
     74  1.1  christos #  ifndef WIN32
     75  1.1  christos #    define WIN32
     76  1.1  christos #  endif
     77  1.1  christos #endif
     78  1.1  christos #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
     79  1.1  christos #  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
     80  1.1  christos #    ifndef SYS16BIT
     81  1.1  christos #      define SYS16BIT
     82  1.1  christos #    endif
     83  1.1  christos #  endif
     84  1.1  christos #endif
     85  1.1  christos 
     86  1.1  christos /*
     87  1.1  christos  * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
     88  1.1  christos  * than 64k bytes at a time (needed on systems with 16-bit int).
     89  1.1  christos  */
     90  1.1  christos #ifdef SYS16BIT
     91  1.1  christos #  define MAXSEG_64K
     92  1.1  christos #endif
     93  1.1  christos #ifdef MSDOS
     94  1.1  christos #  define UNALIGNED_OK
     95  1.1  christos #endif
     96  1.1  christos 
     97  1.1  christos #ifdef __STDC_VERSION__
     98  1.1  christos #  ifndef STDC
     99  1.1  christos #    define STDC
    100  1.1  christos #  endif
    101  1.1  christos #  if __STDC_VERSION__ >= 199901L
    102  1.1  christos #    ifndef STDC99
    103  1.1  christos #      define STDC99
    104  1.1  christos #    endif
    105  1.1  christos #  endif
    106  1.1  christos #endif
    107  1.1  christos #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
    108  1.1  christos #  define STDC
    109  1.1  christos #endif
    110  1.1  christos #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
    111  1.1  christos #  define STDC
    112  1.1  christos #endif
    113  1.1  christos #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
    114  1.1  christos #  define STDC
    115  1.1  christos #endif
    116  1.1  christos #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
    117  1.1  christos #  define STDC
    118  1.1  christos #endif
    119  1.1  christos 
    120  1.1  christos #if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
    121  1.1  christos #  define STDC
    122  1.1  christos #endif
    123  1.1  christos 
    124  1.1  christos #ifndef STDC
    125  1.1  christos #  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
    126  1.1  christos #    define const       /* note: need a more gentle solution here */
    127  1.1  christos #  endif
    128  1.1  christos #endif
    129  1.1  christos 
    130  1.1  christos /* Some Mac compilers merge all .h files incorrectly: */
    131  1.1  christos #if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
    132  1.1  christos #  define NO_DUMMY_DECL
    133  1.1  christos #endif
    134  1.1  christos 
    135  1.1  christos /* Maximum value for memLevel in deflateInit2 */
    136  1.1  christos #ifndef MAX_MEM_LEVEL
    137  1.1  christos #  ifdef MAXSEG_64K
    138  1.1  christos #    define MAX_MEM_LEVEL 8
    139  1.1  christos #  else
    140  1.1  christos #    define MAX_MEM_LEVEL 9
    141  1.1  christos #  endif
    142  1.1  christos #endif
    143  1.1  christos 
    144  1.1  christos /* Maximum value for windowBits in deflateInit2 and inflateInit2.
    145  1.1  christos  * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
    146  1.1  christos  * created by gzip. (Files created by minigzip can still be extracted by
    147  1.1  christos  * gzip.)
    148  1.1  christos  */
    149  1.1  christos #ifndef MAX_WBITS
    150  1.1  christos #  define MAX_WBITS   15 /* 32K LZ77 window */
    151  1.1  christos #endif
    152  1.1  christos 
    153  1.1  christos /* The memory requirements for deflate are (in bytes):
    154  1.1  christos             (1 << (windowBits+2)) +  (1 << (memLevel+9))
    155  1.1  christos  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
    156  1.1  christos  plus a few kilobytes for small objects. For example, if you want to reduce
    157  1.1  christos  the default memory requirements from 256K to 128K, compile with
    158  1.1  christos      make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
    159  1.1  christos  Of course this will generally degrade compression (there's no free lunch).
    160  1.1  christos 
    161  1.1  christos    The memory requirements for inflate are (in bytes) 1 << windowBits
    162  1.1  christos  that is, 32K for windowBits=15 (default value) plus a few kilobytes
    163  1.1  christos  for small objects.
    164  1.1  christos */
    165  1.1  christos 
    166  1.1  christos                         /* Type declarations */
    167  1.1  christos 
    168  1.1  christos #ifndef OF /* function prototypes */
    169  1.1  christos #  ifdef STDC
    170  1.1  christos #    define OF(args)  args
    171  1.1  christos #  else
    172  1.1  christos #    define OF(args)  ()
    173  1.1  christos #  endif
    174  1.1  christos #endif
    175  1.1  christos 
    176  1.1  christos /* The following definitions for FAR are needed only for MSDOS mixed
    177  1.1  christos  * model programming (small or medium model with some far allocations).
    178  1.1  christos  * This was tested only with MSC; for other MSDOS compilers you may have
    179  1.1  christos  * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
    180  1.1  christos  * just define FAR to be empty.
    181  1.1  christos  */
    182  1.1  christos #ifdef SYS16BIT
    183  1.1  christos #  if defined(M_I86SM) || defined(M_I86MM)
    184  1.1  christos      /* MSC small or medium model */
    185  1.1  christos #    define SMALL_MEDIUM
    186  1.1  christos #    ifdef _MSC_VER
    187  1.1  christos #      define FAR _far
    188  1.1  christos #    else
    189  1.1  christos #      define FAR far
    190  1.1  christos #    endif
    191  1.1  christos #  endif
    192  1.1  christos #  if (defined(__SMALL__) || defined(__MEDIUM__))
    193  1.1  christos      /* Turbo C small or medium model */
    194  1.1  christos #    define SMALL_MEDIUM
    195  1.1  christos #    ifdef __BORLANDC__
    196  1.1  christos #      define FAR _far
    197  1.1  christos #    else
    198  1.1  christos #      define FAR far
    199  1.1  christos #    endif
    200  1.1  christos #  endif
    201  1.1  christos #endif
    202  1.1  christos 
    203  1.1  christos #if defined(WINDOWS) || defined(WIN32)
    204  1.1  christos    /* If building or using zlib as a DLL, define ZLIB_DLL.
    205  1.1  christos     * This is not mandatory, but it offers a little performance increase.
    206  1.1  christos     */
    207  1.1  christos #  ifdef ZLIB_DLL
    208  1.1  christos #    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
    209  1.1  christos #      ifdef ZLIB_INTERNAL
    210  1.1  christos #        define ZEXTERN extern __declspec(dllexport)
    211  1.1  christos #      else
    212  1.1  christos #        define ZEXTERN extern __declspec(dllimport)
    213  1.1  christos #      endif
    214  1.1  christos #    endif
    215  1.1  christos #  endif  /* ZLIB_DLL */
    216  1.1  christos    /* If building or using zlib with the WINAPI/WINAPIV calling convention,
    217  1.1  christos     * define ZLIB_WINAPI.
    218  1.1  christos     * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
    219  1.1  christos     */
    220  1.1  christos #  ifdef ZLIB_WINAPI
    221  1.1  christos #    ifdef FAR
    222  1.1  christos #      undef FAR
    223  1.1  christos #    endif
    224  1.1  christos #    include <windows.h>
    225  1.1  christos      /* No need for _export, use ZLIB.DEF instead. */
    226  1.1  christos      /* For complete Windows compatibility, use WINAPI, not __stdcall. */
    227  1.1  christos #    define ZEXPORT WINAPI
    228  1.1  christos #    ifdef WIN32
    229  1.1  christos #      define ZEXPORTVA WINAPIV
    230  1.1  christos #    else
    231  1.1  christos #      define ZEXPORTVA FAR CDECL
    232  1.1  christos #    endif
    233  1.1  christos #  endif
    234  1.1  christos #endif
    235  1.1  christos 
    236  1.1  christos #if defined (__BEOS__)
    237  1.1  christos #  ifdef ZLIB_DLL
    238  1.1  christos #    ifdef ZLIB_INTERNAL
    239  1.1  christos #      define ZEXPORT   __declspec(dllexport)
    240  1.1  christos #      define ZEXPORTVA __declspec(dllexport)
    241  1.1  christos #    else
    242  1.1  christos #      define ZEXPORT   __declspec(dllimport)
    243  1.1  christos #      define ZEXPORTVA __declspec(dllimport)
    244  1.1  christos #    endif
    245  1.1  christos #  endif
    246  1.1  christos #endif
    247  1.1  christos 
    248  1.1  christos #ifndef ZEXTERN
    249  1.1  christos #  define ZEXTERN extern
    250  1.1  christos #endif
    251  1.1  christos #ifndef ZEXPORT
    252  1.1  christos #  define ZEXPORT
    253  1.1  christos #endif
    254  1.1  christos #ifndef ZEXPORTVA
    255  1.1  christos #  define ZEXPORTVA
    256  1.1  christos #endif
    257  1.1  christos 
    258  1.1  christos #ifndef FAR
    259  1.1  christos #  define FAR
    260  1.1  christos #endif
    261  1.1  christos 
    262  1.1  christos #if !defined(__MACTYPES__)
    263  1.1  christos typedef unsigned char  Byte;  /* 8 bits */
    264  1.1  christos #endif
    265  1.1  christos typedef unsigned int   uInt;  /* 16 bits or more */
    266  1.1  christos typedef unsigned long  uLong; /* 32 bits or more */
    267  1.1  christos 
    268  1.1  christos #ifdef SMALL_MEDIUM
    269  1.1  christos    /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
    270  1.1  christos #  define Bytef Byte FAR
    271  1.1  christos #else
    272  1.1  christos    typedef Byte  FAR Bytef;
    273  1.1  christos #endif
    274  1.1  christos typedef char  FAR charf;
    275  1.1  christos typedef int   FAR intf;
    276  1.1  christos typedef uInt  FAR uIntf;
    277  1.1  christos typedef uLong FAR uLongf;
    278  1.1  christos 
    279  1.1  christos #ifdef STDC
    280  1.1  christos    typedef void const *voidpc;
    281  1.1  christos    typedef void FAR   *voidpf;
    282  1.1  christos    typedef void       *voidp;
    283  1.1  christos #else
    284  1.1  christos    typedef Byte const *voidpc;
    285  1.1  christos    typedef Byte FAR   *voidpf;
    286  1.1  christos    typedef Byte       *voidp;
    287  1.1  christos #endif
    288  1.1  christos 
    289  1.1  christos #if 0           /* HAVE_UNISTD_H -- this line is updated by ./configure */
    290  1.1  christos #  include <sys/types.h> /* for off_t */
    291  1.1  christos #  include <unistd.h>    /* for SEEK_* and off_t */
    292  1.1  christos #  ifdef VMS
    293  1.1  christos #    include <unixio.h>   /* for off_t */
    294  1.1  christos #  endif
    295  1.1  christos #  define z_off_t off_t
    296  1.1  christos #endif
    297  1.1  christos #ifndef SEEK_SET
    298  1.1  christos #  define SEEK_SET        0       /* Seek from beginning of file.  */
    299  1.1  christos #  define SEEK_CUR        1       /* Seek from current position.  */
    300  1.1  christos #  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
    301  1.1  christos #endif
    302  1.1  christos #ifndef z_off_t
    303  1.1  christos #  define z_off_t long
    304  1.1  christos #endif
    305  1.1  christos 
    306  1.1  christos #if defined(__OS400__)
    307  1.1  christos #  define NO_vsnprintf
    308  1.1  christos #endif
    309  1.1  christos 
    310  1.1  christos #if defined(__MVS__)
    311  1.1  christos #  define NO_vsnprintf
    312  1.1  christos #  ifdef FAR
    313  1.1  christos #    undef FAR
    314  1.1  christos #  endif
    315  1.1  christos #endif
    316  1.1  christos 
    317  1.1  christos /* MVS linker does not support external names larger than 8 bytes */
    318  1.1  christos #if defined(__MVS__)
    319  1.1  christos #   pragma map(deflateInit_,"DEIN")
    320  1.1  christos #   pragma map(deflateInit2_,"DEIN2")
    321  1.1  christos #   pragma map(deflateEnd,"DEEND")
    322  1.1  christos #   pragma map(deflateBound,"DEBND")
    323  1.1  christos #   pragma map(inflateInit_,"ININ")
    324  1.1  christos #   pragma map(inflateInit2_,"ININ2")
    325  1.1  christos #   pragma map(inflateEnd,"INEND")
    326  1.1  christos #   pragma map(inflateSync,"INSY")
    327  1.1  christos #   pragma map(inflateSetDictionary,"INSEDI")
    328  1.1  christos #   pragma map(compressBound,"CMBND")
    329  1.1  christos #   pragma map(inflate_table,"INTABL")
    330  1.1  christos #   pragma map(inflate_fast,"INFA")
    331  1.1  christos #   pragma map(inflate_copyright,"INCOPY")
    332  1.1  christos #endif
    333  1.1  christos 
    334  1.1  christos #endif /* ZCONF_H */
    335