Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / pr220.test
1 #! /bin/sh
2 # Copyright (C) 2001, 2002, 2004, 2008, 2010 Free Software Foundation,
3 # Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 # Test for PR automake/220.
19 # Test for problems when conditionals are not actually defined.
20 # Check that the problems is diagnosed by configure.
21 # This isn't perfect (ideally we'd like an error from autoconf),
22 # but it is the best we can do.  It certainly makes it easier
23 # to debug the problem.
24 # Note that this should be also in the documentation.
25
26 required=gcc
27 . ./defs || Exit 1
28
29 set -e
30
31 cat > main.c <<'EOF'
32 int main() { return 0; }
33 EOF
34
35 cat > Makefile.am << 'EOF'
36 if NEVER_TRUE
37 NEVER_DEFINED = missingfile.c
38 endif
39
40 bin_PROGRAMS = main
41 main_SOURCES = main.c $(NEVER_DEFINED)
42 EOF
43
44 cat >> configure.in << 'EOF'
45 AC_PROG_CC
46 AC_ARG_ENABLE(foo,
47 [  --enable-foo          Enable foo],
48 [ if test "foo" = "bar" ; then
49     AM_CONDITIONAL(NEVER_TRUE, true)
50   else
51     AM_CONDITIONAL(NEVER_TRUE, false)
52   fi
53 ])
54 AC_OUTPUT
55 EOF
56
57 mkdir build
58
59 $ACLOCAL
60 $AUTOCONF
61 $AUTOMAKE -a
62
63 cd build
64 # configure should fail since we've done something invalid.
65 ../configure 2>stderr && { cat stderr >&2; Exit 1; }
66 cat stderr >&2
67 grep 'conditional.*NEVER_TRUE' stderr
68
69 :