doc: update Vala documentation
[automake.git] / t / distcheck-no-prefix-or-srcdir-override.sh
blobe0051f27f4b9062d2efc43e1e332ffbba589a72a
1 #! /bin/sh
2 # Copyright (C) 2013-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 # Check that "make distcheck" overrides any --srcdir or --prefix flag
18 # (mistakenly) defined in $(AM_DISTCHECK_CONFIGURE_FLAGS) or
19 # $(DISTCHECK_CONFIGURE_FLAGS). See automake bug#14991.
21 . test-init.sh
23 echo AC_OUTPUT >> configure.ac
25 orig_cwd=$(pwd); export orig_cwd
27 cat > Makefile.am << 'END'
28 # configure should choke on non-absolute prefix or non-existent
29 # srcdir. We'll sanity-check that later.
30 AM_DISTCHECK_CONFIGURE_FLAGS = --srcdir am-src --prefix am-pfx
31 END
33 # Same comments as above applies.
34 DISTCHECK_CONFIGURE_FLAGS='--srcdir user-src --prefix user-pfx'
35 export DISTCHECK_CONFIGURE_FLAGS
37 $ACLOCAL
38 $AUTOMAKE
39 $AUTOCONF
41 # Sanity check: configure should choke on non-absolute prefix
42 # or non-existent srcdir.
43 ./configure --prefix foobar 2>stderr && { cat stderr >&2; exit 99; }
44 cat stderr >&2
45 grep "expected an absolute directory name for --prefix" stderr || exit 99
46 ./configure --srcdir foobar 2>stderr && { cat stderr >&2; exit 99; }
47 cat stderr >&2
48 grep "cannot find sources.* in foobar" stderr || exit 99
50 ./configure
51 run_make -E -O distcheck
52 test ! -s stderr
53 # Sanity check: the flags have been actually seen.
54 $PERL -e 'undef $/; $_ = <>; s/ \\\n/ /g; print;' <stdout >t
55 grep '/configure .* --srcdir am-src' t || exit 99
56 grep '/configure .* --prefix am-pfx' t || exit 99
57 grep '/configure .* --srcdir user-src' t || exit 99
58 grep '/configure .* --prefix user-pfx' t || exit 99