vartypo2.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. # Libtool variant.
  18. required=libtoolize
  19. . test-init.sh
  20. cat >>configure.ac <<'END'
  21. AM_PROG_AR
  22. AC_PROG_LIBTOOL
  23. AC_OUTPUT
  24. END
  25. cat >Makefile.am <<'END'
  26. libfoo_la_SOURCES = unused
  27. nodist_libfoo_la_SOURCES = unused
  28. EXTRA_libfoo_la_SOURCES = unused
  29. libfoo_la_LIBADD = unused
  30. libfoo_la_DEPENDENCIES = unused
  31. EXTRA_libfoo_la_DEPENDENCIES = unused
  32. END
  33. libtoolize
  34. $ACLOCAL
  35. AUTOMAKE_fails --add-missing
  36. # The expected diagnostic is:
  37. # automake: warnings are treated as errors
  38. # Makefile.am:3: warning: variable 'EXTRA_libfoo_la_SOURCES' is defined but no program or
  39. # Makefile.am:3: library has 'libfoo_la' as canonical name (possible typo)
  40. # Makefile.am:1: warning: variable 'libfoo_la_SOURCES' is defined but no program or
  41. # Makefile.am:1: library has 'libfoo_la' as canonical name (possible typo)
  42. # Makefile.am:2: warning: variable 'nodist_libfoo_la_SOURCES' is defined but no program or
  43. # Makefile.am:2: library has 'libfoo_la' as canonical name (possible typo)
  44. # Makefile.am:4: warning: variable 'libfoo_la_LIBADD' is defined but no program or
  45. # Makefile.am:4: library has 'libfoo_la' as canonical name (possible typo)
  46. # Makefile.am:6: warning: variable 'EXTRA_libfoo_la_DEPENDENCIES' is defined but no program or
  47. # Makefile.am:6: library has 'libfoo_la' as canonical name (possible typo)
  48. # Makefile.am:5: warning: variable 'libfoo_la_DEPENDENCIES' is defined but no program or
  49. # Makefile.am:5: library has 'libfoo_la' as canonical name (possible typo)
  50. grep 'as canonical' stderr | grep -v ' .libfoo_la. ' && exit 1
  51. test $(grep -c 'variable.*is defined but' stderr) -eq 6
  52. # If we add a global -Wnone, all warnings should disappear.
  53. $AUTOMAKE -Wnone
  54. # Likewise, if matching programs or libraries are defined.
  55. cat >>Makefile.am <<'END'
  56. lib_LTLIBRARIES = libfoo.la
  57. END
  58. $AUTOMAKE
  59. :