Subject: Better bison support in Automake (was: Re: FYI: master: calc++: rely on Automake)

From: Stefano Lattarini <[email-masked]>
Date: Thu, 16 Feb 2012 11:21:31 +0100

[CC:ing bug-automake, so that we won't forget about the issues raised here]

Hi Akim.

On 02/15/2012 01:31 PM, Akim Demaille wrote:
> 
> Le 15 févr. 2012 à 13:18, Stefano Lattarini a écrit :
> 
>> On 02/15/2012 11:36 AM, Akim Demaille wrote:
>>> Rely on $(YACC) being the bison being built, and let Automake do the
>>> rest.  It turned out to be much more difficult than anticipated, for
>>> various reasons, including some bad behavior from Automake 1.11.2
>>> which (i) generates calc++-parser.h instead of calc++-parser.hh,
>>>
>> FYI: this will be fixed in automake 1.12 -- the patch fixing it being
>> already merged into master.
> 
> Thanks Stefano!
> 
> I can't clone automake right now (Savannah seems to be overloaded),
> so I can't check the following typo in the current documentation.
> It should take you only a couple of seconds to check.
> 
>>    ---------- Footnotes ----------
>>
>>    (1) Please note that `automake' recognizes `-d' in `AM_YFLAGS' only
>> if it is not clustered with other options; for example, it won't be
>> recognized if `AM_YFLAGS' is `-dt', but it will be if `AM_YFLAGS' is
>> `-d -t' or `-d -t'
> 
> I guess the latter is `-t -d', and the period is missing.
>
Thanks, fixed (see attached patch).

> But maybe automake no longer needs this?
>
It still need it; without that, no header file will be generated from
the '.y' files (this is a feature, not a bug).

> If it does, it would be good to recognize also --defines.
> 
Maybe; but then, it should be done right, i.e., automake should also
understand hand handle the '--defines=my-hdr.h' usage.  But I guess
this would conflict with ylwrap in some way, sigh :-(

Maybe it's truly time to introduce a new AM_PROG_BISON macro that
will cause automake to drop all the cruft related to POSIX yacc
compatibility ...  As usual, patches welcome ;-)

Regards,
  Stefano
>From 22b28b638a2d7d9d05bf7f2741367fc36f8bb8c0 Mon Sep 17 00:00:00 2001
Message-Id: <22b28b638[email-masked]>
From: Stefano Lattarini <[email-masked]>
Date: Thu, 16 Feb 2012 11:09:50 +0100
Subject: [PATCH] docs: fix typo in description of AM_YFLAGS

Report by Akim Demaille.

* doc/automake.texi (Program variables): Don't list "-d -t" twice
in the examples of valid ways to specify the '-d' flag to Yacc;
instead, use "-d -t" and "-t -d".  Add missing period.
---
 doc/automake.texi |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/doc/automake.texi b/doc/automake.texi
index da134ef..8b1a84b 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -6209,7 +6209,7 @@ adjust its rules to update and distribute the header file built by
 @option{-d} in @code{AM_YFLAGS} only if it is not clustered with other
 options; for example, it won't be recognized if @code{AM_YFLAGS} is
 @option{-dt}, but it will be if @code{AM_YFLAGS} is @option{-d -t} or
-@option{-d -t}}.
+@option{-t -d}.}.
 What Automake cannot guess, though, is where this
 header will be used: it is up to you to ensure the header gets built
 before it is first used.  Typically this is necessary in order for
-- 
1.7.9