cond.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/sh
  2. # Copyright (C) 2003-2017 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. # Check that many conditions do not lead to combinatorial explosion.
  17. # (This is related to PR/352.)
  18. . test-init.sh
  19. echo AC_PROG_CC >>configure.ac
  20. cat >Makefile.am <<EOF
  21. bin_PROGRAMS = a
  22. a02_LDADD =
  23. a03_SOURCES =
  24. EOF
  25. # On this test, Automake 1.7.x would compute all 2**24 = 16777216
  26. # possible combinations of conditionals (it would do this five times,
  27. # to define a01_DEPENDENCIES, a02_DEPENDENCIES, a03_OBJECTS,
  28. # a04_OBJECTS, and to rewrite bin_PROGRAM), eating all memory, swap,
  29. # or cpu time it can found.
  30. for i in \
  31. 01 02 03 04 05 06 07 08 09 10 \
  32. 11 12 13 14 15 16 17 18 19 20 \
  33. 21 22 23 24
  34. do
  35. unindent >>Makefile.am <<EOF
  36. if C$i
  37. bin_PROGRAMS += a$i
  38. a01_LDADD = foo${i}.o
  39. a02_LDADD += bar${i}.o
  40. a03_SOURCES += baz${i}.c
  41. a04_SOURCES = quux${i}.c
  42. endif C$i
  43. EOF
  44. echo "AM_CONDITIONAL([C$i], [:])" >>configure.ac
  45. done
  46. $ACLOCAL
  47. $AUTOMAKE
  48. :