llvm-project/compiler-rt/ConfigureChecks.cmake
Shantonu Sen 33f6acbbf1 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"

llvm-svn: 82504
2009-09-22 00:49:12 +00:00

39 lines
1.2 KiB
CMake

INCLUDE( CheckIncludeFile )
INCLUDE( CheckFunctionExists )
INCLUDE( CheckSymbolExists )
INCLUDE( CheckCSourceCompiles )
SET( PACKAGE ${PACKAGE_NAME} )
SET( VERSION ${PACKAGE_VERSION} )
SET( BINARYDIR ${CMAKE_BINARY_DIR} )
SET( SOURCEDIR ${CMAKE_SOURCE_DIR} )
# HEADER FILES
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 )