tests: never source test-defs.sh directly, source test-lib.sh instead
[automake.git] / t / pr220.sh
blob2054fb31e75582c9557be58dedfeee89f12c5fd6
1 #! /bin/sh
2 # Copyright (C) 2001-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 # Test for PR automake/220.
18 # Test for problems when conditionals are not actually defined.
19 # Check that the problems is diagnosed by configure.
20 # This isn't perfect (ideally we'd like an error from autoconf),
21 # but it is the best we can do. It certainly makes it easier
22 # to debug the problem.
23 # Note that this should be also in the documentation.
25 . ./defs || exit 1
27 cat > Makefile.am << 'EOF'
28 if NEVER_TRUE
29 NEVER_DEFINED = foo.txt
30 endif
31 data_DATA = $(NEVER_DEFINED)
32 EOF
34 cat >> configure.ac << 'EOF'
35 AC_ARG_ENABLE([foo],
36 [ --enable-foo Enable foo],
37 [ if test "foo" = "bar" ; then
38 AM_CONDITIONAL([NEVER_TRUE], [true])
39 else
40 AM_CONDITIONAL([NEVER_TRUE], [false])
43 AC_OUTPUT
44 EOF
46 mkdir build
48 $ACLOCAL
49 $AUTOCONF
50 $AUTOMAKE -a
52 cd build
53 # configure should fail since we've done something invalid.
54 ../configure 2>stderr && { cat stderr >&2; exit 1; }
55 cat stderr >&2
56 grep 'conditional.*NEVER_TRUE' stderr