warnings-override.sh 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 warnings specified in Makefile.am:AUTOMAKE_OPTIONS should override
  17. # those specified in configure.ac:AM_INIT_AUTOMAKE, and both should
  18. # override the warnings 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 (almost) complete control over automake options.
  24. AUTOMAKE="$am_original_AUTOMAKE -Werror"
  25. cat > Makefile.am <<'END'
  26. FOO := bar
  27. AUTOMAKE_OPTIONS =
  28. END
  29. set_warnings ()
  30. {
  31. set +x
  32. sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
  33. -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
  34. mv -f $2-t $2
  35. set -x
  36. cat $2
  37. }
  38. ok ()
  39. {
  40. $AUTOMAKE $*
  41. }
  42. ko ()
  43. {
  44. AUTOMAKE_fails $*
  45. grep '^Makefile\.am:1:.*:=.*not portable' stderr
  46. }
  47. $ACLOCAL
  48. # Files required in gnu strictness.
  49. touch README INSTALL NEWS AUTHORS ChangeLog COPYING
  50. rm -rf autom4te*.cache
  51. set_warnings '-Wno-portability' Makefile.am
  52. set_warnings '' configure.ac
  53. ok -Wportability
  54. ok
  55. rm -rf autom4te*.cache
  56. set_warnings '' Makefile.am
  57. set_warnings '-Wno-portability' configure.ac
  58. ok -Wportability
  59. ok
  60. rm -rf autom4te*.cache
  61. set_warnings '-Wno-portability' Makefile.am
  62. set_warnings '-Wno-portability' configure.ac
  63. ok -Wportability
  64. rm -rf autom4te*.cache
  65. set_warnings '-Wportability' Makefile.am
  66. set_warnings '' configure.ac
  67. ko
  68. ko -Wno-portability
  69. rm -rf autom4te*.cache
  70. set_warnings '' Makefile.am
  71. set_warnings '-Wportability' configure.ac
  72. ko
  73. ko -Wno-portability
  74. rm -rf autom4te*.cache
  75. set_warnings '-Wportability' Makefile.am
  76. set_warnings '-Wportability' configure.ac
  77. ko -Wno-portability
  78. rm -rf autom4te*.cache
  79. set_warnings '-Wno-portability' Makefile.am
  80. set_warnings '-Wportability' configure.ac
  81. ok
  82. ok -Wportability
  83. rm -rf autom4te*.cache
  84. set_warnings '-Wportability' Makefile.am
  85. set_warnings '-Wno-portability' configure.ac
  86. ko
  87. ko -Wno-portability
  88. :