2 # Copyright (C) 2011-2013 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)
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 # Test that we can distribute the same file as many times as we want.
18 # The distdir target should take care of not copying it more than one
23 echo AC_OUTPUT
>> configure.ac
25 cat > Makefile.am
<<'END'
26 bin_PROGRAMS = foo bar
29 python_PYTHON = bar.py
30 EXTRA_DIST = foo.c bar.py
34 for f in $(DISTFILES); do echo " $$f "; done > dist.txt
36 test `grep ' foo\.c ' dist.txt | wc -l` -eq 3
37 test `grep ' bar\.py ' dist.txt | wc -l` -eq 2
39 # So that we don't have to require a C compiler.
40 AUTOMAKE_OPTIONS = no-dependencies
43 # So that we don't have to require a Python interpreter.
44 pythondir = ${prefix}/py
48 ocwd
=$
(pwd) || fatal_
"cannot get current working directory"
50 # Help to ensure cp won't see the same file twice.
54 PATH='$PATH'; export PATH
58 if test -f '$ocwd'/foo-c-copied; then
59 echo "\$0: we tried to copy foo.c twice" >&2
62 # For a sanity check later.
63 echo ok > '$ocwd'/cp-wrapper-has-seen-foo-c
70 if test -f '$ocwd'/bar-py-copied; then
71 echo "\$0: we tried to copy bar.py twice" >&2
74 # For a sanity check later.
75 echo ok > '$ocwd'/cp-wrapper-has-seen-bar-py
83 PATH
=$
(pwd)/bin
$PATH_SEPARATOR$PATH; export PATH
;
89 # Help to ensure cp won't try to copy the same file twice.
90 chmod a-w foo.c bar.py
97 $MAKE sanity-check || fatal_
"expected invariants not verified"
99 test -f cp-wrapper-has-seen-foo-c
&& test -f cp-wrapper-has-seen-bar-py \
100 || fatal_
"our cp wrapper hasn't run correctly"