Bug 1254861 - Unsupport building with clang < 3.3 draft
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 09 Mar 2016 14:44:21 +0900
changeset 338929 1951b94e0c675bd8d4d13d81e23f59cd57623d2b
parent 338928 7ff2a814cb84f25d9c207a900ee83c8bc60a394f
child 515883 5f9a63504d52f57c74984636a9ec5b829ffd8668
push id12609
push userbmo:mh+mozilla@glandium.org
push dateThu, 10 Mar 2016 05:47:20 +0000
bugs1254861
milestone48.0a1
Bug 1254861 - Unsupport building with clang < 3.3
build/autoconf/toolchain.m4
--- 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