tests: Let 'ltorder.sh' run successfully with Guix dynamic loader
[automake.git] / t / autodist.sh
bloba3fb594d0f1ca47a54f3d7cc05afe9103c16fbc1
1 #! /bin/sh
2 # Copyright (C) 2011-2018 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 # Check that automake really automatically distributes all the files
18 # it advertises to do.
19 # Related to automake bug#7819.
20 # Keep this test in sync with sister test 'autodist-subdir.sh'.
22 am_create_testdir=empty
23 . test-init.sh
25 cat > configure.ac <<END
26 AC_INIT([$me], [1.0])
27 AC_CONFIG_AUX_DIR([.])
28 AM_INIT_AUTOMAKE
29 AC_CONFIG_FILES([Makefile])
30 AC_OUTPUT
31 END
33 $ACLOCAL
34 $AUTOCONF
36 # The automake manual states that the list of automatically-distributed
37 # files should be given by 'automake --help'.
38 list=$($AUTOMAKE --help \
39 | sed -n '/^Files.*automatically distributed.*if found.*always/,/^ *$/p' \
40 | sed 1d)
41 # Normalize whitespace, just in case.
42 list=$(echo $list)
44 test -n "$list"
46 cat > Makefile.am <<'END'
47 include distfiles.am
48 check-local:
49 ## For debugging.
50 @echo DIST_COMMON:
51 @for f in $(DIST_COMMON); do echo " $$f"; done
52 @echo DISTDIR:
53 @ls -l $(distdir) | sed 's/^/ /'
54 ## Now the checks.
55 @for f in $(autodist_list); do \
56 echo "file: $$f"; \
57 test -f $(distdir)/$$f \
58 || { echo $$f: distdir fail >&2; exit 1; }; \
59 ## Some filenames might contain dots, but this won't cause spurious
60 ## failures, and "spurious successes" are so unlikely that they're
61 ## not worth worrying about.
62 echo ' ' $(DIST_COMMON) ' ' | grep "[ /]$$f " >/dev/null \
63 || { echo $$f: distcom fail >&2; exit 1; }; \
64 done
65 END
67 : First try listing the automatically-distributed files in proper
68 : targets in Makefile.am
70 echo "MAINTAINERCLEANFILES = $list" > distfiles.am
71 for f in $list; do echo "$f :; touch $f"; done >> distfiles.am
73 cat distfiles.am # For debugging.
75 $AUTOMAKE -a
77 ./configure
79 $MAKE distdir
80 autodist_list="$list" $MAKE check
82 $MAKE maintainer-clean
83 test ! -e README # Sanity check.
84 rm -rf $me-1.0 # Remove $(distdir).
86 : Now try creating the automatically-distributed files before
87 : running automake.
89 : > distfiles.am
90 for f in $list; do
91 echo dummy > $f
92 done
94 ls -l # For debugging.
96 $AUTOMAKE
98 ./configure
100 $MAKE distdir
101 autodist_list="$list" $MAKE check