configure: avoid non-POSIX: test ... -a/-o ...
Shells do support those, and typically simple forms do work, but these were removed in POSIX 2024 because they are notoriously hard to parse correctly, and shells don't always agree on the result. Instead, use standard forms which all shells support identically. Extreme high level overview of quotes in POSIX shell: - WORDs without $... or glob don't need quotes (echo, =, no, x86, ...). - a= b=foo c=$... and case $d in ... all don't need quotes. - IFS/glob affect command and arguments (not assignments or case..in): - IFS only splits direct result of $..., quotes will prevent that. - Glob then splits/matches *?[] and quotes will prevent that. POSIX "test" (see Application Usage), and shell language (quotes): https://pubs.opengroup.org/onlinepubs/9799919799/utilities/test.html https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html My own quick guide: https://gist.github.com/avih/6752ad1e20b334b56fef120cd09c766e
This commit is contained in:
parent
cea857bf73
commit
05ebe494dd
1 changed files with 10 additions and 9 deletions
19
configure
vendored
19
configure
vendored
|
@ -210,7 +210,7 @@ default() # set variable unless already set
|
|||
{
|
||||
local v
|
||||
eval v=\"\$$1\"
|
||||
test -z "$v" -a -n "$2" && eval $1=\"$2\"
|
||||
test -z "$v" && test -n "$2" && eval $1=\"$2\"
|
||||
}
|
||||
|
||||
default_conf() # add to confvars unless already present
|
||||
|
@ -219,7 +219,7 @@ default_conf() # add to confvars unless already present
|
|||
test "${confvars%$v*}" = "${confvars}" && confvars="$confvars $1"
|
||||
}
|
||||
|
||||
if test -z "$source_path" -o "$source_path" = "." ; then
|
||||
if test -z "${source_path#.}" ; then
|
||||
source_path=$(pwd)
|
||||
source_path_used="no"
|
||||
else
|
||||
|
@ -254,9 +254,10 @@ fi
|
|||
default cpu "$cpu_sys"
|
||||
|
||||
# check for crpss build
|
||||
if test "$cpu" != "$cpu_sys" \
|
||||
-o "$targetos" != "$buildos" \
|
||||
-o -n "$cross_prefix" ; then
|
||||
if test "$cpu" != "$cpu_sys" ||
|
||||
test "$targetos" != "$buildos" ||
|
||||
test -n "$cross_prefix"
|
||||
then
|
||||
build_cross="yes"
|
||||
cc="${cross_prefix}${cc}"
|
||||
ar="${cross_prefix}${ar}"
|
||||
|
@ -337,7 +338,7 @@ case $targetos in
|
|||
fi
|
||||
fi
|
||||
# on OSX M1 with --cpu=x86_64, build a tcc to run under rosetta entirely
|
||||
if test "$cpu" = "x86_64" -a "$cpu_sys" = "arm64"; then
|
||||
if test "$cpu" = x86_64 && test "$cpu_sys" = arm64; then
|
||||
CFLAGS="$CFLAGS -arch $cpu"
|
||||
LDFLAGS="$LDFLAGS -arch $cpu"
|
||||
fi
|
||||
|
@ -422,17 +423,17 @@ if test -z "$build_cross"; then
|
|||
_triplet="$($CONFTEST triplet)"
|
||||
fi
|
||||
if test "$mingw32" = "no" ; then
|
||||
if test -z "$triplet" -a -n "$_triplet"; then
|
||||
if test -z "$triplet" && test -n "$_triplet"; then
|
||||
if test -f "/usr/lib/$_triplet/crti.o"; then
|
||||
triplet="$_triplet"
|
||||
fi
|
||||
fi
|
||||
if test -z "$triplet"; then
|
||||
if test $cpu = "x86_64" -o $cpu = "arm64" -o $cpu = "riscv64" ; then
|
||||
case $cpu in x86_64|arm64|riscv64)
|
||||
if test -f "/usr/lib64/crti.o" ; then
|
||||
tcc_lddir="lib64"
|
||||
fi
|
||||
fi
|
||||
esac
|
||||
fi
|
||||
if test "$suggest" = "yes"; then
|
||||
if test -f "/lib/ld-uClibc.so.0" ; then
|
||||
|
|
Loading…
Add table
Reference in a new issue