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