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