git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Timo Hirvonen <tihirvon@gmail.com>
To: Matthias Lederhofer <matled@gmx.net>
Cc: dennis@stosberg.net, git@vger.kernel.org
Subject: Re: [PATCH 1/3] configure: Add test for Perl
Date: Thu, 6 Jul 2006 17:27:56 +0300	[thread overview]
Message-ID: <20060706172756.a42f1627.tihirvon@gmail.com> (raw)
In-Reply-To: <E1FyUNT-0007Ko-JR@moooo.ath.cx>

Matthias Lederhofer <matled@gmx.net> wrote:

> This will not work with spaces in $PATH. I'd do something like this if
> cut is portable (I have only freebsd and linux to test):

This works at least with SunOS /bin/sh, dash, posh and bash.

path_find()
{
        if test -x "$1"
        then
                echo "$1"
                return 0
        fi
	_ifs="$IFS"
	IFS=:
        for i in $PATH
        do
                if test -x "$i/$1"
                then
			IFS="$_ifs"
                        echo "$i/$1"
                        return 0
                fi
        done
	IFS="$_ifs"
        return 1
}

> Is there any reason to check the current directory first? "which"
> doesn't do it for me and without ./ in the front it does not work
> (without . is not in $PATH).

It is not needed but might be useful if PERL is user configurable
variable and can contain either full path or basename. For example this
code

    test "$PROG" || PROG=prog
    PROG=`path_find "$PROG"`

works with these cases

    $ PROG=/usr/bin/program ./configure
    $ PROG=program-1.2 ./configure

-- 
http://onion.dynserv.net/~timo/

  parent reply	other threads:[~2006-07-06 14:28 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-06 12:40 [PATCH 1/3] configure: Add test for Perl Dennis Stosberg
2006-07-06 13:03 ` Randal L. Schwartz
2006-07-06 13:10 ` Timo Hirvonen
2006-07-06 13:29   ` Dennis Stosberg
2006-07-06 13:58   ` Matthias Lederhofer
2006-07-06 14:17     ` Gerrit Pape
2006-07-06 14:25       ` Dennis Stosberg
2006-07-06 14:27     ` Timo Hirvonen [this message]
2006-07-06 15:34       ` Dennis Stosberg
2006-07-07 11:06   ` Petr Baudis
2006-07-07 11:20     ` Junio C Hamano
2006-07-07 11:23     ` Timo Hirvonen
2006-07-06 15:40 ` Alex Riesen
2006-07-06 15:44   ` Dennis Stosberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060706172756.a42f1627.tihirvon@gmail.com \
    --to=tihirvon@gmail.com \
    --cc=dennis@stosberg.net \
    --cc=git@vger.kernel.org \
    --cc=matled@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).