Bug 1515852 - Move --with-system-jpeg to python configure. r=froydnj
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 21 Dec 2018 15:47:22 +0000
changeset 508888 2c4de7449db2b6fa793d6a0f9919759cb81a3895
parent 508887 ca959629000bf8b631ddc17c9a94d3c6d75138b8
child 508889 1d645417b0829d67161fba8f60d61c90fc703be4
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1515852
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1515852 - Move --with-system-jpeg to python configure. r=froydnj We remove --disable-libjpeg-turbo because that's only useful when Yasm is too old, and the required version is now almost 8 years old, so we can reasonably require people to upgrade rather than workaround with a --disable option. The valid_yasm_version function can seem overkill, but that's because future moves of other things to python configure will pile up. Differential Revision: https://phabricator.services.mozilla.com/D15184
build/moz.configure/old.configure
old-configure.in
python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py
toolkit/moz.configure
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -246,17 +246,16 @@ def old_configure_options(*options):
     '--with-nspr-prefix',
     '--with-nss-exec-prefix',
     '--with-nss-prefix',
     '--with-qemu-exe',
     '--with-sixgill',
     '--with-soft-float',
     '--with-system-bz2',
     '--with-system-icu',
-    '--with-system-jpeg',
     '--with-system-libevent',
     '--with-system-nspr',
     '--with-system-nss',
     '--with-system-png',
     '--with-system-zlib',
     '--with-thumb',
     '--with-thumb-interwork',
     '--with-unify-dist',
--- a/old-configure.in
+++ b/old-configure.in
@@ -40,17 +40,16 @@ dnl ====================================
 _SUBDIR_HOST_CC="$HOST_CC"
 _SUBDIR_HOST_CFLAGS="$HOST_CFLAGS"
 _SUBDIR_HOST_CXXFLAGS="$HOST_CXXFLAGS"
 _SUBDIR_HOST_LDFLAGS="$HOST_LDFLAGS"
 _SUBDIR_CONFIG_ARGS="$ac_configure_args"
 
 dnl Set the version number of the libs included with mozilla
 dnl ========================================================
-MOZJPEG=62
 MOZPNG=10635
 NSPR_VERSION=4
 NSPR_MINVER=4.19
 NSS_VERSION=3
 
 dnl Set the minimum version of toolkit libs used by mozilla
 dnl ========================================================
 GLIB_VERSION=2.22
@@ -1634,61 +1633,16 @@ if test -z "$MOZ_SYSTEM_NSS"; then
         WINNT|Darwin|Linux|DragonFly|FreeBSD|NetBSD|OpenBSD|SunOS)
             ;;
         *)
             AC_MSG_ERROR([building in-tree NSS is not supported on this platform. Use --with-system-nss])
             ;;
    esac
 fi
 
-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)
-
-_SAVE_CFLAGS=$CFLAGS
-_SAVE_LDFLAGS=$LDFLAGS
-_SAVE_LIBS=$LIBS
-if test -n "${JPEG_DIR}" -a "${JPEG_DIR}" != "yes"; then
-    CFLAGS="-I${JPEG_DIR}/include $CFLAGS"
-    LDFLAGS="-L${JPEG_DIR}/lib $LDFLAGS"
-fi
-if test -z "$JPEG_DIR" -o "$JPEG_DIR" = no; then
-    MOZ_SYSTEM_JPEG=
-else
-    AC_CHECK_LIB(jpeg, jpeg_destroy_compress, [MOZ_SYSTEM_JPEG=1 MOZ_JPEG_LIBS="-ljpeg"], MOZ_SYSTEM_JPEG=)
-fi
-
-if test "$MOZ_SYSTEM_JPEG" = 1; then
-    AC_TRY_COMPILE([ #include <stdio.h>
-                     #include <sys/types.h>
-                     #include <jpeglib.h> ],
-                   [ #if JPEG_LIB_VERSION < $MOZJPEG
-                     #error "Insufficient JPEG library version ($MOZJPEG required)."
-                     #endif
-                     #ifndef JCS_EXTENSIONS
-                     #error "libjpeg-turbo JCS_EXTENSIONS required"
-                     #endif
-                     ],
-                   MOZ_SYSTEM_JPEG=1,
-                   AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg]))
-fi
-CFLAGS=$_SAVE_CFLAGS
-LDFLAGS=$_SAVE_LDFLAGS
-LIBS=$_SAVE_LIBS
-
-if test -n "${JPEG_DIR}" -a -d "${JPEG_DIR}" -a "$MOZ_SYSTEM_JPEG" = 1; then
-    MOZ_JPEG_CFLAGS="-I${JPEG_DIR}/include"
-    MOZ_JPEG_LIBS="-L${JPEG_DIR}/lib ${MOZ_JPEG_LIBS}"
-fi
-fi # SKIP_LIBRARY_CHECKS
-
 dnl system ZLIB support
 dnl ========================================================
 MOZ_ZLIB_CHECK([1.2.3])
 
 if test -z "$SKIP_LIBRARY_CHECKS"; then
 
 dnl ========================================================
 dnl system PNG Support
