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. # libxkbcommon.
# Note: we use some yacc extensions, which work with either GNU bison # Note: we use some yacc extensions, which work with either GNU bison
# (preferred) or byacc. Other yacc's may or may not work. # (preferred) or byacc (with backtracking enabled).
yacc = find_program('bison', 'win_bison', 'byacc') bison = find_program('bison', 'win_bison', required: false)
yacc_gen = generator( if bison.found()
yacc, yacc_gen = generator(
output: ['@BASENAME@.c', '@BASENAME@.h'], bison,
arguments: ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@', '-p _xkbcommon_'], 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 = [ libxkbcommon_sources = [
'src/compose/parser.c', 'src/compose/parser.c',
'src/compose/parser.h', 'src/compose/parser.h',