diff options
author | Dmitri Gribenko <gribozavr@gmail.com> | 2013-01-09 15:25:30 +0000 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2013-01-09 15:25:30 +0000 |
commit | a7303360aea203d0f58f77ac43287f5b98c7cbe6 (patch) | |
tree | 0e31b2f98bd583ad86d8bcb1694fbbf1db0a72ce /autoconf | |
parent | 7bf2e1b9ef797fda5de53956a1d2aea900ce794f (diff) | |
download | llvm-a7303360aea203d0f58f77ac43287f5b98c7cbe6.tar.gz llvm-a7303360aea203d0f58f77ac43287f5b98c7cbe6.tar.bz2 llvm-a7303360aea203d0f58f77ac43287f5b98c7cbe6.tar.xz |
Configure: if we compile with clang, check that it is not broken
Some linux distibutions (for example, Mageia 2, Fedora 17) ship Clang that is
essentially broken for the end user. Clang can not find or compile libstdc++
headers.
The issue is that our configure prefers clang over gcc, thus selecting a broken
Clang when a working GCC is available.
Now we detect this issue by compiling a simple program. If it does not
compile, configure stops with an error suggesting the user to select a
different compiler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171975 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'autoconf')
-rw-r--r-- | autoconf/configure.ac | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 102147c4f2..a1426c1832 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -65,6 +65,32 @@ AC_PROG_CC(clang llvm-gcc gcc) AC_PROG_CXX(clang++ llvm-g++ g++) AC_PROG_CPP +dnl If CXX is Clang, check that it can find and parse C++ standard library +dnl headers. +if test "$CXX" = "clang++" ; then + AC_MSG_CHECKING([whether clang works]) + AC_LANG_PUSH([C++]) + dnl Note that space between 'include' and '(' is required. There's a broken + dnl regex in aclocal that otherwise will think that we call m4's include + dnl builtin. + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <limits> +#if __has_include (<cxxabi.h>) +#include <cxxabi.h> +#endif +#if __has_include (<unwind.h>) +#include <unwind.h> +#endif +]])], +[ + AC_MSG_RESULT([yes]) +], +[ + AC_MSG_RESULT([no]) + AC_MSG_ERROR([Selected compiler could not find or parse C++ standard library headers. Rerun with CC=c-compiler CXX=c++-compiler ./configure ...]) +]) + AC_LANG_POP([C++]) +fi + dnl Configure all of the projects present in our source tree. While we could dnl just AC_CONFIG_SUBDIRS on the set of directories in projects that have a dnl configure script, that usage of the AC_CONFIG_SUBDIRS macro is deprecated. |