diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ef79b91deb..327a6935c56 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,8 @@ else( MSVC ) CACHE STRING "Semicolon-separated list of targets to build, or \"all\".") endif( MSVC ) +option(LLVM_ENABLE_THREADS "Use threads if available." ON) + if( LLVM_TARGETS_TO_BUILD STREQUAL "all" ) set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} ) endif() diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index b8be58e1088..fd6f73b31cd 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -93,8 +93,17 @@ endif( NOT MSVC ) # FIXME: Signal handler return type, currently hardcoded to 'void' set(RETSIGTYPE void) -# Disable multithreading for now -set(ENABLE_THREADS 0) +if( LLVM_ENABLE_THREADS ) + if( HAVE_PTHREAD_H OR WIN32 ) + set(ENABLE_THREADS 1) + endif() +endif() + +if( ENABLE_THREADS ) + message(STATUS "Threads enabled.") +else( ENABLE_THREADS ) + message(STATUS "Threads disabled.") +endif() configure_file( ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake