Bug 785638 - Use VP8 asm on ELF platforms by default. r=tterribe
authorJan Beich <jbeich@tormail.org>
Mon, 27 Aug 2012 19:34:30 -0400
changeset 105647 8eb3be6ada0e3d93571c96f87ceb4da3b96668bd
parent 105646 9c0e1448ff3be564613b1af42b8f31a7b1de8c59
child 105648 d8ac3833d2a143a04c3745a7f72eba601cc169fa
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewerstterribe
bugs785638
milestone18.0a1
Bug 785638 - Use VP8 asm on ELF platforms by default. r=tterribe
configure.in
media/libvpx/update.sh
media/libvpx/vpx_config.h
media/libvpx/vpx_config_c.c
--- a/configure.in
+++ b/configure.in
@@ -5343,40 +5343,16 @@ if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE
     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.
     VPX_AS=$YASM
     VPX_ASM_SUFFIX=asm
     VPX_NEED_OBJ_INT_EXTRACT=
 
     dnl See if we have assembly on this platform.
     case "$OS_ARCH:$CPU_ARCH" in
-    Linux:x86)
-      VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
-      VPX_X86_ASM=1
-    ;;
-    Linux:x86_64)
-      VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
-      VPX_X86_ASM=1
-    ;;
-    SunOS:x86)
-      VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
-      VPX_X86_ASM=1
-    ;;
-    SunOS:x86_64)
-      VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
-      VPX_X86_ASM=1
-    ;;
-    OpenBSD:x86)
-      VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
-      VPX_X86_ASM=1
-    ;;
-    OpenBSD:x86_64)
-      VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
-      VPX_X86_ASM=1
-    ;;
     Darwin:x86)
       VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
       VPX_X86_ASM=1
     ;;
     Darwin:x86_64)
       VPX_ASFLAGS="-f macho64 -rnasm -pnasm -DPIC"
       VPX_X86_ASM=1
     ;;
@@ -5402,16 +5378,29 @@ if test -n "$MOZ_VP8" -a -z "$MOZ_NATIVE
         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"
         VPX_DASH_C_FLAG="-c"
         VPX_AS_CONVERSION='$(PERL) $(topsrcdir)/media/libvpx/build/make/ads2gas.pl'
         VPX_ASM_SUFFIX="$ASM_SUFFIX"
         VPX_ARM_ASM=1
       fi
