Merge branch 'yacc-quote-fix'
[automake.git] / tests / cond29.test
blob61d9af57c8b788961994af94182d17da5ea02354
1 #!/bin/sh
2 # Copyright (C) 2003-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 # Check that many conditions do not lead to combinatorial explosion.
18 # (This is related to PR/352.)
20 . ./defs || Exit 1
22 echo AC_PROG_CC >>configure.in
24 cat >Makefile.am <<EOF
25 bin_PROGRAMS = a
26 a02_LDADD =
27 a03_SOURCES =
28 EOF
30 # On this test, Automake 1.7.x would compute all 2**24 = 16777216
31 # possible combinations of conditionals (it would do this five times,
32 # to define a01_DEPENDENCIES, a02_DEPENDENCIES, a03_OBJECTS,
33 # a04_OBJECTS, and to rewrite bin_PROGRAM), eating all memory, swap,
34 # or cpu time it can found.
35 # Limit memory available to spawned processes to ~ 150 MB. Considering
36 # that 70 MB is enough for x86_64 Fedora 16, that gives tools and
37 # libraries plenty of room to grow. Suggested by Jim Meyering in
38 # automake bug#10374.
39 (ulimit -v 1; sh -c ":") && skip_ "no adequate 'ulimit' builtin found"
40 (ulimit -v 150000; sh -c ":") || skip_ "no adequate 'ulimit' builtin found"
41 ulimit -v 150000
43 for i in \
44 01 02 03 04 05 06 07 08 09 10 \
45 11 12 13 14 15 16 17 18 19 20 \
46 21 22 23 24
48 unindent >>Makefile.am <<EOF
49 if C$i
50 bin_PROGRAMS += a$i
51 a01_LDADD = foo${i}.o
52 a02_LDADD += bar${i}.o
53 a03_SOURCES += baz${i}.c
54 a04_SOURCES = quux${i}.c
55 endif C$i
56 EOF
57 echo "AM_CONDITIONAL([C$i], [:])" >>configure.in
58 done
60 $ACLOCAL
61 $AUTOMAKE