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>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
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',