yacc-pr204.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. # For PR 204.
  17. # C sources derived from nodist_ yacc sources should not be distributed.
  18. # See also related test 'yacc-nodist.sh'.
  19. # The tests 'lex-nodist.sh' and 'lex-pr204.sh' does similar checks
  20. # for lex-generated C files.
  21. required='cc yacc'
  22. . test-init.sh
  23. cat >> configure.ac <<'EOF'
  24. AM_MAINTAINER_MODE
  25. AC_PROG_CC
  26. AC_PROG_YACC
  27. AC_OUTPUT
  28. EOF
  29. # The PARSE2 intermediate variable is there to make
  30. # sure Automake match 'nodist_' against the right
  31. # variable name...
  32. cat > Makefile.am << 'EOF'
  33. AM_YFLAGS = -d
  34. EXTRA_PROGRAMS = foo
  35. PARSE2 = parse2.y
  36. nodist_foo_SOURCES = parse.y $(PARSE2)
  37. distdirtest: distdir
  38. test ! -f $(distdir)/parse.c
  39. test ! -f $(distdir)/parse.y
  40. test ! -f $(distdir)/parse.h
  41. test ! -f $(distdir)/parse2.c
  42. test ! -f $(distdir)/parse2.y
  43. test ! -f $(distdir)/parse2.h
  44. EOF
  45. cat > parse.y << 'END'
  46. %{
  47. int yylex () {return 0;}
  48. void yyerror (char *s) {}
  49. %}
  50. %%
  51. maude : 'm' 'a' 'u' 'd' 'e' {};
  52. END
  53. cp parse.y parse2.y
  54. $ACLOCAL
  55. $AUTOCONF
  56. $AUTOMAKE -a
  57. ./configure
  58. $MAKE distdirtest
  59. # Make sure parse.c and parse2.c are still targets.
  60. $MAKE parse.c parse2.c
  61. test -f parse.c
  62. test -f parse2.c
  63. # Ensure the rebuild rule works despite AM_MAINTAINER_MODE, because
  64. # it's a nodist_ parser.
  65. $sleep
  66. touch parse.y parse2.y
  67. $sleep
  68. $MAKE parse.c parse2.c
  69. is_newest parse.c parse.y
  70. is_newest parse2.c parse2.y
  71. :