add HAVE_LIBM
[mmh] / etc / mhn.find.sh
1 #! /bin/sh
2 #
3 # mhn.find.sh -- check if a particular command is available
4 #
5 # $Id$
6
7 if test -z "$2"; then
8     echo "usage: mhn.find.sh search-path program" 1>&2
9     exit 1
10 fi
11
12 # PATH to search for programs
13 SEARCHPATH=$1
14
15 # program to search for
16 PROGRAM=$2
17
18 PGM= oIFS="$IFS" IFS=":"
19 for A in $SEARCHPATH; do
20
21     # skip the directories `.' and `..'
22     if test "$A" = "." -o "$A" = ".."; then
23         continue
24     fi
25
26     # if program was found in /usr/local/bin, then
27     # just echo program name, else echo full pathname
28     if test -f "$A/$PROGRAM"; then
29         if test "$A" = "/usr/local/bin"; then
30             PGM="$PROGRAM"
31         else
32             PGM="$A/$PROGRAM"
33         fi
34
35         echo "$PGM"
36         exit 0
37     fi
38 done
39 IFS="$oIFS"
40