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