Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / dist-missing-am.test
1 #! /bin/sh
2 # Copyright (C) 2011 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 # The stub rules emitted to work around the "deleted header problem"
18 # for `.am' files shouldn't prevent "make" from diagnosing a missing
19 # required `.am' file from a distribution tarball.
20 # See discussion about automake bug#9768.
21
22 . ./defs || Exit 1
23
24 set -e
25
26 echo AC_OUTPUT >> configure.in
27
28 cat > Makefile.am <<'END'
29 include $(srcdir)/foobar.am
30 include $(srcdir)/zardoz.am
31 END
32
33 : > foobar.am
34 : > zardoz.am
35
36 $ACLOCAL
37 $AUTOCONF
38 $AUTOMAKE
39
40 ./configure
41
42 # A faulty distribution tarball, with a required `.am' file missing.
43 # Building from it should fail, both for in-tree and VPATH builds.
44 ocwd=`pwd` || fatal_ "cannot get current working directory"
45 for vpath in false :; do
46   $MAKE distdir
47   test -f $distdir/zardoz.am # Sanity check.
48   rm -f $distdir/zardoz.am
49   if $vpath; then
50     # We can't just build in a subdirectory of $distdir, otherwise
51     # we'll hit automake bug#10111.
52     mkdir vpath-distcheck
53     cd vpath-distcheck
54     ../$distdir/configure
55   else
56     cd $distdir
57     ./configure
58   fi
59   $MAKE >output 2>&1 && { cat output; Exit 1; }
60   cat output
61   # This error comes from automake, not make, so we can be stricter
62   # in our grepping of it.
63   grep 'cannot open.*zardoz\.am' output
64   grep 'foobar\.am' output && Exit 1 # No spurious error, please.
65   cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory"
66 done
67
68 :