Bug 1262781 - Use the host compiler for the ASTMatcher check. r?froydnj draft
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 08 Apr 2016 16:32:42 +0900
changeset 349706 3d858b368b60a69647ae0414cd737f4b2489333e
parent 349705 06516bd560bde9d46f1090725a0b62261bc063b3
child 349707 c238f26a56f29c4ab1e355441fa9c965e7fcb04a
push id15166
push userbmo:mh+mozilla@glandium.org
push dateTue, 12 Apr 2016 04:31:02 +0000
reviewersfroydnj
bugs1262781
milestone48.0a1
Bug 1262781 - Use the host compiler for the ASTMatcher check. r?froydnj The check is for the clang plugin, which is a host library. It is especially important to use the host compiler for this check on OSX-on-Linux cross builds.
build/autoconf/clang-plugin.m4
--- a/build/autoconf/clang-plugin.m4
+++ b/build/autoconf/clang-plugin.m4
@@ -96,21 +96,24 @@ if test -n "$ENABLE_CLANG_PLUGIN"; then
     dnl middle of the 3.8 cycle, our CLANG_VERSION_FULL is impossible to use
     dnl correctly, so we have to detect this at configure time.
     AC_CACHE_CHECK(for new ASTMatcher names,
                    ac_cv_have_new_ASTMatcher_names,
         [
             AC_LANG_SAVE
             AC_LANG_CPLUSPLUS
             _SAVE_CXXFLAGS="$CXXFLAGS"
+            _SAVE_CXX="$CXX"
             CXXFLAGS="${LLVM_CXXFLAGS}"
+            CXX="${HOST_CXX}"
             AC_TRY_COMPILE([#include "clang/ASTMatchers/ASTMatchers.h"],
                            [clang::ast_matchers::cxxConstructExpr();],
                            ac_cv_have_new_ASTMatcher_names="yes",
                            ac_cv_have_new_ASTMatcher_names="no")
+            CXX="$_SAVE_CXX"
             CXXFLAGS="$_SAVE_CXXFLAGS"
             AC_LANG_RESTORE
         ])
     if test "$ac_cv_have_new_ASTMatcher_names" = "yes"; then
       LLVM_CXXFLAGS="$LLVM_CXXFLAGS -DHAVE_NEW_ASTMATCHER_NAMES"
     fi
 
     AC_DEFINE(MOZ_CLANG_PLUGIN)