summaryrefslogtreecommitdiff
path: root/U/Oldconfig.U
blob: 2b6d3a0157e1ad3d52e2ea539a723f416c3b3c9d (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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
?RCS: $Id: Oldconfig.U,v 3.0.1.2 1994/01/24 14:05:02 ram Exp $
?RCS:
?RCS: Copyright (c) 1991-1993, Raphael Manfredi
?RCS: 
?RCS: You may redistribute only under the terms of the Artistic Licence,
?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 Licence; a copy of which may be found at the root
?RCS: of the source tree for dist 3.0.
?RCS:
?RCS: $Log: Oldconfig.U,v $
?RCS: Revision 3.0.1.2  1994/01/24  14:05:02  ram
?RCS: patch16: added post-processing on myuname for Xenix targets
?RCS: patch16: message proposing config.sh defaults made consistent
?RCS:
?RCS: Revision 3.0.1.1  1993/09/13  15:56:32  ram
?RCS: patch10: force use of config.sh when -d option is used (WAD)
?RCS: patch10: complain about non-existent hint files (WAD)
?RCS: patch10: added Options dependency for fastread variable
?RCS:
?RCS: Revision 3.0  1993/08/18  12:05:12  ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?X: 
?X: This unit tries to remember what we did last time we ran Configure, mostly
?X: for the sake of setting defaults.
?X: 
?MAKE:Oldconfig hint myuname osname osvers: Instruct Myread uname \
	sed test cat rm n c contains Loc Options
?MAKE:	-pick wipe $@ %<
?S:myuname:
?S:	The output of 'uname -a' if available, otherwise the hostname. On Xenix,
?S:	pseudo variables assignments in the output are stripped, thank you. The
?S:	whole thing is then lower-cased.
?S:.
?S:hint:
?S:	Gives the type of hints used for previous answers. May be one of
?S:	"default", "recommended" or "previous".
?S:.
?S:osname:
?S:	This variable contains the operating system name (e.g. sunos, 
?S:	solaris, hpux, etc.).  It can be useful later on for setting
?S:	defaults. It is set to '' if we can't figure it out.
?S:.
?S:osvers:
?S:	This variable contains the operating system version (e.g.
?S:	4.1.3, 5.2, etc.).  It is primarily used for helping select
?S:	an appropriate hints file, but might be useful elsewhere for
?S:	setting defaults.  It is set to '' if we can't figure it out.
?S:.
?T:tmp file oldmyuname hintfile tans _
?LINT:change n c
: Try to determine whether config.sh was made on this system
case "$config_sh" in
'')
?X: indentation wrong on purpose--RAM
?X: Leave a white space between first two '(' for ksh. The sub-shell is needed
?X: on some machines to avoid the error message when uname is not found; e.g.
?X: old SUN-OS 3.2 would not execute hostname in (uname -a || hostname). Sigh!
myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
?X: Special mention for Xenix, whose 'uname -a' gives us output like this:
?X:  sysname=XENIX
?X:  nodename=whatever
?X:  release=2.3.2 .. etc...
?X: Therefore, we strip all this variable assignment junk and remove all the
?X: new lines to keep the myuname variable sane... --RAM
myuname=`echo $myuname | $sed -e 's/^[^=]*=//' | \
	tr '[A-Z]' '[a-z]' | tr '\012' ' '`
dflt=n
if test "$fastread" = yes; then
	dflt=y
elif test -f ../config.sh; then
?X: The value from config.sh will superseed the one we've just computed
?X: ... but not if we choose to ignore config.sh, so eval oldmyuname here.
	oldmyuname=''
	if $contains myuname= ../config.sh >/dev/null 2>&1; then
		eval "old`grep myuname= ../config.sh`"
	fi
	if test "X$myuname" = "X$oldmyuname"; then
		dflt=y
	fi
fi

