Stefano Lattarini <stefano.lattar...@gmail.com> writes: > It seems that AC_PROG_LEX does not diagnose a failure to find the lex > library required to link lex-generated programs; on the contrary, when > all the link attempts (i.e., with `-ll' and `-lfl') fail, configure > uncorrectly declares that no lex library is needed (!), and happily > proceeds with the configuration process -- only to then have `make' fail > at build time. This seems wrong to me, and is certainly definitely > against the autoconf philosophy.
The current behavior is intentional, I think. See the Autoconf manual's documentation of AC_PROG_LEX: 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. Once this done, the scanner is portable (unless _you_ felt free to use nonportable constructs) and does not depend on any library. In this case, and in this case only, it is suggested that you use this Autoconf snippet: AC_PROG_LEX if test "x$LEX" != xflex; then LEX="$SHELL $missing_dir/missing flex" AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy]) AC_SUBST([LEXLIB], ['']) fi Autoconf is assuming that people are writing portable scanners and hence dealing with yywrap, which is why it doesn't require the library exist. -- Russ Allbery (r...@stanford.edu) <http://www.eyrie.org/~eagle/>