yacc-grepping.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #! /bin/sh
  2. # Copyright (C) 1996-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. # Some grep-based checks on yacc support:
  17. #
  18. # - Make sure intermediate .c file is built from yacc source.
  19. # Report from Thomas Morgan.
  20. #
  21. # - Make sure intermediate .h file is not generated nor removed
  22. # if (AM_)?YFLAGS do not contain '-d'.
  23. # Requested by Jim Meyering.
  24. . test-init.sh
  25. cat >> configure.ac << 'END'
  26. AC_PROG_CC
  27. AC_PROG_YACC
  28. END
  29. # Run it here once and for all, since we are not going to modify
  30. # configure.ac anymore.
  31. $ACLOCAL
  32. cat > Makefile.am <<'END'
  33. bin_PROGRAMS = zardoz
  34. zardoz_SOURCES = zardoz.y
  35. END
  36. # Don't redefine several times the same variable.
  37. cp Makefile.am Makefile.src
  38. $AUTOMAKE -a
  39. $FGREP 'zardoz.c' Makefile.in
  40. # If zardoz.h IS mentioned, fail.
  41. $FGREP 'zardoz.h' Makefile.in && exit 1
  42. cp Makefile.src Makefile.am
  43. echo 'AM_YFLAGS = -d' >> Makefile.am
  44. $AUTOMAKE
  45. $FGREP 'zardoz.c' Makefile.in
  46. # If zardoz.h is NOT mentioned, fail.
  47. $FGREP 'zardoz.h' Makefile.in
  48. cp Makefile.src Makefile.am
  49. echo 'AM_YFLAGS = ' >> Makefile.am
  50. $AUTOMAKE
  51. $FGREP 'zardoz.c' Makefile.in
  52. # If zardoz.h IS mentioned, fail.
  53. $FGREP 'zardoz.h' Makefile.in && exit 1
  54. cp Makefile.src Makefile.am
  55. echo 'YFLAGS = -d' >> Makefile.am
  56. # YFLAGS is a user variable.
  57. AUTOMAKE_fails
  58. grep 'YFLAGS.* user variable' stderr
  59. grep 'AM_YFLAGS.* instead' stderr
  60. $AUTOMAKE -Wno-gnu
  61. # If zardoz.h is NOT mentioned, fail.
  62. $FGREP 'zardoz.h' Makefile.in
  63. cp Makefile.src Makefile.am
  64. echo 'YFLAGS = ' >> Makefile.am
  65. $AUTOMAKE -Wno-gnu
  66. # If zardoz.h IS mentioned, fail.
  67. $FGREP 'zardoz.h' Makefile.in && exit 1
  68. :