diff options
Diffstat (limited to 'include/platform.h')
-rw-r--r-- | include/platform.h | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/include/platform.h b/include/platform.h index c987d418c..94368539e 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -7,6 +7,15 @@ | |||
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 | ||
10 | 19 | ||
11 | /* Convenience macros to test the version of gcc. */ | 20 | /* Convenience macros to test the version of gcc. */ |
12 | #undef __GNUC_PREREQ | 21 | #undef __GNUC_PREREQ |
@@ -119,7 +128,7 @@ | |||
119 | 128 | ||
120 | /* Make all declarations hidden (-fvisibility flag only affects definitions) */ | 129 | /* Make all declarations hidden (-fvisibility flag only affects definitions) */ |
121 | /* (don't include system headers after this until corresponding pop!) */ | 130 | /* (don't include system headers after this until corresponding pop!) */ |
122 | #if __GNUC_PREREQ(4,1) && !defined(__CYGWIN__) | 131 | #if __GNUC_PREREQ(4,1) && !defined(__CYGWIN__) && !ENABLE_PLATFORM_MINGW32 |
123 | # define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN _Pragma("GCC visibility push(hidden)") | 132 | # define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN _Pragma("GCC visibility push(hidden)") |
124 | # define POP_SAVED_FUNCTION_VISIBILITY _Pragma("GCC visibility pop") | 133 | # define POP_SAVED_FUNCTION_VISIBILITY _Pragma("GCC visibility pop") |
125 | #else | 134 | #else |
@@ -148,6 +157,14 @@ | |||
148 | # define bswap_64 __bswap64 | 157 | # define bswap_64 __bswap64 |
149 | # define bswap_32 __bswap32 | 158 | # define bswap_32 __bswap32 |
150 | # define bswap_16 __bswap16 | 159 | # define bswap_16 __bswap16 |
160 | # define __BIG_ENDIAN__ (_BYTE_ORDER == _BIG_ENDIAN) | ||
161 | #elif ENABLE_PLATFORM_MINGW32 | ||
162 | # define __BIG_ENDIAN 0 | ||
163 | # define __LITTLE_ENDIAN 1 | ||
164 | # define __BYTE_ORDER __LITTLE_ENDIAN | ||
165 | # define bswap_16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0xFF) << 8)) | ||
166 | # define bswap_32(x) ((bswap_16(((x) & 0xFFFF0000L) >> 16)) | (bswap_16((x) & 0xFFFFL) << 16)) | ||
167 | # define bswap_64(x) ((bswap_32(((x) & 0xFFFFFFFF00000000LL) >> 32)) | (bswap_32((x) & 0xFFFFFFFFLL) << 32)) | ||
151 | #else | 168 | #else |
152 | # include <byteswap.h> | 169 | # include <byteswap.h> |
153 | # include <endian.h> | 170 | # include <endian.h> |
@@ -400,6 +417,25 @@ typedef unsigned smalluint; | |||
400 | # endif | 417 | # endif |
401 | #endif | 418 | #endif |
402 | 419 | ||
420 | #if ENABLE_PLATFORM_MINGW32 | ||
421 | # undef HAVE_DPRINTF | ||
422 | # undef HAVE_GETLINE | ||
423 | # undef HAVE_MEMRCHR | ||
424 | # undef HAVE_MKDTEMP | ||
425 | # undef HAVE_SETBIT | ||
426 | # undef HAVE_STPCPY | ||
427 | # undef HAVE_STRCASESTR | ||
428 | # undef HAVE_STRCHRNUL | ||
429 | # undef HAVE_STRSEP | ||
430 | # undef HAVE_STRSIGNAL | ||
431 | # undef HAVE_STRVERSCMP | ||
432 | #if !defined(__MINGW64_VERSION_MAJOR) | ||
433 | # undef HAVE_VASPRINTF | ||
434 | #endif | ||
435 | # undef HAVE_UNLOCKED_STDIO | ||
436 | # undef HAVE_UNLOCKED_LINE_OPS | ||
437 | #endif | ||
438 | |||
403 | #if defined(__WATCOMC__) | 439 | #if defined(__WATCOMC__) |
404 | # undef HAVE_DPRINTF | 440 | # undef HAVE_DPRINTF |
405 | # undef HAVE_GETLINE | 441 | # undef HAVE_GETLINE |
@@ -511,6 +547,7 @@ extern int dprintf(int fd, const char *format, ...); | |||
511 | #endif | 547 | #endif |
512 | 548 | ||
513 | #ifndef HAVE_MEMRCHR | 549 | #ifndef HAVE_MEMRCHR |
550 | #include <stddef.h> | ||
514 | extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC; | 551 | extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC; |
515 | #endif | 552 | #endif |
516 | 553 | ||
@@ -570,6 +607,7 @@ extern int usleep(unsigned) FAST_FUNC; | |||
570 | #endif | 607 | #endif |
571 | 608 | ||
572 | #ifndef HAVE_VASPRINTF | 609 | #ifndef HAVE_VASPRINTF |
610 | # include <stdarg.h> | ||
573 | extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; | 611 | extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; |
574 | #endif | 612 | #endif |
575 | 613 | ||