2 # Copyright (C) 2013 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)
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 # 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.
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
33 # Same comments as above applies.
34 DISTCHECK_CONFIGURE_FLAGS='--srcdir user-src --prefix user-pfx'
35 export DISTCHECK_CONFIGURE_FLAGS
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; }
45 grep "expected an absolute directory name for --prefix" stderr || exit 99
46 ./configure --srcdir foobar 2>stderr && { cat stderr >&2; exit 99; }
48 grep "cannot find sources.* in foobar" stderr || exit 99
51 run_make -E -O distcheck
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