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 | |
d01e9330 | 4 | ?RCS: |
65a32477 | 5 | ?RCS: You may redistribute only under the terms of the Artistic License, |
959f3c4c JH |
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 | |
65a32477 | 8 | ?RCS: that same Artistic License; a copy of which may be found at the root |
959f3c4c JH |
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: | |
68f55076 | 60 | ?MAKE:Oldconfig hint myuname osname osvers: Instruct Myread uname \ |
0f00356b | 61 | Checkcc Mksymlinks run \ |
959f3c4c JH |
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: | |
08c552f3 AD |
65 | ?S: The output of 'uname -a' if available, otherwise the hostname. |
66 | ?S: The whole thing is then lower-cased and slashes and single quotes are | |
67 | ?S: removed. | |
959f3c4c JH |
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:. | |
dd6f1bc3 JH |
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:. | |
959f3c4c | 99 | ?H:#define OSNAME "$osname" /**/ |
dd6f1bc3 | 100 | ?H:#define OSVERS "$osvers" /**/ |
959f3c4c JH |
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 | |
0f00356b JH |
108 | ?LINT:extern targetarch |
109 | ?LINT:extern hostarch | |
110 | ?LINT:change hostarch | |
1056f0f3 | 111 | ?LINT:extern is_os2 |
959f3c4c JH |
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! | |
508a21cd JH |
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` | |
08c552f3 | 122 | # Downcase everything to avoid ambiguity. |
65a32477 | 123 | # Remove slashes and single quotes so we can use parts of this in |
08c552f3 AD |
124 | # directory and file names. |
125 | # Remove newlines so myuname is sane to use elsewhere. | |
959f3c4c JH |
126 | # tr '[A-Z]' '[a-z]' would not work in EBCDIC |
127 | # because the A-Z/a-z are not consecutive. | |
08c552f3 | 128 | myuname=`echo $myuname | $sed -e "s,['/],,g" | \ |
959f3c4c JH |
129 | ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '` |
130 | ?X: Save the value we just computed to reset myuname after we get done here. | |
131 | newmyuname="$myuname" | |
132 | dflt=n | |
133 | case "$knowitall" in | |
134 | '') | |
135 | if test -f ../config.sh; then | |
136 | if $contains myuname= ../config.sh >/dev/null 2>&1; then | |
137 | eval "`grep myuname= ../config.sh`" | |
138 | fi | |
139 | if test "X$myuname" = "X$newmyuname"; then | |
140 | dflt=y | |
141 | fi | |
142 | fi | |
143 | ;; | |
144 | *) dflt=y;; | |
145 | esac | |
146 | ||
147 | @if {test -d ../hints} | |
148 | : Get old answers from old config file if Configure was run on the | |
149 | : same system, otherwise use the hints. | |
150 | hint=default | |
151 | cd .. | |
152 | ?X: Since we are now at the root of the source tree, we must use $src | |
153 | ?X: to access the sources and not $rsrc. See src.U for details... | |
154 | if test -f config.sh; then | |
155 | echo " " | |
156 | rp="I see a config.sh file. Shall I use it to set the defaults?" | |
157 | . UU/myread | |
158 | case "$ans" in | |
aac52537 AD |
159 | n*|N*) echo "OK, I'll ignore it." |
160 | mv config.sh config.sh.old | |
161 | myuname="$newmyuname" | |
162 | ;; | |
959f3c4c JH |
163 | *) echo "Fetching default answers from your old config.sh file..." >&4 |
164 | tmp_n="$n" | |
165 | tmp_c="$c" | |
166 | tmp_sh="$sh" | |
167 | . ./config.sh | |
168 | cp config.sh UU | |
169 | n="$tmp_n" | |
170 | c="$tmp_c" | |
171 | : Older versions did not always set $sh. Catch re-use of such | |
172 | : an old config.sh. | |
173 | case "$sh" in | |
174 | '') sh="$tmp_sh" ;; | |
175 | esac | |
176 | hint=previous | |
177 | ;; | |
178 | esac | |
179 | fi | |
14054727 | 180 | . ./UU/checkcc |
959f3c4c JH |
181 | if test ! -f config.sh; then |
182 | $cat <<EOM | |
183 | ||
184 | First time through, eh? I have some defaults handy for some systems | |
185 | that need some extra help getting the Configure answers right: | |
186 | ||
187 | EOM | |
188 | (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/ /g' >&4 | |
189 | dflt='' | |
190 | : Half the following guesses are probably wrong... If you have better | |
191 | : tests or hints, please send them to <MAINTLOC> | |
192 | : The metaconfig authors would also appreciate a copy... | |
193 | $test -f /irix && osname=irix | |
194 | $test -f /xenix && osname=sco_xenix | |
195 | $test -f /dynix && osname=dynix | |
196 | $test -f /dnix && osname=dnix | |
197 | $test -f /lynx.os && osname=lynxos | |
198 | $test -f /unicos && osname=unicos && osvers=`$uname -r` | |
73f6f260 | 199 | $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r` |
959f3c4c JH |
200 | $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r` |
201 | $test -f /bin/mips && /bin/mips && osname=mips | |
959f3c4c JH |
202 | $test -d /usr/apollo/bin && osname=apollo |
203 | $test -f /etc/saf/_sactab && osname=svr4 | |
204 | $test -d /usr/include/minix && osname=minix | |
ea7a0c8f | 205 | $test -f /system/gnu_library/bin/ar.pm && osname=vos |
959f3c4c JH |
206 | if $test -d /MachTen -o -d /MachTen_Folder; then |
207 | ?X: MachTen uname -a output looks like | |
208 | ?X: xxx 4 0.0 Macintosh | |
209 | ?X: MachTen /sbin/version output looks like | |
210 | ?X: MachTen 4.0 Mon Aug 28 10:18:00 1995 | |
211 | ?X: MachTen 3.x had the 'version' command in /usr/etc/version. | |
212 | osname=machten | |
213 | if $test -x /sbin/version; then | |
214 | osvers=`/sbin/version | $awk '{print $2}' | | |
215 | $sed -e 's/[A-Za-z]$//'` | |
216 | elif $test -x /usr/etc/version; then | |
217 | osvers=`/usr/etc/version | $awk '{print $2}' | | |
218 | $sed -e 's/[A-Za-z]$//'` | |
219 | else | |
220 | osvers="$2.$3" | |
221 | fi | |
222 | fi | |
edd6115f JH |
223 | |
224 | $test -f /sys/posix.dll && | |
225 | $test -f /usr/bin/what && | |
226 | set X `/usr/bin/what /sys/posix.dll` && | |
227 | $test "$3" = UWIN && | |
228 | osname=uwin && | |
229 | osvers="$5" | |
230 | ||
08c552f3 AD |
231 | ?X: If we have uname, we already computed a suitable uname -a output, |
232 | ?X: and it lies in $myuname. | |
959f3c4c JH |
233 | if $test -f $uname; then |
234 | set X $myuname | |
235 | shift | |
236 | ||
237 | case "$5" in | |
238 | fps*) osname=fps ;; | |
239 | mips*) | |
240 | case "$4" in | |
241 | umips) osname=umips ;; | |
242 | *) osname=mips ;; | |
243 | esac;; | |
244 | [23]100) osname=mips ;; | |
959f3c4c JH |
245 | ?X: Interactive Unix. |
246 | i386*) | |
247 | tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'` | |
248 | if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then | |
249 | osname='sco' | |
250 | osvers=$tmp | |
251 | elif $test -f /etc/kconfig; then | |
252 | osname=isc | |
253 | if test "$lns" = "$ln -s"; then | |
254 | osvers=4 | |
255 | elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then | |
256 | osvers=3 | |
257 | elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then | |
258 | osvers=2 | |
259 | fi | |
260 | fi | |
261 | tmp='' | |
262 | ;; | |
263 | ?X: MS-DOS djgpp uname -a output looks like: | |
264 | ?X: ms-dos xxx 6 22 pc | |
265 | ?X: $1 is the "dos flavor" (need not be "ms-dos"). | |
266 | ?X: $2 is the node name | |
267 | ?X: $3 and $4 are version/subversion | |
268 | ?X: $5 is always "pc", but that might not be unique to DJGPP. | |
269 | ?X: (e.g. Solaris_x86 has $5 = i86pc, which doesn't actually conflict, | |
65a32477 | 270 | ?X: but it's close enough that I can easily imagine other vendors also |
959f3c4c JH |
271 | ?X: using variants of pc* in $5.) |
272 | ?X: The "DJGPP" environment variable is always set when djgpp is active. | |
273 | pc*) | |
274 | if test -n "$DJGPP"; then | |
275 | osname=dos | |
276 | osvers=djgpp | |
277 | fi | |
278 | ;; | |
279 | esac | |
280 | ||
281 | case "$1" in | |
282 | aix) osname=aix | |
283 | ?X: aix 4.1 uname -a output looks like | |
d01e9330 | 284 | ?X: AIX foo 1 4 000123456789 |
959f3c4c JH |
285 | ?X: where $4 is the major release number and $3 is the (minor) version. |
286 | ?X: More detail on the version is available with the oslevel command. | |
287 | ?X: in 3.2.x, it output a string (see case statements below). In 4.1, | |
288 | ?X: it puts out something like 4.1.1.0 | |
289 | tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1` | |
290 | case "$tmp" in | |
461356af MB |
291 | # oslevel can fail with: |
292 | # oslevel: Unable to acquire lock. | |
293 | *not\ found) osvers="$4"."$3" ;; | |
959f3c4c JH |
294 | '<3240'|'<>3240') osvers=3.2.0 ;; |
295 | '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;; | |
296 | '=3250'|'>3250') osvers=3.2.5 ;; | |
297 | *) osvers=$tmp;; | |
298 | esac | |
299 | ;; | |
502c0e7f MBT |
300 | bitrig) osname=bitrig |
301 | osvers="$3" | |
302 | ;; | |
edd6115f JH |
303 | bsd386) osname=bsd386 |
304 | osvers=`$uname -r` | |
305 | ;; | |
306 | cygwin*) osname=cygwin | |
307 | osvers="$3" | |
308 | ;; | |
959f3c4c JH |
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 | ;; | |
d01e9330 RSG |
318 | dgux) osname=dgux |
319 | osvers="$3" | |
320 | ;; | |
321 | dragonfly) osname=dragonfly | |
959f3c4c JH |
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 | ;; | |
d01e9330 | 329 | freebsd) osname=freebsd |
959f3c4c | 330 | osvers="$3" ;; |
1fde2680 | 331 | genix) osname=genix ;; |
32643781 AD |
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! | |
1fde2680 BD |
337 | gnu) osname=gnu |
338 | osvers="$3" ;; | |
959f3c4c JH |
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 | |
d01e9330 | 343 | hp*) osname=hpux |
959f3c4c JH |
344 | osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'` |
345 | ;; | |
1fde2680 | 346 | irix*) osname=irix |
959f3c4c JH |
347 | case "$3" in |
348 | 4*) osvers=4 ;; | |
349 | 5*) osvers=5 ;; | |
350 | *) osvers="$3" ;; | |
351 | esac | |
352 | ;; | |
1fde2680 | 353 | linux) osname=linux |
959f3c4c JH |
354 | case "$3" in |
355 | *) osvers="$3" ;; | |
356 | esac | |
76d1bd01 | 357 | $test -f /system/lib/libandroid.so && osname=linux-android |
959f3c4c | 358 | ;; |
1fde2680 | 359 | MiNT) osname=mint |
959f3c4c JH |
360 | ;; |
361 | netbsd*) osname=netbsd | |
362 | osvers="$3" | |
363 | ;; | |
364 | news-os) osvers="$3" | |
365 | case "$3" in | |
366 | 4*) osname=newsos4 ;; | |
367 | *) osname=newsos ;; | |
368 | esac | |
369 | ;; | |
9f872204 | 370 | nonstop-ux) osname=nonstopux ;; |
b0f4b628 JH |
371 | openbsd) osname=openbsd |
372 | osvers="$3" | |
373 | ;; | |
1056f0f3 JH |
374 | os2) osname=os2 |
375 | osvers="$4" | |
376 | ;; | |
edd6115f JH |
377 | POSIX-BC | posix-bc ) osname=posix-bc |
378 | osvers="$3" | |
959f3c4c | 379 | ;; |
959f3c4c JH |
380 | powerux | power_ux | powermax_os | powermaxos | \ |
381 | powerunix | power_unix) osname=powerux | |
382 | osvers="$3" | |
383 | ;; | |
edd6115f JH |
384 | qnx) osname=qnx |
385 | osvers="$4" | |
386 | ;; | |
959f3c4c JH |
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 | |
5d7a094e | 417 | ?X: sizer knows the minor minor version: the letter |
8320b5cb | 418 | osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' | tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'` |
5d7a094e JH |
419 | case "$osvers" in |
420 | [1-9].[0-9]*) ;; | |
421 | *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;; | |
422 | esac | |
959f3c4c JH |
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 | ;; | |
6e46fa65 | 429 | # UnixWare 7.1.2 is known as Open UNIX 8 |
a5f24678 | 430 | openunix|unixware) osname=svr5 |
4ac3c55c A |
431 | osvers="$4" |
432 | ;; | |
9dbcc431 | 433 | uts) osname=uts |
959f3c4c JH |
434 | osvers="$3" |
435 | ;; | |
9dbcc431 JH |
436 | vos) osvers="$3" |
437 | ;; | |
959f3c4c JH |
438 | $2) case "$osname" in |
439 | *isc*) ;; | |
440 | *freebsd*) ;; | |
441 | svr*) | |
442 | : svr4.x or possibly later | |
d01e9330 | 443 | case "svr$3" in |
959f3c4c JH |
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 | |
1056f0f3 | 502 | elif test -d c:/. -o -n "$is_os2" ; then |
959f3c4c JH |
503 | set X $myuname |
504 | osname=os2 | |
505 | osvers="$5" | |
506 | fi | |
507 | fi | |
d01e9330 | 508 | |
0f00356b JH |
509 | case "$targetarch" in |
510 | '') ;; | |
511 | *) hostarch=$osname | |
76d1bd01 MBT |
512 | case "$targetarch" in |
513 | nto*|*-nto-*) | |
514 | # Will load qnx.sh, which should change osname to nto | |
515 | osname=qnx | |
516 | osvers='' | |
517 | ;; | |
518 | *linux-android*) | |
519 | # Catch arm-linux-androideabi, mipsel-linux-android, | |
520 | # and i686-linux-android | |
521 | osname=linux-android | |
522 | osvers='' | |
523 | ;; | |
524 | *linux*) | |
525 | # Something like arm-linux-gnueabihf is really just | |
526 | # plain linux. | |
527 | osname=linux | |
528 | osvers='' | |
529 | ;; | |
530 | *solaris*|*sunos*) | |
531 | osname=solaris | |
532 | # XXX perhaps we should just assume | |
533 | # osvers to be 2, or maybe take the value | |
534 | # from targetarch. Using $run before the | |
535 | # hints are run is somewhat icky. | |
536 | set X `$run $uname -a 2>/dev/null` | |
537 | shift | |
538 | case "$3" in | |
539 | 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;; | |
540 | *) osvers="$3" ;; | |
541 | esac | |
542 | ;; | |
543 | *) | |
544 | osname=`echo $targetarch|sed 's,^[^-]*-,,'` | |
545 | osvers='' | |
546 | ;; | |
547 | esac | |
0f00356b JH |
548 | ;; |
549 | esac | |
550 | ||
959f3c4c JH |
551 | : Now look for a hint file osname_osvers, unless one has been |
552 | : specified already. | |
553 | case "$hintfile" in | |
554 | ''|' ') | |
70ffff07 | 555 | file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'` |
959f3c4c | 556 | : Also try without trailing minor version numbers. |
70ffff07 DD |
557 | xfile=`echo $file | $sed -e 's%_[^_]*$%%'` |
558 | xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'` | |
559 | xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'` | |
560 | xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'` | |
959f3c4c JH |
561 | case "$file" in |
562 | '') dflt=none ;; | |
563 | *) case "$osvers" in | |
564 | '') dflt=$file | |
565 | ;; | |
566 | *) if $test -f $src/hints/$file.sh ; then | |
567 | dflt=$file | |
568 | elif $test -f $src/hints/$xfile.sh ; then | |
569 | dflt=$xfile | |
570 | elif $test -f $src/hints/$xxfile.sh ; then | |
571 | dflt=$xxfile | |
572 | elif $test -f $src/hints/$xxxfile.sh ; then | |
573 | dflt=$xxxfile | |
574 | elif $test -f $src/hints/$xxxxfile.sh ; then | |
575 | dflt=$xxxxfile | |
576 | elif $test -f "$src/hints/${osname}.sh" ; then | |
577 | dflt="${osname}" | |
578 | else | |
579 | dflt=none | |
580 | fi | |
581 | ;; | |
582 | esac | |
583 | ;; | |
584 | esac | |
585 | if $test -f Policy.sh ; then | |
586 | case "$dflt" in | |
587 | *Policy*) ;; | |
588 | none) dflt="Policy" ;; | |
589 | *) dflt="Policy $dflt" ;; | |
590 | esac | |
591 | fi | |
592 | ;; | |
593 | *) | |
594 | dflt=`echo $hintfile | $sed 's/\.sh$//'` | |
595 | ;; | |
596 | esac | |
597 | ||
598 | if $test -f Policy.sh ; then | |
599 | $cat <<EOM | |
600 | ||
601 | There's also a Policy hint file available, which should make the | |
602 | site-specific (policy) questions easier to answer. | |
603 | EOM | |
604 | ||
605 | fi | |
606 | ||
607 | $cat <<EOM | |
608 | ||
609 | You may give one or more space-separated answers, or "none" if appropriate. | |
dda48488 DD |
610 | If you have a handcrafted Policy.sh file or a Policy.sh file generated by a |
611 | previous run of Configure, you may specify it as well as or instead of | |
612 | OS-specific hints. If hints are provided for your OS, you should use them: | |
613 | although Perl can probably be built without hints on many platforms, using | |
614 | hints often improve performance and may enable features that Configure can't | |
615 | set up on its own. If there are no hints that match your OS, specify "none"; | |
616 | DO NOT give a wrong version or a wrong OS. | |
959f3c4c JH |
617 | |
618 | EOM | |
619 | ||
620 | rp="Which of these apply, if any?" | |
621 | . UU/myread | |
622 | tans=$ans | |
623 | for file in $tans; do | |
624 | if $test X$file = XPolicy -a -f Policy.sh; then | |
625 | . Policy.sh | |
626 | $cat Policy.sh >> UU/config.sh | |
627 | elif $test -f $src/hints/$file.sh; then | |
628 | . $src/hints/$file.sh | |
629 | $cat $src/hints/$file.sh >> UU/config.sh | |
0f00356b | 630 | elif $test X"$tans" = X -o X"$tans" = Xnone ; then |
959f3c4c JH |
631 | : nothing |
632 | else | |
633 | : Give one chance to correct a possible typo. | |
634 | echo "$file.sh does not exist" | |
635 | dflt=$file | |
636 | rp="hint to use instead?" | |
637 | . UU/myread | |
638 | for file in $ans; do | |
639 | if $test -f "$src/hints/$file.sh"; then | |
640 | . $src/hints/$file.sh | |
641 | $cat $src/hints/$file.sh >> UU/config.sh | |
642 | elif $test X$ans = X -o X$ans = Xnone ; then | |
643 | : nothing | |
644 | else | |
645 | echo "$file.sh does not exist -- ignored." | |
646 | fi | |
647 | done | |
648 | fi | |
649 | done | |
650 | ||
651 | hint=recommended | |
652 | : Remember our hint file for later. | |
653 | if $test -f "$src/hints/$file.sh" ; then | |
654 | hintfile="$file" | |
655 | else | |
656 | hintfile='' | |
657 | fi | |
658 | fi | |
659 | cd UU | |
660 | ?X: From here on, we must use $rsrc instead of $src | |
661 | @else | |
662 | : Get old answers, if there is a config file out there | |
663 | hint=default | |
664 | hintfile='' | |
665 | if test -f ../config.sh; then | |
666 | echo " " | |
667 | rp="I see a config.sh file. Shall I use it to set the defaults?" | |
668 | . ./myread | |
669 | case "$ans" in | |
670 | n*|N*) echo "OK, I'll ignore it.";; | |
671 | *) echo "Fetching default answers from your old config.sh file..." >&4 | |
672 | tmp_n="$n" | |
673 | tmp_c="$c" | |
674 | . ../config.sh | |
675 | cp ../config.sh . | |
676 | n="$tmp_n" | |
677 | c="$tmp_c" | |
678 | hint=previous | |
679 | ;; | |
680 | esac | |
681 | fi | |
682 | @end | |
683 | ?X: remember, indentation is wrong--RAM | |
684 | ;; | |
685 | *) | |
686 | echo " " | |
687 | echo "Fetching default answers from $config_sh..." >&4 | |
688 | tmp_n="$n" | |
689 | tmp_c="$c" | |
690 | cd .. | |
691 | ?X: preserve symbolic links, if any | |
692 | cp $config_sh config.sh 2>/dev/null | |
693 | chmod +w config.sh | |
694 | . ./config.sh | |
695 | cd UU | |
696 | cp ../config.sh . | |
697 | n="$tmp_n" | |
698 | c="$tmp_c" | |
699 | hint=previous | |
700 | ;; | |
701 | esac | |
702 | test "$override" && . ./optdef.sh | |
959f3c4c JH |
703 | |
704 | : Restore computed paths | |
705 | for file in $loclist $trylist; do | |
706 | eval $file="\$_$file" | |
707 | done | |
708 | ||
709 | @if osname || osvers | |
710 | cat << EOM | |
711 | ||
712 | Configure uses the operating system name and version to set some defaults. | |
713 | The default value is probably right if the name rings a bell. Otherwise, | |
714 | since spelling matters for me, either accept the default or answer "none" | |
715 | to leave it blank. | |
716 | ||
717 | EOM | |
718 | @end | |
719 | @if osname | |
720 | case "$osname" in | |
721 | ''|' ') | |
722 | case "$hintfile" in | |
723 | ''|' '|none) dflt=none ;; | |
724 | *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;; | |
725 | esac | |
726 | ;; | |
727 | *) dflt="$osname" ;; | |
728 | esac | |
729 | rp="Operating system name?" | |
730 | . ./myread | |
731 | case "$ans" in | |
732 | none) osname='' ;; | |
733 | *) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;; | |
734 | esac | |
735 | @end | |
736 | @if osvers | |
737 | @if osname | |
738 | echo " " | |
739 | @end | |
740 | case "$osvers" in | |
741 | ''|' ') | |
742 | case "$hintfile" in | |
743 | ''|' '|none) dflt=none ;; | |
744 | *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'` | |
745 | dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'` | |
746 | case "$dflt" in | |
747 | ''|' ') dflt=none ;; | |
748 | esac | |
749 | ;; | |
750 | esac | |
751 | ;; | |
752 | *) dflt="$osvers" ;; | |
753 | esac | |
754 | rp="Operating system version?" | |
755 | . ./myread | |
756 | case "$ans" in | |
757 | none) osvers='' ;; | |
758 | *) osvers="$ans" ;; | |
759 | esac | |
760 | ||
761 | @end | |
c71449a6 JH |
762 | |
763 | . ./posthint.sh | |
764 |