[commit: ghc] master: Better detection of clang in ./configure. Issue #7678. (61e8d5d)
Austin Seipp
mad.one at gmail.com
Sun Feb 10 09:40:54 CET 2013
Repository : ssh://darcs.haskell.org//srv/darcs/ghc
On branch : master
http://hackage.haskell.org/trac/ghc/changeset/61e8d5df26522b01922bc5358b9c233de0d1fc29
>---------------------------------------------------------------
commit 61e8d5df26522b01922bc5358b9c233de0d1fc29
Author: Austin Seipp <aseipp at pobox.com>
Date: Sun Feb 10 02:24:28 2013 -0600
Better detection of clang in ./configure. Issue #7678.
Signed-off-by: Austin Seipp <aseipp at pobox.com>
>---------------------------------------------------------------
aclocal.m4 | 19 +++++++++++++++----
configure.ac | 8 +++++++-
mk/config.mk.in | 4 ++++
3 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/aclocal.m4 b/aclocal.m4
index 837eea0..32af656 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
])
diff --git a/configure.ac b/configure.ac
index c27b49f..fa01e88 100644
--- a/configure.ac
+++ b/configure.ac
@@ -986,8 +986,14 @@ echo ["\
"]
fi
+if test "$CC_CLANG_BACKEND" = "1"; then
+CNAME="clang "
+else
+CNAME="gcc "
+fi
+
echo ["\
- Using GCC : $WhatGccIsCalled
+ Using $CNAME : $WhatGccIsCalled
which is version : $GccVersion
Building a cross compiler : $CrossCompiling
diff --git a/mk/config.mk.in b/mk/config.mk.in
index e40f569..20eadc3 100644
--- a/mk/config.mk.in
+++ b/mk/config.mk.in
@@ -46,6 +46,10 @@ NO_INCLUDE_PKGDATA = NO
# Should we build latex docs?
LATEX_DOCS = NO
+# Is the global compiler clang, llvm, or something neither?
+CC_CLANG_BACKEND = @CC_CLANG_BACKEND@
+CC_LLVM_BACKEND = @CC_LLVM_BACKEND@
+
# Mac OS X deployment target (to cross-compile for older OS versions)
#
MACOSX_DEPLOYMENT_VERSION = @MACOSX_DEPLOYMENT_VERSION@
More information about the ghc-commits
mailing list