From: Stefano Lattarini Date: Sat, 21 May 2011 07:12:06 +0000 (+0200) Subject: test defs: better detection of cross-compile mode X-Git-Tag: ng-0.5a~89^2~233 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f570885382e0a37fc8f2c7fd2e63b5321e0b5612;p=thirdparty%2Fautomake.git 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. --- diff --git a/ChangeLog b/ChangeLog index 3f93d4111..fd23cb9ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2011-05-21 Stefano Lattarini + + 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 testsuite: avoid re-running few tests with 'parallel-tests' option diff --git a/Makefile.in b/Makefile.in index 6494ca09e..951429180 100644 --- a/Makefile.in +++ b/Makefile.in @@ -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@ diff --git a/configure b/configure index e2add32d1..084d8d254 100755 --- 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 diff --git a/configure.ac b/configure.ac index 577541cb4..857177bb0 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/doc/Makefile.in b/doc/Makefile.in index 7bc40a694..193c9fedc 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -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@ diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in index 20b19572b..93cbf395b 100644 --- a/lib/Automake/Makefile.in +++ b/lib/Automake/Makefile.in @@ -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@ diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in index d82bd74bf..8ade0334c 100644 --- a/lib/Automake/tests/Makefile.in +++ b/lib/Automake/tests/Makefile.in @@ -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@ diff --git a/lib/Makefile.in b/lib/Makefile.in index 9195976e9..1f6e5e549 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -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@ diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in index 059ae97c4..e4b0ec28c 100644 --- a/lib/am/Makefile.in +++ b/lib/am/Makefile.in @@ -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@ diff --git a/m4/Makefile.in b/m4/Makefile.in index e50884800..b876b3d2c 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -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@ diff --git a/tests/Makefile.in b/tests/Makefile.in index 87dd62662..711f4cac9 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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@ diff --git a/tests/defs b/tests/defs index e17df6c61..b254ef4bf 100644 --- a/tests/defs +++ b/tests/defs @@ -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 diff --git a/tests/defs-static.in b/tests/defs-static.in index 45f08bfa8..df5072f3c 100644 --- a/tests/defs-static.in +++ b/tests/defs-static.in @@ -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.