From 8b19c5b145592314a63569d7ba3f0e10df84a5cf Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 17 May 2018 13:42:50 -0700 Subject: [PATCH] meson: Add support for using win_flex and win_bison on windows Acked-by: Kristian H. Kristensen --- meson.build | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 10b9c9e9b19..b823dd8ecec 100644 --- a/meson.build +++ b/meson.build @@ -1438,8 +1438,31 @@ endif # pthread stubs. Lets not and say we didn't -prog_bison = find_program('bison', required : with_any_opengl) -prog_flex = find_program('flex', required : with_any_opengl) +if host_machine.system() == 'windows' + # Prefer the winflexbison versions, they're much easier to install and have + # better windows support. + + prog_flex = find_program('win_flex', required : false) + if prog_flex.found() + # windows compatibility (uses instead of and _isatty, + # _fileno functions) + prog_flex = [prog_flex, '--wincompat'] + else + prog_flex = [find_program('lex', 'flex', required : with_any_opengl)] + endif + # Force flex to use const keyword in prototypes, as relies on __cplusplus or + # __STDC__ macro to determine whether it's safe to use const keyword, but + # MSVC never defines __STDC__ unless we disable all MSVC extensions. + prog_flex += '-DYY_USE_CONST=' + + prog_bison = find_program('win_bison', required : false) + if not prog_bison.found() + prog_bison = find_program('yacc', 'bison', required : with_any_opengl) + endif +else + prog_bison = find_program('bison', required : with_any_opengl) + prog_flex = find_program('flex', required : with_any_opengl) +endif dep_selinux = null_dep if get_option('selinux') -- 2.30.2