Commit | Line | Data |
---|---|---|
c98a3161 JH |
1 | ?RCS: $Id: sh.U,v 3.0.1.1 1997/02/28 16:20:13 ram Exp $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1997, Chip Salzenberg | |
4 | ?RCS: Copyright (c) 1991-1993, Raphael Manfredi | |
65a32477 MBT |
5 | ?RCS: |
6 | ?RCS: You may redistribute only under the terms of the Artistic License, | |
c98a3161 JH |
7 | ?RCS: as specified in the README file that comes with the distribution. |
8 | ?RCS: You may reuse parts of this distribution only within the terms of | |
65a32477 | 9 | ?RCS: that same Artistic License; a copy of which may be found at the root |
c98a3161 | 10 | ?RCS: of the source tree for dist 3.0. |
65a32477 | 11 | ?RCS: |
c98a3161 JH |
12 | ?RCS: $Log: sh.U,v $ |
13 | ?RCS: Revision 3.0.1.1 1997/02/28 16:20:13 ram | |
14 | ?RCS: patch61: created | |
15 | ?RCS: | |
76d1bd01 | 16 | ?MAKE:sh targetsh: Head |
c98a3161 JH |
17 | ?MAKE: -pick wipe $@ %< |
18 | ?S:sh: | |
19 | ?S: This variable contains the full pathname of the shell used | |
20 | ?S: on this system to execute Bourne shell scripts. Usually, this will be | |
21 | ?S: /bin/sh, though it's possible that some systems will have /bin/ksh, | |
22 | ?S: /bin/pdksh, /bin/ash, /bin/bash, or even something such as | |
23 | ?S: D:/bin/sh.exe. | |
24 | ?S: This unit comes before Options.U, so you can't set sh with a -D | |
25 | ?S: option, though you can override this (and startsh) | |
26 | ?S: with -O -Dsh=/bin/whatever -Dstartsh=whatever | |
27 | ?S:. | |
76d1bd01 MBT |
28 | ?S:targetsh: |
29 | ?S: If cross-compiling, this variable contains the location of sh on the | |
30 | ?S: target system. | |
31 | ?S: If not, this will be the same as $sh. | |
32 | ?S:. | |
c98a3161 JH |
33 | ?C:SH_PATH: |
34 | ?C: This symbol contains the full pathname to the shell used on this | |
35 | ?C: on this system to execute Bourne shell scripts. Usually, this will be | |
36 | ?C: /bin/sh, though it's possible that some systems will have /bin/ksh, | |
37 | ?C: /bin/pdksh, /bin/ash, /bin/bash, or even something such as | |
38 | ?C: D:/bin/sh.exe. | |
39 | ?C:. | |
9bdd8903 | 40 | ?H:#define SH_PATH "$targetsh" /**/ |
c98a3161 JH |
41 | ?H:. |
42 | ?T:xxx try pth p SYSTYPE | |
43 | ?LINT:extern maintloc maintname _exe | |
44 | ?X: | |
45 | ?X: Be quiet unless something unusual happens because this gets | |
46 | ?X: loaded up even before options are processed. | |
47 | ?X: Can't use ./loc because that depends on startsh, which, in turn | |
48 | ?X: depends on this unit. | |
c98a3161 JH |
49 | ?X: |
50 | : Find the basic shell for Bourne shell scripts | |
51 | case "$sh" in | |
52 | '') | |
65a32477 | 53 | ?X: SYSTYPE is for some older MIPS systems. |
c98a3161 JH |
54 | ?X: I do not know if it is still needed. |
55 | case "$SYSTYPE" in | |
56 | *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";; | |
57 | *) xxx='/bin/sh';; | |
58 | esac | |
59 | if test -f "$xxx"; then | |
60 | sh="$xxx" | |
61 | else | |
62 | : Build up a list and do a single loop so we can 'break' out. | |
63 | pth=`echo $PATH | sed -e "s/$p_/ /g"` | |
64 | for xxx in sh bash ksh pdksh ash; do | |
65 | for p in $pth; do | |
66 | try="$try ${p}/${xxx}" | |
67 | done | |
68 | done | |
69 | for xxx in $try; do | |
70 | if test -f "$xxx"; then | |
71 | sh="$xxx"; | |
72 | break | |
73 | elif test "X$_exe" != X -a -f "$xxx$_exe"; then | |
74 | sh="$xxx"; | |
75 | break | |
76 | elif test -f "$xxx.exe"; then | |
77 | sh="$xxx"; | |
78 | break | |
79 | fi | |
80 | done | |
81 | fi | |
82 | ;; | |
83 | esac | |
84 | ||
85 | ?X: fd 4 isn't open yet... | |
86 | case "$sh" in | |
87 | '') cat >&2 <<EOM | |
65a32477 | 88 | $me: Fatal Error: I can't find a Bourne Shell anywhere. |
c98a3161 JH |
89 | |
90 | Usually it's in /bin/sh. How did you even get this far? | |
fef1427a | 91 | Please report this issue at <$maintloc> |
d5ae7494 | 92 | and we'll try to straighten this all out. |
c98a3161 JH |
93 | EOM |
94 | exit 1 | |
95 | ;; | |
96 | esac | |
97 | ||
76d1bd01 MBT |
98 | : When cross-compiling we need to separate the sh-to-run-Configure-with from the sh-to-use-in-Perl |
99 | : default both to the same thing, cross-compilers can then set targetsh differently if they like | |
100 | targetsh=$sh | |
101 |