Skip to content

Commit

Permalink
Replace "expr --" usage with sed
Browse files Browse the repository at this point in the history
Ideally, this would use POSIX shell parameter expansions (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02), but as noted in https://www.gnu.org/software/autoconf/manual/autoconf-2.70/html_node/Shell-Substitutions.html these are not supported properly on many platforms where Erlang still is.
  • Loading branch information
tianon committed Sep 29, 2021
1 parent 1b0a9a0 commit 47ddfe1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ skip_applications=
while test $# != 0; do
case $1 in
-srcdir=* | --srcdir=*)
user_srcdir=`expr -- "$1" : '[^=]*=\(.*\)'`
user_srcdir=`echo "$1" | sed 's/^[^=]*=//'`
if test "$ERL_TOP" != ""; then
echo "WARNING: Overriding ERL_TOP with $user_srcdir" 1>&2
echo "" 1>&2
Expand Down Expand Up @@ -95,7 +95,7 @@ while test $# != 0; do
echo "" 1>&2
;;
-cache-file=* | --cache-file=* )
static_cache=`expr -- "$1" : '[^=]*=\(.*\)'`
static_cache=`echo "$1" | sed 's/^[^=]*=//'`
if test "$static_cache" != "/dev/null"; then
echo "WARNING: Only using config cache file '$static_cache' as static cache" 1>&2
echo "" 1>&2
Expand Down Expand Up @@ -140,8 +140,8 @@ while test $# != 0; do
pie_ldflags="-no-pie"
;;
CFLAGS=* | LDFLAGS=*)
flgs_var=`expr -- "$1" : '\([^=]*\)=.*'`
flgs_val=`expr -- "$1" : '[^=]*=\(.*\)'`
flgs_var=`echo "$1" | sed 's/=.*$//'`
flgs_val=`echo "$1" | sed 's/^[^=]*=//'`
eval $flgs_var=\$flgs_val
;;
--help=r* | -help=r*)
Expand All @@ -151,7 +151,7 @@ while test $# != 0; do
*)
case $1 in
--without-*)
skip_app=`expr -- "$1" : '--without-\(.*\)'`
skip_app=`echo "$1" | sed 's/^--without-//'`
if [ "$skip_app" = "stdlib" ] ||
[ "$skip_app" = "kernel" ] ||
[ "$skip_app" = "sasl" ] ||
Expand Down
10 changes: 5 additions & 5 deletions configure.src
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ skip_applications=
while test $# != 0; do
case $1 in
-srcdir=* | --srcdir=*)
user_srcdir=`expr -- "$1" : '[^=]*=\(.*\)'`
user_srcdir=`echo "$1" | sed 's/^[^=]*=//'`
if test "$ERL_TOP" != ""; then
echo "WARNING: Overriding ERL_TOP with $user_srcdir" 1>&2
echo "" 1>&2
Expand Down Expand Up @@ -95,7 +95,7 @@ while test $# != 0; do
echo "" 1>&2
;;
-cache-file=* | --cache-file=* )
static_cache=`expr -- "$1" : '[^=]*=\(.*\)'`
static_cache=`echo "$1" | sed 's/^[^=]*=//'`
if test "$static_cache" != "/dev/null"; then
echo "WARNING: Only using config cache file '$static_cache' as static cache" 1>&2
echo "" 1>&2
Expand Down Expand Up @@ -140,8 +140,8 @@ while test $# != 0; do
pie_ldflags="-no-pie"
;;
CFLAGS=* | LDFLAGS=*)
flgs_var=`expr -- "$1" : '\([^=]*\)=.*'`
flgs_val=`expr -- "$1" : '[^=]*=\(.*\)'`
flgs_var=`echo "$1" | sed 's/=.*$//'`
flgs_val=`echo "$1" | sed 's/^[^=]*=//'`
eval $flgs_var=\$flgs_val
;;
--help=r* | -help=r*)
Expand All @@ -151,7 +151,7 @@ while test $# != 0; do
*)
case $1 in
--without-*)
skip_app=`expr -- "$1" : '--without-\(.*\)'`
skip_app=`echo "$1" | sed 's/^--without-//'`
if [ "$skip_app" = "stdlib" ] ||
[ "$skip_app" = "kernel" ] ||
[ "$skip_app" = "sasl" ] ||
Expand Down

0 comments on commit 47ddfe1

Please sign in to comment.