yacc-dist-nobuild.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 distributed Yacc-generated parsers are not uselessly
  17. # remade from an unpacked distributed tarball.
  18. # See automake bug#7884.
  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 = foobar zardoz
  28. foobar_SOURCES = parse.y main.c
  29. zardoz_SOURCES = $(foobar_SOURCES)
  30. zardoz_YFLAGS = -d
  31. END
  32. cat > parse.y << 'END'
  33. %{
  34. int yylex () { return 0; }
  35. void yyerror (char *s) {}
  36. %}
  37. %%
  38. foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
  39. END
  40. cat > main.c << 'END'
  41. int main () { return 0; }
  42. END
  43. $ACLOCAL
  44. $AUTOCONF
  45. $AUTOMAKE -a
  46. ./configure
  47. $MAKE
  48. $MAKE distdir
  49. chmod -R a-w $distdir
  50. mkdir bin
  51. cat > bin/yacc <<'END'
  52. #!/bin/sh
  53. echo "$0 invoked, shouldn't happen!" >&2
  54. exit 1
  55. END
  56. cp bin/yacc bin/bison
  57. chmod a+x bin/yacc bin/bison
  58. PATH=$(pwd)/bin$PATH_SEPARATOR$PATH
  59. YACC=yacc BISON=bison
  60. export YACC BISON
  61. mkdir build
  62. cd build
  63. ../$distdir/configure
  64. $MAKE
  65. # Sanity check.
  66. cd ..
  67. chmod u+w $distdir
  68. rm -f $distdir/parse.c
  69. chmod a-w $distdir
  70. mkdir build2
  71. cd build2
  72. ../$distdir/configure
  73. run_make -e FAIL -M
  74. $FGREP parse.c output
  75. :