summaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorDavid M Peixotto <dmp@rice.edu>2011-06-28 15:38:32 -0500
committerDavid M Peixotto <dmp@rice.edu>2011-10-07 16:48:34 -0500
commit6247b59e5d31de58ee51273916bc44ac2118240a (patch)
tree10ce216966c64b2e45373cd9ceb45e7d27f3f766 /aclocal.m4
parentdba7254566b121408e7167200d0223a531b66e8b (diff)
downloadhaskell-6247b59e5d31de58ee51273916bc44ac2118240a.tar.gz
Add autoconf support to detect an LLVM-based C compiler
This patch adds support to the autoconf scripts to detect when we are using a C compiler that uses an LLVM back end. An LLVM back end does not support all of the extensions use by GCC, so we need to perform some conditional compilation in the runtime, particularly for handling thread local storage and global register variables. The changes here will set the CC_LLVM_BACKEND in the autoconf scripts if we detect an llvm-based compiler. We use this variable to define the llvm_CC_FLAVOR variable that we can use in the runtime code to conditionally compile for LLVM.
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m416
1 files changed, 16 insertions, 0 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index c8c125a228..ebca797c48 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -853,6 +853,22 @@ AC_SUBST(GccLT34)
AC_SUBST(GccLT46)
])# FP_GCC_VERSION
+dnl Check to see if the C compiler uses an LLVM back end
+dnl
+AC_DEFUN([FP_CC_LLVM_BACKEND],
+[AC_REQUIRE([AC_PROG_CC])
+AC_MSG_CHECKING([whether C compiler has an LLVM back end])
+$CC -x c /dev/null -dM -E > conftest.txt 2>&1
+if grep "__llvm__" conftest.txt >/dev/null 2>&1; then
+ AC_SUBST([CC_LLVM_BACKEND], [1])
+ AC_MSG_RESULT([yes])
+else
+ AC_SUBST([CC_LLVM_BACKEND], [0])
+ AC_MSG_RESULT([no])
+fi
+rm -f conftest.txt
+])
+
dnl Small feature test for perl version. Assumes PerlCmd
dnl contains path to perl binary.
dnl