cond36.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/sh
  2. # Copyright (C) 2004-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 rules output for parser defined conditionally.
  17. . test-init.sh
  18. cat >>configure.ac <<'EOF'
  19. AM_CONDITIONAL([CASE_A], [test -z "$case_B"])
  20. AC_PROG_CC
  21. AM_PROG_LEX
  22. AC_PROG_YACC
  23. AC_OUTPUT
  24. EOF
  25. cat > Makefile.am <<'EOF'
  26. AM_YFLAGS = -d
  27. BUILT_SOURCES = tparse.h
  28. if CASE_A
  29. bin_PROGRAMS = ta
  30. ta_SOURCES = ta.c tparse.h tscan.l tparse.y
  31. ta_LDADD = $(LEXLIB)
  32. else
  33. bin_PROGRAMS = tb
  34. tb_SOURCES = tb.c tparse.h tscan.l tparse.y
  35. tb_LDADD = $(LEXLIB)
  36. tparse.h: tparce.c
  37. echo whatever
  38. endif
  39. EOF
  40. $ACLOCAL
  41. # Presently Automake doesn't fully support partially overriden rules
  42. # and should complain.
  43. AUTOMAKE_fails --add-missing
  44. grep 'tparse\.h.*already defined' stderr
  45. $AUTOMAKE -Wno-error
  46. # Still and all, it should generate two rules.
  47. $FGREP 'tparse.h' Makefile.in # For debugging.
  48. test $($FGREP -c 'tparse.h:' Makefile.in) -eq 2
  49. $FGREP '@CASE_A_TRUE@tparse.h:' Makefile.in
  50. $FGREP '@CASE_A_FALSE@tparse.h:' Makefile.in
  51. :