tests: prune some weed in a non-POSIX test
[platform/upstream/automake.git] / t / strictness-precedence.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 # On the command line, in AM_INIT_AUTOMAKE, and in AUTOMAKE_OPTIONS,
18 # strictness specified later should take precedence over strictness
19 # specified earlier.
20
21 . test-init.sh
22
23 # We want complete control over automake options.
24 AUTOMAKE=$am_original_AUTOMAKE
25
26 cat > Makefile.am <<'END'
27 AUTOMAKE_OPTIONS =
28 END
29
30 set_strictness ()
31 {
32   set +x
33   sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
34                 -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
35   mv -f $2-t $2
36   set -x
37   cat $2
38 }
39
40 ok ()
41 {
42   $AUTOMAKE -Werror $*
43 }
44
45 ko ()
46 {
47   AUTOMAKE_fails $*
48   grep 'required file.*README' stderr
49 }
50
51 # Leave out only one of the required files, to avoid too much
52 # repetition in the error messages.
53 touch INSTALL NEWS AUTHORS ChangeLog COPYING
54
55 $ACLOCAL
56 ko --foreign --gnu
57 ok --gnu --foreign
58
59 set_strictness '' Makefile.am
60 set_strictness 'gnu foreign' configure.ac
61 rm -rf autom4te*.cache
62 $ACLOCAL
63 ok
64 set_strictness 'foreign gnu' configure.ac
65 rm -rf autom4te*.cache
66 $ACLOCAL
67 ko
68
69 set_strictness '' configure.ac
70 rm -rf autom4te*.cache
71 $ACLOCAL
72 set_strictness 'gnu foreign' Makefile.am
73 ok
74 set_strictness 'foreign gnu' Makefile.am
75 ko
76
77 :