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