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 | 06358bd07892238ff940ecc8c6d71305731c2bb0 (patch) | |
tree | 29ba898cf17e69cf25832b3575e0218aed7d6c26 /llvm/autoconf | |
parent | 52b1515405c31d8c453488e98ec16140c7863314 (diff) | |
download | bcm5719-llvm-06358bd07892238ff940ecc8c6d71305731c2bb0.tar.gz bcm5719-llvm-06358bd07892238ff940ecc8c6d71305731c2bb0.zip |
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.
llvm-svn: 171975
Diffstat (limited to 'llvm/autoconf')
-rw-r--r-- | llvm/autoconf/configure.ac | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/autoconf/configure.ac b/llvm/autoconf/configure.ac index 102147c4f2c..a1426c1832d 100644 --- a/llvm/autoconf/configure.ac +++ b/llvm/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. |