lflags-cxx.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #! /bin/sh
  2. # Copyright (C) 2010-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 $(LFLAGS) takes precedence over both $(AM_LFLAGS) and
  17. # $(foo_LFLAGS). This is the C++ case.
  18. # Please keep this in sync with the sister tests:
  19. # - lflags.sh
  20. # - yflags.sh
  21. # - yflags-cxx.sh
  22. . test-init.sh
  23. cat >fake-lex <<'END'
  24. #!/bin/sh
  25. echo '/*' "$*" '*/' >lex.yy.c
  26. echo 'extern int dummy;' >> lex.yy.c
  27. END
  28. chmod a+x fake-lex
  29. cat >> configure.ac <<'END'
  30. AC_SUBST([CXX], [false])
  31. # Simulate presence of Lex using our fake-lex script.
  32. AC_SUBST([LEX], ['$(abs_top_srcdir)'/fake-lex])
  33. AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
  34. AC_SUBST([LEXLIB], [''])
  35. AC_OUTPUT
  36. END
  37. cat > Makefile.am <<'END'
  38. AUTOMAKE_OPTIONS = no-dependencies
  39. bin_PROGRAMS = foo bar
  40. foo_SOURCES = main.cc foo.ll
  41. bar_SOURCES = main.cc bar.l++
  42. AM_LFLAGS = __am_flags__
  43. bar_LFLAGS = __bar_flags__
  44. END
  45. $ACLOCAL
  46. $AUTOMAKE -a
  47. grep '\$(LFLAGS).*\$(bar_LFLAGS)' Makefile.in && exit 1
  48. grep '\$(LFLAGS).*\$(AM_LFLAGS)' Makefile.in && exit 1
  49. : > foo.ll
  50. : > bar.l++
  51. $AUTOCONF
  52. ./configure
  53. run_make LFLAGS=__user_flags__ foo.cc bar-bar.c++
  54. cat foo.cc
  55. cat bar-bar.c++
  56. grep '__am_flags__.*__user_flags__' foo.cc
  57. grep '__bar_flags__.*__user_flags__' bar-bar.c++
  58. :