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