Bug 1254861 - Unsupport building with clang < 3.3
--- a/build/autoconf/toolchain.m4
+++ b/build/autoconf/toolchain.m4
@@ -220,16 +220,22 @@ if test "$GNU_CXX"; then
if test "ac_cv_cxx0x_clang_workaround" = "no"; then
AC_MSG_ERROR([Your toolchain does not support C++0x/C++11 mode properly. Please upgrade your toolchain])
fi
elif test "$ac_cv_cxx0x_headers_bug" = "yes"; then
AC_MSG_ERROR([Your toolchain does not support C++0x/C++11 mode properly. Please upgrade your toolchain])
fi
+ if test -n "$CLANG_CC"; then
+ AC_TRY_COMPILE([], [#if !__has_feature(cxx_alignof)
+ #error alignof is not supported
+ #endif],,AC_MSG_ERROR([Only clang/llvm 3.3 or newer supported]))
+ fi
+
AC_CACHE_CHECK([whether 64-bits std::atomic requires -latomic],
ac_cv_needs_atomic,
AC_TRY_LINK(
[#include <cstdint>
#include <atomic>],
[ std::atomic<uint64_t> foo; foo = 1; ],
ac_cv_needs_atomic=no,
_SAVE_LIBS="$LIBS"
@@ -316,16 +322,22 @@ EOF
if test "ac_cv_host_cxx0x_clang_workaround" = "no"; then
AC_MSG_ERROR([Your host toolchain does not support C++0x/C++11 mode properly. Please upgrade your toolchain])
fi
HOST_CXXFLAGS="$CXXFLAGS"
elif test "$ac_cv_host_cxx0x_headers_bug" = "yes"; then
AC_MSG_ERROR([Your host toolchain does not support C++0x/C++11 mode properly. Please upgrade your toolchain])
fi
+ if test "$host_compiler" = CLANG; then
+ AC_TRY_COMPILE([], [#if !__has_feature(cxx_alignof)
+ #error alignof is not supported
+ #endif],,AC_MSG_ERROR([Only clang/llvm 3.3 or newer supported]))
+ fi
+
CXXFLAGS="$_SAVE_CXXFLAGS"
CPPFLAGS="$_SAVE_CPPFLAGS"
CXX="$_SAVE_CXX"
fi
elif test "$GNU_CXX"; then
HOST_CXXFLAGS="$HOST_CXXFLAGS $_ADDED_CXXFLAGS"
fi
AC_LANG_C