]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
test defs: better detection of cross-compile mode
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 21 May 2011 07:12:06 +0000 (09:12 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 21 May 2011 07:12:06 +0000 (09:12 +0200)
* configure.ac (AC_CANONICAL_HOST): New, probably not strictly
necessary, but useful to complements AC_CANONICAL_BUILD.
* tests/defs-static.in ($host_alias, $build_alias): New variables,
exported, user-overridable, defaults AC_SUBST'd by configure.
* tests/defs (cross_compiling): Consider cross-compilation mode
active only if `$host_alias' is not empty *and* it differs from
`$build_alias'.  This is more faithful to the way configure
determines whether it is cross-compiling, but still allows the
user to easily force cross-compilation by overriding `host_alias'
and `build_alias' at runtime.

From a report by Ralf Wildenhues.

13 files changed:
ChangeLog
Makefile.in
configure
configure.ac
doc/Makefile.in
lib/Automake/Makefile.in
lib/Automake/tests/Makefile.in
lib/Makefile.in
lib/am/Makefile.in
m4/Makefile.in
tests/Makefile.in
tests/defs
tests/defs-static.in

index 3f93d4111900d6fe7f894ce472f6a0c386a84beb..fd23cb9ef58e1385b4795c1cbcc1abb92ac8fd9b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2011-05-21  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       test defs: better detection of cross-compile mode
+       * configure.ac (AC_CANONICAL_HOST): New, probably not strictly
+       necessary, but useful to complements AC_CANONICAL_BUILD.
+       * tests/defs-static.in ($host_alias, $build_alias): New variables,
+       exported, user-overridable, defaults AC_SUBST'd by configure.
+       * tests/defs (cross_compiling): Consider cross-compilation mode
+       active only if `$host_alias' is not empty *and* it differs from
+       `$build_alias'.  This is more faithful to the way configure
+       determines whether it is cross-compiling, but still allows the
+       user to easily force cross-compilation by overriding `host_alias'
+       and `build_alias' at runtime.
+       From a report by Ralf Wildenhues.
+
 2011-05-20  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        testsuite: avoid re-running few tests with 'parallel-tests' option
index 6494ca09ed167b918ee65c644cdd421b4d3582a7..951429180aeb78b82f4679a02a0deb9913921279 100644 (file)
@@ -49,6 +49,7 @@ NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
+host_triplet = @host@
 subdir = .
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
        $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
@@ -219,7 +220,11 @@ datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
index e2add32d1a4c411f490920b78c93a4d871a9d118..084d8d254beec2a08b4ed464f6246fcc16d3e549 100755 (executable)
--- a/configure
+++ b/configure
@@ -607,6 +607,10 @@ INSTALL_SCRIPT
 INSTALL_PROGRAM
 am_AUTOHEADER
 am_AUTOCONF
+host_os
+host_vendor
+host_cpu
+host
 build_os
 build_vendor
 build_cpu
@@ -1263,6 +1267,7 @@ Program names:
 
 System types:
   --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
 _ACEOF
 fi
 
@@ -1781,6 +1786,40 @@ IFS=$ac_save_IFS
 case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
 
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if ${ac_cv_host+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
 
 # Save the AUTOCONF setting before AM_INIT_AUTOMAKE overrides it; this
 # way we can run Autoconf tests from configure (or from the test
index 577541cb4873f8a6982811a7c1785779f2f92580..857177bb0546dc58b5a8c035cf15ed5952eb3124 100644 (file)
@@ -1,7 +1,8 @@
 # Process this file with autoconf to produce a configure script.
 
 # Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-# 2004, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+# 2004, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
+# Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -24,6 +25,7 @@ m4_ifndef([AC_PACKAGE_URL],
 AC_CONFIG_SRCDIR(automake.in)
 AC_CONFIG_AUX_DIR(lib)
 
+AC_CANONICAL_HOST
 AC_CANONICAL_BUILD
 
 # Save the AUTOCONF setting before AM_INIT_AUTOMAKE overrides it; this
index 7bc40a6942e454448eab1327e46737f0a50d23a6..193c9fedc5565a275bef4412778fe8f0dcd1c43b 100644 (file)
@@ -48,6 +48,7 @@ NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
+host_triplet = @host@
 subdir = doc
 DIST_COMMON = $(automake_TEXINFOS) $(dist_doc_DATA) $(dist_man1_MANS) \
        $(dist_noinst_DATA) $(srcdir)/Makefile.am \
@@ -204,7 +205,11 @@ datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
index 20b19572b1064439cba94401ce1c435b976a41be..93cbf395b5ecd860c09ebb2f5ce2f23ebebab9d6 100644 (file)
@@ -49,6 +49,7 @@ NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
+host_triplet = @host@
 subdir = lib/Automake
 DIST_COMMON = $(dist_perllib_DATA) $(srcdir)/Makefile.am \
        $(srcdir)/Makefile.in
@@ -203,7 +204,11 @@ datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
index d82bd74bfdd5a8eba75af5811380e251262a9702..8ade0334ce9ad6ef7c84fec0a87bb624c17dfaf3 100644 (file)
@@ -48,6 +48,7 @@ NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
+host_triplet = @host@
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
        $(top_srcdir)/CheckListOfTests.am
 subdir = lib/Automake/tests
@@ -253,7 +254,11 @@ datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
index 9195976e963d438bb4415343431169df566e5ccc..1f6e5e54932cc27a239e4434ba1bc2a1c9b6fe9b 100644 (file)
@@ -49,6 +49,7 @@ NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
+host_triplet = @host@
 subdir = lib
 DIST_COMMON = $(dist_pkgvdata_DATA) $(dist_script_DATA) \
        $(srcdir)/Makefile.am $(srcdir)/Makefile.in COPYING INSTALL \
@@ -206,7 +207,11 @@ datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
index 059ae97c42867a829c389b3732bb8f3b101915f2..e4b0ec28ca43ff26ee211e8f048a3358a19c4dac 100644 (file)
@@ -49,6 +49,7 @@ NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
+host_triplet = @host@
 subdir = lib/am
 DIST_COMMON = $(dist_am_DATA) $(srcdir)/Makefile.am \
        $(srcdir)/Makefile.in
@@ -163,7 +164,11 @@ datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
index e5088480008d17fb6f943811d7954a9d8d984041..b876b3d2c3a7db77a46826f50031410cb8498e10 100644 (file)
@@ -49,6 +49,7 @@ NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
+host_triplet = @host@
 subdir = m4
 DIST_COMMON = $(dist_m4data_DATA) $(srcdir)/Makefile.am \
        $(srcdir)/Makefile.in
@@ -163,7 +164,11 @@ datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
index 87dd626620cb031e9a345709e7a564fa562cf3a8..711f4cac9aad339577b5b7971742ac7633abfe7d 100644 (file)
@@ -48,6 +48,7 @@ NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
+host_triplet = @host@
 DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
        $(srcdir)/aclocal.in $(srcdir)/automake.in $(srcdir)/defs \
        $(srcdir)/defs-static.in $(srcdir)/depmod-tests.am \
@@ -264,7 +265,11 @@ datarootdir = @datarootdir@
 docdir = @docdir@
 dvidir = @dvidir@
 exec_prefix = @exec_prefix@
+host = @host@
 host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
 htmldir = @htmldir@
 includedir = @includedir@
 infodir = @infodir@
index e17df6c611d4dd2efd298e1d285d05df5a397003..b254ef4bf9c33d2b4b7ec3ddd7460260950c67b8 100644 (file)
@@ -135,7 +135,7 @@ framework_failure_ () { warn_ "$me: set-up failure: $@"; Exit 99; }
 # tests (or portions of them) that requires a native compiler.
 cross_compiling ()
 {
-  test x"$host_alias" != x
+  test x"$host_alias" != x && test x"$build_alias" != x"$host_alias"
 }
 
 # is_newest FILE FILES
index 45f08bfa87a98a58a1f0797ed63aa3494f7f5dc4..df5072f3c6cf562ed2cc721a992aa3033a8d7ab5 100644 (file)
@@ -83,6 +83,9 @@ testprefix='@prefix@'
 APIVERSION='@APIVERSION@'
 PATH_SEPARATOR='@PATH_SEPARATOR@'
 
+host_alias=${host_alias-'@host_alias@'}; export host_alias
+build_alias=${build_alias-'@build_alias@'}; export build_alias
+
 # Make sure we override the user shell.
 SHELL='@SHELL@'; export SHELL
 # User can override various tools used.