lflags.sh 1.8 KB

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