From: Saleem Abdulrasool Date: Wed, 25 Feb 2015 02:38:03 +0000 (+0000) Subject: build: check if atomic routines are implicitly provided X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fb5edaa05c960aaa53d19ad99af6cea7977cade9;p=oota-llvm.git build: check if atomic routines are implicitly provided It is possible for the atomic routines to be provided by the compiler without requiring any additional libraries. Check if that is the case before checking for a library. Patch by Matt Glazar! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230452 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/cmake/modules/CheckAtomic.cmake b/cmake/modules/CheckAtomic.cmake index 2ed48197728..30a5e311292 100644 --- a/cmake/modules/CheckAtomic.cmake +++ b/cmake/modules/CheckAtomic.cmake @@ -2,9 +2,13 @@ INCLUDE(CheckCXXSourceCompiles) -check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) -if (HAVE_LIBATOMIC) - list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") +check_function_exists(__atomic_fetch_add_4 HAVE___ATOMIC_FETCH_ADD_4) +if( NOT HAVE___ATOMIC_FETCH_ADD_4 ) + check_library_exists(atomic __atomic_fetch_add_4 "" HAVE_LIBATOMIC) + set(HAVE_LIBATOMIC False) + if( HAVE_LIBATOMIC ) + list(APPEND CMAKE_REQUIRED_LIBRARIES "atomic") + endif() endif() CHECK_CXX_SOURCE_COMPILES("