xref: /freebsd/sys/contrib/zlib/zconf.h (revision 0bf48626aaa33768078f5872b922b1487b3a9296)
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 /* @(#) $FreeBSD$ */
7 
8 #ifndef ZCONF_H
9 #define ZCONF_H
10 
11 #ifdef __FreeBSD__
12 #ifdef _KERNEL
13 #define Z_SOLO
14 #endif
15 #endif
16 
17 /*
18  * If you *really* need a unique prefix for all types and library functions,
19  * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
20  * Even better than compiling with -DZ_PREFIX would be to use configure to set
21  * this permanently in zconf.h using "./configure --zprefix".
22  */
23 #ifdef Z_PREFIX     /* may be set to #if 1 by ./configure */
24 #  define Z_PREFIX_SET
25 
26 /* all linked symbols and init macros */
27 #  define _dist_code            z__dist_code
28 #  define _length_code          z__length_code
29 #  define _tr_align             z__tr_align
30 #  define _tr_flush_bits        z__tr_flush_bits
31 #  define _tr_flush_block       z__tr_flush_block
32 #  define _tr_init              z__tr_init
33 #  define _tr_stored_block      z__tr_stored_block
34 #  define _tr_tally             z__tr_tally
35 #  define adler32               z_adler32
36 #  define adler32_combine       z_adler32_combine
37 #  define adler32_combine64     z_adler32_combine64
38 #  define adler32_z             z_adler32_z
39 #  if !defined(Z_SOLO) && !defined(_KERNEL)
40 #    define compress              z_compress
41 #    define compress2             z_compress2
42 #    define compressBound         z_compressBound
43 #  endif
44 #  define crc32                 z_crc32
45 #  define crc32_combine         z_crc32_combine
46 #  define crc32_combine64       z_crc32_combine64
47 #  define crc32_z               z_crc32_z
48 #  define deflate               z_deflate
49 #  define deflateBound          z_deflateBound
50 #  define deflateCopy           z_deflateCopy
51 #  define deflateEnd            z_deflateEnd
52 #  define deflateGetDictionary  z_deflateGetDictionary
53 #  define deflateInit           z_deflateInit
54 #  define deflateInit2          z_deflateInit2
55 #  define deflateInit2_         z_deflateInit2_
56 #  define deflateInit_          z_deflateInit_
57 #  define deflateParams         z_deflateParams
58 #  define deflatePending        z_deflatePending
59 #  define deflatePrime          z_deflatePrime
60 #  define deflateReset          z_deflateReset
61 #  define deflateResetKeep      z_deflateResetKeep
62 #  define deflateSetDictionary  z_deflateSetDictionary
63 #  define deflateSetHeader      z_deflateSetHeader
64 #  define deflateTune           z_deflateTune
65 #  define deflate_copyright     z_deflate_copyright
66 #  define get_crc_table         z_get_crc_table
67 #  ifndef Z_SOLO
68 #    define gz_error              z_gz_error
69 #    define gz_intmax             z_gz_intmax
70 #    define gz_strwinerror        z_gz_strwinerror
71 #    define gzbuffer              z_gzbuffer
72 #    define gzclearerr            z_gzclearerr
73 #    define gzclose               z_gzclose
74 #    define gzclose_r             z_gzclose_r
75 #    define gzclose_w             z_gzclose_w
76 #    define gzdirect              z_gzdirect
77 #    define gzdopen               z_gzdopen
78 #    define gzeof                 z_gzeof
79 #    define gzerror               z_gzerror
80 #    define gzflush               z_gzflush
81 #    define gzfread               z_gzfread
82 #    define gzfwrite              z_gzfwrite
83 #    define gzgetc                z_gzgetc
84 #    define gzgetc_               z_gzgetc_
85 #    define gzgets                z_gzgets
86 #    define gzoffset              z_gzoffset
87 #    define gzoffset64            z_gzoffset64
88 #    define gzopen                z_gzopen
89 #    define gzopen64              z_gzopen64
90 #    ifdef _WIN32
91 #      define gzopen_w              z_gzopen_w
92 #    endif
93 #    define gzprintf              z_gzprintf
94 #    define gzputc                z_gzputc
95 #    define gzputs                z_gzputs
96 #    define gzread                z_gzread
97 #    define gzrewind              z_gzrewind
98 #    define gzseek                z_gzseek
99 #    define gzseek64              z_gzseek64
100 #    define gzsetparams           z_gzsetparams
101 #    define gztell                z_gztell
102 #    define gztell64              z_gztell64
103 #    define gzungetc              z_gzungetc
104 #    define gzvprintf             z_gzvprintf
105 #    define gzwrite               z_gzwrite
106 #  endif
107 #  define inflate               z_inflate
108 #  define inflateBack           z_inflateBack
109 #  define inflateBackEnd        z_inflateBackEnd
110 #  define inflateBackInit       z_inflateBackInit
111 #  define inflateBackInit_      z_inflateBackInit_
112 #  define inflateCodesUsed      z_inflateCodesUsed
113 #  define inflateCopy           z_inflateCopy
114 #  define inflateEnd            z_inflateEnd
115 #  define inflateGetDictionary  z_inflateGetDictionary
116 #  define inflateGetHeader      z_inflateGetHeader
117 #  define inflateInit           z_inflateInit
118 #  define inflateInit2          z_inflateInit2
119 #  define inflateInit2_         z_inflateInit2_
120 #  define inflateInit_          z_inflateInit_
121 #  define inflateMark           z_inflateMark
122 #  define inflatePrime          z_inflatePrime
123 #  define inflateReset          z_inflateReset
124 #  define inflateReset2         z_inflateReset2
125 #  define inflateResetKeep      z_inflateResetKeep
126 #  define inflateSetDictionary  z_inflateSetDictionary
127 #  define inflateSync           z_inflateSync
128 #  define inflateSyncPoint      z_inflateSyncPoint
129 #  define inflateUndermine      z_inflateUndermine
130 #  define inflateValidate       z_inflateValidate
131 #  define inflate_copyright     z_inflate_copyright
132 #  define inflate_fast          z_inflate_fast
133 #  define inflate_table         z_inflate_table
134 #  if !defined(Z_SOLO) && !defined(_KERNEL)
135 #    define uncompress            z_uncompress
136 #    define uncompress2           z_uncompress2
137 #  endif
138 #  define zError                z_zError
139 #  if !defined(Z_SOLO) && !defined(_KERNEL)
140 #    define zcalloc               z_zcalloc
141 #    define zcfree                z_zcfree
142 #  endif
143 #  define zlibCompileFlags      z_zlibCompileFlags
144 #  define zlibVersion           z_zlibVersion
145 
146 /* all zlib typedefs in zlib.h and zconf.h */
147 #  define Byte                  z_Byte
148 #  define Bytef                 z_Bytef
149 #  define alloc_func            z_alloc_func
150 #  define charf                 z_charf
151 #  define free_func             z_free_func
152 #  ifndef Z_SOLO
153 #    define gzFile                z_gzFile
154 #  endif
155 #  define gz_header             z_gz_header
156 #  define gz_headerp            z_gz_headerp
157 #  define in_func               z_in_func
158 #  define intf                  z_intf
159 #  define out_func              z_out_func
160 #  define uInt                  z_uInt
161 #  define uIntf                 z_uIntf
162 #  define uLong                 z_uLong
163 #  define uLongf                z_uLongf
164 #  define voidp                 z_voidp
165 #  define voidpc                z_voidpc
166 #  define voidpf                z_voidpf
167 
168 /* all zlib structs in zlib.h and zconf.h */
169 #  define gz_header_s           z_gz_header_s
170 #  define internal_state        z_internal_state
171 
172 #endif
173 
174 #if defined(__MSDOS__) && !defined(MSDOS)
175 #  define MSDOS
176 #endif
177 #if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
178 #  define OS2
179 #endif
180 #if defined(_WINDOWS) && !defined(WINDOWS)
181 #  define WINDOWS
182 #endif
183 #if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
184 #  ifndef WIN32
185 #    define WIN32
186 #  endif
187 #endif
188 #if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
189 #  if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
190 #    ifndef SYS16BIT
191 #      define SYS16BIT
192 #    endif
193 #  endif
194 #endif
195 
196 /*
197  * Compile with -DMAXSEG_64K if the alloc function cannot allocate more
198  * than 64k bytes at a time (needed on systems with 16-bit int).
199  */
200 #ifdef SYS16BIT
201 #  define MAXSEG_64K
202 #endif
203 #ifdef MSDOS
204 #  define UNALIGNED_OK
205 #endif
206 
207 #ifdef __STDC_VERSION__
208 #  ifndef STDC
209 #    define STDC
210 #  endif
211 #  if __STDC_VERSION__ >= 199901L
212 #    ifndef STDC99
213 #      define STDC99
214 #    endif
215 #  endif
216 #endif
217 #if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
218 #  define STDC
219 #endif
220 #if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
221 #  define STDC
222 #endif
223 #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
224 #  define STDC
225 #endif
226 #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
227 #  define STDC
228 #endif
229 
230 #if defined(__OS400__) && !defined(STDC)    /* iSeries (formerly AS/400). */
231 #  define STDC
232 #endif
233 
234 #ifndef STDC
235 #  ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
236 #    define const       /* note: need a more gentle solution here */
237 #  endif
238 #endif
239 
240 #if defined(ZLIB_CONST) && !defined(z_const)
241 #  define z_const const
242 #else
243 #  define z_const
244 #endif
245 
246 #ifdef Z_SOLO
247    typedef unsigned long z_size_t;
248 #else
249 #  define z_longlong long long
250 #  if defined(NO_SIZE_T)
251      typedef unsigned NO_SIZE_T z_size_t;
252 #  elif defined(STDC)
253 #    include <stddef.h>
254      typedef size_t z_size_t;
255 #  else
256      typedef unsigned long z_size_t;
257 #  endif
258 #  undef z_longlong
259 #endif
260 
261 /* Maximum value for memLevel in deflateInit2 */
262 #ifndef MAX_MEM_LEVEL
263 #  ifdef MAXSEG_64K
264 #    define MAX_MEM_LEVEL 8
265 #  else
266 #    define MAX_MEM_LEVEL 9
267 #  endif
268 #endif
269 
270 /* Maximum value for windowBits in deflateInit2 and inflateInit2.
271  * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
272  * created by gzip. (Files created by minigzip can still be extracted by
273  * gzip.)
274  */
275 #ifndef MAX_WBITS
276 #  define MAX_WBITS   15 /* 32K LZ77 window */
277 #endif
278 
279 /* The memory requirements for deflate are (in bytes):
280             (1 << (windowBits+2)) +  (1 << (memLevel+9))
281  that is: 128K for windowBits=15  +  128K for memLevel = 8  (default values)
282  plus a few kilobytes for small objects. For example, if you want to reduce
283  the default memory requirements from 256K to 128K, compile with
284      make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
285  Of course this will generally degrade compression (there's no free lunch).
286 
287    The memory requirements for inflate are (in bytes) 1 << windowBits
288  that is, 32K for windowBits=15 (default value) plus about 7 kilobytes
289  for small objects.
290 */
291 
292                         /* Type declarations */
293 
294 #ifndef OF /* function prototypes */
295 #  ifdef STDC
296 #    define OF(args)  args
297 #  else
298 #    define OF(args)  ()
299 #  endif
300 #endif
301 
302 #ifndef Z_ARG /* function prototypes for stdarg */
303 #  if defined(STDC) || defined(Z_HAVE_STDARG_H)
304 #    define Z_ARG(args)  args
305 #  else
306 #    define Z_ARG(args)  ()
307 #  endif
308 #endif
309 
310 /* The following definitions for FAR are needed only for MSDOS mixed
311  * model programming (small or medium model with some far allocations).
312  * This was tested only with MSC; for other MSDOS compilers you may have
313  * to define NO_MEMCPY in zutil.h.  If you don't need the mixed model,
314  * just define FAR to be empty.
315  */
316 #ifdef SYS16BIT
317 #  if defined(M_I86SM) || defined(M_I86MM)
318      /* MSC small or medium model */
319 #    define SMALL_MEDIUM
320 #    ifdef _MSC_VER
321 #      define FAR _far
322 #    else
323 #      define FAR far
324 #    endif
325 #  endif
326 #  if (defined(__SMALL__) || defined(__MEDIUM__))
327      /* Turbo C small or medium model */
328 #    define SMALL_MEDIUM
329 #    ifdef __BORLANDC__
330 #      define FAR _far
331 #    else
332 #      define FAR far
333 #    endif
334 #  endif
335 #endif
336 
337 #if defined(WINDOWS) || defined(WIN32)
338    /* If building or using zlib as a DLL, define ZLIB_DLL.
339     * This is not mandatory, but it offers a little performance increase.
340     */
341 #  ifdef ZLIB_DLL
342 #    if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
343 #      ifdef ZLIB_INTERNAL
344 #        define ZEXTERN extern __declspec(dllexport)
345 #      else
346 #        define ZEXTERN extern __declspec(dllimport)
347 #      endif
348 #    endif
349 #  endif  /* ZLIB_DLL */
350    /* If building or using zlib with the WINAPI/WINAPIV calling convention,
351     * define ZLIB_WINAPI.
352     * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
353     */
354 #  ifdef ZLIB_WINAPI
355 #    ifdef FAR
356 #      undef FAR
357 #    endif
358 #    include <windows.h>
359      /* No need for _export, use ZLIB.DEF instead. */
360      /* For complete Windows compatibility, use WINAPI, not __stdcall. */
361 #    define ZEXPORT WINAPI
362 #    ifdef WIN32
363 #      define ZEXPORTVA WINAPIV
364 #    else
365 #      define ZEXPORTVA FAR CDECL
366 #    endif
367 #  endif
368 #endif
369 
370 #if defined (__BEOS__)
371 #  ifdef ZLIB_DLL
372 #    ifdef ZLIB_INTERNAL
373 #      define ZEXPORT   __declspec(dllexport)
374 #      define ZEXPORTVA __declspec(dllexport)
375 #    else
376 #      define ZEXPORT   __declspec(dllimport)
377 #      define ZEXPORTVA __declspec(dllimport)
378 #    endif
379 #  endif
380 #endif
381 
382 #ifndef ZEXTERN
383 #  define ZEXTERN extern
384 #endif
385 #ifndef ZEXPORT
386 #  define ZEXPORT
387 #endif
388 #ifndef ZEXPORTVA
389 #  define ZEXPORTVA
390 #endif
391 
392 #ifndef FAR
393 #  define FAR
394 #endif
395 
396 #if !defined(__MACTYPES__)
397 typedef unsigned char  Byte;  /* 8 bits */
398 #endif
399 typedef unsigned int   uInt;  /* 16 bits or more */
400 typedef unsigned long  uLong; /* 32 bits or more */
401 
402 #ifdef SMALL_MEDIUM
403    /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
404 #  define Bytef Byte FAR
405 #else
406    typedef Byte  FAR Bytef;
407 #endif
408 typedef char  FAR charf;
409 typedef int   FAR intf;
410 typedef uInt  FAR uIntf;
411 typedef uLong FAR uLongf;
412 
413 #ifdef STDC
414    typedef void const *voidpc;
415    typedef void FAR   *voidpf;
416    typedef void       *voidp;
417 #else
418    typedef Byte const *voidpc;
419    typedef Byte FAR   *voidpf;
420    typedef Byte       *voidp;
421 #endif
422 
423 #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)
424 #  include <limits.h>
425 #  if (UINT_MAX == 0xffffffffUL)
426 #    define Z_U4 unsigned
427 #  elif (ULONG_MAX == 0xffffffffUL)
428 #    define Z_U4 unsigned long
429 #  elif (USHRT_MAX == 0xffffffffUL)
430 #    define Z_U4 unsigned short
431 #  endif
432 #endif
433 
434 #ifdef Z_U4
435    typedef Z_U4 z_crc_t;
436 #else
437    typedef unsigned long z_crc_t;
438 #endif
439 
440 #if 0    /* was set to #if 0 by ./configure */
441 #  define Z_HAVE_UNISTD_H
442 #endif
443 
444 #ifdef HAVE_STDARG_H    /* may be set to #if 1 by ./configure */
445 #  define Z_HAVE_STDARG_H
446 #endif
447 
448 #ifdef STDC
449 #  ifndef Z_SOLO
450 #    include <sys/types.h>      /* for off_t */
451 #  endif
452 #endif
453 
454 #if defined(STDC) || defined(Z_HAVE_STDARG_H)
455 #  ifndef Z_SOLO
456 #    include <stdarg.h>         /* for va_list */
457 #  endif
458 #endif
459 
460 #ifdef _WIN32
461 #  ifndef Z_SOLO
462 #    include <stddef.h>         /* for wchar_t */
463 #  endif
464 #endif
465 
466 /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
467  * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
468  * though the former does not conform to the LFS document), but considering
469  * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
470  * equivalently requesting no 64-bit operations
471  */
472 #if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1
473 #  undef _LARGEFILE64_SOURCE
474 #endif
475 
476 #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H)
477 #  define Z_HAVE_UNISTD_H
478 #endif
479 #ifndef Z_SOLO
480 #  if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
481 #    include <unistd.h>         /* for SEEK_*, off_t, and _LFS64_LARGEFILE */
482 #    ifdef VMS
483 #      include <unixio.h>       /* for off_t */
484 #    endif
485 #    ifndef z_off_t
486 #      define z_off_t off_t
487 #    endif
488 #  endif
489 #endif
490 
491 #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0
492 #  define Z_LFS64
493 #endif
494 
495 #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64)
496 #  define Z_LARGE64
497 #endif
498 
499 #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64)
500 #  define Z_WANT64
501 #endif
502 
503 #if !defined(SEEK_SET) && !defined(Z_SOLO)
504 #  define SEEK_SET        0       /* Seek from beginning of file.  */
505 #  define SEEK_CUR        1       /* Seek from current position.  */
506 #  define SEEK_END        2       /* Set file pointer to EOF plus "offset" */
507 #endif
508 
509 /*
510  * This is hard-configured for FreeBSD.
511  */
512 #ifdef Z_SOLO
513 #  include <sys/types.h>      /* for off_t */
514 #endif
515 #define	z_off_t	off_t
516 #ifndef _FILE_OFFSET_BITS
517 #define _FILE_OFFSET_BITS 64
518 #endif
519 
520 #ifndef z_off_t
521 #  define z_off_t long
522 #endif
523 
524 #if !defined(_WIN32) && defined(Z_LARGE64)
525 #  define z_off64_t off64_t
526 #else
527 #  if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO)
528 #    define z_off64_t __int64
529 #  else
530 #    define z_off64_t z_off_t
531 #  endif
532 #endif
533 
534 /* MVS linker does not support external names larger than 8 bytes */
535 #if defined(__MVS__)
536   #pragma map(deflateInit_,"DEIN")
537   #pragma map(deflateInit2_,"DEIN2")
538   #pragma map(deflateEnd,"DEEND")
539   #pragma map(deflateBound,"DEBND")
540   #pragma map(inflateInit_,"ININ")
541   #pragma map(inflateInit2_,"ININ2")
542   #pragma map(inflateEnd,"INEND")
543   #pragma map(inflateSync,"INSY")
544   #pragma map(inflateSetDictionary,"INSEDI")
545   #pragma map(compressBound,"CMBND")
546   #pragma map(inflate_table,"INTABL")
547   #pragma map(inflate_fast,"INFA")
548   #pragma map(inflate_copyright,"INCOPY")
549 #endif
550 
551 #endif /* ZCONF_H */
552