maint: Update HACKING
[automake.git] / t / distcheck-pr18286.sh
blob49ec0484087c85dd28b1ad960e666b2ff142faf2
1 #! /bin/sh
2 # Copyright (C) 2014-2017 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 <https://www.gnu.org/licenses/>.
17 # Ensure "make distcheck" detects all missing files, without getting
18 # confused by the fact that they exists in the "original" source tree
19 # from which "make distcheck" is run. See automake bug#18286.
21 . test-init.sh
23 echo AC_OUTPUT >> configure.ac
25 cat > Makefile.am <<'END'
26 $(srcdir)/test_data.am: $(srcdir)/test_data.txt $(srcdir)/gen-testdata.sh
27 cd $(srcdir) && $(SHELL) gen-testdata.sh <test_data.txt >test_data.am
29 include $(srcdir)/test_data.am
31 check-local:
32 is $(testdata) == foo bar
33 END
35 cat > test_data.txt <<'END'
36 foo
37 bar
38 END
41 cat > gen-testdata.sh <<'END'
42 #!/bin/sh
43 printf 'testdata = \\\n'
44 sed 's/$/ \\/'
45 echo '$(empty_string)'
46 END
47 chmod a+x gen-testdata.sh
49 $sleep
50 ./gen-testdata.sh <test_data.txt >test_data.am
52 $ACLOCAL
53 $AUTOCONF
54 $AUTOMAKE -a
56 ./configure
58 $MAKE check
60 # Oops, we failed to distribute some required files!
61 run_make -e FAIL -M distcheck
62 $FGREP '../../test_data.txt' output
64 # But if we distribute them, everything will be OK.
65 echo 'EXTRA_DIST = test_data.txt gen-testdata.sh' >> Makefile.am
67 using_gmake || $MAKE Makefile
68 $MAKE distcheck