6f105c0259729affd8c1759c878446dd76f78a3b
[platform/upstream/automake.git] / tests / instdir-no-empty.test
1 #! /bin/sh
2 # Copyright (C) 2012 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 2, 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 # An empty "foo_PRIMARY" declaration should *not* cause "make install"
18 # to create directory $(foodir).  See automake bug#10997 and bug#11030.
19
20 . ./defs || Exit 1
21
22 set -e
23
24 cat >> configure.ac <<'END'
25 AC_SUBST([CC], [whatever])
26 AC_SUBST([JAVAC], [whatever])
27 AM_PATH_PYTHON(,,:)
28 AC_OUTPUT
29 END
30
31 cat > Makefile.am << 'END'
32 AUTOMAKE_OPTIONS = no-dependencies
33 mydir = $(prefix)/my
34 myexecdir = $(prefix)/myexec
35 javadir = $(prefix)/java
36 END
37
38 # Write Makefile.am.
39 {
40
41   for dir in sbin bin libexec pkglibexec myexec; do
42     for dst in '' dist_ nodist_; do
43       echo "${dst}${dir}_SCRIPTS ="
44     done
45     echo "${dir}_PROGRAMS ="
46   done
47
48   for dir in lib pkglib myexec my; do
49     echo "${dir}_LIBRARIES ="
50     echo "${dir}_LTLIBRARIES ="
51   done
52
53   for p1 in '' notrans_; do
54     for p2 in '' dist_ nodist_; do
55       for s in '' 1 2 3 4 5 6 7 8 9; do
56         echo "${p1}${p2}man${s}_MANS ="
57       done
58     done
59   done
60
61   for dst in '' dist_ nodist_; do
62     for dir in dataroot data pkgdata doc lisp my; do
63       echo "${dst}${dir}_DATA ="
64     done
65     for dir in include pkginclude oldinclude my; do
66       echo "${dst}${dir}_HEADERS ="
67     done
68     for dir in python my; do
69       echo "${dst}${dir}_PYTHON ="
70     done
71     for dir in info my; do
72       echo "${dst}${dir}_TEXINFOS ="
73     done
74     for dir in java my; do
75       echo "${dst}${dir}_JAVA ="
76     done
77     for dir in lisp my; do
78       echo "${dst}${dir}_LISP ="
79     done
80   done
81
82 } > t
83
84 cat t >> Makefile.am
85 sed 's/^/nobase_/' t >> Makefile.am
86 rm -f t
87
88 cat Makefile.am # For debugging.
89
90 # Sanity check.
91 grep '^oldinclude_HEADERS =' Makefile.am \
92   && grep '^nodist_my_PYTHON =' Makefile.am \
93   && grep '^notrans_dist_man5_MANS =' Makefile.am \
94   || fatal_ "creating Makefile.am"
95
96 $ACLOCAL
97 $AUTOCONF
98 $AUTOMAKE -a
99
100 cwd=`pwd` || fatal_ "getting current working directory"
101
102 doinst ()
103 {
104   $MAKE install install-pdf install-ps install-dvi ${1+"$@"}
105 }
106
107 : > foo.sh
108
109 ./configure --prefix="$cwd/inst"
110 doinst
111 test ! -d inst || { find inst; Exit 1; }
112 $MAKE uninstall
113 doinst bin_SCRIPTS=foo.sh AM_MAKEFLAGS='bin_SCRIPTS=foo.sh'
114 test -f inst/bin/foo.sh
115
116 ./configure
117 doinst DESTDIR="$cwd/dest"
118 test ! -d dest || { find dest; Exit 1; }
119 $MAKE uninstall
120 doinst DESTDIR="$cwd/dest" bin_SCRIPTS=foo.sh AM_MAKEFLAGS='bin_SCRIPTS=foo.sh'
121 test -f dest/usr/local/bin/foo.sh
122
123 :