summaryrefslogtreecommitdiff
path: root/ConfigureChecks.cmake
diff options
context:
space:
mode:
authorShantonu Sen <ssen@apple.com>2009-09-22 00:49:12 +0000
committerShantonu Sen <ssen@apple.com>2009-09-22 00:49:12 +0000
commitb4c3b6f8a2d3481bac6b0e9b4240fa0c99412d10 (patch)
treeecfc1c923f3e6991c75264d5a8e9edd2d394e492 /ConfigureChecks.cmake
parent92a6cf5b64bb661c8b67825a4a5583eb01807633 (diff)
1) Remove cmake-specific #define usage from the exported
Block.h/Block_private.h headers, since clients won't know what to set. These are moved into runtime.c as appropriate 2) Use cmake checks for CAS builtins, instead of guessing based on GCC #defines (which aren't set by clang and llvm-gcc anyway) 3) "#pragma mark" isn't supported by FSF gcc, so "#if 0" it out. It should still show up in IDEs that support it 4) Fix some compiler warnings. GCC 4.3.3 seems super strict about %p. function pointers can't be cast to void * either. 5) Avoid a warning for apple_versioning.c that "ISO C does not allow empty files" git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@82504 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'ConfigureChecks.cmake')
-rw-r--r--ConfigureChecks.cmake22
1 files changed, 22 insertions, 0 deletions
diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake
index 0516d7fc2..b72a390af 100644
--- a/ConfigureChecks.cmake
+++ b/ConfigureChecks.cmake
@@ -1,5 +1,7 @@
INCLUDE( CheckIncludeFile )
INCLUDE( CheckFunctionExists )
+INCLUDE( CheckSymbolExists )
+INCLUDE( CheckCSourceCompiles )
SET( PACKAGE ${PACKAGE_NAME} )
SET( VERSION ${PACKAGE_VERSION} )
@@ -11,6 +13,26 @@ SET( SOURCEDIR ${CMAKE_SOURCE_DIR} )
CHECK_INCLUDE_FILE( sys/byteorder.h HAVE_SYS_BYTEORDER_H )
CHECK_INCLUDE_FILE( AvailabilityMacros.h HAVE_AVAILABILITY_MACROS_H )
CHECK_INCLUDE_FILE( TargetConditionals.h HAVE_TARGET_CONDITIONALS_H )
+CHECK_INCLUDE_FILE( libkern/OSAtomic.h HAVE_LIBKERN_OSATOMIC_H )
# FUNCTIONS
CHECK_FUNCTION_EXISTS( sysconf HAVE_SYSCONF )
+CHECK_SYMBOL_EXISTS( OSAtomicCompareAndSwapInt libkern/OSAtomic.h HAVE_OSATOMIC_COMPARE_AND_SWAP_INT )
+CHECK_SYMBOL_EXISTS( OSAtomicCompareAndSwapLong libkern/OSAtomic.h HAVE_OSATOMIC_COMPARE_AND_SWAP_LONG )
+
+# BUILTIN
+CHECK_C_SOURCE_COMPILES( "
+volatile int a;
+int main(int argc, char *argv[]) {
+ (void)__sync_bool_compare_and_swap(&a, 1, 2);
+ return 0;
+}
+" HAVE_SYNC_BOOL_COMPARE_AND_SWAP_INT )
+
+CHECK_C_SOURCE_COMPILES( "
+volatile long a;
+int main(int argc, char *argv[]) {
+ (void)__sync_bool_compare_and_swap(&a, 1, 2);
+ return 0;
+}
+" HAVE_SYNC_BOOL_COMPARE_AND_SWAP_LONG )