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