gnuwarn.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #! /bin/sh
  2. # Copyright (C) 2002-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 Automake warns about user variables being overridden.
  17. . test-init.sh
  18. # We need (almost) complete control over automake options.
  19. AUTOMAKE="$am_original_AUTOMAKE -Werror"
  20. cat >> configure.ac << 'END'
  21. AC_PROG_CC
  22. AC_OUTPUT
  23. END
  24. # Needed by --gnu.
  25. : > NEWS
  26. : > README
  27. : > AUTHORS
  28. : > ChangeLog
  29. cat > Makefile.am << 'END'
  30. CFLAGS += -I..
  31. LDFLAGS = -lfoo
  32. CXXFLAGS = -Wall
  33. bin_PROGRAMS = bar
  34. END
  35. $ACLOCAL
  36. # Don't warn in foreign mode
  37. $AUTOMAKE --add-missing --foreign
  38. # Warn in gnu mode
  39. AUTOMAKE_fails --add-missing --gnu
  40. grep '^Makefile\.am:1:.*CFLAGS' stderr
  41. grep '^Makefile\.am:2:.*LDFLAGS' stderr
  42. # No reason to warn about CXXFLAGS since it's not used.
  43. grep CXXFLAGS stderr && exit 1
  44. # Don't warn if -Wno-gnu.
  45. $AUTOMAKE --gnu -Wno-gnu
  46. :