news: fixup: bug#8847 is fixed in 1.12.6, not in 1.12.5
[automake.git] / t / backcompat5.sh
blobcaeac07cf8f57a474a2cc86a19eb14f56141b825
1 #! /bin/sh
2 # Copyright (C) 2010-2012 Free Software Foundation, Inc.
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.
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.
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/>.
17 # Backward-compatibility test: try to build and distribute a package
18 # using obsoleted forms of AC_INIT, AM_INIT_AUTOMAKE and AC_OUTPUT,
19 # and configure.in as autoconf input file.
20 # This script can also serve as mild stress-testing for Automake.
21 # See also the similar test 'backcompat6.sh'.
23 am_serial_tests=yes
24 am_create_testdir=empty
25 . ./defs || exit 1
27 makefiles='hacky/Makefile src/Makefile data/Makefile tests/Makefile'
29 # Yuck!
30 cat > configure.in <<END
31 dnl: Everything here is *deliberately* underquoted!
32 AC_INIT(src/foo.input)
33 AM_INIT_AUTOMAKE(foo, 1.0)
34 AC_CONFIG_FILES(Makefile:mkfile.in)
35 AC_OUTPUT($makefiles)
36 END
38 distdir=foo-1.0
40 cat > mkfile.am <<'END'
41 SUBDIRS = src data tests hacky
42 installcheck-local:
43 grep DataDataData $(DESTDIR)$(prefix)/data/$(PACKAGE)-$(VERSION)/bar
44 END
46 mkdir hacky src tests data
48 echo 'This is a dummy package' > README
50 cat > src/foo.input <<'END'
51 #!sh
52 echo Zardoz
53 END
55 cat > tests/a.test <<'END'
56 #!/bin/sh
57 "$srcdir/../src/foo" | grep Zardoz
58 END
59 chmod a+x tests/a.test
61 cat > data/bar <<'END'
62 line1
63 line2
64 line3
65 END
67 cat >hacky/Makefile.am <<'END'
68 dist-hook:
69 find $(top_distdir) -print
70 chmod a+rx $(top_distdir)/tests/*.test
71 END
73 cat > src/Makefile.am <<'END'
74 dist_bin_SCRIPTS = foo
75 foo: foo.input
76 sed '1s,^#!.*$$,#!/bin/sh,' $(srcdir)/foo.input >$@
77 chmod a+x $@
78 EXTRA_DIST = foo.input
79 DISTCLEANFILES = foo
80 END
82 cat > data/Makefile.am <<'END'
83 nodist_data_DATA = bar
84 datadir = $(prefix)/data/$(PACKAGE)-$(VERSION)
85 bar:
86 echo DataDataData >$@
87 distclean-local:
88 rm -f bar
89 END
91 cat > tests/Makefile.am <<'END'
92 TESTS = a.test
93 EXTRA_DIST = $(TESTS)
94 END
96 $ACLOCAL -Wno-obsolete
97 $AUTOCONF
98 $AUTOMAKE -a -Wno-obsolete
99 test -f install-sh
100 for f in $makefiles; do mv -f $f.in $f.sav; done
101 $AUTOMAKE -Wno-obsolete
102 for f in $makefiles; do diff $f.sav $f.in; done
104 ./configure
105 ls -l . hacky src data tests # For debugging.
106 test ! -e mkfile
107 $MAKE
108 $MAKE distdir
109 test ! -e $distdir/Makefile.in
110 test ! -e $distdir/data/bar
111 test -f $distdir/src/foo
112 diff README $distdir/README
113 diff mkfile.in $distdir/mkfile.in
114 diff tests/a.test $distdir/tests/a.test
115 diff src/foo.input $distdir/src/foo.input
117 $MAKE check
118 $MAKE distcheck
120 test -f $distdir.tar.gz
122 chmod a-x tests/a.test
123 # dist-hook should take care of making test files executables.
124 $MAKE distcheck