summaryrefslogtreecommitdiff
path: root/aclocal.m4
diff options
context:
space:
mode:
authorAustin Seipp <aseipp@pobox.com>2013-02-10 02:24:28 -0600
committerAustin Seipp <aseipp@pobox.com>2013-02-10 02:39:28 -0600
commit61e8d5df26522b01922bc5358b9c233de0d1fc29 (patch)
tree031f515a0e3bc2ba682598a699cf7f3a6e6ccb4b /aclocal.m4
parentae06df63bef37c688b135ae9df3dcc1998375042 (diff)
downloadhaskell-61e8d5df26522b01922bc5358b9c233de0d1fc29.tar.gz
Better detection of clang in ./configure. Issue #7678.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
Diffstat (limited to 'aclocal.m4')
-rw-r--r--aclocal.m419
1 files changed, 15 insertions, 4 deletions
diff --git a/aclocal.m4 b/aclocal.m4
index 837eea05a2..32af656b5b 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1136,19 +1136,30 @@ AC_SUBST(GccLT34)
AC_SUBST(GccLT46)
])# FP_GCC_VERSION
-dnl Check to see if the C compiler uses an LLVM back end
+dnl Check to see if the C compiler is clang or llvm-gcc
dnl
AC_DEFUN([FP_CC_LLVM_BACKEND],
[AC_REQUIRE([AC_PROG_CC])
-AC_MSG_CHECKING([whether C compiler has an LLVM back end])
+AC_MSG_CHECKING([whether C compiler is clang])
$CC -x c /dev/null -dM -E > conftest.txt 2>&1
-if grep "__llvm__" conftest.txt >/dev/null 2>&1; then
+if grep "__clang__" conftest.txt >/dev/null 2>&1; then
+ AC_SUBST([CC_CLANG_BACKEND], [1])
AC_SUBST([CC_LLVM_BACKEND], [1])
AC_MSG_RESULT([yes])
else
- AC_SUBST([CC_LLVM_BACKEND], [0])
AC_MSG_RESULT([no])
+ AC_MSG_CHECKING([whether C compiler has an LLVM back end])
+ if grep "__llvm__" conftest.txt >/dev/null 2>&1; then
+ AC_SUBST([CC_CLANG_BACKEND], [0])
+ AC_SUBST([CC_LLVM_BACKEND], [1])
+ AC_MSG_RESULT([yes])
+ else
+ AC_SUBST([CC_CLANG_BACKEND], [0])
+ AC_SUBST([CC_LLVM_BACKEND], [0])
+ AC_MSG_RESULT([no])
+ fi
fi
+
rm -f conftest.txt
])