Do not rely on which to be present in the system

For portability, it is better to use the built-in `command` to check the
existance of executables in the system.
This commit is contained in:
David Vazquez 2015-10-18 12:00:58 +02:00 committed by Stas Boukarev
parent a61d893a7f
commit 1e226263db
5 changed files with 6 additions and 6 deletions

View file

@ -27,7 +27,7 @@ then
SBCL_HOME=$SBCL_PWD/../../obj/sbcl-home/; export SBCL_HOME
SBCL_BUILDING_CONTRIB="please asdf install your hook"; export SBCL_BUILDING_CONTRIB
else
SBCLRUNTIME="`which sbcl`"
SBCLRUNTIME="`command -v sbcl`"
fi
else
SBCLRUNTIME="$1"

View file

@ -8,10 +8,10 @@ find_gnumake() {
GNUMAKE="$GNUMAKE"
elif [ "GNU Make" = "`make -v 2>/dev/null | head -n 1 | cut -b 1-8`" ]; then
GNUMAKE=make
elif [ -x "`which gmake`" ] ; then
elif [ -x "`command -v gmake`" ] ; then
# "gmake" is the preferred name in *BSD.
GNUMAKE=gmake
elif [ -x "`which gnumake`" ] ; then
elif [ -x "`command -v gnumake`" ] ; then
# MacOS X aka Darwin
GNUMAKE=gnumake
else

View file

@ -2,7 +2,7 @@
git_available_p() {
# Check that (1) we have git (2) this is a git tree.
if ( which git >/dev/null 2>/dev/null && git describe >/dev/null 2>/dev/null )
if ( command -v git >/dev/null && git describe >/dev/null 2>/dev/null )
then
echo "ok"
else

View file

@ -22,7 +22,7 @@ LC_ALL=C
# Just doing CC=${CC:-cc} may be enough, but it needs to be checked
# that cc is available on all platforms.
if [ -z $CC ]; then
if [ -x "`which cc`" ]; then
if [ -x "`command -v cc`" ]; then
CC=cc
else
CC=gcc

View file

@ -3,7 +3,7 @@
platform="${SBCL_SOFTWARE_TYPE}-${SBCL_MACHINE_TYPE}"
if [ -z $CC ]; then
if [ -x "`which cc`" ]; then
if [ -x "`command -v cc`" ]; then
CC=cc
else
CC=gcc