source: trunk/essentials/sys-devel/automake-1.8/tests/defs.in

Last change on this file was 3118, checked in by bird, 18 years ago

automake 1.8.5

File size: 10.0 KB
Line 
1# -*- shell-script -*-
2# @configure_input@
3#
4# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
5# Free Software Foundation, Inc.
6#
7# This file is part of GNU Automake.
8#
9# GNU Automake is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation; either version 2, or (at your option)
12# any later version.
13#
14# GNU Automake is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with autoconf; see the file COPYING. If not, write to
21# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22# Boston, MA 02111-1307, USA.
23
24# Defines for Automake testing environment.
25# Tom Tromey <tromey@cygnus.com>
26
27# Be Bourne compatible.
28# (Snippet copied from configure's initialization in Autoconf 2.57.)
29if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
30 emulate sh
31 NULLCMD=:
32 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
33 # is contrary to our usage. Disable this feature.
34 alias -g '${1+"$@"}'='"$@"'
35elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
36 set -o posix
37fi
38
39# Ensure we are running from the right directory.
40test -f ./defs || {
41 echo "defs: not found in current directory" 1>&2
42 exit 1
43}
44
45# If srcdir is not set, then we are not running from `make check', be verbose.
46if test -z "$srcdir"; then
47 test -z "$VERBOSE" && VERBOSE=x
48 # compute $srcdir.
49 srcdir=`echo "$0" | sed -e 's,/[^\\/]*$,,'`
50 test $srcdir = $0 && srcdir=.
51fi
52
53# Ensure $srcdir is set correctly.
54test -f $srcdir/defs.in || {
55 echo "$srcdir/defs.in not found, check \$srcdir" 1>&2
56 exit 1
57}
58
59me=`echo "$0" | sed -e 's,.*[\\/],,;s/\.test$//'`
60
61# See how redirections should work. User can set VERBOSE to see all
62# output.
63test -z "$VERBOSE" && {
64 exec > /dev/null 2>&1
65}
66
67# Make sure we override the user shell.
68SHELL='@SHELL@'
69export SHELL
70# User can override various tools used.
71test -z "$PERL" && PERL='@PERL@'
72test -z "$MAKE" && MAKE=make
73test -z "$AUTOCONF" && AUTOCONF="@AUTOCONF@"
74test -z "$AUTOHEADER" && AUTOHEADER="@AUTOHEADER@"
75test -z "$AUTOUPDATE" && AUTOUPDATE=autoupdate
76test -z "$MISSING" && MISSING=`pwd`/../lib/missing
77test -z "$ACLOCAL" && ACLOCAL="aclocal-@APIVERSION@"
78# See how Automake should be run. We put --foreign as the default
79# strictness to avoid having to create lots and lots of files. A test
80# can override this by specifying a different strictness. Use -Wall
81# -Werror by default. Tests for which this is inappropriate
82# (e.g. when testing that a warning is enabled by a specific switch)
83# should use -Wnone or/and -Wno-error
84test -z "$AUTOMAKE" && AUTOMAKE="automake-@APIVERSION@ --foreign -Werror -Wall"
85
86PATH="`pwd`@PATH_SEPARATOR@$PATH"
87echo $PATH
88
89if test -n "$required"
90then
91 for tool in $required
92 do
93 # Check that each required tool is present.
94 case $tool in
95 bison)
96 # Since bison is required, we pick YACC for ./configure.
97 YACC='bison -y'
98 export YACC
99 echo "$me: running bison --version"
100 ( bison --version ) || exit 77
101 ;;
102 bzip2)
103 # Do not use --version, bzip2 still tries to compress stdin.
104 echo "$me: running bzip2 --help"
105 ( bzip2 --help ) || exit 77
106 ;;
107 etags)
108 # Exuberant Ctags will create a TAGS file even
109 # when asked for --help or --version. (Emacs's etags
110 # does not have such problem.) Use -o /dev/null
111 # to make sure we do not pollute the tests/ directory.
112 echo "$me: running etags --version -o /dev/null"
113 ( etags --version -o /dev/null ) || exit 77
114 ;;
115 GNUmake)
116 # Use --version AND -v, because SGI Make doesn't fail on --version.
117 # Also grep for GNU because newer versions of FreeBSD make do
118 # not complain about `--version' (they seem to silently ignore it).
119 echo "$me: running $MAKE --version -v | grep GNU"
120 ( $MAKE --version -v | grep GNU ) || exit 77
121 ;;
122 gcc)
123 # When gcc is required, export `CC=gcc' so that ./configure
124 # always use it. This is important only when the user
125 # has defined CC in his environment, otherwise ./configure will
126 # prefer gcc to other compilers.
127 CC=gcc
128 export CC
129 echo "$me: running $CC --version"
130 ( $CC --version ) || exit 77
131 ;;
132 g++)
133 CXX=g++
134 export CXX
135 echo "$me: running $CXX --version"
136 ( $CXX --version ) || exit 77
137 ;;
138 icc)
139 CC=icc
140 export CC
141 # There is no way to ask *only* the compiler's version.
142 # This tool always want to do something (by default
143 # it will try link *nothing* and complain it cannot find
144 # main(); funny). -dryrun is a workaround.
145 echo "$me: running $CC -V -dryrun"
146 ( $CC -V -dryrun ) || exit 77
147 ;;
148 makedepend)
149 echo "$me: running makedepend -f-"
150 ( makedepend -f- ) || exit 77
151 ;;
152 makeinfo-html)
153 # Make sure makeinfo understands --html.
154 echo "$me: running makeinfo --html --version"
155 ( makeinfo --html --version ) || exit 77
156 ;;
157 non-root)
158 # Skip this test case if the user is root.
159 # We try to append to a read-only file to detect this.
160 priv_check_temp=priv-check.$$
161 touch $priv_check_temp || exit 1
162 chmod a-w $priv_check_temp || exit 1
163 (echo foo >> $priv_check_temp) >/dev/null 2>&1
164 overwrite_status=$?
165 rm -f $priv_check_temp
166 test $overwrite_status = 0 && exit 77
167 ;;
168 python)
169 # Python doesn't support --version, it has -V
170 echo "$me: running python -V"
171 ( python -V ) || exit 77
172 ;;
173 ro-dir)
174 # Skip this test case if read-only directories aren't supported
175 # (e.g., under DOS.)
176 ro_dir_temp=ro_dir.$$
177 mkdir $ro_dir_temp || exit 1
178 chmod a-w $ro_dir_temp || exit 1
179 (: > $ro_dir_temp/probe) >/dev/null 2>/dev/null
180 create_status=$?
181 rm -rf $ro_dir_temp
182 test $create_status = 0 && exit 77
183 ;;
184 runtest)
185 # DejaGnu's runtest program. We rely on being able to specify
186 # the program on the runtest command-line. This requires
187 # DejaGnu 1.4.3 or later.
188 echo "$me: running runtest --version"
189 (runtest SOMEPROGRAM=someprogram --version) || exit 77
190 ;;
191 tex)
192 # No all versions of Tex support `--version', so we use
193 # a configure check.
194 test -n "@TEX@" || exit 77
195 ;;
196 texi2dvi-o)
197 # Texi2dvi supports `-o' since Texinfo 4.1.
198 echo "$me: running texi2dvi -o /dev/null --version"
199 ( texi2dvi -o /dev/null --version ) || exit 77
200 ;;
201 # Generic case: the tool must support --version.
202 *)
203 echo "$me: running $tool --version"
204 ( $tool --version ) || exit 77
205 ;;
206 esac
207 # Additional variables to define if some $tool is required.
208 case $tool in
209 gcc)
210 ;;
211 esac
212 done
213fi
214
215# Always use an absolute srcdir. Otherwise symlinks made in subdirs
216# of the test dir just won't work.
217case "$srcdir" in
218 [\\/]* | ?:[\\/]*)
219 ;;
220
221 *)
222 srcdir=`CDPATH=: && cd "$srcdir" && pwd`
223 ;;
224esac
225
226chmod -R a+rwx testSubDir > /dev/null 2>&1
227rm -rf testSubDir > /dev/null 2>&1
228mkdir testSubDir
229
230# Copy in some files we need.
231for file in install-sh missing depcomp; do
232 cp $srcdir/../lib/$file testSubDir/$file || exit 1
233done
234
235cd ./testSubDir
236
237# Build appropriate environment in test directory. Eg create
238# configure.in, touch all necessary files, etc.
239# Don't use AC_OUTPUT, but AC_CONFIG_FILES so that appending
240# still produces a valid configure.ac. But then, tests running
241# config.status really need to append AC_OUTPUT.
242cat > configure.in << END
243AC_INIT([$me], [1.0])
244AM_INIT_AUTOMAKE
245AC_CONFIG_FILES([Makefile])
246END
247
248# Unset some MAKE... variables that may cause $MAKE to act like a
249# recursively invoked sub-make. Any $MAKE invocation in a test is
250# conceptually an independent invocation, not part of the main
251# 'automake' build.
252unset MFLAGS
253unset MAKEFLAGS
254unset MAKELEVEL
255unset DESTDIR
256
257echo "=== Running test $0"
258
259# We might need extra macros, e.g., from Libtool or Gettext.
260# Find them on the system.
261# Use `-I $srcdir/../m4' in addition to `--acdir=$srcdir/../m4', because the
262# other `-I' directories added for libtool and gettext might contain
263# files from an old version of Automake that we don't want to use.
264aclocaldir='@prefix@/share/aclocal'
265extra_includes=""
266if [ -f $aclocaldir/dirlist ] ; then
267 extra_includes=`(tmp_inc=""
268 while read LINE ; do
269 tmp_inc="$tmp_inc -I $LINE"
270 done
271 echo $tmp_inc) < $aclocaldir/dirlist`
272fi
273case $required in
274 *libtool* )
275 libtool_found=no
276 for d in $extra_includes $aclocaldir ; do
277 if [ "x$d" != "x-I" ] && [ -f "$d/libtool.m4" ] ; then
278 libtool_found=yes
279 fi
280 done
281 test "x$libtool_found" = "xyes" || exit 77
282 ACLOCAL="$ACLOCAL -I $srcdir/../m4 $extra_includes -I $aclocaldir"
283 ;;
284 *gettext* )
285 gettext_found=no
286 for d in $extra_includes $aclocaldir ; do
287 if [ "x$d" != "x-I" ] && [ -f "$d/gettext.m4" ] ; then
288 gettext_found=yes
289 fi
290 done
291 test "x$gettext_found" = "xyes" || exit 77
292 ACLOCAL="$ACLOCAL -I $srcdir/../m4 $extra_includes -I $aclocaldir"
293 ;;
294esac
295
296# POSIX no longer requires 'egrep' and 'fgrep',
297# but some hosts lack 'grep -E' and 'grep -F'.
298EGREP='@EGREP@'
299FGREP='@FGREP@'
300
301# The amount we should wait after modifying files depends on the platform.
302# For instance, Windows '95, '98 and ME have 2-second granularity
303# and can be up to 3 seconds in the future w.r.t. the system clock.
304sleep='sleep @MODIFICATION_DELAY@'
305
306# The tests call `make -e' but we do not want $srcdir from the environment
307# to override the definition from the Makefile.
308testsrcdir=$srcdir
309unset srcdir
310
311# AUTOMAKE_run status [options...]
312# --------------------------------
313# Run Automake with OPTIONS, and fail if automake
314# does not exit with STATUS.
315AUTOMAKE_run ()
316{
317 expected_exitcode=$1
318 shift
319 exitcode=0
320 $AUTOMAKE ${1+"$@"} 2>stderr >stdout || exitcode=$?
321 cat stderr
322 cat stdout
323 test $exitcode = $expected_exitcode || exit 1
324}
325
326# AUTOMAKE_fails [options...]
327# ---------------------------
328# Run Automake with OPTIONS, and fail if automake
329# does not exit with STATUS.
330AUTOMAKE_fails ()
331{
332 AUTOMAKE_run 1 ${1+"$@"}
333}
334
335# Turn on shell traces when VERBOSE=x.
336if test "x$VERBOSE" = xx; then
337 set -x
338else
339 :
340fi
341pwd
Note: See TracBrowser for help on using the repository browser.