[pango: 1/2] Use "command -v" instead of "which"



commit 67e2990494dea37ffaaaef2da8d032cd46c6a4dc
Author: Ryan Schmidt <git ryandesign com>
Date:   Mon Aug 27 22:06:05 2018 -0500

    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.

 autogen.sh | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/autogen.sh b/autogen.sh
index bc7c59c9..4390c787 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -7,16 +7,14 @@ test -n "$srcdir" || srcdir=.
 olddir=`pwd`
 cd "$srcdir"
 
-GTKDOCIZE=`which gtkdocize`
-if test -z $GTKDOCIZE; then
+if ! command -v gtkdocize >/dev/null 2>&1; then
        echo "*** No GTK-Doc found, please install it ***"
        exit 1
 else
        gtkdocize || exit $?
 fi
 
-AUTORECONF=`which autoreconf`
-if test -z $AUTORECONF; then
+if ! command -v autoreconf >/dev/null 2>&1; then
        echo "*** No autoreconf found, please install it ***"
        exit 1
 else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]