1 INCLUDE( CheckIncludeFile ) 2 INCLUDE( CheckFunctionExists ) 3 INCLUDE( CheckSymbolExists ) 4 INCLUDE( CheckCSourceCompiles ) 5 6 SET( PACKAGE ${PACKAGE_NAME} ) 7 SET( VERSION ${PACKAGE_VERSION} ) 8 9 SET( BINARYDIR ${CMAKE_BINARY_DIR} ) 10 SET( SOURCEDIR ${CMAKE_SOURCE_DIR} ) 11 12 # HEADER FILES 13 CHECK_INCLUDE_FILE( sys/byteorder.h HAVE_SYS_BYTEORDER_H ) 14 CHECK_INCLUDE_FILE( AvailabilityMacros.h HAVE_AVAILABILITY_MACROS_H ) 15 CHECK_INCLUDE_FILE( TargetConditionals.h HAVE_TARGET_CONDITIONALS_H ) 16 CHECK_INCLUDE_FILE( libkern/OSAtomic.h HAVE_LIBKERN_OSATOMIC_H ) 17 18 # FUNCTIONS 19 CHECK_FUNCTION_EXISTS( sysconf HAVE_SYSCONF ) 20 CHECK_SYMBOL_EXISTS( OSAtomicCompareAndSwapInt libkern/OSAtomic.h HAVE_OSATOMIC_COMPARE_AND_SWAP_INT ) 21 CHECK_SYMBOL_EXISTS( OSAtomicCompareAndSwapLong libkern/OSAtomic.h HAVE_OSATOMIC_COMPARE_AND_SWAP_LONG ) 22 23 # BUILTIN 24 CHECK_C_SOURCE_COMPILES( " 25 volatile int a; 26 int main(int argc, char *argv[]) { 27 (void)__sync_bool_compare_and_swap(&a, 1, 2); 28 return 0; 29 } 30 " HAVE_SYNC_BOOL_COMPARE_AND_SWAP_INT ) 31 32 CHECK_C_SOURCE_COMPILES( " 33 volatile long a; 34 int main(int argc, char *argv[]) { 35 (void)__sync_bool_compare_and_swap(&a, 1, 2); 36 return 0; 37 } 38 " HAVE_SYNC_BOOL_COMPARE_AND_SWAP_LONG ) 39