Bug 1260624 - Move CROSS_COMPILE to moz.configure. r=ted
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 30 Mar 2016 12:43:21 +0900
changeset 291156 dc8b68b4f67a2f2418b5e55f912a5ac5de796ac0
parent 291155 2d041429d9935db8db978c783b05eb65abddd5e4
child 291157 9f566ae2f1c5fc9c16969429cf9793c8465fd76d
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs1260624
milestone48.0a1
Bug 1260624 - Move CROSS_COMPILE to moz.configure. r=ted Note that this removes force-setting cross_compiling to yes in old-configure, which wasn't working because every AC_TRY_COMPILE resets it with $ac_cv_prog_cc_cross or $ac_cv_prog_cxx_cross.
build/autoconf/toolchain.m4
build/moz.configure/init.configure
js/src/old-configure.in
old-configure.in
--- a/build/autoconf/toolchain.m4
+++ b/build/autoconf/toolchain.m4
@@ -178,24 +178,16 @@ AC_PROG_CXX
 
 AC_CHECK_PROGS(RANLIB, "${target_alias}-ranlib" "${target}-ranlib", :)
 AC_CHECK_PROGS(AR, "${target_alias}-ar" "${target}-ar", :)
 AC_CHECK_PROGS(AS, "${target_alias}-as" "${target}-as", :)
 AC_CHECK_PROGS(LD, "${target_alias}-ld" "${target}-ld", :)
 AC_CHECK_PROGS(STRIP, "${target_alias}-strip" "${target}-strip", :)
 AC_CHECK_PROGS(WINDRES, "${target_alias}-windres" "${target}-windres", :)
 AC_CHECK_PROGS(OTOOL, "${target_alias}-otool" "${target}-otool", :)
-AC_DEFINE(CROSS_COMPILE)
-CROSS_COMPILE=1
-
-dnl If we cross compile for ppc on Mac OS X x86, cross_compiling will
-dnl dnl have erroneously been set to "no", because the x86 build host is
-dnl dnl able to run ppc code in a translated environment, making a cross
-dnl dnl compiler appear native.  So we override that here.
-cross_compiling=yes
 ])
 
 AC_DEFUN([MOZ_CXX11],
 [
 dnl Check whether gcc's c++0x mode works
 dnl Updates to the test below should be duplicated further below for the
 dnl cross-compiling case.
 AC_LANG_CPLUSPLUS
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -464,16 +464,26 @@ def host(value, shell):
 @depends('--target', host, shell)
 @checking('for target system type', lambda t: t.alias)
 def target(value, host, shell):
     if not value:
         return host
     return split_triplet(config_sub(shell, value[0]))
 
 
+@depends(host, target)
+@checking('whether cross compiling')
+def cross_compiling(host, target):
+    return host != target
+
+set_config('CROSS_COMPILE', cross_compiling)
+set_define('CROSS_COMPILE', cross_compiling)
+add_old_configure_assignment('CROSS_COMPILE', cross_compiling)
+
+
 # Autoconf needs these set
 @depends(host)
 def host_for_old_configure(host):
     return '--host=%s' % host.alias
 
 add_old_configure_arg(host_for_old_configure)
 
 @depends(host, target)
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -2719,17 +2719,16 @@ OS_LDFLAGS="$LDFLAGS"
 OS_LIBS="$LIBS"
 AC_SUBST(OS_CFLAGS)
 AC_SUBST(OS_CXXFLAGS)
 AC_SUBST(OS_CPPFLAGS)
 AC_SUBST(OS_COMPILE_CFLAGS)
 AC_SUBST(OS_COMPILE_CXXFLAGS)
 AC_SUBST(OS_LDFLAGS)
 AC_SUBST(OS_LIBS)
-AC_SUBST(CROSS_COMPILE)
 
 AC_SUBST(HOST_CC)
 AC_SUBST(HOST_CXX)
 AC_SUBST(HOST_CFLAGS)
 AC_SUBST(HOST_CXXFLAGS)
 AC_SUBST(HOST_LDFLAGS)
 AC_SUBST(HOST_OPTIMIZE_FLAGS)
 AC_SUBST(HOST_AR)
--- a/old-configure.in
+++ b/old-configure.in
@@ -261,25 +261,16 @@ AC_SUBST(OBJCOPY)
 
 dnl ========================================================
 dnl Checks for compilers.
 dnl ========================================================
 
 dnl AR_FLAGS set here so HOST_AR_FLAGS can be set correctly (see bug 538269)
 AR_FLAGS='crs $@'
 
-if test -z "$COMPILE_ENVIRONMENT"; then
-if test "$target" != "$host"; then
-# Assert that we're cross compiling, but don't require a compile toolchain (as
-# MOZ_CROSS_COMPILER does below).
-CROSS_COMPILE=1
-AC_DEFINE(CROSS_COMPILE)
-fi
-fi # !COMPILE_ENVIRONMENT
-
 if test "$COMPILE_ENVIRONMENT"; then
 
 if test "$target" != "$host"; then
     MOZ_CROSS_COMPILER
 else
     AC_PROG_CC
     case "$target" in
     *-mingw*)
@@ -7508,17 +7499,16 @@ OS_LDFLAGS="$LDFLAGS"
 OS_LIBS="$LIBS"
 AC_SUBST(OS_CFLAGS)
 AC_SUBST(OS_CXXFLAGS)
 AC_SUBST(OS_CPPFLAGS)
 AC_SUBST(OS_COMPILE_CFLAGS)
 AC_SUBST(OS_COMPILE_CXXFLAGS)
 AC_SUBST(OS_LDFLAGS)
 AC_SUBST(OS_LIBS)
-AC_SUBST(CROSS_COMPILE)
 AC_SUBST(WCHAR_CFLAGS)
 
 AC_SUBST(HOST_CC)
 AC_SUBST(HOST_CXX)
 AC_SUBST(HOST_CFLAGS)
 AC_SUBST(HOST_CXXFLAGS)
 AC_SUBST(HOST_LDFLAGS)
 AC_SUBST(HOST_OPTIMIZE_FLAGS)