Commit | Line | Data |
---|---|---|
959f3c4c JH |
1 | ?RCS: $Id: Oldconfig.U,v 3.0.1.10 1997/02/28 15:06:39 ram Exp $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1991-1993, Raphael Manfredi | |
4 | ?RCS: | |
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. | |
10 | ?RCS: | |
11 | ?RCS: $Log: Oldconfig.U,v $ | |
12 | ?RCS: Revision 3.0.1.10 1997/02/28 15:06:39 ram | |
13 | ?RCS: patch61: added support for src.U | |
14 | ?RCS: patch61: new OSNAME define | |
15 | ?RCS: patch61: can now sense new OSes | |
16 | ?RCS: | |
17 | ?RCS: Revision 3.0.1.9 1995/07/25 13:40:51 ram | |
18 | ?RCS: patch56: now knows about OS/2 platforms | |
19 | ?RCS: | |
20 | ?RCS: Revision 3.0.1.8 1995/05/12 12:04:18 ram | |
21 | ?RCS: patch54: config.sh reload logic now knows about new -K switch | |
22 | ?RCS: patch54: cleaned up and extended osvers for DEC OSF/1 (ADO) | |
23 | ?RCS: patch54: added MachTen detection (ADO) | |
24 | ?RCS: | |
25 | ?RCS: Revision 3.0.1.7 1995/02/15 14:13:41 ram | |
26 | ?RCS: patch51: adapted osvers computation for AIX (ADO) | |
27 | ?RCS: | |
28 | ?RCS: Revision 3.0.1.6 1995/01/30 14:27:15 ram | |
29 | ?RCS: patch49: unit Options.U now exports file optdef.sh, not a variable | |
30 | ?RCS: patch49: update code for myuname changed (WED) | |
31 | ?RCS: | |
32 | ?RCS: Revision 3.0.1.5 1995/01/11 15:15:36 ram | |
33 | ?RCS: patch45: added quotes around the INITPROG variable (ADO) | |
34 | ?RCS: patch45: allows variable overriding after config file loading | |
35 | ?RCS: | |
36 | ?RCS: Revision 3.0.1.4 1994/10/29 15:57:05 ram | |
37 | ?RCS: patch36: added ?F: line for metalint file checking | |
38 | ?RCS: patch36: merged with the version used for perl5's Configure (ADO) | |
39 | ?RCS: | |
40 | ?RCS: Revision 3.0.1.3 1994/05/06 14:24:17 ram | |
41 | ?RCS: patch23: added support for osf1 hints | |
42 | ?RCS: patch23: new support for solaris and i386 systems (ADO) | |
43 | ?RCS: | |
44 | ?RCS: Revision 3.0.1.2 1994/01/24 14:05:02 ram | |
45 | ?RCS: patch16: added post-processing on myuname for Xenix targets | |
46 | ?RCS: patch16: message proposing config.sh defaults made consistent | |
47 | ?RCS: | |
48 | ?RCS: Revision 3.0.1.1 1993/09/13 15:56:32 ram | |
49 | ?RCS: patch10: force use of config.sh when -d option is used (WAD) | |
50 | ?RCS: patch10: complain about non-existent hint files (WAD) | |
51 | ?RCS: patch10: added Options dependency for fastread variable | |
52 | ?RCS: | |
53 | ?RCS: Revision 3.0 1993/08/18 12:05:12 ram | |
54 | ?RCS: Baseline for dist 3.0 netwide release. | |
55 | ?RCS: | |
56 | ?X: | |
57 | ?X: This unit tries to remember what we did last time we ran Configure, mostly | |
58 | ?X: for the sake of setting defaults. | |
59 | ?X: | |
60 | ?MAKE:Oldconfig hint myuname osname osvers: Instruct Myread uname \ | |
61 | sh awk sed test cat rm lns tr n c contains Loc Options Tr src trnl ln | |
62 | ?MAKE: -pick wipe $@ %< | |
63 | ?S:myuname: | |
64 | ?S: The output of 'uname -a' if available, otherwise the hostname. On Xenix, | |
65 | ?S: pseudo variables assignments in the output are stripped, thank you. The | |
66 | ?S: whole thing is then lower-cased. | |
67 | ?S:. | |
68 | ?S:hint: | |
69 | ?S: Gives the type of hints used for previous answers. May be one of | |
70 | ?S: "default", "recommended" or "previous". | |
71 | ?S:. | |
72 | ?S:osname: | |
73 | ?S: This variable contains the operating system name (e.g. sunos, | |
74 | ?S: solaris, hpux, etc.). It can be useful later on for setting | |
75 | ?S: defaults. Any spaces are replaced with underscores. It is set | |
76 | ?S: to a null string if we can't figure it out. | |
77 | ?S:. | |
78 | ?S:osvers: | |
79 | ?S: This variable contains the operating system version (e.g. | |
80 | ?S: 4.1.3, 5.2, etc.). It is primarily used for helping select | |
81 | ?S: an appropriate hints file, but might be useful elsewhere for | |
82 | ?S: setting defaults. It is set to '' if we can't figure it out. | |
83 | ?S: We try to be flexible about how much of the version number | |
84 | ?S: to keep, e.g. if 4.1.1, 4.1.2, and 4.1.3 are essentially the | |
85 | ?S: same for this package, hints files might just be os_4.0 or | |
86 | ?S: os_4.1, etc., not keeping separate files for each little release. | |
87 | ?S:. | |
88 | ?C:OSNAME: | |
89 | ?C: This symbol contains the name of the operating system, as determined | |
90 | ?C: by Configure. You shouldn't rely on it too much; the specific | |
91 | ?C: feature tests from Configure are generally more reliable. | |
92 | ?C:. | |
93 | ?H:#define OSNAME "$osname" /**/ | |
94 | ?H:. | |
95 | ?F:!config.sh | |
96 | ?T:tmp tmp_n tmp_c tmp_sh file | |
97 | ?T:xxxxfile xxxfile xxfile xfile hintfile newmyuname | |
98 | ?T:tans _ isesix INITPROG DJGPP | |
99 | ?D:osname='' | |
100 | ?LINT:change n c sh | |
101 | : Try to determine whether config.sh was made on this system | |
102 | case "$config_sh" in | |
103 | '') | |
104 | ?X: indentation wrong on purpose--RAM | |
105 | ?X: Leave a white space between first two '(' for ksh. The sub-shell is needed | |
106 | ?X: on some machines to avoid the error message when uname is not found; e.g. | |
107 | ?X: old SUN-OS 3.2 would not execute hostname in (uname -a || hostname). Sigh! | |
508a21cd JH |
108 | ?X: Now not using a subshell but instead $test. |
109 | myuname=`$uname -a 2>/dev/null` | |
110 | $test -z "$myuname" && myuname=`hostname 2>/dev/null` | |
959f3c4c JH |
111 | ?X: Special mention for Xenix, whose 'uname -a' gives us output like this: |
112 | ?X: sysname=XENIX | |
113 | ?X: nodename=whatever | |
114 | ?X: release=2.3.2 .. etc... | |
115 | ?X: Therefore, we strip all this variable assignment junk and remove all the | |
116 | ?X: new lines to keep the myuname variable sane... --RAM | |
117 | # tr '[A-Z]' '[a-z]' would not work in EBCDIC | |
118 | # because the A-Z/a-z are not consecutive. | |
119 | myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \ | |
120 | ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '` | |
121 | ?X: Save the value we just computed to reset myuname after we get done here. | |
122 | newmyuname="$myuname" | |
123 | dflt=n | |
124 | case "$knowitall" in | |
125 | '') | |
126 | if test -f ../config.sh; then | |
127 | if $contains myuname= ../config.sh >/dev/null 2>&1; then | |
128 | eval "`grep myuname= ../config.sh`" | |
129 | fi | |
130 | if test "X$myuname" = "X$newmyuname"; then | |
131 | dflt=y | |
132 | fi | |
133 | fi | |
134 | ;; | |
135 | *) dflt=y;; | |
136 | esac | |
137 | ||
138 | @if {test -d ../hints} | |
139 | : Get old answers from old config file if Configure was run on the | |
140 | : same system, otherwise use the hints. | |
141 | hint=default | |
142 | cd .. | |
143 | ?X: Since we are now at the root of the source tree, we must use $src | |
144 | ?X: to access the sources and not $rsrc. See src.U for details... | |
145 | if test -f config.sh; then | |
146 | echo " " | |
147 | rp="I see a config.sh file. Shall I use it to set the defaults?" | |
148 | . UU/myread | |
149 | case "$ans" in | |
150 | n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;; | |
151 | *) echo "Fetching default answers from your old config.sh file..." >&4 | |
152 | tmp_n="$n" | |
153 | tmp_c="$c" | |
154 | tmp_sh="$sh" | |
155 | . ./config.sh | |
156 | cp config.sh UU | |
157 | n="$tmp_n" | |
158 | c="$tmp_c" | |
159 | : Older versions did not always set $sh. Catch re-use of such | |
160 | : an old config.sh. | |
161 | case "$sh" in | |
162 | '') sh="$tmp_sh" ;; | |
163 | esac | |
164 | hint=previous | |
165 | ;; | |
166 | esac | |
167 | fi | |
168 | if test ! -f config.sh; then | |
169 | $cat <<EOM | |
170 | ||
171 | First time through, eh? I have some defaults handy for some systems | |
172 | that need some extra help getting the Configure answers right: | |
173 | ||
174 | EOM | |
175 | (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4 | |
176 | dflt='' | |
177 | : Half the following guesses are probably wrong... If you have better | |
178 | : tests or hints, please send them to <MAINTLOC> | |
179 | : The metaconfig authors would also appreciate a copy... | |
180 | $test -f /irix && osname=irix | |
181 | $test -f /xenix && osname=sco_xenix | |
182 | $test -f /dynix && osname=dynix | |
183 | $test -f /dnix && osname=dnix | |
184 | $test -f /lynx.os && osname=lynxos | |
185 | $test -f /unicos && osname=unicos && osvers=`$uname -r` | |
73f6f260 | 186 | $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r` |
959f3c4c JH |
187 | $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r` |
188 | $test -f /bin/mips && /bin/mips && osname=mips | |
189 | $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \ | |
190 | $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4 | |
191 | $test -d /usr/apollo/bin && osname=apollo | |
192 | $test -f /etc/saf/_sactab && osname=svr4 | |
193 | $test -d /usr/include/minix && osname=minix | |
194 | if $test -d /MachTen -o -d /MachTen_Folder; then | |
195 | ?X: MachTen uname -a output looks like | |
196 | ?X: xxx 4 0.0 Macintosh | |
197 | ?X: MachTen /sbin/version output looks like | |
198 | ?X: MachTen 4.0 Mon Aug 28 10:18:00 1995 | |
199 | ?X: MachTen 3.x had the 'version' command in /usr/etc/version. | |
200 | osname=machten | |
201 | if $test -x /sbin/version; then | |
202 | osvers=`/sbin/version | $awk '{print $2}' | | |
203 | $sed -e 's/[A-Za-z]$//'` | |
204 | elif $test -x /usr/etc/version; then | |
205 | osvers=`/usr/etc/version | $awk '{print $2}' | | |
206 | $sed -e 's/[A-Za-z]$//'` | |
207 | else | |
208 | osvers="$2.$3" | |
209 | fi | |
210 | fi | |
edd6115f JH |
211 | |
212 | $test -f /sys/posix.dll && | |
213 | $test -f /usr/bin/what && | |
214 | set X `/usr/bin/what /sys/posix.dll` && | |
215 | $test "$3" = UWIN && | |
216 | osname=uwin && | |
217 | osvers="$5" | |
218 | ||
959f3c4c JH |
219 | ?X: If we have uname, we already computed a suitable uname -a output, correctly |
220 | ?X: formatted for Xenix, and it lies in $myuname. | |
221 | if $test -f $uname; then | |
222 | set X $myuname | |
223 | shift | |
224 | ||
225 | case "$5" in | |
226 | fps*) osname=fps ;; | |
227 | mips*) | |
228 | case "$4" in | |
229 | umips) osname=umips ;; | |
230 | *) osname=mips ;; | |
231 | esac;; | |
232 | [23]100) osname=mips ;; | |
233 | next*) osname=next ;; | |
234 | ?X: Interactive Unix. | |
235 | i386*) | |
236 | tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'` | |
237 | if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then | |
238 | osname='sco' | |
239 | osvers=$tmp | |
240 | elif $test -f /etc/kconfig; then | |
241 | osname=isc | |
242 | if test "$lns" = "$ln -s"; then | |
243 | osvers=4 | |
244 | elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then | |
245 | osvers=3 | |
246 | elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then | |
247 | osvers=2 | |
248 | fi | |
249 | fi | |
250 | tmp='' | |
251 | ;; | |
252 | ?X: MS-DOS djgpp uname -a output looks like: | |
253 | ?X: ms-dos xxx 6 22 pc | |
254 | ?X: $1 is the "dos flavor" (need not be "ms-dos"). | |
255 | ?X: $2 is the node name | |
256 | ?X: $3 and $4 are version/subversion | |
257 | ?X: $5 is always "pc", but that might not be unique to DJGPP. | |
258 | ?X: (e.g. Solaris_x86 has $5 = i86pc, which doesn't actually conflict, | |
259 | ?X: but it's close enought that I can easily imagine other vendors also | |
260 | ?X: using variants of pc* in $5.) | |
261 | ?X: The "DJGPP" environment variable is always set when djgpp is active. | |
262 | pc*) | |
263 | if test -n "$DJGPP"; then | |
264 | osname=dos | |
265 | osvers=djgpp | |
266 | fi | |
267 | ;; | |
268 | esac | |
269 | ||
270 | case "$1" in | |
271 | aix) osname=aix | |
272 | ?X: aix 4.1 uname -a output looks like | |
273 | ?X: AIX foo 1 4 000123456789 | |
274 | ?X: where $4 is the major release number and $3 is the (minor) version. | |
275 | ?X: More detail on the version is available with the oslevel command. | |
276 | ?X: in 3.2.x, it output a string (see case statements below). In 4.1, | |
277 | ?X: it puts out something like 4.1.1.0 | |
278 | tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1` | |
279 | case "$tmp" in | |
280 | 'not found') osvers="$4"."$3" ;; | |
281 | '<3240'|'<>3240') osvers=3.2.0 ;; | |
282 | '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;; | |
283 | '=3250'|'>3250') osvers=3.2.5 ;; | |
284 | *) osvers=$tmp;; | |
285 | esac | |
286 | ;; | |
edd6115f JH |
287 | bsd386) osname=bsd386 |
288 | osvers=`$uname -r` | |
289 | ;; | |
290 | cygwin*) osname=cygwin | |
291 | osvers="$3" | |
292 | ;; | |
959f3c4c JH |
293 | *dc.osx) osname=dcosx |
294 | osvers="$3" | |
295 | ;; | |
296 | dnix) osname=dnix | |
297 | osvers="$3" | |
298 | ;; | |
299 | domainos) osname=apollo | |
300 | osvers="$3" | |
301 | ;; | |
302 | dgux) osname=dgux | |
303 | osvers="$3" | |
304 | ;; | |
305 | ?X: uname -a returns | |
306 | ?X: DYNIX/ptx xxx 4.0 V4.1.2 i386 | |
307 | dynixptx*) osname=dynixptx | |
308 | osvers=`echo "$4"|sed 's/^v//'` | |
309 | ;; | |
310 | freebsd) osname=freebsd | |
311 | osvers="$3" ;; | |
312 | genix) osname=genix ;; | |
313 | ?X: HP-UX uname -a gives something like | |
314 | ?X: HP-UX foobar B.10.20 A 9000/735 2016483812 two-user license | |
315 | ?X: Preserve the full 10.20 string instead of the previous plain '10'. | |
316 | ?X: Thanks to Graham Barr. --AD 6/30/1998 | |
317 | hp*) osname=hpux | |
318 | osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'` | |
319 | ;; | |
320 | irix*) osname=irix | |
321 | case "$3" in | |
322 | 4*) osvers=4 ;; | |
323 | 5*) osvers=5 ;; | |
324 | *) osvers="$3" ;; | |
325 | esac | |
326 | ;; | |
327 | linux) osname=linux | |
328 | case "$3" in | |
329 | *) osvers="$3" ;; | |
330 | esac | |
331 | ;; | |
332 | MiNT) osname=mint | |
333 | ;; | |
334 | netbsd*) osname=netbsd | |
335 | osvers="$3" | |
336 | ;; | |
337 | news-os) osvers="$3" | |
338 | case "$3" in | |
339 | 4*) osname=newsos4 ;; | |
340 | *) osname=newsos ;; | |
341 | esac | |
342 | ;; | |
edd6115f JH |
343 | next*) osname=next ;; |
344 | POSIX-BC | posix-bc ) osname=posix-bc | |
345 | osvers="$3" | |
959f3c4c | 346 | ;; |
959f3c4c JH |
347 | powerux | power_ux | powermax_os | powermaxos | \ |
348 | powerunix | power_unix) osname=powerux | |
349 | osvers="$3" | |
350 | ;; | |
edd6115f JH |
351 | qnx) osname=qnx |
352 | osvers="$4" | |
353 | ;; | |
959f3c4c JH |
354 | solaris) osname=solaris |
355 | case "$3" in | |
356 | 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;; | |
357 | *) osvers="$3" ;; | |
358 | esac | |
359 | ;; | |
360 | sunos) osname=sunos | |
361 | case "$3" in | |
362 | 5*) osname=solaris | |
363 | osvers=`echo $3 | $sed 's/^5/2/g'` ;; | |
364 | *) osvers="$3" ;; | |
365 | esac | |
366 | ;; | |
367 | titanos) osname=titanos | |
368 | case "$3" in | |
369 | 1*) osvers=1 ;; | |
370 | 2*) osvers=2 ;; | |
371 | 3*) osvers=3 ;; | |
372 | 4*) osvers=4 ;; | |
373 | *) osvers="$3" ;; | |
374 | esac | |
375 | ;; | |
376 | ultrix) osname=ultrix | |
377 | osvers="$3" | |
378 | ;; | |
379 | osf1|mls+) case "$5" in | |
380 | alpha) | |
381 | ?X: DEC OSF/1 myuname -a output looks like: osf1 xxxx t3.2 123.4 alpha | |
382 | ?X: where the version number can be something like [xvt]n.n | |
383 | osname=dec_osf | |
384 | osvers=`echo "$3" | sed 's/^[xvt]//'` | |
385 | ;; | |
386 | hp*) osname=hp_osf1 ;; | |
387 | mips) osname=mips_osf1 ;; | |
388 | ?X: hp and mips were unsupported Technology Releases -- ADO, 24/10/94 | |
389 | esac | |
390 | ;; | |
4ac3c55c A |
391 | unixware) osname=svr5 |
392 | osvers="$4" | |
393 | ;; | |
394 | uts) osname=uts | |
959f3c4c JH |
395 | osvers="$3" |
396 | ;; | |
959f3c4c JH |
397 | $2) case "$osname" in |
398 | *isc*) ;; | |
399 | *freebsd*) ;; | |
400 | svr*) | |
401 | : svr4.x or possibly later | |
402 | case "svr$3" in | |
403 | ${osname}*) | |
404 | osname=svr$3 | |
405 | osvers=$4 | |
406 | ;; | |
407 | esac | |
408 | case "$osname" in | |
409 | svr4.0) | |
410 | : Check for ESIX | |
411 | if test -f /stand/boot ; then | |
412 | eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot` | |
413 | if test -n "$INITPROG" -a -f "$INITPROG"; then | |
414 | isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'` | |
415 | if test -n "$isesix"; then | |
416 | osname=esix4 | |
417 | fi | |
418 | fi | |
419 | fi | |
420 | ;; | |
421 | esac | |
422 | ;; | |
423 | *) if test -f /etc/systemid; then | |
424 | osname=sco | |
425 | set `echo $3 | $sed 's/\./ /g'` $4 | |
426 | if $test -f $src/hints/sco_$1_$2_$3.sh; then | |
427 | osvers=$1.$2.$3 | |
428 | elif $test -f $src/hints/sco_$1_$2.sh; then | |
429 | osvers=$1.$2 | |
430 | elif $test -f $src/hints/sco_$1.sh; then | |
431 | osvers=$1 | |
432 | fi | |
433 | else | |
434 | case "$osname" in | |
435 | '') : Still unknown. Probably a generic Sys V. | |
436 | osname="sysv" | |
437 | osvers="$3" | |
438 | ;; | |
439 | esac | |
440 | fi | |
441 | ;; | |
442 | esac | |
443 | ;; | |
444 | *) case "$osname" in | |
445 | '') : Still unknown. Probably a generic BSD. | |
446 | osname="$1" | |
447 | osvers="$3" | |
448 | ;; | |
449 | esac | |
450 | ;; | |
451 | esac | |
452 | else | |
453 | ?X: Try to identify sony's NEWS-OS (BSD unix) | |
454 | if test -f /vmunix -a -f $src/hints/news_os.sh; then | |
455 | (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1 | |
456 | if $contains news-os UU/kernel.what >/dev/null 2>&1; then | |
457 | osname=news_os | |
458 | fi | |
459 | $rm -f UU/kernel.what | |
460 | ?X: Maybe it's OS/2 or DOS or something similar | |
461 | elif test -d c:/.; then | |
462 | set X $myuname | |
463 | osname=os2 | |
464 | osvers="$5" | |
465 | fi | |
466 | fi | |
467 | ||
468 | : Now look for a hint file osname_osvers, unless one has been | |
469 | : specified already. | |
470 | case "$hintfile" in | |
471 | ''|' ') | |
472 | file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'` | |
473 | : Also try without trailing minor version numbers. | |
474 | xfile=`echo $file | $sed -e 's@_[^_]*$@@'` | |
475 | xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'` | |
476 | xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'` | |
477 | xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'` | |
478 | case "$file" in | |
479 | '') dflt=none ;; | |
480 | *) case "$osvers" in | |
481 | '') dflt=$file | |
482 | ;; | |
483 | *) if $test -f $src/hints/$file.sh ; then | |
484 | dflt=$file | |
485 | elif $test -f $src/hints/$xfile.sh ; then | |
486 | dflt=$xfile | |
487 | elif $test -f $src/hints/$xxfile.sh ; then | |
488 | dflt=$xxfile | |
489 | elif $test -f $src/hints/$xxxfile.sh ; then | |
490 | dflt=$xxxfile | |
491 | elif $test -f $src/hints/$xxxxfile.sh ; then | |
492 | dflt=$xxxxfile | |
493 | elif $test -f "$src/hints/${osname}.sh" ; then | |
494 | dflt="${osname}" | |
495 | else | |
496 | dflt=none | |
497 | fi | |
498 | ;; | |
499 | esac | |
500 | ;; | |
501 | esac | |
502 | if $test -f Policy.sh ; then | |
503 | case "$dflt" in | |
504 | *Policy*) ;; | |
505 | none) dflt="Policy" ;; | |
506 | *) dflt="Policy $dflt" ;; | |
507 | esac | |
508 | fi | |
509 | ;; | |
510 | *) | |
511 | dflt=`echo $hintfile | $sed 's/\.sh$//'` | |
512 | ;; | |
513 | esac | |
514 | ||
515 | if $test -f Policy.sh ; then | |
516 | $cat <<EOM | |
517 | ||
518 | There's also a Policy hint file available, which should make the | |
519 | site-specific (policy) questions easier to answer. | |
520 | EOM | |
521 | ||
522 | fi | |
523 | ||
524 | $cat <<EOM | |
525 | ||
526 | You may give one or more space-separated answers, or "none" if appropriate. | |
527 | A well-behaved OS will have no hints, so answering "none" or just "Policy" | |
86a2f2c4 | 528 | is a good thing. DO NOT give a wrong version or a wrong OS. |
959f3c4c JH |
529 | |
530 | EOM | |
531 | ||
532 | rp="Which of these apply, if any?" | |
533 | . UU/myread | |
534 | tans=$ans | |
535 | for file in $tans; do | |
536 | if $test X$file = XPolicy -a -f Policy.sh; then | |
537 | . Policy.sh | |
538 | $cat Policy.sh >> UU/config.sh | |
539 | elif $test -f $src/hints/$file.sh; then | |
540 | . $src/hints/$file.sh | |
541 | $cat $src/hints/$file.sh >> UU/config.sh | |
542 | elif $test X$tans = X -o X$tans = Xnone ; then | |
543 | : nothing | |
544 | else | |
545 | : Give one chance to correct a possible typo. | |
546 | echo "$file.sh does not exist" | |
547 | dflt=$file | |
548 | rp="hint to use instead?" | |
549 | . UU/myread | |
550 | for file in $ans; do | |
551 | if $test -f "$src/hints/$file.sh"; then | |
552 | . $src/hints/$file.sh | |
553 | $cat $src/hints/$file.sh >> UU/config.sh | |
554 | elif $test X$ans = X -o X$ans = Xnone ; then | |
555 | : nothing | |
556 | else | |
557 | echo "$file.sh does not exist -- ignored." | |
558 | fi | |
559 | done | |
560 | fi | |
561 | done | |
562 | ||
563 | hint=recommended | |
564 | : Remember our hint file for later. | |
565 | if $test -f "$src/hints/$file.sh" ; then | |
566 | hintfile="$file" | |
567 | else | |
568 | hintfile='' | |
569 | fi | |
570 | fi | |
571 | cd UU | |
572 | ?X: From here on, we must use $rsrc instead of $src | |
573 | @else | |
574 | : Get old answers, if there is a config file out there | |
575 | hint=default | |
576 | hintfile='' | |
577 | if test -f ../config.sh; then | |
578 | echo " " | |
579 | rp="I see a config.sh file. Shall I use it to set the defaults?" | |
580 | . ./myread | |
581 | case "$ans" in | |
582 | n*|N*) echo "OK, I'll ignore it.";; | |
583 | *) echo "Fetching default answers from your old config.sh file..." >&4 | |
584 | tmp_n="$n" | |
585 | tmp_c="$c" | |
586 | . ../config.sh | |
587 | cp ../config.sh . | |
588 | n="$tmp_n" | |
589 | c="$tmp_c" | |
590 | hint=previous | |
591 | ;; | |
592 | esac | |
593 | fi | |
594 | @end | |
595 | ?X: remember, indentation is wrong--RAM | |
596 | ;; | |
597 | *) | |
598 | echo " " | |
599 | echo "Fetching default answers from $config_sh..." >&4 | |
600 | tmp_n="$n" | |
601 | tmp_c="$c" | |
602 | cd .. | |
603 | ?X: preserve symbolic links, if any | |
604 | cp $config_sh config.sh 2>/dev/null | |
605 | chmod +w config.sh | |
606 | . ./config.sh | |
607 | cd UU | |
608 | cp ../config.sh . | |
609 | n="$tmp_n" | |
610 | c="$tmp_c" | |
611 | hint=previous | |
612 | ;; | |
613 | esac | |
614 | test "$override" && . ./optdef.sh | |
615 | myuname="$newmyuname" | |
616 | ||
617 | : Restore computed paths | |
618 | for file in $loclist $trylist; do | |
619 | eval $file="\$_$file" | |
620 | done | |
621 | ||
622 | @if osname || osvers | |
623 | cat << EOM | |
624 | ||
625 | Configure uses the operating system name and version to set some defaults. | |
626 | The default value is probably right if the name rings a bell. Otherwise, | |
627 | since spelling matters for me, either accept the default or answer "none" | |
628 | to leave it blank. | |
629 | ||
630 | EOM | |
631 | @end | |
632 | @if osname | |
633 | case "$osname" in | |
634 | ''|' ') | |
635 | case "$hintfile" in | |
636 | ''|' '|none) dflt=none ;; | |
637 | *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;; | |
638 | esac | |
639 | ;; | |
640 | *) dflt="$osname" ;; | |
641 | esac | |
642 | rp="Operating system name?" | |
643 | . ./myread | |
644 | case "$ans" in | |
645 | none) osname='' ;; | |
646 | *) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;; | |
647 | esac | |
648 | @end | |
649 | @if osvers | |
650 | @if osname | |
651 | echo " " | |
652 | @end | |
653 | case "$osvers" in | |
654 | ''|' ') | |
655 | case "$hintfile" in | |
656 | ''|' '|none) dflt=none ;; | |
657 | *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'` | |
658 | dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'` | |
659 | case "$dflt" in | |
660 | ''|' ') dflt=none ;; | |
661 | esac | |
662 | ;; | |
663 | esac | |
664 | ;; | |
665 | *) dflt="$osvers" ;; | |
666 | esac | |
667 | rp="Operating system version?" | |
668 | . ./myread | |
669 | case "$ans" in | |
670 | none) osvers='' ;; | |
671 | *) osvers="$ans" ;; | |
672 | esac | |
673 | ||
674 | @end | |
c71449a6 JH |
675 | |
676 | . ./posthint.sh | |
677 |