cond46.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #! /bin/sh
  2. # Copyright (C) 2009-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 3 of the License, or
  7. # (at your option) 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. # Ensure the right condition is listed after 'else' and 'endif'.
  17. . test-init.sh
  18. cat >> configure.ac << 'END'
  19. AM_CONDITIONAL([USE_A], [test x = y])
  20. AM_CONDITIONAL([USE_B], [test x = z])
  21. AC_OUTPUT
  22. END
  23. notcompat="incompatible with current conditional"
  24. $ACLOCAL
  25. cat > Makefile.am << 'END'
  26. if USE_A
  27. endif !USE_A
  28. END
  29. AUTOMAKE_fails
  30. grep "^Makefile\\.am:2:.*endif.*!USE_A.*$notcompat.*[^!]USE_A" stderr
  31. cat > Makefile.am << 'END'
  32. if USE_A
  33. endif USE_B
  34. END
  35. AUTOMAKE_fails
  36. grep "^Makefile\\.am:2:.*endif.*[^!]USE_B.*$notcompat.*[^!]USE_A" stderr
  37. cat > Makefile.am << 'END'
  38. if USE_A
  39. else
  40. endif USE_A
  41. END
  42. AUTOMAKE_fails
  43. grep "^Makefile\\.am:3:.*endif.*[^!]USE_A.*$notcompat.*USE_A" stderr
  44. cat > Makefile.am << 'END'
  45. if USE_A
  46. else
  47. endif !USE_A
  48. END
  49. $AUTOMAKE
  50. cat > Makefile.am << 'END'
  51. if USE_A
  52. if USE_B
  53. else
  54. endif !USE_A
  55. endif
  56. END
  57. AUTOMAKE_fails
  58. grep "^Makefile\\.am:4:.*endif.*!USE_A.*$notcompat.*USE_B" stderr
  59. cat > Makefile.am << 'END'
  60. if USE_A
  61. else USE_A
  62. endif
  63. END
  64. AUTOMAKE_fails
  65. grep "^Makefile\\.am:2:.*else.*[^!]USE_A.*$notcompat.*[^!]USE_A" stderr
  66. cat > Makefile.am << 'END'
  67. if USE_A
  68. else !USE_A
  69. endif
  70. END
  71. $AUTOMAKE
  72. cat > Makefile.am << 'END'
  73. if USE_A
  74. else USE_B
  75. endif
  76. END
  77. AUTOMAKE_fails
  78. grep "^Makefile\\.am:2:.*else.*[^!]USE_B.*$notcompat.*[^!]USE_A" stderr
  79. cat > Makefile.am << 'END'
  80. if USE_A
  81. if USE_B
  82. else USE_A
  83. endif
  84. endif
  85. END
  86. AUTOMAKE_fails
  87. grep "^Makefile\\.am:3:.*else.*[^!]USE_A.*$notcompat.*[^!]USE_B" stderr
  88. :