Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / specflg10.test
1 #! /bin/sh
2 # Copyright (C) 2008, 2009  Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # AM_DEFAULT_SOURCE_EXT
18
19 required=g++
20 . ./defs || Exit 1
21
22 set -e
23
24 cat >> configure.in << 'END'
25 AC_PROG_CC
26 AC_PROG_CXX
27 AC_CONFIG_FILES([sub/Makefile sub2/Makefile])
28 AM_CONDITIONAL([COND], [:])
29 AC_OUTPUT
30 END
31
32 mkdir sub sub2
33
34 cat > Makefile.am << 'END'
35 SUBDIRS = sub sub2
36 bin_PROGRAMS = foo
37 END
38
39 cat > sub/Makefile.am << 'END'
40 bin_PROGRAMS = bar baz
41 AM_DEFAULT_SOURCE_EXT = .cpp
42 END
43
44 cat > sub2/Makefile.am << 'END'
45 bin_PROGRAMS = bla
46 if COND
47 AM_DEFAULT_SOURCE_EXT = .foo .quux
48 endif
49 SUFFIXES = .foo .c
50 .foo.c:
51         cat $< >$@
52 BUILT_SOURCES = bla.c
53 CLEANFILES = bla.c
54 END
55
56 cat > foo.c << 'END'
57 int main () { return 0; }
58 END
59
60 cp foo.c sub/bar.cpp
61 cp foo.c sub/baz.cpp
62 cp foo.c sub2/bla.foo
63
64 $ACLOCAL
65 $AUTOCONF
66
67 # Conditional AM_DEFAULT_SOURCE_EXT does not work yet  :-(
68 # (this limitation could be lifted).
69 AUTOMAKE_fails --add-missing
70 grep 'defined conditionally' stderr
71
72 sed '/^if/d; /^endif/d' sub2/Makefile.am > t
73 mv -f t sub2/Makefile.am
74
75 # AM_DEFAULT_SOURCE_EXT can only assume one value
76 # (lifting this limitation is not such a good idea).
77 AUTOMAKE_fails --add-missing
78 grep 'at most one value' stderr
79
80 sed 's/ \.quux//' sub2/Makefile.am > t
81 mv -f t sub2/Makefile.am
82
83 $AUTOMAKE --add-missing
84
85 ./configure
86 $MAKE
87 $MAKE distcheck
88
89 :