Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

automake 1.12 changes bison/yacc output names, backwards incompatible change?

I have posted a repository at https://github.com/Habbie/autoyacc-problem to demonstrate my issue.

With automake 1.11 and below, using AC_PROG_YACC in configure.ac and AM_YFLAGS=-d in Makefile.am, parser.yy gets turned into parser.cc and parser.h. With automake 1.12, I get parser.cc and parser.hh. Because mybin.cc has include "parser.h", this means 1.12 breaks my build.

I have the feeling this is a backwards incompatible change, but I feel there should be a sane way to deal with this.

To demonstrate:

git clone https://github.com/Habbie/autoyacc-problem.git
cd autoyacc-problem/
autoreconf -i
./configure
make

Result with automake 1.11: mybin gets built. Result with automake 1.12:

mybin.cc:1:20: error: parser.h: No such file or directory

Help!

Note: there is no actual C++ code in this example but for my real issue I do need g++.

like image 891
Habbie Avatar asked Nov 03 '22 23:11

Habbie


1 Answers

I aint no expert; but given how you are depending on undocumented behaviour in the older versions of automake (see zhenech) you can either require a newer version of automake (so you can depend on defined behaviour); or make sure the expected file is generated by automake.

Given the default output extension is ".hh" you can make something that generates the .hh file out of the .h file (for the older versions of automake) with a simple make instruction:

.h.hh:
    cp $< $@

if you prefer to generate .h files out of .hh files you may want to turn around the definitions, and depending on specifics of lex/yacc processing of autotools i am infamilar with, you might want to add the generated file to BUILT_SOURCES

like image 106
nido Avatar answered Nov 11 '22 16:11

nido