Avoid leaking TEST_LOG_COMPILER in environment of test scripts.
[automake.git] / tests / instdir-prog.test
blob6a73b7572c98bbf3dd6a301d47745314e4a6f1e2
1 #! /bin/sh
2 # Copyright (C) 2009 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 # If $(bindir) is the empty string, then nothing should be installed there.
18 # This test exercises the prog and libs code paths.
20 . ./defs || Exit 1
22 set -e
24 cat >>configure.in <<'END'
25 AC_PROG_CC
26 AM_PROG_CC_C_O
27 AC_PROG_RANLIB
28 AC_OUTPUT
29 END
31 mkdir sub
33 cat >Makefile.am <<'END'
34 AUTOMAKE_OPTIONS = subdir-objects
35 bin_PROGRAMS = p
36 nobase_bin_PROGRAMS = np sub/np
37 lib_LIBRARIES = libfoo.a
38 nobase_lib_LIBRARIES = libnfoo.a sub/libnfoo.a
39 END
41 cat >p.c <<'END'
42 int main () { return 0; }
43 END
44 cp p.c np.c
45 cp p.c sub/np.c
46 cp p.c libfoo.c
47 cp p.c libnfoo.c
48 cp p.c sub/libnfoo.c
50 $ACLOCAL
51 $AUTOCONF
52 $AUTOMAKE --add-missing
54 instdir=`pwd`/inst
55 destdir=`pwd`/dest
56 mkdir build
57 cd build
58 ../configure --prefix="$instdir"
59 $MAKE
61 bindir= libdir=
62 export bindir libdir
63 $MAKE -e install
64 test ! -d "$instdir"
65 $MAKE -e install DESTDIR="$destdir"
66 test ! -d "$instdir"
67 test ! -d "$destdir"
68 $MAKE -e uninstall > stdout || { cat stdout; Exit 1; }
69 cat stdout
70 grep 'rm -f' stdout && Exit 1
71 $MAKE -e uninstall DESTDIR="$destdir"