yflags-var-expand.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 automake expand variables when looking for '-d' in YFLAGS;
  17. # for example, the following is supposed to work:
  18. # foo_flags = -d
  19. # AM_YFLAGS = $(foo_flags)
  20. . test-init.sh
  21. cat >> configure.ac <<'END'
  22. AC_PROG_CC
  23. AC_PROG_YACC
  24. END
  25. $ACLOCAL
  26. cat > Makefile.am <<'END'
  27. bin_PROGRAMS = foo bar
  28. foo_SOURCES = foo.y
  29. bar_SOURCES = bar.y
  30. my_YFLAGS = -x
  31. AM_YFLAGS = $(my_YFLAGS:x=d)
  32. bar_YFLAGS = $(AM_YFLAGS)
  33. END
  34. $AUTOMAKE -a
  35. $EGREP '(foo|bar|YFLAGS)' Makefile.in # For debugging.
  36. grep '^foo.h *:' Makefile.in
  37. grep '^bar-bar.h *:' Makefile.in
  38. cat > Makefile.am <<'END'
  39. AUTOMAKE_OPTIONS = -Wno-gnu
  40. bin_PROGRAMS = zardoz
  41. zardoz_SOURCES = parser.y
  42. my_YFLAGS = $(my_YFLAGS_1)
  43. my_YFLAGS += $(my_YFLAGS_2)
  44. my_YFLAGS_2 = -d
  45. YFLAGS = $(my_YFLAGS)
  46. END
  47. $AUTOMAKE
  48. $EGREP 'parser|YFLAGS' Makefile.in # For debugging.
  49. grep '^parser.h *:' Makefile.in
  50. :