diff --git a/meson.build b/meson.build index ac70663..6f48c65 100644 --- a/meson.build +++ b/meson.build @@ -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',