[llvm-commits] [llvm] r76221 - in /llvm/trunk: cmake/config-ix.cmake cmake/modules/CheckAtomic.cmake include/llvm/Config/config.h.cmake
Xerxes Ranby
xerxes at zafena.se
Fri Jul 17 12:22:52 PDT 2009
Author: xranby
Date: Fri Jul 17 14:22:41 2009
New Revision: 76221
URL: http://llvm.org/viewvc/llvm-project?rev=76221&view=rev
Log:
Implement cmake LLVM_MULTITHREADED gcc atomic builtin checks.
Added:
llvm/trunk/cmake/modules/CheckAtomic.cmake
Modified:
llvm/trunk/cmake/config-ix.cmake
llvm/trunk/include/llvm/Config/config.h.cmake
Modified: llvm/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=76221&r1=76220&r2=76221&view=diff
==============================================================================
--- llvm/trunk/cmake/config-ix.cmake (original)
+++ llvm/trunk/cmake/config-ix.cmake Fri Jul 17 14:22:41 2009
@@ -76,6 +76,9 @@
add_llvm_definitions( -D_GNU_SOURCE )
endif()
+# Define LLVM_MULTITHREADED if gcc atomic builtins exists.
+include(CheckAtomic)
+
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-fPIC" SUPPORTS_FPIC_FLAG)
Added: llvm/trunk/cmake/modules/CheckAtomic.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/CheckAtomic.cmake?rev=76221&view=auto
==============================================================================
--- llvm/trunk/cmake/modules/CheckAtomic.cmake (added)
+++ llvm/trunk/cmake/modules/CheckAtomic.cmake Fri Jul 17 14:22:41 2009
@@ -0,0 +1,18 @@
+# atomic builtins are required for threading support.
+
+INCLUDE(CheckCXXSourceCompiles)
+
+CHECK_CXX_SOURCE_COMPILES("
+int main() {
+ volatile unsigned long val = 1;
+ __sync_synchronize();
+ __sync_val_compare_and_swap(&val, 1, 0);
+ __sync_add_and_fetch(&val, 1);
+ __sync_sub_and_fetch(&val, 1);
+ return 0;
+ }
+" LLVM_MULTITHREADED)
+
+if( NOT LLVM_MULTITHREADED )
+ message(STATUS "Warning: LLVM will be built thread-unsafe because atomic builtins are missing")
+endif()
Modified: llvm/trunk/include/llvm/Config/config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/config.h.cmake?rev=76221&r1=76220&r2=76221&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/config.h.cmake (original)
+++ llvm/trunk/include/llvm/Config/config.h.cmake Fri Jul 17 14:22:41 2009
@@ -467,6 +467,9 @@
/* Installation directory for man pages */
#undef LLVM_MANDIR
+/* Build multithreading support into LLVM */
+#cmakedefine LLVM_MULTITHREADED ${LLVM_MULTITHREADED}
+
/* Define if this is Unixish platform */
#cmakedefine LLVM_ON_UNIX ${LLVM_ON_UNIX}
More information about the llvm-commits
mailing list