tests: fix spurious failures due to missing 'yywrap()' function
commit0b34421dc2d78a163ce9eaca41348dd672c302ed
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 12 Feb 2012 15:37:44 +0000 (12 16:37 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 12 Feb 2012 15:37:44 +0000 (12 16:37 +0100)
tree0451ef77353bcaf68bb6487ae83a593d694a1725
parente6c40d4bba3155a8dd2406806a7be51d3ac73ed0
tests: fix spurious failures due to missing 'yywrap()' function

The AC_PROG_LEX Autoconf macro does not diagnose a failure to find
the "lex library" expected to provide a 'yywrap' function (function
which is required to link most lex-generated programs).  On the
contrary, when all the link attempts (i.e., with '-ll' and '-lfl')
fail, configure declares that no lex library is needed, and simply
proceeds with the configuration process -- only for the build to
possibly fail later, at make time.

This behaviour is intended; the Autoconf manual reads:

  You are encouraged to use Flex in your sources, since it is
  both more pleasant to use than plain Lex and the C source it
  produces is portable.  In order to ensure portability, however,
  you must either provide a function 'yywrap' or, if you don't use
  it (e.g., your scanner has no '#include'-like feature), simply
  include a '%noyywrap' statement in the scanner's source.

This AC_PROG_LEX behaviour is causing some spurious failures of
the Automake testsuite in environments which lack a proper library
providing 'yywrap' (this happens for example on Fedora-based
systems).   The proper workaround is to simply provide a fall-back
implementation of 'yywrap' in our lexers.

See also similar commits 'v1.11-546-gca0ba5d' (24-10-2011),
'v1.11-1085-gb5c3968' (24-10-2011) and 'v1.11-871-geb147a1'
(25-05-2011).

* tests/lex-clean.test: Provide a dummy 'yywrap' function.
* tests/lex-line.test: Likewise.
* tests/lex-nodist.test: Likewise.
* tests/lex-depend.test: Likewise.
* tests/lex-clean-cxx.test: Move the dummy 'yywrap' function
from the main '.cc' file into the '.lxx' file, so that it won't
be subject to the namespace declaration in the '.cc' file (which
was causing a spurious link error in systems without a default
"lex library").
tests/lex-clean-cxx.test
tests/lex-clean.test
tests/lex-depend.test
tests/lex-line.test
tests/lex-nodist.test