strictness-override.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #! /bin/sh
  2. # Copyright (C) 2011-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. # The strictness specified in Makefile.am:AUTOMAKE_OPTIONS should
  17. # override that specified in configure.ac:AM_INIT_AUTOMAKE, and both
  18. # should override the strictness specified on the command line.
  19. # NOTE: the current semantics might not be the best one (even if it has
  20. # been in place for quite a long time); see also Automake bug #7673.
  21. # Update this test if the semantics are changed.
  22. . test-init.sh
  23. # We want complete control over automake options.
  24. AUTOMAKE=$am_original_AUTOMAKE
  25. cat > Makefile.am <<'END'
  26. AUTOMAKE_OPTIONS =
  27. END
  28. set_strictness ()
  29. {
  30. set +x
  31. sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
  32. -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
  33. mv -f $2-t $2
  34. set -x
  35. cat $2
  36. }
  37. ok ()
  38. {
  39. $AUTOMAKE -Werror $*
  40. }
  41. ko ()
  42. {
  43. AUTOMAKE_fails $*
  44. grep 'required file.*README' stderr
  45. }
  46. $ACLOCAL
  47. # Leave out only one of the required files, to avoid too much
  48. # repetition in the error messages.
  49. touch INSTALL NEWS AUTHORS ChangeLog COPYING
  50. rm -rf autom4te*.cache
  51. set_strictness '' Makefile.am
  52. set_strictness '' configure.ac
  53. ko --gnu
  54. ko
  55. ok --foreign
  56. rm -rf autom4te*.cache
  57. set_strictness 'gnu' Makefile.am
  58. set_strictness '' configure.ac
  59. ko --gnu
  60. ko
  61. ko --foreign
  62. rm -rf autom4te*.cache
  63. set_strictness '' Makefile.am
  64. set_strictness 'gnu' configure.ac
  65. ko --gnu
  66. ko
  67. ko --foreign
  68. rm -rf autom4te*.cache
  69. set_strictness 'foreign' Makefile.am
  70. set_strictness '' configure.ac
  71. ok --gnu
  72. ok
  73. ok --foreign
  74. rm -rf autom4te*.cache
  75. set_strictness '' Makefile.am
  76. set_strictness 'foreign' configure.ac
  77. ok --gnu
  78. ok
  79. ok --foreign
  80. rm -rf autom4te*.cache
  81. set_strictness 'gnu' Makefile.am
  82. set_strictness 'gnu' configure.ac
  83. ko --gnu
  84. ko
  85. ko --foreign
  86. rm -rf autom4te*.cache
  87. set_strictness 'foreign' Makefile.am
  88. set_strictness 'foreign' configure.ac
  89. ok --gnu
  90. ok
  91. ok --foreign
  92. rm -rf autom4te*.cache
  93. set_strictness 'foreign' Makefile.am
  94. set_strictness 'gnu' configure.ac
  95. ok --gnu
  96. ok
  97. ok --foreign
  98. rm -rf autom4te*.cache
  99. set_strictness 'gnu' Makefile.am
  100. set_strictness 'foreign' configure.ac
  101. ko --gnu
  102. ko
  103. ko --foreign
  104. :