am-ft: make the environment available earlier
[platform/upstream/automake.git] / t / get-sysconf.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2013 Free Software Foundation, Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # Dummy test case, aimed at reporting useful system information in the
18 # final 'test-suite.log'.  This way, if a user experiences a failure in
19 # the Automake test suite and then only sends us the 'test-suite.log',
20 # we won't have to ask him for more information to start analyzing the
21 # failure (that had happened too many times in the past!).
22
23 . test-init.sh
24
25 st=0
26 if test -d "$am_top_srcdir"/.git; then
27   # We are running from a git checkout.
28   (cd "$am_top_srcdir" && git log -1) || st=1
29 elif test -f "$am_top_srcdir"/ChangeLog; then
30   # We are probably running from a distribution tarball.
31   awk '
32     BEGIN { first = 1 }
33     (first == 1) { print; first = 0; next; }
34     /^[^\t]/ { exit(0); }
35     { print }
36   ' "$am_top_srcdir"/ChangeLog || st=1
37 else
38   # Some non-common but possibly valid setup (see for example the Homebrew
39   # problem reported in automake bug#10866); so just give an harmless
40   # warning instead of failing.
41   warn_ "no .git directory nor ChangeLog file found, some info won't" \
42         "be available"
43 fi
44 $PERL -V || st=1
45 # It's OK for the user not to have the TAP::Parser module; this can
46 # happen with older perl installation, or on MinGW/MSYS.
47 $PERL -e 'use TAP::Parser; print $TAP::Parser::VERSION, "\n"' || :
48
49 # It's OK if the selected Lex and Yacc programs don't know how to print
50 # the version number or the help screen; those are usually available only
51 # for Flex and Bison.
52 $LEX --version || :
53 $LEX --help || :
54 $YACC --version || :
55 $YACC --help || :
56
57 cat "$am_top_builddir/config.log" || st=1
58 cat "$am_top_builddir/t/wrap/aclocal-$APIVERSION" || st=1
59 cat "$am_top_builddir/t/wrap/automake-$APIVERSION" || st=1
60
61 if test $st -eq 0; then
62   # This test SKIPs, so that all the information it has gathered and
63   # printed will get unconditionally copied into the 'test-suite.log'
64   # file.
65   exit 77
66 fi
67
68 # Some unexpected error occurred; this must be reported as an hard
69 # error by the testsuite driver.
70 exit 99