diff options
Diffstat (limited to 'include/platform.h')
-rw-r--r-- | include/platform.h | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/include/platform.h b/include/platform.h index 2b57cd5a2..eb9f8032b 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -7,6 +7,16 @@ | |||
7 | #ifndef BB_PLATFORM_H | 7 | #ifndef BB_PLATFORM_H |
8 | #define BB_PLATFORM_H 1 | 8 | #define BB_PLATFORM_H 1 |
9 | 9 | ||
10 | #if ENABLE_PLATFORM_MINGW32 | ||
11 | # if !defined(__MINGW32__) /* HOSTCC is called */ | ||
12 | # undef ENABLE_PLATFORM_MINGW32 | ||
13 | # endif | ||
14 | #else | ||
15 | # if defined(__MINGW32__) | ||
16 | # error "You must select target platform MS Windows, or it won't build" | ||
17 | # endif | ||
18 | #endif | ||
19 | |||
10 | /* Assume all these functions exist by default. Platforms where it is not | 20 | /* Assume all these functions exist by default. Platforms where it is not |
11 | * true will #undef them below. | 21 | * true will #undef them below. |
12 | */ | 22 | */ |
@@ -145,7 +155,7 @@ | |||
145 | 155 | ||
146 | /* Make all declarations hidden (-fvisibility flag only affects definitions) */ | 156 | /* Make all declarations hidden (-fvisibility flag only affects definitions) */ |
147 | /* (don't include system headers after this until corresponding pop!) */ | 157 | /* (don't include system headers after this until corresponding pop!) */ |
148 | #if __GNUC_PREREQ(4,1) | 158 | #if __GNUC_PREREQ(4,1) && !ENABLE_PLATFORM_MINGW32 |
149 | # define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN _Pragma("GCC visibility push(hidden)") | 159 | # define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN _Pragma("GCC visibility push(hidden)") |
150 | # define POP_SAVED_FUNCTION_VISIBILITY _Pragma("GCC visibility pop") | 160 | # define POP_SAVED_FUNCTION_VISIBILITY _Pragma("GCC visibility pop") |
151 | #else | 161 | #else |
@@ -165,6 +175,14 @@ | |||
165 | # define bswap_64 __bswap64 | 175 | # define bswap_64 __bswap64 |
166 | # define bswap_32 __bswap32 | 176 | # define bswap_32 __bswap32 |
167 | # define bswap_16 __bswap16 | 177 | # define bswap_16 __bswap16 |
178 | # define __BIG_ENDIAN__ (_BYTE_ORDER == _BIG_ENDIAN) | ||
179 | #elif ENABLE_PLATFORM_MINGW32 | ||
180 | # define __BIG_ENDIAN 0 | ||
181 | # define __LITTLE_ENDIAN 1 | ||
182 | # define __BYTE_ORDER __LITTLE_ENDIAN | ||
183 | # define bswap_16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0xFF) << 8)) | ||
184 | # define bswap_32(x) ((bswap_16(((x) & 0xFFFF0000L) >> 16)) | (bswap_16((x) & 0xFFFFL) << 16)) | ||
185 | # define bswap_64(x) ((bswap_32(((x) & 0xFFFFFFFF00000000LL) >> 32)) | (bswap_32((x) & 0xFFFFFFFFLL) << 32)) | ||
168 | #else | 186 | #else |
169 | # include <byteswap.h> | 187 | # include <byteswap.h> |
170 | # include <endian.h> | 188 | # include <endian.h> |
@@ -367,6 +385,20 @@ typedef unsigned smalluint; | |||
367 | # undef HAVE_STRCHRNUL | 385 | # undef HAVE_STRCHRNUL |
368 | #endif | 386 | #endif |
369 | 387 | ||
388 | #if ENABLE_PLATFORM_MINGW32 | ||
389 | # undef HAVE_DPRINTF | ||
390 | # undef HAVE_MEMRCHR | ||
391 | # undef HAVE_MKDTEMP | ||
392 | # undef HAVE_SETBIT | ||
393 | # undef HAVE_STPCPY | ||
394 | # undef HAVE_STRCASESTR | ||
395 | # undef HAVE_STRCHRNUL | ||
396 | # undef HAVE_STRSIGNAL | ||
397 | # undef HAVE_VASPRINTF | ||
398 | # undef HAVE_MNTENT_H | ||
399 | # undef HAVE_SYS_STATFS_H | ||
400 | #endif | ||
401 | |||
370 | #if defined(__WATCOMC__) | 402 | #if defined(__WATCOMC__) |
371 | # undef HAVE_DPRINTF | 403 | # undef HAVE_DPRINTF |
372 | # undef HAVE_MEMRCHR | 404 | # undef HAVE_MEMRCHR |
@@ -394,6 +426,7 @@ extern int dprintf(int fd, const char *format, ...); | |||
394 | #endif | 426 | #endif |
395 | 427 | ||
396 | #ifndef HAVE_MEMRCHR | 428 | #ifndef HAVE_MEMRCHR |
429 | #include <stddef.h> | ||
397 | extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC; | 430 | extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC; |
398 | #endif | 431 | #endif |
399 | 432 | ||
@@ -432,6 +465,7 @@ extern char *strsep(char **stringp, const char *delim) FAST_FUNC; | |||
432 | #endif | 465 | #endif |
433 | 466 | ||
434 | #ifndef HAVE_VASPRINTF | 467 | #ifndef HAVE_VASPRINTF |
468 | # include <stdarg.h> | ||
435 | extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; | 469 | extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; |
436 | #endif | 470 | #endif |
437 | 471 | ||