am-ft: make the environment available earlier
[platform/upstream/automake.git] / t / amopts-location.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 # Check that errors about AUTOMAKE_OPTIONS refers to correct
18 # locations.
19
20 . test-init.sh
21
22 cat > Makefile.am <<'END'
23 # comment \
24 # continued
25 include Makefile0.am
26 END
27
28 cat > Makefile0.am <<'END'
29 #1
30 #2
31 #3
32 include Makefile1.am
33 END
34
35 cat > Makefile1.am <<'END'
36 AUTOMAKE_OPTIONS = tar-pax
37 # comment
38 END
39
40 cat > Makefile2.am <<'END'
41 ## automake comment
42 bar:
43         :
44 line = \
45 continued
46 AUTOMAKE_OPTIONS = tar-ustar
47 END
48
49 cat > Makefile3.am <<'END'
50 quux = a
51 AUTOMAKE_OPTIONS =
52 quux += b
53 AUTOMAKE_OPTIONS += tar-v7
54 zardoz = 1
55 END
56
57 cat >>configure.ac <<'END'
58 AC_CONFIG_FILES([Makefile2 Makefile3])
59 END
60
61 $ACLOCAL
62 # Automake options 'tar-v7', 'tar-ustar' and 'tar-pax' can only be used
63 # as argument to AM_INIT_AUTOMAKE, and not in AUTOMAKE_OPTIONS.
64 AUTOMAKE_fails
65
66 # Check that all the expected line numbers are correctly reported
67 # in automake warning/error messages.
68 grep '^Makefile1\.am:1:.*tar-pax' stderr
69 grep '^Makefile2\.am:6:.*tar-ustar' stderr
70 grep '^Makefile3\.am:2:.*tar-v7' stderr
71 grep '^Makefile\.am:3:.*Makefile0\.am.*included from here' stderr
72 grep '^Makefile0\.am:4:.*Makefile1\.am.*included from here' stderr
73
74 # And also check that no botched line number is reported.
75 cat stderr \
76   | grep -v '^Makefile\.am:3:'  \
77   | grep -v '^Makefile0\.am:4:' \
78   | grep -v '^Makefile1\.am:1:' \
79   | grep -v '^Makefile2\.am:6:' \
80   | grep -v '^Makefile3\.am:2:' \
81   | grep . && exit 1
82
83 :