doc: update Vala documentation
[automake.git] / t / dist-missing-m4.sh
blobc9756913bcad978462678beac91cf816cb0369e0
1 #! /bin/sh
2 # Copyright (C) 2011-2024 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 <https://www.gnu.org/licenses/>.
17 # The stub rules emitted to work around the "deleted header problem"
18 # for '.m4' files shouldn't prevent "make" from diagnosing a missing
19 # required '.m4' file from a distribution tarball.
20 # See discussion about automake bug#9768.
21 # See also sister test 'dist-missing-included-m4.sh'.
23 . test-init.sh
25 cat >> configure.ac <<'END'
26 m4_pattern_forbid([^MY_])
27 MY_FOOBAR || exit 1
28 MY_ZARDOZ || exit 1
29 AC_OUTPUT
30 END
32 mkdir m4
33 echo 'AC_DEFUN([MY_FOOBAR], [:])' > m4/foobar.m4
34 echo 'AC_DEFUN([MY_ZARDOZ], [:])' > m4/zardoz.m4
36 echo 'ACLOCAL_AMFLAGS = -I m4' > Makefile.am
38 $ACLOCAL -I m4
39 $AUTOCONF
40 $AUTOMAKE
42 ./configure
44 # A faulty distribution tarball, with a required '.m4' file missing.
45 # Building from it should fail, both for in-tree and VPATH builds.
46 ocwd=$(pwd) || fatal_ "cannot get current working directory"
47 for vpath in false :; do
48 $MAKE distdir
49 test -f $distdir/m4/zardoz.m4 # Sanity check.
50 rm -f $distdir/m4/zardoz.m4
51 if $vpath; then
52 # We can't just build in a subdirectory of $distdir, otherwise
53 # we'll hit automake bug#10111.
54 mkdir vpath-distcheck
55 cd vpath-distcheck
56 ../$distdir/configure
57 else
58 cd $distdir
59 ./configure
61 run_make -e FAIL -M
62 # This error will come from autoconf, not make, so we can be stricter
63 # in our grepping of it.
64 grep 'possibly undefined .*MY_ZARDOZ' output
65 grep 'MY_FOOBAR' output && exit 1 # No spurious error, please.
66 cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory"
67 done