Merge branch 'yacc-quote-fix'
[automake.git] / tests / insthook.test
blob6969d98caf2f80357f17b1d7eb3dac4ebc4cb853
1 #! /bin/sh
2 # Copyright (C) 2003-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 # Make sure the install-exec-hook example we give in the manual works.
19 . ./defs || Exit 1
21 cat >>configure.in <<'EOF'
22 AC_PROG_LN_S
23 AC_OUTPUT
24 EOF
26 cat >Makefile.am <<'END'
27 dist_bin_SCRIPTS = foo
29 install-exec-hook:
30 cd "$(DESTDIR)$(bindir)" && \
31 mv -f foo foo-$(VERSION) && \
32 $(LN_S) foo-$(VERSION) foo
34 installcheck-local:
35 test -f "$(bindir)/foo"
36 test -f "$(bindir)/foo-$(VERSION)"
37 : > $(top_srcdir)/../ok
39 uninstall-hook:
40 rm -f $(DESTDIR)$(bindir)/foo-$(VERSION)
41 END
43 echo 1 > foo
45 $ACLOCAL
46 $AUTOCONF
47 $AUTOMAKE
49 ./configure
50 $MAKE distcheck
51 # Sanity check to make sure installcheck-local was run.
52 test -f ok
54 # Make sure that installing a second version doesn't erase the first
55 # one. (This is error prone since `foo' symlinks to `foo-1.0' and the
56 # second version will overwrite `foo'. Hopefully `install' and `install-sh'
57 # are smart enough to erase the `foo' symlink before installing the new
58 # version.)
59 ./configure "--bindir=`pwd`/bin"
60 $MAKE install
61 echo 2 > foo
62 VERSION=2.0 $MAKE -e install
63 grep 1 bin/foo-1.0
64 grep 2 bin/foo-2.0
65 grep 2 bin/foo
67 # install-hook is an error.
68 cat >>Makefile.am <<EOF
69 install-hook:
70 echo test
71 EOF
73 AUTOMAKE_fails
74 grep install-data-hook stderr
75 grep install-exec-hook stderr