@if {test -d ../hints}
: Get old answers from old config file if Configure was run on the
: same system, otherwise use the hints.
hint=default
cd ..
if test -f config.sh; then
	echo " "
	rp="I see a config.sh file.  Shall I use it to set the defaults?"
	. UU/myread
	case "$ans" in
	n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
	*)  echo "Fetching default answers from your old config.sh file..." >&4
		tmp="$n"
		tans="$c"
		. ./config.sh
		cp config.sh UU
		n="$tmp"
		c="$tans"
		hint=previous
		;;
	esac
fi
if test ! -f config.sh; then
	$cat <<EOM

First time through, eh?  I have some defaults handy for the following systems:

EOM
	cd hints; ls -C *.sh | $sed 's/\.sh/   /g' >&4
	dflt=''
	: Half the following guesses are probably wrong... If you have better
	: tests or hints, please send them to <MAINTLOC>
	: The metaconfig authors would also appreciate a copy...
	$test -f /irix && osname=sgi
	$test -f /xenix && osname=sco_xenix
	$test -f /dynix && osname=dynix
	$test -f /dnix && osname=dnix
	$test -f /bin/mips && /bin/mips && osname=mips
	$test -d /NextApps && test -f /usr/adm/software_version && osname=next
	$test -d /usr/include/minix && osname=minix
?X: If we have uname, we already computed a suitable uname -a output, correctly
?X: formatted for Xenix, and it lies in $myuname.
	if $test -f $uname; then
		set X $myuname
		shift

		$test -f $5.sh && dflt="$dflt $5"

		case "$5" in
		fps*) osname=fps ;;
		mips*)
			case "$4" in
			umips) osname=umips ;;
			*) osname=mips ;;
			esac;;
		[23]100) osname=mips ;;
		next*) osname=next ;;
		news*) osname=news ;;
		i386*) if $test -f /etc/kconfig; then
			    osname=isc
				if $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
					osvers=3.2.3
				elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
					osvers=3.2.2
			    fi
		       fi
		       ;;
		esac

		case "$1" in
		aix) osname=aix_rs ;;
		sunos) osname=sunos
			case "$3" in
			[34]*) osvers=$3 ;;
			5*) osname=solaris
				osvers=`echo $3 | $sed 's/^5/2/g'` ;;
			esac
			;;
		solaris) osname=solaris
			case "$3" in
			5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
			esac
			;;
		dnix) osname=dnix ;;
		dgux) osname=dgux ;;
		genix) osname=genix ;;
		hp*ux) osname=hpux ;;
		next) osname=next ;;
		irix) osname=sgi ;;
		ultrix) osname=ultrix
			case "$3" in
			1*) osvers=1 ;;
			2*) osvers=2 ;;
			3*) osvers=3 ;;
			4*) osvers=4 ;;
			esac
			;;
		osf1)	case "$5" in
				alpha)  osname=dec_osf
					case "$3" in
                    	[vt]1\.*) osvers=1 ;;
                        [vt]2\.*) osvers=2 ;;
                        [vt]3\.*) osvers=3 ;;
					esac
                    ;;
			hp*)	osname=hp_osf1	;;	# TR
			mips)	osname=mips_osf1 ;;	# TR
			# TR =	Technology Releases: (un^N)supported
			esac
			;;
		uts) osname=uts ;;
		$2) case "$osname" in
			*isc*) ;;
			*)	if test -f /etc/systemid; then
				osname=sco
				: Does anyone know if these next gyrations are needed
				set `echo $3 | $sed 's/\./ /g'` $4
					if $test -f sco_$1_$2_$3.sh; then
						osvers=$1.$2.$3
					elif $test -f sco_$1_$2.sh; then
						osvers=$1.$2
					elif $test -f sco_$1.sh; then
						osvers=$1
					fi
				fi
				;;
			esac
			;;
		esac
	else
