vartypos.sh 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #! /bin/sh
  2. # Copyright (C) 2010-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. # Make sure we warn about possible variable typos when we should.
  17. . test-init.sh
  18. cat >>configure.ac <<'END'
  19. AC_PROG_RANLIB
  20. AC_OUTPUT
  21. END
  22. cat >Makefile.am <<'END'
  23. foo_SOURCES = unused
  24. nodist_foo_SOURCES = unused
  25. EXTRA_foo_SOURCES = unused
  26. foo_LDADD = unused
  27. foo_LDFLAGS = unused
  28. foo_DEPENDENCIES = unused
  29. EXTRA_foo_DEPENDENCIES = unused
  30. libfoo_a_SOURCES = unused
  31. nodist_libfoo_a_SOURCES = unused
  32. EXTRA_libfoo_a_SOURCES = unused
  33. libfoo_a_LIBADD = unused
  34. libfoo_a_DEPENDENCIES = unused
  35. EXTRA_libfoo_a_DEPENDENCIES = unused
  36. END
  37. $ACLOCAL
  38. AUTOMAKE_fails -Wno-extra-portability
  39. # The expected diagnostic is:
  40. # automake: warnings are treated as errors
  41. # Makefile.am:2: warning: variable 'nodist_foo_SOURCES' is defined but no program or
  42. # Makefile.am:2: library has 'foo' as canonical name (possible typo)
  43. # Makefile.am:1: warning: variable 'foo_SOURCES' is defined but no program or
  44. # Makefile.am:1: library has 'foo' as canonical name (possible typo)
  45. # Makefile.am:9: warning: variable 'libfoo_a_SOURCES' is defined but no program or
  46. # Makefile.am:9: library has 'libfoo_a' as canonical name (possible typo)
  47. # Makefile.am:10: warning: variable 'nodist_libfoo_a_SOURCES' is defined but no program or
  48. # Makefile.am:10: library has 'libfoo_a' as canonical name (possible typo)
  49. # Makefile.am:11: warning: variable 'EXTRA_libfoo_a_SOURCES' is defined but no program or
  50. # Makefile.am:11: library has 'libfoo_a' as canonical name (possible typo)
  51. # Makefile.am:3: warning: variable 'EXTRA_foo_SOURCES' is defined but no program or
  52. # Makefile.am:3: library has 'foo' as canonical name (possible typo)
  53. # Makefile.am:12: warning: variable 'libfoo_a_LIBADD' is defined but no program or
  54. # Makefile.am:12: library has 'libfoo_a' as canonical name (possible typo)
  55. # Makefile.am:4: warning: variable 'foo_LDADD' is defined but no program or
  56. # Makefile.am:4: library has 'foo' as canonical name (possible typo)
  57. # Makefile.am:5: warning: variable 'foo_LDFLAGS' is defined but no program or
  58. # Makefile.am:5: library has 'foo' as canonical name (possible typo)
  59. # Makefile.am:14: warning: variable 'EXTRA_libfoo_a_DEPENDENCIES' is defined but no program or
  60. # Makefile.am:14: library has 'libfoo_a' as canonical name (possible typo)
  61. # Makefile.am:7: warning: variable 'EXTRA_foo_DEPENDENCIES' is defined but no program or
  62. # Makefile.am:7: library has 'foo' as canonical name (possible typo)
  63. # Makefile.am:6: warning: variable 'foo_DEPENDENCIES' is defined but no program or
  64. # Makefile.am:6: library has 'foo' as canonical name (possible typo)
  65. # Makefile.am:13: warning: variable 'libfoo_a_DEPENDENCIES' is defined but no program or
  66. # Makefile.am:13: library has 'libfoo_a' as canonical name (possible typo)
  67. grep 'as canonical' stderr | grep -v ' .foo. ' | grep -v ' .libfoo_a. ' \
  68. && exit 1
  69. test $(grep -c 'variable.*is defined but' stderr) -eq 13
  70. # If we add a global -Wnone, all warnings should disappear.
  71. $AUTOMAKE -Wnone
  72. # Likewise, if matching programs or libraries are defined.
  73. cat >>Makefile.am <<'END'
  74. bin_PROGRAMS = foo
  75. lib_LIBRARIES = libfoo.a
  76. END
  77. $AUTOMAKE -Wno-extra-portability
  78. :