aboutsummaryrefslogtreecommitdiff
path: root/autoconf
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2005-08-24 10:07:20 +0000
committerReid Spencer <rspencer@reidspencer.com>2005-08-24 10:07:20 +0000
commit0a262ba7c3250ef02833fae864459ccc905a2e9b (patch)
treec9538f3275fedf709ead68ba853ad20ee270ae40 /autoconf
parent6ef4949a0bea3f22e7572119d3692b1a5866ffe8 (diff)
For PR616:
These patches make threading optional in LLVM. The configuration scripts are now modified to accept a --disable-threads switch. If this is used, the Mutex class will be implemented with all functions as no-op. Furthermore, linking against libpthread will not be done. Finally, the ParallelJIT example needs libpthread so its makefile was changed to always add -lpthread to the link line. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23003 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'autoconf')
-rw-r--r--autoconf/configure.ac28
1 files changed, 22 insertions, 6 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index b7e11e69e6..0c184516e3 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -230,6 +230,18 @@ case "$enableval" in
*) AC_MSG_ERROR([Invalid setting for --enable-doxygen. Use "yes" or "no"]) ;;
esac
+dnl Allow disablement of threads
+AC_ARG_ENABLE(threads,
+ AS_HELP_STRING([--enable-threads],
+ [Use threads if available (default is YES)]),,
+ enableval=yes)
+case "$enableval" in
+ yes) AC_SUBST(ENABLE_THREADS,[1]) ;;
+ no) AC_SUBST(ENABLE_THREADS,[0]) ;;
+ *) AC_MSG_ERROR([Invalid setting for --enable-threads. Use "yes" or "no"]) ;;
+esac
+AC_DEFINE_UNQUOTED([ENABLE_THREADS],$ENABLE_THREADS,[Define if threads enabled])
+
dnl Allow specific targets to be specified for building (or not)
TARGETS_TO_BUILD=""
AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-target],
@@ -447,10 +459,12 @@ 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.
-AC_CHECK_LIB(pthread,pthread_mutex_init)
-AC_SEARCH_LIBS(pthread_mutex_lock,pthread,
- AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1],
- [Have pthread_mutex_lock]))
+if test "$ENABLE_THREADS" -eq 1 ; then
+ AC_CHECK_LIB(pthread,pthread_mutex_init)
+ AC_SEARCH_LIBS(pthread_mutex_lock,pthread,
+ AC_DEFINE([HAVE_PTHREAD_MUTEX_LOCK],[1],
+ [Have pthread_mutex_lock]))
+fi
dnl===-----------------------------------------------------------------------===
dnl===
@@ -470,10 +484,12 @@ AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h])
-AC_CHECK_HEADERS([malloc.h pthread.h signal.h stdint.h unistd.h utime.h])
-AC_CHECK_HEADERS([windows.h])
+AC_CHECK_HEADERS([malloc.h signal.h stdint.h unistd.h utime.h windows.h])
AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h sys/types.h])
AC_CHECK_HEADERS([rw/stdex/hash_map.h rw/stdex/hash_set.h])
+if test "$ENABLE_THREADS" -eq 1 ; then
+ AC_CHECK_HEADERS(pthread.h)
+fi
dnl===-----------------------------------------------------------------------===
dnl===