Bug 1254861 - Unsupport building with clang < 3.3. r=froydnj
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 09 Mar 2016 14:44:21 +0900
changeset 288191 48286284fa92ecab0c87cc331300bb1566f32f9e
parent 288190 57e084bd99c6c5417260658bb6502f850f14392e
child 288192 b8b72c9bfc6ddaca27f2ef4db1b6b58bdfdf6440
push id30075
push usercbook@mozilla.com
push dateFri, 11 Mar 2016 15:51:11 +0000
treeherdermozilla-central@f907faa919be [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1254861
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1254861 - Unsupport building with clang < 3.3. r=froydnj
build/autoconf/toolchain.m4
--- a/build/autoconf/toolchain.m4
+++ b/build/autoconf/toolchain.m4
@@ -220,16 +220,28 @@ 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
+        dnl We'd normally just check for the version from CC_VERSION (fed
+        dnl from __clang_major__ and __clang_minor__), but the clang that
+        dnl comes with Xcode has a completely different version scheme
+        dnl despite exposing the version with the same defines.
+        dnl So instead of a version check, check for one of the C++11
+        dnl features that was added in clang 3.3.
+        AC_TRY_COMPILE([], [#if !__has_feature(cxx_inheriting_constructors)
+                            #error inheriting constructors are 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 +328,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_inheriting_constructors)
+                                #error inheriting constructors are 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