df2257487e54602f4cae2d63d7553086cee3588e
[platform/upstream/automake.git] / tests / instdir2.test
1 #! /bin/sh
2 # Copyright (C) 2009  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 3, 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 # If $(foodir) is the empty string, then nothing should be installed there.
18 # This test ensures this also if $(foo_PRIMARY) is nonempty, see
19 # instdir.test.
20
21 . ./defs || Exit 1
22
23 set -e
24
25 cat >>configure.in <<'END'
26 AC_SUBST([foodir], ['${datadir}'/foo])
27 AC_OUTPUT
28 END
29
30 mkdir sub
31
32 cat >Makefile.am <<'END'
33 bin_SCRIPTS = s
34 nobase_bin_SCRIPTS = ns sub/ns
35 data_DATA = d
36 nobase_data_DATA = nd sub/nd
37 include_HEADERS = h
38 nobase_include_HEADERS = nh sub/nh
39 foo_DATA = f
40 nobase_foo_DATA = nf sub/nf
41 bardir = $(datadir)/bar
42 bar_DATA = b
43 nobase_bar_DATA = nb sub/nb
44 man1_MANS = m1.1
45 man_MANS = m.2
46 notrans_man1_MANS = nm1.1
47 notrans_man_MANS = nm.2
48 END
49
50 : >s
51 : >ns
52 : >sub/ns
53 : >d
54 : >nd
55 : >sub/nd
56 : >h
57 : >nh
58 : >sub/nh
59 : >f
60 : >nf
61 : >sub/nf
62 : >b
63 : >nb
64 : >sub/nb
65 : >m1.1
66 : >m.2
67 : >nm1.1
68 : >nm.2
69
70 $ACLOCAL
71 $AUTOCONF
72 $AUTOMAKE --add-missing
73
74 instdir=`pwd`/inst
75 destdir=`pwd`/dest
76 mkdir build
77 cd build
78 ../configure --prefix="$instdir"
79 $MAKE
80
81 bindir= datadir= includedir= foodir= bardir= man1dir= man2dir=
82 export bindir datadir includedir foodir bardir man1dir man2dir
83
84 $MAKE -e install
85 test ! -d "$instdir"
86 $MAKE -e install DESTDIR="$destdir"
87 test ! -d "$instdir"
88 test ! -d "$destdir"
89 $MAKE -e uninstall > stdout || { cat stdout; Exit 1; }
90 cat stdout
91 grep 'rm -f' stdout && Exit 1
92 $MAKE -e uninstall DESTDIR="$destdir"
93 :