summaryrefslogtreecommitdiff
path: root/mcon/U/Head.U
blob: b0acc81ce8815d4a5b00aa9014e7a7052d842ac4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
?RCS: $Id: Head.U 167 2013-05-08 17:58:00Z rmanfredi $
?RCS:
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS: 
?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?RCS: $Log: Head.U,v $
?RCS: Revision 3.0.1.9  1997/02/28  15:02:09  ram
?RCS: patch61: make sure we unset CDPATH for shells that support this
?RCS: patch61: improved Korn shell detection and handling
?RCS:
?RCS: Revision 3.0.1.8  1995/07/25  13:40:02  ram
?RCS: patch56: added SVR4-ish /opt directories to path list (ADO)
?RCS: patch56: OS/2 platforms are using another path separator
?RCS:
?RCS: Revision 3.0.1.7  1995/03/21  08:46:15  ram
?RCS: patch52: definition of paths wrongly added spurious ':' chars
?RCS:
?RCS: Revision 3.0.1.6  1994/10/29  15:54:19  ram
?RCS: patch36: make sure ENV is unset before calling /bin/ksh
?RCS:
?RCS: Revision 3.0.1.5  1994/08/29  16:03:44  ram
?RCS: patch32: now sets PATH only using existing directories
?RCS:
?RCS: Revision 3.0.1.4  1994/06/20  06:54:28  ram
?RCS: patch30: now computes its invocation name into 'me'
?RCS: patch30: symbol me is made visible to all units read-only
?RCS:
?RCS: Revision 3.0.1.3  1993/12/15  08:15:07  ram
?RCS: patch15: added /sbin:/usr/sbin:/usr/libexec in PATH for BSD/386
?RCS:
?RCS: Revision 3.0.1.2  1993/11/10  17:32:35  ram
?RCS: patch14: ensure PATH is reset to '.' before testing for alias
?RCS:
?RCS: Revision 3.0.1.1  1993/08/27  14:38:07  ram
?RCS: patch7: not all 'test' programs support the -x option
?RCS:
?RCS: Revision 3.0  1993/08/18  12:04:58  ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?X: 
?X: This is the very first unit in the Configure script.  It is mostly just
?X: things to keep people from getting into a tizzy right off the bat.
?X: 
?MAKE:Head:
?MAKE:	-pick wipe $@ %<
?V:PATH p_ _exe me newsh
?T:argv Id p paths OS2_SHELL DJGPP
?T:inksh needksh avoidksh newsh changesh reason
?F:!*
?LINT:extern ENV CDPATH SHELL MACHTYPE
?LINT:change ENV CDPATH
?LINT:nocomment
#! /bin/sh
#
# If these # comments don't work, trim them. Don't worry about any other
# shell scripts, Configure will trim # comments from them for you.
#
# (If you are trying to port this package to a machine without sh,
# I would suggest you have a look at the prototypical config_h.SH file
# and edit it to reflect your system. Some packages may include samples
# of config.h for certain machines, so you might look for one of those.)
#
?X:
?X: NOTE THAT A CONFIGURE SCRIPT IS IN THE PUBLIC DOMAIN (whether or not
?X: the software which uses it is in the public domain).
?X:
# Yes, you may rip this off to use in other distribution packages. This
# script belongs to the public domain and cannot be copyrighted.
#
?X:
?X: WE ASK YOU NOT TO REMOVE OR ALTER THE FOLLOWING PARAGRAPH, PLEASE:
?X:
# Note: this Configure script was generated automatically. Rather than
# working with this copy of Configure, you may wish to get metaconfig.
# The dist package (which contains metaconfig) is available via SVN:
#     svn co https://svn.code.sf.net/p/dist/code/trunk/dist
?X:
?X: NOTA BENE:
?X: If you develop you own version of metaconfig based on this work,
?X: you have to add some comments telling that the script was generated
?X: by your version, not mine: It credits your work.
?X:

# $Id: Head.U 167 2013-05-08 17:58:00Z rmanfredi $
#
# Generated on <DATE> [metaconfig <VERSION>-<REVISION>]

cat >c1$$ <<EOF
ARGGGHHHH!!!!!

SCO csh still thinks true is false.  Write to SCO today and tell them that next
year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)

(Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
we'd have to do is go in and swap the && and || tokens, wherever they are.)

[End of diatribe. We now return you to your regularly scheduled programming...]
EOF
cat >c2$$ <<EOF

OOPS!  You naughty creature!  You didn't run Configure with sh!
I will attempt to remedy the situation by running sh for you...
EOF

true || cat c1$$ c2$$
true || exec sh $0 $argv:q

(exit $?0) || cat c2$$
(exit $?0) || exec sh $0 $argv:q
rm -f c1$$ c2$$

: compute my invocation name
me=$0
case "$0" in
*/*)
	me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
	test "$me" || me=$0
	;;
esac

?X:
?X: To be able to run under OS/2, we must detect that early enough to use
?X: the proper path separator, stored in $p_. It is : on UNIX and ; on
?X: DOSish systems such as OS/2.
?X:
: Proper separator for the PATH environment variable
p_=:
: On OS/2 this directory should exist if this is not floppy only system ":-]"
if test -d c:/. ; then
	if test -n "$OS2_SHELL"; then
		p_=\;
		PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
?X: That's a bug in ksh5.22
		OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
	elif test -n "$DJGPP"; then
		case "X${MACHTYPE:-nonesuchmach}" in
		*cygwin|*msys) ;;
		*) p_=\; ;;
		esac
	fi
fi

?X:
?X: There are two schools of thoughts here. Some people correctly argue that
?X: the user has a better chance than we do of setting a reasonable PATH and
?X: others argue that Configure is the best place there is to set up a suitable
?X: PATH. Well, here we try to compromise by keeping the user's PATH and
?X: appending some directories which are known to work on some machine or the
?X: other. The rationale behind this being that a novice user might not have a
?X: proper environment variable set, and some directories like /etc (where
?X: chown is located on some BSD systems) may be missing--RAM.
?X:
?X: SVR4 adds an /opt directory for optional packages.  Some sites use
?X: various permutations on /opt as opposed to /usr or /usr/local.-- ADO
?X:
?X: We only add directories that are not already in the PATH of the
?X: user and the directories must exist also.
?X:
: Proper PATH setting
paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
paths="$paths /sbin /usr/sbin /usr/libexec"
paths="$paths /system/gnu_library/bin"

for p in $paths
do
	case "$p_$PATH$p_" in
	*$p_$p$p_*) ;;
	*) test -d $p && PATH=$PATH$p_$p ;;
	esac
done

PATH=.$p_$PATH
export PATH

: shall we be using ksh?
inksh=''
needksh=''
avoidksh=''
newsh=/bin/ksh
changesh=''
?X: Use (alias -x) and not (alias) since zsh and bash recognize the alias
?X: builtin but not the -x option which is typically ksh...
?X: We need to set up PATH before calling the "alias" built-in since some
?X: systems like HP-UX have a binary called /bin/alias.
if (PATH=.; alias -x) >/dev/null 2>&1; then
		inksh=true
fi
?X: On HP-UX, large Configure scripts may exercise a bug in /bin/sh, use ksh
if test -f /hp-ux -a -f /bin/ksh; then
	needksh='to avoid sh bug in "here document" expansion'
fi
?X: On AIX4, /bin/sh is really ksh and it causes problems, use sh
if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
	if test X`/usr/bin/uname -v` = X4; then
		avoidksh="to avoid AIX 4's /bin/sh"
		newsh=/usr/bin/bsh
	fi
fi
?X: On Digital UNIX, /bin/sh may start up buggy /bin/ksh, use sh
if test -f /osf_boot -a -f /usr/sbin/setld; then
	if test X`/usr/bin/uname -s` = XOSF1; then
		avoidksh="to avoid Digital UNIX' ksh"
		newsh=/bin/sh
?X: if BIN_SH is set to 'xpg4', sh will start up ksh
		unset BIN_SH
	fi
fi
?X: If we are not in ksh and need it, then feed us back to it
case "$inksh/$needksh" in
/[a-z]*)
?X: Clear ENV to avoid any ~/.kshrc that could alias cd or whatever...
?X: Don't use "unset ENV", that is not portable enough
		ENV=''
		changesh=true
		reason="$needksh"
	;;
esac
?X: If we are in ksh and must avoid it, then feed us back to a new shell
case "$inksh/$avoidksh" in
true/[a-z]*)
	changesh=true
	reason="$avoidksh"
	;;
esac
?X: Warn them if they use ksh on other systems, which are those where
?X: we don't need ksh nor want to avoid it explicitely, yet are using it.
case "$inksh/$needksh-$avoidksh-" in
true/--)
		cat <<EOM
(I see you are using the Korn shell.  Some ksh's blow up on $me,
mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
EOM
	;;
esac
case "$changesh" in
true)
	export newsh
	echo "(Feeding myself to $newsh $reason.)"
?X: Make sure they didn't say sh <Configure by checking whether $0 ends
?X: with Configure or not. If they did say sh <../../Configure, then too
?X: bad for them anyway, since we lost that path indication...
?X: Otherwise, execing $0 ensures we keep the full remote source dir
?X: indication for src.U.
	case "$0" in
	Configure|*/Configure) exec $newsh $0 "$@";;
	*) exec $newsh Configure "$@";;
	esac
	;;
esac

?X: Unset CDPATH to avoid surprises when using cd under some shells
?X: Can't unset it because that's not portable to very old shells.
?X: Can't set it to '' because then bash 2.02 won't do "cd UU"  --AD  6/98.
?X: Don't want to set it to '.' because then ksh prints out the
?X: name of the directory every time you cd to it. --AD 6/98
?X: In order to inflict the least harm, change it only if it's set.
: if needed, set CDPATH to a harmless value that is not chatty
case "$CDPATH" in
'')	;;
*)	case "$SHELL" in
	*bash*) CDPATH='.' ;;
	*) CDPATH='' ;;
	esac
	;;
esac

: Configure runs within the UU subdirectory
test -d UU || mkdir UU
?X: Use ./* to avoid any confirmation prompts from enhanced shells -- WED
cd UU && rm -f ./*