Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / cond29.test
1 #!/bin/sh
2 # Copyright (C) 2003  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 # Check that many conditions do not lead to combinatorial explosion.
18 # (This is related to PR/352.)
19 #
20 # On this test, Automake 1.7.x would compute all 2**22 = 4194304
21 # possible combinations of conditionals (it would do this five times,
22 # to define a01_DEPENDENCIES, a02_DEPENDENCIES, a03_OBJECTS,
23 # a04_OBJECTS, and to rewrite bin_PROGRAM), eating all memory, swap,
24 # or cpu time it can found.  Although this test won't print `FAIL' if
25 # it fails, it will take long enough so it can't go unnoticed.
26
27 . ./defs || Exit 1
28
29 set -e
30
31 echo AC_PROG_CC >>configure.in
32
33 cat >Makefile.am <<EOF
34 bin_PROGRAMS = a
35 a02_LDADD =
36 a03_SOURCES =
37 EOF
38
39 for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22; do
40 cat >>Makefile.am <<EOF
41 if C$i
42 bin_PROGRAMS += a$i
43 a01_LDADD = foo${i}.o
44 a02_LDADD += bar${i}.o
45 a03_SOURCES += baz${i}.c
46 a04_SOURCES = quux${i}.c
47 endif C$i
48 EOF
49 echo "AM_CONDITIONAL([C$i], [:])" >>configure.in
50 done
51
52 $ACLOCAL
53 $AUTOMAKE