yflags-force-override.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 automake can cope with a definition of the $(YFLAGS) variable
  17. # in Makefile.am (even if that is extremely bad practice, because that
  18. # variable is user-reserved).
  19. required='cc yacc'
  20. . test-init.sh
  21. cat >> configure.ac <<'END'
  22. AC_PROG_CC
  23. AC_PROG_YACC
  24. AC_OUTPUT
  25. END
  26. cat > Makefile.am <<'END'
  27. bin_PROGRAMS = foo
  28. foo_SOURCES = foo.y
  29. # Don't do this in a real-life Makefile.am!
  30. YFLAGS = -d -v
  31. END
  32. cat > foo.y << 'END'
  33. %{
  34. int yylex () { return 0; }
  35. void yyerror (char *s) { return; }
  36. int main () { return 0; }
  37. %}
  38. %%
  39. foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
  40. END
  41. $ACLOCAL
  42. $AUTOMAKE -a -Wno-gnu
  43. $EGREP '(foo|YFLAGS)' Makefile.in # For debugging.
  44. grep '^foo\.h *:' Makefile.in
  45. $AUTOCONF
  46. ./configure
  47. $MAKE
  48. test -f foo.c
  49. test -f foo.h
  50. test -f foo.output
  51. :