419 lines
13 KiB
Bash
419 lines
13 KiB
Bash
# -*- shell-script -*-
|
|
# tests/defs. Generated from defs.in by configure.
|
|
#
|
|
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
|
# 2005, 2006, 2007, 2008, 2009 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
|
|
# the Free Software Foundation; either version 2, or (at your option)
|
|
# any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
# Defines for Automake testing environment.
|
|
# Tom Tromey <tromey@cygnus.com>
|
|
|
|
# Be Bourne compatible.
|
|
# (Snippet copied from configure's initialization in Autoconf 2.59c.)
|
|
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
|
emulate sh
|
|
NULLCMD=:
|
|
# Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
|
|
# is contrary to our usage. Disable this feature.
|
|
alias -g '${1+"$@"}'='"$@"'
|
|
else
|
|
case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
|
|
fi
|
|
BIN_SH=xpg4; export BIN_SH # for Tru64
|
|
DUALCASE=1; export DUALCASE # for MKS sh
|
|
|
|
# Ensure we are running from the right directory.
|
|
test -f ./defs || {
|
|
echo "defs: not found in current directory" 1>&2
|
|
exit 1
|
|
}
|
|
|
|
if test -z "$srcdir"; then
|
|
# compute $srcdir.
|
|
srcdir=`echo "$0" | sed -e 's,/[^\\/]*$,,'`
|
|
test "$srcdir" = $0 && srcdir=.
|
|
else :; fi
|
|
|
|
# Ensure $srcdir is set correctly.
|
|
test -f "$srcdir/defs.in" || {
|
|
echo "$srcdir/defs.in not found, check \$srcdir" 1>&2
|
|
exit 1
|
|
}
|
|
|
|
me=`echo "$0" | sed -e 's,.*[\\/],,;s/\.test$//'`
|
|
|
|
# Make sure we override the user shell.
|
|
SHELL='/bin/bash'
|
|
export SHELL
|
|
# User can override various tools used.
|
|
test -z "$PERL" && PERL='/usr/bin/perl'
|
|
test -z "$MAKE" && MAKE=make
|
|
test -z "$AUTOCONF" && AUTOCONF="autoconf"
|
|
test -z "$AUTOHEADER" && AUTOHEADER="autoheader"
|
|
test -z "$AUTOUPDATE" && AUTOUPDATE=autoupdate
|
|
test -z "$MISSING" && MISSING=`pwd`/../lib/missing
|
|
# Use -Werror because this also turns some Perl warnings into error.
|
|
# (Tests for which this is inappropriate should use -Wno-error.)
|
|
test -z "$ACLOCAL" && ACLOCAL="aclocal-1.11 -Werror"
|
|
# Extra flags to pass to aclocal before all other flags added by this script.
|
|
ACLOCAL_TESTSUITE_FLAGS=
|
|
export ACLOCAL_TESTSUITE_FLAGS
|
|
|
|
# See how Automake should be run. We put --foreign as the default
|
|
# strictness to avoid having to create lots and lots of files. A test
|
|
# can override this by specifying a different strictness. Use -Wall
|
|
# -Werror by default. Tests for which this is inappropriate
|
|
# (e.g. when testing that a warning is enabled by a specific switch)
|
|
# should use -Wnone or/and -Wno-error
|
|
test -z "$AUTOMAKE" && AUTOMAKE="automake-1.11 --foreign -Werror -Wall"
|
|
|
|
PATH="`pwd`:$PATH"
|
|
echo "$PATH"
|
|
# Some shells forget to export modified environment variables.
|
|
# (See note about `export' in the Autoconf manual.)
|
|
export PATH
|
|
|
|
for tool in : $required
|
|
do
|
|
# Check that each required tool is present.
|
|
case $tool in
|
|
:) ;;
|
|
bison)
|
|
# Since bison is required, we pick YACC for ./configure.
|
|
YACC='bison -y'
|
|
export YACC
|
|
echo "$me: running bison --version"
|
|
( bison --version ) || exit 77
|
|
;;
|
|
bzip2)
|
|
# Do not use --version, bzip2 still tries to compress stdin.
|
|
echo "$me: running bzip2 --help"
|
|
( bzip2 --help ) || exit 77
|
|
;;
|
|
etags)
|
|
# Exuberant Ctags will create a TAGS file even
|
|
# when asked for --help or --version. (Emacs's etags
|
|
# does not have such problem.) Use -o /dev/null
|
|
# to make sure we do not pollute the tests/ directory.
|
|
echo "$me: running etags --version -o /dev/null"
|
|
( etags --version -o /dev/null ) || exit 77
|
|
;;
|
|
GNUmake)
|
|
# 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).
|
|
echo "$me: running $MAKE --version -v | grep GNU"
|
|
( $MAKE --version -v | grep GNU ) || exit 77
|
|
;;
|
|
gcc)
|
|
# When gcc is required, export `CC=gcc' so that ./configure
|
|
# 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
|
|
export CC
|
|
echo "$me: running $CC --version"
|
|
( $CC --version ) || exit 77
|
|
;;
|
|
gcj)
|
|
GCJ=gcj
|
|
export GCJ
|
|
echo "$me: running $GCJ --version"
|
|
( $GCJ --version ) || exit 77
|
|
( $GCJ -v ) || exit 77
|
|
;;
|
|
g++)
|
|
CXX=g++
|
|
export CXX
|
|
echo "$me: running $CXX --version"
|
|
( $CXX --version ) || exit 77
|
|
;;
|
|
icc)
|
|
CC=icc
|
|
export CC
|
|
# There is no way to ask *only* the compiler's version.
|
|
# This tool always wants to do something (by default
|
|
# it will try link *nothing* and complain it cannot find
|
|
# main(); funny). Use -help so it does not try linking anything.
|
|
echo "$me: running $CC -V -help"
|
|
( $CC -V -help ) || exit 77
|
|
;;
|
|
makedepend)
|
|
echo "$me: running makedepend -f-"
|
|
( makedepend -f- ) || exit 77
|
|
;;
|
|
makeinfo-html)
|
|
# Make sure makeinfo understands --html.
|
|
echo "$me: running makeinfo --html --version"
|
|
( makeinfo --html --version ) || exit 77
|
|
;;
|
|
non-root)
|
|
# Skip this test case if the user is root.
|
|
# We try to append to a read-only file to detect this.
|
|
priv_check_temp=priv-check.$$
|
|
touch $priv_check_temp || exit 1
|
|
chmod a-w $priv_check_temp || exit 1
|
|
(echo foo >> $priv_check_temp) >/dev/null 2>&1
|
|
overwrite_status=$?
|
|
rm -f $priv_check_temp
|
|
test $overwrite_status = 0 && exit 77
|
|
;;
|
|
python)
|
|
# Python doesn't support --version, it has -V
|
|
echo "$me: running python -V"
|
|
( python -V ) || exit 77
|
|
;;
|
|
ro-dir)
|
|
# Skip this test case if read-only directories aren't supported
|
|
# (e.g., under DOS.)
|
|
ro_dir_temp=ro_dir.$$
|
|
mkdir $ro_dir_temp || exit 1
|
|
chmod a-w $ro_dir_temp || exit 1
|
|
(: > $ro_dir_temp/probe) >/dev/null 2>/dev/null
|
|
create_status=$?
|
|
rm -rf $ro_dir_temp
|
|
test $create_status = 0 && exit 77
|
|
;;
|
|
rst2html)
|
|
# Try the variants that are tried in check.am.
|
|
while :; do
|
|
for r2h in $RST2HTML rst2html rst2html.py; do
|
|
echo "$me: running $r2h --version"
|
|
$r2h --version && break 2
|
|
done
|
|
exit 77
|
|
done
|
|
;;
|
|
runtest)
|
|
# DejaGnu's runtest program. We rely on being able to specify
|
|
# the program on the runtest command-line. This requires
|
|
# DejaGnu 1.4.3 or later.
|
|
echo "$me: running runtest --version"
|
|
(runtest SOMEPROGRAM=someprogram --version) || exit 77
|
|
;;
|
|
tex)
|
|
# No all versions of Tex support `--version', so we use
|
|
# a configure check.
|
|
test -n "tex" || exit 77
|
|
;;
|
|
texi2dvi-o)
|
|
# Texi2dvi supports `-o' since Texinfo 4.1.
|
|
echo "$me: running texi2dvi -o /dev/null --version"
|
|
( texi2dvi -o /dev/null --version ) || exit 77
|
|
;;
|
|
# Generic case: the tool must support --version.
|
|
*)
|
|
echo "$me: running $tool --version"
|
|
( $tool --version ) || exit 77
|
|
;;
|
|
esac
|
|
done
|
|
|
|
|
|
# Always use an absolute srcdir. Otherwise symlinks made in subdirs
|
|
# of the test dir just won't work.
|
|
case "$srcdir" in
|
|
[\\/]* | ?:[\\/]*)
|
|
;;
|
|
|
|
*)
|
|
srcdir=`CDPATH=: && cd "$srcdir" && pwd`
|
|
;;
|
|
esac
|
|
|
|
# We use a trap below for cleanup. This requires us to go through
|
|
# hoops to get the right exit status transported through the signal.
|
|
# So use `Exit STATUS' instead of `exit STATUS' inside of the tests.
|
|
# Turn off errexit here so that we don't trip the bug with OSF1/Tru64
|
|
# sh inside this function.
|
|
Exit ()
|
|
{
|
|
set +e
|
|
(exit $1)
|
|
exit $1
|
|
}
|
|
|
|
curdir=`pwd`
|
|
testSubDir=$me.dir
|
|
chmod -R u+rwx $testSubDir > /dev/null 2>&1
|
|
rm -rf $testSubDir > /dev/null 2>&1
|
|
mkdir $testSubDir
|
|
|
|
sh_errexit_works=yes
|
|
if test "$sh_errexit_works" = yes; then
|
|
trap 'exit_status=$?
|
|
cd "$curdir"
|
|
case $exit_status,$keep_testdirs in
|
|
0,)
|
|
chmod -R a+rwx $testSubDir > /dev/null 2>&1
|
|
rm -rf "$testSubDir" ;;
|
|
esac
|
|
test "$signal" != 0 &&
|
|
echo "$as_me: caught signal $signal"
|
|
echo "$as_me: exit $exit_status"
|
|
exit $exit_status
|
|
' 0
|
|
for signal in 1 2 13 15; do
|
|
trap 'signal='$signal'; { Exit 1; }' $signal
|
|
done
|
|
fi
|
|
signal=0
|
|
|
|
# Copy in some files we need.
|
|
for file in install-sh missing depcomp; do
|
|
cp "$srcdir/../lib/$file" "$testSubDir/$file" || Exit 1
|
|
done
|
|
|
|
cd ./$testSubDir
|
|
|
|
# Build appropriate environment in test directory. Eg create
|
|
# configure.in, touch all necessary files, etc.
|
|
# Don't use AC_OUTPUT, but AC_CONFIG_FILES so that appending
|
|
# still produces a valid configure.ac. But then, tests running
|
|
# config.status really need to append AC_OUTPUT.
|
|
cat > configure.in << END
|
|
AC_INIT([$me], [1.0])
|
|
AM_INIT_AUTOMAKE
|
|
AC_CONFIG_FILES([Makefile])
|
|
END
|
|
|
|
# Unset some MAKE... variables that may cause $MAKE to act like a
|
|
# recursively invoked sub-make. Any $MAKE invocation in a test is
|
|
# conceptually an independent invocation, not part of the main
|
|
# 'automake' build.
|
|
unset MFLAGS
|
|
unset MAKEFLAGS
|
|
unset MAKELEVEL
|
|
unset DESTDIR
|
|
# Unset verbosity flag.
|
|
unset V
|
|
# Also unset variables that control our test driver. While not
|
|
# conceptually independent, they cause some changed semantics we
|
|
# need to control (and test for) in some of the tests to ensure
|
|
# backward-compatible behavior.
|
|
unset DISABLE_HARD_ERRORS
|
|
unset TESTS
|
|
unset TEST_LOGS
|
|
unset RECHECK_LOGS
|
|
unset VERBOSE
|
|
|
|
echo "=== Running test $0"
|
|
|
|
# We might need extra macros, e.g., from Libtool or Gettext.
|
|
# Find them on the system.
|
|
# Use `-I $srcdir/../m4' in addition to `--acdir=$srcdir/../m4', because the
|
|
# other `-I' directories added for libtool and gettext might contain
|
|
# files from an old version of Automake that we don't want to use.
|
|
# Use `-Wno-syntax' because we do not want our test suite to fail because
|
|
# some third-party .m4 file is underquoted.
|
|
case $required in
|
|
*libtool* | *gettext* )
|
|
aclocaldir='/usr/local/share/aclocal'
|
|
extra_includes=""
|
|
if test -f $aclocaldir/dirlist; then
|
|
extra_includes=`
|
|
<$aclocaldir/dirlist \
|
|
sed 's/#.*//;s/[ ][ ]*$//g' \
|
|
| while read dir; do test ! -d "$dir" || echo "-I $dir"; done`
|
|
else :; fi
|
|
|
|
libtool_found=no
|
|
gettext_found=no
|
|
for d in $extra_includes $aclocaldir ; do
|
|
test "x$d" != x-I || continue
|
|
if test -f "$d/libtool.m4"; then
|
|
libtool_found=yes
|
|
fi
|
|
if test -f "$d/gettext.m4"; then
|
|
gettext_found=yes
|
|
fi
|
|
done
|
|
case $required in
|
|
*libtool* ) test $libtool_found = yes || Exit 77 ;;
|
|
*gettext* ) test $gettext_found = yes || Exit 77 ;;
|
|
esac
|
|
# Libtool cannot cope with spaces in the build tree. Our testsuite setup
|
|
# cannot cope with spaces in the source tree name for Libtool and gettext
|
|
# tests.
|
|
case $srcdir,`pwd` in
|
|
*\ * | *\ *) Exit 77 ;;
|
|
esac
|
|
ACLOCAL="$ACLOCAL -Wno-syntax -I $srcdir/../m4 $extra_includes -I $aclocaldir"
|
|
;;
|
|
esac
|
|
|
|
testaclocaldir='/opt/automake-1.11/m4'
|
|
|
|
# POSIX no longer requires 'egrep' and 'fgrep',
|
|
# but some hosts lack 'grep -E' and 'grep -F'.
|
|
EGREP='/bin/grep -E'
|
|
FGREP='/bin/grep -F'
|
|
|
|
# The amount we should wait after modifying files depends on the platform.
|
|
# For instance, Windows '95, '98 and ME have 2-second granularity
|
|
# and can be up to 3 seconds in the future w.r.t. the system clock.
|
|
sleep='sleep 2'
|
|
|
|
# The tests call `make -e' but we do not want $srcdir from the environment
|
|
# to override the definition from the Makefile.
|
|
testsrcdir=$srcdir
|
|
unset srcdir
|
|
|
|
# An old timestamp that can be given to a file, in "touch -t" format.
|
|
# The time stamp should be portable to all file systems of interest.
|
|
# Just for fun, choose the exact time of the announcement of the GNU project
|
|
# in UTC; see <http://www.gnu.org/gnu/initial-announcement.html>.
|
|
old_timestamp=198309271735.59
|
|
|
|
# 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+"$@"}
|
|
}
|
|
|
|
# Turn on shell traces.
|
|
set -x
|
|
|
|
pwd
|