yacc-bison-skeleton.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. # Test to make sure bison + bison's skeleton works.
  17. # For Automake bug#7648 and PR automake/491.
  18. required='cc bison'
  19. . test-init.sh
  20. cat >> configure.ac << 'END'
  21. AC_PROG_CC
  22. AC_C_INLINE dnl Required by some pre-C99 compilers such as MSVC.
  23. AC_PROG_YACC
  24. AC_OUTPUT
  25. END
  26. cat > Makefile.am << 'END'
  27. bin_PROGRAMS = zardoz
  28. zardoz_SOURCES = zardoz.y foo.c
  29. AM_YFLAGS = -d --skeleton glr.c
  30. BUILT_SOURCES = zardoz.h
  31. END
  32. # Parser.
  33. cat > zardoz.y << 'END'
  34. %{
  35. int yylex ();
  36. void yyerror (const char *s);
  37. %}
  38. %%
  39. foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
  40. %%
  41. int yylex () { return 0; }
  42. void yyerror (const char *s) { return; }
  43. END
  44. cat > foo.c << 'END'
  45. #include "zardoz.h"
  46. int main (void)
  47. {
  48. return yyparse ();
  49. }
  50. END
  51. $ACLOCAL
  52. $AUTOCONF
  53. $AUTOMAKE -a
  54. # Try a VPATH build first.
  55. mkdir build
  56. cd build
  57. ../configure YACC='bison -y'
  58. $MAKE
  59. cd ..
  60. # Now try an in-tree build.
  61. ./configure YACC='bison -y'
  62. $MAKE
  63. # Check that distribution is self-contained, and do not require
  64. # bison to be built.
  65. yl_distcheck YACC=false DISTCHECK_CONFIGURE_FLAGS='YACC=false'
  66. :