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

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

automake 1.7.9

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