autoconf
[Top][All Lists]
Advanced

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

Re: AC_PROG_LEX behavior


From: Patrick Welche
Subject: Re: AC_PROG_LEX behavior
Date: Wed, 3 Jun 2009 10:36:17 +0100
User-agent: Mutt/1.5.19 (2009-06-01)

On Fri, Mar 21, 2008 at 10:29:05AM -0400, Stefan Seefeld wrote:
> I'm trying to use AC_PROG_LEX to discover whether flex (or lex) is
> available. During testing I found out that, even when neither is
> available, the LEX variable is set to ':' instead of being empty.
> And sure enough, I subsequently found this in the programs.m4 code:
> 
> 
> AC_DEFUN_ONCE([AC_PROG_LEX],
> [AC_CHECK_PROGS(LEX, flex lex, :)
> if test "x$LEX" != "x:"; then
>   _AC_PROG_LEX_YYTEXT_DECL
> fi])
> 
> Is this intentional ? Is it documented somewhere ? In other words, is it
> ok for me to check for "test $LEX != ':'" to discover success ?

While here, I just hit the following problem:

User has old flex in /usr/bin/flex, and new flex in /usr/local/bin,
so calls "./configure LEX=/usr/local/bin/flex" to configure the
program which needs new flex. The problem is that AC_PROG_FLEX's
description is

     If `flex' is found, set output variable `LEX' to `flex'...

so the program's configure.ac tests

          if test "$LEX" != flex; then

as a way of testing flex vs lex, and decides that there is no flex.

So, essentially, $LEX is being used for two things: "this is where my
lexer lives" and "this is real flex".

Not sure on what is best here - thoughts?

Cheers,

Patrick




reply via email to

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