bug-autoconf
[Top][All Lists]
Advanced

[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: Stefano Lattarini
Subject: Re: AC_PROG_LEX does not diagnose failure to find lex library
Date: Wed, 25 May 2011 19:51:15 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

Hi Russ, sorry for the dealy.

On Thursday 19 May 2011, Russ Allbery wrote:
> 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
>      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.
> 
> 
Thanks for the information.  I've now posted a patch on the Automake list
that fixes the last spurious failures in the lex tests by making use of
your suggestions.  Reference:
 <http://lists.gnu.org/archive/html/automake-patches/2011-05/msg00103.html>

That said, I still think the current autoconf behaviour is somewhat messy
and suboptimal, and, if not a real bug, at least an usability issue.  But
I'm not sure how it could be fixed or improved, so I'll stop complaining
for now ;-)

Thanks,
  Stefano



reply via email to

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