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# include <windows.h> 89 /* No need for _export, use ZLIB.DEF instead. */ 90 /* For complete Windows compatibility, use WINAPI, not __stdcall. */ 91# define Z_EXPORT WINAPI 92# define Z_EXPORTVA WINAPIV 93#endif 94 95#ifndef Z_EXTERN 96# define Z_EXTERN extern 97#endif 98#ifndef Z_EXPORT 99# define Z_EXPORT 100#endif 101#ifndef Z_EXPORTVA 102# define Z_EXPORTVA 103#endif 104 105/* For backwards compatibility */ 106 107#ifndef ZEXTERN 108# define ZEXTERN Z_EXTERN 109#endif 110#ifndef ZEXPORT 111# define ZEXPORT Z_EXPORT 112#endif 113#ifndef ZEXPORTVA 114# define ZEXPORTVA Z_EXPORTVA 115#endif 116 117/* Fallback for something that includes us. */ 118typedef unsigned char Byte; 119typedef Byte Bytef; 120 121typedef unsigned int uInt; /* 16 bits or more */ 122typedef unsigned long uLong; /* 32 bits or more */ 123 124typedef char charf; 125typedef int intf; 126typedef uInt uIntf; 127typedef uLong uLongf; 128 129typedef void const *voidpc; 130typedef void *voidpf; 131typedef void *voidp; 132 133#ifdef HAVE_UNISTD_H /* may be set to #if 1 by configure/cmake/etc */ 134# define Z_HAVE_UNISTD_H 135#endif 136 137#ifdef NEED_PTRDIFF_T /* may be set to #if 1 by configure/cmake/etc */ 138typedef PTRDIFF_TYPE ptrdiff_t; 139#endif 140 141#include <sys/types.h> /* for off_t */ 142#include <stdarg.h> /* for va_list */ 143 144#include <stddef.h> /* for wchar_t and NULL */ 145 146/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and 147 * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even 148 * though the former does not conform to the LFS document), but considering 149 * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as 150 * equivalently requesting no 64-bit operations 151 */ 152#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 153# undef _LARGEFILE64_SOURCE 154#endif 155 156#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) 157# include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ 158# ifndef z_off_t 159# define z_off_t off_t 160# endif 161#endif 162 163#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 164# define Z_LFS64 165#endif 166 167#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) 168# define Z_LARGE64 169#endif 170 171#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) 172# define Z_WANT64 173#endif 174 175#if !defined(SEEK_SET) 176# define SEEK_SET 0 /* Seek from beginning of file. */ 177# define SEEK_CUR 1 /* Seek from current position. */ 178# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ 179#endif 180 181#ifndef z_off_t 182# define z_off_t long 183#endif 184 185#if !defined(_WIN32) && defined(Z_LARGE64) 186# define z_off64_t off64_t 187#else 188# if defined(__MSYS__) 189# define z_off64_t _off64_t 190# elif defined(_WIN32) && !defined(__GNUC__) 191# define z_off64_t __int64 192# else 193# define z_off64_t z_off_t 194# endif 195#endif 196 197#endif /* ZCONF_H */ 198