maint: Update copyright years to 2018
[automake.git] / t / perf / cond.sh
blob8a819bebfe3d1f02eb9a940532c5ecded587c213
1 #!/bin/sh
2 # Copyright (C) 2003-2018 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 <https://www.gnu.org/licenses/>.
17 # Check that many conditions do not lead to combinatorial explosion.
18 # (This is related to PR/352.)
20 . test-init.sh
22 echo AC_PROG_CC >>configure.ac
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.
36 for i in \
37 01 02 03 04 05 06 07 08 09 10 \
38 11 12 13 14 15 16 17 18 19 20 \
39 21 22 23 24
41 unindent >>Makefile.am <<EOF
42 if C$i
43 bin_PROGRAMS += a$i
44 a01_LDADD = foo${i}.o
45 a02_LDADD += bar${i}.o
46 a03_SOURCES += baz${i}.c
47 a04_SOURCES = quux${i}.c
48 endif C$i
49 EOF
50 echo "AM_CONDITIONAL([C$i], [:])" >>configure.ac
51 done
53 $ACLOCAL
54 $AUTOMAKE