Skip to content
Snippets Groups Projects
Commit 57fd614e authored by Thibault Saunier's avatar Thibault Saunier
Browse files

meson: Check bison and flex are recent enough

https://bugzilla.gnome.org/show_bug.cgi?id=781155
parent 4903de24
No related branches found
No related tags found
Loading
...@@ -3,6 +3,7 @@ cc = meson.get_compiler('c') ...@@ -3,6 +3,7 @@ cc = meson.get_compiler('c')
# Find flex, configure lex generator # Find flex, configure lex generator
flex_cdata = configuration_data() flex_cdata = configuration_data()
flex_min_version='2.5.31'
flex = find_program('flex', required : false) flex = find_program('flex', required : false)
if not flex.found() if not flex.found()
flex = find_program('win_flex', required : false) flex = find_program('win_flex', required : false)
...@@ -11,6 +12,18 @@ if not flex.found() ...@@ -11,6 +12,18 @@ if not flex.found()
endif endif
endif endif
flexversion_res = run_command([flex, '--version'])
if flexversion_res.returncode() != 0
error('Could not get flex version (@0@)'.format(flexversion_res.stderr()))
endif
flexversion = flexversion_res.stdout().split('\n')[0].split(' ')[-1].strip()
if flexversion.version_compare('<' + flex_min_version)
error('flex version @0@ >= @1@: NO'.format(flexversion, flex_min_version))
else
message('flex version @0@ >= @1@: YES'.format(flexversion, flex_min_version))
endif
flex_cdata.set('FLEX', flex.path()) flex_cdata.set('FLEX', flex.path())
if cc.get_id() == 'msvc' if cc.get_id() == 'msvc'
flex_cdata.set('FLEX_ARGS', '--nounistd') flex_cdata.set('FLEX_ARGS', '--nounistd')
...@@ -25,6 +38,7 @@ gen_lex = configure_file(input : 'gen_lex.py.in', ...@@ -25,6 +38,7 @@ gen_lex = configure_file(input : 'gen_lex.py.in',
# Find bison, configure grammar generator # Find bison, configure grammar generator
bison_cdata = configuration_data() bison_cdata = configuration_data()
bison_min_version='2.4'
bison = find_program('bison', required : false) bison = find_program('bison', required : false)
if not bison.found() if not bison.found()
bison = find_program('win_bison', required : false) bison = find_program('win_bison', required : false)
...@@ -33,6 +47,20 @@ if not bison.found() ...@@ -33,6 +47,20 @@ if not bison.found()
endif endif
endif endif
bversion_res = run_command([bison, '--version'])
if bversion_res.returncode() != 0
error('Could not get bison version (@0@)'.format(bversion_res.stderr()))
endif
bversion = bversion_res.stdout().split('\n')[0].split(' ')[-1].strip()
if bversion.version_compare('<' + bison_min_version)
error('bison version @0@ >= @1@: NO'.format(bversion, bison_min_version))
else
message('bison version @0@ >= @1@: YES'.format(bversion, bison_min_version))
endif
bison_cdata.set('BISON', bison.path()) bison_cdata.set('BISON', bison.path())
bison_cdata.set('BISON_ARGS', '') bison_cdata.set('BISON_ARGS', '')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment