pluseq9.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. # Test the += diagnostics.
  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. END
  23. cat > Makefile.am << 'END'
  24. if COND1
  25. C = c
  26. if COND2
  27. A = a
  28. B = aa
  29. C += cc
  30. else
  31. A = b
  32. B = bb
  33. endif
  34. A += c
  35. else
  36. A = d
  37. endif
  38. A += e
  39. if COND3
  40. A += f
  41. B = cc
  42. endif
  43. B += dd
  44. END
  45. $ACLOCAL
  46. AUTOMAKE_fails
  47. # We expect the following diagnostic:
  48. #
  49. # Makefile.am:19: cannot apply '+=' because 'B' is not defined in
  50. # Makefile.am:19: the following conditions:
  51. # Makefile.am:19: !COND1 and !COND3
  52. # Makefile.am:19: either define 'B' in these conditions, or use
  53. # Makefile.am:19: '+=' in the same conditions as the definitions.
  54. #
  55. # It would be nice if Automake could print only COND3_FALSE and
  56. # COND1_FALSE (merging the last two conditions), so we'll support
  57. # this case in the check too.
  58. grep '[cC]annot apply.*+=' stderr
  59. grep ': !COND1 and !COND3$' stderr
  60. # Make sure there is exactly one missing condition.
  61. test $(grep -c ': ' stderr) -eq 1
  62. :