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