Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / tar-override.test
1 #! /bin/sh
2 # Copyright (C) 2011 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 the user can override the tar program used by "make dist"
18 # at runtime, by redefining the `TAR' environment variable.
19 # FIXME: currently this works only when the tar format used is `v7'
20 # FIXME: (which is the default one).
21
22 . ./defs || Exit 1
23
24 set -e
25
26 cwd=`pwd` || fatal_ "couldn't get current working directory"
27
28 echo AC_OUTPUT >> configure.in
29
30 cat > am--tar <<'END'
31 #!/bin/sh
32 echo $1 > am--tar-has-run
33 shift
34 exec tar "$@"
35 END
36 chmod a+x am--tar
37
38 cat > Makefile.am <<'END'
39 check-local: dist
40         test -f am--tar-has-run
41 CLEANFILES = am--tar-has-run
42 END
43
44 $ACLOCAL
45 $AUTOCONF
46 $AUTOMAKE
47 ./configure
48
49 $MAKE dist
50 test -f $me-1.0.tar.gz
51 ls | grep has-run && Exit 1
52
53 rm -f *.tar.* *has-run*
54
55 TAR="$cwd/am--tar foo" $MAKE distcheck
56 test -f $me-1.0.tar.gz
57 test "`cat am--tar-has-run`" = foo
58
59 rm -f *.tar.* *has-run*
60
61 TAR=; unset TAR
62 # Creative use of eval to pacify maintainer checks.
63 eval \$'MAKE dist "TAR=./am--tar mu"'
64 test -f $me-1.0.tar.gz
65 test "`cat am--tar-has-run`" = mu
66
67 :