bug 1257689 - move YASM check to moz.configure. r?mshal
MozReview-Commit-ID: KU3eSCsykPl
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -262,16 +262,17 @@ def wanted_mozconfig_variables(help):
'MOZ_INSTRUMENT_EVENT_LOOP',
'PERL',
'RPMBUILD',
'TAR',
'UNZIP',
'USE_FC_FREETYPE',
'WITHOUT_X',
'XARGS',
+ 'YASM',
'ZIP',
])
@depends(mozconfig, wanted_mozconfig_variables)
def mozconfig_options(mozconfig, wanted_mozconfig_variables):
if mozconfig['path']:
helper = command_line_helper()
--- a/config/config.mk
+++ b/config/config.mk
@@ -133,17 +133,17 @@ TOUCH ?= touch
PYTHON_PATH = $(PYTHON) $(topsrcdir)/config/pythonpath.py
# determine debug-related options
_DEBUG_ASFLAGS :=
_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
ifneq ($(OS_ARCH),Darwin)
_DEBUG_ASFLAGS += -g dwarf2
endif
endif
else
--- a/moz.configure
+++ b/moz.configure
@@ -106,16 +106,60 @@ def perl_version_check(min_version):
def require_full_perl_installation(has_full_perl_installation):
if not has_full_perl_installation:
error('Cannot find Config.pm or $Config{archlib}. '
'A full perl installation is required.')
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.
+ add_old_configure_assignment('_YASM_MAJOR_VERSION', version[0])
+ add_old_configure_assignment('_YASM_MINOR_VERSION', version[1])
+ 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 -rnasm -pnasm',
+ ('OSX', 'x86_64'): '-f macho64 -rnasm -pnasm',
+ ('WINNT', 'x86'): '-f win32 -rnasm -pnasm',
+ ('WINNT', 'x86_64'): '-f x64 -rnasm -pnasm',
+ }.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 -rnasm -pnasm'
+ elif target.cpu == 'x86_64':
+ asflags = '-f elf64 -rnasm -pnasm'
+ if asflags:
+ 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)
check_prog('TAR', ('gnutar', 'gtar', 'tar'))
check_prog('UNZIP', ('unzip',))
check_prog('XARGS', ('xargs',))
check_prog('ZIP', ('zip',))
--- a/old-configure.in
+++ b/old-configure.in
@@ -2788,69 +2788,16 @@ if test -n "$_USE_SYSTEM_NSS"; then
fi
if test -n "$MOZ_SYSTEM_NSS"; then
NSS_LIBS="$NSS_LIBS -lcrmf"
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 ========================================================
MOZ_ARG_WITH_STRING(system-jpeg,
[ --with-system-jpeg[=PFX]
Use system libjpeg [installed at prefix PFX]],
JPEG_DIR=$withval)