1 /*
2  * Here we postprocess autoconf generated prefix-config.h entries.
3  * This is generally for things like "off_t" which is left undefined
4  * in plain config.h if the host system does already have it but we do
5  * need the prefix variant - so we add here a #define _zzip_off_t off_t
6  *
7  * This file is supposed to only carry '#define's.
8  * See <zzip/types.h> for definitions that might be seen by the compiler.
9  *
10  * Author:
11  *      Guido Draheim <guidod@gmx.de>
12  *
13  *      Copyright (c) 2001,2002,2003,2004 Guido Draheim
14  *          All rights reserved,
15  *          use under the restrictions of the
16  *          Lesser GNU General Public License
17  *          or alternatively the restrictions
18  *          of the Mozilla Public License 1.1
19  */
20 
21 #ifndef _ZZIP_CONF_H
22 #define _ZZIP_CONF_H 1
23 
24 #if !defined ZZIP_OMIT_CONFIG_H
25 # if defined _MSC_VER || defined __BORLANDC__ || defined __WATCOMC__
26 # include <zzip/_msvc.h>
27 # elif defined ZZIP_1_H
28 # include "zzip-1.h"
29 # elif defined ZZIP_2_H
30 # include "zzip-2.h"
31 # elif defined ZZIP_3_H
32 # include "zzip-3.h"
33 # elif defined ZZIP_4_H
34 # include "zzip-4.h"
35 # elif defined ZZIP_5_H
36 # include "zzip-5.h"
37 # else /* autoconf generated */
38 # include <zzip/_config.h>
39 # endif
40 #endif
41 
42 /* especially win32 platforms do not declare off_t so far - see zzip-msvc.h */
43 #ifndef _zzip_off_t
44 #ifdef   ZZIP_off_t
45 #define _zzip_off_t ZZIP_off_t
46 #else
47 #define _zzip_off_t off_t
48 #endif
49 #endif
50 
51 #ifndef _zzip_off64_t
52 #ifdef   ZZIP_off64_t
53 #define _zzip_off64_t ZZIP_off64_t
54 #else
55 #define _zzip_off64_t off64_t
56 #endif
57 #endif
58 
59 /* currently unused, all current zziplib-users do have ansi-C94 compilers. */
60 #ifndef _zzip_const
61 #ifdef   ZZIP_const
62 #define _zzip_const ZZIP_const
63 #else
64 #define _zzip_const const
65 #endif
66 #endif
67 #ifndef _zzip_inline
68 #ifdef   ZZIP_inline
69 #define _zzip_inline ZZIP_inline
70 #else
71 #define _zzip_inline inline
72 #endif
73 #endif
74 #ifndef _zzip_restrict
75 #ifdef   ZZIP_restrict
76 #define _zzip_restrict ZZIP_restrict
77 #else
78 #define _zzip_restrict restrict
79 #endif
80 #endif
81 #if defined __linux__ && __GNUC__+0 >= 4
82 #define zzip__new__ __attribute__((malloc))
83 #elif defined __linux__ && __GNUC__+0 >= 3 && __GNUC_MINOR_+0 >= 3
84 #define zzip__new__  __attribute__((malloc))
85 #else
86 #define zzip__new__
87 #endif
88 
89 #ifndef _zzip_size_t
90 #ifdef   ZZIP_size_t
91 #define _zzip_size_t ZZIP_size_t
92 #else
93 #define _zzip_size_t size_t
94 #endif
95 #endif
96 #ifndef _zzip_ssize_t
97 #ifdef   ZZIP_ssize_t
98 #define _zzip_ssize_t ZZIP_ssize_t
99 #else
100 #define _zzip_ssize_t ssize_t
101 #endif
102 #endif
103 #ifndef _zzip___int64
104 #ifdef   ZZIP___int64
105 #define _zzip___int64 ZZIP___int64
106 #else
107 #define _zzip___int64 long long
108 #endif
109 #endif
110 
111 /* whether this library shall use a 64bit off_t largefile variant in 64on32: */
112 /* (some exported names must be renamed to avoid bad calls after linking) */
113 #if defined ZZIP_LARGEFILE_SENSITIVE
114 # if _FILE_OFFSET_BITS+0 == 64
115 # define  ZZIP_LARGEFILE_RENAME
116 # elif defined  _LARGE_FILES    /* used on older AIX to get at 64bit off_t */
117 # define  ZZIP_LARGEFILE_RENAME
118 # elif defined  _ZZIP_LARGEFILE /* or simply use this one for zzip64 runs */
119 # define  ZZIP_LARGEFILE_RENAME
120 # endif
121 #endif
122 
123 /* if the environment did not setup these for 64bit off_t largefile... */
124 #ifdef   ZZIP_LARGEFILE_RENAME
125 # ifndef      _FILE_OFFSET_BITS
126 #  ifdef ZZIP__FILE_OFFSET_BITS /* == 64 */
127 #  define     _FILE_OFFSET_BITS ZZIP__FILE_OFFSET_BITS
128 #  endif
129 # endif
130 # ifndef      _LARGE_FILES
131 #  ifdef ZZIP__LARGE_FILES /* == 1 */
132 #  define     _LARGE_FILES ZZIP__LARGE_FILES
133 #  endif
134 # endif
135 # ifndef      _LARGEFILE_SOURCE
136 #  ifdef ZZIP__LARGEFILE_SOURCE /* == 1 */
137 #  define     _LARGEFILE_SOURCE ZZIP__LARGEFILE_SOURCE
138 #  endif
139 # endif
140 #endif
141 
142 #include <errno.h>
143 
144 /* mingw32msvc errno : would be in winsock.h */
145 #ifndef EREMOTE
146 #define EREMOTE ESPIPE
147 #endif
148 
149 #ifndef ELOOP
150 #if   defined EILSEQ
151 #define ELOOP EILSEQ
152 #else
153 #define ELOOP ENOEXEC
154 #endif
155 #endif
156 
157 #if defined __WATCOMC__
158 #undef  _zzip_inline
159 #define _zzip_inline static
160 #endif
161 
162 #if defined _MSC_VER || defined __WATCOMC__
163 #include <io.h>
164 #endif
165 
166 #ifdef _MSC_VER
167 # if !__STDC__
168 #  ifndef _zzip_lseek
169 #  define _zzip_lseek _lseek
170 #  endif
171 #  ifndef _zzip_read
172 #  define _zzip_read _read
173 #  endif
174 #  ifndef _zzip_write
175 #  define _zzip_write _write
176 #  endif
177 #      if 0
178 #  ifndef _zzip_stat
179 #  define _zzip_stat _stat
180 #  endif
181 #      endif
182 # endif /* !__STDC__ */
183 #endif
184   /*MSVC*/
185 
186 #if defined _MSC_VER || defined __WATCOMC__
187 #  ifndef strcasecmp
188 #  define strcasecmp _stricmp
189 #  endif
190 #endif
191 
192 #  ifndef _zzip_lseek
193 #  define _zzip_lseek lseek
194 #  endif
195 
196 #  ifndef _zzip_read
197 #  define _zzip_read  read
198 #  endif
199 
200 #  ifndef _zzip_write
201 #  define _zzip_write  write
202 #  endif
203 
204 #      if 0
205 #  ifndef _zzip_stat
206 #  define _zzip_stat  stat
207 #  endif
208 #     endif
209 
210 
211 #if defined ZZIP_EXPORTS || defined ZZIPLIB_EXPORTS
212 # undef ZZIP_DLL
213 #define ZZIP_DLL 1
214 #endif
215 
216 /* based on zconf.h : */
217 /* compile with -DZZIP_DLL for Windows DLL support */
218 #if defined ZZIP_DLL
219 #  if defined _WINDOWS || defined WINDOWS || defined _WIN32
220 /*#  include <windows.h>*/
221 #  endif
222 #  if !defined _zzip_export && defined _MSC_VER && (defined WIN32 || defined _WIN32)
223 #    define _zzip_export __declspec(dllexport) /*WINAPI*/
224 #  endif
225 #  if !defined _zzip_export && defined __BORLANDC__
226 #    if __BORLANDC__ >= 0x0500 && defined WIN32
227 #    include <windows.h>
228 #    define _zzip_export __declspec(dllexport) /*WINAPI*/
229 #    else
230 #      if defined _Windows && defined __DLL__
231 #      define _zzip_export _export
232 #      endif
233 #    endif
234 #  endif
235 #  if !defined _zzip_export && defined __GNUC__
236 #    if defined __declspec
237 #      define _zzip_export extern __declspec(dllexport)
238 #    else
239 #      define _zzip_export extern
240 #    endif
241 #  endif
242 #  if !defined _zzip_export && defined __BEOS__
243 #    define _zzip_export extern __declspec(export)
244 #  endif
245 #  if !defined _zzip_export && defined __WATCOMC__
246 #    define _zzip_export extern __declspec(dllexport)
247 #    define ZEXPORT __syscall
248 #    define ZEXTERN extern
249 #  endif
250 #endif
251 
252 #if !defined _zzip_export
253 #  if defined __GNUC__ /* || !defined HAVE_LIBZZIP */
254 #  define _zzip_export extern
255 #  elif defined __declspec || (defined _MSC_VER && defined ZZIP_DLL)
256 #  define _zzip_export extern __declspec(dllimport)
257 #  else
258 #  define _zzip_export extern
259 #  endif
260 #endif
261 
262 #endif
263 
264 
265