warnings-win-over-strictness.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. # Check that, on the command line, explicitly-defined warnings take
  17. # precedence over implicit strictness-implied warnings.
  18. . test-init.sh
  19. # We want complete control over automake options.
  20. AUTOMAKE=$am_original_AUTOMAKE
  21. ok ()
  22. {
  23. AUTOMAKE_run $*
  24. test ! -s stderr
  25. }
  26. ko ()
  27. {
  28. AUTOMAKE_run $*
  29. grep '^Makefile\.am:.*:=.*not portable' stderr
  30. test $(wc -l <stderr) -eq 1
  31. }
  32. set_am_opts()
  33. {
  34. set +x
  35. sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
  36. -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
  37. mv -f $2-t $2
  38. set -x
  39. cat $2
  40. }
  41. # Files required in gnu strictness.
  42. touch README INSTALL NEWS AUTHORS ChangeLog COPYING
  43. cat > Makefile.am <<END
  44. AUTOMAKE_OPTIONS =
  45. FOO := bar
  46. END
  47. $ACLOCAL
  48. ko --foreign -Wportability
  49. ko -Wportability --foreign
  50. ok --gnu -Wno-portability
  51. ok -Wno-portability --gnu
  52. set_am_opts '' Makefile.am
  53. rm -rf autom4te*.cache
  54. set_am_opts 'foreign -Wportability' configure.ac
  55. ko
  56. rm -rf autom4te*.cache
  57. set_am_opts '-Wportability foreign' configure.ac
  58. ko
  59. rm -rf autom4te*.cache
  60. set_am_opts 'gnu -Wno-portability' configure.ac
  61. ok
  62. rm -rf autom4te*.cache
  63. set_am_opts '-Wno-portability gnu' configure.ac
  64. ok
  65. rm -rf autom4te*.cache
  66. set_am_opts '' configure.ac
  67. set_am_opts 'foreign -Wportability' Makefile.am
  68. ko
  69. set_am_opts '-Wportability foreign' Makefile.am
  70. ko
  71. set_am_opts 'gnu -Wno-portability' Makefile.am
  72. ok
  73. set_am_opts '-Wno-portability gnu' Makefile.am
  74. ok
  75. :