qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] configure: Replace which(1) with "command -v"
@ 2014-11-19  7:13 Fam Zheng
  2014-11-19  8:18 ` Peter Maydell
  0 siblings, 1 reply; 2+ messages in thread
From: Fam Zheng @ 2014-11-19  7:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

Because which(1) is not always installed, whereas "command -v" is
the more native way to check for a command.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 47048f0..986a13d 100755
--- a/configure
+++ b/configure
@@ -2727,7 +2727,7 @@ fi
 if test "$modules" = yes; then
     shacmd_probe="sha1sum sha1 shasum"
     for c in $shacmd_probe; do
-        if which $c >/dev/null 2>&1; then
+        if command -v $c >/dev/null 2>&1; then
             shacmd="$c"
             break
         fi
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: Replace which(1) with "command -v"
  2014-11-19  7:13 [Qemu-devel] [PATCH] configure: Replace which(1) with "command -v" Fam Zheng
@ 2014-11-19  8:18 ` Peter Maydell
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2014-11-19  8:18 UTC (permalink / raw)
  To: Fam Zheng; +Cc: QEMU Trivial, QEMU Developers

On 19 November 2014 07:13, Fam Zheng <famz@redhat.com> wrote:
> Because which(1) is not always installed, whereas "command -v" is
> the more native way to check for a command.
>
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 47048f0..986a13d 100755
> --- a/configure
> +++ b/configure
> @@ -2727,7 +2727,7 @@ fi
>  if test "$modules" = yes; then
>      shacmd_probe="sha1sum sha1 shasum"
>      for c in $shacmd_probe; do
> -        if which $c >/dev/null 2>&1; then
> +        if command -v $c >/dev/null 2>&1; then
>              shacmd="$c"
>              break
>          fi

Configure already provides the shell function "has"
for checking for existence of a command -- can we just
use that?

thanks
-- PMM

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-11-19  8:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-19  7:13 [Qemu-devel] [PATCH] configure: Replace which(1) with "command -v" Fam Zheng
2014-11-19  8:18 ` Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).