warnings-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. # warnings specified later should take precedence over those specified
  18. # earlier.
  19. . test-init.sh
  20. # We want (almost) complete control over automake options.
  21. AUTOMAKE="$am_original_AUTOMAKE -Werror"
  22. cat > Makefile.am <<'END'
  23. FOO := bar
  24. AUTOMAKE_OPTIONS =
  25. END
  26. set_warnings ()
  27. {
  28. set +x
  29. sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
  30. -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
  31. mv -f $2-t $2
  32. set -x
  33. cat $2
  34. }
  35. ok ()
  36. {
  37. $AUTOMAKE $*
  38. }
  39. ko ()
  40. {
  41. AUTOMAKE_fails $*
  42. grep '^Makefile\.am:1:.*:=.*not portable' stderr
  43. }
  44. # Files required in gnu strictness.
  45. touch README INSTALL NEWS AUTHORS ChangeLog COPYING
  46. $ACLOCAL
  47. ok -Wportability -Wno-portability
  48. ko -Wno-portability -Wportability
  49. set_warnings '' Makefile.am
  50. set_warnings '-Wportability -Wno-portability' configure.ac
  51. rm -rf autom4te*.cache
  52. $ACLOCAL
  53. ok
  54. set_warnings '-Wno-portability -Wportability' configure.ac
  55. rm -rf autom4te*.cache
  56. $ACLOCAL
  57. ko
  58. set_warnings '' configure.ac
  59. rm -rf autom4te*.cache
  60. $ACLOCAL
  61. set_warnings '-Wportability -Wno-portability' Makefile.am
  62. ok
  63. set_warnings '-Wno-portability -Wportability' Makefile.am
  64. ko
  65. :