cond38.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/sh
  2. # Copyright (C) 2005-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 conditional variable ordering.
  17. # Report from Ed Hartnett.
  18. . test-init.sh
  19. cat >>configure.ac <<'EOF'
  20. AM_CONDITIONAL([CASE_A], :)
  21. AM_CONDITIONAL([CASE_B], :)
  22. AC_OUTPUT
  23. EOF
  24. cat > Makefile.am <<'EOF'
  25. SUBDIRS = a
  26. if CASE_A
  27. SUBDIRS += b
  28. endif
  29. SUBDIRS += c
  30. if CASE_A
  31. SUBDIRS += d
  32. if CASE_B
  33. SUBDIRS += e
  34. endif
  35. SUBDIRS += f
  36. endif
  37. SUBDIRS += g
  38. if CASE_B
  39. SUBDIRS += h
  40. endif
  41. if CASE_B
  42. SUBDIRS += iXYZ
  43. SUBDIRS += jZYX
  44. endif
  45. .PHONY: test
  46. test:
  47. is $(SUBDIRS) == a b c d e f g h iXYZ jZYX
  48. EOF
  49. mkdir a b c d e f g h iXYZ jZYX
  50. $ACLOCAL
  51. $AUTOCONF
  52. $AUTOMAKE
  53. ./configure
  54. # Make sure no extra variable was created for the last 3 items.
  55. grep 'append.*=.* h iXYZ jZYX' Makefile
  56. # Check good ordering.
  57. $MAKE test
  58. :