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