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