Commit 61e8d5df authored by thoughtpolice's avatar thoughtpolice
Browse files

Better detection of clang in ./configure. Issue #7678.


Signed-off-by: thoughtpolice's avatarAustin Seipp <aseipp@pobox.com>
parent ae06df63
...@@ -1136,19 +1136,30 @@ AC_SUBST(GccLT34) ...@@ -1136,19 +1136,30 @@ AC_SUBST(GccLT34)
AC_SUBST(GccLT46) AC_SUBST(GccLT46)
])# FP_GCC_VERSION ])# 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 dnl
AC_DEFUN([FP_CC_LLVM_BACKEND], AC_DEFUN([FP_CC_LLVM_BACKEND],
[AC_REQUIRE([AC_PROG_CC]) [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 $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_SUBST([CC_LLVM_BACKEND], [1])
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
else else
AC_SUBST([CC_LLVM_BACKEND], [0])
AC_MSG_RESULT([no]) 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 fi
rm -f conftest.txt rm -f conftest.txt
]) ])
......
...@@ -986,8 +986,14 @@ echo ["\ ...@@ -986,8 +986,14 @@ echo ["\
"] "]
fi fi
if test "$CC_CLANG_BACKEND" = "1"; then
CNAME="clang "
else
CNAME="gcc "
fi
echo ["\ echo ["\
Using GCC : $WhatGccIsCalled Using $CNAME : $WhatGccIsCalled
which is version : $GccVersion which is version : $GccVersion
Building a cross compiler : $CrossCompiling Building a cross compiler : $CrossCompiling
......
...@@ -46,6 +46,10 @@ NO_INCLUDE_PKGDATA = NO ...@@ -46,6 +46,10 @@ NO_INCLUDE_PKGDATA = NO
# Should we build latex docs? # Should we build latex docs?
LATEX_DOCS = NO 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) # Mac OS X deployment target (to cross-compile for older OS versions)
# #
MACOSX_DEPLOYMENT_VERSION = @MACOSX_DEPLOYMENT_VERSION@ MACOSX_DEPLOYMENT_VERSION = @MACOSX_DEPLOYMENT_VERSION@
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment