Use "command -v" instead of "which"

The behavior of "which" is not standardized by POSIX. Some old
implementations print their error messages to stdout instead of stderr,
and don't return a nonzero exit code when they fail to find the given
program. "command -v" on the other hand is in POSIX (optional in 2004
and required as of 2008).

Remove otherwise-unused variables AUTORECONF and GTKDOCIZE.
This commit is contained in:
Ryan Schmidt 2018-08-27 20:54:58 -05:00
parent c138b98e36
commit 2c85e0a498

View File

@ -7,8 +7,7 @@ test -n "$srcdir" || srcdir=.
olddir=`pwd` olddir=`pwd`
cd "$srcdir" cd "$srcdir"
GTKDOCIZE=$(which gtkdocize 2>/dev/null) if ! command -v gtkdocize >/dev/null 2>&1; then
if test -z $GTKDOCIZE; then
echo "You don't have gtk-doc installed, and thus won't be able to generate the documentation." echo "You don't have gtk-doc installed, and thus won't be able to generate the documentation."
rm -f gtk-doc.make rm -f gtk-doc.make
cat > gtk-doc.make <<EOF cat > gtk-doc.make <<EOF
@ -19,8 +18,7 @@ else
gtkdocize || exit $? gtkdocize || exit $?
fi fi
AUTORECONF=`which autoreconf` if ! command -v autoreconf >/dev/null 2>&1; then
if test -z $AUTORECONF; then
echo "*** No autoreconf found, please install it ***" echo "*** No autoreconf found, please install it ***"
exit 1 exit 1
fi fi