diff options
-rw-r--r-- | autoconf/configure.ac | 13 | ||||
-rwxr-xr-x | cmake/config-ix.cmake | 9 | ||||
-rw-r--r-- | include/llvm/Config/config.h.cmake | 6 | ||||
-rw-r--r-- | include/llvm/Config/llvm-config.h.cmake | 3 | ||||
-rw-r--r-- | include/llvm/Config/llvm-config.h.in | 3 | ||||
-rw-r--r-- | include/llvm/Support/Valgrind.h | 4 | ||||
-rw-r--r-- | lib/Support/Mutex.cpp | 2 | ||||
-rw-r--r-- | lib/Support/RWMutex.cpp | 2 | ||||
-rw-r--r-- | lib/Support/ThreadLocal.cpp | 2 | ||||
-rw-r--r-- | lib/Support/Threading.cpp | 8 |
10 files changed, 30 insertions, 22 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac index d7775533e5..5503e3a307 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -538,12 +538,13 @@ AC_ARG_ENABLE(threads, [Use threads if available (default is YES)]),, enableval=default) case "$enableval" in - yes) AC_SUBST(ENABLE_THREADS,[1]) ;; - no) AC_SUBST(ENABLE_THREADS,[0]) ;; - default) AC_SUBST(ENABLE_THREADS,[1]) ;; + yes) AC_SUBST(LLVM_ENABLE_THREADS,[1]) ;; + no) AC_SUBST(LLVM_ENABLE_THREADS,[0]) ;; + default) AC_SUBST(LLVM_ENABLE_THREADS,[1]) ;; *) AC_MSG_ERROR([Invalid setting for --enable-threads. Use "yes" or "no"]) ;; esac -AC_DEFINE_UNQUOTED([ENABLE_THREADS],$ENABLE_THREADS,[Define if threads enabled]) +AC_DEFINE_UNQUOTED([LLVM_ENABLE_THREADS],$LLVM_ENABLE_THREADS, + [Define if threads enabled]) dnl Allow disablement of pthread.h AC_ARG_ENABLE(pthreads, @@ -1144,7 +1145,7 @@ AC_SEARCH_LIBS(mallinfo,malloc,AC_DEFINE([HAVE_MALLINFO],[1], dnl pthread locking functions are optional - but llvm will not be thread-safe dnl without locks. -if test "$ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then +if test "$LLVM_ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then AC_CHECK_LIB(pthread, pthread_mutex_init) AC_SEARCH_LIBS(pthread_mutex_lock,pthread, AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1], @@ -1235,7 +1236,7 @@ AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h sys/uio.h]) AC_CHECK_HEADERS([sys/types.h sys/ioctl.h malloc/malloc.h mach/mach.h]) AC_CHECK_HEADERS([valgrind/valgrind.h]) AC_CHECK_HEADERS([fenv.h]) -if test "$ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then +if test "$LLVM_ENABLE_THREADS" -eq 1 && test "$ENABLE_PTHREADS" -eq 1 ; then AC_CHECK_HEADERS(pthread.h, AC_SUBST(HAVE_PTHREAD, 1), AC_SUBST(HAVE_PTHREAD, 0)) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index 0943ae71b8..a5077002fe 100755 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -379,14 +379,15 @@ endif( PURE_WINDOWS ) set(RETSIGTYPE void) if( LLVM_ENABLE_THREADS ) - if( HAVE_PTHREAD_H OR WIN32 ) - set(ENABLE_THREADS 1) + # Check if threading primitives aren't supported on this platform + if( NOT HAVE_PTHREAD_H AND NOT WIN32 ) + set(LLVM_ENABLE_THREADS 0) endif() endif() -if( ENABLE_THREADS ) +if( LLVM_ENABLE_THREADS ) message(STATUS "Threads enabled.") -else( ENABLE_THREADS ) +else( LLVM_ENABLE_THREADS ) message(STATUS "Threads disabled.") endif() diff --git a/include/llvm/Config/config.h.cmake b/include/llvm/Config/config.h.cmake index fc13591a47..1f9620762d 100644 --- a/include/llvm/Config/config.h.cmake +++ b/include/llvm/Config/config.h.cmake @@ -32,9 +32,6 @@ /* Define if position independent code is enabled */ #cmakedefine ENABLE_PIC -/* Define if threads enabled */ -#cmakedefine ENABLE_THREADS ${ENABLE_THREADS} - /* Define if timestamp information (e.g., __DATE___) is allowed */ #cmakedefine ENABLE_TIMESTAMPS ${ENABLE_TIMESTAMPS} @@ -554,6 +551,9 @@ /* Installation directory for documentation */ #cmakedefine LLVM_DOCSDIR "${LLVM_DOCSDIR}" +/* Define if threads enabled */ +#cmakedefine01 LLVM_ENABLE_THREADS + /* Installation directory for config files */ #cmakedefine LLVM_ETCDIR "${LLVM_ETCDIR}" diff --git a/include/llvm/Config/llvm-config.h.cmake b/include/llvm/Config/llvm-config.h.cmake index 7042b6432e..0c5b542679 100644 --- a/include/llvm/Config/llvm-config.h.cmake +++ b/include/llvm/Config/llvm-config.h.cmake @@ -31,6 +31,9 @@ /* Installation directory for documentation */ #cmakedefine LLVM_DOCSDIR "${LLVM_DOCSDIR}" +/* Define if threads enabled */ +#cmakedefine01 LLVM_ENABLE_THREADS + /* Installation directory for config files */ #cmakedefine LLVM_ETCDIR "${LLVM_ETCDIR}" diff --git a/include/llvm/Config/llvm-config.h.in b/include/llvm/Config/llvm-config.h.in index 83c8f5d38e..30a935bf9c 100644 --- a/include/llvm/Config/llvm-config.h.in +++ b/include/llvm/Config/llvm-config.h.in @@ -31,6 +31,9 @@ /* Installation directory for documentation */ #undef LLVM_DOCSDIR +/* Define if threads enabled */ +#undef LLVM_ENABLE_THREADS + /* Installation directory for config files */ #undef LLVM_ETCDIR diff --git a/include/llvm/Support/Valgrind.h b/include/llvm/Support/Valgrind.h index 9b8d277ecc..e091eb7edc 100644 --- a/include/llvm/Support/Valgrind.h +++ b/include/llvm/Support/Valgrind.h @@ -20,7 +20,7 @@ #include "llvm/Config/config.h" #include <stddef.h> -#if ENABLE_THREADS != 0 && !defined(NDEBUG) +#if LLVM_ENABLE_THREADS != 0 && !defined(NDEBUG) // tsan (Thread Sanitizer) is a valgrind-based tool that detects these exact // functions by name. extern "C" { @@ -42,7 +42,7 @@ namespace sys { // Otherwise valgrind may continue to execute the old version of the code. void ValgrindDiscardTranslations(const void *Addr, size_t Len); -#if ENABLE_THREADS != 0 && !defined(NDEBUG) +#if LLVM_ENABLE_THREADS != 0 && !defined(NDEBUG) // Thread Sanitizer is a valgrind tool that finds races in code. // See http://code.google.com/p/data-race-test/wiki/DynamicAnnotations . diff --git a/lib/Support/Mutex.cpp b/lib/Support/Mutex.cpp index 8874e943f4..6a873cb000 100644 --- a/lib/Support/Mutex.cpp +++ b/lib/Support/Mutex.cpp @@ -19,7 +19,7 @@ //=== independent code. //===----------------------------------------------------------------------===// -#if !defined(ENABLE_THREADS) || ENABLE_THREADS == 0 +#if !defined(LLVM_ENABLE_THREADS) || LLVM_ENABLE_THREADS == 0 // Define all methods as no-ops if threading is explicitly disabled namespace llvm { using namespace sys; diff --git a/lib/Support/RWMutex.cpp b/lib/Support/RWMutex.cpp index d0b1e10b56..d14b9765b8 100644 --- a/lib/Support/RWMutex.cpp +++ b/lib/Support/RWMutex.cpp @@ -20,7 +20,7 @@ //=== independent code. //===----------------------------------------------------------------------===// -#if !defined(ENABLE_THREADS) || ENABLE_THREADS == 0 +#if !defined(LLVM_ENABLE_THREADS) || LLVM_ENABLE_THREADS == 0 // Define all methods as no-ops if threading is explicitly disabled namespace llvm { using namespace sys; diff --git a/lib/Support/ThreadLocal.cpp b/lib/Support/ThreadLocal.cpp index fdb251c0a3..08b12b658b 100644 --- a/lib/Support/ThreadLocal.cpp +++ b/lib/Support/ThreadLocal.cpp @@ -19,7 +19,7 @@ //=== independent code. //===----------------------------------------------------------------------===// -#if !defined(ENABLE_THREADS) || ENABLE_THREADS == 0 +#if !defined(LLVM_ENABLE_THREADS) || LLVM_ENABLE_THREADS == 0 // Define all methods as no-ops if threading is explicitly disabled namespace llvm { using namespace sys; diff --git a/lib/Support/Threading.cpp b/lib/Support/Threading.cpp index 8f0bb93eb4..7483225fdf 100644 --- a/lib/Support/Threading.cpp +++ b/lib/Support/Threading.cpp @@ -24,7 +24,7 @@ static bool multithreaded_mode = false; static sys::Mutex* global_lock = 0; bool llvm::llvm_start_multithreaded() { -#if ENABLE_THREADS != 0 +#if LLVM_ENABLE_THREADS != 0 assert(!multithreaded_mode && "Already multithreaded!"); multithreaded_mode = true; global_lock = new sys::Mutex(true); @@ -39,7 +39,7 @@ bool llvm::llvm_start_multithreaded() { } void llvm::llvm_stop_multithreaded() { -#if ENABLE_THREADS != 0 +#if LLVM_ENABLE_THREADS != 0 assert(multithreaded_mode && "Not currently multithreaded!"); // We fence here to insure that all threaded operations are complete BEFORE we @@ -63,7 +63,7 @@ void llvm::llvm_release_global_lock() { if (multithreaded_mode) global_lock->release(); } -#if ENABLE_THREADS != 0 && defined(HAVE_PTHREAD_H) +#if LLVM_ENABLE_THREADS != 0 && defined(HAVE_PTHREAD_H) #include <pthread.h> struct ThreadInfo { @@ -102,7 +102,7 @@ void llvm::llvm_execute_on_thread(void (*Fn)(void*), void *UserData, error: ::pthread_attr_destroy(&Attr); } -#elif ENABLE_THREADS!=0 && defined(LLVM_ON_WIN32) +#elif LLVM_ENABLE_THREADS!=0 && defined(LLVM_ON_WIN32) #include "Windows/Windows.h" #include <process.h> |