Merge branch 'tests-vartypo-fixes'
[platform/upstream/automake.git] / tests / nobase-libtool.test
1 #! /bin/sh
2 # Copyright (C) 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2011 Free
3 # Software Foundation, Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 # Make sure nobase_* works for libtool libraries and programs as well.
19 # This is just the libtool equivalent of nobase.test, split
20 # up for greater exposure of nobase.test.
21
22 required='libtoolize gcc'
23 . ./defs || Exit 1
24
25 cat >> configure.in <<'EOF'
26 AC_PROG_CC
27 AC_PROG_LIBTOOL
28 AC_OUTPUT
29 EOF
30
31 cat > Makefile.am << 'EOF'
32 fooexecdir = $(prefix)/foo
33 fooexec_LTLIBRARIES = sub/libbase.la
34 nobase_fooexec_LTLIBRARIES = sub/libnobase.la
35 fooexec_PROGRAMS = sub/base
36 nobase_fooexec_PROGRAMS = sub/nobase
37 sub_libbase_la_SOURCES = source2.c
38 sub_libnobase_la_SOURCES = source2.c
39 sub_base_SOURCES = source.c
40 sub_nobase_SOURCES = source.c
41
42 test-install-data: install-data
43         test ! -f inst/foo/sub/libnobase.la
44         test ! -f inst/foo/libbase.la
45
46 test-install-exec: install-exec
47         test   -f inst/foo/sub/libnobase.la
48         test ! -f inst/foo/libnobase.la
49         test   -f inst/foo/libbase.la
50 EOF
51
52 mkdir sub
53
54 cat >source.c <<'EOF'
55 int
56 main (int argc, char *argv[])
57 {
58   return 0;
59 }
60 EOF
61 cp source.c source2.c
62
63 rm -f install-sh
64
65 libtoolize
66 $ACLOCAL
67 $AUTOCONF
68 $AUTOMAKE -a --copy
69 ./configure --prefix "`pwd`/inst" --program-prefix=p
70
71 $MAKE
72 $MAKE test-install-data
73 $MAKE test-install-exec
74 $MAKE uninstall
75
76 test `find inst/foo -type f -print | wc -l` = 0
77
78 $MAKE install-strip
79
80 # Likewise, in a VPATH build.
81
82 $MAKE uninstall
83 $MAKE distclean
84 mkdir build
85 cd build
86 ../configure --prefix "`pwd`/inst" --program-prefix=p
87 $MAKE
88 $MAKE test-install-data
89 $MAKE test-install-exec
90 $MAKE uninstall
91 test `find inst/foo -type f -print | wc -l` = 0