Commit | Line | Data |
---|---|---|
2304df62 AD |
1 | #! /bin/sh |
2 | # | |
3 | # If these # comments don't work, trim them. Don't worry about any other | |
4 | # shell scripts, Configure will trim # comments from them for you. | |
5 | # | |
6 | # (If you are trying to port this package to a machine without sh, | |
7 | # I would suggest you have a look at the prototypical config_h.SH file | |
8 | # and edit it to reflect your system. Some packages may include samples | |
9 | # of config.h for certain machines, so you might look for one of those.) | |
10 | # | |
11 | # Yes, you may rip this off to use in other distribution packages. This | |
12 | # script belongs to the public domain and cannot be copyrighted. | |
13 | # | |
14 | # (Note: this Configure script was generated automatically. Rather than | |
15 | # working with this copy of Configure, you may wish to get metaconfig. | |
16 | # The dist-3.0 package (which contains metaconfig) was posted in | |
17 | # comp.sources.misc so you may fetch it yourself from your nearest | |
18 | # archive site. Check with Archie if you don't know where that can be.) | |
19 | # | |
20 | ||
8e07c86e | 21 | # $Id: Head.U,v 3.0.1.8 1995/07/25 13:40:02 ram Exp $ |
2304df62 | 22 | # |
a4f3eea9 | 23 | # Generated on Thu Oct 10 15:08:34 EDT 1996 [metaconfig 3.0 PL60] |
2304df62 AD |
24 | |
25 | cat >/tmp/c1$$ <<EOF | |
26 | ARGGGHHHH!!!!! | |
27 | ||
28 | SCO csh still thinks true is false. Write to SCO today and tell them that next | |
29 | year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-) | |
30 | ||
31 | (Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All | |
32 | we'd have to do is go in and swap the && and || tokens, wherever they are.) | |
33 | ||
34 | [End of diatribe. We now return you to your regularly scheduled programming...] | |
35 | EOF | |
36 | cat >/tmp/c2$$ <<EOF | |
37 | ||
38 | OOPS! You naughty creature! You didn't run Configure with sh! | |
39 | I will attempt to remedy the situation by running sh for you... | |
40 | EOF | |
41 | ||
42 | true || cat /tmp/c1$$ /tmp/c2$$ | |
43 | true || exec sh $0 $argv:q | |
44 | ||
45 | (exit $?0) || cat /tmp/c2$$ | |
46 | (exit $?0) || exec sh $0 $argv:q | |
47 | rm -f /tmp/c1$$ /tmp/c2$$ | |
48 | ||
a0d0e21e LW |
49 | : compute my invocation name |
50 | me=$0 | |
51 | case "$0" in | |
52 | */*) | |
53 | me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null` | |
54 | test "$me" || me=$0 | |
55 | ;; | |
56 | esac | |
57 | ||
8e07c86e AD |
58 | : Proper PATH separator |
59 | p_=: | |
60 | : On OS/2 this directory should exist if this is not floppy only system :-] | |
4b40f7a3 | 61 | if test -d c:/. -a -n "$OS2_SHELL"; then |
8e07c86e AD |
62 | p_=\; |
63 | PATH=`cmd /c "echo %PATH%" | tr '\\\\' / ` | |
64 | OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'` | |
65 | fi | |
a0d0e21e LW |
66 | |
67 | : Proper PATH setting | |
68 | paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin' | |
16d20bd9 | 69 | paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin" |
232e078e | 70 | paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin" |
16d20bd9 | 71 | paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin" |
232e078e AD |
72 | paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb" |
73 | paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin" | |
74 | paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib" | |
75 | paths="$paths /sbin /usr/sbin /usr/libexec" | |
a0d0e21e LW |
76 | |
77 | for p in $paths | |
78 | do | |
8e07c86e AD |
79 | case "$p_$PATH$p_" in |
80 | *$p_$p$p_*) ;; | |
81 | *) test -d $p && PATH=$PATH$p_$p ;; | |
a0d0e21e LW |
82 | esac |
83 | done | |
84 | ||
8e07c86e | 85 | PATH=.$p_$PATH |
2304df62 AD |
86 | export PATH |
87 | ||
a0d0e21e | 88 | : Sanity checks |
2304df62 | 89 | if test ! -t 0; then |
a0d0e21e | 90 | echo "Say 'sh $me', not 'sh <$me'" |
2304df62 AD |
91 | exit 1 |
92 | fi | |
93 | ||
94 | : On HP-UX, large Configure scripts may exercise a bug in /bin/sh | |
95 | if test -f /hp-ux -a -f /bin/ksh; then | |
96 | if (PATH=.; alias -x) >/dev/null 2>&1; then | |
97 | : already under /bin/ksh | |
98 | else | |
99 | cat <<'EOM' | |
100 | (Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.) | |
101 | EOM | |
ecfc5424 | 102 | unset ENV |
2304df62 AD |
103 | exec /bin/ksh $0 "$@" |
104 | fi | |
105 | else | |
106 | : Warn them if they use ksh on other systems | |
107 | (PATH=.; alias -x) >/dev/null 2>&1 && \ | |
a0d0e21e LW |
108 | cat <<EOM |
109 | (I see you are using the Korn shell. Some ksh's blow up on $me, | |
8ff267be | 110 | especially on older exotic systems. If yours does, try the Bourne |
111 | shell instead.) | |
2304df62 AD |
112 | EOM |
113 | fi | |
114 | ||
115 | : Configure runs within the UU subdirectory | |
116 | test -d UU || mkdir UU | |
8e07c86e | 117 | cd UU && rm -f ./* |
2304df62 | 118 | |
a0d0e21e | 119 | dynamic_ext='' |
2304df62 | 120 | extensions='' |
a0d0e21e LW |
121 | known_extensions='' |
122 | static_ext='' | |
8ff267be | 123 | useopcode='' |
a0d0e21e | 124 | useposix='' |
ecfc5424 | 125 | d_bsd='' |
40a7a20a | 126 | d_eunice='' |
2304df62 AD |
127 | d_xenix='' |
128 | eunicefix='' | |
129 | Mcc='' | |
130 | awk='' | |
131 | bash='' | |
132 | bison='' | |
133 | byacc='' | |
134 | cat='' | |
135 | chgrp='' | |
136 | chmod='' | |
137 | chown='' | |
ecfc5424 | 138 | comm='' |
2304df62 AD |
139 | compress='' |
140 | cp='' | |
141 | cpio='' | |
142 | cpp='' | |
143 | csh='' | |
144 | date='' | |
145 | echo='' | |
146 | egrep='' | |
147 | emacs='' | |
148 | expr='' | |
149 | find='' | |
150 | flex='' | |
151 | gcc='' | |
152 | grep='' | |
8ff267be | 153 | gzip='' |
2304df62 AD |
154 | inews='' |
155 | ksh='' | |
156 | less='' | |
157 | line='' | |
158 | lint='' | |
159 | ln='' | |
160 | lp='' | |
161 | lpr='' | |
162 | ls='' | |
163 | mail='' | |
164 | mailx='' | |
2304df62 AD |
165 | mkdir='' |
166 | more='' | |
167 | mv='' | |
168 | nroff='' | |
169 | perl='' | |
170 | pg='' | |
171 | pmake='' | |
172 | pr='' | |
173 | rm='' | |
174 | rmail='' | |
175 | sed='' | |
176 | sendmail='' | |
2304df62 AD |
177 | shar='' |
178 | sleep='' | |
179 | smail='' | |
180 | sort='' | |
181 | submit='' | |
182 | tail='' | |
183 | tar='' | |
184 | tbl='' | |
185 | test='' | |
186 | touch='' | |
187 | tr='' | |
188 | troff='' | |
189 | uname='' | |
190 | uniq='' | |
191 | uuname='' | |
192 | vi='' | |
193 | zcat='' | |
8ff267be | 194 | zip='' |
1aef975c | 195 | full_sed='' |
a0d0e21e | 196 | libswanted='' |
2304df62 AD |
197 | hint='' |
198 | myuname='' | |
85e6fe83 LW |
199 | osname='' |
200 | osvers='' | |
2304df62 AD |
201 | Author='' |
202 | Date='' | |
203 | Header='' | |
204 | Id='' | |
205 | Locker='' | |
206 | Log='' | |
207 | RCSfile='' | |
208 | Revision='' | |
209 | Source='' | |
210 | State='' | |
4633a7c4 LW |
211 | ar='' |
212 | archobjs='' | |
213 | exe_ext='' | |
214 | firstmakefile='' | |
215 | lib_ext='' | |
216 | obj_ext='' | |
217 | path_sep='' | |
2304df62 | 218 | afs='' |
a0d0e21e LW |
219 | alignbytes='' |
220 | archlib='' | |
221 | archlibexp='' | |
a0d0e21e LW |
222 | d_archlib='' |
223 | installarchlib='' | |
40000a8c AD |
224 | archname='' |
225 | myarchname='' | |
ecfc5424 | 226 | baserev='' |
2304df62 AD |
227 | bin='' |
228 | binexp='' | |
229 | installbin='' | |
230 | byteorder='' | |
231 | cc='' | |
232 | gccversion='' | |
233 | ccflags='' | |
234 | cppflags='' | |
235 | ldflags='' | |
236 | lkflags='' | |
8e07c86e | 237 | locincpth='' |
2304df62 | 238 | optimize='' |
8e07c86e | 239 | cf_email='' |
2304df62 AD |
240 | cf_by='' |
241 | cf_time='' | |
242 | contains='' | |
a0d0e21e | 243 | cpp_stuff='' |
2304df62 AD |
244 | cpplast='' |
245 | cppminus='' | |
246 | cpprun='' | |
247 | cppstdin='' | |
248 | d_access='' | |
a0d0e21e | 249 | d_alarm='' |
ecfc5424 | 250 | d_attribut='' |
2304df62 AD |
251 | d_bcmp='' |
252 | d_bcopy='' | |
253 | d_bzero='' | |
254 | d_casti32='' | |
255 | castflags='' | |
256 | d_castneg='' | |
a0d0e21e LW |
257 | d_chown='' |
258 | d_chroot='' | |
2304df62 | 259 | d_chsize='' |
a0d0e21e LW |
260 | d_closedir='' |
261 | d_void_closedir='' | |
2304df62 AD |
262 | d_const='' |
263 | cryptlib='' | |
264 | d_crypt='' | |
265 | d_csh='' | |
1aef975c | 266 | full_csh='' |
a0d0e21e LW |
267 | d_cuserid='' |
268 | d_dbl_dig='' | |
269 | d_difftime='' | |
270 | d_dlerror='' | |
271 | d_dlopen='' | |
272 | d_dlsymun='' | |
2304df62 | 273 | d_dosuid='' |
a0d0e21e | 274 | d_suidsafe='' |
2304df62 AD |
275 | d_dup2='' |
276 | d_fchmod='' | |
277 | d_fchown='' | |
278 | d_fcntl='' | |
a0d0e21e LW |
279 | d_fd_macros='' |
280 | d_fd_set='' | |
281 | d_fds_bits='' | |
282 | d_fgetpos='' | |
2304df62 AD |
283 | d_flexfnam='' |
284 | d_flock='' | |
a0d0e21e LW |
285 | d_fork='' |
286 | d_fsetpos='' | |
287 | d_Gconvert='' | |
2304df62 AD |
288 | d_getgrps='' |
289 | d_gethent='' | |
290 | aphostname='' | |
291 | d_gethname='' | |
292 | d_phostname='' | |
293 | d_uname='' | |
a0d0e21e | 294 | d_getlogin='' |
2afac517 | 295 | d_getpgid='' |
2304df62 | 296 | d_getpgrp2='' |
2afac517 | 297 | d_bsdgetpgrp='' |
2304df62 | 298 | d_getpgrp='' |
a0d0e21e | 299 | d_getppid='' |
2304df62 | 300 | d_getprior='' |
a4f3eea9 | 301 | d_gnulibc='' |
2304df62 AD |
302 | d_htonl='' |
303 | d_isascii='' | |
304 | d_killpg='' | |
305 | d_link='' | |
a0d0e21e LW |
306 | d_locconv='' |
307 | d_lockf='' | |
2304df62 | 308 | d_lstat='' |
a0d0e21e LW |
309 | d_mblen='' |
310 | d_mbstowcs='' | |
311 | d_mbtowc='' | |
2304df62 AD |
312 | d_memcmp='' |
313 | d_memcpy='' | |
314 | d_memmove='' | |
315 | d_memset='' | |
316 | d_mkdir='' | |
a0d0e21e LW |
317 | d_mkfifo='' |
318 | d_mktime='' | |
2304df62 AD |
319 | d_msg='' |
320 | d_msgctl='' | |
321 | d_msgget='' | |
322 | d_msgrcv='' | |
323 | d_msgsnd='' | |
a0d0e21e | 324 | d_nice='' |
2304df62 | 325 | d_open3='' |
a0d0e21e LW |
326 | d_fpathconf='' |
327 | d_pathconf='' | |
328 | d_pause='' | |
329 | d_pipe='' | |
8e07c86e | 330 | d_poll='' |
2304df62 AD |
331 | d_portable='' |
332 | d_readdir='' | |
85e6fe83 LW |
333 | d_rewinddir='' |
334 | d_seekdir='' | |
335 | d_telldir='' | |
a0d0e21e | 336 | d_readlink='' |
2304df62 AD |
337 | d_rename='' |
338 | d_rmdir='' | |
339 | d_safebcpy='' | |
340 | d_safemcpy='' | |
36477c24 | 341 | d_sanemcmp='' |
2304df62 AD |
342 | d_select='' |
343 | d_sem='' | |
344 | d_semctl='' | |
345 | d_semget='' | |
346 | d_semop='' | |
347 | d_setegid='' | |
348 | d_seteuid='' | |
a0d0e21e | 349 | d_setlinebuf='' |
2304df62 AD |
350 | d_setlocale='' |
351 | d_setpgid='' | |
352 | d_setpgrp2='' | |
353 | d_bsdpgrp='' | |
2afac517 | 354 | d_bsdsetpgrp='' |
2304df62 AD |
355 | d_setpgrp='' |
356 | d_setprior='' | |
357 | d_setregid='' | |
358 | d_setresgid='' | |
359 | d_setresuid='' | |
360 | d_setreuid='' | |
361 | d_setrgid='' | |
362 | d_setruid='' | |
363 | d_setsid='' | |
760ac839 | 364 | d_sfio='' |
8ff267be | 365 | usesfio='' |
2304df62 AD |
366 | d_shm='' |
367 | d_shmat='' | |
a0d0e21e LW |
368 | d_shmatprototype='' |
369 | shmattype='' | |
2304df62 AD |
370 | d_shmctl='' |
371 | d_shmdt='' | |
372 | d_shmget='' | |
2c7991dc | 373 | d_sigaction='' |
8ff267be | 374 | d_sigsetjmp='' |
2304df62 AD |
375 | d_oldsock='' |
376 | d_socket='' | |
377 | d_sockpair='' | |
378 | sockethdr='' | |
379 | socketlib='' | |
380 | d_statblks='' | |
c2960299 AD |
381 | d_stdio_cnt_lval='' |
382 | d_stdio_ptr_lval='' | |
16d20bd9 | 383 | d_stdiobase='' |
2304df62 | 384 | d_stdstdio='' |
16d20bd9 AD |
385 | stdio_base='' |
386 | stdio_bufsiz='' | |
387 | stdio_cnt='' | |
8ff267be | 388 | stdio_filbuf='' |
16d20bd9 | 389 | stdio_ptr='' |
2304df62 AD |
390 | d_index='' |
391 | d_strchr='' | |
a0d0e21e | 392 | d_strcoll='' |
2304df62 AD |
393 | d_strctcpy='' |
394 | d_strerrm='' | |
395 | d_strerror='' | |
396 | d_sysernlst='' | |
397 | d_syserrlst='' | |
a89d8a78 DH |
398 | d_strtod='' |
399 | d_strtol='' | |
400 | d_strtoul='' | |
a0d0e21e | 401 | d_strxfrm='' |
2304df62 AD |
402 | d_symlink='' |
403 | d_syscall='' | |
a0d0e21e | 404 | d_sysconf='' |
2304df62 | 405 | d_system='' |
a0d0e21e LW |
406 | d_tcgetpgrp='' |
407 | d_tcsetpgrp='' | |
85e6fe83 LW |
408 | d_time='' |
409 | timetype='' | |
2304df62 AD |
410 | clocktype='' |
411 | d_times='' | |
412 | d_truncate='' | |
a0d0e21e LW |
413 | d_tzname='' |
414 | d_umask='' | |
2304df62 | 415 | d_vfork='' |
a0d0e21e | 416 | usevfork='' |
2304df62 AD |
417 | d_voidsig='' |
418 | signal_t='' | |
419 | d_volatile='' | |
420 | d_charvspr='' | |
421 | d_vprintf='' | |
422 | d_wait4='' | |
423 | d_waitpid='' | |
a0d0e21e LW |
424 | d_wcstombs='' |
425 | d_wctomb='' | |
426 | dlext='' | |
85e6fe83 LW |
427 | cccdlflags='' |
428 | ccdlflags='' | |
2304df62 | 429 | dlsrc='' |
232e078e | 430 | ld='' |
85e6fe83 | 431 | lddlflags='' |
2304df62 | 432 | usedl='' |
a0d0e21e | 433 | fpostype='' |
2304df62 AD |
434 | gidtype='' |
435 | groupstype='' | |
436 | h_fcntl='' | |
437 | h_sysfile='' | |
ecfc5424 AD |
438 | db_hashtype='' |
439 | db_prefixtype='' | |
a0d0e21e | 440 | i_db='' |
2304df62 | 441 | i_dbm='' |
8e07c86e | 442 | i_rpcsvcdbm='' |
2304df62 | 443 | d_dirnamlen='' |
a0d0e21e | 444 | direntrytype='' |
2304df62 | 445 | i_dirent='' |
a0d0e21e | 446 | i_dld='' |
2304df62 AD |
447 | i_dlfcn='' |
448 | i_fcntl='' | |
a0d0e21e | 449 | i_float='' |
2304df62 AD |
450 | i_gdbm='' |
451 | i_grp='' | |
a0d0e21e | 452 | i_limits='' |
4633a7c4 | 453 | i_locale='' |
a0d0e21e LW |
454 | i_malloc='' |
455 | i_math='' | |
85e6fe83 | 456 | i_memory='' |
2304df62 | 457 | i_ndbm='' |
85e6fe83 | 458 | i_neterrno='' |
2304df62 AD |
459 | i_niin='' |
460 | i_sysin='' | |
461 | d_pwage='' | |
462 | d_pwchange='' | |
463 | d_pwclass='' | |
464 | d_pwcomment='' | |
465 | d_pwexpire='' | |
466 | d_pwquota='' | |
467 | i_pwd='' | |
760ac839 | 468 | i_sfio='' |
2304df62 | 469 | i_stddef='' |
a0d0e21e | 470 | i_stdlib='' |
2304df62 AD |
471 | i_string='' |
472 | strings='' | |
473 | i_sysdir='' | |
474 | i_sysfile='' | |
475 | d_voidtty='' | |
476 | i_bsdioctl='' | |
a0d0e21e | 477 | i_sysfilio='' |
2304df62 AD |
478 | i_sysioctl='' |
479 | i_syssockio='' | |
480 | i_sysndir='' | |
a0d0e21e | 481 | i_sysparam='' |
8ff267be | 482 | i_sysresrc='' |
2304df62 | 483 | i_sysselct='' |
1aef975c | 484 | i_sysstat='' |
a0d0e21e | 485 | i_systimes='' |
fed7345c | 486 | i_systypes='' |
25f94b33 | 487 | i_sysun='' |
8ff267be | 488 | i_syswait='' |
2304df62 AD |
489 | i_sgtty='' |
490 | i_termio='' | |
491 | i_termios='' | |
492 | i_systime='' | |
493 | i_systimek='' | |
494 | i_time='' | |
495 | timeincl='' | |
85e6fe83 | 496 | i_unistd='' |
2304df62 | 497 | i_utime='' |
760ac839 | 498 | i_values='' |
a0d0e21e | 499 | i_stdarg='' |
2304df62 AD |
500 | i_varargs='' |
501 | i_varhdr='' | |
502 | i_vfork='' | |
503 | intsize='' | |
2304df62 | 504 | libc='' |
8ff267be | 505 | libperl='' |
2afac517 | 506 | shrpenv='' |
8ff267be | 507 | useshrplib='' |
a0d0e21e | 508 | glibpth='' |
2304df62 | 509 | libpth='' |
8e07c86e | 510 | loclibpth='' |
2304df62 AD |
511 | plibpth='' |
512 | xlibpth='' | |
513 | libs='' | |
85e6fe83 LW |
514 | lns='' |
515 | lseektype='' | |
8ff267be | 516 | make='' |
517 | make_set_make='' | |
85e6fe83 | 518 | d_mymalloc='' |
94b6baf5 | 519 | freetype='' |
2304df62 AD |
520 | mallocobj='' |
521 | mallocsrc='' | |
522 | malloctype='' | |
523 | usemymalloc='' | |
16d20bd9 AD |
524 | installman1dir='' |
525 | man1dir='' | |
526 | man1direxp='' | |
527 | man1ext='' | |
528 | installman3dir='' | |
529 | man3dir='' | |
530 | man3direxp='' | |
531 | man3ext='' | |
2304df62 AD |
532 | huge='' |
533 | large='' | |
534 | medium='' | |
535 | models='' | |
536 | small='' | |
537 | split='' | |
a0d0e21e | 538 | modetype='' |
2304df62 AD |
539 | mydomain='' |
540 | myhostname='' | |
541 | phostname='' | |
542 | c='' | |
543 | n='' | |
8e07c86e AD |
544 | d_eofnblk='' |
545 | eagain='' | |
546 | o_nonblock='' | |
547 | rd_nodata='' | |
2304df62 AD |
548 | groupcat='' |
549 | hostcat='' | |
550 | passcat='' | |
4633a7c4 LW |
551 | d_oldarchlib='' |
552 | oldarchlib='' | |
553 | oldarchlibexp='' | |
85e6fe83 LW |
554 | orderlib='' |
555 | ranlib='' | |
2304df62 AD |
556 | package='' |
557 | spackage='' | |
2c7991dc | 558 | pager='' |
ecfc5424 | 559 | patchlevel='' |
760ac839 | 560 | subversion='' |
8e07c86e | 561 | perladmin='' |
4633a7c4 | 562 | perlpath='' |
a0d0e21e | 563 | prefix='' |
1aef975c | 564 | prefixexp='' |
2304df62 AD |
565 | installprivlib='' |
566 | privlib='' | |
567 | privlibexp='' | |
568 | prototype='' | |
569 | randbits='' | |
570 | installscript='' | |
571 | scriptdir='' | |
572 | scriptdirexp='' | |
a0d0e21e | 573 | selecttype='' |
8ff267be | 574 | sh='' |
2304df62 | 575 | sig_name='' |
8e07c86e | 576 | sig_num='' |
4633a7c4 LW |
577 | installsitearch='' |
578 | sitearch='' | |
579 | sitearchexp='' | |
25f94b33 AD |
580 | installsitelib='' |
581 | sitelib='' | |
582 | sitelibexp='' | |
a0d0e21e LW |
583 | sizetype='' |
584 | so='' | |
2304df62 AD |
585 | sharpbang='' |
586 | shsharp='' | |
587 | spitshell='' | |
a0d0e21e | 588 | ssizetype='' |
4633a7c4 | 589 | startperl='' |
2304df62 AD |
590 | startsh='' |
591 | stdchar='' | |
592 | sysman='' | |
593 | uidtype='' | |
594 | nm_opt='' | |
40a7a20a | 595 | nm_so_opt='' |
2304df62 AD |
596 | runnm='' |
597 | usenm='' | |
8ff267be | 598 | useperlio='' |
2304df62 AD |
599 | incpath='' |
600 | mips='' | |
601 | mips_type='' | |
602 | usrinc='' | |
603 | defvoidused='' | |
604 | voidflags='' | |
2304df62 AD |
605 | CONFIG='' |
606 | ||
ecfc5424 AD |
607 | define='define' |
608 | undef='undef' | |
609 | smallmach='pdp11 i8086 z8000 i80286 iAPX286' | |
610 | rmlist='' | |
611 | ||
612 | : We must find out about Eunice early | |
613 | eunicefix=':' | |
614 | if test -f /etc/unixtovms; then | |
615 | eunicefix=/etc/unixtovms | |
616 | fi | |
617 | if test -f /etc/unixtovms.exe; then | |
618 | eunicefix=/etc/unixtovms.exe | |
619 | fi | |
620 | ||
621 | : list of known cpp symbols, sorted alphabetically | |
622 | al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2" | |
623 | al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH" | |
624 | al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS" | |
625 | al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM" | |
626 | al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX" | |
627 | al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX" | |
628 | al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4" | |
629 | al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300" | |
630 | al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek" | |
631 | al="$al VMS Xenix286" | |
632 | al="$al _AIX _AIX32 _AIX370 _AM29000 _COFF _CRAY _CX_UX _EPI" | |
633 | al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET" | |
634 | al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3" | |
635 | al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000" | |
636 | al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4" | |
637 | al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS" | |
638 | al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__" | |
639 | al="$al __DGUX__ __DPX2__ __H3050R __H3050RX" | |
640 | al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__" | |
641 | al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__" | |
642 | al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__" | |
643 | al="$al __SVR4_2__ __UMAXV__" | |
644 | al="$al ____386BSD____ __alpha __alpha__ __amiga" | |
645 | al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__" | |
646 | al="$al __host_mips__" | |
647 | al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500" | |
648 | al="$al __hp9000s500 __hp9000s700 __hp9000s800" | |
649 | al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__" | |
650 | al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__" | |
651 | al="$al __m68k __m68k__ __m88100__ __m88k __m88k__" | |
652 | al="$al __mc68000 __mc68000__ __mc68020 __mc68020__" | |
653 | al="$al __mc68030 __mc68030__ __mc68040 __mc68040__" | |
654 | al="$al __mc88100 __mc88100__ __mips __mips__" | |
655 | al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__" | |
656 | al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__" | |
657 | al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__" | |
658 | al="$al _host_mips _mips _unix" | |
659 | al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent" | |
660 | al="$al apollo ardent att386 att3b" | |
661 | al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull" | |
662 | al="$al cadmus clipper concurrent convex cray ctix" | |
663 | al="$al dmert encore gcos gcx gimpel gould" | |
664 | al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800" | |
665 | al="$al hp9000 hp9000s300 hp9000s400 hp9000s500" | |
666 | al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux" | |
667 | al="$al i186 i286 i386 i486 i8086" | |
668 | al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k" | |
669 | al="$al ksr1 linux luna luna88k m68k m88100 m88k" | |
670 | al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030" | |
671 | al="$al mc68040 mc68060 mc68k mc68k32 mc700" | |
672 | al="$al mc88000 mc88100 merlin mert mips mvs n16" | |
673 | al="$al ncl_el ncl_mr" | |
674 | al="$al news1500 news1700 news1800 news1900 news3700" | |
675 | al="$al news700 news800 news900 ns16000 ns32000" | |
676 | al="$al ns32016 ns32332 ns32k nsc32000 os osf" | |
677 | al="$al parisc pc532 pdp11 plexus posix pyr" | |
678 | al="$al riscix riscos scs sequent sgi sinix sony sony_news" | |
679 | al="$al sonyrisc sparc sparclite spectrum stardent stratos" | |
680 | al="$al sun sun3 sun386 svr4 sysV68 sysV88" | |
681 | al="$al titan tower tower32 tower32_200 tower32_600 tower32_700" | |
682 | al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200" | |
683 | al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms" | |
684 | al="$al xenix z8000" | |
685 | ||
ecfc5424 AD |
686 | groupstype='' |
687 | i_whoami='' | |
8e07c86e AD |
688 | : default library list |
689 | libswanted='' | |
690 | : set useposix=false in your hint file to disable the POSIX extension. | |
691 | useposix=true | |
8ff267be | 692 | : set useopcode=false in your hint file to disable the Opcode extension. |
693 | useopcode=true | |
40a7a20a | 694 | : Define several unixisms. These can be used in hint files. |
25f94b33 AD |
695 | exe_ext='' |
696 | : Extra object files, if any, needed on this platform. | |
697 | archobjs='' | |
8e07c86e | 698 | : Possible local include directories to search. |
25f94b33 | 699 | : Set locincpth to "" in a hint file to defeat local include searches. |
8e07c86e AD |
700 | locincpth="/usr/local/include /opt/local/include /usr/gnu/include" |
701 | locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include" | |
702 | : | |
703 | : no include file wanted by default | |
704 | inclwanted='' | |
705 | ||
ecfc5424 AD |
706 | : change the next line if compiling for Xenix/286 on Xenix/386 |
707 | xlibpth='/usr/lib/386 /lib/386' | |
708 | ||
8e07c86e AD |
709 | : Possible local library directories to search. |
710 | loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib" | |
711 | loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib" | |
712 | ||
ecfc5424 | 713 | : general looking path for locating libraries |
4b40f7a3 SV |
714 | glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large" |
715 | glibpth="$glibpth /lib /usr/lib $xlibpth" | |
716 | glibpth="$glibpth /lib/large /usr/lib/small /lib/small" | |
717 | glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib" | |
ecfc5424 AD |
718 | |
719 | : Private path used by Configure to find libraries. Its value | |
720 | : is prepended to libpth. This variable takes care of special | |
721 | : machines, like the mips. Usually, it should be empty. | |
722 | plibpth='' | |
723 | ||
ecfc5424 AD |
724 | : full support for void wanted by default |
725 | defvoidused=15 | |
726 | ||
ecfc5424 | 727 | : List of libraries we want. |
760ac839 | 728 | libswanted='sfio net socket inet nsl nm ndbm gdbm dbm db malloc dl' |
ecfc5424 AD |
729 | libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt" |
730 | libswanted="$libswanted ucb bsd BSD PW x" | |
1aef975c | 731 | : We probably want to search /usr/shlib before most other libraries. |
94b6baf5 | 732 | : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist. |
ecfc5424 AD |
733 | glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'` |
734 | glibpth="/usr/shlib $glibpth" | |
735 | : Do not use vfork unless overridden by a hint file. | |
736 | usevfork=false | |
737 | ||
8ff267be | 738 | : Find the basic shell for Bourne shell scripts |
739 | case "$sh" in | |
740 | '') | |
741 | : SYSTYPE is for some older MIPS systems. | |
742 | : I do not know if it is still needed. | |
743 | case "$SYSTYPE" in | |
744 | *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";; | |
745 | *) xxx='/bin/sh';; | |
746 | esac | |
747 | if test -f "$xxx"; then | |
748 | sh="$xxx" | |
749 | else | |
750 | : Build up a list and do a single loop so we can 'break' out. | |
751 | pth=`echo $PATH | sed -e "s/$p_/ /g"` | |
752 | for xxx in sh bash ksh pdksh ash; do | |
753 | for p in $pth; do | |
754 | try="$try ${p}/${xxx}" | |
755 | done | |
756 | done | |
757 | for xxx in $try; do | |
758 | if test -f "$xxx"; then | |
759 | sh="$xxx"; | |
760 | echo "Your Bourne shell appears to be in $sh." | |
761 | break | |
762 | elif test -f "$xxx.exe"; then | |
763 | sh="$xxx"; | |
764 | echo "Hmm. Your Bourne shell appears to be in $sh." | |
765 | break | |
766 | fi | |
767 | done | |
768 | fi | |
769 | ;; | |
770 | esac | |
771 | ||
772 | case "$sh" in | |
773 | '') cat <<EOM >&2 | |
774 | $me: Fatal Error: I can't find a Bourne Shell anywhere. | |
775 | Usually it's in /bin/sh. How did you even get this far? | |
776 | Please contact me (Andy Dougherty) at doughera@lafcol.lafayette.edu and | |
777 | we'll try to straigten this all out. | |
778 | EOM | |
779 | exit 1 | |
780 | ;; | |
781 | esac | |
782 | ||
760ac839 | 783 | : see if sh knows # comments |
8ff267be | 784 | if `$sh -c '#' >/dev/null 2>&1`; then |
760ac839 LW |
785 | shsharp=true |
786 | spitshell=cat | |
787 | echo " " | |
760ac839 LW |
788 | xcat=/bin/cat |
789 | test -f $xcat || xcat=/usr/bin/cat | |
790 | echo "#!$xcat" >try | |
791 | $eunicefix try | |
792 | chmod +x try | |
793 | ./try > today | |
794 | if test -s today; then | |
760ac839 LW |
795 | sharpbang='#!' |
796 | else | |
797 | echo "#! $xcat" > try | |
798 | $eunicefix try | |
799 | chmod +x try | |
800 | ./try > today | |
801 | if test -s today; then | |
760ac839 LW |
802 | sharpbang='#! ' |
803 | else | |
8ff267be | 804 | echo "Okay, let's see if #! works on this system..." |
760ac839 LW |
805 | echo "It's just a comment." |
806 | sharpbang=': use ' | |
807 | fi | |
808 | fi | |
809 | else | |
8ff267be | 810 | echo "Your $sh doesn't grok # comments--I will strip them later on." |
760ac839 LW |
811 | shsharp=false |
812 | cd .. | |
813 | echo "exec grep -v '^[ ]*#'" >spitshell | |
814 | chmod +x spitshell | |
815 | $eunicefix spitshell | |
816 | spitshell=`pwd`/spitshell | |
817 | cd UU | |
818 | echo "I presume that if # doesn't work, #! won't work either!" | |
819 | sharpbang=': use ' | |
820 | fi | |
821 | rm -f try today | |
822 | ||
823 | : figure out how to guarantee sh startup | |
8ff267be | 824 | case "$startsh" in |
825 | '') startsh=${sharpbang}${sh} ;; | |
826 | *) | |
760ac839 | 827 | esac |
760ac839 LW |
828 | cat >try <<EOSS |
829 | $startsh | |
830 | set abc | |
831 | test "$?abc" != 1 | |
832 | EOSS | |
833 | ||
834 | chmod +x try | |
835 | $eunicefix try | |
836 | if ./try; then | |
8ff267be | 837 | : echo "Yup, it does." |
760ac839 | 838 | else |
8ff267be | 839 | echo "Hmm. '$startsh' didn't work." |
840 | echo "You may have to fix up the shell scripts to make sure sh runs them." | |
760ac839 LW |
841 | fi |
842 | rm -f try | |
843 | ||
2304df62 | 844 | : script used to extract .SH files with variable substitutions |
760ac839 LW |
845 | cat >extract <<EOS |
846 | $startsh | |
847 | EOS | |
848 | cat >>extract <<'EOS' | |
2304df62 AD |
849 | CONFIG=true |
850 | echo "Doing variable substitutions on .SH files..." | |
851 | if test -f MANIFEST; then | |
ff68c719 | 852 | shlist=`awk '!/^old_/ {print $1}' <MANIFEST | grep '\.SH$'` |
a0d0e21e LW |
853 | : Pick up possible extension manifests. |
854 | for dir in ext/* ; do | |
855 | if test -f $dir/MANIFEST; then | |
ff68c719 | 856 | xxx=`awk '!/^old_/ {print $1}' < $dir/MANIFEST | |
a0d0e21e LW |
857 | sed -n "/\.SH$/ s@^@$dir/@p"` |
858 | shlist="$shlist $xxx" | |
859 | fi | |
860 | done | |
861 | set x $shlist | |
2304df62 AD |
862 | else |
863 | echo "(Looking for .SH files under the current directory.)" | |
ff68c719 | 864 | set x `find . -name "*.SH" -print | grep -v '/old_'` |
2304df62 AD |
865 | fi |
866 | shift | |
867 | case $# in | |
868 | 0) set x *.SH; shift;; | |
869 | esac | |
870 | if test ! -f $1; then | |
871 | shift | |
872 | fi | |
873 | for file in $*; do | |
874 | case "$file" in | |
875 | */*) | |
876 | dir=`expr X$file : 'X\(.*\)/'` | |
877 | file=`expr X$file : 'X.*/\(.*\)'` | |
878 | (cd $dir && . ./$file) | |
879 | ;; | |
880 | *) | |
881 | . ./$file | |
882 | ;; | |
883 | esac | |
884 | done | |
885 | if test -f config_h.SH; then | |
886 | if test ! -f config.h; then | |
887 | : oops, they left it out of MANIFEST, probably, so do it anyway. | |
888 | . ./config_h.SH | |
889 | fi | |
890 | fi | |
891 | EOS | |
892 | ||
893 | : produce awk script to parse command line options | |
894 | cat >options.awk <<'EOF' | |
895 | BEGIN { | |
16d20bd9 | 896 | optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification |
2304df62 AD |
897 | |
898 | len = length(optstr); | |
899 | for (i = 1; i <= len; i++) { | |
900 | c = substr(optstr, i, 1); | |
901 | if (i < len) a = substr(optstr, i + 1, 1); else a = ""; | |
902 | if (a == ":") { | |
903 | arg[c] = 1; | |
904 | i++; | |
905 | } | |
906 | opt[c] = 1; | |
907 | } | |
908 | } | |
909 | { | |
910 | expect = 0; | |
911 | str = $0; | |
912 | if (substr(str, 1, 1) != "-") { | |
913 | printf("'%s'\n", str); | |
914 | next; | |
915 | } | |
916 | len = length($0); | |
917 | for (i = 2; i <= len; i++) { | |
918 | c = substr(str, i, 1); | |
919 | if (!opt[c]) { | |
920 | printf("-%s\n", substr(str, i)); | |
921 | next; | |
922 | } | |
923 | printf("-%s\n", c); | |
924 | if (arg[c]) { | |
925 | if (i < len) | |
926 | printf("'%s'\n", substr(str, i + 1)); | |
927 | else | |
928 | expect = 1; | |
929 | next; | |
930 | } | |
931 | } | |
932 | } | |
933 | END { | |
934 | if (expect) | |
935 | print "?"; | |
936 | } | |
937 | EOF | |
938 | ||
939 | : process the command line options | |
4633a7c4 LW |
940 | set X `for arg in "$@"; do echo "X$arg"; done | |
941 | sed -e s/X// | awk -f options.awk` | |
2304df62 AD |
942 | eval "set $*" |
943 | shift | |
944 | rm -f options.awk | |
945 | ||
946 | : set up default values | |
947 | fastread='' | |
948 | reuseval=false | |
949 | config_sh='' | |
950 | alldone='' | |
951 | error='' | |
952 | silent='' | |
953 | extractsh='' | |
ecfc5424 | 954 | override='' |
16d20bd9 | 955 | knowitall='' |
1aef975c | 956 | rm -f optdef.sh |
2304df62 AD |
957 | |
958 | : option parsing | |
959 | while test $# -gt 0; do | |
960 | case "$1" in | |
961 | -d) shift; fastread=yes;; | |
962 | -e) shift; alldone=cont;; | |
963 | -f) | |
964 | shift | |
965 | cd .. | |
966 | if test -r "$1"; then | |
967 | config_sh="$1" | |
968 | else | |
a0d0e21e | 969 | echo "$me: cannot read config file $1." >&2 |
2304df62 AD |
970 | error=true |
971 | fi | |
972 | cd UU | |
973 | shift;; | |
974 | -h) shift; error=true;; | |
975 | -r) shift; reuseval=true;; | |
976 | -s) shift; silent=true;; | |
977 | -E) shift; alldone=exit;; | |
16d20bd9 | 978 | -K) shift; knowitall=true;; |
ecfc5424 | 979 | -O) shift; override=true;; |
2304df62 | 980 | -S) shift; extractsh=true;; |
a0d0e21e LW |
981 | -D) |
982 | shift | |
983 | case "$1" in | |
984 | *=) | |
985 | echo "$me: use '-U symbol=', not '-D symbol='." >&2 | |
986 | echo "$me: ignoring -D $1" >&2 | |
987 | ;; | |
ecfc5424 | 988 | *=*) echo "$1" | \ |
1aef975c AD |
989 | sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;; |
990 | *) echo "$1='define'" >> optdef.sh;; | |
a0d0e21e LW |
991 | esac |
992 | shift | |
993 | ;; | |
994 | -U) | |
995 | shift | |
996 | case "$1" in | |
1aef975c | 997 | *=) echo "$1" >> optdef.sh;; |
a0d0e21e LW |
998 | *=*) |
999 | echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2 | |
1000 | echo "$me: ignoring -U $1" >&2 | |
1001 | ;; | |
1aef975c | 1002 | *) echo "$1='undef'" >> optdef.sh;; |
a0d0e21e LW |
1003 | esac |
1004 | shift | |
1005 | ;; | |
2c7991dc | 1006 | -V) echo "$me generated by metaconfig 3.0 PL60." >&2 |
2304df62 AD |
1007 | exit 0;; |
1008 | --) break;; | |
a0d0e21e | 1009 | -*) echo "$me: unknown option $1" >&2; shift; error=true;; |
2304df62 AD |
1010 | *) break;; |
1011 | esac | |
1012 | done | |
1013 | ||
1014 | case "$error" in | |
1015 | true) | |
1016 | cat >&2 <<EOM | |
2afac517 | 1017 | Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value] |
a0d0e21e | 1018 | [-U symbol] [-U symbol=] |
2304df62 AD |
1019 | -d : use defaults for all answers. |
1020 | -e : go on without questioning past the production of config.sh. | |
1021 | -f : specify an alternate default configuration file. | |
1022 | -h : print this help message and exit (with an error status). | |
1023 | -r : reuse C symbols value if possible (skips costly nm extraction). | |
1024 | -s : silent mode, only echoes questions and essential information. | |
a0d0e21e LW |
1025 | -D : define symbol to have some value: |
1026 | -D symbol symbol gets the value 'define' | |
1027 | -D symbol=value symbol gets the value 'value' | |
2304df62 | 1028 | -E : stop at the end of questions, after having produced config.sh. |
16d20bd9 | 1029 | -K : do not use unless you know what you are doing. |
ecfc5424 | 1030 | -O : let -D and -U override definitions from loaded configuration file. |
2304df62 | 1031 | -S : perform variable substitutions on all .SH files (can mix with -f) |
a0d0e21e LW |
1032 | -U : undefine symbol: |
1033 | -U symbol symbol gets the value 'undef' | |
1034 | -U symbol= symbol gets completely empty | |
2304df62 AD |
1035 | -V : print version number and exit (with a zero status). |
1036 | EOM | |
1037 | exit 1 | |
1038 | ;; | |
1039 | esac | |
1040 | ||
1041 | exec 4>&1 | |
1042 | case "$silent" in | |
1043 | true) exec 1>/dev/null;; | |
1044 | esac | |
1045 | ||
ecfc5424 | 1046 | : run the defines and the undefines, if any, but leave the file out there... |
1aef975c AD |
1047 | touch optdef.sh |
1048 | . ./optdef.sh | |
a0d0e21e | 1049 | |
2304df62 AD |
1050 | case "$extractsh" in |
1051 | true) | |
1052 | case "$config_sh" in | |
1053 | '') config_sh='config.sh'; config='./config.sh';; | |
1054 | /*) config="$config_sh";; | |
1055 | *) config="./$config_sh";; | |
1056 | esac | |
1057 | echo " " | |
1058 | echo "Fetching answers from $config_sh..." | |
1059 | cd .. | |
1060 | . $config | |
1aef975c | 1061 | test "$override" && . ./optdef.sh |
2304df62 AD |
1062 | echo " " |
1063 | . ./UU/extract | |
1064 | rm -rf UU | |
1065 | echo "Done." | |
1066 | exit 0 | |
1067 | ;; | |
1068 | esac | |
1069 | ||
1070 | : set package name | |
85e6fe83 | 1071 | package=perl5 |
1aef975c AD |
1072 | first=`echo $package | sed -e 's/^\(.\).*/\1/'` |
1073 | last=`echo $package | sed -e 's/^.\(.*\)/\1/'` | |
1074 | case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in | |
1075 | ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;; | |
1076 | *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;; | |
1077 | esac | |
2304df62 AD |
1078 | |
1079 | : Eunice requires " " instead of "", can you believe it | |
1080 | echo " " | |
1081 | : Here we go... | |
1082 | echo "Beginning of configuration questions for $package." | |
1083 | ||
1aef975c | 1084 | trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15 |
2304df62 | 1085 | |
2304df62 AD |
1086 | : Some greps do not return status, grrr. |
1087 | echo "grimblepritz" >grimble | |
1088 | if grep blurfldyick grimble >/dev/null 2>&1 ; then | |
1089 | contains=contains | |
1090 | elif grep grimblepritz grimble >/dev/null 2>&1 ; then | |
1091 | contains=grep | |
1092 | else | |
1093 | contains=contains | |
1094 | fi | |
1095 | rm -f grimble | |
1096 | : the following should work in any shell | |
1097 | case "$contains" in | |
1098 | contains*) | |
1099 | echo " " | |
1100 | echo "AGH! Grep doesn't return a status. Attempting remedial action." | |
1101 | cat >contains <<'EOSS' | |
1102 | grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp | |
1103 | EOSS | |
1104 | chmod +x contains | |
1105 | esac | |
1106 | ||
1107 | : first determine how to suppress newline on echo command | |
1108 | echo " " | |
1109 | echo "Checking echo to see how to suppress newlines..." | |
1110 | (echo "hi there\c" ; echo " ") >.echotmp | |
1111 | if $contains c .echotmp >/dev/null 2>&1 ; then | |
1112 | echo "...using -n." | |
1113 | n='-n' | |
1114 | c='' | |
1115 | else | |
1116 | cat <<'EOM' | |
1117 | ...using \c | |
1118 | EOM | |
1119 | n='' | |
1120 | c='\c' | |
1121 | fi | |
1122 | echo $n "The star should be here-->$c" | |
1123 | echo '*' | |
1124 | rm -f .echotmp | |
1125 | ||
1126 | : Now test for existence of everything in MANIFEST | |
1127 | echo " " | |
1128 | if test -f ../MANIFEST; then | |
1129 | echo "First let's make sure your kit is complete. Checking..." >&4 | |
1130 | awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50 | |
1131 | rm -f missing | |
1132 | for filelist in x??; do | |
1133 | (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing) | |
1134 | done | |
1135 | if test -s missing; then | |
1136 | cat missing >&4 | |
1137 | cat >&4 <<'EOM' | |
1138 | ||
1139 | THIS PACKAGE SEEMS TO BE INCOMPLETE. | |
1140 | ||
1141 | You have the option of continuing the configuration process, despite the | |
1142 | distinct possibility that your kit is damaged, by typing 'y'es. If you | |
1143 | do, don't blame me if something goes wrong. I advise you to type 'n'o | |
8ff267be | 1144 | and contact the author (doughera@lafcol.lafayette.edu). |
2304df62 AD |
1145 | |
1146 | EOM | |
1147 | echo $n "Continue? [n] $c" >&4 | |
1148 | read ans | |
1149 | case "$ans" in | |
1150 | y*) | |
1151 | echo "Continuing..." >&4 | |
1152 | rm -f missing | |
1153 | ;; | |
1154 | *) | |
1155 | echo "ABORTING..." >&4 | |
1156 | kill $$ | |
1157 | ;; | |
1158 | esac | |
1159 | else | |
1160 | echo "Looks good..." >&4 | |
1161 | fi | |
1162 | else | |
1163 | echo "There is no MANIFEST file. I hope your kit is complete !" | |
1164 | fi | |
1165 | rm -f missing x?? | |
1166 | ||
1167 | : compute the number of columns on the terminal for proper question formatting | |
1168 | case "$COLUMNS" in | |
1169 | '') COLUMNS='80';; | |
1170 | esac | |
1171 | ||
1172 | : set up the echo used in my read | |
1173 | myecho="case \"\$xxxm\" in | |
1174 | '') echo $n \"\$rp $c\" >&4;; | |
1175 | *) case \"\$rp\" in | |
1176 | '') echo $n \"[\$xxxm] $c\";; | |
1177 | *) | |
1178 | if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then | |
1179 | echo \"\$rp\" >&4 | |
1180 | echo $n \"[\$xxxm] $c\" >&4 | |
1181 | else | |
1182 | echo $n \"\$rp [\$xxxm] $c\" >&4 | |
1183 | fi | |
1184 | ;; | |
1185 | esac;; | |
1186 | esac" | |
1187 | ||
1188 | : now set up to do reads with possible shell escape and default assignment | |
1189 | cat <<EOSC >myread | |
1190 | xxxm=\$dflt | |
1191 | $myecho | |
1192 | ans='!' | |
1193 | case "\$fastread" in | |
1194 | yes) case "\$dflt" in | |
1195 | '') ;; | |
1196 | *) ans=''; | |
1197 | case "\$silent-\$rp" in | |
1198 | true-) ;; | |
1199 | *) echo " " >&4;; | |
1200 | esac;; | |
1201 | esac;; | |
1202 | *) case "\$silent" in | |
1203 | true) case "\$rp" in | |
1204 | '') ans='';; | |
1205 | esac;; | |
1206 | esac;; | |
1207 | esac | |
1208 | while expr "X\$ans" : "X!" >/dev/null; do | |
1209 | read answ | |
1210 | set x \$xxxm | |
1211 | shift | |
1212 | aok=''; eval "ans=\"\$answ\"" && aok=y | |
1213 | case "\$answ" in | |
1214 | "\$ans") | |
1215 | case "\$ans" in | |
ecfc5424 AD |
1216 | \\&*) |
1217 | set x \`expr "X\$ans" : "X&\(.*\)\$"\` | |
1218 | shift | |
1219 | case "\$1" in | |
1220 | -d) | |
1221 | fastread=yes | |
40a7a20a | 1222 | echo "(OK, I'll run with -d after this question.)" >&4 |
ecfc5424 AD |
1223 | ;; |
1224 | -*) | |
40a7a20a | 1225 | echo "*** Sorry, \$1 not supported yet." >&4 |
ecfc5424 AD |
1226 | ;; |
1227 | esac | |
1228 | $myecho | |
1229 | ans=! | |
1230 | ;; | |
2304df62 AD |
1231 | "!") |
1232 | sh 1>&4 | |
1233 | echo " " | |
1234 | $myecho | |
1235 | ;; | |
1236 | !*) | |
1237 | set x \`expr "X\$ans" : "X!\(.*\)\$"\` | |
1238 | shift | |
1239 | sh 1>&4 -c "\$*" | |
1240 | echo " " | |
1241 | $myecho | |
1242 | ;; | |
1243 | esac;; | |
1244 | *) | |
1245 | case "\$aok" in | |
1246 | y) | |
1247 | echo "*** Substitution done -- please confirm." | |
1248 | xxxm="\$ans" | |
1249 | ans=\`echo $n "\$ans$c" | tr '\012' ' '\` | |
1250 | xxxm="\$ans" | |
1251 | ans=! | |
1252 | ;; | |
1253 | *) | |
1254 | echo "*** Error -- try again." | |
1255 | ans=! | |
1256 | ;; | |
1257 | esac | |
1258 | $myecho | |
1259 | ;; | |
1260 | esac | |
1261 | case "\$ans\$xxxm\$nostick" in | |
1262 | '') | |
1263 | ans=! | |
1264 | $myecho | |
1265 | ;; | |
1266 | esac | |
1267 | done | |
1268 | case "\$ans" in | |
1269 | '') ans="\$xxxm";; | |
1270 | esac | |
1271 | EOSC | |
1272 | ||
1273 | : create .config dir to save info across Configure sessions | |
1274 | test -d ../.config || mkdir ../.config | |
1275 | cat >../.config/README <<EOF | |
1276 | This directory created by Configure to save information that should | |
1277 | persist across sessions. | |
1278 | ||
1279 | You may safely delete it if you wish. | |
1280 | EOF | |
1281 | ||
1282 | : general instructions | |
1283 | needman=true | |
1284 | firsttime=true | |
760ac839 LW |
1285 | user=`(logname) 2>/dev/null` |
1286 | case "$user" in "") | |
1287 | user=`whoami 2>&1` ;; | |
1288 | esac | |
2304df62 AD |
1289 | if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then |
1290 | firsttime=false | |
1291 | echo " " | |
1292 | rp='Would you like to see the instructions?' | |
1293 | dflt=n | |
1294 | . ./myread | |
1295 | case "$ans" in | |
1296 | [yY]*) ;; | |
1297 | *) needman=false;; | |
1298 | esac | |
1299 | fi | |
1300 | if $needman; then | |
1301 | cat <<EOH | |
1302 | ||
1303 | This installation shell script will examine your system and ask you questions | |
a0d0e21e | 1304 | to determine how the perl5 package should be installed. If you get |
2304df62 AD |
1305 | stuck on a question, you may use a ! shell escape to start a subshell or |
1306 | execute a command. Many of the questions will have default answers in square | |
1307 | brackets; typing carriage return will give you the default. | |
1308 | ||
1309 | On some of the questions which ask for file or directory names you are allowed | |
1310 | to use the ~name construct to specify the login directory belonging to "name", | |
1311 | even if you don't have a shell which knows about that. Questions where this is | |
1312 | allowed will be marked "(~name ok)". | |
1313 | ||
1314 | EOH | |
1315 | rp='' | |
1316 | dflt='Type carriage return to continue' | |
1317 | . ./myread | |
1318 | cat <<'EOH' | |
1319 | ||
1320 | The prompter used in this script allows you to use shell variables and | |
1321 | backticks in your answers. You may use $1, $2, etc... to refer to the words | |
1322 | in the default answer, as if the default line was a set of arguments given to a | |
1323 | script shell. This means you may also use $* to repeat the whole default line, | |
1324 | so you do not have to re-type everything to add something to the default. | |
1325 | ||
1326 | Everytime there is a substitution, you will have to confirm. If there is an | |
1327 | error (e.g. an unmatched backtick), the default answer will remain unchanged | |
1328 | and you will be prompted again. | |
1329 | ||
1330 | If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all | |
1331 | the questions and use the computed defaults (or the previous answers if there | |
1332 | was already a config.sh file). Type 'Configure -h' for a list of options. | |
ecfc5424 AD |
1333 | You may also start interactively and then answer '& -d' at any prompt to turn |
1334 | on the non-interactive behaviour for the remaining of the execution. | |
2304df62 AD |
1335 | |
1336 | EOH | |
1337 | . ./myread | |
1338 | cat <<EOH | |
1339 | ||
1340 | Much effort has been expended to ensure that this shell script will run on any | |
1341 | Unix system. If despite that it blows up on yours, your best bet is to edit | |
40000a8c AD |
1342 | Configure and run it again. If you can't run Configure for some reason, |
1343 | you'll have to generate a config.sh file by hand. Whatever problems you | |
8ff267be | 1344 | have, let me (doughera@lafcol.lafayette.edu) know how I blew it. |
2304df62 AD |
1345 | |
1346 | This installation script affects things in two ways: | |
1347 | ||
1348 | 1) it may do direct variable substitutions on some of the files included | |
1349 | in this kit. | |
1350 | 2) it builds a config.h file for inclusion in C programs. You may edit | |
1351 | any of these files as the need arises after running this script. | |
1352 | ||
1353 | If you make a mistake on a question, there is no easy way to back up to it | |
1354 | currently. The easiest thing to do is to edit config.sh and rerun all the SH | |
1355 | files. Configure will offer to let you do this before it runs the SH files. | |
1356 | ||
1357 | EOH | |
1358 | dflt='Type carriage return to continue' | |
1359 | . ./myread | |
1360 | case "$firsttime" in | |
1361 | true) echo $user >>../.config/instruct;; | |
1362 | esac | |
1363 | fi | |
1364 | ||
2304df62 AD |
1365 | : find out where common programs are |
1366 | echo " " | |
1367 | echo "Locating common programs..." >&4 | |
1368 | cat <<EOSC >loc | |
1369 | $startsh | |
1370 | case \$# in | |
1371 | 0) exit 1;; | |
1372 | esac | |
1373 | thing=\$1 | |
1374 | shift | |
1375 | dflt=\$1 | |
1376 | shift | |
1377 | for dir in \$*; do | |
1378 | case "\$thing" in | |
1379 | .) | |
1380 | if test -d \$dir/\$thing; then | |
1381 | echo \$dir | |
1382 | exit 0 | |
1383 | fi | |
1384 | ;; | |
1385 | *) | |
a0d0e21e | 1386 | for thisthing in \$dir/\$thing; do |
ecfc5424 | 1387 | : just loop through to pick last item |
a0d0e21e | 1388 | done |
25f94b33 | 1389 | if test -f \$thisthing; then |
a0d0e21e | 1390 | echo \$thisthing |
2304df62 AD |
1391 | exit 0 |
1392 | elif test -f \$dir/\$thing.exe; then | |
1393 | : on Eunice apparently | |
1394 | echo \$dir/\$thing | |
1395 | exit 0 | |
1396 | fi | |
1397 | ;; | |
1398 | esac | |
1399 | done | |
1400 | echo \$dflt | |
1401 | exit 1 | |
1402 | EOSC | |
1403 | chmod +x loc | |
1404 | $eunicefix loc | |
1405 | loclist=" | |
1406 | awk | |
1407 | cat | |
ecfc5424 | 1408 | comm |
2304df62 AD |
1409 | cp |
1410 | echo | |
1411 | expr | |
a0d0e21e | 1412 | find |
2304df62 | 1413 | grep |
a0d0e21e | 1414 | ls |
2304df62 | 1415 | mkdir |
2304df62 AD |
1416 | rm |
1417 | sed | |
1418 | sort | |
85e6fe83 | 1419 | touch |
2304df62 AD |
1420 | tr |
1421 | uniq | |
1422 | " | |
1423 | trylist=" | |
1424 | Mcc | |
2304df62 AD |
1425 | byacc |
1426 | cpp | |
1427 | csh | |
1428 | date | |
1429 | egrep | |
8ff267be | 1430 | gzip |
2c7991dc | 1431 | less |
2304df62 | 1432 | line |
8ff267be | 1433 | ln |
2c7991dc | 1434 | more |
2304df62 AD |
1435 | nroff |
1436 | perl | |
2c7991dc | 1437 | pg |
40a7a20a | 1438 | sendmail |
2304df62 AD |
1439 | test |
1440 | uname | |
8ff267be | 1441 | zip |
2304df62 | 1442 | " |
8e07c86e | 1443 | pth=`echo $PATH | sed -e "s/$p_/ /g"` |
2304df62 AD |
1444 | pth="$pth /lib /usr/lib" |
1445 | for file in $loclist; do | |
1446 | xxx=`./loc $file $file $pth` | |
1447 | eval $file=$xxx | |
1448 | eval _$file=$xxx | |
1449 | case "$xxx" in | |
1450 | /*) | |
1451 | echo $file is in $xxx. | |
1452 | ;; | |
8e07c86e AD |
1453 | ?:[\\/]*) |
1454 | echo $file is in $xxx. | |
1455 | ;; | |
2304df62 | 1456 | *) |
25f94b33 AD |
1457 | echo "I don't know where '$file' is, and my life depends on it." >&4 |
1458 | echo "Go find a public domain implementation or fix your PATH setting!" >&4 | |
4633a7c4 | 1459 | exit 1 |
2304df62 AD |
1460 | ;; |
1461 | esac | |
1462 | done | |
1463 | echo " " | |
1464 | echo "Don't worry if any of the following aren't found..." | |
1465 | say=offhand | |
1466 | for file in $trylist; do | |
1467 | xxx=`./loc $file $file $pth` | |
1468 | eval $file=$xxx | |
1469 | eval _$file=$xxx | |
1470 | case "$xxx" in | |
1471 | /*) | |
1472 | echo $file is in $xxx. | |
1473 | ;; | |
8e07c86e AD |
1474 | ?:[\\/]*) |
1475 | echo $file is in $xxx. | |
1476 | ;; | |
2304df62 AD |
1477 | *) |
1478 | echo "I don't see $file out there, $say." | |
1479 | say=either | |
1480 | ;; | |
1481 | esac | |
1482 | done | |
1483 | case "$egrep" in | |
1484 | egrep) | |
1485 | echo "Substituting grep for egrep." | |
1486 | egrep=$grep | |
1487 | ;; | |
1488 | esac | |
8ff267be | 1489 | case "$ln" in |
1490 | ln) | |
1491 | echo "Substituting cp for ln." | |
1492 | ln=$cp | |
1493 | ;; | |
1494 | esac | |
2304df62 AD |
1495 | case "$test" in |
1496 | test) | |
1497 | echo "Hopefully test is built into your sh." | |
1498 | ;; | |
1499 | *) | |
ecfc5424 | 1500 | if `sh -c "PATH= test true" >/dev/null 2>&1`; then |
2304df62 AD |
1501 | echo "Using the test built into your sh." |
1502 | test=test | |
1503 | _test=test | |
1504 | fi | |
1505 | ;; | |
1506 | esac | |
1507 | case "$echo" in | |
1508 | echo) | |
1509 | echo "Hopefully echo is built into your sh." | |
1510 | ;; | |
1511 | '') ;; | |
1512 | *) | |
1513 | echo " " | |
1514 | echo "Checking compatibility between $echo and builtin echo (if any)..." >&4 | |
1515 | $echo $n "hi there$c" >foo1 | |
1516 | echo $n "hi there$c" >foo2 | |
1517 | if cmp foo1 foo2 >/dev/null 2>&1; then | |
1518 | echo "They are compatible. In fact, they may be identical." | |
1519 | else | |
1520 | case "$n" in | |
1521 | '-n') n='' c='\c';; | |
1522 | *) n='-n' c='';; | |
1523 | esac | |
1524 | cat <<FOO | |
1525 | They are not compatible! You are probably running ksh on a non-USG system. | |
1526 | I'll have to use $echo instead of the builtin, since Bourne shell doesn't | |
1527 | have echo built in and we may have to run some Bourne shell scripts. That | |
1528 | means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous. | |
1529 | ||
1530 | FOO | |
1531 | $echo $n "The star should be here-->$c" | |
1532 | $echo "*" | |
1533 | fi | |
1534 | $rm -f foo1 foo2 | |
1535 | ;; | |
1536 | esac | |
1537 | ||
a0d0e21e LW |
1538 | : determine whether symbolic links are supported |
1539 | echo " " | |
1540 | $touch blurfl | |
1541 | if $ln -s blurfl sym > /dev/null 2>&1 ; then | |
1542 | echo "Symbolic links are supported." >&4 | |
1543 | lns="$ln -s" | |
1544 | else | |
1545 | echo "Symbolic links are NOT supported." >&4 | |
1546 | lns="$ln" | |
1547 | fi | |
1548 | $rm -f blurfl sym | |
1549 | ||
ecfc5424 AD |
1550 | : see whether [:lower:] and [:upper:] are supported character classes |
1551 | echo " " | |
1552 | up='[A-Z]' | |
1553 | low='[a-z]' | |
1554 | case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in | |
1555 | ABYZ) | |
1556 | echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4 | |
1557 | up='[:upper:]' | |
1558 | low='[:lower:]' | |
1559 | ;; | |
1560 | *) | |
1561 | echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4 | |
1562 | ;; | |
1563 | esac | |
1564 | : set up the translation script tr, must be called with ./tr of course | |
1565 | cat >tr <<EOSC | |
1566 | $startsh | |
1567 | case "\$1\$2" in | |
1568 | '[A-Z][a-z]') exec $tr '$up' '$low';; | |
1569 | '[a-z][A-Z]') exec $tr '$low' '$up';; | |
1570 | esac | |
1571 | exec $tr "\$@" | |
1572 | EOSC | |
1573 | chmod +x tr | |
1574 | $eunicefix tr | |
1575 | ||
2304df62 AD |
1576 | : Try to determine whether config.sh was made on this system |
1577 | case "$config_sh" in | |
1578 | '') | |
1579 | myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1` | |
a0d0e21e | 1580 | myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \ |
ecfc5424 | 1581 | ./tr '[A-Z]' '[a-z]' | tr '\012' ' '` |
1aef975c | 1582 | newmyuname="$myuname" |
2304df62 | 1583 | dflt=n |
16d20bd9 AD |
1584 | case "$knowitall" in |
1585 | '') | |
1586 | if test -f ../config.sh; then | |
1587 | if $contains myuname= ../config.sh >/dev/null 2>&1; then | |
1588 | eval "`grep myuname= ../config.sh`" | |
1589 | fi | |
1590 | if test "X$myuname" = "X$newmyuname"; then | |
1591 | dflt=y | |
1592 | fi | |
2304df62 | 1593 | fi |
16d20bd9 AD |
1594 | ;; |
1595 | *) dflt=y;; | |
1596 | esac | |
2304df62 AD |
1597 | |
1598 | : Get old answers from old config file if Configure was run on the | |
1599 | : same system, otherwise use the hints. | |
1600 | hint=default | |
1601 | cd .. | |
1602 | if test -f config.sh; then | |
16d20bd9 AD |
1603 | echo " " |
1604 | rp="I see a config.sh file. Shall I use it to set the defaults?" | |
2304df62 AD |
1605 | . UU/myread |
1606 | case "$ans" in | |
1607 | n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;; | |
1608 | *) echo "Fetching default answers from your old config.sh file..." >&4 | |
ecfc5424 AD |
1609 | tmp_n="$n" |
1610 | tmp_c="$c" | |
85cad39c | 1611 | tmp_sh="$sh" |
2304df62 AD |
1612 | . ./config.sh |
1613 | cp config.sh UU | |
ecfc5424 AD |
1614 | n="$tmp_n" |
1615 | c="$tmp_c" | |
85cad39c | 1616 | : Older versions did not always set $sh. Catch re-use of such |
1617 | : an old config.sh. | |
1618 | case "$sh" in | |
1619 | '') sh="$tmp_sh" ;; | |
1620 | esac | |
2304df62 AD |
1621 | hint=previous |
1622 | ;; | |
1623 | esac | |
1624 | fi | |
1625 | if test ! -f config.sh; then | |
1626 | $cat <<EOM | |
1627 | ||
1628 | First time through, eh? I have some defaults handy for the following systems: | |
1629 | ||
1630 | EOM | |
1631 | cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&4 | |
1632 | dflt='' | |
1633 | : Half the following guesses are probably wrong... If you have better | |
8ff267be | 1634 | : tests or hints, please send them to doughera@lafcol.lafayette.edu |
2304df62 | 1635 | : The metaconfig authors would also appreciate a copy... |
a0d0e21e | 1636 | $test -f /irix && osname=irix |
85e6fe83 LW |
1637 | $test -f /xenix && osname=sco_xenix |
1638 | $test -f /dynix && osname=dynix | |
1639 | $test -f /dnix && osname=dnix | |
a0d0e21e | 1640 | $test -f /unicos && osname=unicos && osvers=`$uname -r` |
85e6fe83 | 1641 | $test -f /bin/mips && /bin/mips && osname=mips |
ecfc5424 AD |
1642 | $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \ |
1643 | $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4 | |
a0d0e21e LW |
1644 | $test -d /usr/apollo/bin && osname=apollo |
1645 | $test -f /etc/saf/_sactab && osname=svr4 | |
85e6fe83 | 1646 | $test -d /usr/include/minix && osname=minix |
4633a7c4 LW |
1647 | if $test -d /MachTen; then |
1648 | osname=machten | |
1649 | if $test -x /sbin/version; then | |
1650 | osvers=`/sbin/version | $awk '{print $2}' | | |
1651 | $sed -e 's/[A-Za-z]$//'` | |
1652 | elif $test -x /usr/etc/version; then | |
1653 | osvers=`/usr/etc/version | $awk '{print $2}' | | |
1654 | $sed -e 's/[A-Za-z]$//'` | |
1655 | else | |
1656 | osvers="$2.$3" | |
1657 | fi | |
1658 | fi | |
2304df62 AD |
1659 | if $test -f $uname; then |
1660 | set X $myuname | |
1661 | shift | |
1662 | ||
2304df62 | 1663 | case "$5" in |
85e6fe83 | 1664 | fps*) osname=fps ;; |
2304df62 AD |
1665 | mips*) |
1666 | case "$4" in | |
85e6fe83 LW |
1667 | umips) osname=umips ;; |
1668 | *) osname=mips ;; | |
2304df62 | 1669 | esac;; |
85e6fe83 LW |
1670 | [23]100) osname=mips ;; |
1671 | next*) osname=next ;; | |
1672 | news*) osname=news ;; | |
ecfc5424 AD |
1673 | i386*) |
1674 | if $test -f /etc/kconfig; then | |
1675 | osname=isc | |
a0d0e21e LW |
1676 | if test "$lns" = "ln -s"; then |
1677 | osvers=4 | |
1678 | elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then | |
1679 | osvers=3 | |
2304df62 | 1680 | elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then |
a0d0e21e | 1681 | osvers=2 |
ecfc5424 AD |
1682 | fi |
1683 | fi | |
1684 | ;; | |
2304df62 AD |
1685 | esac |
1686 | ||
1687 | case "$1" in | |
a0d0e21e LW |
1688 | aix) osname=aix |
1689 | tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1` | |
1690 | case "$tmp" in | |
1aef975c | 1691 | 'not found') osvers="$4"."$3" ;; |
a0d0e21e LW |
1692 | '<3240'|'<>3240') osvers=3.2.0 ;; |
1693 | '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;; | |
1694 | '=3250'|'>3250') osvers=3.2.5 ;; | |
1aef975c | 1695 | *) osvers=$tmp;; |
a0d0e21e LW |
1696 | esac |
1697 | ;; | |
1698 | dnix) osname=dnix | |
1699 | osvers="$3" | |
1700 | ;; | |
1701 | domainos) osname=apollo | |
1702 | osvers="$3" | |
1703 | ;; | |
1704 | dgux) osname=dgux | |
1705 | osvers="$3" | |
1706 | ;; | |
760ac839 LW |
1707 | dynixptx*) osname=dynixptx |
1708 | osvers="$3" | |
1709 | ;; | |
a0d0e21e LW |
1710 | freebsd) osname=freebsd |
1711 | osvers="$3" ;; | |
1712 | genix) osname=genix ;; | |
1713 | hp*) osname=hpux | |
1714 | case "$3" in | |
1715 | *.08.*) osvers=9 ;; | |
1716 | *.09.*) osvers=9 ;; | |
1717 | *.10.*) osvers=10 ;; | |
ecfc5424 | 1718 | *) osvers="$3" ;; |
a0d0e21e LW |
1719 | esac |
1720 | ;; | |
a78b0d02 | 1721 | irix*) osname=irix |
a0d0e21e LW |
1722 | case "$3" in |
1723 | 4*) osvers=4 ;; | |
1724 | 5*) osvers=5 ;; | |
ecfc5424 | 1725 | *) osvers="$3" ;; |
a0d0e21e LW |
1726 | esac |
1727 | ;; | |
1728 | linux) osname=linux | |
1729 | case "$3" in | |
1730 | 1*) osvers=1 ;; | |
1731 | *) osvers="$3" ;; | |
1732 | esac | |
1733 | ;; | |
1734 | netbsd*) osname=netbsd | |
ecfc5424 AD |
1735 | osvers="$3" |
1736 | ;; | |
a0d0e21e LW |
1737 | bsd386) osname=bsd386 |
1738 | osvers=`$uname -r` | |
1739 | ;; | |
1740 | next*) osname=next ;; | |
1741 | solaris) osname=solaris | |
1742 | case "$3" in | |
1743 | 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;; | |
ecfc5424 | 1744 | *) osvers="$3" ;; |
a0d0e21e LW |
1745 | esac |
1746 | ;; | |
85e6fe83 LW |
1747 | sunos) osname=sunos |
1748 | case "$3" in | |
85e6fe83 LW |
1749 | 5*) osname=solaris |
1750 | osvers=`echo $3 | $sed 's/^5/2/g'` ;; | |
a0d0e21e | 1751 | *) osvers="$3" ;; |
2304df62 AD |
1752 | esac |
1753 | ;; | |
a0d0e21e | 1754 | titanos) osname=titanos |
85e6fe83 | 1755 | case "$3" in |
a0d0e21e LW |
1756 | 1*) osvers=1 ;; |
1757 | 2*) osvers=2 ;; | |
1758 | 3*) osvers=3 ;; | |
1759 | 4*) osvers=4 ;; | |
ecfc5424 | 1760 | *) osvers="$3" ;; |
2304df62 AD |
1761 | esac |
1762 | ;; | |
85e6fe83 | 1763 | ultrix) osname=ultrix |
ecfc5424 | 1764 | osvers="$3" |
2304df62 | 1765 | ;; |
85e6fe83 | 1766 | osf1) case "$5" in |
fed7345c AD |
1767 | alpha) |
1768 | osname=dec_osf | |
1769 | osvers=`echo "$3" | sed 's/^[vt]//'` | |
ecfc5424 AD |
1770 | ;; |
1771 | hp*) osname=hp_osf1 ;; | |
1772 | mips) osname=mips_osf1 ;; | |
85e6fe83 LW |
1773 | esac |
1774 | ;; | |
a0d0e21e LW |
1775 | uts) osname=uts |
1776 | osvers="$3" | |
1777 | ;; | |
ff68c719 | 1778 | qnx) osname=qnx |
1779 | osvers="$4" | |
1780 | ;; | |
85e6fe83 | 1781 | $2) case "$osname" in |
2304df62 | 1782 | *isc*) ;; |
a0d0e21e LW |
1783 | *freebsd*) ;; |
1784 | svr*) | |
1785 | : svr4.x or possibly later | |
1786 | case "svr$3" in | |
1787 | ${osname}*) | |
1788 | osname=svr$3 | |
1789 | osvers=$4 | |
1790 | ;; | |
1791 | esac | |
1792 | case "$osname" in | |
1793 | svr4.0) | |
1794 | : Check for ESIX | |
1795 | if test -f /stand/boot ; then | |
1796 | eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot` | |
ecfc5424 AD |
1797 | if test -n "$INITPROG" -a -f "$INITPROG"; then |
1798 | isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'` | |
1799 | if test -n "$isesix"; then | |
a0d0e21e LW |
1800 | osname=esix4 |
1801 | fi | |
1802 | fi | |
1803 | fi | |
1804 | ;; | |
1805 | esac | |
1806 | ;; | |
2304df62 | 1807 | *) if test -f /etc/systemid; then |
a0d0e21e LW |
1808 | osname=sco |
1809 | set `echo $3 | $sed 's/\./ /g'` $4 | |
2304df62 | 1810 | if $test -f sco_$1_$2_$3.sh; then |
85e6fe83 | 1811 | osvers=$1.$2.$3 |
2304df62 | 1812 | elif $test -f sco_$1_$2.sh; then |
85e6fe83 | 1813 | osvers=$1.$2 |
2304df62 | 1814 | elif $test -f sco_$1.sh; then |
85e6fe83 | 1815 | osvers=$1 |
2304df62 | 1816 | fi |
a0d0e21e LW |
1817 | else |
1818 | case "$osname" in | |
1819 | '') : Still unknown. Probably a generic Sys V. | |
1820 | osname="sysv" | |
1821 | osvers="$3" | |
1822 | ;; | |
1823 | esac | |
2304df62 AD |
1824 | fi |
1825 | ;; | |
1826 | esac | |
1827 | ;; | |
a0d0e21e LW |
1828 | *) case "$osname" in |
1829 | '') : Still unknown. Probably a generic BSD. | |
1830 | osname="$1" | |
1831 | osvers="$3" | |
1832 | ;; | |
1833 | esac | |
1834 | ;; | |
2304df62 AD |
1835 | esac |
1836 | else | |
1837 | if test -f /vmunix -a -f news_os.sh; then | |
ecfc5424 | 1838 | (what /vmunix | ../UU/tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1 |
2304df62 | 1839 | if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then |
85e6fe83 | 1840 | osname=news_os |
2304df62 AD |
1841 | fi |
1842 | $rm -f ../UU/kernel.what | |
8e07c86e AD |
1843 | elif test -d c:/.; then |
1844 | set X $myuname | |
1845 | osname=os2 | |
1846 | osvers="$5" | |
2304df62 AD |
1847 | fi |
1848 | fi | |
85e6fe83 | 1849 | |
a0d0e21e LW |
1850 | : Now look for a hint file osname_osvers, unless one has been |
1851 | : specified already. | |
1852 | case "$hintfile" in | |
1853 | ''|' ') | |
ecfc5424 | 1854 | file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'` |
a0d0e21e | 1855 | : Also try without trailing minor version numbers. |
ecfc5424 AD |
1856 | xfile=`echo $file | $sed -e 's@_[^_]*$@@'` |
1857 | xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'` | |
1858 | xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'` | |
1859 | xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'` | |
a0d0e21e LW |
1860 | case "$file" in |
1861 | '') dflt=none ;; | |
1862 | *) case "$osvers" in | |
1863 | '') dflt=$file | |
1864 | ;; | |
1865 | *) if $test -f $file.sh ; then | |
1866 | dflt=$file | |
1867 | elif $test -f $xfile.sh ; then | |
1868 | dflt=$xfile | |
1869 | elif $test -f $xxfile.sh ; then | |
1870 | dflt=$xxfile | |
1871 | elif $test -f $xxxfile.sh ; then | |
1872 | dflt=$xxxfile | |
1873 | elif $test -f $xxxxfile.sh ; then | |
1874 | dflt=$xxxxfile | |
1875 | elif $test -f "${osname}.sh" ; then | |
1876 | dflt="${osname}" | |
1877 | else | |
1878 | dflt=none | |
1879 | fi | |
1880 | ;; | |
1881 | esac | |
85e6fe83 LW |
1882 | ;; |
1883 | esac | |
1884 | ;; | |
a0d0e21e | 1885 | *) |
ecfc5424 | 1886 | dflt=`echo $hintfile | $sed 's/\.sh$//'` |
a0d0e21e | 1887 | ;; |
2304df62 | 1888 | esac |
1aef975c | 1889 | |
2304df62 AD |
1890 | $cat <<EOM |
1891 | ||
1892 | You may give one or more space-separated answers, or "none" if appropriate. | |
1893 | If your OS version has no hints, DO NOT give a wrong version -- say "none". | |
1894 | ||
1895 | EOM | |
1896 | rp="Which of these apply, if any?" | |
1897 | . ../UU/myread | |
85e6fe83 LW |
1898 | tans=$ans |
1899 | for file in $tans; do | |
2304df62 AD |
1900 | if $test -f $file.sh; then |
1901 | . ./$file.sh | |
1902 | $cat $file.sh >> ../UU/config.sh | |
85e6fe83 | 1903 | elif $test X$tans = X -o X$tans = Xnone ; then |
2304df62 AD |
1904 | : nothing |
1905 | else | |
85e6fe83 LW |
1906 | : Give one chance to correct a possible typo. |
1907 | echo "$file.sh does not exist" | |
1908 | dflt=$file | |
1909 | rp="hint to use instead?" | |
1910 | . ../UU/myread | |
1911 | for file in $ans; do | |
1912 | if $test -f "$file.sh"; then | |
1913 | . ./$file.sh | |
1914 | $cat $file.sh >> ../UU/config.sh | |
1915 | elif $test X$ans = X -o X$ans = Xnone ; then | |
1916 | : nothing | |
1917 | else | |
1918 | echo "$file.sh does not exist -- ignored." | |
1919 | fi | |
1920 | done | |
2304df62 AD |
1921 | fi |
1922 | done | |
85e6fe83 | 1923 | |
2304df62 | 1924 | hint=recommended |
85e6fe83 LW |
1925 | : Remember our hint file for later. |
1926 | if $test -f "$file.sh" ; then | |
a0d0e21e | 1927 | hintfile="$file" |
85e6fe83 | 1928 | else |
a0d0e21e | 1929 | hintfile='' |
85e6fe83 LW |
1930 | fi |
1931 | ||
2304df62 AD |
1932 | cd .. |
1933 | fi | |
1934 | cd UU | |
1935 | ;; | |
1936 | *) | |
1937 | echo " " | |
1938 | echo "Fetching default answers from $config_sh..." >&4 | |
ecfc5424 AD |
1939 | tmp_n="$n" |
1940 | tmp_c="$c" | |
2304df62 AD |
1941 | cd .. |
1942 | cp $config_sh config.sh 2>/dev/null | |
a78b0d02 | 1943 | chmod +w config.sh |
2304df62 AD |
1944 | . ./config.sh |
1945 | cd UU | |
1946 | cp ../config.sh . | |
ecfc5424 AD |
1947 | n="$tmp_n" |
1948 | c="$tmp_c" | |
2304df62 AD |
1949 | hint=previous |
1950 | ;; | |
1951 | esac | |
1aef975c AD |
1952 | test "$override" && . ./optdef.sh |
1953 | myuname="$newmyuname" | |
2304df62 AD |
1954 | |
1955 | : Restore computed paths | |
1956 | for file in $loclist $trylist; do | |
1957 | eval $file="\$_$file" | |
1958 | done | |
1959 | ||
85e6fe83 | 1960 | cat << EOM |
a0d0e21e | 1961 | |
85e6fe83 | 1962 | Configure uses the operating system name and version to set some defaults. |
ecfc5424 AD |
1963 | The default value is probably right if the name rings a bell. Otherwise, |
1964 | since spelling matters for me, either accept the default or answer "none" | |
1965 | to leave it blank. | |
a0d0e21e | 1966 | |
85e6fe83 | 1967 | EOM |
85e6fe83 | 1968 | case "$osname" in |
a0d0e21e | 1969 | ''|' ') |
85e6fe83 | 1970 | case "$hintfile" in |
a0d0e21e | 1971 | ''|' '|none) dflt=none ;; |
ecfc5424 | 1972 | *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;; |
85e6fe83 LW |
1973 | esac |
1974 | ;; | |
1975 | *) dflt="$osname" ;; | |
1976 | esac | |
1977 | rp="Operating system name?" | |
1978 | . ./myread | |
1979 | case "$ans" in | |
ecfc5424 AD |
1980 | none) osname='' ;; |
1981 | *) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;; | |
85e6fe83 | 1982 | esac |
8ff267be | 1983 | echo " " |
1984 | case "$osvers" in | |
1985 | ''|' ') | |
1986 | case "$hintfile" in | |
1987 | ''|' '|none) dflt=none ;; | |
1988 | *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'` | |
1989 | dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'` | |
1990 | case "$dflt" in | |
1991 | ''|' ') dflt=none ;; | |
1992 | esac | |
1993 | ;; | |
1994 | esac | |
1995 | ;; | |
1996 | *) dflt="$osvers" ;; | |
1997 | esac | |
1998 | rp="Operating system version?" | |
1999 | . ./myread | |
2000 | case "$ans" in | |
2001 | none) osvers='' ;; | |
2002 | *) osvers="$ans" ;; | |
2003 | esac | |
2004 | ||
760ac839 LW |
2005 | |
2006 | ||
2304df62 AD |
2007 | : who configured the system |
2008 | cf_time=`$date 2>&1` | |
8ff267be | 2009 | cf_by=`(logname) 2>/dev/null` |
2010 | case "$cf_by" in "") | |
2011 | cf_by=`(whoami) 2>/dev/null` | |
2012 | case "$cf_by" in "") | |
2013 | cf_by=unknown ;; | |
2014 | esac ;; | |
2015 | esac | |
2304df62 | 2016 | |
4633a7c4 | 2017 | : determine the architecture name |
2304df62 | 2018 | echo " " |
4633a7c4 LW |
2019 | if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then |
2020 | tarch=`arch`"-$osname" | |
2021 | elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then | |
2022 | if uname -m > tmparch 2>&1 ; then | |
ff68c719 | 2023 | tarch=`$sed -e 's/ /_/g' -e 's/_*$//' -e 's/$/'"-$osname/" tmparch` |
4633a7c4 LW |
2024 | else |
2025 | tarch="$osname" | |
2026 | fi | |
2027 | $rm -f tmparch | |
2028 | else | |
2029 | tarch="$osname" | |
2030 | fi | |
2031 | case "$myarchname" in | |
2032 | ''|"$tarch") ;; | |
2033 | *) | |
2034 | echo "(Your architecture name used to be $myarchname.)" | |
2035 | archname='' | |
2304df62 AD |
2036 | ;; |
2037 | esac | |
4633a7c4 LW |
2038 | case "$archname" in |
2039 | '') dflt="$tarch";; | |
2040 | *) dflt="$archname";; | |
2041 | esac | |
2042 | rp='What is your architecture name' | |
2043 | . ./myread | |
2044 | archname="$ans" | |
2045 | myarchname="$tarch" | |
2046 | ||
2047 | : is AFS running? | |
2048 | echo " " | |
2afac517 | 2049 | case "$afs" in |
2050 | $define|true) afs=true ;; | |
2051 | $undef|false) afs=false ;; | |
2052 | *) if test -d /afs; then | |
2053 | afs=true | |
2054 | else | |
2055 | afs=false | |
2056 | fi | |
2057 | ;; | |
2058 | esac | |
2059 | if $afs; then | |
4633a7c4 | 2060 | echo "AFS may be running... I'll be extra cautious then..." >&4 |
2304df62 | 2061 | else |
4633a7c4 | 2062 | echo "AFS does not seem to be running..." >&4 |
2304df62 AD |
2063 | fi |
2064 | ||
4633a7c4 LW |
2065 | : decide how portable to be. Allow command line overrides. |
2066 | case "$d_portable" in | |
2067 | "$undef") ;; | |
2068 | *) d_portable="$define" ;; | |
2304df62 | 2069 | esac |
2304df62 | 2070 | |
4633a7c4 LW |
2071 | : set up shell script to do ~ expansion |
2072 | cat >filexp <<EOSS | |
2073 | $startsh | |
2074 | : expand filename | |
2075 | case "\$1" in | |
2076 | ~/*|~) | |
2077 | echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|" | |
2304df62 | 2078 | ;; |
4633a7c4 LW |
2079 | ~*) |
2080 | if $test -f /bin/csh; then | |
2081 | /bin/csh -f -c "glob \$1" | |
2082 | failed=\$? | |
2083 | echo "" | |
2084 | exit \$failed | |
2085 | else | |
2086 | name=\`$expr x\$1 : '..\([^/]*\)'\` | |
2087 | dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\` | |
2088 | if $test ! -d "\$dir"; then | |
2089 | me=\`basename \$0\` | |
2090 | echo "\$me: can't locate home directory for: \$name" >&2 | |
2091 | exit 1 | |
2092 | fi | |
2093 | case "\$1" in | |
2094 | */*) | |
2095 | echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` | |
2096 | ;; | |
2097 | *) | |
2098 | echo \$dir | |
2099 | ;; | |
2304df62 | 2100 | esac |
4633a7c4 | 2101 | fi |
2304df62 AD |
2102 | ;; |
2103 | *) | |
4633a7c4 | 2104 | echo \$1 |
2304df62 AD |
2105 | ;; |
2106 | esac | |
4633a7c4 LW |
2107 | EOSS |
2108 | chmod +x filexp | |
2109 | $eunicefix filexp | |
2304df62 AD |
2110 | |
2111 | : now set up to get a file name | |
2112 | cat <<'EOSC' >getfile | |
2113 | tilde='' | |
2114 | fullpath='' | |
2115 | already='' | |
2116 | skip='' | |
2117 | none_ok='' | |
2118 | exp_file='' | |
a0d0e21e | 2119 | nopath_ok='' |
2304df62 AD |
2120 | orig_rp="$rp" |
2121 | orig_dflt="$dflt" | |
2122 | ||
2123 | case "$fn" in | |
ecfc5424 AD |
2124 | *\(*) |
2125 | expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok | |
2126 | fn=`echo $fn | sed 's/(.*)//'` | |
2127 | ;; | |
2128 | esac | |
2129 | ||
2130 | case "$fn" in | |
a0d0e21e LW |
2131 | *:*) |
2132 | loc_file=`expr $fn : '.*:\(.*\)'` | |
2133 | fn=`expr $fn : '\(.*\):.*'` | |
2134 | ;; | |
2135 | esac | |
2136 | ||
2137 | case "$fn" in | |
2304df62 AD |
2138 | *~*) tilde=true;; |
2139 | esac | |
2140 | case "$fn" in | |
2141 | */*) fullpath=true;; | |
2142 | esac | |
2143 | case "$fn" in | |
2144 | *+*) skip=true;; | |
2145 | esac | |
2146 | case "$fn" in | |
2147 | *n*) none_ok=true;; | |
2148 | esac | |
2149 | case "$fn" in | |
2150 | *e*) exp_file=true;; | |
2151 | esac | |
a0d0e21e LW |
2152 | case "$fn" in |
2153 | *p*) nopath_ok=true;; | |
2154 | esac | |
2304df62 AD |
2155 | |
2156 | case "$fn" in | |
2157 | *f*) type='File';; | |
2158 | *d*) type='Directory';; | |
a0d0e21e | 2159 | *l*) type='Locate';; |
2304df62 AD |
2160 | esac |
2161 | ||
2162 | what="$type" | |
2163 | case "$what" in | |
2164 | Locate) what='File';; | |
2165 | esac | |
2166 | ||
2167 | case "$exp_file" in | |
2168 | '') | |
2169 | case "$d_portable" in | |
2170 | "$define") ;; | |
2171 | *) exp_file=true;; | |
2172 | esac | |
2173 | ;; | |
2174 | esac | |
2175 | ||
2176 | cd .. | |
2177 | while test "$type"; do | |
2178 | redo='' | |
2179 | rp="$orig_rp" | |
2180 | dflt="$orig_dflt" | |
2181 | case "$tilde" in | |
2182 | true) rp="$rp (~name ok)";; | |
2183 | esac | |
2184 | . UU/myread | |
ecfc5424 AD |
2185 | if test -f UU/getfile.ok && \ |
2186 | $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1 | |
2187 | then | |
2188 | value="$ans" | |
2189 | ansexp="$ans" | |
2190 | break | |
2191 | fi | |
2304df62 AD |
2192 | case "$ans" in |
2193 | none) | |
2194 | value='' | |
2195 | ansexp='' | |
2196 | case "$none_ok" in | |
2197 | true) type='';; | |
2198 | esac | |
2199 | ;; | |
2200 | *) | |
2201 | case "$tilde" in | |
2202 | '') value="$ans" | |
2203 | ansexp="$ans";; | |
2204 | *) | |
2205 | value=`UU/filexp $ans` | |
2206 | case $? in | |
2207 | 0) | |
2208 | if test "$ans" != "$value"; then | |
ecfc5424 | 2209 | echo "(That expands to $value on this system.)" |
2304df62 AD |
2210 | fi |
2211 | ;; | |
2212 | *) value="$ans";; | |
2213 | esac | |
2214 | ansexp="$value" | |
2215 | case "$exp_file" in | |
2216 | '') value="$ans";; | |
2217 | esac | |
2218 | ;; | |
2219 | esac | |
2220 | case "$fullpath" in | |
2221 | true) | |
2222 | case "$ansexp" in | |
2223 | /*) value="$ansexp" ;; | |
2224 | *) | |
2225 | redo=true | |
2226 | case "$already" in | |
2227 | true) | |
2228 | echo "I shall only accept a full path name, as in /bin/ls." >&4 | |
2229 | echo "Use a ! shell escape if you wish to check pathnames." >&4 | |
2230 | ;; | |
2231 | *) | |
2232 | echo "Please give a full path name, starting with slash." >&4 | |
2233 | case "$tilde" in | |
2234 | true) | |
2235 | echo "Note that using ~name is ok provided it expands well." >&4 | |
2236 | already=true | |
2237 | ;; | |
2238 | esac | |
2239 | esac | |
2240 | ;; | |
2241 | esac | |
2242 | ;; | |
2243 | esac | |
2244 | case "$redo" in | |
2245 | '') | |
2246 | case "$type" in | |
2247 | File) | |
2248 | if test -f "$ansexp"; then | |
2249 | type='' | |
2250 | elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1 | |
2251 | then | |
2252 | echo "($value is not a plain file, but that's ok.)" | |
2253 | type='' | |
2254 | fi | |
2255 | ;; | |
2256 | Directory) | |
2257 | if test -d "$ansexp"; then | |
2258 | type='' | |
2259 | fi | |
2260 | ;; | |
2261 | Locate) | |
40000a8c | 2262 | if test -d "$ansexp"; then |
a0d0e21e LW |
2263 | echo "(Looking for $loc_file in directory $value.)" |
2264 | value="$value/$loc_file" | |
40000a8c | 2265 | ansexp="$ansexp/$loc_file" |
2304df62 | 2266 | fi |
40000a8c | 2267 | if test -f "$ansexp"; then |
2304df62 AD |
2268 | type='' |
2269 | fi | |
a0d0e21e LW |
2270 | case "$nopath_ok" in |
2271 | true) case "$value" in | |
2272 | */*) ;; | |
2273 | *) echo "Assuming $value will be in people's path." | |
2274 | type='' | |
2275 | ;; | |
2276 | esac | |
2277 | ;; | |
2278 | esac | |
2304df62 AD |
2279 | ;; |
2280 | esac | |
2281 | ||
2282 | case "$skip" in | |
2283 | true) type=''; | |
2284 | esac | |
2285 | ||
2286 | case "$type" in | |
2287 | '') ;; | |
2288 | *) | |
2289 | if test "$fastread" = yes; then | |
2290 | dflt=y | |
2291 | else | |
2292 | dflt=n | |
2293 | fi | |
2294 | rp="$what $value doesn't exist. Use that name anyway?" | |
2295 | . UU/myread | |
2296 | dflt='' | |
2297 | case "$ans" in | |
2298 | y*) type='';; | |
2299 | *) echo " ";; | |
2300 | esac | |
2301 | ;; | |
2302 | esac | |
2303 | ;; | |
2304 | esac | |
2305 | ;; | |
2306 | esac | |
2307 | done | |
2308 | cd UU | |
2309 | ans="$value" | |
2310 | rp="$orig_rp" | |
2311 | dflt="$orig_dflt" | |
ecfc5424 | 2312 | rm -f getfile.ok |
2304df62 AD |
2313 | EOSC |
2314 | ||
4633a7c4 LW |
2315 | : determine root of directory hierarchy where package will be installed. |
2316 | case "$prefix" in | |
2317 | '') | |
2318 | dflt=`./loc . /usr/local /usr/local /local /opt /usr` | |
8e07c86e | 2319 | ;; |
4633a7c4 LW |
2320 | *) |
2321 | dflt="$prefix" | |
8e07c86e AD |
2322 | ;; |
2323 | esac | |
4633a7c4 | 2324 | $cat <<EOM |
2304df62 | 2325 | |
4633a7c4 LW |
2326 | By default, $package will be installed in $dflt/bin, manual |
2327 | pages under $dflt/man, etc..., i.e. with $dflt as prefix for | |
2328 | all installation directories. Typically set to /usr/local, but you | |
2329 | may choose /usr if you wish to install $package among your system | |
2330 | binaries. If you wish to have binaries under /bin but manual pages | |
2331 | under /usr/local/man, that's ok: you will be prompted separately | |
2332 | for each of the installation directories, the prefix being only used | |
2333 | to set the defaults. | |
8e07c86e AD |
2334 | |
2335 | EOM | |
2336 | fn=d~ | |
2337 | rp='Installation prefix to use?' | |
2338 | . ./getfile | |
2339 | oldprefix='' | |
2340 | case "$prefix" in | |
a0d0e21e | 2341 | '') ;; |
8e07c86e AD |
2342 | *) |
2343 | case "$ans" in | |
2344 | "$prefix") ;; | |
2345 | *) oldprefix="$prefix";; | |
2346 | esac | |
2347 | ;; | |
a0d0e21e | 2348 | esac |
8e07c86e AD |
2349 | prefix="$ans" |
2350 | prefixexp="$ansexp" | |
a0d0e21e | 2351 | |
8e07c86e AD |
2352 | : set the prefixit variable, to compute a suitable default value |
2353 | prefixit='case "$3" in | |
2354 | ""|none) | |
2355 | case "$oldprefix" in | |
2356 | "") eval "$1=\"\$$2\"";; | |
2357 | *) | |
2358 | case "$3" in | |
2359 | "") eval "$1=";; | |
2360 | none) | |
2361 | eval "tp=\"\$$2\""; | |
2362 | case "$tp" in | |
2363 | ""|" ") eval "$1=\"\$$2\"";; | |
2364 | *) eval "$1=";; | |
2365 | esac;; | |
2366 | esac;; | |
2367 | esac;; | |
2368 | *) | |
2369 | eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\""; | |
2370 | case "$tp" in | |
2371 | --|/*--|\~*--) eval "$1=\"$prefix/$3\"";; | |
2372 | /*-$oldprefix/*|\~*-$oldprefix/*) | |
2373 | eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";; | |
2374 | *) eval "$1=\"\$$2\"";; | |
2375 | esac;; | |
2376 | esac' | |
a0d0e21e | 2377 | |
4633a7c4 LW |
2378 | : determine where private library files go |
2379 | : Usual default is /usr/local/lib/perl5. Also allow things like | |
2380 | : /opt/perl/lib, since /opt/perl/lib/perl5 would be redundant. | |
2381 | case "$prefix" in | |
2382 | *perl*) set dflt privlib lib ;; | |
2383 | *) set dflt privlib lib/$package ;; | |
2384 | esac | |
8e07c86e | 2385 | eval $prefixit |
4633a7c4 LW |
2386 | $cat <<EOM |
2387 | ||
2388 | There are some auxiliary files for $package that need to be put into a | |
2389 | private library directory that is accessible by everyone. | |
2390 | ||
2391 | EOM | |
2392 | fn=d~+ | |
2393 | rp='Pathname where the private library files will reside?' | |
8e07c86e | 2394 | . ./getfile |
4633a7c4 LW |
2395 | if $test "X$privlibexp" != "X$ansexp"; then |
2396 | installprivlib='' | |
8e07c86e | 2397 | fi |
4633a7c4 LW |
2398 | privlib="$ans" |
2399 | privlibexp="$ansexp" | |
8e07c86e AD |
2400 | if $afs; then |
2401 | $cat <<EOM | |
2304df62 | 2402 | |
8e07c86e | 2403 | Since you are running AFS, I need to distinguish the directory in which |
4633a7c4 | 2404 | private files reside from the directory in which they are installed (and from |
8e07c86e | 2405 | which they are presumably copied to the former directory by occult means). |
a0d0e21e | 2406 | |
8e07c86e | 2407 | EOM |
4633a7c4 LW |
2408 | case "$installprivlib" in |
2409 | '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;; | |
2410 | *) dflt="$installprivlib";; | |
8e07c86e AD |
2411 | esac |
2412 | fn=de~ | |
4633a7c4 | 2413 | rp='Where will private files be installed?' |
8e07c86e | 2414 | . ./getfile |
4633a7c4 | 2415 | installprivlib="$ans" |
8e07c86e | 2416 | else |
4633a7c4 LW |
2417 | installprivlib="$privlibexp" |
2418 | fi | |
2419 | ||
2420 | : set the base revision | |
2421 | baserev=5.0 | |
2422 | ||
2423 | : get the patchlevel | |
2424 | echo " " | |
2425 | echo "Getting the current patchlevel..." >&4 | |
2426 | if $test -r ../patchlevel.h;then | |
760ac839 LW |
2427 | patchlevel=`awk '/PATCHLEVEL/ {print $3}' ../patchlevel.h` |
2428 | subversion=`awk '/SUBVERSION/ {print $3}' ../patchlevel.h` | |
4633a7c4 LW |
2429 | else |
2430 | patchlevel=0 | |
f55a7265 | 2431 | subversion=0 |
8e07c86e | 2432 | fi |
36477c24 | 2433 | $echo $n "(You have $package $baserev patchlevel $patchlevel" $c |
2434 | test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c | |
2435 | echo ".)" | |
2304df62 | 2436 | |
8e07c86e AD |
2437 | : set the prefixup variable, to restore leading tilda escape |
2438 | prefixup='case "$prefixexp" in | |
2439 | "$prefix") ;; | |
2440 | *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";; | |
2441 | esac' | |
2442 | ||
4633a7c4 LW |
2443 | : determine where public architecture dependent libraries go |
2444 | set archlib archlib | |
8e07c86e | 2445 | eval $prefixit |
4633a7c4 | 2446 | case "$archlib" in |
8e07c86e | 2447 | '') |
4633a7c4 | 2448 | case "$privlib" in |
760ac839 | 2449 | '') dflt=`./loc . "." $prefixexp/lib /usr/local/lib /usr/lib /lib` |
4633a7c4 LW |
2450 | set dflt |
2451 | eval $prefixup | |
2452 | ;; | |
36477c24 | 2453 | *) if test 0 -eq "$subversion"; then |
2454 | version=`echo $baserev $patchlevel | \ | |
2455 | $awk '{ printf "%d.%03d\n",$1,$2 }'` | |
2456 | else | |
2457 | version=`echo $baserev $patchlevel $subversion | \ | |
2458 | $awk '{ printf "%d.%03d%02d\n",$1,$2,$3 }'` | |
2459 | fi | |
4633a7c4 LW |
2460 | dflt="$privlib/$archname/$version" |
2461 | ;; | |
2462 | esac | |
8e07c86e | 2463 | ;; |
4633a7c4 | 2464 | *) dflt="$archlib";; |
8e07c86e | 2465 | esac |
4633a7c4 LW |
2466 | cat <<EOM |
2467 | ||
2468 | $spackage contains architecture-dependent library files. If you are | |
2469 | sharing libraries in a heterogeneous environment, you might store | |
2470 | these files in a separate location. Otherwise, you can just include | |
2471 | them with the rest of the public library files. | |
2472 | ||
8e07c86e | 2473 | EOM |
4633a7c4 LW |
2474 | fn=d+~ |
2475 | rp='Where do you want to put the public architecture-dependent libraries?' | |
8e07c86e | 2476 | . ./getfile |
4633a7c4 LW |
2477 | archlib="$ans" |
2478 | archlibexp="$ansexp" | |
2479 | ||
8e07c86e AD |
2480 | if $afs; then |
2481 | $cat <<EOM | |
2482 | ||
2483 | Since you are running AFS, I need to distinguish the directory in which | |
4633a7c4 | 2484 | private files reside from the directory in which they are installed (and from |
8e07c86e AD |
2485 | which they are presumably copied to the former directory by occult means). |
2486 | ||
2487 | EOM | |
4633a7c4 LW |
2488 | case "$installarchlib" in |
2489 | '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;; | |
2490 | *) dflt="$installarchlib";; | |
8e07c86e AD |
2491 | esac |
2492 | fn=de~ | |
4633a7c4 | 2493 | rp='Where will architecture-dependent library files be installed?' |
8e07c86e | 2494 | . ./getfile |
4633a7c4 | 2495 | installarchlib="$ans" |
8e07c86e | 2496 | else |
4633a7c4 LW |
2497 | installarchlib="$archlibexp" |
2498 | fi | |
2499 | if $test X"$archlib" = X"$privlib"; then | |
2500 | d_archlib="$undef" | |
2501 | else | |
2502 | d_archlib="$define" | |
8e07c86e AD |
2503 | fi |
2504 | ||
40a7a20a | 2505 | : set up the script used to warn in case of inconsistency |
2506 | cat <<'EOSC' >whoa | |
2507 | dflt=y | |
2508 | echo " " | |
2509 | echo "*** WHOA THERE!!! ***" >&4 | |
2510 | echo " The $hint value for \$$var on this machine was \"$was\"!" >&4 | |
2511 | rp=" Keep the $hint value?" | |
2512 | . ./myread | |
2513 | case "$ans" in | |
2514 | y) td=$was; tu=$was;; | |
2515 | esac | |
2516 | EOSC | |
2517 | ||
2518 | : function used to set $1 to $val | |
2519 | setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef; | |
2520 | case "$val$was" in | |
2521 | $define$undef) . ./whoa; eval "$var=\$td";; | |
2522 | $undef$define) . ./whoa; eval "$var=\$tu";; | |
2523 | *) eval "$var=$val";; | |
2524 | esac' | |
2525 | ||
2526 | : make some quick guesses about what we are up against | |
2527 | echo " " | |
2528 | $echo $n "Hmm... $c" | |
2529 | echo exit 1 >bsd | |
2530 | echo exit 1 >usg | |
2531 | echo exit 1 >v7 | |
2532 | echo exit 1 >osf1 | |
2533 | echo exit 1 >eunice | |
2534 | echo exit 1 >xenix | |
2535 | echo exit 1 >venix | |
8ff267be | 2536 | echo exit 1 >os2 |
40a7a20a | 2537 | d_bsd="$undef" |
2538 | $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null | |
2539 | if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1 | |
2540 | then | |
2541 | echo "Looks kind of like an OSF/1 system, but we'll see..." | |
2542 | echo exit 0 >osf1 | |
2543 | elif test `echo abc | tr a-z A-Z` = Abc ; then | |
2544 | xxx=`./loc addbib blurfl $pth` | |
2545 | if $test -f $xxx; then | |
2546 | echo "Looks kind of like a USG system with BSD features, but we'll see..." | |
2547 | echo exit 0 >bsd | |
2548 | echo exit 0 >usg | |
2549 | else | |
2550 | if $contains SIGTSTP foo >/dev/null 2>&1 ; then | |
2551 | echo "Looks kind of like an extended USG system, but we'll see..." | |
2552 | else | |
2553 | echo "Looks kind of like a USG system, but we'll see..." | |
2554 | fi | |
2555 | echo exit 0 >usg | |
2556 | fi | |
2557 | elif $contains SIGTSTP foo >/dev/null 2>&1 ; then | |
2558 | echo "Looks kind of like a BSD system, but we'll see..." | |
2559 | d_bsd="$define" | |
2560 | echo exit 0 >bsd | |
2561 | else | |
2562 | echo "Looks kind of like a Version 7 system, but we'll see..." | |
2563 | echo exit 0 >v7 | |
2564 | fi | |
2565 | case "$eunicefix" in | |
2566 | *unixtovms*) | |
2567 | $cat <<'EOI' | |
2568 | There is, however, a strange, musty smell in the air that reminds me of | |
2569 | something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit. | |
2570 | EOI | |
2571 | echo exit 0 >eunice | |
2572 | d_eunice="$define" | |
2573 | : it so happens the Eunice I know will not run shell scripts in Unix format | |
2574 | ;; | |
2575 | *) | |
2576 | echo " " | |
2577 | echo "Congratulations. You aren't running Eunice." | |
2578 | d_eunice="$undef" | |
2579 | ;; | |
2580 | esac | |
8ff267be | 2581 | : Detect OS2. The p_ variable is set above in the Head.U unit. |
2582 | case "$p_" in | |
2583 | :) ;; | |
2584 | *) | |
2585 | $cat <<'EOI' | |
2586 | I have the feeling something is not exactly right, however...don't tell me... | |
2587 | lemme think...does HAL ring a bell?...no, of course, you're only running OS/2! | |
2588 | EOI | |
2589 | echo exit 0 >os2 | |
2590 | ;; | |
2591 | esac | |
40a7a20a | 2592 | if test -f /xenix; then |
2593 | echo "Actually, this looks more like a XENIX system..." | |
2594 | echo exit 0 >xenix | |
2595 | d_xenix="$define" | |
2596 | else | |
2597 | echo " " | |
2598 | echo "It's not Xenix..." | |
2599 | d_xenix="$undef" | |
2600 | fi | |
2601 | chmod +x xenix | |
2602 | $eunicefix xenix | |
2603 | if test -f /venix; then | |
2604 | echo "Actually, this looks more like a VENIX system..." | |
2605 | echo exit 0 >venix | |
2606 | else | |
2607 | echo " " | |
2608 | if ./xenix; then | |
2609 | : null | |
2610 | else | |
2611 | echo "Nor is it Venix..." | |
2612 | fi | |
2613 | fi | |
8ff267be | 2614 | chmod +x bsd usg v7 osf1 eunice xenix venix os2 |
2615 | $eunicefix bsd usg v7 osf1 eunice xenix venix os2 | |
40a7a20a | 2616 | $rm -f foo |
2617 | ||
2618 | : see if setuid scripts can be secure | |
2619 | $cat <<EOM | |
2620 | ||
2621 | Some kernels have a bug that prevents setuid #! scripts from being | |
2622 | secure. Some sites have disabled setuid #! scripts because of this. | |
2623 | ||
2624 | First let's decide if your kernel supports secure setuid #! scripts. | |
2625 | (If setuid #! scripts would be secure but have been disabled anyway, | |
2626 | don't say that they are secure if asked.) | |
2627 | ||
2628 | EOM | |
2629 | ||
2630 | val="$undef" | |
2631 | if $test -d /dev/fd; then | |
2632 | echo "#!$ls" >reflect | |
2633 | chmod +x,u+s reflect | |
2634 | ./reflect >flect 2>&1 | |
2635 | if $contains "/dev/fd" flect >/dev/null; then | |
2636 | echo "Congratulations, your kernel has secure setuid scripts!" >&4 | |
2637 | val="$define" | |
2638 | else | |
2639 | $cat <<EOM | |
2640 | If you are not sure if they are secure, I can check but I'll need a | |
2641 | username and password different from the one you are using right now. | |
2642 | If you don't have such a username or don't want me to test, simply | |
2643 | enter 'none'. | |
2644 | ||
2645 | EOM | |
2646 | rp='Other username to test security of setuid scripts with?' | |
2647 | dflt='none' | |
2648 | . ./myread | |
2649 | case "$ans" in | |
2650 | n|none) | |
2651 | case "$d_suidsafe" in | |
2652 | '') echo "I'll assume setuid scripts are *not* secure." >&4 | |
2653 | dflt=n;; | |
2654 | "$undef") | |
2655 | echo "Well, the $hint value is *not* secure." >&4 | |
2656 | dflt=n;; | |
2657 | *) echo "Well, the $hint value *is* secure." >&4 | |
2658 | dflt=y;; | |
2659 | esac | |
2660 | ;; | |
2661 | *) | |
2662 | $rm -f reflect flect | |
2663 | echo "#!$ls" >reflect | |
2664 | chmod +x,u+s reflect | |
2665 | echo >flect | |
2666 | chmod a+w flect | |
2667 | echo '"su" will (probably) prompt you for '"$ans's password." | |
2668 | su $ans -c './reflect >flect' | |
2669 | if $contains "/dev/fd" flect >/dev/null; then | |
2670 | echo "Okay, it looks like setuid scripts are secure." >&4 | |
2671 | dflt=y | |
2672 | else | |
2673 | echo "I don't think setuid scripts are secure." >&4 | |
2674 | dflt=n | |
2675 | fi | |
2676 | ;; | |
2677 | esac | |
2678 | rp='Does your kernel have *secure* setuid scripts?' | |
2679 | . ./myread | |
2680 | case "$ans" in | |
2681 | [yY]*) val="$define";; | |
2682 | *) val="$undef";; | |
2683 | esac | |
2684 | fi | |
2685 | else | |
2686 | echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4 | |
760ac839 | 2687 | echo "(That's for file descriptors, not floppy disks.)" |
40a7a20a | 2688 | val="$undef" |
2689 | fi | |
2690 | set d_suidsafe | |
2691 | eval $setvar | |
2692 | ||
2693 | $rm -f reflect flect | |
2694 | ||
2695 | : now see if they want to do setuid emulation | |
2696 | echo " " | |
2697 | val="$undef" | |
2698 | case "$d_suidsafe" in | |
2699 | "$define") | |
2700 | val="$undef" | |
2701 | echo "No need to emulate SUID scripts since they are secure here." >& 4 | |
2702 | ;; | |
2703 | *) | |
2704 | $cat <<EOM | |
2705 | Some systems have disabled setuid scripts, especially systems where | |
2706 | setuid scripts cannot be secure. On systems where setuid scripts have | |
2707 | been disabled, the setuid/setgid bits on scripts are currently | |
2708 | useless. It is possible for $package to detect those bits and emulate | |
2709 | setuid/setgid in a secure fashion. This emulation will only work if | |
2710 | setuid scripts have been disabled in your kernel. | |
2711 | ||
2712 | EOM | |
2713 | case "$d_dosuid" in | |
2714 | "$define") dflt=y ;; | |
2715 | *) dflt=n ;; | |
2716 | esac | |
2717 | rp="Do you want to do setuid/setgid emulation?" | |
2718 | . ./myread | |
2719 | case "$ans" in | |
2720 | [yY]*) val="$define";; | |
2721 | *) val="$undef";; | |
2722 | esac | |
2723 | ;; | |
2724 | esac | |
2725 | set d_dosuid | |
2726 | eval $setvar | |
2727 | ||
37120919 AD |
2728 | : determine where site specific libraries go. |
2729 | set sitelib sitelib | |
2730 | eval $prefixit | |
2731 | case "$sitelib" in | |
2732 | '') dflt="$privlib/site_perl" ;; | |
2733 | *) dflt="$sitelib" ;; | |
2734 | esac | |
2735 | $cat <<EOM | |
2736 | ||
2737 | The installation process will also create a directory for | |
2738 | site-specific extensions and modules. Some users find it convenient | |
2739 | to place all local files in this directory rather than in the main | |
2740 | distribution directory. | |
2741 | ||
2742 | EOM | |
2743 | fn=d~+ | |
2744 | rp='Pathname for the site-specific library files?' | |
2745 | . ./getfile | |
2746 | if $test "X$sitelibexp" != "X$ansexp"; then | |
2747 | installsitelib='' | |
2748 | fi | |
2749 | sitelib="$ans" | |
2750 | sitelibexp="$ansexp" | |
2751 | if $afs; then | |
2752 | $cat <<EOM | |
2753 | ||
2754 | Since you are running AFS, I need to distinguish the directory in which | |
2755 | private files reside from the directory in which they are installed (and from | |
2756 | which they are presumably copied to the former directory by occult means). | |
2757 | ||
2758 | EOM | |
2759 | case "$installsitelib" in | |
2760 | '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;; | |
2761 | *) dflt="$installsitelib";; | |
2762 | esac | |
2763 | fn=de~ | |
2764 | rp='Where will private files be installed?' | |
2765 | . ./getfile | |
2766 | installsitelib="$ans" | |
2767 | else | |
2768 | installsitelib="$sitelibexp" | |
2769 | fi | |
4633a7c4 | 2770 | |
37120919 AD |
2771 | : determine where site specific architecture-dependent libraries go. |
2772 | xxx=`echo $sitelib/$archname | sed 's!^$prefix!!'` | |
2773 | : xxx is usuually lib/site_perl/archname. | |
2774 | set sitearch sitearch none | |
8e07c86e | 2775 | eval $prefixit |
37120919 AD |
2776 | case "$sitearch" in |
2777 | '') dflt="$sitelib/$archname" ;; | |
2778 | *) dflt="$sitearch" ;; | |
2779 | esac | |
8e07c86e AD |
2780 | $cat <<EOM |
2781 | ||
4633a7c4 LW |
2782 | The installation process will also create a directory for |
2783 | architecture-dependent site-specific extensions and modules. | |
8e07c86e AD |
2784 | |
2785 | EOM | |
4633a7c4 LW |
2786 | fn=nd~+ |
2787 | rp='Pathname for the site-specific architecture-dependent library files?' | |
8e07c86e | 2788 | . ./getfile |
4633a7c4 LW |
2789 | if $test "X$sitearchexp" != "X$ansexp"; then |
2790 | installsitearch='' | |
8e07c86e | 2791 | fi |
4633a7c4 LW |
2792 | sitearch="$ans" |
2793 | sitearchexp="$ansexp" | |
8e07c86e AD |
2794 | if $afs; then |
2795 | $cat <<EOM | |
2796 | ||
2797 | Since you are running AFS, I need to distinguish the directory in which | |
2798 | private files reside from the directory in which they are installed (and from | |
2799 | which they are presumably copied to the former directory by occult means). | |
2800 | ||
2801 | EOM | |
4633a7c4 LW |
2802 | case "$installsitearch" in |
2803 | '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;; | |
2804 | *) dflt="$installsitearch";; | |
8e07c86e AD |
2805 | esac |
2806 | fn=de~ | |
2807 | rp='Where will private files be installed?' | |
2808 | . ./getfile | |
4633a7c4 | 2809 | installsitearch="$ans" |
8e07c86e | 2810 | else |
4633a7c4 | 2811 | installsitearch="$sitearchexp" |
8e07c86e AD |
2812 | fi |
2813 | ||
4633a7c4 LW |
2814 | : determine where old public architecture dependent libraries might be |
2815 | case "$oldarchlib" in | |
2816 | '') case "$privlib" in | |
2817 | '') ;; | |
2818 | *) dflt="$privlib/$archname" | |
8e07c86e | 2819 | ;; |
8e07c86e AD |
2820 | esac |
2821 | ;; | |
4633a7c4 LW |
2822 | *) dflt="$oldarchlib" |
2823 | ;; | |
8e07c86e | 2824 | esac |
4633a7c4 LW |
2825 | if $test ! -d "$dflt/auto"; then |
2826 | dflt=none | |
2827 | fi | |
8e07c86e AD |
2828 | cat <<EOM |
2829 | ||
760ac839 | 2830 | In 5.001, Perl stored architecture-dependent library files in a directory |
4633a7c4 LW |
2831 | with a name such as $privlib/$archname, |
2832 | and this directory contained files from the standard extensions and | |
2833 | files from any additional extensions you might have added. Starting | |
2834 | with version 5.002, all the architecture-dependent standard extensions | |
760ac839 LW |
2835 | will go into a version-specific directory such as |
2836 | $archlib, | |
4633a7c4 LW |
2837 | while locally-added extensions will go into |
2838 | $sitearch. | |
2839 | ||
2840 | If you wish Perl to continue to search the old architecture-dependent | |
2841 | library for your local extensions, give the path to that directory. | |
2842 | If you do not wish to use your old architecture-dependent library | |
2843 | files, answer 'none'. | |
8e07c86e AD |
2844 | |
2845 | EOM | |
4633a7c4 LW |
2846 | fn=dn~ |
2847 | rp='Directory for your old 5.001 architecture-dependent libraries?' | |
8e07c86e | 2848 | . ./getfile |
4633a7c4 LW |
2849 | oldarchlib="$ans" |
2850 | oldarchlibexp="$ansexp" | |
2851 | case "$oldarchlib" in | |
2852 | ''|' ') val="$undef" ;; | |
2853 | *) val="$define" ;; | |
2854 | esac | |
2855 | set d_oldarchlib | |
2856 | eval $setvar | |
8e07c86e | 2857 | |
4633a7c4 LW |
2858 | : determine where public executables go |
2859 | echo " " | |
2860 | set dflt bin bin | |
2861 | eval $prefixit | |
2862 | fn=d~ | |
2863 | rp='Pathname where the public executables will reside?' | |
2864 | . ./getfile | |
2865 | if $test "X$ansexp" != "X$binexp"; then | |
2866 | installbin='' | |
2867 | fi | |
2868 | bin="$ans" | |
2869 | binexp="$ansexp" | |
8e07c86e AD |
2870 | if $afs; then |
2871 | $cat <<EOM | |
2872 | ||
2873 | Since you are running AFS, I need to distinguish the directory in which | |
4633a7c4 | 2874 | executables reside from the directory in which they are installed (and from |
8e07c86e AD |
2875 | which they are presumably copied to the former directory by occult means). |
2876 | ||
2877 | EOM | |
4633a7c4 LW |
2878 | case "$installbin" in |
2879 | '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;; | |
2880 | *) dflt="$installbin";; | |
8e07c86e AD |
2881 | esac |
2882 | fn=de~ | |
4633a7c4 | 2883 | rp='Where will public executables be installed?' |
8e07c86e | 2884 | . ./getfile |
4633a7c4 | 2885 | installbin="$ans" |
8e07c86e | 2886 | else |
4633a7c4 | 2887 | installbin="$binexp" |
8e07c86e AD |
2888 | fi |
2889 | ||
2c7991dc | 2890 | : determine where manual pages are on this system |
2891 | echo " " | |
2892 | case "$sysman" in | |
2893 | '') | |
2894 | syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1' | |
2895 | syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1" | |
2896 | syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1" | |
2897 | syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1" | |
2898 | syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1" | |
2899 | sysman=`./loc . /usr/man/man1 $syspath` | |
2900 | ;; | |
2901 | esac | |
2902 | if $test -d "$sysman"; then | |
2903 | echo "System manual is in $sysman." >&4 | |
2904 | else | |
2905 | echo "Could not find manual pages in source form." >&4 | |
2906 | fi | |
2907 | ||
2afac517 | 2908 | : see what memory models we can support |
2909 | case "$models" in | |
2910 | '') | |
2911 | $cat >pdp11.c <<'EOP' | |
2912 | main() { | |
2913 | #ifdef pdp11 | |
2914 | exit(0); | |
2915 | #else | |
2916 | exit(1); | |
2917 | #endif | |
2918 | } | |
2919 | EOP | |
2920 | cc -o pdp11 pdp11.c >/dev/null 2>&1 | |
2921 | if ./pdp11 2>/dev/null; then | |
2922 | dflt='unsplit split' | |
2923 | else | |
2924 | tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` | |
2925 | case "$tans" in | |
2926 | X) dflt='none';; | |
2927 | *) if $test -d /lib/small || $test -d /usr/lib/small; then | |
2928 | dflt='small' | |
2929 | else | |
2930 | dflt='' | |
2931 | fi | |
2932 | if $test -d /lib/medium || $test -d /usr/lib/medium; then | |
2933 | dflt="$dflt medium" | |
2934 | fi | |
2935 | if $test -d /lib/large || $test -d /usr/lib/large; then | |
2936 | dflt="$dflt large" | |
2937 | fi | |
2938 | if $test -d /lib/huge || $test -d /usr/lib/huge; then | |
2939 | dflt="$dflt huge" | |
2940 | fi | |
2941 | esac | |
2942 | fi;; | |
2943 | *) dflt="$models";; | |
2944 | esac | |
8e07c86e | 2945 | $cat <<EOM |
2afac517 | 2946 | |
2947 | Some systems have different model sizes. On most systems they are called | |
2948 | small, medium, large, and huge. On the PDP11 they are called unsplit and | |
2949 | split. If your system doesn't support different memory models, say "none". | |
2950 | If you wish to force everything to one memory model, say "none" here and | |
2951 | put the appropriate flags later when it asks you for other cc and ld flags. | |
2952 | Venix systems may wish to put "none" and let the compiler figure things out. | |
2953 | (In the following question multiple model names should be space separated.) | |
8e07c86e | 2954 | |
8e07c86e | 2955 | EOM |
2afac517 | 2956 | rp="Which memory models are supported?" |
2957 | . ./myread | |
2958 | models="$ans" | |
2959 | ||
2960 | case "$models" in | |
2961 | none) | |
2962 | small='' | |
2963 | medium='' | |
2964 | large='' | |
2965 | huge='' | |
2966 | unsplit='' | |
2967 | split='' | |
2c7991dc | 2968 | ;; |
2afac517 | 2969 | *split) |
2970 | case "$split" in | |
2971 | '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \ | |
2972 | $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then | |
2973 | dflt='-i' | |
2974 | else | |
2975 | dflt='none' | |
2976 | fi;; | |
2977 | *) dflt="$split";; | |
2978 | esac | |
2979 | rp="What flag indicates separate I and D space?" | |
2980 | . ./myread | |
2981 | tans="$ans" | |
2982 | case "$tans" in | |
2983 | none) tans='';; | |
2984 | esac | |
2985 | split="$tans" | |
2986 | unsplit='';; | |
2987 | *large*|*small*|*medium*|*huge*) | |
2988 | case "$models" in | |
2989 | *large*) | |
2990 | case "$large" in | |
2991 | '') dflt='-Ml';; | |
2992 | *) dflt="$large";; | |
2993 | esac | |
2994 | rp="What flag indicates large model?" | |
2995 | . ./myread | |
2996 | tans="$ans" | |
2997 | case "$tans" in | |
2998 | none) tans=''; | |
2999 | esac | |
3000 | large="$tans";; | |
3001 | *) large='';; | |
3002 | esac | |
3003 | case "$models" in | |
3004 | *huge*) case "$huge" in | |
3005 | '') dflt='-Mh';; | |
3006 | *) dflt="$huge";; | |
3007 | esac | |
3008 | rp="What flag indicates huge model?" | |
3009 | . ./myread | |
3010 | tans="$ans" | |
3011 | case "$tans" in | |
3012 | none) tans=''; | |
3013 | esac | |
3014 | huge="$tans";; | |
3015 | *) huge="$large";; | |
3016 | esac | |
3017 | case "$models" in | |
3018 | *medium*) case "$medium" in | |
3019 | '') dflt='-Mm';; | |
3020 | *) dflt="$medium";; | |
3021 | esac | |
3022 | rp="What flag indicates medium model?" | |
3023 | . ./myread | |
3024 | tans="$ans" | |
3025 | case "$tans" in | |
3026 | none) tans=''; | |
3027 | esac | |
3028 | medium="$tans";; | |
3029 | *) medium="$large";; | |
3030 | esac | |
3031 | case "$models" in | |
3032 | *small*) case "$small" in | |
3033 | '') dflt='none';; | |
3034 | *) dflt="$small";; | |
3035 | esac | |
3036 | rp="What flag indicates small model?" | |
3037 | . ./myread | |
3038 | tans="$ans" | |
3039 | case "$tans" in | |
3040 | none) tans=''; | |
3041 | esac | |
3042 | small="$tans";; | |
3043 | *) small='';; | |
25f94b33 | 3044 | esac |
8e07c86e | 3045 | ;; |
2afac517 | 3046 | *) |
3047 | echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4 | |
8e07c86e AD |
3048 | ;; |
3049 | esac | |
8e07c86e | 3050 | |
2afac517 | 3051 | : see if we need a special compiler |
3052 | echo " " | |
3053 | if ./usg; then | |
3054 | case "$cc" in | |
3055 | '') case "$Mcc" in | |
3056 | /*) dflt='Mcc';; | |
3057 | *) case "$large" in | |
3058 | -M*) dflt='cc';; | |
3059 | *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then | |
3060 | if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then | |
3061 | dflt='cc' | |
3062 | else | |
3063 | dflt='cc -M' | |
3064 | fi | |
3065 | else | |
3066 | dflt='cc' | |
3067 | fi;; | |
3068 | esac;; | |
3069 | esac;; | |
3070 | *) dflt="$cc";; | |
3071 | esac | |
3072 | $cat <<'EOM' | |
3073 | On some systems the default C compiler will not resolve multiple global | |
3074 | references that happen to have the same name. On some such systems the "Mcc" | |
3075 | command may be used to force these to be resolved. On other systems a "cc -M" | |
3076 | command is required. (Note that the -M flag on other systems indicates a | |
3077 | memory model to use!) If you have the Gnu C compiler, you might wish to use | |
3078 | that instead. | |
8e07c86e AD |
3079 | |
3080 | EOM | |
2afac517 | 3081 | rp="What command will force resolution on this system?" |
3082 | . ./myread | |
3083 | cc="$ans" | |
8e07c86e | 3084 | else |
2afac517 | 3085 | case "$cc" in |
3086 | '') dflt=cc;; | |
3087 | *) dflt="$cc";; | |
3088 | esac | |
3089 | rp="Use which C compiler?" | |
3090 | . ./myread | |
3091 | cc="$ans" | |
8e07c86e | 3092 | fi |
2afac517 | 3093 | echo " " |
3094 | echo "Checking for GNU cc in disguise and/or its version number..." >&4 | |
3095 | $cat >gccvers.c <<EOM | |
3096 | #include <stdio.h> | |
3097 | int main() { | |
3098 | #ifdef __GNUC__ | |
3099 | #ifdef __VERSION__ | |
3100 | printf("%s\n", __VERSION__); | |
3101 | #else | |
3102 | printf("%s\n", "1"); | |
3103 | #endif | |
3104 | #endif | |
3105 | exit(0); | |
3106 | } | |
3107 | EOM | |
3108 | if $cc -o gccvers gccvers.c >/dev/null 2>&1; then | |
3109 | gccversion=`./gccvers` | |
3110 | case "$gccversion" in | |
3111 | '') echo "You are not using GNU cc." ;; | |
3112 | *) echo "You are using GNU cc $gccversion." ;; | |
3113 | esac | |
3114 | else | |
3115 | echo " " | |
3116 | echo "*** WHOA THERE!!! ***" >&4 | |
3117 | echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4 | |
3118 | case "$knowitall" in | |
3119 | '') | |
3120 | echo " You'd better start hunting for one and let me know about it." >&4 | |
3121 | exit 1 | |
2c7991dc | 3122 | ;; |
8e07c86e | 3123 | esac |
2afac517 | 3124 | fi |
3125 | $rm -f gccvers* | |
3126 | case "$gccversion" in | |
3127 | 1*) cpp=`./loc gcc-cpp $cpp $pth` ;; | |
8e07c86e AD |
3128 | esac |
3129 | ||
2afac517 | 3130 | : What should the include directory be ? |
8e07c86e | 3131 | echo " " |
2afac517 | 3132 | $echo $n "Hmm... $c" |
3133 | dflt='/usr/include' | |
3134 | incpath='' | |
3135 | mips_type='' | |
3136 | if $test -f /bin/mips && /bin/mips; then | |
3137 | echo "Looks like a MIPS system..." | |
3138 | $cat >usr.c <<'EOCP' | |
3139 | #ifdef SYSTYPE_BSD43 | |
3140 | /bsd43 | |
3141 | #endif | |
3142 | EOCP | |
3143 | if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then | |
3144 | dflt='/bsd43/usr/include' | |
3145 | incpath='/bsd43' | |
3146 | mips_type='BSD 4.3' | |
8e07c86e | 3147 | else |
2afac517 | 3148 | mips_type='System V' |
8e07c86e | 3149 | fi |
2afac517 | 3150 | $rm -f usr.c usr.out |
3151 | echo "and you're compiling with the $mips_type compiler and libraries." | |
3152 | xxx_prompt=y | |
3153 | echo "exit 0" >mips | |
8e07c86e | 3154 | else |
2afac517 | 3155 | echo "Doesn't look like a MIPS system." |
3156 | xxx_prompt=n | |
3157 | echo "exit 1" >mips | |
3158 | fi | |
3159 | chmod +x mips | |
3160 | $eunicefix mips | |
3161 | echo " " | |
3162 | case "$usrinc" in | |
3163 | '') ;; | |
3164 | *) dflt="$usrinc";; | |
3165 | esac | |
3166 | case "$xxx_prompt" in | |
3167 | y) fn=d/ | |
3168 | rp='Where are the include files you want to use?' | |
3169 | . ./getfile | |
3170 | usrinc="$ans" | |
3171 | ;; | |
3172 | *) usrinc="$dflt" | |
3173 | ;; | |
3174 | esac | |
8e07c86e | 3175 | |
2afac517 | 3176 | : Set private lib path |
3177 | case "$plibpth" in | |
3178 | '') if ./mips; then | |
3179 | plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib" | |
3180 | fi;; | |
3181 | esac | |
3182 | case "$libpth" in | |
3183 | ' ') dlist='';; | |
3184 | '') dlist="$loclibpth $plibpth $glibpth";; | |
3185 | *) dlist="$libpth";; | |
3186 | esac | |
8e07c86e | 3187 | |
2afac517 | 3188 | : Now check and see which directories actually exist, avoiding duplicates |
3189 | libpth='' | |
3190 | for xxx in $dlist | |
3191 | do | |
3192 | if $test -d $xxx; then | |
3193 | case " $libpth " in | |
3194 | *" $xxx "*) ;; | |
3195 | *) libpth="$libpth $xxx";; | |
3196 | esac | |
3197 | fi | |
3198 | done | |
3199 | $cat <<'EOM' | |
8e07c86e | 3200 | |
2afac517 | 3201 | Some systems have incompatible or broken versions of libraries. Among |
3202 | the directories listed in the question below, please remove any you | |
3203 | know not to be holding relevant libraries, and add any that are needed. | |
3204 | Say "none" for none. | |
8e07c86e | 3205 | |
8e07c86e | 3206 | EOM |
2afac517 | 3207 | case "$libpth" in |
3208 | '') dflt='none';; | |
3209 | *) | |
3210 | set X $libpth | |
3211 | shift | |
3212 | dflt=${1+"$@"} | |
4633a7c4 | 3213 | ;; |
8e07c86e | 3214 | esac |
2afac517 | 3215 | rp="Directories to use for library searches?" |
3216 | . ./myread | |
3217 | case "$ans" in | |
3218 | none) libpth=' ';; | |
3219 | *) libpth="$ans";; | |
3220 | esac | |
8e07c86e | 3221 | |
2afac517 | 3222 | : compute shared library extension |
3223 | case "$so" in | |
3224 | '') | |
3225 | if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then | |
3226 | dflt='sl' | |
3227 | else | |
3228 | dflt='so' | |
3229 | fi | |
3230 | ;; | |
3231 | *) dflt="$so";; | |
8e07c86e | 3232 | esac |
2afac517 | 3233 | $cat <<EOM |
8e07c86e | 3234 | |
2afac517 | 3235 | On some systems, shared libraries may be available. Answer 'none' if |
3236 | you want to suppress searching of shared libraries for the remaining | |
3237 | of this configuration. | |
8e07c86e AD |
3238 | |
3239 | EOM | |
2afac517 | 3240 | rp='What is the file extension used for shared libraries?' |
3241 | . ./myread | |
3242 | so="$ans" | |
8e07c86e | 3243 | |
ff68c719 | 3244 | : If no lib_ext yet, assume '.a'. |
3245 | case "$lib_ext" in | |
3246 | '') lib_ext='.a';; | |
3247 | esac | |
3248 | ||
2afac517 | 3249 | : Looking for optional libraries |
3250 | echo " " | |
3251 | echo "Checking for optional libraries..." >&4 | |
3252 | case "$libs" in | |
3253 | ' '|'') dflt='';; | |
3254 | *) dflt="$libs";; | |
8e07c86e | 3255 | esac |
2afac517 | 3256 | case "$libswanted" in |
3257 | '') libswanted='c_s';; | |
3258 | esac | |
3259 | for thislib in $libswanted; do | |
3260 | ||
3261 | if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then | |
3262 | echo "Found -l$thislib (shared)." | |
3263 | case " $dflt " in | |
3264 | *"-l$thislib "*);; | |
3265 | *) dflt="$dflt -l$thislib";; | |
4633a7c4 | 3266 | esac |
2afac517 | 3267 | elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then |
3268 | echo "Found -l$thislib (shared)." | |
3269 | case " $dflt " in | |
3270 | *"-l$thislib "*);; | |
3271 | *) dflt="$dflt -l$thislib";; | |
3272 | esac | |
ff68c719 | 3273 | elif xxx=`./loc lib$thislib${lib_ext} X $libpth`; $test -f "$xxx"; then |
2afac517 | 3274 | echo "Found -l$thislib." |
3275 | case " $dflt " in | |
3276 | *"-l$thislib "*);; | |
3277 | *) dflt="$dflt -l$thislib";; | |
3278 | esac | |
ff68c719 | 3279 | elif xxx=`./loc $thislib${lib_ext} X $libpth`; $test -f "$xxx"; then |
2afac517 | 3280 | echo "Found -l$thislib." |
3281 | case " $dflt " in | |
3282 | *"-l$thislib "*);; | |
3283 | *) dflt="$dflt -l$thislib";; | |
3284 | esac | |
ff68c719 | 3285 | elif xxx=`./loc lib${thislib}_s${lib_ext} X $libpth`; $test -f "$xxx"; then |
2afac517 | 3286 | echo "Found -l${thislib}_s." |
3287 | case " $dflt " in | |
3288 | *"-l$thislib "*);; | |
3289 | *) dflt="$dflt -l${thislib}_s";; | |
3290 | esac | |
ff68c719 | 3291 | elif xxx=`./loc Slib$thislib${lib_ext} X $xlibpth`; $test -f "$xxx"; then |
2afac517 | 3292 | echo "Found -l$thislib." |
3293 | case " $dflt " in | |
3294 | *"-l$thislib "*);; | |
3295 | *) dflt="$dflt -l$thislib";; | |
3296 | esac | |
3297 | else | |
3298 | echo "No -l$thislib." | |
3299 | fi | |
3300 | done | |
3301 | set X $dflt | |
3302 | shift | |
3303 | dflt="$*" | |
3304 | case "$libs" in | |
3305 | '') dflt="$dflt";; | |
3306 | *) dflt="$libs";; | |
3307 | esac | |
3308 | case "$dflt" in | |
3309 | ' '|'') dflt='none';; | |
8e07c86e | 3310 | esac |
2afac517 | 3311 | |
4633a7c4 LW |
3312 | $cat <<EOM |
3313 | ||
2afac517 | 3314 | Some versions of Unix support shared libraries, which make executables smaller |
3315 | but make load time slightly longer. | |
8e07c86e | 3316 | |
2afac517 | 3317 | On some systems, mostly System V Release 3's, the shared library is included |
3318 | by putting the option "-lc_s" as the last thing on the cc command line when | |
3319 | linking. Other systems use shared libraries by default. There may be other | |
3320 | libraries needed to compile $package on your machine as well. If your system | |
3321 | needs the "-lc_s" option, include it here. Include any other special libraries | |
3322 | here as well. Say "none" for none. | |
4633a7c4 | 3323 | EOM |
2afac517 | 3324 | |
3325 | echo " " | |
3326 | rp="Any additional libraries?" | |
8e07c86e | 3327 | . ./myread |
2afac517 | 3328 | case "$ans" in |
3329 | none) libs=' ';; | |
3330 | *) libs="$ans";; | |
3331 | esac | |
8e07c86e | 3332 | |
4633a7c4 | 3333 | : see how we invoke the C preprocessor |
2304df62 | 3334 | echo " " |
4633a7c4 LW |
3335 | echo "Now, how can we feed standard input to your C preprocessor..." >&4 |
3336 | cat <<'EOT' >testcpp.c | |
3337 | #define ABC abc | |
3338 | #define XYZ xyz | |
3339 | ABC.XYZ | |
3340 | EOT | |
3341 | cd .. | |
3342 | echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin | |
3343 | chmod 755 cppstdin | |
3344 | wrapper=`pwd`/cppstdin | |
3345 | ok='false' | |
3346 | cd UU | |
3347 | ||
3348 | if $test "X$cppstdin" != "X" && \ | |
3349 | $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \ | |
3350 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
3351 | then | |
3352 | echo "You used to use $cppstdin $cppminus so we'll use that again." | |
3353 | case "$cpprun" in | |
3354 | '') echo "But let's see if we can live without a wrapper..." ;; | |
3355 | *) | |
3356 | if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \ | |
3357 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
3358 | then | |
3359 | echo "(And we'll use $cpprun $cpplast to preprocess directly.)" | |
3360 | ok='true' | |
a0d0e21e | 3361 | else |
4633a7c4 | 3362 | echo "(However, $cpprun $cpplast does not work, let's see...)" |
2304df62 | 3363 | fi |
2304df62 | 3364 | ;; |
2304df62 | 3365 | esac |
4633a7c4 LW |
3366 | else |
3367 | case "$cppstdin" in | |
3368 | '') ;; | |
3369 | *) | |
3370 | echo "Good old $cppstdin $cppminus does not seem to be of any help..." | |
3371 | ;; | |
3372 | esac | |
3373 | fi | |
3374 | ||
3375 | if $ok; then | |
3376 | : nothing | |
3377 | elif echo 'Maybe "'"$cc"' -E" will work...'; \ | |
3378 | $cc -E <testcpp.c >testcpp.out 2>&1; \ | |
3379 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3380 | echo "Yup, it does." | |
3381 | x_cpp="$cc -E" | |
3382 | x_minus=''; | |
3383 | elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \ | |
3384 | $cc -E - <testcpp.c >testcpp.out 2>&1; \ | |
3385 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3386 | echo "Yup, it does." | |
3387 | x_cpp="$cc -E" | |
3388 | x_minus='-'; | |
3389 | elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \ | |
3390 | $cc -P <testcpp.c >testcpp.out 2>&1; \ | |
3391 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3392 | echo "Yipee, that works!" | |
3393 | x_cpp="$cc -P" | |
3394 | x_minus=''; | |
3395 | elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \ | |
3396 | $cc -P - <testcpp.c >testcpp.out 2>&1; \ | |
3397 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3398 | echo "At long last!" | |
3399 | x_cpp="$cc -P" | |
3400 | x_minus='-'; | |
3401 | elif echo 'No such luck, maybe "'$cpp'" will work...'; \ | |
3402 | $cpp <testcpp.c >testcpp.out 2>&1; \ | |
3403 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3404 | echo "It works!" | |
3405 | x_cpp="$cpp" | |
3406 | x_minus=''; | |
3407 | elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \ | |
3408 | $cpp - <testcpp.c >testcpp.out 2>&1; \ | |
3409 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3410 | echo "Hooray, it works! I was beginning to wonder." | |
3411 | x_cpp="$cpp" | |
3412 | x_minus='-'; | |
3413 | elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \ | |
3414 | $wrapper <testcpp.c >testcpp.out 2>&1; \ | |
3415 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3416 | x_cpp="$wrapper" | |
3417 | x_minus='' | |
3418 | echo "Eureka!" | |
3419 | else | |
3420 | dflt='' | |
3421 | rp="No dice. I can't find a C preprocessor. Name one:" | |
3422 | . ./myread | |
3423 | x_cpp="$ans" | |
3424 | x_minus='' | |
3425 | $x_cpp <testcpp.c >testcpp.out 2>&1 | |
3426 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3427 | echo "OK, that will do." >&4 | |
3428 | else | |
3429 | echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4 | |
3430 | exit 1 | |
3431 | fi | |
3432 | fi | |
3433 | ||
3434 | case "$ok" in | |
3435 | false) | |
3436 | cppstdin="$x_cpp" | |
3437 | cppminus="$x_minus" | |
3438 | cpprun="$x_cpp" | |
3439 | cpplast="$x_minus" | |
3440 | set X $x_cpp | |
3441 | shift | |
3442 | case "$1" in | |
3443 | "$cpp") | |
3444 | echo "Perhaps can we force $cc -E using a wrapper..." | |
3445 | if $wrapper <testcpp.c >testcpp.out 2>&1; \ | |
3446 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
3447 | then | |
3448 | echo "Yup, we can." | |
3449 | cppstdin="$wrapper" | |
3450 | cppminus=''; | |
3451 | else | |
3452 | echo "Nope, we'll have to live without it..." | |
3453 | fi | |
3454 | ;; | |
3455 | esac | |
3456 | case "$cpprun" in | |
3457 | "$wrapper") | |
3458 | cpprun='' | |
3459 | cpplast='' | |
3460 | ;; | |
3461 | esac | |
3462 | ;; | |
3463 | esac | |
3464 | ||
3465 | case "$cppstdin" in | |
3466 | "$wrapper") ;; | |
3467 | *) $rm -f $wrapper;; | |
3468 | esac | |
3469 | $rm -f testcpp.c testcpp.out | |
3470 | ||
2afac517 | 3471 | : determine optimize, if desired, or use for debug flag also |
3472 | case "$optimize" in | |
3473 | ' ') dflt='none';; | |
3474 | '') dflt='-O';; | |
3475 | *) dflt="$optimize";; | |
4633a7c4 | 3476 | esac |
2afac517 | 3477 | $cat <<EOH |
4633a7c4 | 3478 | |
760ac839 | 3479 | Some C compilers have problems with their optimizers. By default, $package |
4633a7c4 LW |
3480 | compiles with the -O flag to use the optimizer. Alternately, you might want |
3481 | to use the symbolic debugger, which uses the -g flag (on traditional Unix | |
3482 | systems). Either flag can be specified here. To use neither flag, specify | |
3483 | the word "none". | |
3484 | ||
3485 | EOH | |
3486 | rp="What optimizer/debugger flag should be used?" | |
3487 | . ./myread | |
3488 | optimize="$ans" | |
3489 | case "$optimize" in | |
3490 | 'none') optimize=" ";; | |
3491 | esac | |
3492 | ||
3493 | dflt='' | |
25f94b33 AD |
3494 | : We will not override a previous value, but we might want to |
3495 | : augment a hint file | |
3496 | case "$hint" in | |
3497 | none|recommended) | |
4633a7c4 LW |
3498 | case "$gccversion" in |
3499 | 1*) dflt='-fpcc-struct-return' ;; | |
3500 | esac | |
3501 | case "$optimize" in | |
3502 | *-g*) dflt="$dflt -DDEBUGGING";; | |
3503 | esac | |
3504 | case "$gccversion" in | |
3505 | 2*) if test -d /etc/conf/kconfig.d && | |
3506 | $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1 | |
3507 | then | |
3508 | dflt="$dflt -posix" | |
3509 | fi | |
3510 | ;; | |
3511 | esac | |
3512 | ;; | |
3513 | esac | |
3514 | ||
a4f3eea9 | 3515 | case "$mips_type" in |
3516 | *BSD*|'') inclwanted="$locincpth $usrinc";; | |
3517 | *) inclwanted="$locincpth $inclwanted $usrinc/bsd";; | |
3518 | esac | |
3519 | for thisincl in $inclwanted; do | |
3520 | if $test -d $thisincl; then | |
3521 | if $test x$thisincl != x$usrinc; then | |
3522 | case "$dflt" in | |
3523 | *$thisincl*);; | |
3524 | *) dflt="$dflt -I$thisincl";; | |
3525 | esac | |
3526 | fi | |
3527 | fi | |
3528 | done | |
3529 | ||
3530 | inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then | |
3531 | xxx=true; | |
3532 | elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then | |
3533 | xxx=true; | |
3534 | else | |
3535 | xxx=false; | |
3536 | fi; | |
3537 | if $xxx; then | |
3538 | case "$dflt" in | |
3539 | *$2*);; | |
3540 | *) dflt="$dflt -D$2";; | |
3541 | esac; | |
3542 | fi' | |
3543 | ||
3544 | if ./osf1; then | |
3545 | set signal.h __LANGUAGE_C__; eval $inctest | |
3546 | else | |
3547 | set signal.h LANGUAGE_C; eval $inctest | |
3548 | fi | |
3549 | set signal.h NO_PROTOTYPE; eval $inctest | |
3550 | set signal.h _NO_PROTO; eval $inctest | |
3551 | ||
3552 | case "$hint" in | |
3553 | none|recommended) dflt="$ccflags $dflt" ;; | |
3554 | *) dflt="$ccflags";; | |
3555 | esac | |
3556 | ||
3557 | case "$dflt" in | |
3558 | ''|' ') dflt=none;; | |
3559 | esac | |
3560 | $cat <<EOH | |
3561 | ||
3562 | Your C compiler may want other flags. For this question you should include | |
3563 | -I/whatever and -DWHATEVER flags and any other flags used by the C compiler, | |
3564 | but you should NOT include libraries or ld flags like -lwhatever. If you | |
3565 | want $package to honor its debug switch, you should include -DDEBUGGING here. | |
3566 | Your C compiler might also need additional flags, such as -D_POSIX_SOURCE, | |
3567 | -DHIDEMYMALLOC or -DCRIPPLED_CC. | |
3568 | ||
3569 | To use no flags, specify the word "none". | |
3570 | ||
3571 | EOH | |
3572 | set X $dflt | |
3573 | shift | |
3574 | dflt=${1+"$@"} | |
3575 | rp="Any additional cc flags?" | |
3576 | . ./myread | |
3577 | case "$ans" in | |
3578 | none) ccflags='';; | |
3579 | *) ccflags="$ans";; | |
3580 | esac | |
3581 | ||
3582 | : the following weeds options from ccflags that are of no interest to cpp | |
3583 | cppflags="$ccflags" | |
3584 | case "$gccversion" in | |
3585 | 1*) cppflags="$cppflags -D__GNUC__" | |
3586 | esac | |
3587 | case "$mips_type" in | |
3588 | '');; | |
3589 | *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";; | |
3590 | esac | |
3591 | case "$cppflags" in | |
3592 | '');; | |
3593 | *) | |
3594 | echo " " | |
3595 | echo "Let me guess what the preprocessor flags are..." >&4 | |
3596 | set X $cppflags | |
3597 | shift | |
3598 | cppflags='' | |
3599 | $cat >cpp.c <<'EOM' | |
3600 | #define BLURFL foo | |
3601 | ||
3602 | BLURFL xx LFRULB | |
3603 | EOM | |
3604 | previous='' | |
3605 | for flag in $* | |
3606 | do | |
3607 | case "$flag" in | |
3608 | -*) ftry="$flag";; | |
3609 | *) ftry="$previous $flag";; | |
3610 | esac | |
3611 | if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \ | |
3612 | >cpp1.out 2>/dev/null && \ | |
3613 | $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \ | |
3614 | >cpp2.out 2>/dev/null && \ | |
3615 | $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \ | |
3616 | $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1 | |
3617 | then | |
3618 | cppflags="$cppflags $ftry" | |
3619 | previous='' | |
3620 | else | |
3621 | previous="$flag" | |
3622 | fi | |
3623 | done | |
3624 | set X $cppflags | |
3625 | shift | |
3626 | cppflags=${1+"$@"} | |
3627 | case "$cppflags" in | |
3628 | *-*) echo "They appear to be: $cppflags";; | |
3629 | esac | |
3630 | $rm -f cpp.c cpp?.out | |
3631 | ;; | |
3632 | esac | |
3633 | ||
3634 | : flags used in final linking phase | |
3635 | ||
3636 | case "$ldflags" in | |
3637 | '') if ./venix; then | |
3638 | dflt='-i -z' | |
3639 | else | |
3640 | dflt='' | |
3641 | fi | |
3642 | case "$ccflags" in | |
3643 | *-posix*) dflt="$dflt -posix" ;; | |
3644 | esac | |
3645 | ;; | |
3646 | *) dflt="$ldflags";; | |
3647 | esac | |
3648 | ||
3649 | : Try to guess additional flags to pick up local libraries. | |
3650 | for thislibdir in $libpth; do | |
3651 | case " $loclibpth " in | |
3652 | *" $thislibdir "*) | |
3653 | case "$dflt " in | |
3654 | *"-L$thislibdir "*) ;; | |
3655 | *) dflt="$dflt -L$thislibdir" ;; | |
3656 | esac | |
3657 | ;; | |
3658 | esac | |
3659 | done | |
3660 | ||
3661 | case "$dflt" in | |
3662 | '') dflt='none' ;; | |
3663 | esac | |
3664 | ||
3665 | $cat <<EOH | |
3666 | ||
3667 | Your C linker may need flags. For this question you should | |
3668 | include -L/whatever and any other flags used by the C linker, but you | |
3669 | should NOT include libraries like -lwhatever. | |
3670 | ||
3671 | Make sure you include the appropriate -L/path flags if your C linker | |
3672 | does not normally search all of the directories you specified above, | |
3673 | namely | |
3674 | $libpth | |
3675 | To use no flags, specify the word "none". | |
3676 | ||
3677 | EOH | |
3678 | ||
3679 | rp="Any additional ld flags (NOT including libraries)?" | |
3680 | . ./myread | |
3681 | case "$ans" in | |
3682 | none) ldflags='';; | |
3683 | *) ldflags="$ans";; | |
3684 | esac | |
3685 | rmlist="$rmlist pdp11" | |
3686 | ||
3687 | : coherency check | |
3688 | echo " " | |
3689 | echo "Checking your choice of C compiler and flags for coherency..." >&4 | |
3690 | set X $cc $optimize $ccflags $ldflags try.c -o try | |
3691 | shift | |
3692 | $cat >try.msg <<EOM | |
3693 | I've tried to compile and run a simple program with: | |
3694 | ||
3695 | $* | |
3696 | ./try | |
3697 | ||
3698 | and I got the following output: | |
3699 | ||
3700 | EOM | |
3701 | $cat > try.c <<'EOF' | |
3702 | #include <stdio.h> | |
3703 | main() { exit(0); } | |
3704 | EOF | |
3705 | dflt=y | |
3706 | if sh -c "$cc $optimize $ccflags try.c -o try $ldflags" >>try.msg 2>&1; then | |
3707 | if sh -c './try' >>try.msg 2>&1; then | |
3708 | dflt=n | |
3709 | else | |
3710 | echo "The program compiled OK, but exited with status $?." >>try.msg | |
3711 | rp="You have a problem. Shall I abort Configure" | |
3712 | dflt=y | |
3713 | fi | |
3714 | else | |
3715 | echo "I can't compile the test program." >>try.msg | |
3716 | rp="You have a BIG problem. Shall I abort Configure" | |
3717 | dflt=y | |
3718 | fi | |
3719 | case "$dflt" in | |
3720 | y) | |
3721 | $cat try.msg | |
3722 | case "$knowitall" in | |
3723 | '') | |
3724 | echo "(The supplied flags might be incorrect with this C compiler.)" | |
3725 | ;; | |
3726 | *) dflt=n;; | |
3727 | esac | |
3728 | echo " " | |
3729 | . ./myread | |
3730 | case "$ans" in | |
3731 | n*|N*) ;; | |
3732 | *) echo "Ok. Stopping Configure." >&4 | |
3733 | exit 1 | |
3734 | ;; | |
3735 | esac | |
3736 | ;; | |
3737 | n) echo "OK, that should do.";; | |
3738 | esac | |
3739 | $rm -f try try.* core | |
3740 | ||
3741 | echo " " | |
3742 | echo "Checking for GNU C Library..." >&4 | |
3743 | cat >gnulibc.c <<EOM | |
3744 | int | |
3745 | main() | |
3746 | { | |
3747 | return __libc_main(); | |
3748 | } | |
3749 | EOM | |
3750 | if $cc $ccflags $ldflags -o gnulibc gnulibc.c $libs >/dev/null 2>&1 && \ | |
3751 | ./gnulibc | $contains '^GNU C Library' >/dev/null 2>&1; then | |
3752 | val="$define" | |
3753 | echo "You are using the GNU C Library" | |
4633a7c4 | 3754 | else |
a4f3eea9 | 3755 | val="$undef" |
3756 | echo "You are not using the GNU C Library" | |
4633a7c4 | 3757 | fi |
a4f3eea9 | 3758 | $rm -f gnulibc* |
3759 | set d_gnulibc | |
3760 | eval $setvar | |
25f94b33 | 3761 | |
a4f3eea9 | 3762 | : see if nm is to be used to determine whether a symbol is defined or not |
3763 | case "$usenm" in | |
3764 | '') | |
3765 | case "$d_gnulibc" in | |
3766 | $define) | |
3767 | dflt=n | |
3768 | ;; | |
3769 | *) | |
3770 | dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null` | |
3771 | if $test $dflt -gt 20; then | |
3772 | dflt=y | |
3773 | else | |
3774 | dflt=n | |
3775 | fi | |
3776 | ;; | |
3777 | esac | |
3778 | ;; | |
3779 | *) | |
3780 | case "$usenm" in | |
3781 | true) dflt=y;; | |
3782 | *) dflt=n;; | |
3783 | esac | |
3784 | ;; | |
25f94b33 | 3785 | esac |
a4f3eea9 | 3786 | $cat <<EOM |
4633a7c4 | 3787 | |
a4f3eea9 | 3788 | I can use 'nm' to extract the symbols from your C libraries. This is a time |
3789 | consuming task which may generate huge output on the disk (up to 3 megabytes) | |
3790 | but that should make the symbols extraction faster. The alternative is to skip | |
3791 | the 'nm' extraction part and to compile a small test program instead to | |
3792 | determine whether each symbol is present. If you have a fast C compiler and/or | |
3793 | if your 'nm' output cannot be parsed, this may be the best solution. | |
3794 | You shouldn't let me use 'nm' if you have the GNU C Library. | |
4633a7c4 | 3795 | |
a4f3eea9 | 3796 | EOM |
3797 | rp='Shall I use nm to extract C symbols from the libraries?' | |
4633a7c4 LW |
3798 | . ./myread |
3799 | case "$ans" in | |
a4f3eea9 | 3800 | n|N) usenm=false;; |
3801 | *) usenm=true;; | |
4633a7c4 LW |
3802 | esac |
3803 | ||
a4f3eea9 | 3804 | runnm=$usenm |
3805 | case "$reuseval" in | |
3806 | true) runnm=false;; | |
4633a7c4 | 3807 | esac |
a4f3eea9 | 3808 | |
3809 | : nm options which may be necessary | |
3810 | case "$nm_opt" in | |
3811 | '') if $test -f /mach_boot; then | |
3812 | nm_opt='' | |
3813 | elif $test -d /usr/ccs/lib; then | |
3814 | nm_opt='-p' | |
3815 | elif $test -f /dgux; then | |
3816 | nm_opt='-p' | |
3817 | else | |
3818 | nm_opt='' | |
3819 | fi;; | |
4633a7c4 | 3820 | esac |
4633a7c4 | 3821 | |
a4f3eea9 | 3822 | : nm options which may be necessary for shared libraries but illegal |
3823 | : for archive libraries. Thank you, Linux. | |
3824 | case "$nm_so_opt" in | |
3825 | '') case "$myuname" in | |
3826 | *linux*) | |
3827 | if nm --help | $grep 'dynamic' > /dev/null 2>&1; then | |
3828 | nm_so_opt='--dynamic' | |
4633a7c4 | 3829 | fi |
a4f3eea9 | 3830 | ;; |
4633a7c4 | 3831 | esac |
4633a7c4 LW |
3832 | ;; |
3833 | esac | |
3834 | ||
a4f3eea9 | 3835 | case "$runnm" in |
3836 | true) | |
3837 | : get list of predefined functions in a handy place | |
3838 | echo " " | |
3839 | case "$libc" in | |
3840 | '') libc=unknown | |
3841 | case "$libs" in | |
ff68c719 | 3842 | *-lc_s*) libc=`./loc libc_s${lib_ext} $libc $libpth` |
a4f3eea9 | 3843 | esac |
3844 | ;; | |
3845 | esac | |
3846 | libnames=''; | |
3847 | case "$libs" in | |
3848 | '') ;; | |
3849 | *) for thislib in $libs; do | |
3850 | case "$thislib" in | |
3851 | -lc|-lc_s) | |
3852 | : Handle C library specially below. | |
3853 | ;; | |
3854 | -l*) | |
3855 | thislib=`echo $thislib | $sed -e 's/^-l//'` | |
3856 | if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then | |
3857 | : | |
3858 | elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then | |
3859 | : | |
ff68c719 | 3860 | elif try=`./loc lib$thislib${lib_ext} X $libpth`; $test -f "$try"; then |
3861 | : | |
3862 | elif try=`./loc $thislib${lib_ext} X $libpth`; $test -f "$try"; then | |
a4f3eea9 | 3863 | : |
3864 | elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then | |
3865 | : | |
3866 | elif try=`./loc $thislib X $libpth`; $test -f "$try"; then | |
3867 | : | |
ff68c719 | 3868 | elif try=`./loc Slib$thislib${lib_ext} X $xlibpth`; $test -f "$try"; then |
a4f3eea9 | 3869 | : |
3870 | else | |
3871 | try='' | |
3872 | fi | |
3873 | libnames="$libnames $try" | |
3874 | ;; | |
3875 | *) libnames="$libnames $thislib" ;; | |
3876 | esac | |
3877 | done | |
3878 | ;; | |
3879 | esac | |
3880 | xxx=normal | |
3881 | case "$libc" in | |
3882 | unknown) | |
3883 | set /lib/libc.$so | |
3884 | for xxx in $libpth; do | |
3885 | $test -r $1 || set $xxx/libc.$so | |
3886 | : The messy sed command sorts on library version numbers. | |
3887 | $test -r $1 || \ | |
3888 | set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \ | |
3889 | tr ' ' '\012' | egrep -v '\.[A-Za-z]*$' | $sed -e ' | |
3890 | h | |
3891 | s/[0-9][0-9]*/0000&/g | |
3892 | s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g | |
3893 | G | |
3894 | s/\n/ /' | \ | |
3895 | sort | $sed -e 's/^.* //'` | |
3896 | eval set \$$# | |
3897 | done | |
3898 | $test -r $1 || set /usr/ccs/lib/libc.$so | |
3899 | $test -r $1 || set /lib/libsys_s.a | |
3900 | ;; | |
3901 | *) | |
3902 | set blurfl | |
3903 | ;; | |
3904 | esac | |
3905 | if $test -r "$1"; then | |
3906 | echo "Your (shared) C library seems to be in $1." | |
3907 | libc="$1" | |
3908 | elif $test -r /lib/libc && $test -r /lib/clib; then | |
3909 | echo "Your C library seems to be in both /lib/clib and /lib/libc." | |
3910 | xxx=apollo | |
3911 | libc='/lib/clib /lib/libc' | |
3912 | if $test -r /lib/syslib; then | |
3913 | echo "(Your math library is in /lib/syslib.)" | |
3914 | libc="$libc /lib/syslib" | |
3915 | fi | |
3916 | elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then | |
3917 | echo "Your C library seems to be in $libc, as you said before." | |
ff68c719 | 3918 | elif $test -r $incpath/usr/lib/libc${lib_ext}; then |
3919 | libc=$incpath/usr/lib/libc${lib_ext}; | |
a4f3eea9 | 3920 | echo "Your C library seems to be in $libc. That's fine." |
ff68c719 | 3921 | elif $test -r /lib/libc${lib_ext}; then |
3922 | libc=/lib/libc${lib_ext}; | |
a4f3eea9 | 3923 | echo "Your C library seems to be in $libc. You're normal." |
3924 | else | |
ff68c719 | 3925 | if tans=`./loc libc${lib_ext} blurfl/dyick $libpth`; $test -r "$tans"; then |
a4f3eea9 | 3926 | : |
3927 | elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then | |
3928 | libnames="$libnames "`./loc clib blurfl/dyick $libpth` | |
3929 | elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then | |
3930 | : | |
ff68c719 | 3931 | elif tans=`./loc Slibc${lib_ext} blurfl/dyick $xlibpth`; $test -r "$tans"; then |
a4f3eea9 | 3932 | : |
ff68c719 | 3933 | elif tans=`./loc Mlibc${lib_ext} blurfl/dyick $xlibpth`; $test -r "$tans"; then |
a4f3eea9 | 3934 | : |
4633a7c4 | 3935 | else |
ff68c719 | 3936 | tans=`./loc Llibc${lib_ext} blurfl/dyick $xlibpth` |
4633a7c4 | 3937 | fi |
a4f3eea9 | 3938 | if $test -r "$tans"; then |
3939 | echo "Your C library seems to be in $tans, of all places." | |
3940 | libc=$tans | |
3941 | else | |
3942 | libc='blurfl' | |
3943 | fi | |
3944 | fi | |
3945 | if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then | |
3946 | dflt="$libc" | |
3947 | cat <<EOM | |
4633a7c4 | 3948 | |
a4f3eea9 | 3949 | If the guess above is wrong (which it might be if you're using a strange |
3950 | compiler, or your machine supports multiple models), you can override it here. | |
4633a7c4 | 3951 | |
a4f3eea9 | 3952 | EOM |
3953 | else | |
3954 | dflt='' | |
3955 | echo $libpth | tr ' ' '\012' | sort | uniq > libpath | |
3956 | cat >&4 <<EOM | |
3957 | I can't seem to find your C library. I've looked in the following places: | |
4633a7c4 | 3958 | |
a4f3eea9 | 3959 | EOM |
3960 | $sed 's/^/ /' libpath | |
3961 | cat <<EOM | |
4633a7c4 | 3962 | |
a4f3eea9 | 3963 | None of these seems to contain your C library. I need to get its name... |
4633a7c4 | 3964 | |
a4f3eea9 | 3965 | EOM |
3966 | fi | |
3967 | fn=f | |
3968 | rp='Where is your C library?' | |
3969 | . ./getfile | |
3970 | libc="$ans" | |
4633a7c4 | 3971 | |
4633a7c4 | 3972 | echo " " |
a4f3eea9 | 3973 | echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames |
3974 | set X `cat libnames` | |
4633a7c4 | 3975 | shift |
a4f3eea9 | 3976 | xxx=files |
3977 | case $# in 1) xxx=file; esac | |
3978 | echo "Extracting names from the following $xxx for later perusal:" >&4 | |
3979 | echo " " | |
3980 | $sed 's/^/ /' libnames >&4 | |
3981 | echo " " | |
3982 | $echo $n "This may take a while...$c" >&4 | |
4633a7c4 | 3983 | |
a4f3eea9 | 3984 | : Linux may need the special Dynamic option to nm for shared libraries. |
3985 | : In general, this is stored in the nm_so_opt variable. | |
3986 | : Unfortunately, that option may be fatal on non-shared libraries. | |
3987 | for nm_libs_ext in $*; do | |
3988 | case $nm_libs_ext in | |
3989 | *$so*) nm $nm_so_opt $nm_opt $nm_libs_ext 2>/dev/null ;; | |
3990 | *) nm $nm_opt $nm_libs_ext 2>/dev/null ;; | |
3991 | esac | |
3992 | done > libc.tmp | |
4633a7c4 | 3993 | |
a4f3eea9 | 3994 | $echo $n ".$c" |
3995 | $grep fprintf libc.tmp > libc.ptf | |
3996 | xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4' | |
3997 | xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4' | |
3998 | xxx='[ADTSIW]' | |
3999 | if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\ | |
4000 | eval $xscan;\ | |
4001 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4002 | eval $xrun | |
4003 | elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\ | |
4004 | eval $xscan;\ | |
4005 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4006 | eval $xrun | |
4007 | elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\ | |
4008 | eval $xscan;\ | |
4009 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4010 | eval $xrun | |
4011 | elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\ | |
4012 | eval $xscan;\ | |
4013 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4014 | eval $xrun | |
4015 | elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\ | |
4016 | eval $xscan;\ | |
4017 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4018 | eval $xrun | |
4019 | elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\ | |
4020 | eval $xscan;\ | |
4021 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4022 | eval $xrun | |
4023 | elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \ | |
4024 | -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\ | |
4025 | eval $xscan;\ | |
4026 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4027 | eval $xrun | |
4028 | elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\ | |
4029 | eval $xscan;\ | |
4030 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4031 | eval $xrun | |
4032 | elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\ | |
4033 | eval $xscan;\ | |
4034 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4035 | eval $xrun | |
4036 | elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\ | |
4037 | eval $xscan;\ | |
4038 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4039 | eval $xrun | |
4040 | elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\ | |
4041 | eval $xscan;\ | |
4042 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4043 | eval $xrun | |
4044 | else | |
4045 | nm -p $* 2>/dev/null >libc.tmp | |
4046 | $grep fprintf libc.tmp > libc.ptf | |
4047 | if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\ | |
4048 | eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1 | |
4049 | then | |
4050 | nm_opt='-p' | |
4051 | eval $xrun | |
4633a7c4 | 4052 | else |
a4f3eea9 | 4053 | echo " " |
4054 | echo "nm didn't seem to work right. Trying ar instead..." >&4 | |
4055 | com='' | |
4056 | if ar t $libc > libc.tmp; then | |
4057 | for thisname in $libnames; do | |
4058 | ar t $thisname >>libc.tmp | |
4059 | done | |
4060 | $sed -e 's/\.o$//' < libc.tmp > libc.list | |
4061 | echo "Ok." >&4 | |
4062 | else | |
4063 | echo "ar didn't seem to work right." >&4 | |
4064 | echo "Maybe this is a Cray...trying bld instead..." >&4 | |
4065 | if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list | |
4066 | then | |
4067 | for thisname in $libnames; do | |
4068 | bld t $libnames | \ | |
4069 | $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list | |
4070 | ar t $thisname >>libc.tmp | |
4071 | done | |
4072 | echo "Ok." >&4 | |
4073 | else | |
4074 | echo "That didn't work either. Giving up." >&4 | |
4075 | exit 1 | |
4076 | fi | |
4077 | fi | |
4633a7c4 | 4078 | fi |
4633a7c4 | 4079 | fi |
a4f3eea9 | 4080 | nm_extract="$com" |
4081 | if $test -f /lib/syscalls.exp; then | |
4633a7c4 | 4082 | echo " " |
a4f3eea9 | 4083 | echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4 |
4084 | $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list | |
4085 | fi | |
4086 | ;; | |
4087 | esac | |
4088 | $rm -f libnames libpath | |
4089 | ||
4090 | : Define several unixisms. Hints files or command line options | |
4091 | : can be used to override them. | |
4092 | case "$ar" in | |
4093 | '') ar='ar';; | |
4094 | esac | |
a4f3eea9 | 4095 | case "$obj_ext" in |
4096 | '') obj_ext='.o';; | |
4097 | esac | |
4098 | case "$path_sep" in | |
4099 | '') path_sep=':';; | |
4100 | esac | |
4101 | : Which makefile gets called first. This is used by make depend. | |
4102 | case "$firstmakefile" in | |
4103 | '') firstmakefile='makefile';; | |
4633a7c4 | 4104 | esac |
4633a7c4 | 4105 | |
2afac517 | 4106 | : determine filename position in cpp output |
4633a7c4 | 4107 | echo " " |
2afac517 | 4108 | echo "Computing filename position in cpp output for #include directives..." >&4 |
4109 | echo '#include <stdio.h>' > foo.c | |
4110 | $cat >fieldn <<EOF | |
4111 | $startsh | |
4112 | $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \ | |
4113 | $grep '^[ ]*#.*stdio\.h' | \ | |
4114 | while read cline; do | |
4115 | pos=1 | |