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