3dcf6715ac04335ac37a93b44430717ee664774c
[platform/upstream/automake.git] / tests / cygnus-imply-foreign.test
1 #! /bin/sh
2 # Copyright (C) 2010-2012 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 'cygnus' mode imply 'foreign' mode.
18
19 . ./defs || Exit 1
20
21 cat >> configure.ac <<'END'
22 # This is *required* in cygnus mode
23 AM_MAINTAINER_MODE
24 END
25
26 $ACLOCAL
27
28 : > Makefile.am
29
30 # We want complete control automake flags, while honouring the
31 # user overrides for $AUTOMAKE.
32 AUTOMAKE=$am_original_AUTOMAKE
33
34 # Sanity check: gnu mode must complain about missing files and
35 # portability problems.
36 AUTOMAKE_fails
37 grep 'required file.*README' stderr
38
39 # But cygnus mode should imply foreign mode, so no complaints.
40 # And cygnus mode should by able to override gnu and gnits modes.
41 $AUTOMAKE --cygnus -Werror
42 $AUTOMAKE --gnu --cygnus -Werror
43 $AUTOMAKE --gnits --cygnus -Werror
44
45 # Try again, this time enabling cygnus mode from Makefile.am.
46 cp Makefile.am Makefile.sav
47 echo 'AUTOMAKE_OPTIONS = gnu cygnus' >> Makefile.am
48 $AUTOMAKE -Werror
49 mv -f Makefile.sav Makefile.am
50
51 # Try again, this time enabling cygnus mode from configure.ac.
52 cp configure.ac configure.sav
53 sed 's/^AM_INIT_AUTOMAKE$/&([gnits cygnus])/' configure.sav >configure.ac
54 cmp configure.ac configure.sav && fatal_ 'failed to edit configure.ac'
55
56 $ACLOCAL --force
57 $AUTOMAKE -Werror
58 mv -f configure.sav configure.ac
59
60 :