summaryrefslogtreecommitdiff
path: root/autoconf
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-05-18 23:58:51 +0000
committerOwen Anderson <resistor@mac.com>2009-05-18 23:58:51 +0000
commitd4b272bcf418fa63d54aa0db95c1d2e3c8b843fd (patch)
tree33a89d4b3b19c254802683247ee245e1db49deb1 /autoconf
parentcd3f9991a03bcce0cdf3c6985a59da017337a2bf (diff)
downloadllvm-d4b272bcf418fa63d54aa0db95c1d2e3c8b843fd.tar.gz
llvm-d4b272bcf418fa63d54aa0db95c1d2e3c8b843fd.tar.bz2
llvm-d4b272bcf418fa63d54aa0db95c1d2e3c8b843fd.tar.xz
Test for the presence of GCC atomic builtins at configure time. If not found,
disable building LLVM in thread-safe mode and print a nice warning. Regenerate configure for these changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72075 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'autoconf')
-rw-r--r--autoconf/configure.ac21
1 files changed, 20 insertions, 1 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac
index cb217a5143..56853e96bf 100644
--- a/autoconf/configure.ac
+++ b/autoconf/configure.ac
@@ -372,7 +372,6 @@ case "$enableval" in
default) AC_SUBST(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])
dnl Allow building without position independent code
AC_ARG_ENABLE(pic,
@@ -897,6 +896,26 @@ if test "$llvm_cv_platform_type" = "Unix" ; then
fi
fi
+dnl atomic builtins are required for threading support.
+if test "$ENABLE_THREADS" -eq 1 ; then
+ AC_MSG_CHECKING(for GCC atomic builtins)
+ AC_LINK_IFELSE(
+ AC_LANG_SOURCE(
+ [[int main() {
+ volatile unsigned long val = 1;
+ __sync_synchronize();
+ __sync_val_compare_and_swap(&val, 1, 0);
+ return 0;
+ }
+ ]]),
+ AC_MSG_RESULT(yes),
+ AC_MSG_RESULT(no)
+ AC_SUBST(ENABLE_THREADS, [0])
+ AC_MSG_WARN([Threading support disabled because atomic builtins are missing]))
+fi
+
+AC_DEFINE_UNQUOTED([ENABLE_THREADS],$ENABLE_THREADS,[Define if threads enabled])
+
dnl===-----------------------------------------------------------------------===
dnl===
dnl=== SECTION 9: Additional checks, variables, etc.