1 ?RCS: $Id: Loc.U,v 3.0.1.3 1994/01/24 14:01:44 ram Exp $
3 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 3.0.
11 ?RCS: Revision 3.0.1.3 1994/01/24 14:01:44 ram
12 ?RCS: patch16: added metalint hint on changed PATH variable
14 ?RCS: Revision 3.0.1.2 1993/12/15 08:16:52 ram
15 ?RCS: patch15: now set _test variable when test is built-in
16 ?RCS: patch15: fixed rare cases where echo is not needed
18 ?RCS: Revision 3.0.1.1 1993/09/13 15:47:13 ram
19 ?RCS: patch10: test program not always in /bin/test (WAD)
21 ?RCS: Revision 3.0 1993/08/18 12:05:05 ram
22 ?RCS: Baseline for dist 3.0 netwide release.
25 ?X: This unit produces a shell script "loc" which can be used to find out
26 ?X: where in a list of directories something is. It then uses loc to
27 ?X: determine the location of commonly used programs. It leaves loc sitting
28 ?X: around for other Configure units to use, but arranges for its demise
29 ?X: at the end of Configure.
31 ?X: To add a new program to find, add it both to the ?MAKE: line and to either
32 ?X: the loclist or trylist variable.
34 ?X: I put startsh at the end of the dependency list, in order to avoid the
35 ?X: loading of the spitshell unit before the instructions.
37 ?MAKE:Loc Mcc awk bash bison byacc cat chgrp chmod chown compress cp cpio \
38 cpp csh date echo egrep emacs expr find flex gcc grep inews ksh \
39 less line lint ln lp lpr ls mail mailx make mkdir more mv nroff \
40 perl pg pmake pr rm rmail sed sendmail sh shar sleep smail sort \
41 submit tail tar tbl test touch tr troff uname uniq uuname vi \
42 zcat: eunicefix n c Instruct Myread startsh
43 ?MAKE: -pick weed $@ %<
44 ?LINT:describe Loc Mcc awk bash bison byacc cat chgrp chmod chown compress \
45 cp cpio cpp csh date echo egrep emacs expr find flex gcc grep \
46 inews ksh less line lint ln lp lpr ls mail mailx make mkdir more \
47 mv nroff perl pg pmake pr rm rmail sed sendmail sh shar sleep \
48 smail sort submit tail tar tbl test touch tr troff uname uniq \
50 ?V::pth loclist trylist
51 ?T:thing xxx dir file say _test
53 : find out where common programs are
55 echo "Locating common programs..." >&4
68 if test -d \$dir/\$thing; then
74 if test -f \$dir/\$thing; then
77 elif test -f \$dir/\$thing.exe; then
78 : on Eunice apparently
159 ?LINT:set Loc Mcc awk bash bison byacc cat chgrp chmod chown compress cp \
160 cpio cpp csh date echo egrep emacs expr find flex gcc grep inews \
161 ksh less line lint ln lp lpr ls mail mailx make mkdir more mv \
162 nroff perl pg pmake pr rm rmail sed sendmail sh shar sleep \
163 smail sort submit tail tar tbl test touch tr troff uname uniq \
165 pth=`echo $PATH | sed -e 's/:/ /g'`
166 pth="$pth /lib /usr/lib"
167 for file in $loclist; do
168 xxx=`./loc $file $file $pth`
173 echo $file is in $xxx.
176 echo "I don't know where $file is. I hope it's in everyone's PATH."
181 echo "Don't worry if any of the following aren't found..."
183 for file in $trylist; do
184 xxx=`./loc $file $file $pth`
189 echo $file is in $xxx.
192 echo "I don't see $file out there, $say."
199 echo "Substituting grep for egrep."
205 echo "Hopefully test is built into your sh."
208 if sh -c "PATH= test true" >/dev/null 2>&1; then
209 echo "Using the test built into your sh."
211 ?X: We need to set both test and _test, since Oldconfig.U will use the _test
212 ?X: value to systematically restore computed paths, which may be wrong if
213 ?X: we choose to load an old config.sh generated on another platform.
223 echo "Hopefully echo is built into your sh."
225 ?X: For those rare cases where we don't need $echo...
229 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
230 $echo $n "hi there$c" >foo1
231 echo $n "hi there$c" >foo2
232 if cmp foo1 foo2 >/dev/null 2>&1; then
233 echo "They are compatible. In fact, they may be identical."
240 They are not compatible! You are probably running ksh on a non-USG system.
241 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
242 have echo built in and we may have to run some Bourne shell scripts. That
243 means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
246 $echo $n "The star should be here-->$c"