strictness-precedence.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. # On the command line, in AM_INIT_AUTOMAKE, and in AUTOMAKE_OPTIONS,
  17. # strictness specified later should take precedence over strictness
  18. # specified earlier.
  19. . test-init.sh
  20. # We want complete control over automake options.
  21. AUTOMAKE=$am_original_AUTOMAKE
  22. cat > Makefile.am <<'END'
  23. AUTOMAKE_OPTIONS =
  24. END
  25. set_strictness ()
  26. {
  27. set +x
  28. sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
  29. -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
  30. mv -f $2-t $2
  31. set -x
  32. cat $2
  33. }
  34. ok ()
  35. {
  36. $AUTOMAKE -Werror $*
  37. }
  38. ko ()
  39. {
  40. AUTOMAKE_fails $*
  41. grep 'required file.*README' stderr
  42. }
  43. # Leave out only one of the required files, to avoid too much
  44. # repetition in the error messages.
  45. touch INSTALL NEWS AUTHORS ChangeLog COPYING
  46. $ACLOCAL
  47. ko --foreign --gnu
  48. ok --gnu --foreign
  49. set_strictness '' Makefile.am
  50. set_strictness 'gnu foreign' configure.ac
  51. rm -rf autom4te*.cache
  52. $ACLOCAL
  53. ok
  54. set_strictness 'foreign gnu' configure.ac
  55. rm -rf autom4te*.cache
  56. $ACLOCAL
  57. ko
  58. set_strictness '' configure.ac
  59. rm -rf autom4te*.cache
  60. $ACLOCAL
  61. set_strictness 'gnu foreign' Makefile.am
  62. ok
  63. set_strictness 'foreign gnu' Makefile.am
  64. ko
  65. :