@@ -1747,18 +1701,16 @@ MOZ_ARG_HEADER(Application)
 
 ENABLE_SYSTEM_EXTENSION_DIRS=1
 MOZ_BRANDING_DIRECTORY=
 MOZ_OFFICIAL_BRANDING=
 MOZ_AUTH_EXTENSION=1
 if test "$MOZ_IOS"; then
    MOZ_AUTH_EXTENSION=
 fi
-LIBJPEG_TURBO_AS=
-LIBJPEG_TURBO_ASFLAGS=
 MOZ_PREF_EXTENSIONS=1
 MOZ_SPELLCHECK=1
 MOZ_TOOLKIT_SEARCH=1
 MOZ_UNIVERSALCHARDET=1
 MOZ_XUL=1
 MOZ_ZIPWRITER=1
 MOZ_NO_SMART_CARDS=
 NECKO_COOKIES=1
@@ -2382,106 +2334,16 @@ if test -n "$MOZ_CRASHREPORTER"; then
     if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
       MOZ_CRASHREPORTER_INJECTOR=1
       AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
     fi
   fi
 fi
 
 dnl ========================================================
-dnl = libjpeg-turbo configuration
-dnl ========================================================
-MOZ_LIBJPEG_TURBO=
-LIBJPEG_TURBO_USE_YASM=
-if test -z "$MOZ_SYSTEM_JPEG"; then
-    MOZ_LIBJPEG_TURBO=1
-fi
-
-MOZ_ARG_DISABLE_BOOL(libjpeg_turbo,
-[ --disable-libjpeg-turbo  Disable optimized jpeg decoding routines],
-    MOZ_LIBJPEG_TURBO=,
-    MOZ_LIBJPEG_TURBO=1)
-
-if test "$MOZ_SYSTEM_JPEG" = 1 -a "$MOZ_LIBJPEG_TURBO" = 1; then
-    AC_MSG_ERROR([cannot use --with-system-jpeg with --enable-libjpeg-turbo.])
-fi
-
-dnl Detect if we can use yasm to compile libjpeg-turbo's optimized assembly
-dnl files.
-
-if test -n "$MOZ_LIBJPEG_TURBO" -a -n "$COMPILE_ENVIRONMENT"; then
-
-  dnl Do we support libjpeg-turbo on this platform?
-  case "$OS_ARCH:$CPU_ARCH" in
-  Darwin:x86)
-    LIBJPEG_TURBO_ASFLAGS="-DPIC -DMACHO"
-  ;;
-  Darwin:x86_64)
-    LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DMACHO"
-  ;;
-  Darwin:arm*)
-  ;;
-  WINNT:x86)
-    LIBJPEG_TURBO_ASFLAGS="-DPIC -DWIN32"
-  ;;
-  WINNT:x86_64)
-    LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DWIN64 -DMSVC"
-  ;;
-  WINNT:*)
-  ;;
-  *:arm)
-    LIBJPEG_TURBO_ASFLAGS="-march=armv7-a -mfpu=neon"
-  ;;
-  *:aarch64)
-    LIBJPEG_TURBO_ASFLAGS="-march=armv8-a"
-  ;;
-  *:mips32)
-    LIBJPEG_TURBO_ASFLAGS="-mdspr2"
-  ;;
-  *:x86)
-    if $CC -E -dM -</dev/null | grep -q __ELF__; then
-      LIBJPEG_TURBO_ASFLAGS="-DPIC -DELF"
-    fi
-  ;;
-  *:x86_64)
-    if $CC -E -dM -</dev/null | grep -q __ELF__; then
-      LIBJPEG_TURBO_ASFLAGS="-D__x86_64__ -DPIC -DELF"
-    fi
-  ;;
-  esac
-fi
-
-if test -n "$LIBJPEG_TURBO_ASFLAGS"; then
-  case "$CPU_ARCH" in
-dnl If we're on an x86 or x64 system which supports libjpeg-turbo's asm routines
-dnl and --disable-libjpeg-turbo wasn't passed, check for Yasm, and error out if
-dnl it doesn't exist or we have too old of a version.
-  x86_64|x86)
-    LIBJPEG_TURBO_USE_YASM=1
-
-    if test -z "$YASM" ; then
-        AC_MSG_ERROR([Yasm is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you do not appear to have Yasm installed.  Either install it or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
-    fi
-
-    dnl Check that we have the right yasm version.  We require 1.0.1 or newer
-    dnl on Linux and 1.1 or newer everywhere else.
-    if test "$OS_ARCH" = "Linux" ; then
-        if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
-            AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.$_YASM_RELEASE.  Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
-        fi
-    else
-        if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
-            AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libjpeg-turbo's optimized JPEG decoding routines, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION.  Upgrade to the newest version or configure with --disable-libjpeg-turbo to use the pure C JPEG decoder.  See https://developer.mozilla.org/en/YASM for more details.])
-        fi
-    fi
-  ;;
-  esac
-fi
-
-dnl ========================================================
 dnl = libav-fft configuration
 dnl ========================================================
 
 MOZ_LIBAV_FFT=
 
 dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
 dnl 32-bit linux/os x have text relocation issues.
 
@@ -3889,21 +3751,18 @@ HOST_CFLAGS=`echo \
     $_COMPILATION_HOST_CFLAGS \
     $HOST_CFLAGS`
 
 HOST_CXXFLAGS=`echo \
     $_WARNINGS_HOST_CXXFLAGS \
     $_COMPILATION_HOST_CXXFLAGS \
     $HOST_CXXFLAGS`
 
-AC_SUBST(MOZ_SYSTEM_JPEG)
 AC_SUBST(MOZ_SYSTEM_PNG)
 
-AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
-AC_SUBST_LIST(MOZ_JPEG_LIBS)
 AC_SUBST_LIST(MOZ_PNG_CFLAGS)
 AC_SUBST_LIST(MOZ_PNG_LIBS)
 
 AC_SUBST(MOZ_SYSTEM_NSPR)
 
 AC_SUBST(MOZ_SYSTEM_NSS)
 
 HOST_CMFLAGS="-x objective-c -fobjc-exceptions"
@@ -3957,18 +3816,16 @@ AC_SUBST(USE_N32)
 AC_SUBST(CC_VERSION)
 AC_SUBST(NS_ENABLE_TSF)
 AC_SUBST(WIN32_CONSOLE_EXE_LDFLAGS)
 AC_SUBST(WIN32_GUI_EXE_LDFLAGS)
 
 AC_SUBST(MOZ_FFVPX)
 AC_SUBST(MOZ_FFVPX_FLACONLY)
 AC_SUBST_LIST(FFVPX_ASFLAGS)
-AC_SUBST(LIBJPEG_TURBO_USE_YASM)
-AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
 AC_SUBST(MOZ_LIBAV_FFT)
 AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
 AC_SUBST(MOZ_DEVTOOLS)
 
 AC_SUBST(MOZ_PACKAGE_JSSHELL)
 AC_SUBST(MOZ_FOLD_LIBS)
 AC_SUBST_LIST(MOZ_FOLD_LIBS_FLAGS)
 
--- a/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_toolkit_moz_configure.py
@@ -1,20 +1,22 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 from __future__ import absolute_import, print_function, unicode_literals
 
 import os
 
+from StringIO import StringIO
 from buildconfig import topsrcdir
 from common import BaseConfigureTest
 from mozunit import MockedOpen, main
 from mozbuild.configure.options import InvalidOptionError
+from mozbuild.configure.util import Version
 
 
 class TestToolkitMozConfigure(BaseConfigureTest):
     def test_developer_options(self, milestone='42.0a1'):
         def get_value(args=[], environ={}):
             sandbox = self.get_sandbox({}, {}, args, environ)
             return sandbox._value_for(sandbox['developer_options'])
 
@@ -35,10 +37,68 @@ class TestToolkitMozConfigure(BaseConfig
                 get_value(['--disable-release'],
                           environ={'MOZILLA_OFFICIAL': 1})
 
             self.assertEqual(get_value(environ={'MOZ_AUTOMATION': 1}), None)
 
     def test_developer_options_release(self):
         self.test_developer_options('42.0')
 
+    def test_valid_yasm_version(self):
+        out = StringIO()
+        sandbox = self.get_sandbox({}, {}, out=out)
+        func = sandbox._depends[sandbox['valid_yasm_version']]._func
+
+        # Missing yasm is not an error when nothing requires it.
+        func(None, False, False)
+
+        # Any version of yasm works when nothing requires it.
+        func(Version('1.0'), False, False)
+
+        # Any version of yasm works when something requires any version.
+        func(Version('1.0'), True, False)
+        func(Version('1.0'), True, True)
+        func(Version('1.0'), False, True)
+
+        # A version of yasm greater than any requirement works.
+        func(Version('1.5'), Version('1.0'), True)
+        func(Version('1.5'), True, Version('1.0'))
+        func(Version('1.5'), Version('1.1'), Version('1.0'))
+
+        out.truncate(0)
+        with self.assertRaises(SystemExit):
+            func(None, Version('1.0'), False)
+
+        self.assertEqual(
+            out.getvalue(),
+            'ERROR: Yasm is required to build with vpx, but you do not appear to have Yasm installed.\n'
+        )
+
+        out.truncate(0)
+        with self.assertRaises(SystemExit):
+            func(None, Version('1.0'), Version('1.0'))
+
+        self.assertEqual(
+            out.getvalue(),
+            'ERROR: Yasm is required to build with jpeg and vpx, but you do not appear to have Yasm installed.\n'
+        )
+
+        out.truncate(0)
+        with self.assertRaises(SystemExit):
+            func(Version('1.0'), Version('1.1'), Version('1.0'))
+
+        self.assertEqual(
+            out.getvalue(),
+            'ERROR: Yasm version 1.1 or greater is required to build with vpx.\n'
+        )
+
+        out.truncate(0)
+        with self.assertRaises(SystemExit):
+            func(Version('1.0'), True, Version('1.0.1'))
+
+        self.assertEqual(
+            out.getvalue(),
+            'ERROR: Yasm version 1.0.1 or greater is required to build with jpeg.\n'
+        )
+
+
 if __name__ == '__main__':
     main()
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -1298,31 +1298,31 @@ with only_when(compile_environment):
         check_symbol('vpx_codec_dec_init_ver', flags=vpx.libs, onerror=lambda: die(
             "--with-system-libvpx requested but symbol vpx_codec_dec_init_ver "
             "not found"
         ))
 
         set_config('MOZ_SYSTEM_LIBVPX', True)
 
 
-    @depends('--with-system-libvpx', target, yasm_version, gnu_as)
-    def in_tree_vpx(system_libvpx, target, yasm_version, gnu_as):
+    @depends('--with-system-libvpx', target, gnu_as)
+    def in_tree_vpx(system_libvpx, target, gnu_as):
         if system_libvpx:
             return
 
         use_yasm = (target.cpu in ('x86', 'x86_64')) or None
+        need_yasm = False
         arm_asm = (target.cpu == 'arm' and gnu_as) or None
 
         if use_yasm:
-            if not yasm_version:
-                die('Yasm is required to build on this architecture.')
-            if target.kernel == 'WINNT' and yasm_version < '1.1':
-                die('Yasm 1.1 or greater is required to build libvpx for Windows.')
+            need_yasm = True
+            if target.kernel == 'WINNT':
+                need_yasm = Version('1.1')
 
-        return namespace(arm_asm=arm_asm, use_yasm=use_yasm)
+        return namespace(arm_asm=arm_asm, use_yasm=use_yasm, need_yasm=need_yasm)
 
 
     # Building with -mfpu=neon requires either the "softfp" or the
     # "hardfp" ABI. Depending on the compiler's default target, and the
     # CFLAGS, the default ABI might be neither, in which case it is the
     # "softfloat" ABI.
     # The "softfloat" ABI is binary-compatible with the "softfp" ABI, so
     # we can safely mix code built with both ABIs. So, if we detect
@@ -1349,8 +1349,134 @@ with only_when(compile_environment):
         elif vpx and vpx.use_yasm and target.os != 'WINNT' and target.cpu != 'x86_64':
             flags = ['-DPIC']
         return flags
 
 
     set_config('VPX_USE_YASM', in_tree_vpx.use_yasm)
     set_config('VPX_ASFLAGS', vpx_as_flags)
     add_old_configure_assignment('VPX_ASFLAGS', vpx_as_flags)
+
+
+# JPEG
+# ====
+
+with only_when(compile_environment):
+    option('--with-system-jpeg', nargs='?',
+           help='Use system libjpeg (installed at given prefix)')
+
+    @depends_if('--with-system-jpeg')
+    def jpeg_flags(value):
+        if len(value):
+            return namespace(
+                cflags=('-I%s/include' % value[0],),
+                ldflags=('-L%s/lib' % value[0], '-ljpeg'),
+            )
+        return namespace(
+            ldflags=('-ljpeg',),
+        )
+
+    with only_when('--with-system-jpeg'):
+        check_symbol('jpeg_destroy_compress', flags=jpeg_flags.ldflags,
+                     onerror=lambda: die('--with-system-jpeg requested but symbol '
+                                         'jpeg_destroy_compress not found.'))
+
+        c_compiler.try_compile(
+            includes=[
+                'stdio.h',
+                'sys/types.h',
+                'jpeglib.h',
+            ],
+            body='''
+                #if JPEG_LIB_VERSION < 62
+                #error Insufficient JPEG library version
+                #endif
+            ''',
+            check_msg='for sufficient jpeg library version',
+            onerror=lambda: die('Insufficient JPEG library version for '
+                                '--with-system-jpeg (62 required)'),
+        )
+
+        c_compiler.try_compile(
+            includes=[
+                'stdio.h',
+                'sys/types.h',
+                'jpeglib.h',
+            ],
+            body='''
+                #ifndef JCS_EXTENSIONS
+                #error libjpeg-turbo JCS_EXTENSIONS required
+                #endif
+            ''',
+            check_msg='for sufficient libjpeg-turbo JCS_EXTENSIONS',
+            onerror=lambda: die('libjpeg-turbo JCS_EXTENSIONS required for '
+                                 '--with-system-jpeg'),
+        )
+
+        set_config('MOZ_JPEG_CFLAGS', jpeg_flags.cflags)
+        set_config('MOZ_JPEG_LIBS', jpeg_flags.ldflags)
+
+    @depends('--with-system-jpeg', target)
+    def in_tree_jpeg(system_jpeg, target):
+        if system_jpeg:
+            return
+
+        flags = ()
+        use_yasm = None
+        need_yasm = False
+        if target.kernel == 'Darwin':
+            if target.cpu == 'x86':
+                flags = ('-DPIC', '-DMACHO')
+            elif target.cpu == 'x86_64':
+                flags = ('-D__x86_64__', '-DPIC', '-DMACHO')
+        elif target.kernel == 'WINNT':
+            if target.cpu == 'x86':
+                flags = ('-DPIC', '-DWIN32')
+            elif target.cpu == 'x86_64':
+                flags = ('-D__x86_64__', '-DPIC', '-DWIN64', '-DMSVC')
+        elif target.cpu == 'arm':
+            flags = ('-march=armv7-a', '-mfpu=neon')
+        elif target.cpu == 'aarch64':
+            flags = ('-march=armv8-a',)
+        elif target.cpu == 'mips32':
+            flags = ('-mdspr2',)
+        elif target.cpu == 'x86':
+            flags = ('-DPIC', '-DELF')
+        elif target.cpu == 'x86_64':
+            flags = ('-D__x86_64__', '-DPIC', '-DELF')
+
+        if target.cpu in ('x86', 'x86_64'):
+            use_yasm = True
+            if target.kernel == 'Linux' and target.os == 'GNU':
+                need_yasm = Version('1.0.1')
+            else:
+                need_yasm = Version('1.1')
+
+        return namespace(flags=flags, use_yasm=use_yasm, need_yasm=need_yasm)
+
+    set_config('LIBJPEG_TURBO_USE_YASM', in_tree_jpeg.use_yasm)
+    set_config('LIBJPEG_TURBO_ASFLAGS', in_tree_jpeg.flags)
+
+
+@depends(yasm_version, in_tree_vpx.need_yasm, in_tree_jpeg.use_yasm)
+@imports(_from='__builtin__', _import='sorted')
+def valid_yasm_version(yasm_version, for_vpx, for_jpeg):
+    requires = {
+        'vpx': for_vpx,
+        'jpeg': for_jpeg,
+    }
+    requires = {k: v for (k, v) in requires.items() if v}
+    if requires and not yasm_version:
+        items = sorted(requires.keys())
+        if len(items) > 1:
+            what = ' and '.join((', '.join(items[:-1]), items[-1]))
+        else:
+            what = items[0]
+        die('Yasm is required to build with %s, but you do not appear to have '
+            'Yasm installed.' % what)
+
+    versioned = {k: v for (k, v) in requires.items() if v is not True}
+    by_version = sorted(versioned.items(), key=lambda x: x[1])
+    if by_version:
+        what, version = by_version[-1]
+        if yasm_version < version:
+            die('Yasm version %s or greater is required to build with %s.'
+                % (version, what))