Skip to content

Commit 7bfa847

Browse files
committed
configure: don't depend on GNU sed
Closes qbittorrent#3169.
1 parent 331219d commit 7bfa847

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

configure

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5657,8 +5657,11 @@ extract() {
56575657
return 1
56585658
fi
56595659

5660+
# BSD sed needs an actual newline character in the substitute command
5661+
new_line='
5662+
'
56605663
# Convert " -" to "\n" if not between quotes and remove possible leading white spaces
5661-
string=$(echo " $*" | $SED -e 's: -:\n:g' -e 's:"\(.*\)\n\(.*\)":\"\1 -\2":g' -e "s:'\(.*\)\n\(.*\)':\'\1 -\2':g" -e 's/^[:space:]*//')
5664+
string=$(echo " $*" | $SED -e "s: -:\\${new_line}:g" -e 's:"\(.*\)\n\(.*\)":\"\1 -\2":g' -e "s:'\(.*\)\n\(.*\)':\'\1 -\2':g" -e 's/^[:space:]*//')
56625665
SAVEIFS=$IFS
56635666
IFS=$(printf "\n\b")
56645667
for i in $string; do

configure.ac

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,11 @@ extract() {
222222
return 1
223223
fi
224224

225+
# BSD sed needs an actual newline character in the substitute command
226+
new_line='
227+
'
225228
# Convert " -" to "\n" if not between quotes and remove possible leading white spaces
226-
string=$(echo " $*" | $SED -e 's: -:\n:g' -e 's:"\(.*\)\n\(.*\)":\"\1 -\2":g' -e "s:'\(.*\)\n\(.*\)':\'\1 -\2':g" -e 's/^[[:space:]]*//')
229+
string=$(echo " $*" | $SED -e "s: -:\\${new_line}:g" -e 's:"\(.*\)\n\(.*\)":\"\1 -\2":g' -e "s:'\(.*\)\n\(.*\)':\'\1 -\2':g" -e 's/^[[:space:]]*//')
227230
SAVEIFS=$IFS
228231
IFS=$(printf "\n\b")
229232
for i in $string; do

0 commit comments

Comments
 (0)