2
0

lex5.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #! /bin/sh
  2. # Copyright (C) 2002-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. # Test for subdir lexers.
  17. required='cc lex'
  18. . test-init.sh
  19. cat >> configure.ac << 'END'
  20. AC_PROG_CC
  21. AM_PROG_LEX
  22. AC_OUTPUT
  23. END
  24. cat > Makefile.am << 'END'
  25. AUTOMAKE_OPTIONS = subdir-objects
  26. LDADD = @LEXLIB@
  27. bin_PROGRAMS = foo/foo
  28. foo_foo_SOURCES = foo/foo.l
  29. END
  30. mkdir foo
  31. cat > foo/foo.l << 'END'
  32. %{
  33. #define YY_NO_UNISTD_H 1
  34. %}
  35. %%
  36. "END" return EOF;
  37. .
  38. %%
  39. int
  40. main ()
  41. {
  42. while (yylex () != EOF)
  43. ;
  44. return 0;
  45. }
  46. END
  47. $ACLOCAL
  48. $AUTOCONF
  49. $AUTOMAKE -a
  50. # We expect ylwrap to be used and distributed even if there is
  51. # only one lexer.
  52. test -f ylwrap
  53. mkdir sub
  54. cd sub
  55. ../configure
  56. $MAKE foo/foo.o
  57. ls -l # For debugging.
  58. test -f foo/foo.c
  59. test -f foo/foo.o
  60. # Now, adds another lexer to test ylwrap.
  61. cd ..
  62. cp foo/foo.l foo/foo2.l
  63. cat >> Makefile.am << 'END'
  64. EXTRA_foo_foo_SOURCES = foo/foo2.l
  65. END
  66. # Make sure Makefile.in has a new time stamp: the rebuild rules are
  67. # used below. We do this after updating Makefile.am, that way we can
  68. # ensure that automake, even with --no-force, is not confused if the
  69. # new Makefile.am has the same time stamp as the older one (since the
  70. # output will change, --no-force should have no effect).
  71. $sleep
  72. $AUTOMAKE -a --no-force
  73. cd sub
  74. using_gmake || $MAKE Makefile
  75. $MAKE foo/foo2.o
  76. ls -l # For debugging.
  77. test -f foo/foo2.c
  78. test -f foo/foo2.o
  79. :