[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_PROG_LEX does not diagnose failure to find lex library

From: Russ Allbery
Subject: Re: AC_PROG_LEX does not diagnose failure to find lex library
Date: Wed, 18 May 2011 16:06:15 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux)

Stefano Lattarini <address@hidden> 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

          if test "x$LEX" != xflex; then
            LEX="$SHELL $missing_dir/missing flex"
            AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
            AC_SUBST([LEXLIB], [''])

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 (address@hidden)             <http://www.eyrie.org/~eagle/>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]