Implement conditional AC_CONFIG_FILES: AM_COND_IF.
[automake/ericb.git] / tests / insthook.test
blobe3a3e3ec8f44ad7b62ed1579a4af2e1ff2e78e60
1 #! /bin/sh
2 # Copyright (C) 2003, 2005, 2007 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 3, 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 set -e
23 cat >>configure.in <<'EOF'
24 AC_PROG_LN_S
25 AC_OUTPUT
26 EOF
28 cat >Makefile.am <<'END'
29 dist_bin_SCRIPTS = foo
31 install-exec-hook:
32 cd "$(DESTDIR)$(bindir)" && \
33 mv -f foo foo-$(VERSION) && \
34 $(LN_S) foo-$(VERSION) foo
36 installcheck-local:
37 test -f "$(bindir)/foo"
38 test -f "$(bindir)/foo-$(VERSION)"
39 : > $(top_srcdir)/../ok
40 END
42 echo 1 > foo
44 $ACLOCAL
45 $AUTOCONF
46 $AUTOMAKE
48 ./configure
49 $MAKE distcheck
50 # Sanity check to make sure installcheck-local was run.
51 test -f ok
53 # Make sure that installing a second version doesn't erase the first
54 # one. (This is error prone since `foo' symlinks to `foo-1.0' and the
55 # second version will overwrite `foo'. Hopefully `install' and `install-sh'
56 # are smart enough to erase the `foo' symlink before installing the new
57 # version.)
58 ./configure "--bindir=`pwd`/bin"
59 $MAKE install
60 echo 2 > foo
61 VERSION=2.0 $MAKE -e install
62 grep 1 bin/foo-1.0
63 grep 2 bin/foo-2.0
64 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