Noeud:Using Bison with the GNU Build System, Noeud « Next »:Exercises on Bison, Noeud « Previous »:The yleval Module, Noeud « Up »:Parsing
Autoconf and Automake provide some generic Yacc support, but no Bison
dedicated support. In particular Automake expects y.tab.c
and
y.tab.h
as output files, which makes it go through various hoops
to prevent several concurrent invocations of yacc
to overwrite
each others' output.
As Gperf, Lex, and Flex, Yacc and Bison are maintainer requirements: someone changing the package needs them, but since their result is shipped, a regular user does not need them. Really, don't bother with different Yaccs, Bison alone will satisfy all your needs, and if it doesn't, just improve it!
If you use Autoconf's AC_PROG_YACC
, then if bison
is
found, it sets YACC
to bison --yacc
, otherwise to
byacc
if it exist, otherwise to yacc
. It seems so much
simpler to simply set YACC
to bison
! But then you lose
the assistance of Automake, and in particular of missing
(voir Using Gperf with the GNU Build System). So I suggest simply
sticking to AC_PROG_YACC
, and let Automake handle the rest.
Then, in your Makefile.am
, merely list Bison sources as ordinary
source files:
LDFLAGS = -no-undefined pkglibexec_LTLIBRARIES = yleval.la yleval_la_SOURCES = ylparse.y ylscan.l yleval.c yleval.h ylparse.h yleval_la_LDFLAGS = -module
and that's all.