diff options
Diffstat (limited to 'include/platform.h')
-rw-r--r-- | include/platform.h | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/include/platform.h b/include/platform.h index b81c59d4e..749169b0c 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 |
@@ -131,7 +140,7 @@ | |||
131 | 140 | ||
132 | /* Make all declarations hidden (-fvisibility flag only affects definitions) */ | 141 | /* Make all declarations hidden (-fvisibility flag only affects definitions) */ |
133 | /* (don't include system headers after this until corresponding pop!) */ | 142 | /* (don't include system headers after this until corresponding pop!) */ |
134 | #if __GNUC_PREREQ(4,1) && !defined(__CYGWIN__) | 143 | #if __GNUC_PREREQ(4,1) && !defined(__CYGWIN__) && !ENABLE_PLATFORM_MINGW32 |
135 | # define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN _Pragma("GCC visibility push(hidden)") | 144 | # define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN _Pragma("GCC visibility push(hidden)") |
136 | # define POP_SAVED_FUNCTION_VISIBILITY _Pragma("GCC visibility pop") | 145 | # define POP_SAVED_FUNCTION_VISIBILITY _Pragma("GCC visibility pop") |
137 | #else | 146 | #else |
@@ -160,6 +169,14 @@ | |||
160 | # define bswap_64 __bswap64 | 169 | # define bswap_64 __bswap64 |
161 | # define bswap_32 __bswap32 | 170 | # define bswap_32 __bswap32 |
162 | # define bswap_16 __bswap16 | 171 | # define bswap_16 __bswap16 |
172 | # define __BIG_ENDIAN__ (_BYTE_ORDER == _BIG_ENDIAN) | ||
173 | #elif ENABLE_PLATFORM_MINGW32 | ||
174 | # define __BIG_ENDIAN 0 | ||
175 | # define __LITTLE_ENDIAN 1 | ||
176 | # define __BYTE_ORDER __LITTLE_ENDIAN | ||
177 | # define bswap_16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0xFF) << 8)) | ||
178 | # define bswap_32(x) ((bswap_16(((x) & 0xFFFF0000L) >> 16)) | (bswap_16((x) & 0xFFFFL) << 16)) | ||
179 | # define bswap_64(x) ((bswap_32(((x) & 0xFFFFFFFF00000000LL) >> 32)) | (bswap_32((x) & 0xFFFFFFFFLL) << 32)) | ||
163 | #else | 180 | #else |
164 | # include <byteswap.h> | 181 | # include <byteswap.h> |
165 | # include <endian.h> | 182 | # include <endian.h> |
@@ -419,6 +436,26 @@ typedef unsigned smalluint; | |||
419 | # endif | 436 | # endif |
420 | #endif | 437 | #endif |
421 | 438 | ||
439 | #if ENABLE_PLATFORM_MINGW32 | ||
440 | # undef HAVE_DPRINTF | ||
441 | # undef HAVE_GETLINE | ||
442 | # undef HAVE_MEMRCHR | ||
443 | # undef HAVE_MKDTEMP | ||
444 | # undef HAVE_SETBIT | ||
445 | # undef HAVE_STPCPY | ||
446 | # undef HAVE_STRCASESTR | ||
447 | # undef HAVE_STRCHRNUL | ||
448 | # undef HAVE_STRSEP | ||
449 | # undef HAVE_STRSIGNAL | ||
450 | # undef HAVE_STRVERSCMP | ||
451 | #if !defined(__MINGW64_VERSION_MAJOR) | ||
452 | # undef HAVE_VASPRINTF | ||
453 | #endif | ||
454 | # undef HAVE_UNLOCKED_STDIO | ||
455 | # undef HAVE_UNLOCKED_LINE_OPS | ||
456 | # undef HAVE_PRINTF_PERCENTM | ||
457 | #endif | ||
458 | |||
422 | #if defined(__WATCOMC__) | 459 | #if defined(__WATCOMC__) |
423 | # undef HAVE_DPRINTF | 460 | # undef HAVE_DPRINTF |
424 | # undef HAVE_GETLINE | 461 | # undef HAVE_GETLINE |
@@ -533,6 +570,7 @@ extern int dprintf(int fd, const char *format, ...); | |||
533 | #endif | 570 | #endif |
534 | 571 | ||
535 | #ifndef HAVE_MEMRCHR | 572 | #ifndef HAVE_MEMRCHR |
573 | #include <stddef.h> | ||
536 | extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC; | 574 | extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC; |
537 | #endif | 575 | #endif |
538 | 576 | ||
@@ -592,6 +630,7 @@ extern int usleep(unsigned) FAST_FUNC; | |||
592 | #endif | 630 | #endif |
593 | 631 | ||
594 | #ifndef HAVE_VASPRINTF | 632 | #ifndef HAVE_VASPRINTF |
633 | # include <stdarg.h> | ||
595 | extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; | 634 | extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; |
596 | #endif | 635 | #endif |
597 | 636 | ||