]> git.ipfire.org Git - thirdparty/automake.git/commit
lex tests: avoid spurious failures when LEXLIB isn't found
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 25 May 2011 17:05:15 +0000 (19:05 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Thu, 26 May 2011 15:16:49 +0000 (17:16 +0200)
commiteb147a19783b1cee960502697124e68e4c109df5
tree9bef9006f3492bda711547dbfddc9ef444e14781
parent47fc204c850dd547d8d8dd28bdc07074d9179626
lex tests: avoid spurious failures when LEXLIB isn't found

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 might be (partly) 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 in Linux->MinGW cross
compilations).  But at this point is clear that a proper workaround
is to simply provide a fall-back implementation of `yywrap' in our
lexers.

* tests/cond35.test: Provide a dummy `yywrap' function.
* tests/lex3.test: Likewise.
* tests/lexvpath.test: Likewise.
* tests/silent-many-gcc.test: Likewise.
* tests/silent-many-generic.test: Likewise.
* tests/silent-lex-gcc.test: Likewise, and a dummy `main' too.
* tests/silent-lex-generic.test: Likewise.
* tests/lex-lib.test: New test.
* tests/lex-libobj.test: New test.
* tests/lex-nowrap.test: New test.
* tests/Makefile.am (TESTS): Update.
* THANKS: Update.

Thanks to Russ Allbery for the suggestion.
14 files changed:
ChangeLog
THANKS
tests/Makefile.am
tests/Makefile.in
tests/cond35.test
tests/lex-lib.test [new file with mode: 0755]
tests/lex-libobj.test [new file with mode: 0755]
tests/lex-noyywrap.test [new file with mode: 0755]
tests/lex3.test
tests/lexvpath.test
tests/silent-lex-gcc.test
tests/silent-lex-generic.test
tests/silent-many-gcc.test
tests/silent-many-generic.test