[Top][All Lists]

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

Re: AC_PROG_YACC question

From: Bob Proulx
Subject: Re: AC_PROG_YACC question
Date: Fri, 5 Oct 2001 10:53:04 -0600


> Here's what autoconf (2.13) docs say about AC_PROG_YACC :
>       "If bison is found, set output variable YACC to `bison -y'.
>        Otherwise, if byacc is found, set YACC to `byacc'.  Otherwise set
>        YACC to `yacc'."
> I was wondering, if it finds neither bison nor byacc, why doesn't the macro
> also looks for yacc before setting the variable ? I'd expect it to be the
> job of the configure script to tell the user that the package won't build
> unless he installs the package rather than having make fail with some 
> `yacc : not found' message. (same for AC_PROG_LEX)
> I understand that was probably a design decision, a feature rather than a
> bug, but I don't quite get the reasoning behind this decision.

I have only dipped my toes into autoconf myself so don't take anything
I say as authoritative.  And please pipe in with corrections.  That is
my disclaimer.  But I just worked through this problem myself

You have an old version of autoconf.  The new version of the docs or
the code or both have apparently been updated.  Your version might be
documented accurately.  Here is what the say now.

   - Macro: AC_PROG_YACC
       If `bison' is found, set output variable `YACC' to `bison -y'.
       Otherwise, if `byacc' is found, set `YACC' to `byacc'.  Otherwise
       set `YACC' to `yacc'.

And looking at the code in /usr/share/autoconf/acspecific.m4 we find
the following snippet.

  # ------------
  [AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)])

If automake sees a .y file in your source tree it will want to see
YACC set to some value in your  If you don't care which
then just call AC_PROG_YACC.  But in my case I prefer a different
order.  Therefore instead of AC_PROG_YACC I use the following.

  AC_CHECK_PROGS(YACC,byacc yacc 'bison -y',[${am_missing_run} yacc])

This fulfills the need to set YACC, it looks for byacc first and then
yacc and then finally 'bison -y' if nothing else exists.  If nothing
is found it will call 'missing yacc' which prints a user level message
describing the problem in their development environment.  Repeat the
same description again for AC_PROG_LEX but normally the default order
there is fine for me.

Hope this helps.  But I am sure you were probably already aware of all
of that.


reply via email to

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