6 #define HAVE_AVAILABILITY_MACROS_H 1
7 #define HAVE_TARGET_CONDITIONALS_H 1
8 #define HAVE_OSATOMIC_COMPARE_AND_SWAP_INT 1
9 #define HAVE_OSATOMIC_COMPARE_AND_SWAP_LONG 1
10 #define HAVE_LIBKERN_OSATOMIC_H
12 /* Be sneaky and turn OSAtomicCompareAndSwapInt into OSAtomicCompareAndSwap32
13 * and OSAtomicCompareAndSwapLong into either OSAtomicCompareAndSwap32
14 * or OSAtomicCompareAndSwap64 (depending on __LP64__) so that the library
15 * is Tiger compatible!
17 #include <libkern/OSAtomic.h>
18 #undef OSAtomicCompareAndSwapInt
19 #undef OSAtomicCompareAndSwapLong
20 #define OSAtomicCompareAndSwapInt(o,n,v) OSAtomicCompareAndSwap32Compat(o,n,v)
22 #define OSAtomicCompareAndSwapLong(o,n,v) OSAtomicCompareAndSwap64Compat(o,n,v)
24 #define OSAtomicCompareAndSwapLong(o,n,v) OSAtomicCompareAndSwap32Compat(o,n,v)
27 static __inline
bool OSAtomicCompareAndSwap32Compat(int32_t o
, int32_t n
, volatile int32_t *v
)
28 {return OSAtomicCompareAndSwap32(o
,n
,(int32_t *)v
);}
30 static __inline
bool OSAtomicCompareAndSwap64Compat(int64_t o
, int64_t n
, volatile int64_t *v
)
31 {return OSAtomicCompareAndSwap64(o
,n
,(int64_t *)v
);}
34 #else /* !__APPLE__ */
36 #if defined(__WIN32__) || defined(_WIN32)
38 /* Poor runtime.c code causes warnings calling InterlockedCompareExchange */
39 #define _CRT_SECURE_NO_WARNINGS 1
41 static __inline
int InterlockedCompareExchangeCompat(volatile void *v
, long n
, long o
)
42 {return (int)InterlockedCompareExchange((LONG
*)v
, (LONG
)n
, (LONG
)o
);}
43 #undef InterlockedCompareExchange
44 #define InterlockedCompareExchange(v,n,o) InterlockedCompareExchangeCompat(v,n,o)
46 #elif defined(__GNUC__) /* && !defined(__WIN32__) && !defined(_WIN32) */
48 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) /* GCC >= 4.1 */
50 /* runtime.c ignores these if __WIN32__ or _WIN32 is defined */
51 #define HAVE_SYNC_BOOL_COMPARE_AND_SWAP_INT 1
52 #define HAVE_SYNC_BOOL_COMPARE_AND_SWAP_LONG 1
54 #else /* GCC earlier than version 4.1 */
56 #error GCC version 4.1 (or compatible) or later is required on non-apple, non-w32 targets
58 #endif /* GCC earlier than version 4.1 */
60 #endif /* !defined(__GNUC__) && !defined(__WIN32__) && !defined(_WIN32) */
62 #endif /* !__APPLE__ */
64 #endif /* _CONFIG_H_ */