diff options
author | Vollstrecker <werner@vollstreckernet.de> | 2024-12-07 17:23:40 +0100 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2025-01-31 19:59:10 -0800 |
commit | 3d6dc3c3aa73fc5421a7671b32d1dd251fea1edc (patch) | |
tree | 292462702801e6d4ef1bb6c1f65f2ffa81e769cf | |
parent | 9e058e844334a6f9289bf6e6650ca46d4a3e2ce9 (diff) | |
download | zlib-3d6dc3c3aa73fc5421a7671b32d1dd251fea1edc.tar.gz zlib-3d6dc3c3aa73fc5421a7671b32d1dd251fea1edc.tar.bz2 zlib-3d6dc3c3aa73fc5421a7671b32d1dd251fea1edc.zip |
CMake: Create zconf.h from zconf.h.in.
Instead of zconf.h.cmakein, which is removed.
-rw-r--r-- | CMakeLists.txt | 76 | ||||
-rw-r--r-- | zconf.h.cmakein | 546 |
2 files changed, 61 insertions, 561 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 7e8e89c..4b80bc7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -31,6 +31,30 @@ include(CheckCSourceCompiles) | |||
31 | include(CMakePackageConfigHelpers) | 31 | include(CMakePackageConfigHelpers) |
32 | include(GNUInstallDirs) | 32 | include(GNUInstallDirs) |
33 | 33 | ||
34 | if(NOT ZLIB_CONF_WRITTEN) | ||
35 | set(Z_PREFIX ${ZLIB_PREFIX}) | ||
36 | set(CONF_OUT_FILE ${zlib_BINARY_DIR}/zconf.h.cmakein) | ||
37 | file(READ ${zlib_SOURCE_DIR}/zconf.h.in ZCONF_CONTENT LIMIT 245) | ||
38 | file(WRITE ${CONF_OUT_FILE} ${ZCONF_CONTENT}) | ||
39 | file(APPEND ${CONF_OUT_FILE} "#cmakedefine01 Z_PREFIX\n") | ||
40 | file(APPEND ${CONF_OUT_FILE} "#cmakedefine01 HAVE_STDARG_H\n") | ||
41 | file(APPEND ${CONF_OUT_FILE} "#cmakedefine01 HAVE_UNISTD_H\n") | ||
42 | file(READ ${zlib_SOURCE_DIR}/zconf.h.in ZCONF_CONTENT OFFSET 244) | ||
43 | set(FIRST_ITEM TRUE) | ||
44 | |||
45 | foreach(item IN LISTS ZCONF_CONTENT) | ||
46 | if(FIRST_ITEM) | ||
47 | string(APPEND OUT_CONTENT ${item}) | ||
48 | set(FIRST_ITEM FALSE) | ||
49 | else(FIRST_ITEM) | ||
50 | string(APPEND OUT_CONTENT "\;" ${item}) | ||
51 | endif(FIRST_ITEM) | ||
52 | endforeach(item IN LISTS ${ZCONF_CONTENT}) | ||
53 | |||
54 | file(APPEND ${CONF_OUT_FILE} ${OUT_CONTENT}) | ||
55 | set(ZLIB_CONF_WRITTEN TRUE CACHE BOOL "zconf.h.cmakein was created") | ||
56 | mark_as_advanced(ZLIB_CONF_WRITTEN) | ||
57 | endif(NOT ZLIB_CONF_WRITTEN) | ||
34 | # | 58 | # |
35 | # Check to see if we have large file support | 59 | # Check to see if we have large file support |
36 | # | 60 | # |
@@ -44,15 +68,30 @@ set(CMAKE_REQUIRED_DEFINITIONS) # clear variable | |||
44 | check_function_exists(fseeko HAVE_FSEEKO) | 68 | check_function_exists(fseeko HAVE_FSEEKO) |
45 | 69 | ||
46 | # | 70 | # |
71 | # Check for stdarg.h | ||
72 | # | ||
73 | check_include_file(stdarg.h HAVE_STDARG_H) | ||
74 | |||
75 | # | ||
47 | # Check for unistd.h | 76 | # Check for unistd.h |
48 | # | 77 | # |
49 | check_include_file(unistd.h Z_HAVE_UNISTD_H) | 78 | check_include_file(unistd.h HAVE_UNISTD_H) |
79 | |||
80 | # | ||
81 | # Check visibility attribute is supported | ||
82 | check_c_source_compiles( | ||
83 | " | ||
84 | #include <stdlib.h> | ||
85 | static void f(void) __attribute__ ((visibility(\"hidden\"))); | ||
86 | int main(void) {return 0;} | ||
87 | " | ||
88 | HAVE___ATTR__VIS_HIDDEN) | ||
50 | 89 | ||
51 | set(ZLIB_PC ${zlib_BINARY_DIR}/zlib.pc) | 90 | set(ZLIB_PC ${zlib_BINARY_DIR}/zlib.pc) |
52 | configure_file(${zlib_SOURCE_DIR}/zlib.pc.cmakein | 91 | configure_file(${zlib_SOURCE_DIR}/zlib.pc.cmakein |
53 | ${ZLIB_PC} @ONLY) | 92 | ${ZLIB_PC} @ONLY) |
54 | configure_file(${zlib_SOURCE_DIR}/zconf.h.cmakein | 93 | configure_file(${zlib_BINARY_DIR}/zconf.h.cmakein |
55 | ${zlib_BINARY_DIR}/zconf.h @ONLY) | 94 | ${zlib_BINARY_DIR}/zconf.h) |
56 | include_directories(${zlib_BINARY_DIR} ${zlib_SOURCE_DIR}) | 95 | include_directories(${zlib_BINARY_DIR} ${zlib_SOURCE_DIR}) |
57 | 96 | ||
58 | #============================================================================ | 97 | #============================================================================ |
@@ -113,10 +152,12 @@ if(ZLIB_BUILD_SHARED) | |||
113 | $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) | 152 | $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) |
114 | target_compile_definitions(zlib | 153 | target_compile_definitions(zlib |
115 | PRIVATE | 154 | PRIVATE |
116 | $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1> | ||
117 | $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO> | 155 | $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO> |
156 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN> | ||
118 | $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE> | 157 | $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE> |
119 | $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE>) | 158 | $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE> |
159 | PUBLIC | ||
160 | $<$<BOOL:${HAVE_OFF64_T}>:_LARGEFILE64_SOURCE=1>) | ||
120 | set(INSTALL_VERSION ${zlib_VERSION_MAJOR}) | 161 | set(INSTALL_VERSION ${zlib_VERSION_MAJOR}) |
121 | 162 | ||
122 | if(NOT CYGWIN) | 163 | if(NOT CYGWIN) |
@@ -149,6 +190,7 @@ if(ZLIB_BUILD_STATIC) | |||
149 | target_compile_definitions(zlibstatic | 190 | target_compile_definitions(zlibstatic |
150 | PRIVATE | 191 | PRIVATE |
151 | $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO> | 192 | $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO> |
193 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN> | ||
152 | $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE> | 194 | $<$<BOOL:${MSVC}>:_CRT_SECURE_NO_DEPRECATE> |
153 | $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE> | 195 | $<$<BOOL:${MSVC}>:_CRT_NONSTDC_NO_DEPRECATE> |
154 | PUBLIC | 196 | PUBLIC |
@@ -242,23 +284,28 @@ if(ZLIB_BUILD_TESTING) | |||
242 | add_test(zlib_example zlib_example) | 284 | add_test(zlib_example zlib_example) |
243 | 285 | ||
244 | add_executable(minigzip test/minigzip.c) | 286 | add_executable(minigzip test/minigzip.c) |
287 | target_compile_definitions(zlib | ||
288 | PRIVATE | ||
289 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) | ||
245 | target_link_libraries(minigzip ZLIB::ZLIB) | 290 | target_link_libraries(minigzip ZLIB::ZLIB) |
246 | 291 | ||
247 | if(HAVE_OFF64_T) | 292 | if(HAVE_OFF64_T) |
248 | add_executable(zlib_example64 test/example.c) | 293 | add_executable(zlib_example64 test/example.c) |
249 | target_compile_definitions(zlib_example64 PRIVATE LARGEFILE64_SOURCE=1) | 294 | target_compile_definitions(zlib_example64 |
295 | PRIVATE | ||
296 | LARGEFILE64_SOURCE=1 | ||
297 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) | ||
250 | target_link_libraries(zlib_example64 ZLIB::ZLIB) | 298 | target_link_libraries(zlib_example64 ZLIB::ZLIB) |
251 | add_test(zlib_example64 zlib_example64) | 299 | add_test(zlib_example64 zlib_example64) |
252 | |||
253 | add_executable(minigzip64 test/minigzip.c) | ||
254 | target_compile_definitions(minigzip64 PRIVATE LARGEFILE64_SOURCE=1) | ||
255 | target_link_libraries(minigzip64 ZLIB::ZLIB) | ||
256 | endif(HAVE_OFF64_T) | 300 | endif(HAVE_OFF64_T) |
257 | endif(ZLIB_BUILD_SHARED) | 301 | endif(ZLIB_BUILD_SHARED) |
258 | 302 | ||
259 | if(ZLIB_BUILD_STATIC) | 303 | if(ZLIB_BUILD_STATIC) |
260 | add_executable(zlib_static_example test/example.c) | 304 | add_executable(zlib_static_example test/example.c) |
261 | target_link_libraries(zlib_static_example ZLIB::ZLIBSTATIC) | 305 | target_link_libraries(zlib_static_example ZLIB::ZLIBSTATIC) |
306 | target_compile_definitions(zlib_static_example | ||
307 | PRIVATE | ||
308 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) | ||
262 | add_test(zlib_static_example zlib_static_example) | 309 | add_test(zlib_static_example zlib_static_example) |
263 | 310 | ||
264 | add_executable(static_minigzip test/minigzip.c) | 311 | add_executable(static_minigzip test/minigzip.c) |
@@ -266,13 +313,12 @@ if(ZLIB_BUILD_TESTING) | |||
266 | 313 | ||
267 | if(HAVE_OFF64_T) | 314 | if(HAVE_OFF64_T) |
268 | add_executable(zlib_static_example64 test/example.c) | 315 | add_executable(zlib_static_example64 test/example.c) |
269 | target_compile_definitions(zlib_static_example64 PRIVATE LARGEFILE64_SOURCE=1) | 316 | target_compile_definitions(zlib_static_example64 |
317 | PRIVATE | ||
318 | LARGEFILE64_SOURCE=1 | ||
319 | $<$<BOOL:${HAVE___ATTR__VIS_HIDDEN}>:HAVE_HIDDEN>) | ||
270 | target_link_libraries(zlib_static_example64 ZLIB::ZLIBSTATIC) | 320 | target_link_libraries(zlib_static_example64 ZLIB::ZLIBSTATIC) |
271 | add_test(zlib_static_example64 zlib_static_example64) | 321 | add_test(zlib_static_example64 zlib_static_example64) |
272 | |||
273 | add_executable(static_minigzip64 test/minigzip.c) | ||
274 | target_compile_definitions(static_minigzip64 PRIVATE LARGEFILE64_SOURCE=1) | ||
275 | target_link_libraries(static_minigzip64 ZLIB::ZLIBSTATIC) | ||
276 | endif(HAVE_OFF64_T) | 322 | endif(HAVE_OFF64_T) |
277 | endif(ZLIB_BUILD_STATIC) | 323 | endif(ZLIB_BUILD_STATIC) |
278 | 324 | ||
diff --git a/zconf.h.cmakein b/zconf.h.cmakein deleted file mode 100644 index f43a904..0000000 --- a/zconf.h.cmakein +++ /dev/null | |||
@@ -1,546 +0,0 @@ | |||
1 | /* zconf.h -- configuration of the zlib compression library | ||
2 | * Copyright (C) 1995-2024 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 | #cmakedefine Z_PREFIX | ||
11 | #cmakedefine Z_HAVE_UNISTD_H | ||
12 | |||
13 | /* | ||
14 | * If you *really* need a unique prefix for all types and library functions, | ||
15 | * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. | ||
16 | * Even better than compiling with -DZ_PREFIX would be to use configure to set | ||
17 | * this permanently in zconf.h using "./configure --zprefix". | ||
18 | */ | ||
19 | #ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ | ||
20 | # define Z_PREFIX_SET | ||
21 | |||
22 | /* all linked symbols and init macros */ | ||
23 | # define _dist_code z__dist_code | ||
24 | # define _length_code z__length_code | ||
25 | # define _tr_align z__tr_align | ||
26 | # define _tr_flush_bits z__tr_flush_bits | ||
27 | # define _tr_flush_block z__tr_flush_block | ||
28 | # define _tr_init z__tr_init | ||
29 | # define _tr_stored_block z__tr_stored_block | ||
30 | # define _tr_tally z__tr_tally | ||
31 | # define adler32 z_adler32 | ||
32 | # define adler32_combine z_adler32_combine | ||
33 | # define adler32_combine64 z_adler32_combine64 | ||
34 | # define adler32_z z_adler32_z | ||
35 | # ifndef Z_SOLO | ||
36 | # define compress z_compress | ||
37 | # define compress2 z_compress2 | ||
38 | # define compressBound z_compressBound | ||
39 | # endif | ||
40 | # define crc32 z_crc32 | ||
41 | # define crc32_combine z_crc32_combine | ||
42 | # define crc32_combine64 z_crc32_combine64 | ||
43 | # define crc32_combine_gen z_crc32_combine_gen | ||
44 | # define crc32_combine_gen64 z_crc32_combine_gen64 | ||
45 | # define crc32_combine_op z_crc32_combine_op | ||
46 | # define crc32_z z_crc32_z | ||
47 | # define deflate z_deflate | ||
48 | # define deflateBound z_deflateBound | ||
49 | # define deflateCopy z_deflateCopy | ||
50 | # define deflateEnd z_deflateEnd | ||
51 | # define deflateGetDictionary z_deflateGetDictionary | ||
52 | # define deflateInit z_deflateInit | ||
53 | # define deflateInit2 z_deflateInit2 | ||
54 | # define deflateInit2_ z_deflateInit2_ | ||
55 | # define deflateInit_ z_deflateInit_ | ||
56 | # define deflateParams z_deflateParams | ||
57 | # define deflatePending z_deflatePending | ||
58 | # define deflatePrime z_deflatePrime | ||
59 | # define deflateReset z_deflateReset | ||
60 | # define deflateResetKeep z_deflateResetKeep | ||
61 | # define deflateSetDictionary z_deflateSetDictionary | ||
62 | # define deflateSetHeader z_deflateSetHeader | ||
63 | # define deflateTune z_deflateTune | ||
64 | # define deflateUsed z_deflateUsed | ||
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 | # ifndef Z_SOLO | ||
135 | # define uncompress z_uncompress | ||
136 | # define uncompress2 z_uncompress2 | ||
137 | # endif | ||
138 | # define zError z_zError | ||
139 | # ifndef Z_SOLO | ||
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 | #ifndef z_const | ||
241 | # ifdef ZLIB_CONST | ||
242 | # define z_const const | ||
243 | # else | ||
244 | # define z_const | ||
245 | # endif | ||
246 | #endif | ||
247 | |||
248 | #ifdef Z_SOLO | ||
249 | # ifdef _WIN64 | ||
250 | typedef unsigned long long z_size_t; | ||
251 | # else | ||
252 | typedef unsigned long z_size_t; | ||
253 | # endif | ||
254 | #else | ||
255 | # define z_longlong long long | ||
256 | # if defined(NO_SIZE_T) | ||
257 | typedef unsigned NO_SIZE_T z_size_t; | ||
258 | # elif defined(STDC) | ||
259 | # include <stddef.h> | ||
260 | typedef size_t z_size_t; | ||
261 | # else | ||
262 | typedef unsigned long z_size_t; | ||
263 | # endif | ||
264 | # undef z_longlong | ||
265 | #endif | ||
266 | |||
267 | /* Maximum value for memLevel in deflateInit2 */ | ||
268 | #ifndef MAX_MEM_LEVEL | ||
269 | # ifdef MAXSEG_64K | ||
270 | # define MAX_MEM_LEVEL 8 | ||
271 | # else | ||
272 | # define MAX_MEM_LEVEL 9 | ||
273 | # endif | ||
274 | #endif | ||
275 | |||
276 | /* Maximum value for windowBits in deflateInit2 and inflateInit2. | ||
277 | * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files | ||
278 | * created by gzip. (Files created by minigzip can still be extracted by | ||
279 | * gzip.) | ||
280 | */ | ||
281 | #ifndef MAX_WBITS | ||
282 | # define MAX_WBITS 15 /* 32K LZ77 window */ | ||
283 | #endif | ||
284 | |||
285 | /* The memory requirements for deflate are (in bytes): | ||
286 | (1 << (windowBits+2)) + (1 << (memLevel+9)) | ||
287 | that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) | ||
288 | plus a few kilobytes for small objects. For example, if you want to reduce | ||
289 | the default memory requirements from 256K to 128K, compile with | ||
290 | make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" | ||
291 | Of course this will generally degrade compression (there's no free lunch). | ||
292 | |||
293 | The memory requirements for inflate are (in bytes) 1 << windowBits | ||
294 | that is, 32K for windowBits=15 (default value) plus about 7 kilobytes | ||
295 | for small objects. | ||
296 | */ | ||
297 | |||
298 | /* Type declarations */ | ||
299 | |||
300 | #ifndef OF /* function prototypes */ | ||
301 | # ifdef STDC | ||
302 | # define OF(args) args | ||
303 | # else | ||
304 | # define OF(args) () | ||
305 | # endif | ||
306 | #endif | ||
307 | |||
308 | /* The following definitions for FAR are needed only for MSDOS mixed | ||
309 | * model programming (small or medium model with some far allocations). | ||
310 | * This was tested only with MSC; for other MSDOS compilers you may have | ||
311 | * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, | ||
312 | * just define FAR to be empty. | ||
313 | */ | ||
314 | #ifdef SYS16BIT | ||
315 | # if defined(M_I86SM) || defined(M_I86MM) | ||
316 | /* MSC small or medium model */ | ||
317 | # define SMALL_MEDIUM | ||
318 | # ifdef _MSC_VER | ||
319 | # define FAR _far | ||
320 | # else | ||
321 | # define FAR far | ||
322 | # endif | ||
323 | # endif | ||
324 | # if (defined(__SMALL__) || defined(__MEDIUM__)) | ||
325 | /* Turbo C small or medium model */ | ||
326 | # define SMALL_MEDIUM | ||
327 | # ifdef __BORLANDC__ | ||
328 | # define FAR _far | ||
329 | # else | ||
330 | # define FAR far | ||
331 | # endif | ||
332 | # endif | ||
333 | #endif | ||
334 | |||
335 | #if defined(WINDOWS) || defined(WIN32) | ||
336 | /* If building or using zlib as a DLL, define ZLIB_DLL. | ||
337 | * This is not mandatory, but it offers a little performance increase. | ||
338 | */ | ||
339 | # ifdef ZLIB_DLL | ||
340 | # if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) | ||
341 | # ifdef ZLIB_INTERNAL | ||
342 | # define ZEXTERN extern __declspec(dllexport) | ||
343 | # else | ||
344 | # define ZEXTERN extern __declspec(dllimport) | ||
345 | # endif | ||
346 | # endif | ||
347 | # endif /* ZLIB_DLL */ | ||
348 | /* If building or using zlib with the WINAPI/WINAPIV calling convention, | ||
349 | * define ZLIB_WINAPI. | ||
350 | * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. | ||
351 | */ | ||
352 | # ifdef ZLIB_WINAPI | ||
353 | # ifdef FAR | ||
354 | # undef FAR | ||
355 | # endif | ||
356 | # ifndef WIN32_LEAN_AND_MEAN | ||
357 | # define WIN32_LEAN_AND_MEAN | ||
358 | # endif | ||
359 | # include <windows.h> | ||
360 | /* No need for _export, use ZLIB.DEF instead. */ | ||
361 | /* For complete Windows compatibility, use WINAPI, not __stdcall. */ | ||
362 | # define ZEXPORT WINAPI | ||
363 | # ifdef WIN32 | ||
364 | # define ZEXPORTVA WINAPIV | ||
365 | # else | ||
366 | # define ZEXPORTVA FAR CDECL | ||
367 | # endif | ||
368 | # endif | ||
369 | #endif | ||
370 | |||
371 | #if defined (__BEOS__) | ||
372 | # ifdef ZLIB_DLL | ||
373 | # ifdef ZLIB_INTERNAL | ||
374 | # define ZEXPORT __declspec(dllexport) | ||
375 | # define ZEXPORTVA __declspec(dllexport) | ||
376 | # else | ||
377 | # define ZEXPORT __declspec(dllimport) | ||
378 | # define ZEXPORTVA __declspec(dllimport) | ||
379 | # endif | ||
380 | # endif | ||
381 | #endif | ||
382 | |||
383 | #ifndef ZEXTERN | ||
384 | # define ZEXTERN extern | ||
385 | #endif | ||
386 | #ifndef ZEXPORT | ||
387 | # define ZEXPORT | ||
388 | #endif | ||
389 | #ifndef ZEXPORTVA | ||
390 | # define ZEXPORTVA | ||
391 | #endif | ||
392 | |||
393 | #ifndef FAR | ||
394 | # define FAR | ||
395 | #endif | ||
396 | |||
397 | #if !defined(__MACTYPES__) | ||
398 | typedef unsigned char Byte; /* 8 bits */ | ||
399 | #endif | ||
400 | typedef unsigned int uInt; /* 16 bits or more */ | ||
401 | typedef unsigned long uLong; /* 32 bits or more */ | ||
402 | |||
403 | #ifdef SMALL_MEDIUM | ||
404 | /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ | ||
405 | # define Bytef Byte FAR | ||
406 | #else | ||
407 | typedef Byte FAR Bytef; | ||
408 | #endif | ||
409 | typedef char FAR charf; | ||
410 | typedef int FAR intf; | ||
411 | typedef uInt FAR uIntf; | ||
412 | typedef uLong FAR uLongf; | ||
413 | |||
414 | #ifdef STDC | ||
415 | typedef void const *voidpc; | ||
416 | typedef void FAR *voidpf; | ||
417 | typedef void *voidp; | ||
418 | #else | ||
419 | typedef Byte const *voidpc; | ||
420 | typedef Byte FAR *voidpf; | ||
421 | typedef Byte *voidp; | ||
422 | #endif | ||
423 | |||
424 | #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) | ||
425 | # include <limits.h> | ||
426 | # if (UINT_MAX == 0xffffffffUL) | ||
427 | # define Z_U4 unsigned | ||
428 | # elif (ULONG_MAX == 0xffffffffUL) | ||
429 | # define Z_U4 unsigned long | ||
430 | # elif (USHRT_MAX == 0xffffffffUL) | ||
431 | # define Z_U4 unsigned short | ||
432 | # endif | ||
433 | #endif | ||
434 | |||
435 | #ifdef Z_U4 | ||
436 | typedef Z_U4 z_crc_t; | ||
437 | #else | ||
438 | typedef unsigned long z_crc_t; | ||
439 | #endif | ||
440 | |||
441 | #ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ | ||
442 | # define Z_HAVE_UNISTD_H | ||
443 | #endif | ||
444 | |||
445 | #ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ | ||
446 | # define Z_HAVE_STDARG_H | ||
447 | #endif | ||
448 | |||
449 | #ifdef STDC | ||
450 | # ifndef Z_SOLO | ||
451 | # include <sys/types.h> /* for off_t */ | ||
452 | # endif | ||
453 | #endif | ||
454 | |||
455 | #if defined(STDC) || defined(Z_HAVE_STDARG_H) | ||
456 | # ifndef Z_SOLO | ||
457 | # include <stdarg.h> /* for va_list */ | ||
458 | # endif | ||
459 | #endif | ||
460 | |||
461 | #ifdef _WIN32 | ||
462 | # ifndef Z_SOLO | ||
463 | # include <stddef.h> /* for wchar_t */ | ||
464 | # endif | ||
465 | #endif | ||
466 | |||
467 | /* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and | ||
468 | * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even | ||
469 | * though the former does not conform to the LFS document), but considering | ||
470 | * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as | ||
471 | * equivalently requesting no 64-bit operations | ||
472 | */ | ||
473 | #if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 | ||
474 | # undef _LARGEFILE64_SOURCE | ||
475 | #endif | ||
476 | |||
477 | #ifndef Z_HAVE_UNISTD_H | ||
478 | # if defined(__WATCOMC__) || defined(__GO32__) || \ | ||
479 | (defined(_LARGEFILE64_SOURCE) && !defined(_WIN32)) | ||
480 | # define Z_HAVE_UNISTD_H | ||
481 | # endif | ||
482 | #endif | ||
483 | #ifndef Z_SOLO | ||
484 | # if defined(Z_HAVE_UNISTD_H) | ||
485 | # include <unistd.h> /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ | ||
486 | # ifdef VMS | ||
487 | # include <unixio.h> /* for off_t */ | ||
488 | # endif | ||
489 | # ifndef z_off_t | ||
490 | # define z_off_t off_t | ||
491 | # endif | ||
492 | # endif | ||
493 | #endif | ||
494 | |||
495 | #if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 | ||
496 | # define Z_LFS64 | ||
497 | #endif | ||
498 | |||
499 | #if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) | ||
500 | # define Z_LARGE64 | ||
501 | #endif | ||
502 | |||
503 | #if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) | ||
504 | # define Z_WANT64 | ||
505 | #endif | ||
506 | |||
507 | #if !defined(SEEK_SET) && !defined(Z_SOLO) | ||
508 | # define SEEK_SET 0 /* Seek from beginning of file. */ | ||
509 | # define SEEK_CUR 1 /* Seek from current position. */ | ||
510 | # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ | ||
511 | #endif | ||
512 | |||
513 | #ifndef z_off_t | ||
514 | # define z_off_t long long | ||
515 | #endif | ||
516 | |||
517 | #if !defined(_WIN32) && defined(Z_LARGE64) | ||
518 | # define z_off64_t off64_t | ||
519 | #elif defined(__MINGW32__) | ||
520 | # define z_off64_t long long | ||
521 | #elif defined(_WIN32) && !defined(__GNUC__) | ||
522 | # define z_off64_t __int64 | ||
523 | #elif defined(__GO32__) | ||
524 | # define z_off64_t offset_t | ||
525 | #else | ||
526 | # define z_off64_t z_off_t | ||
527 | #endif | ||
528 | |||
529 | /* MVS linker does not support external names larger than 8 bytes */ | ||
530 | #if defined(__MVS__) | ||
531 | #pragma map(deflateInit_,"DEIN") | ||
532 | #pragma map(deflateInit2_,"DEIN2") | ||
533 | #pragma map(deflateEnd,"DEEND") | ||
534 | #pragma map(deflateBound,"DEBND") | ||
535 | #pragma map(inflateInit_,"ININ") | ||
536 | #pragma map(inflateInit2_,"ININ2") | ||
537 | #pragma map(inflateEnd,"INEND") | ||
538 | #pragma map(inflateSync,"INSY") | ||
539 | #pragma map(inflateSetDictionary,"INSEDI") | ||
540 | #pragma map(compressBound,"CMBND") | ||
541 | #pragma map(inflate_table,"INTABL") | ||
542 | #pragma map(inflate_fast,"INFA") | ||
543 | #pragma map(inflate_copyright,"INCOPY") | ||
544 | #endif | ||
545 | |||
546 | #endif /* ZCONF_H */ | ||