+    ;;
+    *:x86)
+      if $CC -E -dM -</dev/null | grep -q __ELF__; then
+        VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
+        VPX_X86_ASM=1
+      fi
+    ;;
+    *:x86_64)
+      if $CC -E -dM -</dev/null | grep -q __ELF__; then
+        VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
+        VPX_X86_ASM=1
+      fi
+    ;;
     esac
 
     if test -n "$COMPILE_ENVIRONMENT" -a -n "$VPX_X86_ASM" -a -z "$VPX_AS"; then
       AC_MSG_ERROR([yasm is a required build tool for this architecture when webm is enabled. You may either install yasm or --disable-webm (which disables the WebM video format). See https://developer.mozilla.org/en/YASM for more details.])
     fi
 
     if test -n "$MOZ_VP8_ENCODER" -a \
             -z "$GNU_CC" -a -z "$INTEL_CC" -a -z "$CLANG_CC" ; then
--- a/media/libvpx/update.sh
+++ b/media/libvpx/update.sh
@@ -358,22 +358,22 @@ commonFiles=(
 # configure files specific to x86-win32-vs8
 cp $1/objdir/x86-win32-vs8/vpx_config.c vpx_config_x86-win32-vs8.c
 cp $1/objdir/x86-win32-vs8/vpx_config.asm vpx_config_x86-win32-vs8.asm
 cp $1/objdir/x86-win32-vs8/vpx_config.h vpx_config_x86-win32-vs8.h
 
 # Should be same for all platforms...
 cp $1/objdir/x86-win32-vs8/vpx_version.h vpx_version.h
 
-# Config files for x86-linux-gcc, OpenBSD/i386 and Solaris x86
+# Config files for x86-linux-gcc and other x86 elf platforms
 cp $1/objdir/x86-linux-gcc/vpx_config.c vpx_config_x86-linux-gcc.c
 cp $1/objdir/x86-linux-gcc/vpx_config.asm vpx_config_x86-linux-gcc.asm
 cp $1/objdir/x86-linux-gcc/vpx_config.h vpx_config_x86-linux-gcc.h
 
-# Config files for x86_64-linux-gcc, OpenBSD/amd64 and Solaris x86_64
+# Config files for x86_64-linux-gcc and other x86_64 elf platforms
 cp $1/objdir/x86_64-linux-gcc/vpx_config.c vpx_config_x86_64-linux-gcc.c
 cp $1/objdir/x86_64-linux-gcc/vpx_config.asm vpx_config_x86_64-linux-gcc.asm
 cp $1/objdir/x86_64-linux-gcc/vpx_config.h vpx_config_x86_64-linux-gcc.h
 
 # Copy config files for mac...
 cp $1/objdir/x86-darwin9-gcc/vpx_config.c vpx_config_x86-darwin9-gcc.c
 cp $1/objdir/x86-darwin9-gcc/vpx_config.asm vpx_config_x86-darwin9-gcc.asm
 cp $1/objdir/x86-darwin9-gcc/vpx_config.h vpx_config_x86-darwin9-gcc.h
--- a/media/libvpx/vpx_config.h
+++ b/media/libvpx/vpx_config.h
@@ -11,38 +11,22 @@
 #elif defined(__APPLE__) && defined(__x86_64__)
 /* 64 bit MacOS. */
 #include "vpx_config_x86_64-darwin9-gcc.h"
 
 #elif defined(__APPLE__) && defined(__i386__)
 /* 32 bit MacOS. */
 #include "vpx_config_x86-darwin9-gcc.h"
 
-#elif defined(__linux__) && defined(__i386__)
-/* 32 bit Linux. */
+#elif defined(__ELF__) && (defined(__i386) || defined(__i386__))
+/* 32 bit ELF platforms. */
 #include "vpx_config_x86-linux-gcc.h"
 
-#elif defined(__linux__) && defined(__x86_64__)
-/* 64 bit Linux. */
-#include "vpx_config_x86_64-linux-gcc.h"
-
-#elif defined(__OpenBSD__) && defined(__i386__)
-/* 32 bit OpenBSD. */
-#include "vpx_config_x86-linux-gcc.h"
-
-#elif defined(__OpenBSD__) && defined(__x86_64__)
-/* 64 bit OpenBSD. */
-#include "vpx_config_x86_64-linux-gcc.h"
-
-#elif defined(__sun) && defined(__i386)
-/* 32 bit Solaris. */
-#include "vpx_config_x86-linux-gcc.h"
-
-#elif defined(__sun) && defined(__x86_64)
-/* 64 bit Solaris. */
+#elif defined(__ELF__) && (defined(__x86_64) || defined(__x86_64__))
+/* 64 bit ELF platforms. */
 #include "vpx_config_x86_64-linux-gcc.h"
 
 #else
 #error VPX_X86_ASM is defined, but assembly not supported on this platform!
 #endif
 
 #elif defined(VPX_ARM_ASM)
 
--- a/media/libvpx/vpx_config_c.c
+++ b/media/libvpx/vpx_config_c.c
@@ -10,40 +10,24 @@
 #elif defined(__APPLE__) && defined(__x86_64__)
 /* 64 bit MacOS. */
 #include "vpx_config_x86_64-darwin9-gcc.c"
 
 #elif defined(__APPLE__) && defined(__i386__)
 /* 32 bit MacOS. */
 #include "vpx_config_x86-darwin9-gcc.c"
 
-#elif defined(__linux__) && defined(__i386__)
-/* 32 bit Linux. */
+#elif defined(__ELF__) && (defined(__i386) || defined(__i386__))
+/* 32 bit ELF platforms. */
 #include "vpx_config_x86-linux-gcc.c"
 
-#elif defined(__linux__) && defined(__x86_64__)
-/* 64 bit Linux. */
+#elif defined(__ELF__) && (defined(__x86_64) || defined(__x86_64__))
+/* 64 bit ELF platforms. */
 #include "vpx_config_x86_64-linux-gcc.c"
 
-#elif defined(__OpenBSD__) && defined(__i386)
-/* 32 bit OpenBSD. */
-#include "vpx_config_x86-linux-gcc.h"
-
-#elif defined(__OpenBSD__) && defined(__x86_64)
-/* 64 bit OpenBSD. */
-#include "vpx_config_x86_64-linux-gcc.h"
-
-#elif defined(__sun) && defined(__i386)
-/* 32 bit Solaris. */
-#include "vpx_config_x86-linux-gcc.h"
-
-#elif defined(__sun) && defined(__x86_64)
-/* 64 bit Solaris. */
-#include "vpx_config_x86_64-linux-gcc.h"
-
 #else
 #error VPX_X86_ASM is defined, but assembly not supported on this platform!
 #endif
 
 #elif defined(VPX_ARM_ASM)
 
 #if defined(__linux__) && defined(__GNUC__)
 #include "vpx_config_arm-linux-gcc.c"