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