Discussion:
[x264-devel] Minor configure improvements
Diego Biurrun
2018-01-18 20:22:59 UTC
Permalink
x264 | branch: master | Diego Biurrun <***@biurrun.de> | Sun Feb 5 09:02:51 2017 +0100| [6fce82284a0fb3edfa299b904b1559452a3b1094] | committer: Henrik Gramner

Minor configure improvements

* Drop empty addition of GPLed filters

* Replace backticks with $()
http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=6fce82284a0fb3edfa299b904b1559452a3b1094
---

configure | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 41793e94..79f76cdf 100755
--- a/configure
+++ b/configure
@@ -548,10 +548,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%%-*}"
@@ -562,7 +562,7 @@ host_os="${host#*-}"
trap 'rm -rf 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
@@ -917,7 +917,7 @@ fi

if [ $asm = auto -a \( $ARCH = X86 -o $ARCH = X86_64 \) ] ; then
if ! as_check "vmovdqa32 [eax]{k1}{z}, zmm0" ; 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 nasm-2.13"
echo "If you really want to compile without asm, configure with --disable-asm."
@@ -1529,9 +1529,7 @@ Cflags: -I$includedir
EOF

filters="crop select_every"
-gpl_filters=""
[ $swscale = yes ] && filters="resize $filters"
-[ $gpl = yes ] && filters="$filters $gpl_filters"

cat > conftest.log <<EOF
platform: $ARCH
Alexander Strasser
2018-01-21 00:00:03 UTC
Permalink
[...]
Post by Diego Biurrun
- VER=`($AS --version || echo no assembler) 2>/dev/null | head -n 1`
+ VER="$(($AS --version || echo no assembler) 2>/dev/null | head -n 1)"
Don't know if this can fail in some shells, the ones I tested it
worked as expected.

Newer POSIX seems to discourage writing it that way:

The syntax of the shell command language has an ambiguity for expansions beginning with "$((", which can introduce an arithmetic expansion or a command substitution that starts with a subshell. Arithmetic expansion has precedence; that is, the shell shall first determine whether it can parse the expansion as an arithmetic expansion and shall only parse the expansion as a command substitution if it determines that it cannot parse the expansion as an arithmetic expansion. The shell need not evaluate nested expansions when performing this determination. If it encounters the end of input without already having determined that it cannot parse the expansion as an arithmetic expansion, the shell shall treat the expansion as an incomplete arithmetic expansion and report a syntax error. A conforming application shall ensure that it separates the "$(" and '(' into two tokens (that is, separate them with white space) in a command substitution that starts with a subshell. For example, a command substitution containing a single subshell could be written as:

$( (command) )


It's probably only problematic if there's only a single subshell
inside the command substitution. Maybe better to still be clear
and write "$( (" when a command substitution is intended.
Post by Diego Biurrun
echo "Found $VER"
echo "Minimum version is nasm-2.13"
echo "If you really want to compile without asm, configure with --disable-asm."
Alexander

Loading...