diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure index 0321826b8659..93addb3909fe 100644 --- a/build/moz.configure/old.configure +++ b/build/moz.configure/old.configure @@ -253,7 +253,6 @@ def old_configure_options(*options): '--with-system-icu', '--with-system-jpeg', '--with-system-libevent', - '--with-system-libvpx', '--with-system-nspr', '--with-system-nss', '--with-system-png', diff --git a/old-configure.in b/old-configure.in index 6fba6cb9425d..1adb7e9cc38a 100644 --- a/old-configure.in +++ b/old-configure.in @@ -1808,8 +1808,6 @@ MOZ_AUTH_EXTENSION=1 if test "$MOZ_IOS"; then MOZ_AUTH_EXTENSION= fi -VPX_USE_YASM= -VPX_ASFLAGS= LIBJPEG_TURBO_AS= LIBJPEG_TURBO_ASFLAGS= MOZ_PREF_EXTENSIONS=1 @@ -2216,113 +2214,6 @@ if test -n "$MOZ_APPLEMEDIA"; then fi fi # COMPILE_ENVIRONMENT -dnl system libvpx Support -dnl ======================================================== -MOZ_ARG_WITH_BOOL(system-libvpx, -[ --with-system-libvpx Use system libvpx (located with pkgconfig)], - MOZ_SYSTEM_LIBVPX=1) - -MOZ_LIBVPX_CFLAGS= -MOZ_LIBVPX_LIBS= - -_SAVE_CFLAGS=$CFLAGS -_SAVE_LIBS=$LIBS -if test -n "$MOZ_SYSTEM_LIBVPX"; then - dnl ============================ - dnl === libvpx Version check === - dnl ============================ - dnl Check to see if we have a system libvpx package. - PKG_CHECK_MODULES(MOZ_LIBVPX, vpx >= 1.5.0) - - CFLAGS="$CFLAGS $MOZ_LIBVPX_CFLAGS" - LIBS="$LIBS $MOZ_LIBVPX_LIBS" - - MOZ_CHECK_HEADER([vpx/vpx_decoder.h], [], - [AC_MSG_ERROR([Couldn't find vpx/vpx_decoder.h which is required for build with system libvpx. Use --without-system-libvpx to build with in-tree libvpx.])]) - - AC_CHECK_LIB(vpx, vpx_codec_dec_init_ver, [], - [AC_MSG_ERROR([--with-system-libvpx requested but symbol vpx_codec_dec_init_ver not found])]) -fi -CFLAGS=$_SAVE_CFLAGS -LIBS=$_SAVE_LIBS - -AC_SUBST(MOZ_SYSTEM_LIBVPX) -AC_SUBST_LIST(MOZ_LIBVPX_CFLAGS) -AC_SUBST_LIST(MOZ_LIBVPX_LIBS) - -if test -z "$MOZ_SYSTEM_LIBVPX"; then - - dnl Detect if we can use an assembler to compile optimized assembly for libvpx. - dnl We currently require yasm on all x86 platforms and require yasm 1.1.0 on Win32. - dnl We currently require gcc on all arm platforms. - - dnl See if we have assembly on this platform. - case "$OS_ARCH:$CPU_ARCH" in - Darwin:x86) - VPX_USE_YASM=1 - ;; - Darwin:x86_64) - VPX_USE_YASM=1 - ;; - WINNT:x86_64) - VPX_USE_YASM=1 - ;; - WINNT:x86) - dnl Check for yasm 1.1 or greater. - if test -n "$COMPILE_ENVIRONMENT" -a -z "$YASM"; then - AC_MSG_ERROR([yasm 1.1 or greater is required to build libvpx on Win32, but it appears not to be installed. Install it (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.]) - elif test -n "$COMPILE_ENVIRONMENT" -a "$_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 libvpx on Win32, but you appear to have version $_YASM_MAJOR_VERSION.$_YASM_MINOR_VERSION. Upgrade to the newest version (included in MozillaBuild 1.5.1 and newer) or configure with --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.]) - else - VPX_USE_YASM=1 - dnl The encoder needs obj_int_extract to get asm offsets. - fi # COMPILE_ENVIRONMENT and others - ;; - *:arm*) - if test -n "$GNU_AS" ; then - dnl These flags are a lie; they're just used to enable the requisite - dnl opcodes; actual arch detection is done at runtime. - VPX_ASFLAGS="-march=armv7-a -mfpu=neon" - dnl Building with -mfpu=neon requires either the "softfp" or the - dnl "hardfp" ABI. Depending on the compiler's default target, and the - dnl CFLAGS, the default ABI might be neither, in which case it is the - dnl "softfloat" ABI. - dnl The "softfloat" ABI is binary-compatible with the "softfp" ABI, so - dnl we can safely mix code built with both ABIs. So, if we detect - dnl that compiling uses the "softfloat" ABI, force the use of the - dnl "softfp" ABI instead. - dnl Confusingly, the __SOFTFP__ preprocessor variable indicates the - dnl "softfloat" ABI, not the "softfp" ABI. - dnl Note: VPX_ASFLAGS is also used in CFLAGS. - AC_TRY_COMPILE([], - [#ifndef __SOFTFP__ - #error "compiler target supports -mfpu=neon, so we don't have to add extra flags" - #endif], - VPX_ASFLAGS="$VPX_ASFLAGS -mfloat-abi=softfp" - ) - fi - ;; - *:x86) - if $CC -E -dM -= 1.5.0') + + check_header('vpx/vpx_decoder.h', flags=vpx.cflags, onerror=lambda: die( + "Couldn't find vpx/vpx_decoder.h, which is required to build " + "with system libvpx. Use --without-system-libvpx to build " + "with in-tree libvpx.")) + + 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): + if system_libvpx: + return + + use_yasm = (target.cpu in ('x86', 'x86_64')) or None + 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.') + + return namespace(arm_asm=arm_asm, use_yasm=use_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 + # that compiling uses the "softfloat" ABI, force the use of the + # "softfp" ABI instead. + # Confusingly, the __SOFTFP__ preprocessor variable indicates the + # "softfloat" ABI, not the "softfp" ABI. + # Note: VPX_ASFLAGS is also used in CFLAGS. + softfp = cxx_compiler.try_compile(body=''' + #ifndef __SOFTFP__ + #error "compiler target supports -mfpu=neon, so we don't have to add extra flags" + #endif''', when=in_tree_vpx.arm_asm) + + + @depends(in_tree_vpx, softfp, target) + def vpx_as_flags(vpx, softfp, target): + flags = [] + if vpx and vpx.arm_asm: + # These flags are a lie; they're just used to enable the requisite + # opcodes; actual arch detection is done at runtime. + flags = ['-march=armv7-a', '-mfpu=neon'] + if softfp: + flags.append('-mfloat-abi=softfp') + 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)