diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-06-17 14:12:16 +0300 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2020-06-17 14:12:16 +0300 |
commit | c54aa053d14155242bb1c7d8ae0c291dd120f179 (patch) | |
tree | 7ada63921c0faaf4f4f7b58cc41d5dc29c47e9a3 /meson.build | |
parent | 8b4f18d53be27be87d2299c1dcecbd7d2423b5d3 (diff) |
meson: Check the nasm version with run_command
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/751
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/631>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/meson.build b/meson.build index 4469c5eb7..7bb064577 100644 --- a/meson.build +++ b/meson.build @@ -335,18 +335,42 @@ else cdata.set('DISABLE_ORC', 1) endif -have_nasm=false +have_nasm = false # FIXME: nasm path needs testing on non-Linux, esp. Windows host_cpu = host_machine.cpu_family() if host_cpu == 'x86_64' if cc.get_id() == 'msvc' message('Nasm disabled on MSVC') else - nasm = find_program('nasm', native: true, version : '>= 2.13', required: get_option('asm')) + asm_option = get_option('asm') + nasm = find_program('nasm', native: true, required: asm_option) if nasm.found() - message('Nasm found on x86-64') - cdata.set('HAVE_NASM', 1) - have_nasm = true + # We can't use the version: kwarg for find_program because old versions + # of nasm don't support --version + ret = run_command(nasm, '-v') + if ret.returncode() == 0 + nasm_version = ret.stdout().strip().split()[2] + nasm_req = '>=2.13' + if nasm_version.version_compare(nasm_req) + message('nasm found on x86-64') + cdata.set('HAVE_NASM', 1) + have_nasm = true + else + if asm_option.enabled() + error('asm option is enabled, and nasm @0@ was found, but @1@ is required'.format(nasm_version, nasm_req)) + endif + message('nasm @0@ was found, but @1@ is required'.format(nasm_version, nasm_req)) + endif + else + if asm_option.enabled() + error('asm option is enabled, but nasm is not usable: @0@\n@1@'.format(ret.stdout(), ret.stderr())) + endif + message('nasm was found, but it\'s not usable') + endif + # Unset nasm to not be 'found' + if not have_nasm + nasm = disabler() + endif endif endif endif |