lex-depend-cxx.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. # Test to make sure dependencies work with Lex/C++.
  17. # Test synthesized from PR automake/6.
  18. required='c++ lex'
  19. . test-init.sh
  20. cat >> configure.ac << 'END'
  21. AC_PROG_CXX
  22. AM_PROG_LEX
  23. AC_OUTPUT
  24. END
  25. cat > Makefile.am << 'END'
  26. noinst_PROGRAMS = joe moe
  27. joe_SOURCES = joe.ll
  28. moe_SOURCES = moe.l++
  29. LDADD = $(LEXLIB)
  30. .PHONY: test-deps-exist
  31. test-deps-exist:
  32. ls -l $(DEPDIR) ;: For debugging.
  33. test -f $(DEPDIR)/joe.Po
  34. test -f $(DEPDIR)/moe.Po
  35. .PHONY: test-obj-updated
  36. test-obj-updated: joe.$(OBJEXT) moe.$(OBJEXT)
  37. is_newest joe.$(OBJEXT) my-hdr.hxx
  38. is_newest moe.$(OBJEXT) my-hdr.hxx
  39. END
  40. cat > joe.ll << 'END'
  41. %{
  42. #define YY_NO_UNISTD_H 1
  43. int isatty (int fd) { return 0; }
  44. %}
  45. %%
  46. "foo" return EOF;
  47. .
  48. %%
  49. #include "my-hdr.hxx"
  50. int yywrap (void)
  51. {
  52. return 1;
  53. }
  54. int main (int argc, char **argv)
  55. {
  56. return 0;
  57. }
  58. END
  59. cp joe.ll moe.l++
  60. cat > my-hdr.hxx <<'END'
  61. // This header contains deliberately invalid C (but valid C++).
  62. using namespace std;
  63. END
  64. $ACLOCAL
  65. $AUTOMAKE -a
  66. $FGREP joe.Po Makefile.in
  67. $FGREP moe.Po Makefile.in
  68. $AUTOCONF
  69. # Try to enable dependency tracking if possible, even if that means
  70. # using slow dependency extractors.
  71. ./configure --enable-dependency-tracking
  72. $MAKE test-deps-exist
  73. $MAKE
  74. $sleep
  75. touch my-hdr.hxx
  76. $MAKE test-obj-updated
  77. :