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