vars3.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 variables containing spaces
  17. # and other non-POSIX characters.
  18. . test-init.sh
  19. cat >Makefile.am <<'EOF'
  20. L01 = $(shell echo *)
  21. L02 = $$(not an error)
  22. L03 = $$(this is)$${ok too}
  23. L04 = $(nextvariableisbad)$(addsuffix .a, $(A))
  24. L05 = "$(bad boy)"
  25. L06 = $(this:is= ok)
  26. L07 = ${three errors}${on this} $(long line)
  27. L08$(o u c h): $(wildcard *.c)
  28. ${another Error}
  29. echo $${ok-this is}
  30. L11: $(thisis) $(ok)
  31. ${here}
  32. EOF
  33. $ACLOCAL
  34. # Make sure this warning is print in the 'portability' category.
  35. $AUTOMAKE --warnings=no-error,none,portability 2>stderr \
  36. || { cat stderr >&2; exit 1; }
  37. cat stderr >&2
  38. # Lines number are printed in error message.
  39. # Use them to make sure errors are diagnosed against the right lines.
  40. # No error expected apart from those on these lines.
  41. grep -v '^Makefile\.am:[145789]:' stderr | grep . && exit 1
  42. # Now check some individual values.
  43. grep ':1:.*shell echo' stderr
  44. grep 'nextvariableisbad' stderr && exit 1
  45. grep ':4:.*addsuffix' stderr
  46. grep ':5:.*bad boy' stderr
  47. grep ':7:.*three errors' stderr
  48. grep ':7:.*on this' stderr
  49. grep ':7:.*long line' stderr
  50. grep ':8:.*o u c h' stderr
  51. grep ':8:.*wildcard' stderr
  52. grep ':9:.*another Error' stderr
  53. $EGREP 'ok|thisis|here' stderr && exit 1
  54. # None of these errors be diagnosed with '-Wno-portability'.
  55. $AUTOMAKE -Wno-portability
  56. # Likewise if we add this in the Makefile.am
  57. # (although this makes some difference internally: AUTOMAKE_OPTIONS is
  58. # processed far later).
  59. echo 'AUTOMAKE_OPTIONS = -Wno-portability' >> Makefile.am
  60. $AUTOMAKE
  61. :