| 1 |
/* zconf.h -- configuration of the zlib compression library |
| 2 |
* Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler |
| 3 |
* For conditions of distribution and use, see copyright notice in zlib.h |
| 4 |
*/ |
| 5 |
|
| 6 |
#ifndef ZCONF_H |
| 7 |
#define ZCONF_H |
| 8 |
|
| 9 |
#if !defined(_WIN32) && defined(__WIN32__) |
| 10 |
# define _WIN32 |
| 11 |
#endif |
| 12 |
|
| 13 |
#ifdef __STDC_VERSION__ |
| 14 |
# if __STDC_VERSION__ >= 199901L |
| 15 |
# ifndef STDC99 |
| 16 |
# define STDC99 |
| 17 |
# endif |
| 18 |
# endif |
| 19 |
#endif |
| 20 |
|
| 21 |
/* Clang macro for detecting declspec support |
| 22 |
* https://clang.llvm.org/docs/LanguageExtensions.html#has-declspec-attribute |
| 23 |
*/ |
| 24 |
#ifndef __has_declspec_attribute |
| 25 |
# define __has_declspec_attribute(x) 0 |
| 26 |
#endif |
| 27 |
|
| 28 |
#if defined(ZLIB_CONST) && !defined(z_const) |
| 29 |
# define z_const const |
| 30 |
#else |
| 31 |
# define z_const |
| 32 |
#endif |
| 33 |
|
| 34 |
/* Maximum value for memLevel in deflateInit2 */ |
| 35 |
#ifndef MAX_MEM_LEVEL |
| 36 |
# define MAX_MEM_LEVEL 9 |
| 37 |
#endif |
| 38 |
|
| 39 |
/* Maximum value for windowBits in deflateInit2 and inflateInit2. |
| 40 |
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files |
| 41 |
* created by gzip. (Files created by minigzip can still be extracted by |
| 42 |
* gzip.) |
| 43 |
*/ |
| 44 |
#ifndef MAX_WBITS |
| 45 |
# define MAX_WBITS 15 /* 32K LZ77 window */ |
| 46 |
#endif |
| 47 |
|
| 48 |
/* The memory requirements for deflate are (in bytes): |
| 49 |
(1 << (windowBits+2)) + (1 << (memLevel+9)) |
| 50 |
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) |
| 51 |
plus a few kilobytes for small objects. For example, if you want to reduce |
| 52 |
the default memory requirements from 256K to 128K, compile with |
| 53 |
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" |
| 54 |
Of course this will generally degrade compression (there's no free lunch). |
| 55 |
|
| 56 |
The memory requirements for inflate are (in bytes) 1 << windowBits |
| 57 |
that is, 32K for windowBits=15 (default value) plus about 7 kilobytes |
| 58 |
for small objects. |
| 59 |
*/ |
| 60 |
|
| 61 |
/* Type declarations */ |
| 62 |
|
| 63 |
|
| 64 |
#ifndef OF /* function prototypes */ |
| 65 |
# define OF(args) args |
| 66 |
#endif |
| 67 |
|
| 68 |
#ifdef ZLIB_INTERNAL |
| 69 |
# define Z_INTERNAL ZLIB_INTERNAL |
| 70 |
#endif |
| 71 |
|
| 72 |
/* If building or using zlib as a DLL, define ZLIB_DLL. |
| 73 |
* This is not mandatory, but it offers a little performance increase. |
| 74 |
*/ |
| 75 |
#if defined(ZLIB_DLL) && (defined(_WIN32) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport))) |
| 76 |
# ifdef Z_INTERNAL |
| 77 |
# define Z_EXTERN extern __declspec(dllexport) |
| 78 |
# else |
| 79 |
# define Z_EXTERN extern __declspec(dllimport) |
| 80 |
# endif |
| 81 |
#endif |
| 82 |
|
| 83 |
/* If building or using zlib with the WINAPI/WINAPIV calling convention, |
| 84 |
* define ZLIB_WINAPI. |
| 85 |
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. |
| 86 |
*/ |
| 87 |
#if defined(ZLIB_WINAPI) && defined(_WIN32) |
| 88 |
# ifndef WIN32_LEAN_AND_MEAN |
| 89 |
# define WIN32_LEAN_AND_MEAN |
| 90 |
# endif |
| 91 |
# include <windows.h> |
| 92 |
/* No need for _export, use ZLIB.DEF instead. */ |
| 93 |
/* For complete Windows compatibility, use WINAPI, not __stdcall. */ |
| 94 |
# define Z_EXPORT WINAPI |
| 95 |
# define Z_EXPORTVA WINAPIV |
| 96 |
#endif |
| 97 |
|
| 98 |
#ifndef Z_EXTERN |
| 99 |
# define Z_EXTERN extern |
| 100 |
#endif |
| 101 |
#ifndef Z_EXPORT |
| 102 |
# define Z_EXPORT |
| 103 |
#endif |
| 104 |
#ifndef Z_EXPORTVA |
| 105 |
# define Z_EXPORTVA |
| 106 |
#endif |
| 107 |
|
| 108 |
/* For backwards compatibility */ |
| 109 |
|
| 110 |
#ifndef ZEXTERN |
| 111 |
# define ZEXTERN Z_EXTERN |
| 112 |
#endif |
| 113 |
#ifndef ZEXPORT |
| 114 |
# define ZEXPORT Z_EXPORT |
| 115 |
#endif |
| 116 |
#ifndef ZEXPORTVA |
| 117 |
# define ZEXPORTVA Z_EXPORTVA |
| 118 |
#endif |
| 119 |
|
| 120 |
/* Legacy zlib typedefs for backwards compatibility. Don't assume stdint.h is defined. */ |
| 121 |
typedef unsigned char Byte; |
| 122 |
typedef Byte Bytef; |
| 123 |
|
| 124 |
typedef unsigned int uInt; /* 16 bits or more */ |
| 125 |
typedef unsigned long uLong; /* 32 bits or more */ |
| 126 |
|
| 127 |
typedef char charf; |
| 128 |
typedef int intf; |
| 129 |
typedef uInt uIntf; |
| 130 |
typedef uLong uLongf; |
| 131 |
|
| 132 |
typedef void const *voidpc; |
| 133 |
typedef void *voidpf; |
| 134 |
typedef void *voidp; |
| 135 |
|
| 136 |
typedef unsigned int z_crc_t; |
| 137 |
|
| 138 |
#if 1 /* was set to #if 1 by configure/cmake/etc */ |
| 139 |
# define Z_HAVE_UNISTD_H |
| 140 |
#endif |
| 141 |
|
| 142 |
#ifdef NEED_PTRDIFF_T /* may be set to #if 1 by configure/cmake/etc */ |
| 143 |
typedef PTRDIFF_TYPE ptrdiff_t; |
| 144 |
#endif |
| 145 |
|
| 146 |
#include <sys/types.h> /* for off_t */ |
| 147 |
|
| 148 |
#include <stddef.h> /* for wchar_t and NULL */ |
| 149 |
|
| 150 |
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and |
| 151 |
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even |
| 152 |
* though the former does not conform to the LFS document), but considering |
| 153 |
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as |
| 154 |
* equivalently requesting no 64-bit operations |
| 155 |
*/ |
| 156 |
#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 |
| 157 |
# undef _LARGEFILE64_SOURCE |
| 158 |
#endif |
| 159 |
|
| 160 |
#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) |
| 161 |
# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ |
| 162 |
# ifndef z_off_t |
| 163 |
# define z_off_t off_t |
| 164 |
# endif |
| 165 |
#endif |
| 166 |
|
| 167 |
#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 |
| 168 |
# define Z_LFS64 |
| 169 |
#endif |
| 170 |
|
| 171 |
#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) |
| 172 |
# define Z_LARGE64 |
| 173 |
#endif |
| 174 |
|
| 175 |
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) |
| 176 |
# define Z_WANT64 |
| 177 |
#endif |
| 178 |
|
| 179 |
#if !defined(SEEK_SET) |
| 180 |
# define SEEK_SET 0 /* Seek from beginning of file. */ |
| 181 |
# define SEEK_CUR 1 /* Seek from current position. */ |
| 182 |
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ |
| 183 |
#endif |
| 184 |
|
| 185 |
#ifndef z_off_t |
| 186 |
# define z_off_t long |
| 187 |
#endif |
| 188 |
|
| 189 |
#if !defined(_WIN32) && defined(Z_LARGE64) |
| 190 |
# define z_off64_t off64_t |
| 191 |
#else |
| 192 |
# if defined(__MSYS__) |
| 193 |
# define z_off64_t _off64_t |
| 194 |
# elif defined(_WIN32) && !defined(__GNUC__) |
| 195 |
# define z_off64_t __int64 |
| 196 |
# else |
| 197 |
# define z_off64_t z_off_t |
| 198 |
# endif |
| 199 |
#endif |
| 200 |
|
| 201 |
#endif /* ZCONF_H */ |