bug 1257689 - move YASM check to moz.configure. r=mshal

MozReview-Commit-ID: KU3eSCsykPl

--HG--
extra : rebase_source : 4ec8256a4c772b61497ad442620aacb39f3b9ade
extra : amend_source : 258380912dcbcdb4dee2ac6737d71aa5328d12a7
extra : histedit_source : 9cabff8c5ba88ce541ea9881d9147dc4fb3a5692%2Cb1a74d8d449ebbbf5727a9665542043a5b122af7
This commit is contained in:
Ted Mielczarek 2016-03-17 19:15:01 -04:00
parent cc2cdd3cd6
commit 509c7d11f9
4 changed files with 48 additions and 54 deletions

View File

@ -276,6 +276,7 @@ def wanted_mozconfig_variables(help):
'USE_FC_FREETYPE',
'WITHOUT_X',
'XARGS',
'YASM',
'ZIP',
])

View File

@ -138,7 +138,7 @@ _DEBUG_CFLAGS :=
_DEBUG_LDFLAGS :=
ifneq (,$(MOZ_DEBUG)$(MOZ_DEBUG_SYMBOLS))
ifeq ($(AS),yasm)
ifeq ($(AS),$(YASM))
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
_DEBUG_ASFLAGS += -g cv8
else

View File

@ -120,6 +120,52 @@ def perl_version_check(min_version):
perl_version_check('5.006')
# yasm detection
# ==============================================================
yasm = check_prog('YASM', ['yasm'], allow_missing=True)
@depends(yasm)
@checking('yasm version')
@advanced
def yasm_version(yasm):
if yasm:
import subprocess
try:
version = Version(subprocess.check_output(
[yasm, '--version']
).splitlines()[0].split()[1])
# Until we move all the yasm consumers out of old-configure.
# bug 1257904
add_old_configure_assignment('_YASM_MAJOR_VERSION', version.major)
add_old_configure_assignment('_YASM_MINOR_VERSION', version.minor)
return version
except subprocess.CalledProcessError as e:
error('Failed to get yasm version: %s' % e.message)
@depends(yasm, target)
def yasm_asflags(yasm, target):
if yasm:
asflags = {
('OSX', 'x86'): '-f macho32',
('OSX', 'x86_64'): '-f macho64',
('WINNT', 'x86'): '-f win32',
('WINNT', 'x86_64'): '-f x64',
}.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'
if asflags:
asflags += ' -rnasm -pnasm'
set_config('YASM_ASFLAGS', asflags)
set_config('HAVE_YASM', '1')
# Until the YASM variable is not necessary in old-configure.
add_old_configure_assignment('YASM', '1')
return asflags
# Miscellaneous programs
# ==============================================================
check_prog('DOXYGEN', ('doxygen',), allow_missing=True)

View File

@ -2606,59 +2606,6 @@ else
NSS_CFLAGS="-I${DIST}/include/nss"
fi
dnl ======================
dnl Detect yasm
dnl ======================
AC_MSG_CHECKING([for YASM assembler])
AC_CHECK_PROGS(YASM, yasm, "")
if test -n "$YASM"; then
AC_MSG_CHECKING([yasm version])
dnl Pull out yasm's version string
YASM_VERSION=`yasm --version | $AWK '/^yasm/ { print $2 }'`
_YASM_MAJOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $1 }'`
_YASM_MINOR_VERSION=`echo ${YASM_VERSION} | $AWK -F\. '{ print $2 }'`
_YASM_RELEASE=` echo ${YASM_VERSION} | $AWK -F\. '{ print $3 }'`
_YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'`
AC_MSG_RESULT([$_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.$_YASM_RELEASE ($YASM_VERSION)])
# Determine proper yasm arguments.
YASM_ASFLAGS=
case "$OS_ARCH:$CPU_ARCH" in
Darwin:x86)
YASM_ASFLAGS="-f macho32 -rnasm -pnasm"
;;
Darwin:x86_64)
YASM_ASFLAGS="-f macho64 -rnasm -pnasm"
;;
WINNT:x86_64)
YASM_ASFLAGS="-f x64 -rnasm -pnasm"
;;
WINNT:x86)
YASM_ASFLAGS="-f win32 -rnasm -pnasm"
;;
*:x86)
if $CC -E -dM -</dev/null | grep -q __ELF__; then
YASM_ASFLAGS="-f elf32 -rnasm -pnasm"
fi
;;
*:x86_64)
if $CC -E -dM -</dev/null | grep -q __ELF__; then
YASM_ASFLAGS="-f elf64 -rnasm -pnasm"
fi
;;
*)
# yasm doesn't support other architectures, so just disable it.
YASM=
esac
if test -z "$YASM_ASFLAGS"; then
# If we didn't get YASM_ASFLAGS, we shouldn't be using yasm.
YASM=
fi
fi
AC_SUBST(YASM_ASFLAGS)
if test -z "$SKIP_LIBRARY_CHECKS"; then
dnl system JPEG support
dnl ========================================================