summaryrefslogtreecommitdiff
path: root/include/platform.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/platform.h')
-rw-r--r--include/platform.h40
1 files changed, 39 insertions, 1 deletions
diff --git a/include/platform.h b/include/platform.h
index 09c7ccd9c..e2b61592e 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>
@@ -396,6 +413,25 @@ typedef unsigned smalluint;
396# endif 413# endif
397#endif 414#endif
398 415
416#if ENABLE_PLATFORM_MINGW32
417# undef HAVE_DPRINTF
418# undef HAVE_GETLINE
419# undef HAVE_MEMRCHR
420# undef HAVE_MKDTEMP
421# undef HAVE_SETBIT
422# undef HAVE_STPCPY
423# undef HAVE_STRCASESTR
424# undef HAVE_STRCHRNUL
425# undef HAVE_STRSEP
426# undef HAVE_STRSIGNAL
427# undef HAVE_STRVERSCMP
428#if !defined(__MINGW64_VERSION_MAJOR)
429# undef HAVE_VASPRINTF
430#endif
431# undef HAVE_UNLOCKED_STDIO
432# undef HAVE_UNLOCKED_LINE_OPS
433#endif
434
399#if defined(__WATCOMC__) 435#if defined(__WATCOMC__)
400# undef HAVE_DPRINTF 436# undef HAVE_DPRINTF
401# undef HAVE_GETLINE 437# undef HAVE_GETLINE
@@ -493,6 +529,7 @@ extern int dprintf(int fd, const char *format, ...);
493#endif 529#endif
494 530
495#ifndef HAVE_MEMRCHR 531#ifndef HAVE_MEMRCHR
532#include <stddef.h>
496extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC; 533extern void *memrchr(const void *s, int c, size_t n) FAST_FUNC;
497#endif 534#endif
498 535
@@ -535,6 +572,7 @@ extern int usleep(unsigned) FAST_FUNC;
535#endif 572#endif
536 573
537#ifndef HAVE_VASPRINTF 574#ifndef HAVE_VASPRINTF
575# include <stdarg.h>
538extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; 576extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC;
539#endif 577#endif
540 578