build: fix build with byacc

We apparently broke byacc support in the switch to meson.

byacc only supports short option names. And to make things fun, bison
only supports long option for `--defines`.

Fixes: https://github.com/xkbcommon/libxkbcommon/issues/133
Signed-off-by: Ran Benita <ran@unusedvar.com>
master
Ran Benita 2020-02-18 14:12:20 +02:00
parent c90703265f
commit 1b23a650ab
1 changed files with 20 additions and 7 deletions

View File

@ -135,13 +135,26 @@ have_version_script = cc.links(
# libxkbcommon.
# Note: we use some yacc extensions, which work with either GNU bison
# (preferred) or byacc. Other yacc's may or may not work.
yacc = find_program('bison', 'win_bison', 'byacc')
yacc_gen = generator(
yacc,
output: ['@BASENAME@.c', '@BASENAME@.h'],
arguments: ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@', '-p _xkbcommon_'],
)
# (preferred) or byacc (with backtracking enabled).
bison = find_program('bison', 'win_bison', required: false)
if bison.found()
yacc_gen = generator(
bison,
output: ['@BASENAME@.c', '@BASENAME@.h'],
arguments: ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@', '-p _xkbcommon_'],
)
else
byacc = find_program('byacc', required: false)
if byacc.found()
yacc_gen = generator(
byacc,
output: ['@BASENAME@.c', '@BASENAME@.h'],
arguments: ['@INPUT@', '-H', '@OUTPUT1@', '-o', '@OUTPUT0@', '-p _xkbcommon_'],
)
else
error('Could not find a compatible YACC program (bison or byacc)')
endif
endif
libxkbcommon_sources = [
'src/compose/parser.c',
'src/compose/parser.h',