From: Stefano Lattarini Date: Sun, 15 May 2011 13:35:27 +0000 (+0200) Subject: Merge branch 'maint' X-Git-Tag: ng-0.5a~177 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68e69411324c7d79a5c274977785d4b3cdba910f;p=thirdparty%2Fautomake.git Merge branch 'maint' * maint: testsuite: be more cross-compile friendly --- 68e69411324c7d79a5c274977785d4b3cdba910f diff --cc ChangeLog index ab98c38ef,333e3ab9e..b3a1e7e43 --- a/ChangeLog +++ b/ChangeLog @@@ -1,10 -1,12 +1,19 @@@ + 2011-05-15 Stefano Lattarini + + testsuite: be more cross-compile friendly + * tests/defs.in (cross_compiling): New subroutine. + (am__tool_prefix): New internal variable. + (gcc, g++, gcj): Force the use of the correct "tool prefix" + when cross compiling. + (gfortran, g77, non-cross): New requirements. + +2011-05-15 Stefano Lattarini + + tests: fix portability issues in 'repeated-options.test' + * tests/repeated-options.test: Do not assume that object files + have `.o' suffix and executables have no default suffix; instead, + use `$(OBJEXT)' and `$(EXEEXT)'. + 2011-05-07 Stefano Lattarini tests: fix spurious failure of txinfo21.test on FreeBSD diff --cc tests/defs index 6ee183017,736a3940e..3be8eade1 --- a/tests/defs +++ b/tests/defs @@@ -129,110 -148,23 +129,127 @@@ fail_ () { warn_ "$me: failed test: $@" skip_ () { warn_ "$me: skipped test: $@"; Exit 77; } framework_failure_ () { warn_ "$me: set-up failure: $@"; Exit 99; } + # cross_compiling + # --------------- + # Tell whether we are cross-compiling. This is especially useful to skip + # tests (or portions of them) that requires a native compiler. + cross_compiling () + { + test x"$host_alias" != x + } + +# is_newest FILE FILES +# -------------------- +# Return false if any file in FILES is newer than FILE. +# Resolve ties in favor of FILE. +is_newest () +{ + is_newest_files=`find "$@" -newer "$1"` + test -z "$is_newest_files" +} + +# AUTOMAKE_run status [options...] +# -------------------------------- +# Run Automake with OPTIONS, and fail if automake +# does not exit with STATUS. +AUTOMAKE_run () +{ + expected_exitcode=$1 + shift + exitcode=0 + $AUTOMAKE ${1+"$@"} >stdout 2>stderr || exitcode=$? + cat stderr >&2 + cat stdout + test $exitcode = $expected_exitcode || Exit 1 +} + +# AUTOMAKE_fails [options...] +# --------------------------- +# Run Automake with OPTIONS, and fail if automake +# does not exit with STATUS. +AUTOMAKE_fails () +{ + AUTOMAKE_run 1 ${1+"$@"} +} + +# using_gmake +# ----------- +# Return success if $MAKE is GNU make, return failure otherwise. +# Caches the result for speed reasons. +using_gmake () +{ + case $am__using_gmake in + yes) + return 0;; + no) + return 1;; + '') + # Use --version AND -v, because SGI Make doesn't fail on --version. + # Also grep for GNU because newer versions of FreeBSD make do + # not complain about `--version' (they seem to silently ignore it). + if $MAKE --version -v | grep GNU; then + am__using_gmake=yes + return 0 + else + am__using_gmake=no + return 1 + fi;; + *) + echo "invalid value for \$am__using_gmake: '$am__using_gmake'" >&2 + Exit 99;; + esac +} + +commented_sed_unindent_prog=' + /^$/b # Nothing to do for empty lines. + x # Get x into pattern space. + /^$/{ # No prior x, go prepare it. + g # Copy this 1st non-blank line into pattern space. + s/^\(['"$tab"' ]*\).*/x\1/ # Prepare x in pattern space. + } # Now: x in pattern and in hold. + G # Build x\n in pattern space, and + h # duplicate it into hold space. + s/\n.*$// # Restore x in pattern space, and + x # exchange with the above duplicate in hold space. + s/^x\(.*\)\n\1// # Remove leading from . + s/^x.*\n// # Restore when there is no leading . +' + +# unindent [input files...] +# ------------------------- +# Remove the "proper" amount of leading whitespace from the given files, +# and output the result on stdout. That amount is determined by looking +# at the leading whitespace of the first non-blank line in the input +# files. If no input file is specified, standard input is implied. +unindent () +{ + if test x"$sed_unindent_prog" = x; then + sed_unindent_prog=`printf '%s\n' "$commented_sed_unindent_prog" | sed -e "s/ *# .*//"` + fi + sed "$sed_unindent_prog" ${1+"$@"} +} +sed_unindent_prog="" # Avoid interferences from the environment. + + +## ----------------------------------------------------------- ## +## Checks for required tools, and additional setups (if any) ## +## required by them. ## +## ----------------------------------------------------------- ## + +# Print it here, so that the user will see it also if the test +# will be skipped due to some tool missing in $PATH itself. +echo "$PATH" + + # So that we can force the use of correct gcc, g++ etc., consistently + # with cross-compilation settings. + if cross_compiling; then + am__tool_prefix="$host_alias-" + else + am__tool_prefix= + fi + +# Look for (and maybe set up) required tools and/or system features; skip +# the current test if they are not found. for tool in : $required do # Check that each required tool is present. @@@ -274,29 -212,48 +291,53 @@@ # always use it. This is important only when the user # has defined CC in his environment, otherwise ./configure will # prefer gcc to other compilers. - CC=gcc + CC=${am__tool_prefix}gcc export CC echo "$me: running $CC --version" - ( $CC --version ) || exit 77 + $CC --version || exit 77 + echo "$me: running $CC -v" + $CC -v || exit 77 ;; gcj) - GCJ=gcj + GCJ=${am__tool_prefix}gcj export GCJ echo "$me: running $GCJ --version" - ( $GCJ --version ) || exit 77 - ( $GCJ -v ) || exit 77 + $GCJ --version || exit 77 + echo "$me: running $GCJ -v" + $GCJ -v || exit 77 ;; g++) - CXX=g++ + CXX=${am__tool_prefix}g++ export CXX echo "$me: running $CXX --version" - ( $CXX --version ) || exit 77 + $CXX --version || exit 77 + echo "$me: running $CXX -v" + $CXX -v || exit 77 ;; + gfortran) + FC=${am__tool_prefix}gfortran + export FC + echo "$me: running $FC --version" + $FC --version || skip_ "GNU Fortran compiler not available" + echo "$me: running $FC -v" + $FC -v || skip_ "botched installation for GNU Fortran compiler" + case " $required " in + *\ g77\ *) ;; + *) F77=$FC; export F77;; + esac + ;; + g77) + F77=${am__tool_prefix}g77 + export F77 + echo "$me: running $F77 --version" + $F77 --version || skip_ "GNU Fortran 77 compiler not available" + echo "$me: running $F77 -v" + $F77 -v || skip_ "botched installation for GNU Fortran 77 compiler" + case " $required " in + *\ gfortran\ *) ;; + *) FC=$F77; export FC;; + esac + ;; icc) CC=icc export CC @@@ -333,18 -290,11 +374,21 @@@ (echo foo >> $priv_check_temp) >/dev/null 2>&1 overwrite_status=$? rm -f $priv_check_temp - test $overwrite_status = 0 && exit 77 + if test $overwrite_status -eq 0; then + echo "$me: cannot drop file write permissions" >&2 + exit 77 + fi + unset priv_check_temp overwrite_status + ;; + perl-threads) + if test "$WANT_NO_THREADS" = "yes"; then + echo "$me: skip with Devel::Cover: cannot cope with threads" >&2 + exit 77 + fi ;; + non-cross) + cross_compiling && skip_ "doesn't work in cross-compile mode" + ;; python) # Python doesn't support --version, it has -V echo "$me: running python -V"