cond21.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #! /bin/sh
  2. # Copyright (C) 2002-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 for use of = and += in different conditions.
  17. . test-init.sh
  18. cat >> configure.ac << 'END'
  19. AM_CONDITIONAL([COND1], [true])
  20. AM_CONDITIONAL([COND2], [true])
  21. AM_CONDITIONAL([COND3], [true])
  22. AC_OUTPUT
  23. END
  24. cat > Makefile.am << 'END'
  25. FOO = foo
  26. if COND1
  27. FOO += foo1
  28. else
  29. FOO += foon1
  30. endif
  31. if COND2
  32. FOO += foo2
  33. else
  34. FOO += foon2
  35. endif
  36. if COND1
  37. FOO += foo1b
  38. else
  39. FOO += foon1b
  40. endif
  41. if COND1
  42. if COND2
  43. BAR = bar12
  44. else
  45. BAR = bar1n2
  46. endif
  47. else
  48. BAR = barn1
  49. endif
  50. BAR += bar
  51. if COND3
  52. BAR += bar3
  53. endif
  54. .PHONY: test
  55. test:
  56. @echo BAR: $(BAR) :BAR
  57. @echo FOO: $(FOO) :FOO
  58. END
  59. $ACLOCAL
  60. $AUTOCONF
  61. $AUTOMAKE -a
  62. ./configure
  63. $MAKE test | $FGREP 'BAR: bar12 bar bar3 :BAR'
  64. $MAKE test | $FGREP 'FOO: foo foo1 foo2 foo1b :FOO'
  65. :