[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Use first form of the test command
From: |
Issam E. Maghni |
Subject: |
[PATCH] Use first form of the test command |
Date: |
Sun, 16 Aug 2020 19:42:57 -0400 |
Following
https://lists.gnu.org/archive/html/automake-patches/2020-08/msg00004.html
> The first form is easier to implement and directly available in BusyBox.
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html
> This change has also been done in make and cmake.
> https://git.savannah.gnu.org/cgit/make.git/commit/?id=c8a6263
> https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4704
Signed-off-by: Issam E. Maghni <issam.e.maghni@mailbox.org>
---
config.guess | 26 +++++++++++++-------------
config.sub | 2 +-
testsuite/config-guess.sh | 12 ++++++------
testsuite/config-sub.sh | 4 ++--
4 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/config.guess b/config.guess
index e94095c..8bd86e2 100755
--- a/config.guess
+++ b/config.guess
@@ -404,7 +404,7 @@ case
"$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
# If there is a compiler, see if it is configured for 64-bit objects.
# Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
# This test works for both compilers.
- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
@@ -544,10 +544,10 @@ EOF
AViiON:dgux:*:*)
# DG/UX returns AViiON for all architectures
UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ]
+ if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" =
mc88110
then
- if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \
- [ "$TARGET_BINARY_INTERFACE"x = x ]
+ if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \
+ test "$TARGET_BINARY_INTERFACE"x = x
then
echo m88k-dg-dgux"$UNAME_RELEASE"
else
@@ -580,7 +580,7 @@ EOF
echo i386-ibm-aix
exit ;;
ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
+ if test -x /usr/bin/oslevel ; then
IBM_REV=`/usr/bin/oslevel`
else
IBM_REV="$UNAME_VERSION.$UNAME_RELEASE"
@@ -620,7 +620,7 @@ EOF
else
IBM_ARCH=powerpc
fi
- if [ -x /usr/bin/lslpp ] ; then
+ if test -x /usr/bin/lslpp ; then
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else
@@ -655,7 +655,7 @@ EOF
9000/31?) HP_ARCH=m68000 ;;
9000/[34]??) HP_ARCH=m68k ;;
9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
+ if test -x /usr/bin/getconf; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
case "$sc_cpu_version" in
@@ -669,7 +669,7 @@ EOF
esac ;;
esac
fi
- if [ "$HP_ARCH" = "" ]; then
+ if test "$HP_ARCH" = ""; then
set_cc_for_build
sed 's/^ //' << EOF > "$dummy.c"
@@ -708,7 +708,7 @@ EOF
test -z "$HP_ARCH" && HP_ARCH=hppa
fi ;;
esac
- if [ "$HP_ARCH" = hppa2.0w ]
+ if test "$HP_ARCH" = hppa2.0w
then
set_cc_for_build
@@ -782,7 +782,7 @@ EOF
echo hppa1.0-hp-osf
exit ;;
i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
+ if test -x /usr/sbin/sysversion ; then
echo "$UNAME_MACHINE"-unknown-osf1mk
else
echo "$UNAME_MACHINE"-unknown-osf1
@@ -1097,7 +1097,7 @@ EOF
x86_64:Linux:*:*)
set_cc_for_build
LIBCABI=$LIBC
- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_X32 >/dev/null
@@ -1294,7 +1294,7 @@ EOF
echo mips-sony-newsos6
exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
+ if test -d /usr/nec; then
echo mips-nec-sysv"$UNAME_RELEASE"
else
echo mips-unknown-sysv"$UNAME_RELEASE"
@@ -1359,7 +1359,7 @@ EOF
else
set_cc_for_build
fi
- if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+ if test "$CC_FOR_BUILD" != no_compiler_found; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
diff --git a/config.sub b/config.sub
index 3d9a8dc..424ea8e 100755
--- a/config.sub
+++ b/config.sub
@@ -1278,7 +1278,7 @@ esac
# Decode manufacturer-specific aliases for certain operating systems.
-if [ x$basic_os != x ]
+if test x$basic_os != x
then
# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just
diff --git a/testsuite/config-guess.sh b/testsuite/config-guess.sh
index 42a013d..9031c36 100644
--- a/testsuite/config-guess.sh
+++ b/testsuite/config-guess.sh
@@ -22,12 +22,12 @@ run_config_guess()
-e "s,@VERSION@,$version," \
-e "s,@PROCESSOR@,$processor," > ./uname << EOF
#!/bin/sh
-[ \$# -ne 1 ] && exec sh \$0 -s
-[ \$1 = -m ] && echo "@MACHINE@" && exit 0
-[ \$1 = -r ] && echo "@RELEASE@" && exit 0
-[ \$1 = -s ] && echo "@SYSTEM@" && exit 0
-[ \$1 = -v ] && echo "@VERSION@" && exit 0
-[ \$1 = -p ] && echo "@PROCESSOR@" && exit 0
+test \$# -ne 1 && exec sh \$0 -s
+test \$1 = -m && echo "@MACHINE@" && exit 0
+test \$1 = -r && echo "@RELEASE@" && exit 0
+test \$1 = -s && echo "@SYSTEM@" && exit 0
+test \$1 = -v && echo "@VERSION@" && exit 0
+test \$1 = -p && echo "@PROCESSOR@" && exit 0
EOF
chmod +x uname
output=$(CC_FOR_BUILD=no_compiler_found sh -eu ../config.guess
2>/dev/null)
diff --git a/testsuite/config-sub.sh b/testsuite/config-sub.sh
index 7fb6fcc..c679bb3 100644
--- a/testsuite/config-sub.sh
+++ b/testsuite/config-sub.sh
@@ -36,7 +36,7 @@ run_config_sub()
while read -r alias canonical ; do
run_one_config_sub "$alias" "$canonical" &
numtests+=1 jobs+=1
- if [ $jobs -eq $maxprocs ] ; then
+ if test $jobs -eq $maxprocs ; then
for pid in $(jobs -p) ; do
wait "$pid"
rc=$((rc || $?))
@@ -73,7 +73,7 @@ run_config_sub_idempotent()
sed -r 's/\t+/\t/g' < config-sub.data | cut -f 2 | uniq | while read -r
canonical ; do
run_one_config_sub_idempotent "$canonical" &
numtests+=1 jobs+=1
- if [ $jobs -eq $maxprocs ] ; then
+ if test $jobs -eq $maxprocs ; then
for pid in $(jobs -p) ; do
wait "$pid"
rc=$((rc || $?))
--
2.28.0
- [PATCH] Use first form of the test command,
Issam E. Maghni <=