summaryrefslogtreecommitdiff
path: root/autoconf
diff options
context:
space:
mode:
Diffstat (limited to 'autoconf')
-rw-r--r--autoconf/configure.ac26
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.