?X: Try to identify sony's NEWS-OS (BSD unix)
		if test -f /vmunix -a -f news_os.sh; then
			(what /vmunix | tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
			if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
				osname=news_os
			fi
			$rm -f ../UU/kernel.what
		fi
	fi
	
	: Now look for a hint file osname_osvers
	file=`echo "${osname}_${osvers}" | sed -e 's@\.@_@g' -e 's@_$@@'`
	case "$file" in
	'') dflt=none ;;
	*)  case "$osvers" in
		'') dflt=$file 
			;;
		*)  if $test -f $file.sh ; then
				dflt=$file
			elif $test -f "${osname}.sh" ; then
				dflt="${osname}"
			else
				dflt=none
			fi
			;;
		esac
		;;
	esac
			
	$cat <<EOM

You may give one or more space-separated answers, or "none" if appropriate.
If your OS version has no hints, DO NOT give a wrong version -- say "none".

EOM
	rp="Which of these apply, if any?"
	. ../UU/myread
	tans=$ans
	for file in $tans; do
		if $test -f $file.sh; then
			. ./$file.sh
			$cat $file.sh >> ../UU/config.sh
		elif $test X$tans = X -o X$tans = Xnone ; then
			: nothing
		else
			: Give one chance to correct a possible typo.
			echo "$file.sh does not exist"
			dflt=$file
			rp="hint to use instead?"
			. ../UU/myread
			for file in $ans; do
				if $test -f "$file.sh"; then
					. ./$file.sh
					$cat $file.sh >> ../UU/config.sh
				elif $test X$ans = X -o X$ans = Xnone ; then
					: nothing
				else
					echo "$file.sh does not exist -- ignored."
				fi
			done
		fi
	done

	hint=recommended
	: Remember our hint file for later.
	if $test -f "$file.sh" ; then
		hintfile="$file.sh"
	else
		hintfile=none
	fi

	cd ..
fi
cd UU
@else
: Get old answers, if there is a config file out there
hint=default
if test -f ../config.sh; then
	echo " "
	rp="I see a config.sh file.  Shall I use it to set the defaults?"
	. ./myread
	case "$ans" in
	n*|N*) echo "OK, I'll ignore it.";;
	*)  echo "Fetching default answers from your old config.sh file..." >&4
		tmp="$n"
		tans="$c"
		. ../config.sh
		cp ../config.sh .
		n="$tmp"
		c="$tans"
		hint=previous
		;;
	esac
fi
@end
?X: remember, indentation is wrong--RAM
;;
*)
	echo " "
	echo "Fetching default answers from $config_sh..." >&4
	tmp="$n"
	tans="$c"
	cd ..
?X: preserve symbolic links, if any
	cp $config_sh config.sh 2>/dev/null
	. ./config.sh
	cd UU
	cp ../config.sh .
	n="$tmp"
	c="$tans"
	hint=previous
	;;
esac

: Restore computed paths
for file in $loclist $trylist; do
	eval $file="\$_$file"
done

cat << EOM
Configure uses the operating system name and version to set some defaults.
Say "none" to leave it blank.
EOM

case "$osname" in
	''|' ')  
		case "$hintfile" in
		none) dflt=none ;;
		*)  dflt=`echo $hintfile | sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
		esac
		;;
	*) dflt="$osname" ;;
esac
rp="Operating system name?"
. ./myread
case "$ans" in
    none)  osname='' ;;
    *) osname="$ans" ;;
esac

case "$osvers" in
	''|' ')  
		case "$hintfile" in
		none) dflt=none ;;
		*)	dflt=`echo $hintfile | sed -e 's/\.sh$//' -e 's/^[^_]*//'`
    		dflt=`echo $dflt | sed -e 's/^_//' -e 's/_/./g'` ;;
		esac
		;;
	*) dflt="$osvers" ;;
esac
rp="Operating system version?"
. ./myread
case "$ans" in
    none)  osvers='' ;;
    *) osvers="$ans" ;;
esac