--- ./build/contrib/x264/x264/configure.orig	2012-01-19 07:48:34.000000000 +0800
+++ ./build/contrib/x264/x264/configure	2012-08-23 09:37:56.000000000 +0800
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
 cat <<EOF
@@ -75,8 +75,8 @@
     # Intel Compiler issues an incredibly large number of warnings on any warning level,
     # suppress them by disabling all warnings rather than having to use #pragmas to disable most of them
     for arg in $*; do
-        [ $arg = -ffast-math ] && arg=
-        [[ "$arg" = -falign-loops* ]] && arg=
+        [ "$arg" = -ffast-math ] && arg=
+        [ -z "${arg%%-falign-loops*}" ] && arg=
         [ "$arg" = -fno-tree-vectorize ] && arg=
         [ "$arg" = -Wshadow ] && arg=
         if [ $compiler = ICL ]; then
@@ -96,7 +96,7 @@
 icl_ldflags() {
     for arg in $*; do
         arg=${arg/LIBPATH/libpath}
-        [ ${arg#-libpath:} == $arg -a ${arg#-l} != $arg ] && arg=${arg#-l}.lib
+        [ ${arg#-libpath:} = $arg -a ${arg#-l} != $arg ] && arg=${arg#-l}.lib
         [ ${arg#-L} != $arg ] && arg=-libpath:${arg#-L}
         [ $arg = -Wl,--large-address-aware ] && arg=-largeaddressaware
         [ $arg = -s ] && arg=
@@ -396,10 +396,10 @@
 host_os="${host#*-}"
 
 # test for use of Intel Compiler
-if [[ $host_os = mingw* || $host_os = cygwin* ]]; then
-    if [[ `basename "$CC"` = icl* ]]; then
+if [ -z "${host_os%%mingw*}" -o -z "${host_os%%cygwin*}" ]; then
+    if [ "${CC%%icl*}" != "${CC}" ]; then
         # Windows Intel Compiler creates dependency generation with absolute Windows paths, Cygwin's make does not support Windows paths.
-        [[ $host_os = cygwin* ]] && die "Windows Intel Compiler support requires MSYS"
+        [ -z "${host_os%%cygwin*}" ] && die "Windows Intel Compiler support requires MSYS"
         compiler=ICL
         CFLAGS="$CFLAGS -Qstd=c99 -nologo -Qms0 -DHAVE_STRING_H -Iextras"
         QPRE="-Q"
@@ -408,7 +408,7 @@
         cpp_check "" "" "_MSC_VER >= 1400" || die "Windows Intel Compiler support requires Visual Studio 2005 or newer"
     fi
 else
-    if [[ `basename "$CC"` = icc* ]]; then
+    if [ "${CC%%icc*}" != "${CC}" ]; then
         AR="xiar"
         compiler=ICC
         QPRE="-"
@@ -496,11 +496,15 @@
         AS="yasm"
         ASFLAGS="$ASFLAGS -O2"
         if [ $compiler = GNU ]; then
-            if [[ "$asm" == auto && "$CFLAGS" != *-march* ]]; then
-                CFLAGS="$CFLAGS -march=i686"
-            fi
-            if [[ "$asm" == auto && "$CFLAGS" != *-mfpmath* ]]; then
-                CFLAGS="$CFLAGS -mfpmath=sse -msse"
+            if [ "$asm" = yes ]; then
+                case "$CFLAGS" in
+                    *-march*) ;;
+                    *) CFLAGS="$CFLAGS -march=i686" ;;
+                esac
+                case "$CFLAGS" in
+                    *-mfpmath*) ;;
+                    *) CFLAGS="$CFLAGS -mfpmath=sse -msse" ;;
+                esac
             fi
         else
             # icc on linux has various degrees of mod16 stack support
@@ -526,7 +530,7 @@
             ASFLAGS="$ASFLAGS -f elf"
         fi
         ;;
-    x86_64)
+    x86_64|amd64)
         ARCH="X86_64"
         AS="yasm"
         if [ "$SYS" = MACOSX ]; then
@@ -990,7 +994,7 @@
 # generate exported config file
 
 config_chroma_format="X264_CSP_I$chroma_format"
-[ "$config_chroma_format" == "X264_CSP_Iall" ] && config_chroma_format="0"
+[ "$config_chroma_format" = "X264_CSP_Iall" ] && config_chroma_format="0"
 cat > x264_config.h << EOF
 #define X264_BIT_DEPTH     $bit_depth
 #define X264_GPL           $x264_gpl
--- ./build/contrib/x264/x264/version.sh.orig	2012-01-19 07:48:34.000000000 +0800
+++ ./build/contrib/x264/x264/version.sh	2012-08-22 12:00:27.000000000 +0800
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 [ -n "$1" ] && cd $1
 git rev-list HEAD | sort > config.git-hash
 LOCALVER=`wc -l config.git-hash | awk '{print $1}'`
