Bug 1501796 - Check for nasm in configure script. r=firefox-build-system-reviewers,mshal

Differential Revision: https://phabricator.services.mozilla.com/D9854

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Thomas Daede 2018-11-07 00:26:15 +00:00
Родитель 369464db2e
Коммит ede80683a6
1 изменённых файлов: 59 добавлений и 0 удалений

Просмотреть файл

@ -128,6 +128,65 @@ set_config('HAVE_YASM', have_yasm)
# Until the YASM variable is not necessary in old-configure.
add_old_configure_assignment('YASM', have_yasm)
# nasm detection
# ==============================================================
nasm = check_prog('NASM', ['nasm'], allow_missing=True)
@depends_if(nasm)
@checking('nasm version')
def nasm_version(nasm):
version = check_cmd_output(
nasm, '-v',
onerror=lambda: die('Failed to get nasm version.')
).splitlines()[0].split()[2]
return Version(version)
@depends_if(nasm_version)
def nasm_major_version(nasm_version):
return str(nasm_version.major)
@depends_if(nasm_version)
def nasm_minor_version(nasm_version):
return str(nasm_version.minor)
set_config('NASM_MAJOR_VERSION', nasm_major_version)
set_config('NASM_MINOR_VERSION', nasm_minor_version)
@depends(nasm, target)
def nasm_asflags(nasm, target):
if nasm:
asflags = {
('OSX', 'x86'): ['-f', 'macho32'],
('OSX', 'x86_64'): ['-f', 'macho64'],
('WINNT', 'x86'): ['-f', 'win32'],
('WINNT', 'x86_64'): ['-f', 'win64'],
}.get((target.os, target.cpu), None)
if asflags is None:
# We're assuming every x86 platform we support that's
# not Windows or Mac is ELF.
if target.cpu == 'x86':
asflags = ['-f', 'elf32']
elif target.cpu == 'x86_64':
asflags = ['-f', 'elf64']
return asflags
set_config('NASM_ASFLAGS', nasm_asflags)
@depends(nasm_asflags)
def have_nasm(value):
if value:
return True
set_config('HAVE_NASM', have_nasm)
# Android NDK
# ==============================================================