summaryrefslogtreecommitdiffstats
path: root/llvm/cmake/modules
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2015-02-25 02:38:03 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2015-02-25 02:38:03 +0000
commit5285c120086265bfaca69c3a95e3e8e3a61b291d (patch)
tree660a1e44bf6fc8aac0ceba69638dfc9bc0ebe2ae /llvm/cmake/modules
parent671a29d30d2fe5d5d3bab0123690849f98ac031f (diff)
downloadbcm5719-llvm-5285c120086265bfaca69c3a95e3e8e3a61b291d.tar.gz
bcm5719-llvm-5285c120086265bfaca69c3a95e3e8e3a61b291d.zip
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! llvm-svn: 230452
Diffstat (limited to 'llvm/cmake/modules')
-rw-r--r--llvm/cmake/modules/CheckAtomic.cmake10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/cmake/modules/CheckAtomic.cmake b/llvm/cmake/modules/CheckAtomic.cmake
index 2ed48197728..30a5e311292 100644
--- a/llvm/cmake/modules/CheckAtomic.cmake
+++ b/llvm/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("
OpenPOWER on IntegriCloud