[x264-devel] [PATCH 10/11] build: Replace backticks by $() in shell scripts

Diego Biurrun diego at biurrun.de
Sun Feb 5 09:02:52 CET 2017


$() is just as portable, but much easier to nest.
---
 configure | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 6fe0600..625eafb 100755
--- a/configure
+++ b/configure
@@ -494,7 +494,7 @@ for opt do
                 echo "Supplied bit depth must be in range [8,10]."
                 exit 1
             fi
-            bit_depth=`expr $bit_depth + 0`
+            bit_depth=$(expr $bit_depth + 0)
             ;;
         --chroma-format=*)
             chroma_format="$optarg"
@@ -529,10 +529,10 @@ else
 fi
 
 if [ "x$host" = x ]; then
-    host=`${SRCPATH}/config.guess`
+    host=$(${SRCPATH}/config.guess)
 fi
 # normalize a triplet into a quadruplet
-host=`${SRCPATH}/config.sub $host`
+host=$(${SRCPATH}/config.sub $host)
 
 # split $host
 host_cpu="${host%%-*}"
@@ -543,7 +543,7 @@ host_os="${host#*-}"
 trap 'rm -f conftest*' EXIT
 
 # test for use of compilers that require specific handling
-cc_base=`basename "$CC"`
+cc_base=$(basename "$CC")
 QPRE="-"
 if [[ $host_os = mingw* || $host_os = cygwin* ]]; then
     if [[ "$cc_base" = icl || "$cc_base" = icl[\ .]* ]]; then
@@ -553,8 +553,8 @@ if [[ $host_os = mingw* || $host_os = cygwin* ]]; then
         compiler_style=MS
         CFLAGS="$CFLAGS -Qstd=c99 -nologo -Qms0 -DHAVE_STRING_H -I\$(SRCPATH)/extras"
         QPRE="-Q"
-        `$CC 2>&1 | grep -q IA-32` && host_cpu=i486
-        `$CC 2>&1 | grep -q "Intel(R) 64"` && host_cpu=x86_64
+        $($CC 2>&1 | grep -q IA-32)         && host_cpu=i486
+        $($CC 2>&1 | grep -q "Intel(R) 64") && host_cpu=x86_64
         cpp_check "" "" "_MSC_VER >= 1400" || die "Windows Intel Compiler support requires Visual Studio 2005 or newer"
         if cc_check '' -Qdiag-error:10006,10157 ; then
             CHECK_CFLAGS="$CHECK_CFLAGS -Qdiag-error:10006,10157"
@@ -564,8 +564,8 @@ if [[ $host_os = mingw* || $host_os = cygwin* ]]; then
         compiler=CL
         compiler_style=MS
         CFLAGS="$CFLAGS -nologo -GS- -DHAVE_STRING_H -I\$(SRCPATH)/extras"
-        `$CC 2>&1 | grep -q 'x86'` && host_cpu=i486
-        `$CC 2>&1 | grep -q 'x64'` && host_cpu=x86_64
+        $($CC 2>&1 | grep -q 'x86') && host_cpu=i486
+        $($CC 2>&1 | grep -q 'x64') && host_cpu=x86_64
         cpp_check '' '' '_MSC_VER > 1800 || (_MSC_VER == 1800 && _MSC_FULL_VER >= 180030324)' || die "Microsoft Visual Studio support requires Visual Studio 2013 Update 2 or newer"
     else
         # MinGW uses broken pre-VS2015 Microsoft printf functions unless it's told to use the POSIX ones.
@@ -876,7 +876,7 @@ fi
 
 if [ $asm = auto -a \( $ARCH = X86 -o $ARCH = X86_64 \) ] ; then
     if ! as_check "vpmovzxwd ymm0, xmm0" ; then
-        VER=`($AS --version || echo no assembler) 2>/dev/null | head -n 1`
+        VER=$(($AS --version || echo no assembler) 2>/dev/null | head -n 1)
         echo "Found $VER"
         echo "Minimum version is yasm-1.2.0"
         echo "If you really want to compile without asm, configure with --disable-asm."
-- 
2.1.4



More information about the x264-devel mailing list