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