diff options
Diffstat (limited to 'include/platform.h')
| -rw-r--r-- | include/platform.h | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/include/platform.h b/include/platform.h index a5b61757f..0db8bf345 100644 --- a/include/platform.h +++ b/include/platform.h | |||
| @@ -7,6 +7,20 @@ | |||
| 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 | # else | ||
| 14 | # undef __USE_MINGW_ANSI_STDIO | ||
| 15 | # define __USE_MINGW_ANSI_STDIO 0 | ||
| 16 | # undef _WIN32_WINNT | ||
| 17 | # define _WIN32_WINNT 0x502 | ||
| 18 | # endif | ||
| 19 | #else | ||
| 20 | # if defined(__MINGW32__) | ||
| 21 | # error "You must select target platform MS Windows, or it won't build" | ||
| 22 | # endif | ||
| 23 | #endif | ||
| 10 | 24 | ||
| 11 | /* Convenience macros to test the version of gcc. */ | 25 | /* Convenience macros to test the version of gcc. */ |
| 12 | #undef __GNUC_PREREQ | 26 | #undef __GNUC_PREREQ |
| @@ -135,7 +149,7 @@ | |||
| 135 | 149 | ||
| 136 | /* Make all declarations hidden (-fvisibility flag only affects definitions) */ | 150 | /* Make all declarations hidden (-fvisibility flag only affects definitions) */ |
| 137 | /* (don't include system headers after this until corresponding pop!) */ | 151 | /* (don't include system headers after this until corresponding pop!) */ |
| 138 | #if __GNUC_PREREQ(4,1) && !defined(__CYGWIN__) | 152 | #if __GNUC_PREREQ(4,1) && !defined(__CYGWIN__) && !ENABLE_PLATFORM_MINGW32 |
| 139 | # define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN _Pragma("GCC visibility push(hidden)") | 153 | # define PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN _Pragma("GCC visibility push(hidden)") |
| 140 | # define POP_SAVED_FUNCTION_VISIBILITY _Pragma("GCC visibility pop") | 154 | # define POP_SAVED_FUNCTION_VISIBILITY _Pragma("GCC visibility pop") |
| 141 | #else | 155 | #else |
| @@ -164,6 +178,13 @@ | |||
| 164 | # define bswap_64 __bswap64 | 178 | # define bswap_64 __bswap64 |
| 165 | # define bswap_32 __bswap32 | 179 | # define bswap_32 __bswap32 |
| 166 | # define bswap_16 __bswap16 | 180 | # define bswap_16 __bswap16 |
| 181 | #elif ENABLE_PLATFORM_MINGW32 | ||
| 182 | # define __BIG_ENDIAN 0 | ||
| 183 | # define __LITTLE_ENDIAN 1 | ||
| 184 | # define __BYTE_ORDER __LITTLE_ENDIAN | ||
| 185 | # define bswap_16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0xFF) << 8)) | ||
| 186 | # define bswap_32(x) ((bswap_16(((x) & 0xFFFF0000L) >> 16)) | (bswap_16((x) & 0xFFFFL) << 16)) | ||
| 187 | # define bswap_64(x) ((bswap_32(((x) & 0xFFFFFFFF00000000LL) >> 32)) | (bswap_32((x) & 0xFFFFFFFFLL) << 32)) | ||
| 167 | #else | 188 | #else |
| 168 | # include <byteswap.h> | 189 | # include <byteswap.h> |
| 169 | # include <endian.h> | 190 | # include <endian.h> |
| @@ -446,6 +467,26 @@ typedef unsigned smalluint; | |||
| 446 | # endif | 467 | # endif |
| 447 | #endif | 468 | #endif |
| 448 | 469 | ||
| 470 | #if ENABLE_PLATFORM_MINGW32 | ||
| 471 | # undef HAVE_FDATASYNC | ||
| 472 | # undef HAVE_DPRINTF | ||
| 473 | # undef HAVE_GETLINE | ||
| 474 | # undef HAVE_MEMRCHR | ||
| 475 | # undef HAVE_MKDTEMP | ||
| 476 | # undef HAVE_SETBIT | ||
| 477 | # undef HAVE_STPCPY | ||
| 478 | # undef HAVE_STPNCPY | ||
| 479 | # undef HAVE_STRCASESTR | ||
| 480 | # undef HAVE_STRCHRNUL | ||
| 481 | # undef HAVE_STRSEP | ||
| 482 | #if !defined(__MINGW64_VERSION_MAJOR) | ||
| 483 | # undef HAVE_VASPRINTF | ||
| 484 | #endif | ||
| 485 | # undef HAVE_UNLOCKED_STDIO | ||
| 486 | # undef HAVE_UNLOCKED_LINE_OPS | ||
| 487 | # undef HAVE_PRINTF_PERCENTM | ||
| 488 | #endif | ||
| 489 | |||
| 449 | #if defined(__WATCOMC__) | 490 | #if defined(__WATCOMC__) |
| 450 | # undef HAVE_DPRINTF | 491 | # undef HAVE_DPRINTF |
| 451 | # undef HAVE_GETLINE | 492 | # undef HAVE_GETLINE |
| @@ -566,6 +607,7 @@ extern int dprintf(int fd, const char *format, ...); | |||
| 566 | #endif | 607 | #endif |
| 567 | 608 | ||
| 568 | #ifndef HAVE_MEMRCHR | 609 | #ifndef HAVE_MEMRCHR |
| 610 | #include <stddef.h> | ||
| 569 | extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC; | 611 | extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC; |
| 570 | #endif | 612 | #endif |
| 571 | 613 | ||
| @@ -629,6 +671,7 @@ extern int usleep(unsigned) FAST_FUNC; | |||
| 629 | #endif | 671 | #endif |
| 630 | 672 | ||
| 631 | #ifndef HAVE_VASPRINTF | 673 | #ifndef HAVE_VASPRINTF |
| 674 | # include <stdarg.h> | ||
| 632 | extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; | 675 | extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; |
| 633 | #endif | 676 | #endif |
| 634 | 677 | ||
