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 | ||
ecfc5424 | 21 | # $Id: Head.U,v 3.0.1.6 1994/10/29 15:54:19 ram Exp $ |
2304df62 | 22 | # |
1aef975c | 23 | # Generated on Mon Feb 6 10:35:10 EST 1995 [metaconfig 3.0 PL50] |
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' | |
61 | paths=$paths:'/usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin' | |
62 | paths=$paths:'/sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb' | |
63 | paths=$paths:'/bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin' | |
64 | paths=$paths:'/etc /usr/lib /usr/ucblib /lib /usr/ccs/lib' | |
65 | paths=$paths:'/sbin /usr/sbin /usr/libexec' | |
66 | ||
67 | for p in $paths | |
68 | do | |
69 | case ":$PATH:" in | |
70 | *:$p:*) ;; | |
71 | *) test -d $p && PATH=$PATH:$p ;; | |
72 | esac | |
73 | done | |
74 | ||
75 | PATH=.:$PATH | |
2304df62 AD |
76 | export PATH |
77 | ||
a0d0e21e | 78 | : Sanity checks |
2304df62 | 79 | if test ! -t 0; then |
a0d0e21e | 80 | echo "Say 'sh $me', not 'sh <$me'" |
2304df62 AD |
81 | exit 1 |
82 | fi | |
83 | ||
84 | : On HP-UX, large Configure scripts may exercise a bug in /bin/sh | |
85 | if test -f /hp-ux -a -f /bin/ksh; then | |
86 | if (PATH=.; alias -x) >/dev/null 2>&1; then | |
87 | : already under /bin/ksh | |
88 | else | |
89 | cat <<'EOM' | |
90 | (Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.) | |
91 | EOM | |
ecfc5424 | 92 | unset ENV |
2304df62 AD |
93 | exec /bin/ksh $0 "$@" |
94 | fi | |
95 | else | |
96 | : Warn them if they use ksh on other systems | |
97 | (PATH=.; alias -x) >/dev/null 2>&1 && \ | |
a0d0e21e LW |
98 | cat <<EOM |
99 | (I see you are using the Korn shell. Some ksh's blow up on $me, | |
2304df62 AD |
100 | especially on exotic machines. If yours does, try the Bourne shell instead.) |
101 | EOM | |
102 | fi | |
103 | ||
104 | : Configure runs within the UU subdirectory | |
105 | test -d UU || mkdir UU | |
106 | cd UU && rm -f * | |
107 | ||
a0d0e21e | 108 | dynamic_ext='' |
2304df62 | 109 | extensions='' |
a0d0e21e LW |
110 | known_extensions='' |
111 | static_ext='' | |
112 | useposix='' | |
ecfc5424 | 113 | d_bsd='' |
2304df62 AD |
114 | d_eunice='' |
115 | d_xenix='' | |
116 | eunicefix='' | |
117 | Mcc='' | |
118 | awk='' | |
119 | bash='' | |
120 | bison='' | |
121 | byacc='' | |
122 | cat='' | |
123 | chgrp='' | |
124 | chmod='' | |
125 | chown='' | |
ecfc5424 | 126 | comm='' |
2304df62 AD |
127 | compress='' |
128 | cp='' | |
129 | cpio='' | |
130 | cpp='' | |
131 | csh='' | |
132 | date='' | |
133 | echo='' | |
134 | egrep='' | |
135 | emacs='' | |
136 | expr='' | |
137 | find='' | |
138 | flex='' | |
139 | gcc='' | |
140 | grep='' | |
141 | inews='' | |
142 | ksh='' | |
143 | less='' | |
144 | line='' | |
145 | lint='' | |
146 | ln='' | |
147 | lp='' | |
148 | lpr='' | |
149 | ls='' | |
150 | mail='' | |
151 | mailx='' | |
152 | make='' | |
153 | mkdir='' | |
154 | more='' | |
155 | mv='' | |
156 | nroff='' | |
157 | perl='' | |
158 | pg='' | |
159 | pmake='' | |
160 | pr='' | |
161 | rm='' | |
162 | rmail='' | |
163 | sed='' | |
164 | sendmail='' | |
165 | sh='' | |
166 | shar='' | |
167 | sleep='' | |
168 | smail='' | |
169 | sort='' | |
170 | submit='' | |
171 | tail='' | |
172 | tar='' | |
173 | tbl='' | |
174 | test='' | |
175 | touch='' | |
176 | tr='' | |
177 | troff='' | |
178 | uname='' | |
179 | uniq='' | |
180 | uuname='' | |
181 | vi='' | |
182 | zcat='' | |
1aef975c | 183 | full_sed='' |
a0d0e21e | 184 | libswanted='' |
2304df62 AD |
185 | hint='' |
186 | myuname='' | |
85e6fe83 LW |
187 | osname='' |
188 | osvers='' | |
2304df62 AD |
189 | Author='' |
190 | Date='' | |
191 | Header='' | |
192 | Id='' | |
193 | Locker='' | |
194 | Log='' | |
195 | RCSfile='' | |
196 | Revision='' | |
197 | Source='' | |
198 | State='' | |
199 | afs='' | |
a0d0e21e LW |
200 | alignbytes='' |
201 | archlib='' | |
202 | archlibexp='' | |
203 | archname='' | |
204 | d_archlib='' | |
205 | installarchlib='' | |
ecfc5424 | 206 | baserev='' |
2304df62 AD |
207 | bin='' |
208 | binexp='' | |
209 | installbin='' | |
210 | byteorder='' | |
211 | cc='' | |
212 | gccversion='' | |
213 | ccflags='' | |
214 | cppflags='' | |
215 | ldflags='' | |
216 | lkflags='' | |
217 | optimize='' | |
218 | cf_by='' | |
219 | cf_time='' | |
220 | contains='' | |
a0d0e21e | 221 | cpp_stuff='' |
2304df62 AD |
222 | cpplast='' |
223 | cppminus='' | |
224 | cpprun='' | |
225 | cppstdin='' | |
226 | d_access='' | |
a0d0e21e | 227 | d_alarm='' |
ecfc5424 | 228 | d_attribut='' |
2304df62 AD |
229 | d_bcmp='' |
230 | d_bcopy='' | |
1aef975c | 231 | d_byacc='' |
2304df62 AD |
232 | d_bzero='' |
233 | d_casti32='' | |
234 | castflags='' | |
235 | d_castneg='' | |
a0d0e21e LW |
236 | d_chown='' |
237 | d_chroot='' | |
2304df62 | 238 | d_chsize='' |
a0d0e21e LW |
239 | d_closedir='' |
240 | d_void_closedir='' | |
2304df62 AD |
241 | d_const='' |
242 | cryptlib='' | |
243 | d_crypt='' | |
244 | d_csh='' | |
1aef975c | 245 | full_csh='' |
a0d0e21e LW |
246 | d_cuserid='' |
247 | d_dbl_dig='' | |
248 | d_difftime='' | |
249 | d_dlerror='' | |
250 | d_dlopen='' | |
251 | d_dlsymun='' | |
2304df62 | 252 | d_dosuid='' |
a0d0e21e LW |
253 | d_suidsafe='' |
254 | d_drem='' | |
2304df62 AD |
255 | d_dup2='' |
256 | d_fchmod='' | |
257 | d_fchown='' | |
258 | d_fcntl='' | |
a0d0e21e LW |
259 | d_fd_macros='' |
260 | d_fd_set='' | |
261 | d_fds_bits='' | |
262 | d_fgetpos='' | |
2304df62 AD |
263 | d_flexfnam='' |
264 | d_flock='' | |
a0d0e21e LW |
265 | d_fmod='' |
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_linuxstd='' |
285 | d_locconv='' | |
286 | d_lockf='' | |
2304df62 | 287 | d_lstat='' |
a0d0e21e LW |
288 | d_mblen='' |
289 | d_mbstowcs='' | |
290 | d_mbtowc='' | |
2304df62 AD |
291 | d_memcmp='' |
292 | d_memcpy='' | |
293 | d_memmove='' | |
294 | d_memset='' | |
295 | d_mkdir='' | |
a0d0e21e LW |
296 | d_mkfifo='' |
297 | d_mktime='' | |
2304df62 AD |
298 | d_msg='' |
299 | d_msgctl='' | |
300 | d_msgget='' | |
301 | d_msgrcv='' | |
302 | d_msgsnd='' | |
a0d0e21e | 303 | d_nice='' |
2304df62 | 304 | d_open3='' |
a0d0e21e LW |
305 | d_fpathconf='' |
306 | d_pathconf='' | |
307 | d_pause='' | |
308 | d_pipe='' | |
2304df62 AD |
309 | d_portable='' |
310 | d_readdir='' | |
85e6fe83 LW |
311 | d_rewinddir='' |
312 | d_seekdir='' | |
313 | d_telldir='' | |
a0d0e21e | 314 | d_readlink='' |
2304df62 AD |
315 | d_rename='' |
316 | d_rmdir='' | |
317 | d_safebcpy='' | |
318 | d_safemcpy='' | |
319 | d_select='' | |
320 | d_sem='' | |
321 | d_semctl='' | |
322 | d_semget='' | |
323 | d_semop='' | |
324 | d_setegid='' | |
325 | d_seteuid='' | |
a0d0e21e | 326 | d_setlinebuf='' |
2304df62 AD |
327 | d_setlocale='' |
328 | d_setpgid='' | |
329 | d_setpgrp2='' | |
330 | d_bsdpgrp='' | |
331 | d_setpgrp='' | |
332 | d_setprior='' | |
333 | d_setregid='' | |
334 | d_setresgid='' | |
335 | d_setresuid='' | |
336 | d_setreuid='' | |
337 | d_setrgid='' | |
338 | d_setruid='' | |
339 | d_setsid='' | |
340 | d_shm='' | |
341 | d_shmat='' | |
a0d0e21e LW |
342 | d_shmatprototype='' |
343 | shmattype='' | |
2304df62 AD |
344 | d_shmctl='' |
345 | d_shmdt='' | |
346 | d_shmget='' | |
347 | d_oldsock='' | |
348 | d_socket='' | |
349 | d_sockpair='' | |
350 | sockethdr='' | |
351 | socketlib='' | |
352 | d_statblks='' | |
353 | d_stdstdio='' | |
354 | d_index='' | |
355 | d_strchr='' | |
a0d0e21e | 356 | d_strcoll='' |
2304df62 AD |
357 | d_strctcpy='' |
358 | d_strerrm='' | |
359 | d_strerror='' | |
360 | d_sysernlst='' | |
361 | d_syserrlst='' | |
a0d0e21e | 362 | d_strxfrm='' |
2304df62 AD |
363 | d_symlink='' |
364 | d_syscall='' | |
a0d0e21e | 365 | d_sysconf='' |
2304df62 | 366 | d_system='' |
a0d0e21e LW |
367 | d_tcgetpgrp='' |
368 | d_tcsetpgrp='' | |
85e6fe83 LW |
369 | d_time='' |
370 | timetype='' | |
2304df62 AD |
371 | clocktype='' |
372 | d_times='' | |
373 | d_truncate='' | |
a0d0e21e LW |
374 | d_tzname='' |
375 | d_umask='' | |
2304df62 | 376 | d_vfork='' |
a0d0e21e | 377 | usevfork='' |
2304df62 AD |
378 | d_voidsig='' |
379 | signal_t='' | |
380 | d_volatile='' | |
381 | d_charvspr='' | |
382 | d_vprintf='' | |
383 | d_wait4='' | |
384 | d_waitpid='' | |
a0d0e21e LW |
385 | d_wcstombs='' |
386 | d_wctomb='' | |
387 | dlext='' | |
85e6fe83 LW |
388 | cccdlflags='' |
389 | ccdlflags='' | |
ecfc5424 | 390 | d_shrplib='' |
2304df62 | 391 | dlsrc='' |
85e6fe83 | 392 | lddlflags='' |
ecfc5424 | 393 | shrpdir='' |
2304df62 | 394 | usedl='' |
a0d0e21e | 395 | fpostype='' |
2304df62 AD |
396 | gidtype='' |
397 | groupstype='' | |
398 | h_fcntl='' | |
399 | h_sysfile='' | |
ecfc5424 AD |
400 | db_hashtype='' |
401 | db_prefixtype='' | |
a0d0e21e | 402 | i_db='' |
2304df62 AD |
403 | i_dbm='' |
404 | d_dirnamlen='' | |
a0d0e21e | 405 | direntrytype='' |
2304df62 | 406 | i_dirent='' |
a0d0e21e | 407 | i_dld='' |
2304df62 AD |
408 | i_dlfcn='' |
409 | i_fcntl='' | |
a0d0e21e | 410 | i_float='' |
2304df62 AD |
411 | i_gdbm='' |
412 | i_grp='' | |
a0d0e21e LW |
413 | i_limits='' |
414 | i_malloc='' | |
415 | i_math='' | |
85e6fe83 | 416 | i_memory='' |
2304df62 | 417 | i_ndbm='' |
85e6fe83 | 418 | i_neterrno='' |
2304df62 AD |
419 | i_niin='' |
420 | i_sysin='' | |
421 | d_pwage='' | |
422 | d_pwchange='' | |
423 | d_pwclass='' | |
424 | d_pwcomment='' | |
425 | d_pwexpire='' | |
426 | d_pwquota='' | |
427 | i_pwd='' | |
2304df62 | 428 | i_stddef='' |
a0d0e21e | 429 | i_stdlib='' |
2304df62 AD |
430 | i_string='' |
431 | strings='' | |
432 | i_sysdir='' | |
433 | i_sysfile='' | |
434 | d_voidtty='' | |
435 | i_bsdioctl='' | |
a0d0e21e | 436 | i_sysfilio='' |
2304df62 AD |
437 | i_sysioctl='' |
438 | i_syssockio='' | |
439 | i_sysndir='' | |
a0d0e21e | 440 | i_sysparam='' |
2304df62 | 441 | i_sysselct='' |
1aef975c | 442 | i_sysstat='' |
a0d0e21e | 443 | i_systimes='' |
2304df62 AD |
444 | i_sgtty='' |
445 | i_termio='' | |
446 | i_termios='' | |
447 | i_systime='' | |
448 | i_systimek='' | |
449 | i_time='' | |
450 | timeincl='' | |
85e6fe83 | 451 | i_unistd='' |
2304df62 | 452 | i_utime='' |
a0d0e21e | 453 | i_stdarg='' |
2304df62 AD |
454 | i_varargs='' |
455 | i_varhdr='' | |
456 | i_vfork='' | |
457 | intsize='' | |
2304df62 | 458 | libc='' |
a0d0e21e | 459 | glibpth='' |
2304df62 AD |
460 | libpth='' |
461 | plibpth='' | |
462 | xlibpth='' | |
463 | libs='' | |
85e6fe83 LW |
464 | lns='' |
465 | lseektype='' | |
466 | d_mymalloc='' | |
2304df62 AD |
467 | mallocobj='' |
468 | mallocsrc='' | |
469 | malloctype='' | |
470 | usemymalloc='' | |
471 | installmansrc='' | |
472 | manext='' | |
473 | mansrc='' | |
474 | mansrcexp='' | |
475 | huge='' | |
476 | large='' | |
477 | medium='' | |
478 | models='' | |
479 | small='' | |
480 | split='' | |
a0d0e21e | 481 | modetype='' |
2304df62 AD |
482 | mydomain='' |
483 | myhostname='' | |
484 | phostname='' | |
485 | c='' | |
486 | n='' | |
487 | groupcat='' | |
488 | hostcat='' | |
489 | passcat='' | |
85e6fe83 LW |
490 | orderlib='' |
491 | ranlib='' | |
2304df62 AD |
492 | package='' |
493 | spackage='' | |
ecfc5424 | 494 | patchlevel='' |
a0d0e21e | 495 | prefix='' |
1aef975c | 496 | prefixexp='' |
2304df62 AD |
497 | installprivlib='' |
498 | privlib='' | |
499 | privlibexp='' | |
500 | prototype='' | |
501 | randbits='' | |
502 | installscript='' | |
503 | scriptdir='' | |
504 | scriptdirexp='' | |
a0d0e21e | 505 | selecttype='' |
2304df62 | 506 | sig_name='' |
a0d0e21e LW |
507 | sizetype='' |
508 | so='' | |
2304df62 AD |
509 | sharpbang='' |
510 | shsharp='' | |
511 | spitshell='' | |
a0d0e21e | 512 | ssizetype='' |
2304df62 AD |
513 | startsh='' |
514 | stdchar='' | |
515 | sysman='' | |
516 | uidtype='' | |
517 | nm_opt='' | |
518 | runnm='' | |
519 | usenm='' | |
520 | incpath='' | |
521 | mips='' | |
522 | mips_type='' | |
523 | usrinc='' | |
524 | defvoidused='' | |
525 | voidflags='' | |
2304df62 AD |
526 | CONFIG='' |
527 | ||
ecfc5424 AD |
528 | define='define' |
529 | undef='undef' | |
530 | smallmach='pdp11 i8086 z8000 i80286 iAPX286' | |
531 | rmlist='' | |
532 | ||
533 | : We must find out about Eunice early | |
534 | eunicefix=':' | |
535 | if test -f /etc/unixtovms; then | |
536 | eunicefix=/etc/unixtovms | |
537 | fi | |
538 | if test -f /etc/unixtovms.exe; then | |
539 | eunicefix=/etc/unixtovms.exe | |
540 | fi | |
541 | ||
542 | : list of known cpp symbols, sorted alphabetically | |
543 | al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2" | |
544 | al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH" | |
545 | al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS" | |
546 | al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM" | |
547 | al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX" | |
548 | al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX" | |
549 | al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4" | |
550 | al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300" | |
551 | al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek" | |
552 | al="$al VMS Xenix286" | |
553 | al="$al _AIX _AIX32 _AIX370 _AM29000 _COFF _CRAY _CX_UX _EPI" | |
554 | al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET" | |
555 | al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3" | |
556 | al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000" | |
557 | al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4" | |
558 | al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS" | |
559 | al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__" | |
560 | al="$al __DGUX__ __DPX2__ __H3050R __H3050RX" | |
561 | al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__" | |
562 | al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__" | |
563 | al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__" | |
564 | al="$al __SVR4_2__ __UMAXV__" | |
565 | al="$al ____386BSD____ __alpha __alpha__ __amiga" | |
566 | al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__" | |
567 | al="$al __host_mips__" | |
568 | al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500" | |
569 | al="$al __hp9000s500 __hp9000s700 __hp9000s800" | |
570 | al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__" | |
571 | al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__" | |
572 | al="$al __m68k __m68k__ __m88100__ __m88k __m88k__" | |
573 | al="$al __mc68000 __mc68000__ __mc68020 __mc68020__" | |
574 | al="$al __mc68030 __mc68030__ __mc68040 __mc68040__" | |
575 | al="$al __mc88100 __mc88100__ __mips __mips__" | |
576 | al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__" | |
577 | al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__" | |
578 | al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__" | |
579 | al="$al _host_mips _mips _unix" | |
580 | al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent" | |
581 | al="$al apollo ardent att386 att3b" | |
582 | al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull" | |
583 | al="$al cadmus clipper concurrent convex cray ctix" | |
584 | al="$al dmert encore gcos gcx gimpel gould" | |
585 | al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800" | |
586 | al="$al hp9000 hp9000s300 hp9000s400 hp9000s500" | |
587 | al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux" | |
588 | al="$al i186 i286 i386 i486 i8086" | |
589 | al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k" | |
590 | al="$al ksr1 linux luna luna88k m68k m88100 m88k" | |
591 | al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030" | |
592 | al="$al mc68040 mc68060 mc68k mc68k32 mc700" | |
593 | al="$al mc88000 mc88100 merlin mert mips mvs n16" | |
594 | al="$al ncl_el ncl_mr" | |
595 | al="$al news1500 news1700 news1800 news1900 news3700" | |
596 | al="$al news700 news800 news900 ns16000 ns32000" | |
597 | al="$al ns32016 ns32332 ns32k nsc32000 os osf" | |
598 | al="$al parisc pc532 pdp11 plexus posix pyr" | |
599 | al="$al riscix riscos scs sequent sgi sinix sony sony_news" | |
600 | al="$al sonyrisc sparc sparclite spectrum stardent stratos" | |
601 | al="$al sun sun3 sun386 svr4 sysV68 sysV88" | |
602 | al="$al titan tower tower32 tower32_200 tower32_600 tower32_700" | |
603 | al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200" | |
604 | al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms" | |
605 | al="$al xenix z8000" | |
606 | ||
607 | gccversion='' | |
608 | groupstype='' | |
609 | i_whoami='' | |
610 | : change the next line if compiling for Xenix/286 on Xenix/386 | |
611 | xlibpth='/usr/lib/386 /lib/386' | |
612 | ||
613 | : general looking path for locating libraries | |
614 | glibpth="/lib/pa1.1 /usr/lib/large /lib /usr/lib $xlibpth" | |
615 | glibpth="$glibpth /lib/large /usr/lib/small /lib/small" | |
616 | glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib /usr/shlib" | |
617 | ||
618 | : Private path used by Configure to find libraries. Its value | |
619 | : is prepended to libpth. This variable takes care of special | |
620 | : machines, like the mips. Usually, it should be empty. | |
621 | plibpth='' | |
622 | ||
623 | : default library list | |
624 | libswanted='' | |
625 | : full support for void wanted by default | |
626 | defvoidused=15 | |
627 | ||
628 | : set useposix=false in your hint file to disable the POSIX extension. | |
629 | useposix=true | |
630 | : no include file wanted by default | |
631 | inclwanted='' | |
632 | ||
633 | : List of libraries we want. | |
634 | libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl' | |
635 | libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt" | |
636 | libswanted="$libswanted ucb bsd BSD PW x" | |
1aef975c | 637 | : We probably want to search /usr/shlib before most other libraries. |
ecfc5424 AD |
638 | : This is only used by ext/util/extliblist |
639 | glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'` | |
640 | glibpth="/usr/shlib $glibpth" | |
641 | : Do not use vfork unless overridden by a hint file. | |
642 | usevfork=false | |
1aef975c AD |
643 | : We might as well always be portable. It makes no difference for |
644 | : perl5, and makes people happy. | |
645 | d_portable=define | |
ecfc5424 | 646 | |
2304df62 AD |
647 | : script used to extract .SH files with variable substitutions |
648 | cat >extract <<'EOS' | |
649 | CONFIG=true | |
650 | echo "Doing variable substitutions on .SH files..." | |
651 | if test -f MANIFEST; then | |
a0d0e21e LW |
652 | shlist=`awk '{print $1}' <MANIFEST | grep '\.SH'` |
653 | : Pick up possible extension manifests. | |
654 | for dir in ext/* ; do | |
655 | if test -f $dir/MANIFEST; then | |
656 | xxx=`awk '{print $1}' < $dir/MANIFEST | | |
657 | sed -n "/\.SH$/ s@^@$dir/@p"` | |
658 | shlist="$shlist $xxx" | |
659 | fi | |
660 | done | |
661 | set x $shlist | |
2304df62 AD |
662 | else |
663 | echo "(Looking for .SH files under the current directory.)" | |
664 | set x `find . -name "*.SH" -print` | |
665 | fi | |
666 | shift | |
667 | case $# in | |
668 | 0) set x *.SH; shift;; | |
669 | esac | |
670 | if test ! -f $1; then | |
671 | shift | |
672 | fi | |
673 | for file in $*; do | |
674 | case "$file" in | |
675 | */*) | |
676 | dir=`expr X$file : 'X\(.*\)/'` | |
677 | file=`expr X$file : 'X.*/\(.*\)'` | |
678 | (cd $dir && . ./$file) | |
679 | ;; | |
680 | *) | |
681 | . ./$file | |
682 | ;; | |
683 | esac | |
684 | done | |
685 | if test -f config_h.SH; then | |
686 | if test ! -f config.h; then | |
687 | : oops, they left it out of MANIFEST, probably, so do it anyway. | |
688 | . ./config_h.SH | |
689 | fi | |
690 | fi | |
691 | EOS | |
692 | ||
693 | : produce awk script to parse command line options | |
694 | cat >options.awk <<'EOF' | |
695 | BEGIN { | |
ecfc5424 | 696 | optstr = "dD:eEf:hOrsSU:V"; # getopt-style specification |
2304df62 AD |
697 | |
698 | len = length(optstr); | |
699 | for (i = 1; i <= len; i++) { | |
700 | c = substr(optstr, i, 1); | |
701 | if (i < len) a = substr(optstr, i + 1, 1); else a = ""; | |
702 | if (a == ":") { | |
703 | arg[c] = 1; | |
704 | i++; | |
705 | } | |
706 | opt[c] = 1; | |
707 | } | |
708 | } | |
709 | { | |
710 | expect = 0; | |
711 | str = $0; | |
712 | if (substr(str, 1, 1) != "-") { | |
713 | printf("'%s'\n", str); | |
714 | next; | |
715 | } | |
716 | len = length($0); | |
717 | for (i = 2; i <= len; i++) { | |
718 | c = substr(str, i, 1); | |
719 | if (!opt[c]) { | |
720 | printf("-%s\n", substr(str, i)); | |
721 | next; | |
722 | } | |
723 | printf("-%s\n", c); | |
724 | if (arg[c]) { | |
725 | if (i < len) | |
726 | printf("'%s'\n", substr(str, i + 1)); | |
727 | else | |
728 | expect = 1; | |
729 | next; | |
730 | } | |
731 | } | |
732 | } | |
733 | END { | |
734 | if (expect) | |
735 | print "?"; | |
736 | } | |
737 | EOF | |
738 | ||
739 | : process the command line options | |
740 | set X `for arg in "$@"; do echo $arg; done | awk -f options.awk` | |
741 | eval "set $*" | |
742 | shift | |
743 | rm -f options.awk | |
744 | ||
745 | : set up default values | |
746 | fastread='' | |
747 | reuseval=false | |
748 | config_sh='' | |
749 | alldone='' | |
750 | error='' | |
751 | silent='' | |
752 | extractsh='' | |
ecfc5424 | 753 | override='' |
1aef975c | 754 | rm -f optdef.sh |
2304df62 AD |
755 | |
756 | : option parsing | |
757 | while test $# -gt 0; do | |
758 | case "$1" in | |
759 | -d) shift; fastread=yes;; | |
760 | -e) shift; alldone=cont;; | |
761 | -f) | |
762 | shift | |
763 | cd .. | |
764 | if test -r "$1"; then | |
765 | config_sh="$1" | |
766 | else | |
a0d0e21e | 767 | echo "$me: cannot read config file $1." >&2 |
2304df62 AD |
768 | error=true |
769 | fi | |
770 | cd UU | |
771 | shift;; | |
772 | -h) shift; error=true;; | |
773 | -r) shift; reuseval=true;; | |
774 | -s) shift; silent=true;; | |
775 | -E) shift; alldone=exit;; | |
ecfc5424 | 776 | -O) shift; override=true;; |
2304df62 | 777 | -S) shift; extractsh=true;; |
a0d0e21e LW |
778 | -D) |
779 | shift | |
780 | case "$1" in | |
781 | *=) | |
782 | echo "$me: use '-U symbol=', not '-D symbol='." >&2 | |
783 | echo "$me: ignoring -D $1" >&2 | |
784 | ;; | |
ecfc5424 | 785 | *=*) echo "$1" | \ |
1aef975c AD |
786 | sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;; |
787 | *) echo "$1='define'" >> optdef.sh;; | |
a0d0e21e LW |
788 | esac |
789 | shift | |
790 | ;; | |
791 | -U) | |
792 | shift | |
793 | case "$1" in | |
1aef975c | 794 | *=) echo "$1" >> optdef.sh;; |
a0d0e21e LW |
795 | *=*) |
796 | echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2 | |
797 | echo "$me: ignoring -U $1" >&2 | |
798 | ;; | |
1aef975c | 799 | *) echo "$1='undef'" >> optdef.sh;; |
a0d0e21e LW |
800 | esac |
801 | shift | |
802 | ;; | |
1aef975c | 803 | -V) echo "$me generated by metaconfig 3.0 PL50." >&2 |
2304df62 AD |
804 | exit 0;; |
805 | --) break;; | |
a0d0e21e | 806 | -*) echo "$me: unknown option $1" >&2; shift; error=true;; |
2304df62 AD |
807 | *) break;; |
808 | esac | |
809 | done | |
810 | ||
811 | case "$error" in | |
812 | true) | |
813 | cat >&2 <<EOM | |
ecfc5424 | 814 | Usage: $me [-dehrEOSV] [-f config.sh] [-D symbol] [-D symbol=value] |
a0d0e21e | 815 | [-U symbol] [-U symbol=] |
2304df62 AD |
816 | -d : use defaults for all answers. |
817 | -e : go on without questioning past the production of config.sh. | |
818 | -f : specify an alternate default configuration file. | |
819 | -h : print this help message and exit (with an error status). | |
820 | -r : reuse C symbols value if possible (skips costly nm extraction). | |
821 | -s : silent mode, only echoes questions and essential information. | |
a0d0e21e LW |
822 | -D : define symbol to have some value: |
823 | -D symbol symbol gets the value 'define' | |
824 | -D symbol=value symbol gets the value 'value' | |
2304df62 | 825 | -E : stop at the end of questions, after having produced config.sh. |
ecfc5424 | 826 | -O : let -D and -U override definitions from loaded configuration file. |
2304df62 | 827 | -S : perform variable substitutions on all .SH files (can mix with -f) |
a0d0e21e LW |
828 | -U : undefine symbol: |
829 | -U symbol symbol gets the value 'undef' | |
830 | -U symbol= symbol gets completely empty | |
2304df62 AD |
831 | -V : print version number and exit (with a zero status). |
832 | EOM | |
833 | exit 1 | |
834 | ;; | |
835 | esac | |
836 | ||
837 | exec 4>&1 | |
838 | case "$silent" in | |
839 | true) exec 1>/dev/null;; | |
840 | esac | |
841 | ||
ecfc5424 | 842 | : run the defines and the undefines, if any, but leave the file out there... |
1aef975c AD |
843 | touch optdef.sh |
844 | . ./optdef.sh | |
a0d0e21e | 845 | |
2304df62 AD |
846 | case "$extractsh" in |
847 | true) | |
848 | case "$config_sh" in | |
849 | '') config_sh='config.sh'; config='./config.sh';; | |
850 | /*) config="$config_sh";; | |
851 | *) config="./$config_sh";; | |
852 | esac | |
853 | echo " " | |
854 | echo "Fetching answers from $config_sh..." | |
855 | cd .. | |
856 | . $config | |
1aef975c | 857 | test "$override" && . ./optdef.sh |
2304df62 AD |
858 | echo " " |
859 | . ./UU/extract | |
860 | rm -rf UU | |
861 | echo "Done." | |
862 | exit 0 | |
863 | ;; | |
864 | esac | |
865 | ||
866 | : set package name | |
85e6fe83 | 867 | package=perl5 |
1aef975c AD |
868 | first=`echo $package | sed -e 's/^\(.\).*/\1/'` |
869 | last=`echo $package | sed -e 's/^.\(.*\)/\1/'` | |
870 | case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in | |
871 | ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;; | |
872 | *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;; | |
873 | esac | |
2304df62 AD |
874 | |
875 | : Eunice requires " " instead of "", can you believe it | |
876 | echo " " | |
877 | : Here we go... | |
878 | echo "Beginning of configuration questions for $package." | |
879 | ||
1aef975c | 880 | trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15 |
2304df62 | 881 | |
2304df62 AD |
882 | : Some greps do not return status, grrr. |
883 | echo "grimblepritz" >grimble | |
884 | if grep blurfldyick grimble >/dev/null 2>&1 ; then | |
885 | contains=contains | |
886 | elif grep grimblepritz grimble >/dev/null 2>&1 ; then | |
887 | contains=grep | |
888 | else | |
889 | contains=contains | |
890 | fi | |
891 | rm -f grimble | |
892 | : the following should work in any shell | |
893 | case "$contains" in | |
894 | contains*) | |
895 | echo " " | |
896 | echo "AGH! Grep doesn't return a status. Attempting remedial action." | |
897 | cat >contains <<'EOSS' | |
898 | grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp | |
899 | EOSS | |
900 | chmod +x contains | |
901 | esac | |
902 | ||
903 | : first determine how to suppress newline on echo command | |
904 | echo " " | |
905 | echo "Checking echo to see how to suppress newlines..." | |
906 | (echo "hi there\c" ; echo " ") >.echotmp | |
907 | if $contains c .echotmp >/dev/null 2>&1 ; then | |
908 | echo "...using -n." | |
909 | n='-n' | |
910 | c='' | |
911 | else | |
912 | cat <<'EOM' | |
913 | ...using \c | |
914 | EOM | |
915 | n='' | |
916 | c='\c' | |
917 | fi | |
918 | echo $n "The star should be here-->$c" | |
919 | echo '*' | |
920 | rm -f .echotmp | |
921 | ||
922 | : Now test for existence of everything in MANIFEST | |
923 | echo " " | |
924 | if test -f ../MANIFEST; then | |
925 | echo "First let's make sure your kit is complete. Checking..." >&4 | |
926 | awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50 | |
927 | rm -f missing | |
928 | for filelist in x??; do | |
929 | (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing) | |
930 | done | |
931 | if test -s missing; then | |
932 | cat missing >&4 | |
933 | cat >&4 <<'EOM' | |
934 | ||
935 | THIS PACKAGE SEEMS TO BE INCOMPLETE. | |
936 | ||
937 | You have the option of continuing the configuration process, despite the | |
938 | distinct possibility that your kit is damaged, by typing 'y'es. If you | |
939 | do, don't blame me if something goes wrong. I advise you to type 'n'o | |
940 | and contact the author (lwall@netlabs.com). | |
941 | ||
942 | EOM | |
943 | echo $n "Continue? [n] $c" >&4 | |
944 | read ans | |
945 | case "$ans" in | |
946 | y*) | |
947 | echo "Continuing..." >&4 | |
948 | rm -f missing | |
949 | ;; | |
950 | *) | |
951 | echo "ABORTING..." >&4 | |
952 | kill $$ | |
953 | ;; | |
954 | esac | |
955 | else | |
956 | echo "Looks good..." >&4 | |
957 | fi | |
958 | else | |
959 | echo "There is no MANIFEST file. I hope your kit is complete !" | |
960 | fi | |
961 | rm -f missing x?? | |
962 | ||
963 | : compute the number of columns on the terminal for proper question formatting | |
964 | case "$COLUMNS" in | |
965 | '') COLUMNS='80';; | |
966 | esac | |
967 | ||
968 | : set up the echo used in my read | |
969 | myecho="case \"\$xxxm\" in | |
970 | '') echo $n \"\$rp $c\" >&4;; | |
971 | *) case \"\$rp\" in | |
972 | '') echo $n \"[\$xxxm] $c\";; | |
973 | *) | |
974 | if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then | |
975 | echo \"\$rp\" >&4 | |
976 | echo $n \"[\$xxxm] $c\" >&4 | |
977 | else | |
978 | echo $n \"\$rp [\$xxxm] $c\" >&4 | |
979 | fi | |
980 | ;; | |
981 | esac;; | |
982 | esac" | |
983 | ||
984 | : now set up to do reads with possible shell escape and default assignment | |
985 | cat <<EOSC >myread | |
986 | xxxm=\$dflt | |
987 | $myecho | |
988 | ans='!' | |
989 | case "\$fastread" in | |
990 | yes) case "\$dflt" in | |
991 | '') ;; | |
992 | *) ans=''; | |
993 | case "\$silent-\$rp" in | |
994 | true-) ;; | |
995 | *) echo " " >&4;; | |
996 | esac;; | |
997 | esac;; | |
998 | *) case "\$silent" in | |
999 | true) case "\$rp" in | |
1000 | '') ans='';; | |
1001 | esac;; | |
1002 | esac;; | |
1003 | esac | |
1004 | while expr "X\$ans" : "X!" >/dev/null; do | |
1005 | read answ | |
1006 | set x \$xxxm | |
1007 | shift | |
1008 | aok=''; eval "ans=\"\$answ\"" && aok=y | |
1009 | case "\$answ" in | |
1010 | "\$ans") | |
1011 | case "\$ans" in | |
ecfc5424 AD |
1012 | \\&*) |
1013 | set x \`expr "X\$ans" : "X&\(.*\)\$"\` | |
1014 | shift | |
1015 | case "\$1" in | |
1016 | -d) | |
1017 | fastread=yes | |
1018 | echo "(OK, I'll run with -d after this question.)" | |
1019 | ;; | |
1020 | -*) | |
1021 | echo "*** Sorry, \$1 not supported yet." | |
1022 | ;; | |
1023 | esac | |
1024 | $myecho | |
1025 | ans=! | |
1026 | ;; | |
2304df62 AD |
1027 | "!") |
1028 | sh 1>&4 | |
1029 | echo " " | |
1030 | $myecho | |
1031 | ;; | |
1032 | !*) | |
1033 | set x \`expr "X\$ans" : "X!\(.*\)\$"\` | |
1034 | shift | |
1035 | sh 1>&4 -c "\$*" | |
1036 | echo " " | |
1037 | $myecho | |
1038 | ;; | |
1039 | esac;; | |
1040 | *) | |
1041 | case "\$aok" in | |
1042 | y) | |
1043 | echo "*** Substitution done -- please confirm." | |
1044 | xxxm="\$ans" | |
1045 | ans=\`echo $n "\$ans$c" | tr '\012' ' '\` | |
1046 | xxxm="\$ans" | |
1047 | ans=! | |
1048 | ;; | |
1049 | *) | |
1050 | echo "*** Error -- try again." | |
1051 | ans=! | |
1052 | ;; | |
1053 | esac | |
1054 | $myecho | |
1055 | ;; | |
1056 | esac | |
1057 | case "\$ans\$xxxm\$nostick" in | |
1058 | '') | |
1059 | ans=! | |
1060 | $myecho | |
1061 | ;; | |
1062 | esac | |
1063 | done | |
1064 | case "\$ans" in | |
1065 | '') ans="\$xxxm";; | |
1066 | esac | |
1067 | EOSC | |
1068 | ||
1069 | : create .config dir to save info across Configure sessions | |
1070 | test -d ../.config || mkdir ../.config | |
1071 | cat >../.config/README <<EOF | |
1072 | This directory created by Configure to save information that should | |
1073 | persist across sessions. | |
1074 | ||
1075 | You may safely delete it if you wish. | |
1076 | EOF | |
1077 | ||
1078 | : general instructions | |
1079 | needman=true | |
1080 | firsttime=true | |
1081 | user=`( (logname) 2>/dev/null || whoami) 2>&1` | |
1082 | if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then | |
1083 | firsttime=false | |
1084 | echo " " | |
1085 | rp='Would you like to see the instructions?' | |
1086 | dflt=n | |
1087 | . ./myread | |
1088 | case "$ans" in | |
1089 | [yY]*) ;; | |
1090 | *) needman=false;; | |
1091 | esac | |
1092 | fi | |
1093 | if $needman; then | |
1094 | cat <<EOH | |
1095 | ||
1096 | This installation shell script will examine your system and ask you questions | |
a0d0e21e | 1097 | to determine how the perl5 package should be installed. If you get |
2304df62 AD |
1098 | stuck on a question, you may use a ! shell escape to start a subshell or |
1099 | execute a command. Many of the questions will have default answers in square | |
1100 | brackets; typing carriage return will give you the default. | |
1101 | ||
1102 | On some of the questions which ask for file or directory names you are allowed | |
1103 | to use the ~name construct to specify the login directory belonging to "name", | |
1104 | even if you don't have a shell which knows about that. Questions where this is | |
1105 | allowed will be marked "(~name ok)". | |
1106 | ||
1107 | EOH | |
1108 | rp='' | |
1109 | dflt='Type carriage return to continue' | |
1110 | . ./myread | |
1111 | cat <<'EOH' | |
1112 | ||
1113 | The prompter used in this script allows you to use shell variables and | |
1114 | backticks in your answers. You may use $1, $2, etc... to refer to the words | |
1115 | in the default answer, as if the default line was a set of arguments given to a | |
1116 | script shell. This means you may also use $* to repeat the whole default line, | |
1117 | so you do not have to re-type everything to add something to the default. | |
1118 | ||
1119 | Everytime there is a substitution, you will have to confirm. If there is an | |
1120 | error (e.g. an unmatched backtick), the default answer will remain unchanged | |
1121 | and you will be prompted again. | |
1122 | ||
1123 | If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all | |
1124 | the questions and use the computed defaults (or the previous answers if there | |
1125 | was already a config.sh file). Type 'Configure -h' for a list of options. | |
ecfc5424 AD |
1126 | You may also start interactively and then answer '& -d' at any prompt to turn |
1127 | on the non-interactive behaviour for the remaining of the execution. | |
2304df62 AD |
1128 | |
1129 | EOH | |
1130 | . ./myread | |
1131 | cat <<EOH | |
1132 | ||
1133 | Much effort has been expended to ensure that this shell script will run on any | |
1134 | Unix system. If despite that it blows up on yours, your best bet is to edit | |
1135 | Configure and run it again. Also, let me (lwall@netlabs.com) | |
1136 | know how I blew it. If you can't run Configure for some reason, you'll have to | |
1137 | generate a config.sh file by hand. | |
1138 | ||
1139 | This installation script affects things in two ways: | |
1140 | ||
1141 | 1) it may do direct variable substitutions on some of the files included | |
1142 | in this kit. | |
1143 | 2) it builds a config.h file for inclusion in C programs. You may edit | |
1144 | any of these files as the need arises after running this script. | |
1145 | ||
1146 | If you make a mistake on a question, there is no easy way to back up to it | |
1147 | currently. The easiest thing to do is to edit config.sh and rerun all the SH | |
1148 | files. Configure will offer to let you do this before it runs the SH files. | |
1149 | ||
1150 | EOH | |
1151 | dflt='Type carriage return to continue' | |
1152 | . ./myread | |
1153 | case "$firsttime" in | |
1154 | true) echo $user >>../.config/instruct;; | |
1155 | esac | |
1156 | fi | |
1157 | ||
1158 | : see if sh knows # comments | |
1159 | echo " " | |
1160 | echo "Checking your sh to see if it knows about # comments..." >&4 | |
ecfc5424 | 1161 | if `sh -c '#' >/dev/null 2>&1`; then |
2304df62 AD |
1162 | echo "Your sh handles # comments correctly." |
1163 | shsharp=true | |
1164 | spitshell=cat | |
1165 | echo " " | |
1166 | echo "Okay, let's see if #! works on this system..." | |
a0d0e21e | 1167 | xcat=/bin/cat |
ecfc5424 | 1168 | test -f $xcat || xcat=/usr/bin/cat |
a0d0e21e | 1169 | echo "#!$xcat" >try |
2304df62 AD |
1170 | $eunicefix try |
1171 | chmod +x try | |
1172 | ./try > today | |
1173 | if test -s today; then | |
1174 | echo "It does." | |
1175 | sharpbang='#!' | |
1176 | else | |
a0d0e21e | 1177 | echo "#! $xcat" > try |
2304df62 AD |
1178 | $eunicefix try |
1179 | chmod +x try | |
1180 | ./try > today | |
1181 | if test -s today; then | |
1182 | echo "It does." | |
1183 | sharpbang='#! ' | |
1184 | else | |
1185 | echo "It's just a comment." | |
1186 | sharpbang=': use ' | |
1187 | fi | |
1188 | fi | |
1189 | else | |
1190 | echo "Your sh doesn't grok # comments--I will strip them later on." | |
1191 | shsharp=false | |
a0d0e21e | 1192 | cd .. |
2304df62 AD |
1193 | echo "exec grep -v '^[ ]*#'" >spitshell |
1194 | chmod +x spitshell | |
1195 | $eunicefix spitshell | |
1196 | spitshell=`pwd`/spitshell | |
a0d0e21e | 1197 | cd UU |
2304df62 AD |
1198 | echo "I presume that if # doesn't work, #! won't work either!" |
1199 | sharpbang=': use ' | |
1200 | fi | |
1201 | rm -f try today | |
1202 | ||
1203 | : figure out how to guarantee sh startup | |
1204 | echo " " | |
1205 | echo "Checking out how to guarantee sh startup..." >&4 | |
1206 | case "$SYSTYPE" in | |
1207 | *bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";; | |
1208 | *) startsh=$sharpbang'/bin/sh';; | |
1209 | esac | |
1210 | echo "Let's see if '$startsh' works..." | |
1211 | cat >try <<EOSS | |
1212 | $startsh | |
1213 | set abc | |
1214 | test "$?abc" != 1 | |
1215 | EOSS | |
1216 | ||
1217 | chmod +x try | |
1218 | $eunicefix try | |
1219 | if ./try; then | |
1220 | echo "Yup, it does." | |
1221 | else | |
1222 | echo "Nope. You may have to fix up the shell scripts to make sure sh runs them." | |
1223 | fi | |
1224 | rm -f try | |
1225 | ||
1226 | : find out where common programs are | |
1227 | echo " " | |
1228 | echo "Locating common programs..." >&4 | |
1229 | cat <<EOSC >loc | |
1230 | $startsh | |
1231 | case \$# in | |
1232 | 0) exit 1;; | |
1233 | esac | |
1234 | thing=\$1 | |
1235 | shift | |
1236 | dflt=\$1 | |
1237 | shift | |
1238 | for dir in \$*; do | |
1239 | case "\$thing" in | |
1240 | .) | |
1241 | if test -d \$dir/\$thing; then | |
1242 | echo \$dir | |
1243 | exit 0 | |
1244 | fi | |
1245 | ;; | |
1246 | *) | |
a0d0e21e | 1247 | for thisthing in \$dir/\$thing; do |
ecfc5424 | 1248 | : just loop through to pick last item |
a0d0e21e LW |
1249 | done |
1250 | if test -f \$thisthing; then | |
1251 | echo \$thisthing | |
2304df62 AD |
1252 | exit 0 |
1253 | elif test -f \$dir/\$thing.exe; then | |
1254 | : on Eunice apparently | |
1255 | echo \$dir/\$thing | |
1256 | exit 0 | |
1257 | fi | |
1258 | ;; | |
1259 | esac | |
1260 | done | |
1261 | echo \$dflt | |
1262 | exit 1 | |
1263 | EOSC | |
1264 | chmod +x loc | |
1265 | $eunicefix loc | |
1266 | loclist=" | |
1267 | awk | |
1268 | cat | |
ecfc5424 | 1269 | comm |
2304df62 AD |
1270 | cp |
1271 | echo | |
1272 | expr | |
a0d0e21e | 1273 | find |
2304df62 | 1274 | grep |
85e6fe83 | 1275 | ln |
a0d0e21e | 1276 | ls |
2304df62 | 1277 | mkdir |
2304df62 AD |
1278 | rm |
1279 | sed | |
1280 | sort | |
85e6fe83 | 1281 | touch |
2304df62 AD |
1282 | tr |
1283 | uniq | |
1284 | " | |
1285 | trylist=" | |
1286 | Mcc | |
2304df62 AD |
1287 | byacc |
1288 | cpp | |
1289 | csh | |
1290 | date | |
1291 | egrep | |
2304df62 AD |
1292 | line |
1293 | nroff | |
1294 | perl | |
1295 | test | |
1296 | uname | |
1297 | " | |
1298 | pth=`echo $PATH | sed -e 's/:/ /g'` | |
1299 | pth="$pth /lib /usr/lib" | |
1300 | for file in $loclist; do | |
1301 | xxx=`./loc $file $file $pth` | |
1302 | eval $file=$xxx | |
1303 | eval _$file=$xxx | |
1304 | case "$xxx" in | |
1305 | /*) | |
1306 | echo $file is in $xxx. | |
1307 | ;; | |
1308 | *) | |
1309 | echo "I don't know where $file is. I hope it's in everyone's PATH." | |
1310 | ;; | |
1311 | esac | |
1312 | done | |
1313 | echo " " | |
1314 | echo "Don't worry if any of the following aren't found..." | |
1315 | say=offhand | |
1316 | for file in $trylist; do | |
1317 | xxx=`./loc $file $file $pth` | |
1318 | eval $file=$xxx | |
1319 | eval _$file=$xxx | |
1320 | case "$xxx" in | |
1321 | /*) | |
1322 | echo $file is in $xxx. | |
1323 | ;; | |
1324 | *) | |
1325 | echo "I don't see $file out there, $say." | |
1326 | say=either | |
1327 | ;; | |
1328 | esac | |
1329 | done | |
1330 | case "$egrep" in | |
1331 | egrep) | |
1332 | echo "Substituting grep for egrep." | |
1333 | egrep=$grep | |
1334 | ;; | |
1335 | esac | |
1336 | case "$test" in | |
1337 | test) | |
1338 | echo "Hopefully test is built into your sh." | |
1339 | ;; | |
1340 | *) | |
ecfc5424 | 1341 | if `sh -c "PATH= test true" >/dev/null 2>&1`; then |
2304df62 AD |
1342 | echo "Using the test built into your sh." |
1343 | test=test | |
1344 | _test=test | |
1345 | fi | |
1346 | ;; | |
1347 | esac | |
1348 | case "$echo" in | |
1349 | echo) | |
1350 | echo "Hopefully echo is built into your sh." | |
1351 | ;; | |
1352 | '') ;; | |
1353 | *) | |
1354 | echo " " | |
1355 | echo "Checking compatibility between $echo and builtin echo (if any)..." >&4 | |
1356 | $echo $n "hi there$c" >foo1 | |
1357 | echo $n "hi there$c" >foo2 | |
1358 | if cmp foo1 foo2 >/dev/null 2>&1; then | |
1359 | echo "They are compatible. In fact, they may be identical." | |
1360 | else | |
1361 | case "$n" in | |
1362 | '-n') n='' c='\c';; | |
1363 | *) n='-n' c='';; | |
1364 | esac | |
1365 | cat <<FOO | |
1366 | They are not compatible! You are probably running ksh on a non-USG system. | |
1367 | I'll have to use $echo instead of the builtin, since Bourne shell doesn't | |
1368 | have echo built in and we may have to run some Bourne shell scripts. That | |
1369 | means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous. | |
1370 | ||
1371 | FOO | |
1372 | $echo $n "The star should be here-->$c" | |
1373 | $echo "*" | |
1374 | fi | |
1375 | $rm -f foo1 foo2 | |
1376 | ;; | |
1377 | esac | |
1378 | ||
a0d0e21e LW |
1379 | : determine whether symbolic links are supported |
1380 | echo " " | |
1381 | $touch blurfl | |
1382 | if $ln -s blurfl sym > /dev/null 2>&1 ; then | |
1383 | echo "Symbolic links are supported." >&4 | |
1384 | lns="$ln -s" | |
1385 | else | |
1386 | echo "Symbolic links are NOT supported." >&4 | |
1387 | lns="$ln" | |
1388 | fi | |
1389 | $rm -f blurfl sym | |
1390 | ||
ecfc5424 AD |
1391 | : see whether [:lower:] and [:upper:] are supported character classes |
1392 | echo " " | |
1393 | up='[A-Z]' | |
1394 | low='[a-z]' | |
1395 | case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in | |
1396 | ABYZ) | |
1397 | echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4 | |
1398 | up='[:upper:]' | |
1399 | low='[:lower:]' | |
1400 | ;; | |
1401 | *) | |
1402 | echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4 | |
1403 | ;; | |
1404 | esac | |
1405 | : set up the translation script tr, must be called with ./tr of course | |
1406 | cat >tr <<EOSC | |
1407 | $startsh | |
1408 | case "\$1\$2" in | |
1409 | '[A-Z][a-z]') exec $tr '$up' '$low';; | |
1410 | '[a-z][A-Z]') exec $tr '$low' '$up';; | |
1411 | esac | |
1412 | exec $tr "\$@" | |
1413 | EOSC | |
1414 | chmod +x tr | |
1415 | $eunicefix tr | |
1416 | ||
2304df62 AD |
1417 | : Try to determine whether config.sh was made on this system |
1418 | case "$config_sh" in | |
1419 | '') | |
1420 | myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1` | |
a0d0e21e | 1421 | myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \ |
ecfc5424 | 1422 | ./tr '[A-Z]' '[a-z]' | tr '\012' ' '` |
1aef975c | 1423 | newmyuname="$myuname" |
2304df62 | 1424 | dflt=n |
ecfc5424 AD |
1425 | if test "$fastread" = yes; then |
1426 | dflt=y | |
1427 | elif test -f ../config.sh; then | |
2304df62 | 1428 | if $contains myuname= ../config.sh >/dev/null 2>&1; then |
1aef975c | 1429 | eval "`grep myuname= ../config.sh`" |
2304df62 | 1430 | fi |
1aef975c | 1431 | if test "X$myuname" = "X$newmyuname"; then |
2304df62 AD |
1432 | dflt=y |
1433 | fi | |
1434 | fi | |
1435 | ||
1436 | : Get old answers from old config file if Configure was run on the | |
1437 | : same system, otherwise use the hints. | |
1438 | hint=default | |
1439 | cd .. | |
1440 | if test -f config.sh; then | |
1441 | echo " " | |
1442 | rp="I see a config.sh file. Shall I use it to set the defaults?" | |
1443 | . UU/myread | |
1444 | case "$ans" in | |
1445 | n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;; | |
1446 | *) echo "Fetching default answers from your old config.sh file..." >&4 | |
ecfc5424 AD |
1447 | tmp_n="$n" |
1448 | tmp_c="$c" | |
2304df62 AD |
1449 | . ./config.sh |
1450 | cp config.sh UU | |
ecfc5424 AD |
1451 | n="$tmp_n" |
1452 | c="$tmp_c" | |
2304df62 AD |
1453 | hint=previous |
1454 | ;; | |
1455 | esac | |
1456 | fi | |
1457 | if test ! -f config.sh; then | |
1458 | $cat <<EOM | |
1459 | ||
1460 | First time through, eh? I have some defaults handy for the following systems: | |
1461 | ||
1462 | EOM | |
1463 | cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&4 | |
1464 | dflt='' | |
1465 | : Half the following guesses are probably wrong... If you have better | |
1466 | : tests or hints, please send them to lwall@netlabs.com | |
1467 | : The metaconfig authors would also appreciate a copy... | |
a0d0e21e | 1468 | $test -f /irix && osname=irix |
85e6fe83 LW |
1469 | $test -f /xenix && osname=sco_xenix |
1470 | $test -f /dynix && osname=dynix | |
1471 | $test -f /dnix && osname=dnix | |
a0d0e21e | 1472 | $test -f /unicos && osname=unicos && osvers=`$uname -r` |
85e6fe83 | 1473 | $test -f /bin/mips && /bin/mips && osname=mips |
ecfc5424 AD |
1474 | $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \ |
1475 | $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4 | |
a0d0e21e LW |
1476 | $test -d /usr/apollo/bin && osname=apollo |
1477 | $test -f /etc/saf/_sactab && osname=svr4 | |
85e6fe83 | 1478 | $test -d /usr/include/minix && osname=minix |
2304df62 AD |
1479 | if $test -f $uname; then |
1480 | set X $myuname | |
1481 | shift | |
1482 | ||
2304df62 | 1483 | case "$5" in |
85e6fe83 | 1484 | fps*) osname=fps ;; |
2304df62 AD |
1485 | mips*) |
1486 | case "$4" in | |
85e6fe83 LW |
1487 | umips) osname=umips ;; |
1488 | *) osname=mips ;; | |
2304df62 | 1489 | esac;; |
85e6fe83 LW |
1490 | [23]100) osname=mips ;; |
1491 | next*) osname=next ;; | |
1492 | news*) osname=news ;; | |
ecfc5424 AD |
1493 | i386*) |
1494 | if $test -f /etc/kconfig; then | |
1495 | osname=isc | |
a0d0e21e LW |
1496 | if test "$lns" = "ln -s"; then |
1497 | osvers=4 | |
1498 | elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then | |
1499 | osvers=3 | |
2304df62 | 1500 | elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then |
a0d0e21e | 1501 | osvers=2 |
ecfc5424 AD |
1502 | fi |
1503 | fi | |
1504 | ;; | |
2304df62 AD |
1505 | esac |
1506 | ||
1507 | case "$1" in | |
a0d0e21e LW |
1508 | aix) osname=aix |
1509 | tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1` | |
1510 | case "$tmp" in | |
1aef975c | 1511 | 'not found') osvers="$4"."$3" ;; |
a0d0e21e LW |
1512 | '<3240'|'<>3240') osvers=3.2.0 ;; |
1513 | '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;; | |
1514 | '=3250'|'>3250') osvers=3.2.5 ;; | |
1aef975c | 1515 | *) osvers=$tmp;; |
a0d0e21e LW |
1516 | esac |
1517 | ;; | |
1518 | dnix) osname=dnix | |
1519 | osvers="$3" | |
1520 | ;; | |
1521 | domainos) osname=apollo | |
1522 | osvers="$3" | |
1523 | ;; | |
1524 | dgux) osname=dgux | |
1525 | osvers="$3" | |
1526 | ;; | |
1527 | freebsd) osname=freebsd | |
1528 | osvers="$3" ;; | |
1529 | genix) osname=genix ;; | |
1530 | hp*) osname=hpux | |
1531 | case "$3" in | |
1532 | *.08.*) osvers=9 ;; | |
1533 | *.09.*) osvers=9 ;; | |
1534 | *.10.*) osvers=10 ;; | |
ecfc5424 | 1535 | *) osvers="$3" ;; |
a0d0e21e LW |
1536 | esac |
1537 | ;; | |
1538 | irix) osname=irix | |
1539 | case "$3" in | |
1540 | 4*) osvers=4 ;; | |
1541 | 5*) osvers=5 ;; | |
ecfc5424 | 1542 | *) osvers="$3" ;; |
a0d0e21e LW |
1543 | esac |
1544 | ;; | |
1545 | linux) osname=linux | |
1546 | case "$3" in | |
1547 | 1*) osvers=1 ;; | |
1548 | *) osvers="$3" ;; | |
1549 | esac | |
1550 | ;; | |
1551 | netbsd*) osname=netbsd | |
ecfc5424 AD |
1552 | osvers="$3" |
1553 | ;; | |
a0d0e21e LW |
1554 | bsd386) osname=bsd386 |
1555 | osvers=`$uname -r` | |
1556 | ;; | |
1557 | next*) osname=next ;; | |
1558 | solaris) osname=solaris | |
1559 | case "$3" in | |
1560 | 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;; | |
ecfc5424 | 1561 | *) osvers="$3" ;; |
a0d0e21e LW |
1562 | esac |
1563 | ;; | |
85e6fe83 LW |
1564 | sunos) osname=sunos |
1565 | case "$3" in | |
85e6fe83 LW |
1566 | 5*) osname=solaris |
1567 | osvers=`echo $3 | $sed 's/^5/2/g'` ;; | |
a0d0e21e | 1568 | *) osvers="$3" ;; |
2304df62 AD |
1569 | esac |
1570 | ;; | |
a0d0e21e | 1571 | titanos) osname=titanos |
85e6fe83 | 1572 | case "$3" in |
a0d0e21e LW |
1573 | 1*) osvers=1 ;; |
1574 | 2*) osvers=2 ;; | |
1575 | 3*) osvers=3 ;; | |
1576 | 4*) osvers=4 ;; | |
ecfc5424 | 1577 | *) osvers="$3" ;; |
2304df62 AD |
1578 | esac |
1579 | ;; | |
85e6fe83 | 1580 | ultrix) osname=ultrix |
ecfc5424 | 1581 | osvers="$3" |
2304df62 | 1582 | ;; |
85e6fe83 LW |
1583 | osf1) case "$5" in |
1584 | alpha) osname=dec_osf | |
1585 | case "$3" in | |
ecfc5424 AD |
1586 | [vt]1\.*) osvers=1 ;; |
1587 | [vt]2\.*) osvers=2 ;; | |
1588 | [vt]3\.*) osvers=3 ;; | |
85e6fe83 | 1589 | esac |
ecfc5424 AD |
1590 | ;; |
1591 | hp*) osname=hp_osf1 ;; | |
1592 | mips) osname=mips_osf1 ;; | |
85e6fe83 LW |
1593 | esac |
1594 | ;; | |
a0d0e21e LW |
1595 | uts) osname=uts |
1596 | osvers="$3" | |
1597 | ;; | |
85e6fe83 | 1598 | $2) case "$osname" in |
2304df62 | 1599 | *isc*) ;; |
a0d0e21e LW |
1600 | *freebsd*) ;; |
1601 | svr*) | |
1602 | : svr4.x or possibly later | |
1603 | case "svr$3" in | |
1604 | ${osname}*) | |
1605 | osname=svr$3 | |
1606 | osvers=$4 | |
1607 | ;; | |
1608 | esac | |
1609 | case "$osname" in | |
1610 | svr4.0) | |
1611 | : Check for ESIX | |
1612 | if test -f /stand/boot ; then | |
1613 | eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot` | |
ecfc5424 AD |
1614 | if test -n "$INITPROG" -a -f "$INITPROG"; then |
1615 | isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'` | |
1616 | if test -n "$isesix"; then | |
a0d0e21e LW |
1617 | osname=esix4 |
1618 | fi | |
1619 | fi | |
1620 | fi | |
1621 | ;; | |
1622 | esac | |
1623 | ;; | |
2304df62 | 1624 | *) if test -f /etc/systemid; then |
a0d0e21e LW |
1625 | osname=sco |
1626 | set `echo $3 | $sed 's/\./ /g'` $4 | |
2304df62 | 1627 | if $test -f sco_$1_$2_$3.sh; then |
85e6fe83 | 1628 | osvers=$1.$2.$3 |
2304df62 | 1629 | elif $test -f sco_$1_$2.sh; then |
85e6fe83 | 1630 | osvers=$1.$2 |
2304df62 | 1631 | elif $test -f sco_$1.sh; then |
85e6fe83 | 1632 | osvers=$1 |
2304df62 | 1633 | fi |
a0d0e21e LW |
1634 | else |
1635 | case "$osname" in | |
1636 | '') : Still unknown. Probably a generic Sys V. | |
1637 | osname="sysv" | |
1638 | osvers="$3" | |
1639 | ;; | |
1640 | esac | |
2304df62 AD |
1641 | fi |
1642 | ;; | |
1643 | esac | |
1644 | ;; | |
a0d0e21e LW |
1645 | *) case "$osname" in |
1646 | '') : Still unknown. Probably a generic BSD. | |
1647 | osname="$1" | |
1648 | osvers="$3" | |
1649 | ;; | |
1650 | esac | |
1651 | ;; | |
2304df62 AD |
1652 | esac |
1653 | else | |
1654 | if test -f /vmunix -a -f news_os.sh; then | |
ecfc5424 | 1655 | (what /vmunix | ../UU/tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1 |
2304df62 | 1656 | if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then |
85e6fe83 | 1657 | osname=news_os |
2304df62 AD |
1658 | fi |
1659 | $rm -f ../UU/kernel.what | |
1660 | fi | |
1661 | fi | |
85e6fe83 | 1662 | |
a0d0e21e LW |
1663 | : Now look for a hint file osname_osvers, unless one has been |
1664 | : specified already. | |
1665 | case "$hintfile" in | |
1666 | ''|' ') | |
ecfc5424 | 1667 | file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'` |
a0d0e21e | 1668 | : Also try without trailing minor version numbers. |
ecfc5424 AD |
1669 | xfile=`echo $file | $sed -e 's@_[^_]*$@@'` |
1670 | xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'` | |
1671 | xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'` | |
1672 | xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'` | |
a0d0e21e LW |
1673 | case "$file" in |
1674 | '') dflt=none ;; | |
1675 | *) case "$osvers" in | |
1676 | '') dflt=$file | |
1677 | ;; | |
1678 | *) if $test -f $file.sh ; then | |
1679 | dflt=$file | |
1680 | elif $test -f $xfile.sh ; then | |
1681 | dflt=$xfile | |
1682 | elif $test -f $xxfile.sh ; then | |
1683 | dflt=$xxfile | |
1684 | elif $test -f $xxxfile.sh ; then | |
1685 | dflt=$xxxfile | |
1686 | elif $test -f $xxxxfile.sh ; then | |
1687 | dflt=$xxxxfile | |
1688 | elif $test -f "${osname}.sh" ; then | |
1689 | dflt="${osname}" | |
1690 | else | |
1691 | dflt=none | |
1692 | fi | |
1693 | ;; | |
1694 | esac | |
85e6fe83 LW |
1695 | ;; |
1696 | esac | |
1697 | ;; | |
a0d0e21e | 1698 | *) |
ecfc5424 | 1699 | dflt=`echo $hintfile | $sed 's/\.sh$//'` |
a0d0e21e | 1700 | ;; |
2304df62 | 1701 | esac |
1aef975c | 1702 | |
2304df62 AD |
1703 | $cat <<EOM |
1704 | ||
1705 | You may give one or more space-separated answers, or "none" if appropriate. | |
1706 | If your OS version has no hints, DO NOT give a wrong version -- say "none". | |
1707 | ||
1708 | EOM | |
1709 | rp="Which of these apply, if any?" | |
1710 | . ../UU/myread | |
85e6fe83 LW |
1711 | tans=$ans |
1712 | for file in $tans; do | |
2304df62 AD |
1713 | if $test -f $file.sh; then |
1714 | . ./$file.sh | |
1715 | $cat $file.sh >> ../UU/config.sh | |
85e6fe83 | 1716 | elif $test X$tans = X -o X$tans = Xnone ; then |
2304df62 AD |
1717 | : nothing |
1718 | else | |
85e6fe83 LW |
1719 | : Give one chance to correct a possible typo. |
1720 | echo "$file.sh does not exist" | |
1721 | dflt=$file | |
1722 | rp="hint to use instead?" | |
1723 | . ../UU/myread | |
1724 | for file in $ans; do | |
1725 | if $test -f "$file.sh"; then | |
1726 | . ./$file.sh | |
1727 | $cat $file.sh >> ../UU/config.sh | |
1728 | elif $test X$ans = X -o X$ans = Xnone ; then | |
1729 | : nothing | |
1730 | else | |
1731 | echo "$file.sh does not exist -- ignored." | |
1732 | fi | |
1733 | done | |
2304df62 AD |
1734 | fi |
1735 | done | |
85e6fe83 | 1736 | |
2304df62 | 1737 | hint=recommended |
85e6fe83 LW |
1738 | : Remember our hint file for later. |
1739 | if $test -f "$file.sh" ; then | |
a0d0e21e | 1740 | hintfile="$file" |
85e6fe83 | 1741 | else |
a0d0e21e | 1742 | hintfile='' |
85e6fe83 LW |
1743 | fi |
1744 | ||
2304df62 AD |
1745 | cd .. |
1746 | fi | |
1747 | cd UU | |
1748 | ;; | |
1749 | *) | |
1750 | echo " " | |
1751 | echo "Fetching default answers from $config_sh..." >&4 | |
ecfc5424 AD |
1752 | tmp_n="$n" |
1753 | tmp_c="$c" | |
2304df62 AD |
1754 | cd .. |
1755 | cp $config_sh config.sh 2>/dev/null | |
1756 | . ./config.sh | |
1757 | cd UU | |
1758 | cp ../config.sh . | |
ecfc5424 AD |
1759 | n="$tmp_n" |
1760 | c="$tmp_c" | |
2304df62 AD |
1761 | hint=previous |
1762 | ;; | |
1763 | esac | |
1aef975c AD |
1764 | test "$override" && . ./optdef.sh |
1765 | myuname="$newmyuname" | |
2304df62 AD |
1766 | |
1767 | : Restore computed paths | |
1768 | for file in $loclist $trylist; do | |
1769 | eval $file="\$_$file" | |
1770 | done | |
1771 | ||
85e6fe83 | 1772 | cat << EOM |
a0d0e21e | 1773 | |
85e6fe83 | 1774 | Configure uses the operating system name and version to set some defaults. |
ecfc5424 AD |
1775 | The default value is probably right if the name rings a bell. Otherwise, |
1776 | since spelling matters for me, either accept the default or answer "none" | |
1777 | to leave it blank. | |
a0d0e21e | 1778 | |
85e6fe83 | 1779 | EOM |
85e6fe83 | 1780 | case "$osname" in |
a0d0e21e | 1781 | ''|' ') |
85e6fe83 | 1782 | case "$hintfile" in |
a0d0e21e | 1783 | ''|' '|none) dflt=none ;; |
ecfc5424 | 1784 | *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;; |
85e6fe83 LW |
1785 | esac |
1786 | ;; | |
1787 | *) dflt="$osname" ;; | |
1788 | esac | |
1789 | rp="Operating system name?" | |
1790 | . ./myread | |
1791 | case "$ans" in | |
ecfc5424 AD |
1792 | none) osname='' ;; |
1793 | *) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;; | |
85e6fe83 | 1794 | esac |
2304df62 AD |
1795 | : who configured the system |
1796 | cf_time=`$date 2>&1` | |
a0d0e21e LW |
1797 | (logname > .temp) >/dev/null 2>&1 |
1798 | $test -s .temp || (whoami > .temp) >/dev/null 2>&1 | |
1799 | $test -s .temp || echo unknown > .temp | |
1800 | cf_by=`$cat .temp` | |
1801 | $rm -f .temp | |
2304df62 AD |
1802 | |
1803 | : determine where manual pages are on this system | |
1804 | echo " " | |
1805 | case "$sysman" in | |
1806 | '') | |
a0d0e21e | 1807 | syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1' |
2304df62 AD |
1808 | syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1" |
1809 | syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1" | |
1810 | syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1" | |
a0d0e21e LW |
1811 | syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1" |
1812 | sysman=`./loc . /usr/man/man1 $syspath` | |
2304df62 AD |
1813 | ;; |
1814 | esac | |
1815 | if $test -d "$sysman"; then | |
1816 | echo "System manual is in $sysman." >&4 | |
1817 | else | |
1818 | echo "Could not find manual pages in source form." >&4 | |
1819 | fi | |
1820 | ||
1821 | : see what memory models we can support | |
1822 | case "$models" in | |
1823 | '') | |
1824 | $cat >pdp11.c <<'EOP' | |
1825 | main() { | |
1826 | #ifdef pdp11 | |
1827 | exit(0); | |
1828 | #else | |
1829 | exit(1); | |
1830 | #endif | |
1831 | } | |
1832 | EOP | |
1833 | cc -o pdp11 pdp11.c >/dev/null 2>&1 | |
1834 | if ./pdp11 2>/dev/null; then | |
1835 | dflt='unsplit split' | |
1836 | else | |
1837 | tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` | |
1838 | case "$tans" in | |
1839 | X) dflt='none';; | |
1840 | *) if $test -d /lib/small || $test -d /usr/lib/small; then | |
1841 | dflt='small' | |
1842 | else | |
1843 | dflt='' | |
1844 | fi | |
1845 | if $test -d /lib/medium || $test -d /usr/lib/medium; then | |
1846 | dflt="$dflt medium" | |
1847 | fi | |
1848 | if $test -d /lib/large || $test -d /usr/lib/large; then | |
1849 | dflt="$dflt large" | |
1850 | fi | |
1851 | if $test -d /lib/huge || $test -d /usr/lib/huge; then | |
1852 | dflt="$dflt huge" | |
1853 | fi | |
1854 | esac | |
1855 | fi;; | |
1856 | *) dflt="$models";; | |
1857 | esac | |
1858 | $cat <<EOM | |
1859 | ||
1860 | Some systems have different model sizes. On most systems they are called | |
1861 | small, medium, large, and huge. On the PDP11 they are called unsplit and | |
1862 | split. If your system doesn't support different memory models, say "none". | |
1863 | If you wish to force everything to one memory model, say "none" here and | |
1864 | put the appropriate flags later when it asks you for other cc and ld flags. | |
1865 | Venix systems may wish to put "none" and let the compiler figure things out. | |
1866 | (In the following question multiple model names should be space separated.) | |
1867 | ||
1868 | EOM | |
1869 | rp="Which memory models are supported?" | |
1870 | . ./myread | |
1871 | models="$ans" | |
1872 | ||
1873 | case "$models" in | |
1874 | none) | |
1875 | small='' | |
1876 | medium='' | |
1877 | large='' | |
1878 | huge='' | |
1879 | unsplit='' | |
1880 | split='' | |
1881 | ;; | |
1882 | *split) | |
1883 | case "$split" in | |
1884 | '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \ | |
1885 | $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then | |
1886 | dflt='-i' | |
1887 | else | |
1888 | dflt='none' | |
1889 | fi;; | |
1890 | *) dflt="$split";; | |
1891 | esac | |
1892 | rp="What flag indicates separate I and D space?" | |
1893 | . ./myread | |
1894 | tans="$ans" | |
1895 | case "$tans" in | |
1896 | none) tans='';; | |
1897 | esac | |
1898 | split="$tans" | |
1899 | unsplit='';; | |
1900 | *large*|*small*|*medium*|*huge*) | |
1901 | case "$models" in | |
1902 | *large*) | |
1903 | case "$large" in | |
1904 | '') dflt='-Ml';; | |
1905 | *) dflt="$large";; | |
1906 | esac | |
1907 | rp="What flag indicates large model?" | |
1908 | . ./myread | |
1909 | tans="$ans" | |
1910 | case "$tans" in | |
1911 | none) tans=''; | |
1912 | esac | |
1913 | large="$tans";; | |
1914 | *) large='';; | |
1915 | esac | |
1916 | case "$models" in | |
1917 | *huge*) case "$huge" in | |
1918 | '') dflt='-Mh';; | |
1919 | *) dflt="$huge";; | |
1920 | esac | |
1921 | rp="What flag indicates huge model?" | |
1922 | . ./myread | |
1923 | tans="$ans" | |
1924 | case "$tans" in | |
1925 | none) tans=''; | |
1926 | esac | |
1927 | huge="$tans";; | |
1928 | *) huge="$large";; | |
1929 | esac | |
1930 | case "$models" in | |
1931 | *medium*) case "$medium" in | |
1932 | '') dflt='-Mm';; | |
1933 | *) dflt="$medium";; | |
1934 | esac | |
1935 | rp="What flag indicates medium model?" | |
1936 | . ./myread | |
1937 | tans="$ans" | |
1938 | case "$tans" in | |
1939 | none) tans=''; | |
1940 | esac | |
1941 | medium="$tans";; | |
1942 | *) medium="$large";; | |
1943 | esac | |
1944 | case "$models" in | |
1945 | *small*) case "$small" in | |
1946 | '') dflt='none';; | |
1947 | *) dflt="$small";; | |
1948 | esac | |
1949 | rp="What flag indicates small model?" | |
1950 | . ./myread | |
1951 | tans="$ans" | |
1952 | case "$tans" in | |
1953 | none) tans=''; | |
1954 | esac | |
1955 | small="$tans";; | |
1956 | *) small='';; | |
1957 | esac | |
1958 | ;; | |
1959 | *) | |
1960 | echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4 | |
1961 | ;; | |
1962 | esac | |
1963 | ||
1964 | : make some quick guesses about what we are up against | |
1965 | echo " " | |
1966 | $echo $n "Hmm... $c" | |
1967 | echo exit 1 >bsd | |
1968 | echo exit 1 >usg | |
1969 | echo exit 1 >v7 | |
1970 | echo exit 1 >osf1 | |
1971 | echo exit 1 >eunice | |
1972 | echo exit 1 >xenix | |
1973 | echo exit 1 >venix | |
ecfc5424 | 1974 | d_bsd="$undef" |
2304df62 AD |
1975 | $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null |
1976 | if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1 | |
1977 | then | |
1978 | echo "Looks kind of like an OSF/1 system, but we'll see..." | |
1979 | echo exit 0 >osf1 | |
1980 | elif test `echo abc | tr a-z A-Z` = Abc ; then | |
1981 | xxx=`./loc addbib blurfl $pth` | |
1982 | if $test -f $xxx; then | |
1983 | echo "Looks kind of like a USG system with BSD features, but we'll see..." | |
1984 | echo exit 0 >bsd | |
1985 | echo exit 0 >usg | |
1986 | else | |
1987 | if $contains SIGTSTP foo >/dev/null 2>&1 ; then | |
1988 | echo "Looks kind of like an extended USG system, but we'll see..." | |
1989 | else | |
1990 | echo "Looks kind of like a USG system, but we'll see..." | |
1991 | fi | |
1992 | echo exit 0 >usg | |
1993 | fi | |
1994 | elif $contains SIGTSTP foo >/dev/null 2>&1 ; then | |
1995 | echo "Looks kind of like a BSD system, but we'll see..." | |
ecfc5424 | 1996 | d_bsd="$define" |
2304df62 AD |
1997 | echo exit 0 >bsd |
1998 | else | |
1999 | echo "Looks kind of like a Version 7 system, but we'll see..." | |
2000 | echo exit 0 >v7 | |
2001 | fi | |
2002 | case "$eunicefix" in | |
2003 | *unixtovms*) | |
2004 | $cat <<'EOI' | |
2005 | There is, however, a strange, musty smell in the air that reminds me of | |
2006 | something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit. | |
2007 | EOI | |
2008 | echo exit 0 >eunice | |
2009 | d_eunice="$define" | |
2010 | : it so happens the Eunice I know will not run shell scripts in Unix format | |
2011 | ;; | |
2012 | *) | |
2013 | echo " " | |
2014 | echo "Congratulations. You aren't running Eunice." | |
2015 | d_eunice="$undef" | |
2016 | ;; | |
2017 | esac | |
2018 | if test -f /xenix; then | |
2019 | echo "Actually, this looks more like a XENIX system..." | |
2020 | echo exit 0 >xenix | |
2021 | d_xenix="$define" | |
2022 | else | |
2023 | echo " " | |
2024 | echo "It's not Xenix..." | |
2025 | d_xenix="$undef" | |
2026 | fi | |
2027 | chmod +x xenix | |
2028 | $eunicefix xenix | |
2029 | if test -f /venix; then | |
2030 | echo "Actually, this looks more like a VENIX system..." | |
2031 | echo exit 0 >venix | |
2032 | else | |
2033 | echo " " | |
ecfc5424 | 2034 | if ./xenix; then |
2304df62 AD |
2035 | : null |
2036 | else | |
2037 | echo "Nor is it Venix..." | |
2038 | fi | |
2039 | fi | |
2040 | chmod +x bsd usg v7 osf1 eunice xenix venix | |
2041 | $eunicefix bsd usg v7 osf1 eunice xenix venix | |
2042 | $rm -f foo | |
2043 | ||
2044 | : see if we need a special compiler | |
2045 | echo " " | |
ecfc5424 | 2046 | if ./usg; then |
2304df62 AD |
2047 | case "$cc" in |
2048 | '') case "$Mcc" in | |
2049 | /*) dflt='Mcc';; | |
2050 | *) case "$large" in | |
2051 | -M*) dflt='cc';; | |
2052 | *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then | |
2053 | if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then | |
2054 | dflt='cc' | |
2055 | else | |
2056 | dflt='cc -M' | |
2057 | fi | |
2058 | else | |
2059 | dflt='cc' | |
2060 | fi;; | |
2061 | esac;; | |
2062 | esac;; | |
2063 | *) dflt="$cc";; | |
2064 | esac | |
2065 | $cat <<'EOM' | |
2066 | On some systems the default C compiler will not resolve multiple global | |
2067 | references that happen to have the same name. On some such systems the "Mcc" | |
2068 | command may be used to force these to be resolved. On other systems a "cc -M" | |
2069 | command is required. (Note that the -M flag on other systems indicates a | |
2070 | memory model to use!) If you have the Gnu C compiler, you might wish to use | |
2071 | that instead. | |
2072 | ||
2073 | EOM | |
2074 | rp="What command will force resolution on this system?" | |
2075 | . ./myread | |
2076 | cc="$ans" | |
2077 | else | |
2078 | case "$cc" in | |
2079 | '') dflt=cc;; | |
2080 | *) dflt="$cc";; | |
2081 | esac | |
2082 | rp="Use which C compiler?" | |
2083 | . ./myread | |
2084 | cc="$ans" | |
2085 | fi | |
ecfc5424 AD |
2086 | echo " " |
2087 | echo "Checking for GNU cc in disguise and/or its version number..." >&4 | |
2304df62 AD |
2088 | $cat >gccvers.c <<EOM |
2089 | #include <stdio.h> | |
a0d0e21e | 2090 | int main() { |
2304df62 | 2091 | #ifdef __GNUC__ |
a0d0e21e | 2092 | #ifdef __VERSION__ |
ecfc5424 | 2093 | printf("%s\n", __VERSION__); |
2304df62 | 2094 | #else |
ecfc5424 | 2095 | printf("%s\n", "1"); |
2304df62 | 2096 | #endif |
a0d0e21e | 2097 | #endif |
ecfc5424 | 2098 | exit(0); |
2304df62 AD |
2099 | } |
2100 | EOM | |
a0d0e21e LW |
2101 | if $cc -o gccvers gccvers.c >/dev/null 2>&1; then |
2102 | gccversion=`./gccvers` | |
2103 | case "$gccversion" in | |
2104 | '') echo "You are not using GNU cc." ;; | |
2105 | *) echo "You are using GNU cc $gccversion." ;; | |
2106 | esac | |
2107 | else | |
ecfc5424 | 2108 | echo "I can't compile the test program -- Assuming it isn't GNU cc." |
a0d0e21e LW |
2109 | fi |
2110 | $rm -f gccvers* | |
2111 | case "$gccversion" in | |
2112 | 1*) cpp=`./loc gcc-cpp $cpp $pth` ;; | |
2304df62 | 2113 | esac |
a0d0e21e | 2114 | |
2304df62 AD |
2115 | : decide how portable to be |
2116 | case "$d_portable" in | |
2117 | "$define") dflt=y;; | |
2118 | *) dflt=n;; | |
2119 | esac | |
2120 | $cat <<'EOH' | |
2121 | ||
2122 | I can set things up so that your shell scripts and binaries are more portable, | |
2123 | at what may be a noticable cost in performance. In particular, if you | |
2124 | ask to be portable, the following happens: | |
2125 | ||
2126 | 1) Shell scripts will rely on the PATH variable rather than using | |
2127 | the paths derived above. | |
2128 | 2) ~username interpretations will be done at run time rather than | |
2129 | by Configure. | |
2130 | ||
2131 | EOH | |
2132 | rp="Do you expect to run these scripts and binaries on multiple machines?" | |
2133 | . ./myread | |
2134 | case "$ans" in | |
2135 | y*) d_portable="$define" | |
2304df62 AD |
2136 | ;; |
2137 | *) d_portable="$undef" ;; | |
2138 | esac | |
2139 | ||
2140 | : set up shell script to do ~ expansion | |
2141 | cat >filexp <<EOSS | |
2142 | $startsh | |
2143 | : expand filename | |
2144 | case "\$1" in | |
2145 | ~/*|~) | |
2146 | echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|" | |
2147 | ;; | |
2148 | ~*) | |
2149 | if $test -f /bin/csh; then | |
2150 | /bin/csh -f -c "glob \$1" | |
a0d0e21e | 2151 | failed=\$? |
2304df62 AD |
2152 | echo "" |
2153 | exit \$failed | |
2154 | else | |
2155 | name=\`$expr x\$1 : '..\([^/]*\)'\` | |
2156 | dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\` | |
2157 | if $test ! -d "\$dir"; then | |
2158 | me=\`basename \$0\` | |
2159 | echo "\$me: can't locate home directory for: \$name" >&2 | |
2160 | exit 1 | |
2161 | fi | |
2162 | case "\$1" in | |
2163 | */*) | |
2164 | echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` | |
2165 | ;; | |
2166 | *) | |
2167 | echo \$dir | |
2168 | ;; | |
2169 | esac | |
2170 | fi | |
2171 | ;; | |
2172 | *) | |
2173 | echo \$1 | |
2174 | ;; | |
2175 | esac | |
2176 | EOSS | |
2177 | chmod +x filexp | |
2178 | $eunicefix filexp | |
2179 | ||
2180 | : now set up to get a file name | |
2181 | cat <<'EOSC' >getfile | |
2182 | tilde='' | |
2183 | fullpath='' | |
2184 | already='' | |
2185 | skip='' | |
2186 | none_ok='' | |
2187 | exp_file='' | |
a0d0e21e | 2188 | nopath_ok='' |
2304df62 AD |
2189 | orig_rp="$rp" |
2190 | orig_dflt="$dflt" | |
2191 | ||
2192 | case "$fn" in | |
ecfc5424 AD |
2193 | *\(*) |
2194 | expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok | |
2195 | fn=`echo $fn | sed 's/(.*)//'` | |
2196 | ;; | |
2197 | esac | |
2198 | ||
2199 | case "$fn" in | |
a0d0e21e LW |
2200 | *:*) |
2201 | loc_file=`expr $fn : '.*:\(.*\)'` | |
2202 | fn=`expr $fn : '\(.*\):.*'` | |
2203 | ;; | |
2204 | esac | |
2205 | ||
2206 | case "$fn" in | |
2304df62 AD |
2207 | *~*) tilde=true;; |
2208 | esac | |
2209 | case "$fn" in | |
2210 | */*) fullpath=true;; | |
2211 | esac | |
2212 | case "$fn" in | |
2213 | *+*) skip=true;; | |
2214 | esac | |
2215 | case "$fn" in | |
2216 | *n*) none_ok=true;; | |
2217 | esac | |
2218 | case "$fn" in | |
2219 | *e*) exp_file=true;; | |
2220 | esac | |
a0d0e21e LW |
2221 | case "$fn" in |
2222 | *p*) nopath_ok=true;; | |
2223 | esac | |
2304df62 AD |
2224 | |
2225 | case "$fn" in | |
2226 | *f*) type='File';; | |
2227 | *d*) type='Directory';; | |
a0d0e21e | 2228 | *l*) type='Locate';; |
2304df62 AD |
2229 | esac |
2230 | ||
2231 | what="$type" | |
2232 | case "$what" in | |
2233 | Locate) what='File';; | |
2234 | esac | |
2235 | ||
2236 | case "$exp_file" in | |
2237 | '') | |
2238 | case "$d_portable" in | |
2239 | "$define") ;; | |
2240 | *) exp_file=true;; | |
2241 | esac | |
2242 | ;; | |
2243 | esac | |
2244 | ||
2245 | cd .. | |
2246 | while test "$type"; do | |
2247 | redo='' | |
2248 | rp="$orig_rp" | |
2249 | dflt="$orig_dflt" | |
2250 | case "$tilde" in | |
2251 | true) rp="$rp (~name ok)";; | |
2252 | esac | |
2253 | . UU/myread | |
ecfc5424 AD |
2254 | if test -f UU/getfile.ok && \ |
2255 | $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1 | |
2256 | then | |
2257 | value="$ans" | |
2258 | ansexp="$ans" | |
2259 | break | |
2260 | fi | |
2304df62 AD |
2261 | case "$ans" in |
2262 | none) | |
2263 | value='' | |
2264 | ansexp='' | |
2265 | case "$none_ok" in | |
2266 | true) type='';; | |
2267 | esac | |
2268 | ;; | |
2269 | *) | |
2270 | case "$tilde" in | |
2271 | '') value="$ans" | |
2272 | ansexp="$ans";; | |
2273 | *) | |
2274 | value=`UU/filexp $ans` | |
2275 | case $? in | |
2276 | 0) | |
2277 | if test "$ans" != "$value"; then | |
ecfc5424 | 2278 | echo "(That expands to $value on this system.)" |
2304df62 AD |
2279 | fi |
2280 | ;; | |
2281 | *) value="$ans";; | |
2282 | esac | |
2283 | ansexp="$value" | |
2284 | case "$exp_file" in | |
2285 | '') value="$ans";; | |
2286 | esac | |
2287 | ;; | |
2288 | esac | |
2289 | case "$fullpath" in | |
2290 | true) | |
2291 | case "$ansexp" in | |
2292 | /*) value="$ansexp" ;; | |
2293 | *) | |
2294 | redo=true | |
2295 | case "$already" in | |
2296 | true) | |
2297 | echo "I shall only accept a full path name, as in /bin/ls." >&4 | |
2298 | echo "Use a ! shell escape if you wish to check pathnames." >&4 | |
2299 | ;; | |
2300 | *) | |
2301 | echo "Please give a full path name, starting with slash." >&4 | |
2302 | case "$tilde" in | |
2303 | true) | |
2304 | echo "Note that using ~name is ok provided it expands well." >&4 | |
2305 | already=true | |
2306 | ;; | |
2307 | esac | |
2308 | esac | |
2309 | ;; | |
2310 | esac | |
2311 | ;; | |
2312 | esac | |
2313 | case "$redo" in | |
2314 | '') | |
2315 | case "$type" in | |
2316 | File) | |
2317 | if test -f "$ansexp"; then | |
2318 | type='' | |
2319 | elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1 | |
2320 | then | |
2321 | echo "($value is not a plain file, but that's ok.)" | |
2322 | type='' | |
2323 | fi | |
2324 | ;; | |
2325 | Directory) | |
2326 | if test -d "$ansexp"; then | |
2327 | type='' | |
2328 | fi | |
2329 | ;; | |
2330 | Locate) | |
2331 | if test -d "$value"; then | |
a0d0e21e LW |
2332 | echo "(Looking for $loc_file in directory $value.)" |
2333 | value="$value/$loc_file" | |
2304df62 AD |
2334 | fi |
2335 | if test -f "$value"; then | |
2336 | type='' | |
2337 | fi | |
a0d0e21e LW |
2338 | case "$nopath_ok" in |
2339 | true) case "$value" in | |
2340 | */*) ;; | |
2341 | *) echo "Assuming $value will be in people's path." | |
2342 | type='' | |
2343 | ;; | |
2344 | esac | |
2345 | ;; | |
2346 | esac | |
2304df62 AD |
2347 | ;; |
2348 | esac | |
2349 | ||
2350 | case "$skip" in | |
2351 | true) type=''; | |
2352 | esac | |
2353 | ||
2354 | case "$type" in | |
2355 | '') ;; | |
2356 | *) | |
2357 | if test "$fastread" = yes; then | |
2358 | dflt=y | |
2359 | else | |
2360 | dflt=n | |
2361 | fi | |
2362 | rp="$what $value doesn't exist. Use that name anyway?" | |
2363 | . UU/myread | |
2364 | dflt='' | |
2365 | case "$ans" in | |
2366 | y*) type='';; | |
2367 | *) echo " ";; | |
2368 | esac | |
2369 | ;; | |
2370 | esac | |
2371 | ;; | |
2372 | esac | |
2373 | ;; | |
2374 | esac | |
2375 | done | |
2376 | cd UU | |
2377 | ans="$value" | |
2378 | rp="$orig_rp" | |
2379 | dflt="$orig_dflt" | |
ecfc5424 | 2380 | rm -f getfile.ok |
2304df62 AD |
2381 | EOSC |
2382 | ||
2383 | : What should the include directory be ? | |
2384 | echo " " | |
2385 | $echo $n "Hmm... $c" | |
a0d0e21e | 2386 | dflt='/usr/include' |
2304df62 AD |
2387 | incpath='' |
2388 | mips_type='' | |
2389 | if $test -f /bin/mips && /bin/mips; then | |
2390 | echo "Looks like a MIPS system..." | |
2391 | $cat >usr.c <<'EOCP' | |
2392 | #ifdef SYSTYPE_BSD43 | |
2393 | /bsd43 | |
2394 | #endif | |
2395 | EOCP | |
2396 | if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then | |
2397 | dflt='/bsd43/usr/include' | |
2398 | incpath='/bsd43' | |
2399 | mips_type='BSD 4.3' | |
2400 | else | |
2401 | mips_type='System V' | |
2402 | fi | |
2403 | $rm -f usr.c usr.out | |
2404 | echo "and you're compiling with the $mips_type compiler and libraries." | |
2405 | else | |
2406 | echo "Doesn't look like a MIPS system." | |
2407 | echo "exit 1" >mips | |
2408 | chmod +x mips | |
2409 | $eunicefix mips | |
2410 | fi | |
2411 | echo " " | |
a0d0e21e LW |
2412 | case "$usrinc" in |
2413 | '') ;; | |
2414 | *) dflt="$usrinc";; | |
2415 | esac | |
2304df62 AD |
2416 | fn=d/ |
2417 | rp='Where are the include files you want to use?' | |
2418 | . ./getfile | |
2419 | usrinc="$ans" | |
2420 | ||
a0d0e21e LW |
2421 | : see how we invoke the C preprocessor |
2422 | echo " " | |
2423 | echo "Now, how can we feed standard input to your C preprocessor..." >&4 | |
2424 | cat <<'EOT' >testcpp.c | |
2425 | #define ABC abc | |
2426 | #define XYZ xyz | |
2427 | ABC.XYZ | |
2428 | EOT | |
2429 | cd .. | |
2430 | echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin | |
2431 | chmod 755 cppstdin | |
2432 | wrapper=`pwd`/cppstdin | |
2433 | ok='false' | |
2434 | cd UU | |
2304df62 | 2435 | |
a0d0e21e LW |
2436 | if $test "X$cppstdin" != "X" && \ |
2437 | $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \ | |
2438 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
2439 | then | |
2440 | echo "You used to use $cppstdin $cppminus so we'll use that again." | |
2441 | case "$cpprun" in | |
2442 | '') echo "But let's see if we can live without a wrapper..." ;; | |
2443 | *) | |
2444 | if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \ | |
2445 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
2304df62 | 2446 | then |
a0d0e21e LW |
2447 | echo "(And we'll use $cpprun $cpplast to preprocess directly.)" |
2448 | ok='true' | |
2449 | else | |
2450 | echo "(However, $cpprun $cpplast does not work, let's see...)" | |
2304df62 AD |
2451 | fi |
2452 | ;; | |
2453 | esac | |
2304df62 | 2454 | else |
a0d0e21e LW |
2455 | case "$cppstdin" in |
2456 | '') ;; | |
2457 | *) | |
2458 | echo "Good old $cppstdin $cppminus does not seem to be of any help..." | |
2459 | ;; | |
2460 | esac | |
2304df62 | 2461 | fi |
2304df62 | 2462 | |
a0d0e21e LW |
2463 | if $ok; then |
2464 | : nothing | |
2465 | elif echo 'Maybe "'"$cc"' -E" will work...'; \ | |
2466 | $cc -E <testcpp.c >testcpp.out 2>&1; \ | |
2467 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2468 | echo "Yup, it does." | |
2469 | x_cpp="$cc -E" | |
2470 | x_minus=''; | |
2471 | elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \ | |
2472 | $cc -E - <testcpp.c >testcpp.out 2>&1; \ | |
2473 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2474 | echo "Yup, it does." | |
2475 | x_cpp="$cc -E" | |
2476 | x_minus='-'; | |
2477 | elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \ | |
2478 | $cc -P <testcpp.c >testcpp.out 2>&1; \ | |
2479 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2480 | echo "Yipee, that works!" | |
2481 | x_cpp="$cc -P" | |
2482 | x_minus=''; | |
2483 | elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \ | |
2484 | $cc -P - <testcpp.c >testcpp.out 2>&1; \ | |
2485 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2486 | echo "At long last!" | |
2487 | x_cpp="$cc -P" | |
2488 | x_minus='-'; | |
2489 | elif echo 'No such luck, maybe "'$cpp'" will work...'; \ | |
2490 | $cpp <testcpp.c >testcpp.out 2>&1; \ | |
2491 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2492 | echo "It works!" | |
2493 | x_cpp="$cpp" | |
2494 | x_minus=''; | |
2495 | elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \ | |
2496 | $cpp - <testcpp.c >testcpp.out 2>&1; \ | |
2497 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2498 | echo "Hooray, it works! I was beginning to wonder." | |
2499 | x_cpp="$cpp" | |
2500 | x_minus='-'; | |
2501 | elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \ | |
2502 | $wrapper <testcpp.c >testcpp.out 2>&1; \ | |
2503 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2504 | x_cpp="$wrapper" | |
2505 | x_minus='' | |
2506 | echo "Eureka!" | |
2507 | else | |
2508 | dflt='' | |
2509 | rp="No dice. I can't find a C preprocessor. Name one:" | |
2510 | . ./myread | |
2511 | x_cpp="$ans" | |
2512 | x_minus='' | |
2513 | $x_cpp <testcpp.c >testcpp.out 2>&1 | |
2514 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2515 | echo "OK, that will do." >&4 | |
2516 | else | |
2517 | echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4 | |
2518 | exit 1 | |
2519 | fi | |
2520 | fi | |
2521 | ||
2522 | case "$ok" in | |
2523 | false) | |
2524 | cppstdin="$x_cpp" | |
2525 | cppminus="$x_minus" | |
2526 | cpprun="$x_cpp" | |
2527 | cpplast="$x_minus" | |
2528 | set X $x_cpp | |
2529 | shift | |
2530 | case "$1" in | |
2531 | "$cpp") | |
2532 | echo "Perhaps can we force $cc -E using a wrapper..." | |
2533 | if $wrapper <testcpp.c >testcpp.out 2>&1; \ | |
2534 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
2535 | then | |
2536 | echo "Yup, we can." | |
2537 | cppstdin="$wrapper" | |
2538 | cppminus=''; | |
2539 | else | |
2540 | echo "Nope, we'll have to live without it..." | |
2541 | fi | |
2542 | ;; | |
2543 | esac | |
2544 | case "$cpprun" in | |
2545 | "$wrapper") | |
2546 | cpprun='' | |
2547 | cpplast='' | |
2548 | ;; | |
2549 | esac | |
2550 | ;; | |
2551 | esac | |
2552 | ||
2553 | case "$cppstdin" in | |
2554 | "$wrapper") ;; | |
2555 | *) $rm -f $wrapper;; | |
2556 | esac | |
2557 | $rm -f testcpp.c testcpp.out | |
2558 | ||
2559 | : determine optimize, if desired, or use for debug flag also | |
2560 | case "$optimize" in | |
2561 | ' ') dflt='none';; | |
2562 | '') dflt='-O';; | |
2563 | *) dflt="$optimize";; | |
2564 | esac | |
2565 | $cat <<EOH | |
2566 | ||
2567 | Some C compilers have problems with their optimizers, by default, $package | |
2568 | compiles with the -O flag to use the optimizer. Alternately, you might want | |
2569 | to use the symbolic debugger, which uses the -g flag (on traditional Unix | |
2570 | systems). Either flag can be specified here. To use neither flag, specify | |
2571 | the word "none". | |
2572 | ||
2573 | EOH | |
2574 | rp="What optimizer/debugger flag should be used?" | |
2575 | . ./myread | |
2576 | optimize="$ans" | |
2577 | case "$optimize" in | |
2578 | 'none') optimize=" ";; | |
2579 | esac | |
2580 | ||
2581 | dflt='' | |
2582 | case "$ccflags" in | |
2583 | '') | |
2584 | case "$gccversion" in | |
2585 | 1*) dflt='-fpcc-struct-return' ;; | |
2586 | esac | |
2587 | case "$optimize" in | |
2588 | *-g*) dflt="$dflt -DDEBUGGING";; | |
2589 | esac | |
2590 | case "$gccversion" in | |
2591 | 2*) if test -d /etc/conf/kconfig.d && | |
2592 | $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1 | |
2593 | then | |
2594 | dflt="$dflt -posix" | |
2595 | fi | |
2596 | ;; | |
2597 | esac | |
2598 | ;; | |
2599 | esac | |
2600 | ||
2601 | case "$mips_type" in | |
2602 | *BSD*) ;; | |
2603 | '') ;; | |
2604 | *) inclwanted="$inclwanted $usrinc/bsd";; | |
2605 | esac | |
2606 | for thisincl in $inclwanted; do | |
2607 | if $test -d $thisincl; then | |
2608 | if $test x$thisincl != x$usrinc; then | |
2609 | case "$dflt" in | |
2610 | *$thisincl*);; | |
2611 | *) dflt="$dflt -I$thisincl";; | |
2612 | esac | |
2613 | fi | |
2614 | fi | |
2615 | done | |
2616 | ||
2617 | inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then | |
2618 | xxx=true; | |
2619 | elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then | |
2620 | xxx=true; | |
2621 | else | |
2622 | xxx=false; | |
2623 | fi; | |
2624 | if $xxx; then | |
2625 | case "$dflt" in | |
2626 | *$2*);; | |
2627 | *) dflt="$dflt -D$2";; | |
2628 | esac; | |
2629 | fi' | |
2630 | ||
2631 | if ./osf1; then | |
2632 | set signal.h __LANGUAGE_C__; eval $inctest | |
2633 | else | |
2634 | set signal.h LANGUAGE_C; eval $inctest | |
2635 | fi | |
2636 | set signal.h NO_PROTOTYPE; eval $inctest | |
2637 | set signal.h _NO_PROTO; eval $inctest | |
2638 | ||
2639 | case "$dflt" in | |
2640 | '') dflt=none;; | |
2304df62 | 2641 | esac |
85e6fe83 LW |
2642 | case "$ccflags" in |
2643 | '') ;; | |
2644 | *) dflt="$ccflags";; | |
2645 | esac | |
2304df62 AD |
2646 | $cat <<EOH |
2647 | ||
2648 | Your C compiler may want other flags. For this question you should include | |
2649 | -I/whatever and -DWHATEVER flags and any other flags used by the C compiler, | |
2650 | but you should NOT include libraries or ld flags like -lwhatever. If you | |
2651 | want $package to honor its debug switch, you should include -DDEBUGGING here. | |
a0d0e21e LW |
2652 | Your C compiler might also need additional flags, such as -D_POSIX_SOURCE, |
2653 | -DHIDEMYMALLOC or -DCRIPPLED_CC. | |
2654 | ||
2304df62 AD |
2655 | To use no flags, specify the word "none". |
2656 | ||
2304df62 AD |
2657 | EOH |
2658 | set X $dflt | |
2659 | shift | |
2660 | dflt=${1+"$@"} | |
2661 | rp="Any additional cc flags?" | |
2662 | . ./myread | |
2663 | case "$ans" in | |
2664 | none) ccflags='';; | |
2665 | *) ccflags="$ans";; | |
2666 | esac | |
2667 | ||
2668 | : the following weeds options from ccflags that are of no interest to cpp | |
2669 | cppflags="$ccflags" | |
a0d0e21e LW |
2670 | case "$gccversion" in |
2671 | 1*) cppflags="$cppflags -D__GNUC__" | |
2304df62 AD |
2672 | esac |
2673 | case "$mips_type" in | |
2674 | '');; | |
2675 | *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";; | |
2676 | esac | |
2677 | case "$cppflags" in | |
2678 | '');; | |
a0d0e21e LW |
2679 | *) |
2680 | echo " " | |
2681 | echo "Let me guess what the preprocessor flags are..." >&4 | |
2682 | set X $cppflags | |
2683 | shift | |
2304df62 | 2684 | cppflags='' |
a0d0e21e LW |
2685 | $cat >cpp.c <<'EOM' |
2686 | #define BLURFL foo | |
2687 | ||
2688 | BLURFL xx LFRULB | |
2689 | EOM | |
2690 | previous='' | |
2691 | for flag in $* | |
2304df62 | 2692 | do |
a0d0e21e LW |
2693 | case "$flag" in |
2694 | -*) ftry="$flag";; | |
2695 | *) ftry="$previous $flag";; | |
2304df62 | 2696 | esac |
a0d0e21e LW |
2697 | if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \ |
2698 | >cpp1.out 2>/dev/null && \ | |
2699 | $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \ | |
2700 | >cpp2.out 2>/dev/null && \ | |
2701 | $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \ | |
2702 | $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1 | |
2703 | then | |
2704 | cppflags="$cppflags $ftry" | |
2705 | previous='' | |
2706 | else | |
2707 | previous="$flag" | |
2708 | fi | |
2304df62 | 2709 | done |
a0d0e21e LW |
2710 | set X $cppflags |
2711 | shift | |
2712 | cppflags=${1+"$@"} | |
2304df62 | 2713 | case "$cppflags" in |
a0d0e21e | 2714 | *-*) echo "They appear to be: $cppflags";; |
2304df62 | 2715 | esac |
a0d0e21e | 2716 | $rm -f cpp.c cpp?.out |
2304df62 AD |
2717 | ;; |
2718 | esac | |
2719 | ||
2720 | : flags used in final linking phase | |
2721 | case "$ldflags" in | |
ecfc5424 | 2722 | '') if ./venix; then |
2304df62 AD |
2723 | dflt='-i -z' |
2724 | else | |
a0d0e21e | 2725 | dflt='' |
2304df62 | 2726 | fi |
a0d0e21e LW |
2727 | case "$ccflags" in |
2728 | *-posix*) dflt="$dflt -posix" ;; | |
2729 | esac | |
2730 | case "$dflt" in | |
2731 | '') dflt='none' ;; | |
2732 | esac | |
2304df62 AD |
2733 | ;; |
2734 | *) dflt="$ldflags";; | |
2735 | esac | |
2736 | echo " " | |
2737 | rp="Any additional ld flags (NOT including libraries)?" | |
2738 | . ./myread | |
2739 | case "$ans" in | |
2740 | none) ldflags='';; | |
2741 | *) ldflags="$ans";; | |
2742 | esac | |
2743 | rmlist="$rmlist pdp11" | |
2744 | ||
2304df62 AD |
2745 | : Set private lib path |
2746 | case "$plibpth" in | |
ecfc5424 | 2747 | '') if ./mips; then |
2304df62 AD |
2748 | plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib" |
2749 | fi;; | |
2750 | esac | |
a0d0e21e LW |
2751 | case "$libpth" in |
2752 | ' ') dlist='';; | |
2753 | '') dlist="$plibpth $glibpth";; | |
2754 | *) dlist="$libpth";; | |
2755 | esac | |
2756 | ||
2757 | : Now check and see which directories actually exist, avoiding duplicates | |
2758 | libpth='' | |
2759 | for xxx in $dlist | |
2304df62 | 2760 | do |
a0d0e21e LW |
2761 | if $test -d $xxx; then |
2762 | case " $libpth " in | |
2763 | *" $xxx "*) ;; | |
2764 | *) libpth="$libpth $xxx";; | |
2765 | esac | |
2304df62 AD |
2766 | fi |
2767 | done | |
a0d0e21e | 2768 | $cat <<'EOM' |
2304df62 | 2769 | |
a0d0e21e LW |
2770 | Some systems have incompatible or broken versions of libraries. Among |
2771 | the directories listed in the question below, please remove any you | |
2772 | know not to be holding relevant libraries, and add any that are needed. | |
2773 | Say "none" for none. | |
2774 | ||
2775 | EOM | |
2776 | case "$libpth" in | |
2777 | '') dflt='none';; | |
2778 | *) | |
2779 | set X $libpth | |
2780 | shift | |
2781 | dflt=${1+"$@"} | |
2782 | ;; | |
2783 | esac | |
2304df62 AD |
2784 | rp="Directories to use for library searches?" |
2785 | . ./myread | |
2786 | case "$ans" in | |
2787 | none) libpth=' ';; | |
2788 | *) libpth="$ans";; | |
2789 | esac | |
a0d0e21e LW |
2790 | |
2791 | : compute shared library extension | |
2792 | case "$so" in | |
2793 | '') | |
2794 | if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then | |
2795 | dflt='sl' | |
2796 | else | |
2797 | dflt='so' | |
2798 | fi | |
2799 | ;; | |
2800 | *) dflt="$so";; | |
2801 | esac | |
ecfc5424 | 2802 | $cat <<EOM |
a0d0e21e LW |
2803 | |
2804 | On some systems, shared libraries may be available. Answer 'none' if | |
ecfc5424 AD |
2805 | you want to suppress searching of shared libraries for the remaining |
2806 | of this configuration. | |
2807 | ||
a0d0e21e LW |
2808 | EOM |
2809 | rp='What is the file extension used for shared libraries?' | |
2810 | . ./myread | |
2811 | so="$ans" | |
2812 | ||
2304df62 AD |
2813 | : Looking for optional libraries |
2814 | echo " " | |
2815 | echo "Checking for optional libraries..." >&4 | |
2816 | case "$libs" in | |
2817 | ' '|'') dflt='';; | |
2818 | *) dflt="$libs";; | |
2819 | esac | |
2820 | case "$libswanted" in | |
2821 | '') libswanted='c_s';; | |
2822 | esac | |
2823 | for thislib in $libswanted; do | |
a0d0e21e LW |
2824 | |
2825 | if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then | |
2826 | echo "Found -l$thislib (shared)." | |
2827 | case " $dflt " in | |
2828 | *"-l$thislib "*);; | |
2829 | *) dflt="$dflt -l$thislib";; | |
2830 | esac | |
2831 | elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then | |
2832 | echo "Found -l$thislib (shared)." | |
2833 | case " $dflt " in | |
2834 | *"-l$thislib "*);; | |
2835 | *) dflt="$dflt -l$thislib";; | |
2836 | esac | |
2837 | elif xxx=`./loc lib$thislib.a X $libpth`; $test -f "$xxx"; then | |
2304df62 | 2838 | echo "Found -l$thislib." |
a0d0e21e LW |
2839 | case " $dflt " in |
2840 | *"-l$thislib "*);; | |
2304df62 AD |
2841 | *) dflt="$dflt -l$thislib";; |
2842 | esac | |
a0d0e21e LW |
2843 | elif xxx=`./loc lib${thislib}_s.a X $libpth`; $test -f "$xxx"; then |
2844 | echo "Found -l${thislib}_s." | |
2845 | case " $dflt " in | |
2846 | *"-l$thislib "*);; | |
2847 | *) dflt="$dflt -l${thislib}_s";; | |
2304df62 | 2848 | esac |
a0d0e21e LW |
2849 | elif xxx=`./loc Slib$thislib.a X $xlibpth`; $test -f "$xxx"; then |
2850 | echo "Found -l$thislib." | |
2851 | case " $dflt " in | |
2852 | *"-l$thislib "*);; | |
2304df62 AD |
2853 | *) dflt="$dflt -l$thislib";; |
2854 | esac | |
2855 | else | |
a0d0e21e | 2856 | echo "No -l$thislib." |
2304df62 AD |
2857 | fi |
2858 | done | |
2859 | set X $dflt | |
2860 | shift | |
2861 | dflt="$*" | |
2862 | case "$libs" in | |
2863 | '') dflt="$dflt";; | |
2864 | *) dflt="$libs";; | |
2865 | esac | |
2866 | case "$dflt" in | |
2867 | ' '|'') dflt='none';; | |
2868 | esac | |
2869 | ||
2870 | $cat <<EOM | |
2871 | ||
2872 | Some versions of Unix support shared libraries, which make executables smaller | |
2873 | but make load time slightly longer. | |
2874 | ||
2875 | On some systems, mostly newer Unix System V's, the shared library is included | |
2876 | by putting the option "-lc_s" as the last thing on the cc command line when | |
2877 | linking. Other systems use shared libraries by default. There may be other | |
2878 | libraries needed to compile $package on your machine as well. If your system | |
2879 | needs the "-lc_s" option, include it here. Include any other special libraries | |
2880 | here as well. Say "none" for none. | |
2881 | EOM | |
2882 | ||
2883 | echo " " | |
2884 | rp="Any additional libraries?" | |
2885 | . ./myread | |
2886 | case "$ans" in | |
2887 | none) libs=' ';; | |
2888 | *) libs="$ans";; | |
2889 | esac | |
2890 | ||
2891 | : see if nm is to be used to determine whether a symbol is defined or not | |
2892 | case "$usenm" in | |
2893 | '') | |
2894 | dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null` | |
2895 | if $test $dflt -gt 20; then | |
2896 | dflt=y | |
2897 | else | |
2898 | dflt=n | |
2899 | fi | |
2900 | ;; | |
2901 | *) | |
2902 | case "$usenm" in | |
2903 | true) dflt=y;; | |
2904 | *) dflt=n;; | |
2905 | esac | |
2906 | ;; | |
2907 | esac | |
2908 | $cat <<EOM | |
2909 | ||
2910 | I can use 'nm' to extract the symbols from your C libraries. This is a time | |
2911 | consuming task which may generate huge output on the disk (up to 3 megabytes) | |
2912 | but that should make the symbols extraction faster. The alternative is to skip | |
2913 | the 'nm' extraction part and to compile a small test program instead to | |
2914 | determine whether each symbol is present. If you have a fast C compiler and/or | |
2915 | if your 'nm' output cannot be parsed, this may be the best solution. | |
2916 | ||
2917 | EOM | |
2918 | rp='Shall I use nm to extract C symbols from the libraries?' | |
2919 | . ./myread | |
2920 | case "$ans" in | |
2921 | n|N) usenm=false;; | |
2922 | *) usenm=true;; | |
2923 | esac | |
2924 | ||
2925 | runnm=$usenm | |
2926 | case "$reuseval" in | |
2927 | true) runnm=false;; | |
2928 | esac | |
2929 | ||
2930 | : nm options which may be necessary | |
2931 | case "$nm_opt" in | |
2932 | '') if $test -f /mach_boot; then | |
2933 | nm_opt='' | |
2934 | elif $test -d /usr/ccs/lib; then | |
2935 | nm_opt='-p' | |
2936 | elif $test -f /dgux; then | |
2937 | nm_opt='-p' | |
2938 | else | |
2939 | nm_opt='' | |
2940 | fi;; | |
2941 | esac | |
2942 | ||
2943 | case "$runnm" in | |
2944 | true) | |
2945 | : get list of predefined functions in a handy place | |
2946 | echo " " | |
2947 | case "$libc" in | |
2948 | '') libc=unknown | |
2949 | case "$libs" in | |
2950 | *-lc_s*) libc=`./loc libc_s.a $libc $libpth` | |
2951 | esac | |
2952 | ;; | |
2953 | esac | |
2304df62 AD |
2954 | libnames=''; |
2955 | case "$libs" in | |
2956 | '') ;; | |
2957 | *) for thislib in $libs; do | |
2958 | case "$thislib" in | |
a0d0e21e LW |
2959 | -lc|-lc_s) |
2960 | : Handle C library specially below. | |
2961 | ;; | |
2304df62 | 2962 | -l*) |
ecfc5424 | 2963 | thislib=`echo $thislib | $sed -e 's/^-l//'` |
a0d0e21e LW |
2964 | if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then |
2965 | : | |
2966 | elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then | |
2967 | : | |
2968 | elif try=`./loc lib$thislib.a X $libpth`; $test -f "$try"; then | |
2969 | : | |
2970 | elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then | |
2971 | : | |
2972 | elif try=`./loc $thislib X $libpth`; $test -f "$try"; then | |
2973 | : | |
2974 | elif try=`./loc Slib$thislib.a X $xlibpth`; $test -f "$try"; then | |
2975 | : | |
2976 | else | |
2977 | try='' | |
2304df62 AD |
2978 | fi |
2979 | libnames="$libnames $try" | |
2980 | ;; | |
2981 | *) libnames="$libnames $thislib" ;; | |
2982 | esac | |
2983 | done | |
2984 | ;; | |
2985 | esac | |
2986 | xxx=normal | |
2987 | case "$libc" in | |
2988 | unknown) | |
a0d0e21e LW |
2989 | set /usr/ccs/lib/libc.$so |
2990 | $test -r $1 || set /usr/lib/libc.$so | |
2991 | $test -r $1 || set /usr/shlib/libc.$so | |
2992 | $test -r $1 || set /usr/lib/libc.$so.[0-9]* | |
2993 | $test -r $1 || set /lib/libc.$so | |
2304df62 AD |
2994 | $test -r $1 || set /lib/libsys_s.a |
2995 | eval set \$$# | |
2996 | ;; | |
2997 | *) | |
2998 | set blurfl | |
2999 | ;; | |
3000 | esac | |
3001 | if $test -r "$1"; then | |
3002 | echo "Your (shared) C library seems to be in $1." | |
3003 | libc="$1" | |
3004 | elif $test -r /lib/libc && $test -r /lib/clib; then | |
3005 | echo "Your C library seems to be in both /lib/clib and /lib/libc." | |
3006 | xxx=apollo | |
3007 | libc='/lib/clib /lib/libc' | |
3008 | if $test -r /lib/syslib; then | |
3009 | echo "(Your math library is in /lib/syslib.)" | |
3010 | libc="$libc /lib/syslib" | |
3011 | fi | |
3012 | elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then | |
3013 | echo "Your C library seems to be in $libc, as you said before." | |
3014 | elif $test -r $incpath/usr/lib/libc.a; then | |
3015 | libc=$incpath/usr/lib/libc.a; | |
3016 | echo "Your C library seems to be in $libc. That's fine." | |
3017 | elif $test -r /lib/libc.a; then | |
3018 | libc=/lib/libc.a; | |
3019 | echo "Your C library seems to be in $libc. You're normal." | |
3020 | else | |
3021 | if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then | |
3022 | : | |
3023 | elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then | |
3024 | libnames="$libnames "`./loc clib blurfl/dyick $libpth` | |
3025 | elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then | |
3026 | : | |
3027 | elif tans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then | |
3028 | : | |
3029 | elif tans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then | |
3030 | : | |
3031 | else | |
3032 | tans=`./loc Llibc.a blurfl/dyick $xlibpth` | |
3033 | fi | |
3034 | if $test -r "$tans"; then | |
3035 | echo "Your C library seems to be in $tans, of all places." | |
3036 | libc=$tans | |
3037 | else | |
3038 | libc='blurfl' | |
3039 | fi | |
3040 | fi | |
3041 | if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then | |
3042 | dflt="$libc" | |
3043 | cat <<EOM | |
3044 | ||
3045 | If the guess above is wrong (which it might be if you're using a strange | |
3046 | compiler, or your machine supports multiple models), you can override it here. | |
3047 | ||
3048 | EOM | |
3049 | else | |
3050 | dflt='' | |
3051 | echo $libpth | tr ' ' '\012' | sort | uniq > libpath | |
3052 | cat >&4 <<EOM | |
3053 | I can't seem to find your C library. I've looked in the following places: | |
3054 | ||
3055 | EOM | |
3056 | $sed 's/^/ /' libpath | |
3057 | cat <<EOM | |
3058 | ||
3059 | None of these seems to contain your C library. I need to get its name... | |
3060 | ||
3061 | EOM | |
3062 | fi | |
3063 | fn=f | |
3064 | rp='Where is your C library?' | |
3065 | . ./getfile | |
3066 | libc="$ans" | |
3067 | ||
3068 | echo " " | |
3069 | echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames | |
3070 | set X `cat libnames` | |
3071 | shift | |
3072 | xxx=files | |
3073 | case $# in 1) xxx=file; esac | |
3074 | echo "Extracting names from the following $xxx for later perusal:" >&4 | |
3075 | echo " " | |
3076 | $sed 's/^/ /' libnames >&4 | |
3077 | echo " " | |
3078 | $echo $n "This may take a while...$c" >&4 | |
ecfc5424 | 3079 | |
2304df62 AD |
3080 | nm $nm_opt $* 2>/dev/null >libc.tmp |
3081 | $echo $n ".$c" | |
3082 | $grep fprintf libc.tmp > libc.ptf | |
3083 | xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4' | |
3084 | xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4' | |
a0d0e21e | 3085 | if com="$sed -n -e 's/^.* [ADTSI] *_[_.]*//p' -e 's/^.* [ADTSI] //p'";\ |
2304df62 AD |
3086 | eval $xscan;\ |
3087 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3088 | eval $xrun | |
3089 | elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\ | |
3090 | eval $xscan;\ | |
3091 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3092 | eval $xrun | |
3093 | elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\ | |
3094 | eval $xscan;\ | |
3095 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3096 | eval $xrun | |
3097 | elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\ | |
3098 | eval $xscan;\ | |
3099 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3100 | eval $xrun | |
3101 | elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\ | |
3102 | eval $xscan;\ | |
3103 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3104 | eval $xrun | |
3105 | elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\ | |
3106 | eval $xscan;\ | |
3107 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3108 | eval $xrun | |
3109 | elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \ | |
3110 | -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\ | |
3111 | eval $xscan;\ | |
3112 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3113 | eval $xrun | |
3114 | elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\ | |
3115 | eval $xscan;\ | |
3116 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3117 | eval $xrun | |
3118 | elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\ | |
3119 | eval $xscan;\ | |
3120 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3121 | eval $xrun | |
a0d0e21e LW |
3122 | elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\ |
3123 | eval $xscan;\ | |
3124 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3125 | eval $xrun | |
2304df62 AD |
3126 | else |
3127 | nm -p $* 2>/dev/null >libc.tmp | |
3128 | com="$sed -n -e 's/^.* [ADTS] *_[_.]*//p' -e 's/^.* [ADTS] //p'";\ | |
3129 | eval "<libc.tmp $com >libc.list" | |
3130 | if $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3131 | nm_opt='-p' | |
3132 | echo "done" >&4 | |
3133 | else | |
3134 | echo " " | |
3135 | echo "nm didn't seem to work right. Trying ar instead..." >&4 | |
3136 | com='' | |
3137 | if ar t $libc > libc.tmp; then | |
3138 | for thisname in $libnames; do | |
3139 | ar t $thisname >>libc.tmp | |
3140 | done | |
3141 | $sed -e 's/\.o$//' < libc.tmp > libc.list | |
3142 | echo "Ok." >&4 | |
3143 | else | |
3144 | echo "ar didn't seem to work right." >&4 | |
3145 | echo "Maybe this is a Cray...trying bld instead..." >&4 | |
3146 | if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then | |
3147 | for thisname in $libnames; do | |
3148 | bld t $libnames | \ | |
3149 | $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list | |
3150 | ar t $thisname >>libc.tmp | |
3151 | done | |
3152 | echo "Ok." >&4 | |
3153 | else | |
3154 | echo "That didn't work either. Giving up." >&4 | |
3155 | exit 1 | |
3156 | fi | |
3157 | fi | |
3158 | fi | |
3159 | fi | |
3160 | nm_extract="$com" | |
3161 | if $test -f /lib/syscalls.exp; then | |
3162 | echo " " | |
3163 | echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4 | |
3164 | $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list | |
3165 | fi | |
3166 | ;; | |
3167 | esac | |
3168 | $rm -f libnames libpath | |
3169 | ||
3170 | : is a C symbol defined? | |
3171 | csym='tlook=$1; | |
3172 | case "$3" in | |
3173 | -v) tf=libc.tmp; tc=""; tdc="";; | |
3174 | -a) tf=libc.tmp; tc="[0]"; tdc=[];; | |
3175 | *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";; | |
3176 | esac; | |
3177 | tx=yes; | |
3178 | case "$reuseval-$4" in | |
3179 | true-) ;; | |
3180 | true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;; | |
3181 | esac; | |
3182 | case "$tx" in | |
3183 | yes) | |
3184 | case "$runnm" in | |
3185 | true) | |
3186 | if $contains $tlook $tf >/dev/null 2>&1; | |
3187 | then tval=true; | |
3188 | else tval=false; | |
3189 | fi;; | |
3190 | *) | |
3191 | echo "main() { extern int $1$tdc; printf(\"%d\", $1$tc); }" > t.c; | |
3192 | if $cc $ccflags -o t t.c $ldflags $libs >/dev/null 2>&1; | |
3193 | then tval=true; | |
3194 | else tval=false; | |
3195 | fi; | |
3196 | $rm -f t t.c;; | |
3197 | esac;; | |
3198 | *) | |
3199 | case "$tval" in | |
3200 | $define) tval=true;; | |
3201 | *) tval=false;; | |
3202 | esac;; | |
3203 | esac; | |
3204 | eval "$2=$tval"' | |
3205 | ||
3206 | : set up the script used to warn in case of inconsistency | |
3207 | cat <<'EOSC' >whoa | |
3208 | dflt=y | |
3209 | echo " " | |
3210 | echo "*** WHOA THERE!!! ***" >&4 | |
3211 | echo " The $hint value for \$$var on this machine was \"$was\"!" >&4 | |
3212 | rp=" Keep the $hint value?" | |
3213 | . ./myread | |
3214 | case "$ans" in | |
3215 | y) td=$was; tu=$was;; | |
3216 | esac | |
3217 | EOSC | |
3218 | ||
3219 | : define an is-in-libc? function | |
3220 | inlibc='echo " "; td=$define; tu=$undef; | |
3221 | sym=$1; var=$2; eval "was=\$$2"; | |
3222 | tx=yes; | |
3223 | case "$reuseval$was" in | |
3224 | true) ;; | |
3225 | true*) tx=no;; | |
3226 | esac; | |
3227 | case "$tx" in | |
3228 | yes) | |
3229 | set $sym tres -f; | |
3230 | eval $csym; | |
3231 | case "$tres" in | |
3232 | true) | |
3233 | echo "$sym() found." >&4; | |
ecfc5424 | 3234 | case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";; |
2304df62 AD |
3235 | *) |
3236 | echo "$sym() NOT found." >&4; | |
ecfc5424 | 3237 | case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";; |
2304df62 AD |
3238 | esac;; |
3239 | *) | |
3240 | case "$was" in | |
3241 | $define) echo "$sym() found." >&4;; | |
3242 | *) echo "$sym() NOT found." >&4;; | |
3243 | esac;; | |
3244 | esac' | |
3245 | ||
a0d0e21e LW |
3246 | : see if gconvert exists |
3247 | set gconvert d_gconvert | |
3248 | eval $inlibc | |
2304df62 | 3249 | |
a0d0e21e LW |
3250 | case "$d_gconvert" in |
3251 | $define) | |
ecfc5424 | 3252 | echo "We'll use it to convert floats into a string then." >&4 |
a0d0e21e LW |
3253 | d_Gconvert="gconvert((x),(n),(t),(b))" |
3254 | ;; | |
3255 | *) | |
3256 | : Maybe we can emulate it with gcvt. | |
3257 | set gcvt d_gcvt | |
3258 | eval $inlibc | |
2304df62 | 3259 | |
a0d0e21e LW |
3260 | case "$d_gcvt" in |
3261 | $define) | |
3262 | : Test whether gcvt drops a trailing decimal point | |
ecfc5424 | 3263 | $cat >try.c <<'EOP' |
a0d0e21e | 3264 | main() { |
ecfc5424 AD |
3265 | char buf[64]; |
3266 | gcvt(1.0, 8, buf); | |
3267 | if (buf[0] != '1' || buf[1] != '\0') | |
3268 | exit(1); | |
3269 | gcvt(0.0, 8, buf); | |
3270 | if (buf[0] != '0' || buf[1] != '\0') | |
3271 | exit(1); | |
3272 | gcvt(-1.0, 8, buf); | |
3273 | if (buf[0] != '-' || buf[1] != '1' || buf[2] != '\0') | |
3274 | exit(1); | |
3275 | exit(0); | |
a0d0e21e LW |
3276 | } |
3277 | EOP | |
3278 | if $cc $ccflags $ldflags -o try try.c $libs > /dev/null 2>&1; then | |
3279 | if ./try; then | |
3280 | echo "Good, your gcvt() drops a trailing decimal point." | |
ecfc5424 | 3281 | echo "We'll use it to convert floats into a string." >&4 |
a0d0e21e LW |
3282 | d_Gconvert="gcvt((x),(n),(b))" |
3283 | else | |
3284 | echo "But your gcvt() keeps a trailing decimal point". | |
3285 | d_Gconvert='' | |
3286 | fi | |
2304df62 | 3287 | else |
a0d0e21e LW |
3288 | echo "Hmm. I can't compile the gcvt test program." |
3289 | d_Gconvert='' | |
2304df62 | 3290 | fi |
a0d0e21e | 3291 | $rm -f try.c try |
2304df62 AD |
3292 | ;; |
3293 | esac | |
a0d0e21e LW |
3294 | case "$d_Gconvert" in |
3295 | '') | |
ecfc5424 | 3296 | echo "I'll use sprintf instead to convert floats into a string." >&4 |
a0d0e21e | 3297 | d_Gconvert='sprintf((b),"%.*g",(n),(x))' |
2304df62 AD |
3298 | ;; |
3299 | esac | |
2304df62 AD |
3300 | esac |
3301 | ||
a0d0e21e LW |
3302 | : Initialize h_fcntl |
3303 | h_fcntl=false | |
3304 | ||
3305 | : Initialize h_sysfile | |
3306 | h_sysfile=false | |
2304df62 AD |
3307 | |
3308 | : determine filename position in cpp output | |
3309 | echo " " | |
3310 | echo "Computing filename position in cpp output for #include directives..." >&4 | |
3311 | echo '#include <stdio.h>' > foo.c | |
3312 | $cat >fieldn <<EOF | |
3313 | $startsh | |
a0d0e21e | 3314 | $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \ |
2304df62 AD |
3315 | $grep '^[ ]*#.*stdio\.h' | \ |
3316 | while read cline; do | |
3317 | pos=1 | |
3318 | set \$cline | |
3319 | while $test \$# -gt 0; do | |
3320 | if $test -r \`echo \$1 | $tr -d '"'\`; then | |
3321 | echo "\$pos" | |
3322 | exit 0 | |
3323 | fi | |
3324 | shift | |
3325 | pos=\`expr \$pos + 1\` | |
3326 | done | |
3327 | done | |
3328 | EOF | |
3329 | chmod +x fieldn | |
3330 | fieldn=`./fieldn` | |
3331 | $rm -f foo.c fieldn | |
3332 | case $fieldn in | |
3333 | '') pos='???';; | |
3334 | 1) pos=first;; | |
3335 | 2) pos=second;; | |
3336 | 3) pos=third;; | |
3337 | *) pos="${fieldn}th";; | |
3338 | esac | |
3339 | echo "Your cpp writes the filename in the $pos field of the line." | |
3340 | ||
3341 | : locate header file | |
3342 | $cat >findhdr <<EOF | |
3343 | $startsh | |
3344 | wanted=\$1 | |
3345 | name='' | |
3346 | if test -f $usrinc/\$wanted; then | |
3347 | echo "$usrinc/\$wanted" | |
3348 | exit 0 | |
3349 | fi | |
3350 | awkprg='{ print \$$fieldn }' | |
3351 | echo "#include <\$wanted>" > foo\$\$.c | |
3352 | $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \ | |
3353 | $grep "^[ ]*#.*\$wanted" | \ | |
3354 | while read cline; do | |
3355 | name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\` | |
3356 | case "\$name" in | |
3357 | */\$wanted) echo "\$name"; exit 0;; | |
3358 | *) name='';; | |
3359 | esac; | |
3360 | done; | |
3361 | $rm -f foo\$\$.c; | |
3362 | case "\$name" in | |
3363 | '') exit 1;; | |
3364 | esac | |
3365 | EOF | |
3366 | chmod +x findhdr | |
3367 | ||
3368 | : access call always available on UNIX | |
3369 | set access d_access | |
3370 | eval $inlibc | |
3371 | ||
3372 | : locate the flags for 'access()' | |
3373 | case "$d_access" in | |
3374 | "$define") | |
3375 | echo " " | |
3376 | $cat >access.c <<'EOCP' | |
3377 | #include <sys/types.h> | |
3378 | #ifdef I_FCNTL | |
3379 | #include <fcntl.h> | |
3380 | #endif | |
3381 | #ifdef I_SYS_FILE | |
3382 | #include <sys/file.h> | |
3383 | #endif | |
3384 | #ifdef I_UNISTD | |
3385 | #include <unistd.h> | |
3386 | #endif | |
3387 | main() { | |
3388 | exit(R_OK); | |
3389 | } | |
3390 | EOCP | |
3391 | : check sys/file.h first, no particular reason here | |
3392 | if $test `./findhdr sys/file.h` && \ | |
3393 | $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then | |
3394 | h_sysfile=true; | |
3395 | echo "<sys/file.h> defines the *_OK access constants." >&4 | |
3396 | elif $test `./findhdr fcntl.h` && \ | |
3397 | $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then | |
3398 | h_fcntl=true; | |
3399 | echo "<fcntl.h> defines the *_OK access constants." >&4 | |
85e6fe83 LW |
3400 | elif $test `./findhdr unistd.h` && \ |
3401 | $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then | |
3402 | echo "<unistd.h> defines the *_OK access constants." >&4 | |
2304df62 AD |
3403 | else |
3404 | echo "I can't find the four *_OK access constants--I'll use mine." >&4 | |
3405 | fi | |
3406 | ;; | |
3407 | esac | |
3408 | $rm -f access* | |
3409 | ||
a0d0e21e LW |
3410 | : see if alarm exists |
3411 | set alarm d_alarm | |
2304df62 AD |
3412 | eval $inlibc |
3413 | ||
a0d0e21e LW |
3414 | : is AFS running? |
3415 | echo " " | |
3416 | if test -d /afs; then | |
3417 | echo "AFS may be running... I'll be extra cautious then..." >&4 | |
3418 | afs=true | |
3419 | else | |
3420 | echo "AFS does not seem to be running..." >&4 | |
3421 | afs=false | |
3422 | fi | |
2304df62 | 3423 | |
a0d0e21e LW |
3424 | : determine root of directory hierarchy where package will be installed. |
3425 | case "$prefix" in | |
3426 | '') | |
3427 | dflt=`./loc . /usr/local /usr/local /local /opt /usr` | |
3428 | ;; | |
3429 | *) | |
3430 | dflt="$prefix" | |
3431 | ;; | |
3432 | esac | |
3433 | $cat <<EOM | |
2304df62 | 3434 | |
a0d0e21e LW |
3435 | By default, $package will be installed in $dflt/bin, manual |
3436 | pages under $dflt/man, etc..., i.e. with $dflt as prefix for | |
3437 | all installation directories. Typically set to /usr/local, but you | |
3438 | may choose /usr if you wish to install $package among your system | |
3439 | binaries. If you wish to have binaries under /bin but manual pages | |
3440 | under /usr/local/man, that's ok: you will be prompted separately | |
3441 | for each of the installation directories, the prefix being only used | |
1aef975c | 3442 | to set the defaults. |
a0d0e21e LW |
3443 | |
3444 | EOM | |
3445 | fn=d~ | |
3446 | rp='Installation prefix to use?' | |
3447 | . ./getfile | |
1aef975c AD |
3448 | oldprefix='' |
3449 | case "$prefix" in | |
3450 | '') ;; | |
3451 | *) | |
3452 | case "$ans" in | |
3453 | "$prefix") ;; | |
3454 | *) oldprefix="$prefix";; | |
3455 | esac | |
3456 | ;; | |
3457 | esac | |
a0d0e21e | 3458 | prefix="$ans" |
1aef975c AD |
3459 | prefixexp="$ansexp" |
3460 | ||
3461 | : set the prefixit variable, to compute a suitable default value | |
3462 | prefixit='case "$3" in | |
3463 | ""|none) | |
3464 | case "$oldprefix" in | |
3465 | "") eval "$1=\"\$$2\"";; | |
3466 | *) | |
3467 | case "$3" in | |
3468 | "") eval "$1=";; | |
3469 | none) | |
3470 | eval "tp=\"\$$2\""; | |
3471 | case "$tp" in | |
3472 | ""|" ") eval "$1=\"\$$2\"";; | |
3473 | *) eval "$1=";; | |
3474 | esac;; | |
3475 | esac;; | |
3476 | esac;; | |
3477 | *) | |
3478 | eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\""; | |
3479 | case "$tp" in | |
3480 | --|/*--|\~*--) eval "$1=\"$prefix/$3\"";; | |
3481 | /*-$oldprefix/*|\~*-$oldprefix/*) | |
3482 | eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";; | |
3483 | *) eval "$1=\"\$$2\"";; | |
3484 | esac;; | |
3485 | esac' | |
a0d0e21e LW |
3486 | |
3487 | : determine where private executables go | |
1aef975c AD |
3488 | set dflt privlib lib/$package |
3489 | eval $prefixit | |
a0d0e21e LW |
3490 | $cat <<EOM |
3491 | ||
3492 | There are some auxiliary files for $package that need to be put into a | |
3493 | private library directory that is accessible by everyone. | |
3494 | ||
3495 | EOM | |
3496 | fn=d~+ | |
1aef975c | 3497 | rp='Pathname where the private library files will reside?' |
a0d0e21e | 3498 | . ./getfile |
1aef975c AD |
3499 | if $test "X$privlibexp" != "X$ansexp"; then |
3500 | installprivlib='' | |
3501 | fi | |
a0d0e21e LW |
3502 | privlib="$ans" |
3503 | privlibexp="$ansexp" | |
3504 | if $afs; then | |
3505 | $cat <<EOM | |
3506 | ||
3507 | Since you are running AFS, I need to distinguish the directory in which | |
3508 | private files reside from the directory in which they are installed (and from | |
3509 | which they are presumably copied to the former directory by occult means). | |
3510 | ||
3511 | EOM | |
3512 | case "$installprivlib" in | |
3513 | '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;; | |
3514 | *) dflt="$installprivlib";; | |
3515 | esac | |
3516 | fn=de~ | |
3517 | rp='Where will private files be installed?' | |
3518 | . ./getfile | |
3519 | installprivlib="$ans" | |
3520 | else | |
3521 | installprivlib="$privlibexp" | |
3522 | fi | |
3523 | ||
1aef975c AD |
3524 | : set the prefixup variable, to restore leading tilda escape |
3525 | prefixup='case "$prefixexp" in | |
3526 | "$prefix") ;; | |
3527 | *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";; | |
3528 | esac' | |
3529 | ||
a0d0e21e | 3530 | : determine where public architecture dependent libraries go |
1aef975c AD |
3531 | if xxx=`./loc arch blurfl $pth`; test -f "$xxx"; then |
3532 | tarchname=`arch` | |
3533 | archname="${tarchname}-$osname" | |
3534 | elif xxx=`./loc uname blurfl $pth`; test -f "$xxx" ; then | |
3535 | if uname -m > tmparch 2>&1 ; then | |
3536 | tarchname=`cat tmparch` | |
ecfc5424 | 3537 | archname="${tarchname}-$osname" |
2304df62 | 3538 | fi |
1aef975c AD |
3539 | $rm -f tmparch |
3540 | else | |
3541 | archname="$osname" | |
3542 | fi | |
3543 | set archlib archlib | |
3544 | eval $prefixit | |
ecfc5424 AD |
3545 | case "$archlib" in |
3546 | '') | |
3547 | case "$privlib" in | |
1aef975c AD |
3548 | '') |
3549 | dflt=`./loc . "." $prefixexp/lib /usr/local/lib /usr/lib /lib` | |
3550 | set dflt | |
3551 | eval $prefixup | |
3552 | ;; | |
ecfc5424 AD |
3553 | *) dflt="$privlib/$archname";; |
3554 | esac | |
3555 | ;; | |
3556 | *) dflt="$archlib";; | |
a0d0e21e | 3557 | esac |
a0d0e21e LW |
3558 | cat <<EOM |
3559 | ||
1aef975c | 3560 | $spackage contains architecture-dependent library files. If you are |
a0d0e21e LW |
3561 | sharing libraries in a heterogeneous environment, you might store |
3562 | these files in a separate location. Otherwise, you can just include | |
3563 | them with the rest of the public library files. | |
3564 | ||
3565 | EOM | |
ecfc5424 | 3566 | fn=d~ |
a0d0e21e LW |
3567 | rp='Where do you want to put the public architecture-dependent libraries?' |
3568 | . ./getfile | |
3569 | archlib="$ans" | |
3570 | archlibexp="$ansexp" | |
3571 | ||
3572 | if $afs; then | |
3573 | $cat <<EOM | |
3574 | ||
3575 | Since you are running AFS, I need to distinguish the directory in which | |
3576 | private files reside from the directory in which they are installed (and from | |
3577 | which they are presumably copied to the former directory by occult means). | |
3578 | ||
3579 | EOM | |
3580 | case "$installarchlib" in | |
3581 | '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;; | |
3582 | *) dflt="$installarchlib";; | |
3583 | esac | |
3584 | fn=de~ | |
3585 | rp='Where will architecture-dependent library files be installed?' | |
3586 | . ./getfile | |
3587 | installarchlib="$ans" | |
3588 | else | |
3589 | installarchlib="$archlibexp" | |
3590 | fi | |
3591 | if $test X"$archlib" = X"$privlib"; then | |
3592 | d_archlib="$undef" | |
3593 | else | |
3594 | d_archlib="$define" | |
3595 | fi | |
3596 | ||
2304df62 AD |
3597 | : function used to set $1 to $val |
3598 | setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef; | |
3599 | case "$val$was" in | |
ecfc5424 AD |
3600 | $define$undef) . ./whoa; eval "$var=\$td";; |
3601 | $undef$define) . ./whoa; eval "$var=\$tu";; | |
2304df62 AD |
3602 | *) eval "$var=$val";; |
3603 | esac' | |
3604 | ||
ecfc5424 | 3605 | : Look for GNU-cc style attribute checking |
2304df62 | 3606 | echo " " |
a0d0e21e LW |
3607 | echo "Checking whether your compiler can handle __attribute__ ..." >&4 |
3608 | $cat >attrib.c <<'EOCP' | |
1aef975c | 3609 | #include <stdio.h> |
ecfc5424 | 3610 | void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn)); |
a0d0e21e LW |
3611 | EOCP |
3612 | if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then | |
3613 | if $contains 'warning' attrib.out >/dev/null 2>&1; then | |
ecfc5424 | 3614 | echo "Your C compiler doesn't fully support __attribute__." |
a0d0e21e LW |
3615 | val="$undef" |
3616 | else | |
ecfc5424 | 3617 | echo "Your C compiler supports __attribute__." |
a0d0e21e LW |
3618 | val="$define" |
3619 | fi | |
3620 | else | |
ecfc5424 | 3621 | echo "Your C compiler doesn't seem to understand __attribute__ at all." |
a0d0e21e LW |
3622 | val="$undef" |
3623 | fi | |
ecfc5424 | 3624 | set d_attribut |
a0d0e21e LW |
3625 | eval $setvar |
3626 | $rm -f attrib* | |
3627 | ||
3628 | : see if bcmp exists | |
3629 | set bcmp d_bcmp | |
3630 | eval $inlibc | |
3631 | ||
3632 | : see if bcopy exists | |
3633 | set bcopy d_bcopy | |
3634 | eval $inlibc | |
3635 | ||
3636 | : see if setpgrp exists | |
3637 | set setpgrp d_setpgrp | |
3638 | eval $inlibc | |
3639 | ||
3640 | : see which flavor of setpgrp is in use | |
3641 | case "$d_setpgrp" in | |
3642 | "$define") | |
3643 | echo " " | |
3644 | $cat >set.c <<EOP | |
3645 | main() | |
3646 | { | |
3647 | if (getuid() == 0) { | |
3648 | printf("(I see you are running Configure as super-user...)\n"); | |
3649 | setuid(1); | |
3650 | } | |
3651 | if (-1 == setpgrp(1, 1)) | |
3652 | exit(1); | |
3653 | exit(0); | |
3654 | } | |
3655 | EOP | |
ecfc5424 | 3656 | if $cc $ccflags -o set set.c $ldflags $libs >/dev/null 2>&1; then |
a0d0e21e LW |
3657 | ./set 2>/dev/null |
3658 | case $? in | |
3659 | 0) echo "You have to use setpgrp() instead of setpgrp(pid, pgrp)." >&4 | |
3660 | val="$undef";; | |
3661 | *) echo "You have to use setpgrp(pid, pgrp) instead of setpgrp()." >&4 | |
3662 | val="$define";; | |
3663 | esac | |
3664 | else | |
ecfc5424 | 3665 | if ./usg; then |
a0d0e21e LW |
3666 | xxx="USG one, i.e. you use setpgrp()." |
3667 | val="$undef" | |
3668 | else | |
3669 | xxx="BSD one, i.e. you use setpgrp(pid, pgrp)." | |
3670 | val="$define" | |
3671 | fi | |
3672 | echo "Assuming your setpgrp is a $xxx" >&4 | |
3673 | fi | |
3674 | ;; | |
3675 | *) val="$undef";; | |
3676 | esac | |
3677 | set d_bsdpgrp | |
3678 | eval $setvar | |
3679 | $rm -f set set.c | |
3680 | ||
1aef975c AD |
3681 | : Check if we really have byacc |
3682 | case "$byacc" in | |
3683 | ''|'byacc') val="$undef" ;; | |
3684 | *) val="$define" ;; | |
3685 | esac | |
3686 | set d_byacc | |
3687 | eval $setvar | |
3688 | ||
a0d0e21e LW |
3689 | : see if bzero exists |
3690 | set bzero d_bzero | |
3691 | eval $inlibc | |
3692 | ||
3693 | : check for length of integer | |
3694 | echo " " | |
3695 | case "$intsize" in | |
3696 | '') | |
3697 | echo "Checking to see how big your integers are..." >&4 | |
3698 | $cat >try.c <<'EOCP' | |
3699 | #include <stdio.h> | |
3700 | main() | |
3701 | { | |
3702 | printf("%d\n", sizeof(int)); | |
3703 | } | |
3704 | EOCP | |
3705 | if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then | |
3706 | dflt=`./try` | |
3707 | else | |
3708 | dflt='4' | |
3709 | echo "(I can't seem to compile the test program. Guessing...)" | |
3710 | fi | |
3711 | ;; | |
3712 | *) | |
3713 | dflt="$intsize" | |
3714 | ;; | |
3715 | esac | |
3716 | rp="What is the size of an integer (in bytes)?" | |
3717 | . ./myread | |
3718 | intsize="$ans" | |
3719 | $rm -f try.c try | |
3720 | ||
ecfc5424 | 3721 | : see if signal is declared as pointer to function returning int or void |
a0d0e21e | 3722 | echo " " |
ecfc5424 AD |
3723 | xxx=`./findhdr signal.h` |
3724 | $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null | |
3725 | if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then | |
3726 | echo "You have int (*signal())() instead of void." >&4 | |
3727 | val="$undef" | |
3728 | elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then | |
3729 | echo "You have void (*signal())() instead of int." >&4 | |
3730 | val="$define" | |
3731 | elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then | |
3732 | echo "You have int (*signal())() instead of void." >&4 | |
3733 | val="$undef" | |
a0d0e21e | 3734 | else |
ecfc5424 AD |
3735 | case "$d_voidsig" in |
3736 | '') | |
3737 | echo "I can't determine whether signal handler returns void or int..." >&4 | |
3738 | dflt=void | |
3739 | rp="What type does your signal handler return?" | |
3740 | . ./myread | |
3741 | case "$ans" in | |
3742 | v*) val="$define";; | |
3743 | *) val="$undef";; | |
3744 | esac;; | |
3745 | "$define") | |
3746 | echo "As you already told me, signal handler returns void." >&4;; | |
3747 | *) | |
3748 | echo "As you already told me, signal handler returns int." >&4;; | |
3749 | esac | |
3750 | fi | |
3751 | set d_voidsig | |
3752 | eval $setvar | |
3753 | case "$d_voidsig" in | |
3754 | "$define") signal_t="void";; | |
3755 | *) signal_t="int";; | |
3756 | esac | |
3757 | $rm -f $$.tmp | |
3758 | ||
3759 | : check for ability to cast large floats to 32-bit ints. | |
3760 | echo " " | |
3761 | echo 'Checking whether your C compiler can cast large floats to int32.' >&4 | |
3762 | if $test "$intsize" -eq 4; then | |
3763 | xxx=int | |
3764 | else | |
3765 | xxx=long | |
3766 | fi | |
3767 | $cat >try.c <<EOCP | |
3768 | #include <sys/types.h> | |
3769 | #include <signal.h> | |
3770 | $signal_t blech() { exit(3); } | |
3771 | main() | |
2304df62 | 3772 | { |
a0d0e21e | 3773 | $xxx i32; |
2304df62 AD |
3774 | double f; |
3775 | int result = 0; | |
3776 | signal(SIGFPE, blech); | |
3777 | ||
3778 | f = (double) 0x7fffffff; | |
3779 | f = 10 * f; | |
a0d0e21e | 3780 | i32 = ($xxx) f; |
2304df62 | 3781 | |
a0d0e21e | 3782 | if (i32 != ($xxx) f) |
2304df62 AD |
3783 | result |= 1; |
3784 | exit(result); | |
3785 | } | |
3786 | EOCP | |
3787 | if $cc -o try $ccflags try.c >/dev/null 2>&1; then | |
3788 | ./try | |
3789 | yyy=$? | |
3790 | else | |
a0d0e21e | 3791 | echo "(I can't seem to compile the test program--assuming it can't)" |
2304df62 AD |
3792 | yyy=1 |
3793 | fi | |
3794 | case "$yyy" in | |
3795 | 0) val="$define" | |
3796 | echo "Yup, it can." | |
3797 | ;; | |
3798 | *) val="$undef" | |
3799 | echo "Nope, it can't." | |
3800 | ;; | |
3801 | esac | |
3802 | set d_casti32 | |
3803 | eval $setvar | |
85e6fe83 | 3804 | $rm -f try try.* |
a0d0e21e | 3805 | |
2304df62 AD |
3806 | : check for ability to cast negative floats to unsigned |
3807 | echo " " | |
3808 | echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4 | |
ecfc5424 AD |
3809 | $cat >try.c <<EOCP |
3810 | #include <sys/types.h> | |
2304df62 | 3811 | #include <signal.h> |
ecfc5424 | 3812 | $signal_t blech() { exit(3); } |
2304df62 AD |
3813 | main() |
3814 | { | |
3815 | double f = -123; | |
3816 | unsigned long along; | |
3817 | unsigned int aint; | |
3818 | unsigned short ashort; | |
3819 | int result = 0; | |
3820 | ||
3821 | signal(SIGFPE, blech); | |
3822 | along = (unsigned long)f; | |
3823 | aint = (unsigned int)f; | |
3824 | ashort = (unsigned short)f; | |
3825 | if (along != (unsigned long)-123) | |
3826 | result |= 1; | |
3827 | if (aint != (unsigned int)-123) | |
3828 | result |= 1; | |
3829 | if (ashort != (unsigned short)-123) | |
3830 | result |= 1; | |
3831 | f = (double)0x40000000; | |
3832 | f = f + f; | |
3833 | along = 0; | |
3834 | along = (unsigned long)f; | |
3835 | if (along != 0x80000000) | |
3836 | result |= 2; | |
3837 | f -= 1.; | |
3838 | along = 0; | |
3839 | along = (unsigned long)f; | |
3840 | if (along != 0x7fffffff) | |
3841 | result |= 1; | |
3842 | f += 2.; | |
3843 | along = 0; | |
3844 | along = (unsigned long)f; | |
3845 | if (along != 0x80000001) | |
3846 | result |= 2; | |
3847 | exit(result); | |
3848 | ||
3849 | } | |
3850 | EOCP | |
3851 | if $cc -o try $ccflags try.c >/dev/null 2>&1; then | |
3852 | ./try | |
3853 | castflags=$? | |
3854 | else | |
ecfc5424 | 3855 | echo "(I can't seem to compile the test program--assuming it can't)" |
2304df62 AD |
3856 | castflags=3 |
3857 | fi | |
3858 | case "$castflags" in | |
3859 | 0) val="$define" | |
3860 | echo "Yup, it can." | |
3861 | ;; | |
3862 | *) val="$undef" | |
3863 | echo "Nope, it can't." | |
3864 | ;; | |
3865 | esac | |
3866 | set d_castneg | |
3867 | eval $setvar | |
3868 | $rm -f try.* | |
3869 | ||
2304df62 AD |
3870 | : see if vprintf exists |
3871 | echo " " | |
3872 | if set vprintf val -f d_vprintf; eval $csym; $val; then | |
3873 | echo 'vprintf() found.' >&4 | |
3874 | val="$define" | |
3875 | $cat >vprintf.c <<'EOF' | |
3876 | #include <varargs.h> | |
3877 | ||
3878 | main() { xxx("foo"); } | |
3879 | ||
3880 | xxx(va_alist) | |
3881 | va_dcl | |
3882 | { | |
3883 | va_list args; | |
3884 | char buf[10]; | |
3885 | ||
3886 | va_start(args); | |
3887 | exit((unsigned long)vsprintf(buf,"%s",args) > 10L); | |
3888 | } | |
3889 | EOF | |
3890 | if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then | |
3891 | echo "Your vsprintf() returns (int)." >&4 | |
3892 | val2="$undef" | |
3893 | else | |
3894 | echo "Your vsprintf() returns (char*)." >&4 | |
3895 | val2="$define" | |
3896 | fi | |
3897 | else | |
3898 | echo 'vprintf() NOT found.' >&4 | |
3899 | val="$undef" | |
3900 | val2="$undef" | |
3901 | fi | |
3902 | set d_vprintf | |
3903 | eval $setvar | |
3904 | val=$val2 | |
3905 | set d_charvspr | |
3906 | eval $setvar | |
3907 | ||
a0d0e21e LW |
3908 | : see if chown exists |
3909 | set chown d_chown | |
3910 | eval $inlibc | |
3911 | ||
3912 | : see if chroot exists | |
3913 | set chroot d_chroot | |
3914 | eval $inlibc | |
3915 | ||
2304df62 AD |
3916 | : see if chsize exists |
3917 | set chsize d_chsize | |
3918 | eval $inlibc | |
3919 | ||
3920 | : check for const keyword | |
3921 | echo " " | |
3922 | echo 'Checking to see if your C compiler knows about "const"...' >&4 | |
3923 | $cat >const.c <<'EOCP' | |
3924 | typedef struct spug { int drokk; } spug; | |
3925 | main() | |
3926 | { | |
3927 | const char *foo; | |
3928 | const spug y; | |
3929 | } | |
3930 | EOCP | |
3931 | if $cc -c $ccflags const.c >/dev/null 2>&1 ; then | |
3932 | val="$define" | |
3933 | echo "Yup, it does." | |
3934 | else | |
3935 | val="$undef" | |
3936 | echo "Nope, it doesn't." | |
3937 | fi | |
3938 | set d_const | |
3939 | eval $setvar | |
3940 | ||
3941 | : see if crypt exists | |
3942 | echo " " | |
3943 | if set crypt val -f d_crypt; eval $csym; $val; then | |
3944 | echo 'crypt() found.' >&4 | |
3945 | val="$define" | |
3946 | cryptlib='' | |
3947 | else | |
3948 | cryptlib=`./loc Slibcrypt.a "" $xlibpth` | |
3949 | if $test -z "$cryptlib"; then | |
3950 | cryptlib=`./loc Mlibcrypt.a "" $xlibpth` | |
3951 | else | |
3952 | cryptlib=-lcrypt | |
3953 | fi | |
3954 | if $test -z "$cryptlib"; then | |
3955 | cryptlib=`./loc Llibcrypt.a "" $xlibpth` | |
3956 | else | |
3957 | cryptlib=-lcrypt | |
3958 | fi | |
3959 | if $test -z "$cryptlib"; then | |
3960 | cryptlib=`./loc libcrypt.a "" $libpth` | |
3961 | else | |
3962 | cryptlib=-lcrypt | |
3963 | fi | |
3964 | if $test -z "$cryptlib"; then | |
3965 | echo 'crypt() NOT found.' >&4 | |
3966 | val="$undef" | |
3967 | else | |
3968 | val="$define" | |
3969 | fi | |
3970 | fi | |
3971 | set d_crypt | |
3972 | eval $setvar | |
3973 | ||
3974 | : get csh whereabouts | |
3975 | case "$csh" in | |
3976 | 'csh') val="$undef" ;; | |
3977 | *) val="$define" ;; | |
3978 | esac | |
3979 | set d_csh | |
3980 | eval $setvar | |
1aef975c | 3981 | full_csh=$csh |
2304df62 | 3982 | |
a0d0e21e LW |
3983 | : see if cuserid exists |
3984 | set cuserid d_cuserid | |
2304df62 AD |
3985 | eval $inlibc |
3986 | ||
85e6fe83 LW |
3987 | : define an alternate in-header-list? function |
3988 | inhdr='echo " "; td=$define; tu=$undef; yyy=$@; | |
3989 | cont=true; xxf="echo \"<\$1> found.\" >&4"; | |
3990 | case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";; | |
3991 | *) xxnf="echo \"<\$1> NOT found, ...\" >&4";; | |
3992 | esac; | |
3993 | case $# in 4) instead=instead;; *) instead="at last";; esac; | |
3994 | while $test "$cont"; do | |
3995 | xxx=`./findhdr $1` | |
3996 | var=$2; eval "was=\$$2"; | |
3997 | if $test "$xxx" && $test -r "$xxx"; | |
3998 | then eval $xxf; | |
ecfc5424 | 3999 | eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td"; |
85e6fe83 LW |
4000 | cont=""; |
4001 | else eval $xxnf; | |
ecfc5424 | 4002 | eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi; |
85e6fe83 LW |
4003 | set $yyy; shift; shift; yyy=$@; |
4004 | case $# in 0) cont="";; | |
4005 | 2) xxf="echo \"but I found <\$1> $instead.\" >&4"; | |
4006 | xxnf="echo \"and I did not find <\$1> either.\" >&4";; | |
4007 | *) xxf="echo \"but I found <\$1\> instead.\" >&4"; | |
4008 | xxnf="echo \"there is no <\$1>, ...\" >&4";; | |
4009 | esac; | |
4010 | done; | |
4011 | while $test "$yyy"; | |
4012 | do set $yyy; var=$2; eval "was=\$$2"; | |
ecfc5424 | 4013 | eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; |
85e6fe83 LW |
4014 | set $yyy; shift; shift; yyy=$@; |
4015 | done' | |
4016 | ||
a0d0e21e LW |
4017 | : see if this is a limits.h system |
4018 | set limits.h i_limits | |
85e6fe83 LW |
4019 | eval $inhdr |
4020 | ||
a0d0e21e LW |
4021 | : see if this is a float.h system |
4022 | set float.h i_float | |
4023 | eval $inhdr | |
4024 | ||
4025 | : See if number of significant digits in a double precision number is known | |
4026 | echo " " | |
4027 | $cat >dbl_dig.c <<EOM | |
4028 | #$i_limits I_LIMITS | |
4029 | #$i_float I_FLOAT | |
4030 | #ifdef I_LIMITS | |
4031 | #include <limits.h> | |
85e6fe83 | 4032 | #endif |
a0d0e21e LW |
4033 | #ifdef I_FLOAT |
4034 | #include <float.h> | |
4035 | #endif | |
4036 | #ifdef DBL_DIG | |
4037 | printf("Contains DBL_DIG"); | |
85e6fe83 | 4038 | #endif |
85e6fe83 | 4039 | EOM |
a0d0e21e LW |
4040 | $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null |
4041 | if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then | |
4042 | echo "DBL_DIG found." >&4 | |
4043 | val="$define" | |
2304df62 | 4044 | else |
a0d0e21e LW |
4045 | echo "DBL_DIG NOT found." >&4 |
4046 | val="$undef" | |
2304df62 | 4047 | fi |
a0d0e21e LW |
4048 | $rm -f dbl_dig.? |
4049 | set d_dbl_dig | |
2304df62 | 4050 | eval $setvar |
2304df62 | 4051 | |
a0d0e21e LW |
4052 | : see if difftime exists |
4053 | set difftime d_difftime | |
2304df62 AD |
4054 | eval $inlibc |
4055 | ||
a0d0e21e LW |
4056 | : see if this is a dirent system |
4057 | echo " " | |
4058 | if xinc=`./findhdr dirent.h`; $test "$xinc"; then | |
4059 | val="$define" | |
4060 | echo "<dirent.h> found." >&4 | |
4061 | else | |
4062 | val="$undef" | |
4063 | if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then | |
4064 | echo "<sys/dir.h> found." >&4 | |
4065 | echo " " | |
4066 | else | |
4067 | xinc=`./findhdr sys/ndir.h` | |
4068 | fi | |
4069 | echo "<dirent.h> NOT found." >&4 | |
4070 | fi | |
4071 | set i_dirent | |
4072 | eval $setvar | |
4073 | ||
4074 | : Look for type of directory structure. | |
4075 | echo " " | |
4076 | $cppstdin $cppflags $cppminus < "$xinc" > try.c | |
4077 | ||
4078 | case "$direntrytype" in | |
4079 | ''|' ') | |
4080 | case "$i_dirent" in | |
4081 | $define) guess1='struct dirent' ;; | |
4082 | *) guess1='struct direct' ;; | |
4083 | esac | |
4084 | ;; | |
4085 | *) guess1="$direntrytype" | |
4086 | ;; | |
4087 | esac | |
4088 | ||
4089 | case "$guess1" in | |
4090 | 'struct dirent') guess2='struct direct' ;; | |
4091 | *) guess2='struct dirent' ;; | |
4092 | esac | |
4093 | ||
4094 | if $contains "$guess1" try.c >/dev/null 2>&1; then | |
4095 | direntrytype="$guess1" | |
4096 | echo "Your directory entries are $direntrytype." >&4 | |
4097 | elif $contains "$guess2" try.c >/dev/null 2>&1; then | |
4098 | direntrytype="$guess2" | |
4099 | echo "Your directory entries seem to be $direntrytype." >&4 | |
4100 | else | |
4101 | echo "I don't recognize your system's directory entries." >&4 | |
4102 | rp="What type is used for directory entries on this system?" | |
4103 | dflt="$guess1" | |
4104 | . ./myread | |
4105 | direntrytype="$ans" | |
4106 | fi | |
4107 | $rm -f try.c | |
4108 | ||
4109 | ||
4110 | : see if the directory entry stores field length | |
4111 | echo " " | |
ecfc5424 AD |
4112 | $cppstdin $cppflags $cppminus < "$xinc" > try.c |
4113 | if $contains 'd_namlen' try.c >/dev/null 2>&1; then | |
a0d0e21e LW |
4114 | echo "Good, your directory entry keeps length information in d_namlen." >&4 |
4115 | val="$define" | |
4116 | else | |
4117 | echo "Your directory entry does not know about the d_namlen field." >&4 | |
4118 | val="$undef" | |
4119 | fi | |
4120 | set d_dirnamlen | |
4121 | eval $setvar | |
ecfc5424 | 4122 | $rm -f try.c |
a0d0e21e LW |
4123 | |
4124 | : see if dlerror exists | |
4125 | set dlerror d_dlerror | |
4126 | eval $inlibc | |
4127 | ||
4128 | : see if dld is available | |
4129 | set dld.h i_dld | |
4130 | eval $inhdr | |
4131 | ||
4132 | : see if dlopen exists | |
4133 | set dlopen d_dlopen | |
4134 | eval $inlibc | |
4135 | ||
4136 | : determine which dynamic loading, if any, to compile in | |
4137 | echo " " | |
4138 | dldir="ext/DynaLoader" | |
4139 | case "$usedl" in | |
4140 | $define|y|true) | |
4141 | dflt='y' | |
4142 | usedl="$define" | |
4143 | ;; | |
4144 | $undef|n|false) | |
4145 | dflt='n' | |
4146 | usedl="$undef" | |
4147 | ;; | |
4148 | *) | |
4149 | dflt='n' | |
4150 | case "$d_dlopen" in | |
ecfc5424 AD |
4151 | $define) dflt='y' ;; |
4152 | esac | |
a0d0e21e | 4153 | case "$i_dld" in |
ecfc5424 AD |
4154 | $define) dflt='y' ;; |
4155 | esac | |
4156 | : Does a dl_xxx.xs file exist for this operating system | |
4157 | $test -f ../$dldir/dl_${osname}.xs && dflt='y' | |
4158 | ;; | |
a0d0e21e LW |
4159 | esac |
4160 | rp="Do you wish to use dynamic loading?" | |
4161 | . ./myread | |
4162 | usedl="$ans" | |
4163 | case "$ans" in | |
4164 | y*) usedl="$define" | |
4165 | case "$dlsrc" in | |
4166 | '') | |
4167 | if $test -f ../$dldir/dl_${osname}.xs ; then | |
4168 | dflt="$dldir/dl_${osname}.xs" | |
4169 | elif $test "$d_dlopen" = "$define" ; then | |
4170 | dflt="$dldir/dl_dlopen.xs" | |
4171 | elif $test "$i_dld" = "$define" ; then | |
4172 | dflt="$dldir/dl_dld.xs" | |
4173 | else | |
4174 | dflt='' | |
4175 | fi | |
4176 | ;; | |
4177 | *) dflt="$dldir/$dlsrc" | |
4178 | ;; | |
4179 | esac | |
4180 | echo "The following dynamic loading files are available:" | |
4181 | : Can not go over to $dldir because getfile has path hard-coded in. | |
4182 | cd ..; ls -C $dldir/dl*.xs; cd UU | |
4183 | rp="Source file to use for dynamic loading" | |
4184 | fn="fne~" | |
4185 | . ./getfile | |
4186 | usedl="$define" | |
4187 | : emulate basename | |
4188 | dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'` | |
4189 | $cat << EOM | |
4190 | ||
4191 | Some systems may require passing special flags to $cc -c to | |
4192 | compile modules that will be used to create a shared library. | |
4193 | To use no flags, say "none". | |
4194 | ||
4195 | EOM | |
4196 | case "$cccdlflags" in | |
ecfc5424 AD |
4197 | ''|' ') case "$cc" in |
4198 | *gcc*) dflt='-fpic' ;; | |
4199 | *) case "$osname" in | |
4200 | hpux) dflt='+z' ;; | |
4201 | next) dflt='none' ;; | |
4202 | solaris) dflt='-K pic' ;; | |
4203 | sunos) dflt='-pic' ;; | |
4204 | svr4*|esix*) dflt='-Kpic' ;; | |
4205 | *) dflt='none' ;; | |
4206 | esac ;; | |
4207 | esac ;; | |
a0d0e21e LW |
4208 | *) dflt="$cccdlflags" ;; |
4209 | esac | |
4210 | rp="Any special flags to pass to $cc -c to compile shared library modules?" | |
4211 | . ./myread | |
4212 | case "$ans" in | |
4213 | none) cccdlflags='' ;; | |
4214 | *) cccdlflags="$ans" ;; | |
4215 | esac | |
4216 | ||
4217 | cat << 'EOM' | |
4218 | ||
ecfc5424 AD |
4219 | Some systems may require passing special flags to ld to create a |
4220 | library that can be dynamically loaded. If your ld flags include | |
4221 | -L/other/path options to locate libraries outside your loader's normal | |
4222 | search path, you may need to specify those -L options here as well. To | |
4223 | use no flags, say "none". | |
a0d0e21e LW |
4224 | |
4225 | EOM | |
4226 | case "$lddlflags" in | |
4227 | ''|' ') case "$osname" in | |
4228 | hpux) dflt='-b' ;; | |
4229 | next) dflt='none' ;; | |
4230 | solaris) dflt='-G' ;; | |
ecfc5424 AD |
4231 | sunos) dflt='-assert nodefinitions' ;; |
4232 | svr4*|esix*) dflt="-G $ldflags" ;; | |
a0d0e21e LW |
4233 | *) dflt='none' ;; |
4234 | esac | |
4235 | ;; | |
4236 | *) dflt="$lddlflags" ;; | |
4237 | esac | |
ecfc5424 | 4238 | rp="Any special flags to pass to ld to create a dynamically loaded library?" |
a0d0e21e LW |
4239 | . ./myread |
4240 | case "$ans" in | |
4241 | none) lddlflags='' ;; | |
4242 | *) lddlflags="$ans" ;; | |
4243 | esac | |
4244 | ||
4245 | cat <<EOM | |
4246 | ||
4247 | Some systems may require passing special flags to $cc to indicate that | |
4248 | the resulting executable will use dynamic linking. To use no flags, | |
4249 | say "none". | |
4250 | ||
4251 | EOM | |
4252 | case "$ccdlflags" in | |
ecfc5424 AD |
4253 | ''|' ') case "$osname" in |
4254 | hpux) dflt='none' ;; | |
4255 | next) dflt='none' ;; | |
4256 | sunos) dflt='none' ;; | |
4257 | *) dflt='none' ;; | |
4258 | esac ;; | |
4259 | *) dflt="$ccdlflags" ;; | |
a0d0e21e LW |
4260 | esac |
4261 | rp="Any special flags to pass to $cc to use dynamic loading?" | |
4262 | . ./myread | |
4263 | case "$ans" in | |
4264 | none) ccdlflags='' ;; | |
4265 | *) ccdlflags="$ans" ;; | |
4266 | esac | |
4267 | ;; | |
4268 | *) usedl="$undef" | |
4269 | dlsrc='dl_none.xs' | |
4270 | lddlflags='' | |
4271 | ccdlflags='' | |
4272 | ;; | |
4273 | esac | |
4274 | ||
ecfc5424 AD |
4275 | val="$undef" |
4276 | case "$osname" in | |
4277 | esix*|svr4*) | |
4278 | case "$usedl" in | |
4279 | $define) | |
4280 | $cat <<EOM | |
4281 | ||
4282 | System V Release 4 systems can support dynamic loading | |
4283 | only if libperl is created as a shared library. | |
4284 | ||
4285 | EOM | |
4286 | val="$define" | |
4287 | ;; | |
4288 | esac ;; | |
4289 | esac | |
4290 | set d_shrplib; eval $setvar | |
4291 | case "$d_shrplib" in | |
4292 | $define) | |
4293 | cat <<EOM >&4 | |
4294 | ||
4295 | Be sure to add the perl source directory to the LD_LIBRARY_PATH | |
4296 | environment variable before running make: | |
4297 | LD_LIBRARY_PATH=`cd ..;pwd`; export LD_LIBRARY_PATH | |
4298 | or | |
4299 | setenv LD_LIBRARY_PATH `cd ..;pwd` | |
4300 | ||
4301 | EOM | |
4302 | ;; | |
4303 | esac | |
4304 | case "$d_shrplib" in | |
4305 | $define) | |
4306 | case "$shrpdir" in | |
4307 | "") dflt="$archlib/CORE";; | |
4308 | *) dflt="$shrpdir";; | |
4309 | esac | |
4310 | rp="What directory should we install the shared libperl into?" | |
4311 | fn="d~" | |
4312 | . ./getfile | |
4313 | shrpdir="$ans" | |
4314 | ;; | |
4315 | *) shrpdir='none' | |
4316 | ;; | |
4317 | esac | |
4318 | ||
a0d0e21e LW |
4319 | : see if dlfcn is available |
4320 | set dlfcn.h i_dlfcn | |
4321 | eval $inhdr | |
4322 | ||
4323 | case "$usedl" in | |
4324 | $define|y|true) | |
4325 | $cat << EOM | |
4326 | ||
4327 | On a few systems, the dynamically loaded modules that perl generates and uses | |
4328 | will need a different extension then shared libs. The default will probably | |
4329 | be appropriate. | |
4330 | ||
4331 | EOM | |
4332 | case "$dlext" in | |
4333 | '') dflt="$so" ;; | |
4334 | *) dflt="$dlext" ;; | |
4335 | esac | |
4336 | rp='What is the extension of dynamically loaded modules' | |
4337 | . ./myread | |
4338 | dlext="$ans" | |
4339 | ;; | |
4340 | *) | |
4341 | dlext="none" | |
4342 | ;; | |
4343 | esac | |
4344 | ||
4345 | : Check if dlsym need a leading underscore | |
4346 | echo " " | |
4347 | val="$undef" | |
4348 | ||
4349 | case "$dlsrc" in | |
4350 | dl_dlopen.xs) | |
4351 | echo "Checking whether your dlsym() needs a leading underscore ..." >&4 | |
4352 | $cat >dyna.c <<'EOM' | |
4353 | fred () { } | |
4354 | EOM | |
4355 | ||
4356 | $cat >fred.c<<EOM | |
4357 | ||
4358 | #include <stdio.h> | |
4359 | #$i_dlfcn I_DLFCN | |
4360 | #ifdef I_DLFCN | |
4361 | #include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */ | |
4362 | #else | |
4363 | #include <sys/types.h> | |
4364 | #include <nlist.h> | |
4365 | #include <link.h> | |
4366 | #endif | |
4367 | ||
4368 | extern int fred() ; | |
4369 | ||
4370 | main() | |
4371 | { | |
4372 | void * handle ; | |
4373 | void * symbol ; | |
4374 | #ifndef RTLD_LAZY | |
4375 | int mode = 1 ; | |
4376 | #else | |
4377 | int mode = RTLD_LAZY ; | |
4378 | #endif | |
4379 | handle = dlopen("./dyna.$dlext", mode) ; | |
4380 | if (handle == NULL) { | |
4381 | printf ("1\n") ; | |
4382 | exit(0); | |
4383 | } | |
4384 | symbol = dlsym(handle, "fred") ; | |
4385 | if (symbol == NULL) { | |
4386 | /* try putting a leading underscore */ | |
4387 | symbol = dlsym(handle, "_fred") ; | |
4388 | if (symbol == NULL) { | |
4389 | printf ("2\n") ; | |
4390 | exit(0); | |
4391 | } | |
4392 | printf ("3\n") ; | |
4393 | } | |
4394 | else | |
4395 | printf ("4\n") ; | |
4396 | exit(0); | |
4397 | } | |
4398 | EOM | |
4399 | if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && | |
4400 | ld $lddlflags -o dyna.$dlext dyna.o > /dev/null 2>&1 && | |
4401 | $cc $ccflags $ldflags $cccdlflags $ccdlflags fred.c -o fred $libs > /dev/null 2>&1; then | |
4402 | xxx=`./fred` | |
4403 | case $xxx in | |
4404 | 1) echo "Test program failed using dlopen." >&4 | |
4405 | echo "Perhaps you should not use dynamic loading." >&4;; | |
4406 | 2) echo "Test program failed using dlsym." >&4 | |
4407 | echo "Perhaps you should not use dynamic loading." >&4;; | |
4408 | 3) echo "dlsym needs a leading underscore" >&4 | |
4409 | val="$define" ;; | |
4410 | 4) echo "dlsym doesn't need a leading underscore." >&4;; | |
4411 | esac | |
4412 | else | |
4413 | echo "I can't compile and run the test program." >&4 | |
4414 | fi | |
4415 | ;; | |
4416 | esac | |
4417 | ||
4418 | $rm -f fred fred.? dyna.$dlext dyna.? | |
4419 | ||
4420 | set d_dlsymun | |
4421 | eval $setvar | |
4422 | ||
4423 | : see if setuid scripts can be secure | |
ecfc5424 | 4424 | $cat <<EOM |
a0d0e21e LW |
4425 | |
4426 | Some kernels have a bug that prevents setuid #! scripts from being | |
4427 | secure. Some sites have disabled setuid #! scripts because of this. | |
4428 | ||
4429 | First let's decide if your kernel supports secure setuid #! scripts. | |
4430 | (If setuid #! scripts would be secure but have been disabled anyway, | |
4431 | don't say that they are secure if asked.) | |
4432 | ||
4433 | EOM | |
4434 | ||
4435 | val="$undef" | |
4436 | if $test -d /dev/fd; then | |
4437 | echo "#!$ls" >reflect | |
4438 | chmod +x,u+s reflect | |
4439 | ./reflect >flect 2>&1 | |
4440 | if $contains "/dev/fd" flect >/dev/null; then | |
ecfc5424 AD |
4441 | echo "Congratulations, your kernel has secure setuid scripts!" >&4 |
4442 | val="$define" | |
a0d0e21e LW |
4443 | else |
4444 | $cat <<EOM | |
4445 | If you are not sure if they are secure, I can check but I'll need a | |
4446 | username and password different from the one you are using right now. | |
4447 | If you don't have such a username or don't want me to test, simply | |
4448 | enter 'none'. | |
4449 | ||
4450 | EOM | |
4451 | rp='Other username to test security of setuid scripts with?' | |
4452 | dflt='none' | |
4453 | . ./myread | |
4454 | case "$ans" in | |
4455 | n|none) | |
4456 | case "$d_suidsafe" in | |
4457 | '') echo "I'll assume setuid scripts are *not* secure." >&4 | |
4458 | dflt=n;; | |
4459 | "$undef") | |
4460 | echo "Well, the $hint value is *not* secure." >&4 | |
4461 | dflt=n;; | |
ecfc5424 | 4462 | *) echo "Well, the $hint value *is* secure." >&4 |
a0d0e21e LW |
4463 | dflt=y;; |
4464 | esac | |
4465 | ;; | |
ecfc5424 AD |
4466 | *) |
4467 | $rm -f reflect flect | |
4468 | echo "#!$ls" >reflect | |
4469 | chmod +x,u+s reflect | |
4470 | echo >flect | |
4471 | chmod a+w flect | |
4472 | echo '"su" will (probably) prompt you for '"$ans's password." | |
4473 | su $ans -c './reflect >flect' | |
4474 | if $contains "/dev/fd" flect >/dev/null; then | |
a0d0e21e LW |
4475 | echo "Okay, it looks like setuid scripts are secure." >&4 |
4476 | dflt=y | |
ecfc5424 | 4477 | else |
a0d0e21e LW |
4478 | echo "I don't think setuid scripts are secure." >&4 |
4479 | dflt=n | |
ecfc5424 | 4480 | fi |
a0d0e21e LW |
4481 | ;; |
4482 | esac | |
4483 | rp='Does your kernel have *secure* setuid scripts?' | |
4484 | . ./myread | |
4485 | case "$ans" in | |
4486 | [yY]*) val="$define";; | |
4487 | *) val="$undef";; | |
4488 | esac | |
4489 | fi | |
4490 | else | |
4491 | echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4 | |
4492 | val="$undef" | |
4493 | fi | |
4494 | set d_suidsafe | |
4495 | eval $setvar | |
4496 | ||
4497 | $rm -f reflect flect | |
4498 | ||
4499 | : now see if they want to do setuid emulation | |
ecfc5424 AD |
4500 | echo " " |
4501 | val="$undef" | |
4502 | case "$d_suidsafe" in | |
4503 | "$define") | |
4504 | val="$undef" | |
4505 | echo "No need to emulate SUID scripts since they are secure here." >& 4 | |
4506 | ;; | |
4507 | *) | |
4508 | $cat <<EOM | |
a0d0e21e LW |
4509 | Some systems have disabled setuid scripts, especially systems where |
4510 | setuid scripts cannot be secure. On systems where setuid scripts have | |
4511 | been disabled, the setuid/setgid bits on scripts are currently | |
4512 | useless. It is possible for $package to detect those bits and emulate | |
4513 | setuid/setgid in a secure fashion. This emulation will only work if | |
4514 | setuid scripts have been disabled in your kernel. | |
4515 | ||
4516 | EOM | |
a0d0e21e LW |
4517 | case "$d_dosuid" in |
4518 | "$define") dflt=y ;; | |
4519 | *) dflt=n ;; | |
4520 | esac | |
4521 | rp="Do you want to do setuid/setgid emulation?" | |
4522 | . ./myread | |
4523 | case "$ans" in | |
4524 | [yY]*) val="$define";; | |
4525 | *) val="$undef";; | |
4526 | esac | |
4527 | ;; | |
4528 | esac | |
4529 | set d_dosuid | |
4530 | eval $setvar | |
4531 | ||
4532 | : see if drem exists | |
4533 | set drem d_drem | |
4534 | eval $inlibc | |
4535 | ||
4536 | : see if dup2 exists | |
4537 | set dup2 d_dup2 | |
4538 | eval $inlibc | |
4539 | ||
4540 | : see if fchmod exists | |
4541 | set fchmod d_fchmod | |
4542 | eval $inlibc | |
4543 | ||
4544 | : see if fchown exists | |
4545 | set fchown d_fchown | |
4546 | eval $inlibc | |
4547 | ||
4548 | : see if this is an fcntl system | |
4549 | set fcntl d_fcntl | |
4550 | eval $inlibc | |
4551 | ||
4552 | : see if fgetpos exists | |
4553 | set fgetpos d_fgetpos | |
4554 | eval $inlibc | |
4555 | ||
4556 | : see if we can have long filenames | |
4557 | echo " " | |
4558 | rmlist="$rmlist /tmp/cf$$" | |
4559 | $test -d /tmp/cf$$ || mkdir /tmp/cf$$ | |
4560 | first=123456789abcdef | |
4561 | second=/tmp/cf$$/$first | |
4562 | $rm -f $first $second | |
4563 | if (echo hi >$first) 2>/dev/null; then | |
4564 | if $test -f 123456789abcde; then | |
4565 | echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4 | |
4566 | val="$undef" | |
4567 | else | |
4568 | if (echo hi >$second) 2>/dev/null; then | |
4569 | if $test -f /tmp/cf$$/123456789abcde; then | |
4570 | $cat <<'EOM' | |
4571 | That's peculiar... You can have filenames longer than 14 characters, but only | |
4572 | on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems | |
4573 | I shall consider your system cannot support long filenames at all. | |
4574 | EOM | |
4575 | val="$undef" | |
4576 | else | |
4577 | echo 'You can have filenames longer than 14 characters.' >&4 | |
4578 | val="$define" | |
4579 | fi | |
4580 | else | |
4581 | $cat <<'EOM' | |
4582 | How confusing! Some of your filesystems are sane enough to allow filenames | |
4583 | longer than 14 characters but some others like /tmp can't even think about them. | |
4584 | So, for now on, I shall assume your kernel does not allow them at all. | |
4585 | EOM | |
4586 | val="$undef" | |
4587 | fi | |
4588 | fi | |
4589 | else | |
4590 | $cat <<'EOM' | |
4591 | You can't have filenames longer than 14 chars. You can't even think about them! | |
4592 | EOM | |
4593 | val="$undef" | |
4594 | fi | |
4595 | set d_flexfnam | |
4596 | eval $setvar | |
4597 | $rm -rf /tmp/cf$$ 123456789abcde* | |
4598 | ||
4599 | : see if flock exists | |
4600 | set flock d_flock | |
4601 | eval $inlibc | |
4602 | ||
4603 | : see if fmod exists | |
4604 | set fmod d_fmod | |
4605 | eval $inlibc | |
4606 | ||
4607 | : see if fork exists | |
4608 | set fork d_fork | |
4609 | eval $inlibc | |
4610 | ||
4611 | : see if pathconf exists | |
4612 | set pathconf d_pathconf | |
4613 | eval $inlibc | |
4614 | ||
4615 | : see if fpathconf exists | |
4616 | set fpathconf d_fpathconf | |
4617 | eval $inlibc | |
4618 | ||
4619 | : see if fsetpos exists | |
4620 | set fsetpos d_fsetpos | |
4621 | eval $inlibc | |
4622 | ||
4623 | : see if gethostent exists | |
4624 | set gethostent d_gethent | |
4625 | eval $inlibc | |
4626 | ||
4627 | : see if getlogin exists | |
4628 | set getlogin d_getlogin | |
4629 | eval $inlibc | |
4630 | ||
4631 | : see if getpgrp exists | |
4632 | set getpgrp d_getpgrp | |
4633 | eval $inlibc | |
4634 | ||
4635 | : see if getpgrp2 exists | |
4636 | set getpgrp2 d_getpgrp2 | |
4637 | eval $inlibc | |
4638 | ||
4639 | : see if getppid exists | |
4640 | set getppid d_getppid | |
4641 | eval $inlibc | |
4642 | ||
4643 | : see if getpriority exists | |
4644 | set getpriority d_getprior | |
4645 | eval $inlibc | |
4646 | ||
a0d0e21e LW |
4647 | : see if this is a netinet/in.h or sys/in.h system |
4648 | set netinet/in.h i_niin sys/in.h i_sysin | |
4649 | eval $inhdr | |
4650 | ||
4651 | : see if htonl --and friends-- exists | |
4652 | val='' | |
4653 | set htonl val | |
4654 | eval $inlibc | |
4655 | ||
4656 | : Maybe they are macros. | |
4657 | case "$val" in | |
4658 | $undef) | |
4659 | $cat >htonl.c <<EOM | |
4660 | #include <stdio.h> | |
4661 | #include <sys/types.h> | |
4662 | #$i_niin I_NETINET_IN | |
4663 | #$i_sysin I_SYS_IN | |
4664 | #ifdef I_NETINET_IN | |
4665 | #include <netinet/in.h> | |
4666 | #endif | |
4667 | #ifdef I_SYS_IN | |
4668 | #include <sys/in.h> | |
4669 | #endif | |
4670 | #ifdef htonl | |
4671 | printf("Defined as a macro."); | |
4672 | #endif | |
4673 | EOM | |
4674 | $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null | |
4675 | if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then | |
4676 | val="$define" | |
4677 | echo "But it seems to be defined as a macro." >&4 | |
4678 | fi | |
4679 | $rm -f htonl.? | |
4680 | ;; | |
4681 | esac | |
4682 | set d_htonl | |
4683 | eval $setvar | |
4684 | ||
4685 | : see which of string.h or strings.h is needed | |
4686 | echo " " | |
4687 | strings=`./findhdr string.h` | |
4688 | if $test "$strings" && $test -r "$strings"; then | |
4689 | echo "Using <string.h> instead of <strings.h>." >&4 | |
4690 | val="$define" | |
4691 | else | |
4692 | val="$undef" | |
4693 | strings=`./findhdr strings.h` | |
4694 | if $test "$strings" && $test -r "$strings"; then | |
4695 | echo "Using <strings.h> instead of <string.h>." >&4 | |
4696 | else | |
4697 | echo "No string header found -- You'll surely have problems." >&4 | |
4698 | fi | |
4699 | fi | |
4700 | set i_string | |
4701 | eval $setvar | |
4702 | case "$i_string" in | |
4703 | "$undef") strings=`./findhdr strings.h`;; | |
4704 | *) strings=`./findhdr string.h`;; | |
4705 | esac | |
4706 | ||
4707 | : index or strchr | |
4708 | echo " " | |
4709 | if set index val -f; eval $csym; $val; then | |
4710 | if set strchr val -f d_strchr; eval $csym; $val; then | |
4711 | if $contains strchr "$strings" >/dev/null 2>&1 ; then | |
4712 | val="$define" | |
4713 | vali="$undef" | |
4714 | echo "strchr() found." >&4 | |
4715 | else | |
4716 | val="$undef" | |
4717 | vali="$define" | |
4718 | echo "index() found." >&4 | |
4719 | fi | |
4720 | else | |
4721 | val="$undef" | |
4722 | vali="$define" | |
4723 | echo "index() found." >&4 | |
4724 | fi | |
4725 | else | |
4726 | if set strchr val -f d_strchr; eval $csym; $val; then | |
4727 | val="$define" | |
4728 | vali="$undef" | |
4729 | echo "strchr() found." >&4 | |
4730 | else | |
4731 | echo "No index() or strchr() found!" >&4 | |
4732 | val="$undef" | |
4733 | vali="$undef" | |
4734 | fi | |
4735 | fi | |
4736 | set d_strchr; eval $setvar | |
4737 | val="$vali" | |
4738 | set d_index; eval $setvar | |
4739 | ||
4740 | : Look for isascii | |
4741 | echo " " | |
4742 | $cat >isascii.c <<'EOCP' | |
4743 | #include <stdio.h> | |
4744 | #include <ctype.h> | |
4745 | main() { | |
4746 | int c = 'A'; | |
4747 | if (isascii(c)) | |
4748 | exit(0); | |
4749 | else | |
4750 | exit(1); | |
4751 | } | |
4752 | EOCP | |
4753 | if $cc $ccflags $ldflags -o isascii isascii.c $libs >/dev/null 2>&1 ; then | |
4754 | echo "isascii() found." >&4 | |
4755 | val="$define" | |
4756 | else | |
4757 | echo "isascii() NOT found." >&4 | |
4758 | val="$undef" | |
4759 | fi | |
4760 | set d_isascii | |
4761 | eval $setvar | |
4762 | $rm -f isascii* | |
4763 | ||
4764 | : see if killpg exists | |
4765 | set killpg d_killpg | |
4766 | eval $inlibc | |
4767 | ||
4768 | : see if link exists | |
4769 | set link d_link | |
4770 | eval $inlibc | |
4771 | ||
4772 | : see if stdio is really std | |
4773 | echo " " | |
4774 | xxx=`./findhdr stdio.h` | |
4775 | if $contains 'char.*_ptr;' "$xxx" >/dev/null 2>&1 ; then | |
4776 | if $contains '_cnt;' "$xxx" >/dev/null 2>&1 ; then | |
4777 | echo "Your stdio is pretty std." >&4 | |
4778 | val="$define" | |
4779 | else | |
4780 | echo "Your stdio isn't very std." >&4 | |
4781 | val="$undef" | |
4782 | fi | |
4783 | else | |
4784 | echo "Your stdio isn't very std." >&4 | |
4785 | val="$undef" | |
4786 | fi | |
4787 | set d_stdstdio | |
4788 | eval $setvar | |
4789 | ||
4790 | : see if stdio is like that in linux | |
4791 | case "$d_stdstdio" in | |
4792 | "$undef") | |
4793 | echo " " | |
4794 | xxx=`./findhdr stdio.h` | |
4795 | $cppstdin $cppflags $cppminus < "$xxx" > stdio.E | |
4796 | if $contains 'char.*_IO_read_base' stdio.E >/dev/null 2>&1 && \ | |
4797 | $contains '_IO_read_ptr' stdio.E >/dev/null 2>&1 && \ | |
4798 | $contains '_IO_read_end' stdio.E >/dev/null 2>&1 ; then | |
4799 | echo "Your stdio looks like linux." >&4 | |
4800 | val="$define" | |
4801 | else | |
4802 | echo "You don't have linux stdio, either." >&4 | |
4803 | val="$undef" | |
4804 | fi | |
4805 | $rm -f stdio.E | |
4806 | ;; | |
4807 | *) val="$undef" ;; | |
4808 | esac | |
4809 | ||
4810 | set d_linuxstd | |
4811 | eval $setvar | |
4812 | ||
4813 | : see if localeconv exists | |
4814 | set localeconv d_locconv | |
4815 | eval $inlibc | |
4816 | ||
4817 | : see if lockf exists | |
4818 | set lockf d_lockf | |
4819 | eval $inlibc | |
4820 | ||
4821 | : see if lstat exists | |
4822 | set lstat d_lstat | |
4823 | eval $inlibc | |
4824 | ||
4825 | : see if mblen exists | |
4826 | set mblen d_mblen | |
4827 | eval $inlibc | |
4828 | ||
4829 | : see if mbstowcs exists | |
4830 | set mbstowcs d_mbstowcs | |
4831 | eval $inlibc | |
4832 | ||
4833 | : see if mbtowc exists | |
4834 | set mbtowc d_mbtowc | |
4835 | eval $inlibc | |
4836 | ||
4837 | : see if memcmp exists | |
4838 | set memcmp d_memcmp | |
4839 | eval $inlibc | |
4840 | ||
4841 | : see if memcpy exists | |
4842 | set memcpy d_memcpy | |
4843 | eval $inlibc | |
4844 | ||
4845 | : see if memmove exists | |
4846 | set memmove d_memmove | |
2304df62 AD |
4847 | eval $inlibc |
4848 | ||
4849 | : see if memset exists | |
4850 | set memset d_memset | |
4851 | eval $inlibc | |
4852 | ||
4853 | : see if mkdir exists | |
4854 | set mkdir d_mkdir | |
4855 | eval $inlibc | |
4856 | ||
a0d0e21e LW |
4857 | : see if mkfifo exists |
4858 | set mkfifo d_mkfifo | |
4859 | eval $inlibc | |
4860 | ||
4861 | : see if mktime exists | |
4862 | set mktime d_mktime | |
4863 | eval $inlibc | |
4864 | ||
2304df62 AD |
4865 | : see if msgctl exists |
4866 | set msgctl d_msgctl | |
4867 | eval $inlibc | |
4868 | ||
4869 | : see if msgget exists | |
4870 | set msgget d_msgget | |
4871 | eval $inlibc | |
4872 | ||
4873 | : see if msgsnd exists | |
4874 | set msgsnd d_msgsnd | |
4875 | eval $inlibc | |
4876 | ||
4877 | : see if msgrcv exists | |
4878 | set msgrcv d_msgrcv | |
4879 | eval $inlibc | |
4880 | ||
4881 | : see how much of the 'msg*(2)' library is present. | |
4882 | h_msg=true | |
4883 | echo " " | |
4884 | case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in | |
4885 | *"$undef"*) h_msg=false;; | |
4886 | esac | |
4887 | : we could also check for sys/ipc.h ... | |
4888 | if $h_msg && $test `./findhdr sys/msg.h`; then | |
4889 | echo "You have the full msg*(2) library." >&4 | |
4890 | val="$define" | |
4891 | else | |
4892 | echo "You don't have the full msg*(2) library." >&4 | |
4893 | val="$undef" | |
4894 | fi | |
4895 | set d_msg | |
4896 | eval $setvar | |
4897 | ||
a0d0e21e LW |
4898 | : see if this is a malloc.h system |
4899 | set malloc.h i_malloc | |
4900 | eval $inhdr | |
4901 | ||
85e6fe83 | 4902 | : determine which malloc to compile in |
85e6fe83 LW |
4903 | echo " " |
4904 | case "$usemymalloc" in | |
a0d0e21e LW |
4905 | ''|y*|true) dflt='y' ;; |
4906 | n*|false) dflt='n' ;; | |
4907 | *) dflt="$usemymalloc" ;; | |
85e6fe83 LW |
4908 | esac |
4909 | rp="Do you wish to attempt to use the malloc that comes with $package?" | |
4910 | . ./myread | |
4911 | usemymalloc="$ans" | |
4912 | case "$ans" in | |
a0d0e21e LW |
4913 | y*|true) |
4914 | usemymalloc='y' | |
4915 | mallocsrc='malloc.c' | |
4916 | mallocobj='malloc.o' | |
4917 | d_mymalloc="$define" | |
4918 | case "$libs" in | |
4919 | *-lmalloc*) | |
4920 | : Remove malloc from list of libraries to use | |
4921 | echo "Removing unneeded -lmalloc from library list" >&4 | |
4922 | set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'` | |
4923 | shift | |
4924 | libs="$*" | |
4925 | echo "libs = $libs" >&4 | |
4926 | ;; | |
4927 | esac | |
4928 | ;; | |
4929 | *) | |
4930 | usemymalloc='n' | |
4931 | mallocsrc='' | |
4932 | mallocobj='' | |
4933 | d_mymalloc="$undef" | |
4934 | ;; | |
85e6fe83 LW |
4935 | esac |
4936 | ||
4937 | : compute the type returned by malloc | |
4938 | echo " " | |
4939 | case "$malloctype" in | |
4940 | '') | |
a0d0e21e LW |
4941 | $cat >malloc.c <<END |
4942 | #$i_malloc I_MALLOC | |
4943 | #include <stdio.h> | |
4944 | #include <sys/types.h> | |
4945 | #ifdef I_MALLOC | |
85e6fe83 | 4946 | #include <malloc.h> |
a0d0e21e | 4947 | #endif |
85e6fe83 LW |
4948 | void *malloc(); |
4949 | END | |
4950 | if $cc $ccflags -c malloc.c >/dev/null 2>&1; then | |
4951 | malloctype='void *' | |
4952 | else | |
4953 | malloctype='char *' | |
4954 | fi | |
4955 | $rm -f malloc.[co] | |
4956 | ;; | |
4957 | esac | |
4958 | echo "Your system wants malloc to return '$malloctype', it would seem." >&4 | |
4959 | ||
a0d0e21e LW |
4960 | : see if nice exists |
4961 | set nice d_nice | |
2304df62 AD |
4962 | eval $inlibc |
4963 | ||
4964 | : Locate the flags for 'open()' | |
4965 | echo " " | |
4966 | $cat >open3.c <<'EOCP' | |
4967 | #include <sys/types.h> | |
4968 | #ifdef I_FCNTL | |
4969 | #include <fcntl.h> | |
4970 | #endif | |
4971 | #ifdef I_SYS_FILE | |
4972 | #include <sys/file.h> | |
4973 | #endif | |
4974 | main() { | |
4975 | if(O_RDONLY); | |
4976 | #ifdef O_TRUNC | |
4977 | exit(0); | |
4978 | #else | |
4979 | exit(1); | |
4980 | #endif | |
4981 | } | |
4982 | EOCP | |
4983 | : check sys/file.h first to get FREAD on Sun | |
4984 | if $test `./findhdr sys/file.h` && \ | |
4985 | $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then | |
4986 | h_sysfile=true; | |
4987 | echo "<sys/file.h> defines the O_* constants..." >&4 | |
4988 | if ./open3; then | |
4989 | echo "and you have the 3 argument form of open()." >&4 | |
4990 | val="$define" | |
4991 | else | |
4992 | echo "but not the 3 argument form of open(). Oh, well." >&4 | |
4993 | val="$undef" | |
4994 | fi | |
4995 | elif $test `./findhdr fcntl.h` && \ | |
4996 | $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then | |
4997 | h_fcntl=true; | |
4998 | echo "<fcntl.h> defines the O_* constants..." >&4 | |
4999 | if ./open3; then | |
5000 | echo "and you have the 3 argument form of open()." >&4 | |
5001 | val="$define" | |
5002 | else | |
5003 | echo "but not the 3 argument form of open(). Oh, well." >&4 | |
5004 | val="$undef" | |
5005 | fi | |
5006 | else | |
5007 | val="$undef" | |
5008 | echo "I can't find the O_* constant definitions! You got problems." >&4 | |
5009 | fi | |
5010 | set d_open3 | |
5011 | eval $setvar | |
5012 | $rm -f open3* | |
5013 | ||
a0d0e21e LW |
5014 | : see if pause exists |
5015 | set pause d_pause | |
5016 | eval $inlibc | |
5017 | ||
5018 | : see if pipe exists | |
5019 | set pipe d_pipe | |
5020 | eval $inlibc | |
5021 | ||
2304df62 AD |
5022 | : see if this is a pwd system |
5023 | echo " " | |
5024 | xxx=`./findhdr pwd.h` | |
5025 | if $test "$xxx"; then | |
5026 | i_pwd="$define" | |
5027 | echo "<pwd.h> found." >&4 | |
85e6fe83 | 5028 | $cppstdin $cppflags $cppminus < $xxx >$$.h |
2304df62 AD |
5029 | if $contains 'pw_quota' $$.h >/dev/null 2>&1; then |
5030 | d_pwquota="$define" | |
5031 | else | |
5032 | d_pwquota="$undef" | |
5033 | fi | |
5034 | if $contains 'pw_age' $$.h >/dev/null 2>&1; then | |
5035 | d_pwage="$define" | |
5036 | else | |
5037 | d_pwage="$undef" | |
5038 | fi | |
5039 | if $contains 'pw_change' $$.h >/dev/null 2>&1; then | |
5040 | d_pwchange="$define" | |
5041 | else | |
5042 | d_pwchange="$undef" | |
5043 | fi | |
5044 | if $contains 'pw_class' $$.h >/dev/null 2>&1; then | |
5045 | d_pwclass="$define" | |
5046 | else | |
5047 | d_pwclass="$undef" | |
5048 | fi | |
5049 | if $contains 'pw_expire' $$.h >/dev/null 2>&1; then | |
5050 | d_pwexpire="$define" | |
5051 | else | |
5052 | d_pwexpire="$undef" | |
5053 | fi | |
5054 | if $contains 'pw_comment' $$.h >/dev/null 2>&1; then | |
5055 | d_pwcomment="$define" | |
5056 | else | |
5057 | d_pwcomment="$undef" | |
5058 | fi | |
5059 | $rm -f $$.h | |
5060 | else | |
5061 | i_pwd="$undef" | |
5062 | d_pwquota="$undef" | |
5063 | d_pwage="$undef" | |
5064 | d_pwchange="$undef" | |
5065 | d_pwclass="$undef" | |
5066 | d_pwexpire="$undef" | |
5067 | d_pwcomment="$undef" | |
5068 | echo "<pwd.h> NOT found." >&4 | |
5069 | fi | |
5070 | ||
85e6fe83 | 5071 | : see if readdir and friends exist |
2304df62 AD |
5072 | set readdir d_readdir |
5073 | eval $inlibc | |
85e6fe83 LW |
5074 | set seekdir d_seekdir |
5075 | eval $inlibc | |
5076 | set telldir d_telldir | |
5077 | eval $inlibc | |
5078 | set rewinddir d_rewinddir | |
5079 | eval $inlibc | |
2304df62 | 5080 | |
a0d0e21e LW |
5081 | : see if readlink exists |
5082 | set readlink d_readlink | |
5083 | eval $inlibc | |
5084 | ||
2304df62 AD |
5085 | : see if rename exists |
5086 | set rename d_rename | |
5087 | eval $inlibc | |
5088 | ||
5089 | : see if rmdir exists | |
5090 | set rmdir d_rmdir | |
5091 | eval $inlibc | |
5092 | ||
5093 | : can bcopy handle overlapping blocks? | |
5094 | val="$undef" | |
5095 | case "$d_bcopy" in | |
5096 | "$define") | |
5097 | echo " " | |
5098 | echo "Checking to see if your bcopy() can do overlapping copies..." >&4 | |
5099 | $cat >foo.c <<'EOCP' | |
5100 | main() | |
5101 | { | |
85e6fe83 LW |
5102 | char buf[128], abc[128]; |
5103 | char *b; | |
5104 | int len; | |
5105 | int off; | |
5106 | int align; | |
a0d0e21e | 5107 | |
85e6fe83 | 5108 | bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36); |
2304df62 AD |
5109 | |
5110 | for (align = 7; align >= 0; align--) { | |
5111 | for (len = 36; len; len--) { | |
5112 | b = buf+align; | |
85e6fe83 | 5113 | bcopy(abc, b, len); |
2304df62 AD |
5114 | for (off = 1; off <= len; off++) { |
5115 | bcopy(b, b+off, len); | |
5116 | bcopy(b+off, b, len); | |
85e6fe83 | 5117 | if (bcmp(b, abc, len)) |
2304df62 AD |
5118 | exit(1); |
5119 | } | |
5120 | } | |
5121 | } | |
5122 | exit(0); | |
5123 | } | |
5124 | EOCP | |
a0d0e21e | 5125 | if $cc foo.c -o safebcpy $ccflags $ldflags $libs >/dev/null 2>&1 ; then |
2304df62 AD |
5126 | if ./safebcpy 2>/dev/null; then |
5127 | echo "Yes, it can." | |
5128 | val="$define" | |
5129 | else | |
5130 | echo "It can't, sorry." | |
5131 | fi | |
5132 | else | |
5133 | echo "(I can't compile the test program, so we'll assume not...)" | |
5134 | fi | |
5135 | ;; | |
5136 | esac | |
5137 | $rm -f foo.* safebcpy core | |
5138 | set d_safebcpy | |
5139 | eval $setvar | |
5140 | ||
5141 | : can memcpy handle overlapping blocks? | |
5142 | val="$undef" | |
5143 | case "$d_memcpy" in | |
5144 | "$define") | |
5145 | echo " " | |
5146 | echo "Checking to see if your memcpy() can do overlapping copies..." >&4 | |
5147 | $cat >foo.c <<'EOCP' | |
5148 | main() | |
5149 | { | |
85e6fe83 LW |
5150 | char buf[128], abc[128]; |
5151 | char *b; | |
5152 | int len; | |
5153 | int off; | |
5154 | int align; | |
5155 | ||
5156 | memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36); | |
2304df62 AD |
5157 | |
5158 | for (align = 7; align >= 0; align--) { | |
5159 | for (len = 36; len; len--) { | |
5160 | b = buf+align; | |
85e6fe83 | 5161 | memcpy(abc, b, len); |
2304df62 AD |
5162 | for (off = 1; off <= len; off++) { |
5163 | memcpy(b, b+off, len); | |
5164 | memcpy(b+off, b, len); | |
85e6fe83 | 5165 | if (memcmp(b, abc, len)) |
2304df62 AD |
5166 | exit(1); |
5167 | } | |
5168 | } | |
5169 | } | |
5170 | exit(0); | |
5171 | } | |
5172 | EOCP | |
a0d0e21e | 5173 | if $cc foo.c -o safemcpy $ccflags $ldflags $libs >/dev/null 2>&1 ; then |
2304df62 AD |
5174 | if ./safemcpy 2>/dev/null; then |
5175 | echo "Yes, it can." | |
5176 | val="$define" | |
5177 | else | |
5178 | echo "It can't, sorry." | |
5179 | fi | |
5180 | else | |
5181 | echo "(I can't compile the test program, so we'll assume not...)" | |
5182 | fi | |
5183 | ;; | |
5184 | esac | |
5185 | $rm -f foo.* safemcpy core | |
5186 | set d_safemcpy | |
5187 | eval $setvar | |
5188 | ||
5189 | : see if select exists | |
5190 | set select d_select | |
5191 | eval $inlibc | |
5192 | ||
5193 | : see if semctl exists | |
5194 | set semctl d_semctl | |
5195 | eval $inlibc | |
5196 | ||
5197 | : see if semget exists | |
5198 | set semget d_semget | |
5199 | eval $inlibc | |
5200 | ||
5201 | : see if semop exists | |
5202 | set semop d_semop | |
5203 | eval $inlibc | |
5204 | ||
5205 | : see how much of the 'sem*(2)' library is present. | |
5206 | h_sem=true | |
5207 | echo " " | |
5208 | case "$d_semctl$d_semget$d_semop" in | |
5209 | *"$undef"*) h_sem=false;; | |
5210 | esac | |
5211 | : we could also check for sys/ipc.h ... | |
5212 | if $h_sem && $test `./findhdr sys/sem.h`; then | |
5213 | echo "You have the full sem*(2) library." >&4 | |
5214 | val="$define" | |
5215 | else | |
5216 | echo "You don't have the full sem*(2) library." >&4 | |
5217 | val="$undef" | |
5218 | fi | |
5219 | set d_sem | |
5220 | eval $setvar | |
5221 | ||
5222 | : see if setegid exists | |
5223 | set setegid d_setegid | |
5224 | eval $inlibc | |
5225 | ||
5226 | : see if seteuid exists | |
5227 | set seteuid d_seteuid | |
5228 | eval $inlibc | |
5229 | ||
a0d0e21e LW |
5230 | : see if setlinebuf exists |
5231 | set setlinebuf d_setlinebuf | |
5232 | eval $inlibc | |
5233 | ||
2304df62 AD |
5234 | : see if setlocale exists |
5235 | set setlocale d_setlocale | |
5236 | eval $inlibc | |
a0d0e21e | 5237 | |
2304df62 AD |
5238 | : see if setpgid exists |
5239 | set setpgid d_setpgid | |
5240 | eval $inlibc | |
5241 | ||
2304df62 AD |
5242 | : see if setpgrp2 exists |
5243 | set setpgrp2 d_setpgrp2 | |
5244 | eval $inlibc | |
5245 | ||
5246 | : see if setpriority exists | |
5247 | set setpriority d_setprior | |
5248 | eval $inlibc | |
5249 | ||
5250 | : see if setregid exists | |
5251 | set setregid d_setregid | |
5252 | eval $inlibc | |
5253 | set setresgid d_setresgid | |
5254 | eval $inlibc | |
5255 | ||
5256 | : see if setreuid exists | |
5257 | set setreuid d_setreuid | |
5258 | eval $inlibc | |
5259 | set setresuid d_setresuid | |
5260 | eval $inlibc | |
5261 | ||
5262 | : see if setrgid exists | |
5263 | set setrgid d_setrgid | |
5264 | eval $inlibc | |
5265 | ||
5266 | : see if setruid exists | |
5267 | set setruid d_setruid | |
5268 | eval $inlibc | |
5269 | ||
5270 | : see if setsid exists | |
5271 | set setsid d_setsid | |
5272 | eval $inlibc | |
5273 | ||
5274 | : see if shmctl exists | |
5275 | set shmctl d_shmctl | |
5276 | eval $inlibc | |
5277 | ||
5278 | : see if shmget exists | |
5279 | set shmget d_shmget | |
5280 | eval $inlibc | |
5281 | ||
a0d0e21e LW |
5282 | : see if shmat exists |
5283 | set shmat d_shmat | |
5284 | eval $inlibc | |
5285 | : see what shmat returns | |
5286 | case "$d_shmat" in | |
5287 | "$define") | |
5288 | $cat >shmat.c <<'END' | |
5289 | #include <sys/shm.h> | |
5290 | void *shmat(); | |
5291 | END | |
5292 | if $cc $ccflags -c shmat.c >/dev/null 2>&1; then | |
5293 | shmattype='void *' | |
5294 | else | |
5295 | shmattype='char *' | |
5296 | fi | |
5297 | echo "and it returns ($shmattype)." >&4 | |
5298 | : see if a prototype for shmat is available | |
5299 | $cppstdin $cppflags $cppminus < $usrinc/sys/shm.h > shmat.c 2>/dev/null | |
5300 | if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then | |
5301 | val="$define" | |
5302 | else | |
5303 | val="$undef" | |
5304 | fi | |
5305 | $rm -f shmat.[co] | |
5306 | ;; | |
5307 | *) | |
5308 | val="$undef" | |
5309 | ;; | |
5310 | esac | |
5311 | set d_shmatprototype | |
5312 | eval $setvar | |
5313 | ||
5314 | : see if shmdt exists | |
5315 | set shmdt d_shmdt | |
5316 | eval $inlibc | |
5317 | ||
5318 | : see how much of the 'shm*(2)' library is present. | |
5319 | h_shm=true | |
5320 | echo " " | |
5321 | case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in | |
5322 | *"$undef"*) h_shm=false;; | |
5323 | esac | |
5324 | : we could also check for sys/ipc.h ... | |
5325 | if $h_shm && $test `./findhdr sys/shm.h`; then | |
5326 | echo "You have the full shm*(2) library." >&4 | |
5327 | val="$define" | |
5328 | else | |
5329 | echo "You don't have the full shm*(2) library." >&4 | |
5330 | val="$undef" | |
5331 | fi | |
5332 | set d_shm | |
5333 | eval $setvar | |
5334 | ||
5335 | socketlib='' | |
5336 | sockethdr='' | |
5337 | : see whether socket exists | |
5338 | echo " " | |
5339 | $echo $n "Hmm... $c" >&4 | |
5340 | if set socket val -f d_socket; eval $csym; $val; then | |
5341 | echo "Looks like you have Berkeley networking support." >&4 | |
5342 | d_socket="$define" | |
5343 | if set setsockopt val -f; eval $csym; $val; then | |
5344 | d_oldsock="$undef" | |
5345 | else | |
5346 | echo "...but it uses the old 4.1c interface, rather than 4.2" >&4 | |
5347 | d_oldsock="$define" | |
5348 | fi | |
5349 | else | |
5350 | if $contains socklib libc.list >/dev/null 2>&1; then | |
5351 | echo "Looks like you have Berkeley networking support." >&4 | |
5352 | d_socket="$define" | |
5353 | : we will have to assume that it supports the 4.2 BSD interface | |
5354 | d_oldsock="$undef" | |
5355 | else | |
5356 | echo "You don't have Berkeley networking in libc.a..." >&4 | |
5357 | if test -f /usr/lib/libnet.a; then | |
5358 | ( (nm $nm_opt /usr/lib/libnet.a | eval $nm_extract) || \ | |
5359 | ar t /usr/lib/libnet.a) 2>/dev/null >> libc.list | |
5360 | if $contains socket libc.list >/dev/null 2>&1; then | |
5361 | echo "...but the Wollongong group seems to have hacked it in." >&4 | |
5362 | socketlib="-lnet" | |
5363 | sockethdr="-I/usr/netinclude" | |
5364 | d_socket="$define" | |
5365 | if $contains setsockopt libc.list >/dev/null 2>&1; then | |
5366 | d_oldsock="$undef" | |
5367 | else | |
5368 | echo "...using the old 4.1c interface, rather than 4.2" >&4 | |
5369 | d_oldsock="$define" | |
5370 | fi | |
5371 | else | |
5372 | echo "or even in libnet.a, which is peculiar." >&4 | |
5373 | d_socket="$undef" | |
5374 | d_oldsock="$undef" | |
5375 | fi | |
5376 | else | |
5377 | echo "or anywhere else I see." >&4 | |
5378 | d_socket="$undef" | |
5379 | d_oldsock="$undef" | |
5380 | fi | |
5381 | fi | |
5382 | fi | |
5383 | ||
5384 | : see if socketpair exists | |
5385 | set socketpair d_sockpair | |
2304df62 AD |
5386 | eval $inlibc |
5387 | ||
2304df62 AD |
5388 | : see if stat knows about block sizes |
5389 | echo " " | |
5390 | xxx=`./findhdr sys/stat.h` | |
5391 | if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then | |
5392 | if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then | |
5393 | echo "Your stat() knows about block sizes." >&4 | |
5394 | val="$define" | |
5395 | else | |
5396 | echo "Your stat() doesn't know about block sizes." >&4 | |
5397 | val="$undef" | |
5398 | fi | |
5399 | else | |
5400 | echo "Your stat() doesn't know about block sizes." >&4 | |
5401 | val="$undef" | |
5402 | fi | |
5403 | set d_statblks | |
5404 | eval $setvar | |
5405 | ||
a0d0e21e LW |
5406 | : see if strcoll exists |
5407 | set strcoll d_strcoll | |
5408 | eval $inlibc | |
2304df62 AD |
5409 | |
5410 | : check for structure copying | |
5411 | echo " " | |
5412 | echo "Checking to see if your C compiler can copy structs..." >&4 | |
5413 | $cat >try.c <<'EOCP' | |
5414 | main() | |
5415 | { | |
5416 | struct blurfl { | |
5417 | int dyick; | |
5418 | } foo, bar; | |
5419 | ||
5420 | foo = bar; | |
5421 | } | |
5422 | EOCP | |
5423 | if $cc -c try.c >/dev/null 2>&1 ; then | |
5424 | val="$define" | |
5425 | echo "Yup, it can." | |
5426 | else | |
5427 | val="$undef" | |
5428 | echo "Nope, it can't." | |
5429 | fi | |
5430 | set d_strctcpy | |
5431 | eval $setvar | |
5432 | $rm -f try.* | |
5433 | ||
5434 | : see if strerror and/or sys_errlist[] exist | |
5435 | echo " " | |
5436 | if set strerror val -f d_strerror; eval $csym; $val; then | |
5437 | echo 'strerror() found.' >&4 | |
5438 | d_strerror="$define" | |
a0d0e21e | 5439 | d_strerrm='strerror(e)' |
2304df62 AD |
5440 | if set sys_errlist val -a d_syserrlst; eval $csym; $val; then |
5441 | echo "(You also have sys_errlist[], so we could roll our own strerror.)" | |
5442 | d_syserrlst="$define" | |
5443 | else | |
5444 | echo "(Since you don't have sys_errlist[], sterror() is welcome.)" | |
5445 | d_syserrlst="$undef" | |
5446 | fi | |
5447 | elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \ | |
5448 | $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then | |
5449 | echo 'strerror() found in string header.' >&4 | |
5450 | d_strerror="$define" | |
a0d0e21e | 5451 | d_strerrm='strerror(e)' |
2304df62 AD |
5452 | if set sys_errlist val -a d_syserrlst; eval $csym; $val; then |
5453 | echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)" | |
5454 | d_syserrlst="$define" | |
5455 | else | |
5456 | echo "(You don't appear to have any sys_errlist[], how can this be?)" | |
5457 | d_syserrlst="$undef" | |
5458 | fi | |
5459 | elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then | |
5460 | echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4 | |
5461 | d_strerror="$undef" | |
5462 | d_syserrlst="$define" | |
a0d0e21e | 5463 | d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])' |
2304df62 AD |
5464 | else |
5465 | echo 'strerror() and sys_errlist[] NOT found.' >&4 | |
5466 | d_strerror="$undef" | |
5467 | d_syserrlst="$undef" | |
a0d0e21e | 5468 | d_strerrm='"unknown"' |
2304df62 AD |
5469 | fi |
5470 | ||
a0d0e21e LW |
5471 | : see if strxfrm exists |
5472 | set strxfrm d_strxfrm | |
5473 | eval $inlibc | |
5474 | ||
2304df62 AD |
5475 | : see if symlink exists |
5476 | set symlink d_symlink | |
5477 | eval $inlibc | |
5478 | ||
5479 | : see if syscall exists | |
5480 | set syscall d_syscall | |
5481 | eval $inlibc | |
5482 | ||
a0d0e21e LW |
5483 | : see if sysconf exists |
5484 | set sysconf d_sysconf | |
5485 | eval $inlibc | |
5486 | ||
2304df62 AD |
5487 | : see if system exists |
5488 | set system d_system | |
5489 | eval $inlibc | |
5490 | ||
a0d0e21e LW |
5491 | : see if tcgetpgrp exists |
5492 | set tcgetpgrp d_tcgetpgrp | |
5493 | eval $inlibc | |
5494 | ||
5495 | : see if tcsetpgrp exists | |
5496 | set tcsetpgrp d_tcsetpgrp | |
5497 | eval $inlibc | |
5498 | ||
5499 | : define an is-a-typedef? function | |
5500 | typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@; | |
5501 | case "$inclist" in | |
5502 | "") inclist="sys/types.h";; | |
5503 | esac; | |
ecfc5424 AD |
5504 | eval "varval=\$$var"; |
5505 | case "$varval" in | |
a0d0e21e LW |
5506 | "") |
5507 | $rm -f temp.c; | |
5508 | for inc in $inclist; do | |
5509 | echo "#include <$inc>" >>temp.c; | |
5510 | done; | |
5511 | $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null; | |
5512 | if $contains $type temp.E >/dev/null 2>&1; then | |
5513 | eval "$var=$type"; | |
5514 | else | |
5515 | eval "$var=$def"; | |
5516 | fi; | |
5517 | $rm -f temp.?;; | |
ecfc5424 | 5518 | *) eval "$var=$varval";; |
a0d0e21e LW |
5519 | esac' |
5520 | ||
5521 | : see if this is a sys/times.h system | |
5522 | set sys/times.h i_systimes | |
5523 | eval $inhdr | |
5524 | ||
2304df62 AD |
5525 | : see if times exists |
5526 | echo " " | |
5527 | if set times val -f d_times; eval $csym; $val; then | |
5528 | echo 'times() found.' >&4 | |
5529 | d_times="$define" | |
a0d0e21e LW |
5530 | inc='' |
5531 | case "$i_systimes" in | |
5532 | "$define") inc='sys/times.h';; | |
2304df62 | 5533 | esac |
a0d0e21e LW |
5534 | set clock_t clocktype long stdio.h sys/types.h $inc |
5535 | eval $typedef | |
5536 | dflt="$clocktype" | |
2304df62 AD |
5537 | echo " " |
5538 | rp="What type is returned by times() on this sytem?" | |
5539 | . ./myread | |
5540 | clocktype="$ans" | |
5541 | else | |
a0d0e21e | 5542 | echo 'times() NOT found, hope that will do.' >&4 |
2304df62 AD |
5543 | d_times="$undef" |
5544 | clocktype='int' | |
5545 | fi | |
5546 | ||
5547 | : see if truncate exists | |
5548 | set truncate d_truncate | |
5549 | eval $inlibc | |
5550 | ||
a0d0e21e LW |
5551 | : see if tzname[] exists |
5552 | echo " " | |
5553 | if set tzname val -a d_tzname; eval $csym; $val; then | |
5554 | val="$define" | |
5555 | echo 'tzname[] found.' >&4 | |
5556 | else | |
5557 | val="$undef" | |
5558 | echo 'tzname[] NOT found.' >&4 | |
5559 | fi | |
5560 | set d_tzname | |
5561 | eval $setvar | |
5562 | ||
5563 | : see if umask exists | |
5564 | set umask d_umask | |
5565 | eval $inlibc | |
5566 | ||
2304df62 AD |
5567 | : see if we have to deal with yellow pages, now NIS. |
5568 | if $test -d /usr/etc/yp || $test -d /etc/yp; then | |
5569 | if $test -f /usr/etc/nibindd; then | |
5570 | echo " " | |
5571 | echo "I'm fairly confident you're on a NeXT." | |
5572 | echo " " | |
5573 | rp='Do you get the hosts file via NetInfo?' | |
5574 | dflt=y | |
5575 | case "$hostcat" in | |
5576 | nidump*) ;; | |
5577 | '') ;; | |
5578 | *) dflt=n;; | |
5579 | esac | |
5580 | . ./myread | |
5581 | case "$ans" in | |
5582 | y*) hostcat='nidump hosts .';; | |
5583 | *) hostcat='cat /etc/hosts';; | |
5584 | esac | |
5585 | fi | |
5586 | case "$hostcat" in | |
5587 | nidump*) ;; | |
5588 | *) | |
5589 | case "$hostcat" in | |
5590 | *ypcat*) dflt=y;; | |
5591 | '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then | |
5592 | dflt=y | |
5593 | else | |
5594 | dflt=n | |
5595 | fi;; | |
5596 | *) dflt=n;; | |
5597 | esac | |
5598 | echo " " | |
5599 | rp='Are you getting the hosts file via yellow pages?' | |
5600 | . ./myread | |
5601 | case "$ans" in | |
5602 | y*) hostcat='ypcat hosts';; | |
5603 | *) hostcat='cat /etc/hosts';; | |
5604 | esac | |
5605 | ;; | |
5606 | esac | |
5607 | fi | |
5608 | ||
5609 | : now get the host name | |
5610 | echo " " | |
5611 | echo "Figuring out host name..." >&4 | |
5612 | case "$myhostname" in | |
5613 | '') cont=true | |
5614 | echo 'Maybe "hostname" will work...' | |
5615 | if tans=`sh -c hostname 2>&1` ; then | |
5616 | myhostname=$tans | |
5617 | phostname=hostname | |
5618 | cont='' | |
5619 | fi | |
5620 | ;; | |
5621 | *) cont='';; | |
5622 | esac | |
5623 | if $test "$cont"; then | |
ecfc5424 | 5624 | if ./xenix; then |
2304df62 AD |
5625 | echo 'Oh, dear. Maybe "/etc/systemid" is the key...' |
5626 | if tans=`cat /etc/systemid 2>&1` ; then | |
5627 | myhostname=$tans | |
5628 | phostname='cat /etc/systemid' | |
5629 | echo "Whadyaknow. Xenix always was a bit strange..." | |
5630 | cont='' | |
5631 | fi | |
5632 | elif $test -r /etc/systemid; then | |
5633 | echo "(What is a non-Xenix system doing with /etc/systemid?)" | |
5634 | fi | |
5635 | fi | |
5636 | if $test "$cont"; then | |
5637 | echo 'No, maybe "uuname -l" will work...' | |
5638 | if tans=`sh -c 'uuname -l' 2>&1` ; then | |
5639 | myhostname=$tans | |
5640 | phostname='uuname -l' | |
5641 | else | |
5642 | echo 'Strange. Maybe "uname -n" will work...' | |
5643 | if tans=`sh -c 'uname -n' 2>&1` ; then | |
5644 | myhostname=$tans | |
5645 | phostname='uname -n' | |
5646 | else | |
5647 | echo 'Oh well, maybe I can mine it out of whoami.h...' | |
5648 | if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then | |
5649 | myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'` | |
5650 | phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h" | |
5651 | else | |
5652 | case "$myhostname" in | |
5653 | '') echo "Does this machine have an identity crisis or something?" | |
5654 | phostname='';; | |
5655 | *) | |
5656 | echo "Well, you said $myhostname before..." | |
5657 | phostname='echo $myhostname';; | |
5658 | esac | |
5659 | fi | |
5660 | fi | |
5661 | fi | |
5662 | fi | |
5663 | : you do not want to know about this | |
5664 | set $myhostname | |
5665 | myhostname=$1 | |
5666 | ||
2304df62 AD |
5667 | : verify guess |
5668 | if $test "$myhostname" ; then | |
5669 | dflt=y | |
5670 | rp='Your host name appears to be "'$myhostname'".'" Right?" | |
5671 | . ./myread | |
5672 | case "$ans" in | |
5673 | y*) ;; | |
5674 | *) myhostname='';; | |
5675 | esac | |
5676 | fi | |
5677 | ||
5678 | : bad guess or no guess | |
5679 | while $test "X$myhostname" = X ; do | |
5680 | dflt='' | |
5681 | rp="Please type the (one word) name of your host:" | |
5682 | . ./myread | |
5683 | myhostname="$ans" | |
5684 | done | |
5685 | ||
ecfc5424 AD |
5686 | : translate upper to lower if necessary |
5687 | case "$myhostname" in | |
5688 | *[A-Z]*) | |
5689 | echo "(Normalizing case in your host name)" | |
5690 | myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'` | |
5691 | ;; | |
5692 | esac | |
5693 | ||
2304df62 AD |
5694 | : a little sanity check here |
5695 | case "$phostname" in | |
5696 | '') ;; | |
5697 | *) | |
ecfc5424 | 5698 | case `$phostname | ./tr '[A-Z]' '[a-z]'` in |
2304df62 AD |
5699 | $myhostname$mydomain|$myhostname) ;; |
5700 | *) | |
5701 | case "$phostname" in | |
5702 | sed*) | |
5703 | echo "(That doesn't agree with your whoami.h file, by the way.)" | |
5704 | ;; | |
5705 | *) | |
5706 | echo "(That doesn't agree with your $phostname command, by the way.)" | |
5707 | ;; | |
5708 | esac | |
5709 | ;; | |
5710 | esac | |
5711 | ;; | |
5712 | esac | |
5713 | ||
5714 | : see how we will look up host name | |
5715 | echo " " | |
5716 | if false; then | |
5717 | : dummy stub to allow use of elif | |
5718 | elif set uname val -f d_uname; eval $csym; $val; then | |
ecfc5424 | 5719 | if ./xenix; then |
2304df62 AD |
5720 | $cat <<'EOM' |
5721 | uname() was found, but you're running xenix, and older versions of xenix | |
5722 | have a broken uname(). If you don't really know whether your xenix is old | |
5723 | enough to have a broken system call, use the default answer. | |
5724 | ||
5725 | EOM | |
5726 | dflt=y | |
5727 | case "$d_uname" in | |
5728 | "$define") dflt=n;; | |
5729 | esac | |
5730 | rp='Is your uname() broken?' | |
5731 | . ./myread | |
5732 | case "$ans" in | |
5733 | n*) d_uname="$define"; call=uname;; | |
5734 | esac | |
5735 | else | |
5736 | echo 'uname() found.' >&4 | |
5737 | d_uname="$define" | |
5738 | call=uname | |
5739 | fi | |
5740 | fi | |
5741 | case "$d_gethname" in | |
5742 | '') d_gethname="$undef";; | |
5743 | esac | |
5744 | case "$d_uname" in | |
5745 | '') d_uname="$undef";; | |
5746 | esac | |
5747 | case "$d_phostname" in | |
5748 | '') d_phostname="$undef";; | |
5749 | esac | |
5750 | ||
a0d0e21e LW |
5751 | : backward compatibility for d_hvfork |
5752 | if test X$d_hvfork != X; then | |
5753 | d_vfork="$d_hvfork" | |
5754 | d_hvfork='' | |
5755 | fi | |
2304df62 | 5756 | : see if there is a vfork |
a0d0e21e LW |
5757 | val='' |
5758 | set vfork val | |
2304df62 | 5759 | eval $inlibc |
a0d0e21e LW |
5760 | |
5761 | : Ok, but do we want to use it. vfork is reportedly unreliable in | |
5762 | : perl on Solaris 2.x, and probably elsewhere. | |
5763 | case "$val" in | |
5764 | $define) | |
5765 | echo " " | |
5766 | case "$usevfork" in | |
5767 | false) dflt='n';; | |
5768 | *) dflt='y';; | |
5769 | esac | |
5770 | rp="Some systems have problems with vfork(). Do you want to use it?" | |
5771 | . ./myread | |
5772 | case "$ans" in | |
5773 | y|Y) ;; | |
5774 | *) | |
5775 | echo "Ok, we won't use vfork()." | |
5776 | val="$undef" | |
5777 | ;; | |
5778 | esac | |
5779 | ;; | |
5780 | esac | |
5781 | set d_vfork | |
5782 | eval $setvar | |
85e6fe83 | 5783 | case "$d_vfork" in |
a0d0e21e LW |
5784 | $define) usevfork='true';; |
5785 | *) usevfork='false';; | |
5786 | esac | |
5787 | ||
5788 | : see if this is an sysdir system | |
5789 | set sys/dir.h i_sysdir | |
5790 | eval $inhdr | |
5791 | ||
5792 | : see if this is an sysndir system | |
5793 | set sys/ndir.h i_sysndir | |
5794 | eval $inhdr | |
5795 | ||
5796 | : see if closedir exists | |
5797 | set closedir d_closedir | |
5798 | eval $inlibc | |
5799 | ||
5800 | case "$d_closedir" in | |
5801 | "$define") | |
5802 | echo " " | |
5803 | echo "Checking whether closedir() returns a status..." >&4 | |
5804 | cat > closedir.c <<EOM | |
5805 | #$i_dirent I_DIRENT /**/ | |
5806 | #$i_sysdir I_SYS_DIR /**/ | |
5807 | #$i_sysndir I_SYS_NDIR /**/ | |
5808 | ||
5809 | #if defined(I_DIRENT) | |
5810 | #include <dirent.h> | |
5811 | #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */ | |
5812 | #include <sys/dir.h> | |
5813 | #endif | |
5814 | #else | |
5815 | #ifdef I_SYS_NDIR | |
5816 | #include <sys/ndir.h> | |
5817 | #else | |
5818 | #ifdef I_SYS_DIR | |
5819 | #ifdef hp9000s500 | |
5820 | #include <ndir.h> /* may be wrong in the future */ | |
5821 | #else | |
5822 | #include <sys/dir.h> | |
5823 | #endif | |
5824 | #endif | |
5825 | #endif | |
5826 | #endif | |
5827 | int main() { return closedir(opendir(".")); } | |
5828 | EOM | |
5829 | if $cc $ccflags $ldflags -o closedir closedir.c $libs > /dev/null 2>&1; then | |
5830 | if ./closedir > /dev/null 2>&1 ; then | |
5831 | echo "Yes, it does." | |
5832 | val="$undef" | |
5833 | else | |
5834 | echo "No, it doesn't." | |
5835 | val="$define" | |
5836 | fi | |
5837 | else | |
5838 | echo "(I can't seem to compile the test program--assuming it doesn't)" | |
5839 | val="$define" | |
5840 | fi | |
5841 | ;; | |
5842 | *) | |
5843 | val="$undef"; | |
5844 | ;; | |
85e6fe83 | 5845 | esac |
a0d0e21e LW |
5846 | set d_void_closedir |
5847 | eval $setvar | |
5848 | $rm -f closedir* | |
2304df62 AD |
5849 | : check for volatile keyword |
5850 | echo " " | |
5851 | echo 'Checking to see if your C compiler knows about "volatile"...' >&4 | |
5852 | $cat >try.c <<'EOCP' | |
5853 | main() | |
5854 | { | |
5855 | typedef struct _goo_struct goo_struct; | |
5856 | goo_struct * volatile goo = ((goo_struct *)0); | |
5857 | struct _goo_struct { | |
5858 | long long_int; | |
5859 | int reg_int; | |
5860 | char char_var; | |
5861 | }; | |
5862 | typedef unsigned short foo_t; | |
5863 | char *volatile foo; | |
5864 | volatile int bar; | |
5865 | volatile foo_t blech; | |
5866 | foo = foo; | |
5867 | } | |
5868 | EOCP | |
5869 | if $cc -c $ccflags try.c >/dev/null 2>&1 ; then | |
5870 | val="$define" | |
5871 | echo "Yup, it does." | |
5872 | else | |
5873 | val="$undef" | |
5874 | echo "Nope, it doesn't." | |
5875 | fi | |
5876 | set d_volatile | |
5877 | eval $setvar | |
5878 | $rm -f try.* | |
5879 | ||
5880 | : see if there is a wait4 | |
5881 | set wait4 d_wait4 | |
5882 | eval $inlibc | |
5883 | ||
5884 | : see if waitpid exists | |
5885 | set waitpid d_waitpid | |
5886 | eval $inlibc | |
5887 | ||
a0d0e21e LW |
5888 | : see if wcstombs exists |
5889 | set wcstombs d_wcstombs | |
5890 | eval $inlibc | |
5891 | ||
5892 | : see if wctomb exists | |
5893 | set wctomb d_wctomb | |
5894 | eval $inlibc | |
5895 | ||
2304df62 AD |
5896 | : preserve RCS keywords in files with variable substitution, grrr |
5897 | Date='$Date' | |
5898 | Id='$Id' | |
5899 | Log='$Log' | |
5900 | RCSfile='$RCSfile' | |
5901 | Revision='$Revision' | |
5902 | ||
a0d0e21e | 5903 | : check for alignment requirements |
2304df62 | 5904 | echo " " |
a0d0e21e LW |
5905 | case "$alignbytes" in |
5906 | '') echo "Checking alignment constraints..." >&4 | |
5907 | $cat >try.c <<'EOCP' | |
5908 | struct foobar { | |
5909 | char foo; | |
5910 | double bar; | |
5911 | } try; | |
5912 | main() | |
5913 | { | |
5914 | printf("%d\n", (char *)&try.bar - (char *)&try.foo); | |
5915 | } | |
5916 | EOCP | |
5917 | if $cc $ccflags try.c -o try >/dev/null 2>&1; then | |
5918 | dflt=`./try` | |
5919 | else | |
5920 | dflt='8' | |
5921 | echo"(I can't seem to compile the test program...)" | |
5922 | fi | |
5923 | ;; | |
5924 | *) dflt="$alignbytes" | |
5925 | ;; | |
5926 | esac | |
5927 | rp="Doubles must be aligned on a how-many-byte boundary?" | |
5928 | . ./myread | |
5929 | alignbytes="$ans" | |
5930 | $rm -f try.c try | |
2304df62 AD |
5931 | |
5932 | : determine where public executables go | |
5933 | echo " " | |
1aef975c AD |
5934 | set dflt bin bin |
5935 | eval $prefixit | |
2304df62 AD |
5936 | fn=d~ |
5937 | rp='Pathname where the public executables will reside?' | |
5938 | . ./getfile | |
1aef975c AD |
5939 | if $test "X$ansexp" != "X$binexp"; then |
5940 | installbin='' | |
5941 | fi | |
2304df62 AD |
5942 | bin="$ans" |
5943 | binexp="$ansexp" | |
5944 | if $afs; then | |
5945 | $cat <<EOM | |
5946 | ||
5947 | Since you are running AFS, I need to distinguish the directory in which | |
5948 | executables reside from the directory in which they are installed (and from | |
5949 | which they are presumably copied to the former directory by occult means). | |
5950 | ||
5951 | EOM | |
5952 | case "$installbin" in | |
5953 | '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;; | |
5954 | *) dflt="$installbin";; | |
5955 | esac | |
5956 | fn=de~ | |
5957 | rp='Where will public executables be installed?' | |
5958 | . ./getfile | |
5959 | installbin="$ans" | |
5960 | else | |
5961 | installbin="$binexp" | |
5962 | fi | |
5963 | ||
5964 | : check for ordering of bytes in a long | |
5965 | case "$byteorder" in | |
5966 | '') | |
5967 | $cat <<'EOM' | |
5968 | ||
5969 | In the following, larger digits indicate more significance. A big-endian | |
5970 | machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A | |
5971 | little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other | |
5972 | machines may have weird orders like 3412. A Cray will report 87654321. If | |
5973 | the test program works the default is probably right. | |
5974 | I'm now running the test program... | |
5975 | EOM | |
5976 | $cat >try.c <<'EOCP' | |
5977 | #include <stdio.h> | |
5978 | main() | |
5979 | { | |
5980 | int i; | |
5981 | union { | |
5982 | unsigned long l; | |
5983 | char c[sizeof(long)]; | |
5984 | } u; | |
5985 | ||
5986 | if (sizeof(long) > 4) | |
5987 | u.l = (0x08070605L << 32) | 0x04030201L; | |
5988 | else | |
5989 | u.l = 0x04030201L; | |
5990 | for (i = 0; i < sizeof(long); i++) | |
5991 | printf("%c", u.c[i]+'0'); | |
5992 | printf("\n"); | |
5993 | } | |
5994 | EOCP | |
5995 | if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then | |
5996 | dflt=`./try` | |
5997 | case "$dflt" in | |
5998 | ????|????????) echo "(The test program ran ok.)";; | |
5999 | *) echo "(The test program didn't run right for some reason.)";; | |
6000 | esac | |
6001 | else | |
6002 | dflt='4321' | |
6003 | cat <<'EOM' | |
a0d0e21e LW |
6004 | (I can't seem to compile the test program. Guessing big-endian...) |
6005 | EOM | |
6006 | fi | |
6007 | ;; | |
6008 | *) | |
6009 | echo " " | |
6010 | dflt="$byteorder" | |
6011 | ;; | |
2304df62 | 6012 | esac |
a0d0e21e | 6013 | rp="What is the order of bytes in a long?" |
2304df62 | 6014 | . ./myread |
a0d0e21e LW |
6015 | byteorder="$ans" |
6016 | $rm -f try.c try | |
85e6fe83 | 6017 | |
a0d0e21e LW |
6018 | : how do we catenate cpp tokens here? |
6019 | echo " " | |
6020 | echo "Checking to see how your cpp does stuff like catenate tokens..." >&4 | |
6021 | $cat >cpp_stuff.c <<'EOCP' | |
6022 | #define RCAT(a,b)a/**/b | |
6023 | #define ACAT(a,b)a ## b | |
6024 | RCAT(Rei,ser) | |
6025 | ACAT(Cir,cus) | |
6026 | EOCP | |
ecfc5424 | 6027 | $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1 |
a0d0e21e LW |
6028 | if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then |
6029 | echo "Oh! Smells like ANSI's been here." | |
6030 | echo "We can catify or stringify, separately or together!" | |
6031 | cpp_stuff=42 | |
6032 | elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then | |
6033 | echo "Ah, yes! The good old days!" | |
6034 | echo "However, in the good old days we don't know how to stringify and" | |
6035 | echo "catify at the same time." | |
6036 | cpp_stuff=1 | |
6037 | else | |
6038 | $cat >&4 <<EOM | |
6039 | Hmm, I don't seem to be able to catenate tokens with your cpp. You're going | |
6040 | to have to edit the values of CAT[2-5] in config.h... | |
85e6fe83 | 6041 | EOM |
a0d0e21e LW |
6042 | cpp_stuff="/* Help! How do we handle cpp_stuff? */*/" |
6043 | fi | |
ecfc5424 AD |
6044 | $rm -f cpp_stuff.* |
6045 | ||
6046 | : see if this is a db.h system | |
6047 | set db.h i_db | |
6048 | eval $inhdr | |
6049 | ||
6050 | case "$i_db" in | |
6051 | define) | |
6052 | : Check the return type needed for hash | |
6053 | echo "Checking return type needed for hash for Berkeley DB ..." >&4 | |
6054 | cat >try.c <<'EOCP' | |
6055 | #include <sys/types.h> | |
6056 | #include <db.h> | |
6057 | u_int32_t | |
6058 | hash_cb (ptr, size) | |
6059 | const void * ptr ; | |
6060 | size_t size ; | |
6061 | { | |
6062 | } | |
6063 | HASHINFO info ; | |
6064 | main() | |
6065 | { | |
6066 | info.hash = hash_cb ; | |
6067 | } | |
6068 | EOCP | |
6069 | if $cc $ccflags -c try.c >try.out 2>&1 ; then | |
6070 | if $contains warning try.out >>/dev/null 2>&1 ; then | |
6071 | db_hashtype='int' | |
6072 | else | |
6073 | db_hashtype='u_int32_t' | |
6074 | fi | |
6075 | else | |
6076 | echo "I can't seem to compile the test program." >&4 | |
6077 | db_hashtype=int | |
6078 | fi | |
6079 | $rm -f try.[co] | |
6080 | echo "Your version of Berkeley DB uses $db_hashtype for hash." | |
6081 | ;; | |
6082 | *) db_hashtype=int | |
6083 | ;; | |
6084 | esac | |
6085 | ||
6086 | case "$i_db" in | |
6087 | define) | |
6088 | : Check the return type needed for prefix | |
6089 | echo "Checking return type needed for prefix for Berkeley DB ..." >&4 | |
6090 | cat >try.c <<'EOCP' | |
6091 | #include <sys/types.h> | |
6092 | #include <db.h> | |
6093 | size_t | |
6094 | prefix_cb (key1, key2) | |
6095 | const DBT * key1 ; | |
6096 | const DBT * key2 ; | |
6097 | { | |
6098 | } | |
6099 | BTREEINFO info ; | |
6100 | main() | |
6101 | { | |
6102 | info.prefix = prefix_cb ; | |
6103 | } | |
6104 | EOCP | |
6105 | if $cc $ccflags -c try.c >try.out 2>&1 ; then | |
6106 | if $contains warning try.out >>/dev/null 2>&1 ; then | |
6107 | db_prefixtype='int' | |
6108 | else | |
6109 | db_prefixtype='size_t' | |
6110 | fi | |
6111 | else | |
6112 | echo "I can't seem to compile the test program." >&4 | |
6113 | db_prefixtype='int' | |
6114 | fi | |
6115 | $rm -f try.[co] | |
6116 | echo "Your version of Berkeley DB uses $db_prefixtype for prefix." | |
6117 | ;; | |
6118 | *) db_prefixtype='int' | |
6119 | ;; | |
6120 | esac | |
85e6fe83 | 6121 | |
a0d0e21e LW |
6122 | : check for void type |
6123 | echo " " | |
ecfc5424 AD |
6124 | echo "Checking to see how well your C compiler groks the void type..." >&4 |
6125 | echo " " | |
a0d0e21e | 6126 | $cat >&4 <<EOM |
a0d0e21e LW |
6127 | Support flag bits are: |
6128 | 1: basic void declarations. | |
6129 | 2: arrays of pointers to functions returning void. | |
6130 | 4: operations between pointers to and addresses of void functions. | |
6131 | 8: generic void pointers. | |
85e6fe83 | 6132 | EOM |
ecfc5424 | 6133 | echo " " |
a0d0e21e LW |
6134 | case "$voidflags" in |
6135 | '') | |
6136 | $cat >try.c <<'EOCP' | |
6137 | #if TRY & 1 | |
6138 | void main() { | |
6139 | #else | |
6140 | main() { | |
6141 | #endif | |
6142 | extern void moo(); /* function returning void */ | |
6143 | void (*goo)(); /* ptr to func returning void */ | |
6144 | #if TRY & 8 | |
6145 | void *hue; /* generic ptr */ | |
6146 | #endif | |
6147 | #if TRY & 2 | |
6148 | void (*foo[10])(); | |
6149 | #endif | |
85e6fe83 | 6150 | |
a0d0e21e LW |
6151 | #if TRY & 4 |
6152 | if(goo == moo) { | |
6153 | exit(0); | |
6154 | } | |
6155 | #endif | |
6156 | exit(0); | |
6157 | } | |
6158 | EOCP | |
6159 | if $cc -c -DTRY=$defvoidused try.c >.out 2>&1 ; then | |
6160 | voidflags=$defvoidused | |
6161 | echo "It appears to support void to the level $package wants ($defvoidused)." | |
6162 | if $contains warning .out >/dev/null 2>&1; then | |
6163 | echo "However, you might get some warnings that look like this:" | |
6164 | $cat .out | |
6165 | fi | |
6166 | else | |
6167 | echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4 | |
6168 | if $cc -c -DTRY=1 try.c >/dev/null 2>&1 ; then | |
6169 | echo "It supports 1..." | |
6170 | if $cc -c -DTRY=3 try.c >/dev/null 2>&1 ; then | |
6171 | echo "It also supports 2..." | |
6172 | if $cc -c -DTRY=7 try.c >/dev/null 2>&1 ; then | |
6173 | voidflags=7 | |
6174 | echo "And it supports 4 but not 8 definitely." | |
6175 | else | |
6176 | echo "It doesn't support 4..." | |
6177 | if $cc -c -DTRY=11 try.c >/dev/null 2>&1 ; then | |
6178 | voidflags=11 | |
6179 | echo "But it supports 8." | |
6180 | else | |
6181 | voidflags=3 | |
6182 | echo "Neither does it support 8." | |
6183 | fi | |
6184 | fi | |
6185 | else | |
6186 | echo "It does not support 2..." | |
6187 | if $cc -c -DTRY=13 try.c >/dev/null 2>&1 ; then | |
6188 | voidflags=13 | |
6189 | echo "But it supports 4 and 8." | |
6190 | else | |
6191 | if $cc -c -DTRY=5 try.c >/dev/null 2>&1 ; then | |
6192 | voidflags=5 | |
6193 | echo "And it supports 4 but has not heard about 8." | |
6194 | else | |
6195 | echo "However it supports 8 but not 4." | |
6196 | fi | |
6197 | fi | |
6198 | fi | |
6199 | else | |
6200 | echo "There is no support at all for void." | |
6201 | voidflags=0 | |
6202 | fi | |
6203 | fi | |
2304df62 | 6204 | esac |
a0d0e21e LW |
6205 | dflt="$voidflags"; |
6206 | rp="Your void support flags add up to what?" | |
6207 | . ./myread | |
6208 | voidflags="$ans" | |
6209 | $rm -f try.* .out | |
6210 | ||
ecfc5424 AD |
6211 | : see if dbm.h is available |
6212 | set dbm.h t_dbm | |
85e6fe83 | 6213 | eval $inhdr |
ecfc5424 AD |
6214 | case "$t_dbm" in |
6215 | $define) | |
6216 | : see if dbmclose exists | |
6217 | set dbmclose d_dbmclose | |
6218 | eval $inlibc | |
6219 | case "$d_dbmclose" in | |
6220 | $undef) | |
6221 | t_dbm="$undef" | |
6222 | echo "We won't be including <dbm.h>" | |
6223 | ;; | |
6224 | esac | |
6225 | ;; | |
6226 | esac | |
6227 | val="$t_dbm" | |
6228 | set i_dbm | |
6229 | eval $setvar | |
85e6fe83 LW |
6230 | |
6231 | : see if ndbm.h is available | |
ecfc5424 | 6232 | set ndbm.h t_ndbm |
85e6fe83 | 6233 | eval $inhdr |
ecfc5424 AD |
6234 | case "$t_ndbm" in |
6235 | $define) | |
6236 | : see if dbm_open exists | |
6237 | set dbm_open d_dbm_open | |
6238 | eval $inlibc | |
6239 | case "$d_dbm_open" in | |
6240 | $undef) | |
6241 | t_ndbm="$undef" | |
6242 | echo "We won't be including <ndbm.h>" | |
6243 | ;; | |
6244 | esac | |
6245 | ;; | |
6246 | esac | |
6247 | val="$t_ndbm" | |
6248 | set i_ndbm | |
6249 | eval $setvar | |
85e6fe83 LW |
6250 | |
6251 | : see if gdbm.h is available | |
ecfc5424 | 6252 | set gdbm.h t_gdbm |
85e6fe83 | 6253 | eval $inhdr |
ecfc5424 AD |
6254 | case "$t_gdbm" in |
6255 | $define) | |
6256 | : see if gdbm_open exists | |
6257 | set gdbm_open d_gdbm_open | |
6258 | eval $inlibc | |
6259 | case "$d_gdbm_open" in | |
6260 | $undef) | |
6261 | t_gdbm="$undef" | |
6262 | echo "We won't be including <gdbm.h>" | |
6263 | ;; | |
6264 | esac | |
6265 | ;; | |
6266 | esac | |
6267 | val="$t_gdbm" | |
6268 | set i_gdbm | |
6269 | eval $setvar | |
85e6fe83 | 6270 | |
2304df62 | 6271 | echo " " |
a0d0e21e LW |
6272 | echo "Looking for extensions..." >&4 |
6273 | cd ../ext | |
6274 | known_extensions='' | |
6275 | for xxx in * ; do | |
6276 | if $test -f $xxx/$xxx.xs; then | |
6277 | known_extensions="$known_extensions $xxx" | |
6278 | fi | |
6279 | done | |
6280 | set X $known_extensions | |
6281 | shift | |
6282 | known_extensions="$*" | |
6283 | cd ../UU | |
6284 | ||
85e6fe83 | 6285 | : Now see which are supported on this system. |
a0d0e21e LW |
6286 | avail_ext='' |
6287 | for xxx in $known_extensions ; do | |
85e6fe83 | 6288 | case "$xxx" in |
a0d0e21e LW |
6289 | DB_File) case "$i_db" in |
6290 | $define) avail_ext="$avail_ext $xxx" ;; | |
6291 | esac | |
6292 | ;; | |
6293 | GDBM_File) case "$i_gdbm" in | |
6294 | $define) avail_ext="$avail_ext $xxx" ;; | |
6295 | esac | |
6296 | ;; | |
6297 | NDBM_File) case "$i_ndbm" in | |
6298 | $define) avail_ext="$avail_ext $xxx" ;; | |
85e6fe83 LW |
6299 | esac |
6300 | ;; | |
a0d0e21e LW |
6301 | ODBM_File) case "$i_dbm" in |
6302 | $define) avail_ext="$avail_ext $xxx" ;; | |
85e6fe83 LW |
6303 | esac |
6304 | ;; | |
a0d0e21e LW |
6305 | POSIX) case "$useposix" in |
6306 | true|define|y) avail_ext="$avail_ext $xxx" ;; | |
85e6fe83 LW |
6307 | esac |
6308 | ;; | |
a0d0e21e LW |
6309 | Socket) case "$d_socket" in |
6310 | $define) avail_ext="$avail_ext $xxx" ;; | |
85e6fe83 LW |
6311 | esac |
6312 | ;; | |
a0d0e21e | 6313 | *) avail_ext="$avail_ext $xxx" |
85e6fe83 LW |
6314 | ;; |
6315 | esac | |
6316 | done | |
6317 | ||
a0d0e21e LW |
6318 | set X $avail_ext |
6319 | shift | |
6320 | avail_ext="$*" | |
6321 | ||
6322 | case $usedl in | |
6323 | $define) | |
6324 | $cat <<EOM | |
6325 | A number of extensions are supplied with $package. You may choose to | |
6326 | compile these extensions for dynamic loading (the default), compile | |
6327 | them into the $package executable (static loading), or not include | |
6328 | them at all. Answer "none" to include no extensions. | |
6329 | ||
6330 | EOM | |
6331 | case "$dynamic_ext" in | |
6332 | ''|' ') dflt="$avail_ext" ;; | |
6333 | *) dflt="$dynamic_ext" ;; | |
6334 | esac | |
6335 | case "$dflt" in | |
6336 | '') dflt=none;; | |
6337 | esac | |
6338 | rp="What extensions do you wish to load dynamically?" | |
6339 | . ./myread | |
6340 | case "$ans" in | |
6341 | none) dynamic_ext='' ;; | |
6342 | *) dynamic_ext="$ans" ;; | |
6343 | esac | |
6344 | ||
6345 | case "$static_ext" in | |
6346 | ''|' ') | |
6347 | : Exclude those already listed in dynamic linking | |
6348 | dflt='' | |
6349 | for xxx in $avail_ext; do | |
6350 | case " $dynamic_ext " in | |
6351 | *" $xxx "*) ;; | |
6352 | *) dflt="$dflt $xxx" ;; | |
6353 | esac | |
6354 | done | |
6355 | set X $dflt | |
6356 | shift | |
6357 | dflt="$*" | |
6358 | ;; | |
6359 | *) dflt="$static_ext" | |
6360 | ;; | |
6361 | esac | |
6362 | ||
6363 | case "$dflt" in | |
6364 | '') dflt=none;; | |
6365 | esac | |
6366 | rp="What extensions do you wish to load statically?" | |
6367 | . ./myread | |
6368 | case "$ans" in | |
6369 | none) static_ext='' ;; | |
6370 | *) static_ext="$ans" ;; | |
6371 | esac | |
6372 | ;; | |
6373 | *) | |
6374 | $cat <<EOM | |
6375 | A number of extensions are supplied with $package. Answer "none" | |
6376 | to include no extensions. | |
6377 | ||
6378 | EOM | |
6379 | case "$static_ext" in | |
6380 | ''|' ') dflt="$avail_ext" ;; | |
6381 | *) dflt="$static_ext" ;; | |
6382 | esac | |
6383 | ||
6384 | case "$dflt" in | |
6385 | '') dflt=none;; | |
6386 | esac | |
6387 | rp="What extensions do you wish to include?" | |
6388 | . ./myread | |
6389 | case "$ans" in | |
6390 | none) static_ext='' ;; | |
6391 | *) static_ext="$ans" ;; | |
6392 | esac | |
6393 | ;; | |
6394 | esac | |
6395 | ||
6396 | set X $dynamic_ext $static_ext | |
6397 | shift | |
6398 | extensions="$*" | |
6399 | ||
6400 | : see what type file positions are declared as in the library | |
6401 | set fpos_t fpostype long stdio.h sys/types.h | |
6402 | eval $typedef | |
6403 | echo " " | |
6404 | dflt="$fpostype" | |
6405 | rp="What is the type for file position used by fsetpos()?" | |
2304df62 | 6406 | . ./myread |
a0d0e21e | 6407 | fpostype="$ans" |
2304df62 | 6408 | |
1aef975c AD |
6409 | : Store the full pathname to the sed program for use in the C program |
6410 | full_sed=$sed | |
6411 | ||
2304df62 | 6412 | : see what type gids are declared as in the kernel |
a0d0e21e LW |
6413 | set gid_t gidtype xxx stdio.h sys/types.h |
6414 | eval $typedef | |
2304df62 | 6415 | case "$gidtype" in |
a0d0e21e LW |
6416 | xxx) |
6417 | xxx=`./findhdr sys/user.h` | |
6418 | set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short | |
6419 | case $1 in | |
6420 | unsigned) dflt="$1 $2" ;; | |
6421 | *) dflt="$1" ;; | |
6422 | esac | |
2304df62 | 6423 | ;; |
a0d0e21e | 6424 | *) dflt="$gidtype";; |
2304df62 AD |
6425 | esac |
6426 | echo " " | |
6427 | rp="What is the type for group ids returned by getgid()?" | |
6428 | . ./myread | |
a0d0e21e LW |
6429 | gidtype="$ans" |
6430 | ||
2304df62 AD |
6431 | : see if getgroups exists |
6432 | set getgroups d_getgrps | |
6433 | eval $inlibc | |
6434 | ||
a0d0e21e LW |
6435 | : Find type of 2nd arg to getgroups |
6436 | echo " " | |
2304df62 AD |
6437 | case "$d_getgrps" in |
6438 | 'define') | |
a0d0e21e | 6439 | case "$groupstype" in |
2304df62 AD |
6440 | '') dflt="$gidtype" ;; |
6441 | *) dflt="$groupstype" ;; | |
a0d0e21e LW |
6442 | esac |
6443 | $cat <<EOM | |
2304df62 | 6444 | What is the type of the second argument to getgroups()? Usually this |
85e6fe83 | 6445 | is the same as group ids, $gidtype, but not always. |
2304df62 AD |
6446 | |
6447 | EOM | |
a0d0e21e LW |
6448 | rp='What type is the second argument to getgroups()?' |
6449 | . ./myread | |
6450 | groupstype="$ans" | |
6451 | ;; | |
6452 | *) groupstype="$gidtype";; | |
2304df62 | 6453 | esac |
2304df62 | 6454 | |
85e6fe83 | 6455 | : see what type lseek is declared as in the kernel |
a0d0e21e LW |
6456 | set off_t lseektype long stdio.h sys/types.h |
6457 | eval $typedef | |
2304df62 | 6458 | echo " " |
a0d0e21e | 6459 | dflt="$lseektype" |
85e6fe83 LW |
6460 | rp="What type is lseek's offset on this system declared as?" |
6461 | . ./myread | |
6462 | lseektype="$ans" | |
2304df62 AD |
6463 | |
6464 | : determine where manual pages go | |
1aef975c AD |
6465 | set mansrc mansrc none |
6466 | eval $prefixit | |
2304df62 AD |
6467 | $cat <<EOM |
6468 | ||
1aef975c | 6469 | $spackage has manual pages available in source form. |
2304df62 | 6470 | EOM |
ecfc5424 | 6471 | case "$nroff" in |
2304df62 AD |
6472 | nroff) |
6473 | echo "However, you don't have nroff, so they're probably useless to you." | |
6474 | case "$mansrc" in | |
6475 | '') mansrc="none";; | |
6476 | esac;; | |
6477 | esac | |
6478 | echo "If you don't want the manual sources installed, answer 'none'." | |
6479 | case "$mansrc" in | |
6480 | '') | |
1aef975c AD |
6481 | lookpath="$prefixexp/man/man1 $prefixexp/man/u_man/man1" |
6482 | lookpath="$lookpath $prefixexp/man/l_man/man1" | |
6483 | lookpath="$lookpath /usr/local/man/man1 /opt/man/man1 /usr/man/manl" | |
2304df62 AD |
6484 | lookpath="$lookpath /usr/man/local/man1 /usr/man/l_man/man1" |
6485 | lookpath="$lookpath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1" | |
6486 | lookpath="$lookpath /usr/man/man.L" | |
1aef975c | 6487 | mansrc=`./loc . $prefixexp/man/man1 $lookpath` |
2304df62 AD |
6488 | if $test -d "$mansrc"; then |
6489 | dflt="$mansrc" | |
6490 | else | |
6491 | dflt="$sysman" | |
6492 | fi | |
1aef975c AD |
6493 | set dflt |
6494 | eval $prefixup | |
2304df62 | 6495 | ;; |
1aef975c | 6496 | ' ') dflt=none;; |
2304df62 AD |
6497 | *) dflt="$mansrc" |
6498 | ;; | |
6499 | esac | |
6500 | echo " " | |
6501 | fn=dn~ | |
6502 | rp='Where do the manual pages (source) go?' | |
6503 | . ./getfile | |
1aef975c AD |
6504 | if test "X$mansrcexp" != "X$ansexp"; then |
6505 | installmansrc='' | |
6506 | fi | |
2304df62 AD |
6507 | mansrc="$ans" |
6508 | mansrcexp="$ansexp" | |
1aef975c AD |
6509 | case "$mansrc" in |
6510 | '') mansrc=' ' | |
6511 | installmansrc='';; | |
6512 | esac | |
2304df62 AD |
6513 | if $afs; then |
6514 | $cat <<EOM | |
6515 | ||
6516 | Since you are running AFS, I need to distinguish the directory in which | |
6517 | manual pages reside from the directory in which they are installed (and from | |
6518 | which they are presumably copied to the former directory by occult means). | |
6519 | ||
6520 | EOM | |
6521 | case "$installmansrc" in | |
6522 | '') dflt=`echo $mansrcexp | sed 's#^/afs/#/afs/.#'`;; | |
6523 | *) dflt="$installmansrc";; | |
6524 | esac | |
6525 | fn=de~ | |
6526 | rp='Where will man pages be installed?' | |
6527 | . ./getfile | |
6528 | installmansrc="$ans" | |
6529 | else | |
6530 | installmansrc="$mansrcexp" | |
6531 | fi | |
6532 | ||
2304df62 | 6533 | case "$mansrc" in |
1aef975c | 6534 | ' ') manext='0';; |
2304df62 AD |
6535 | *l) manext=l;; |
6536 | *n) manext=n;; | |
6537 | *o) manext=l;; | |
6538 | *p) manext=n;; | |
6539 | *C) manext=C;; | |
6540 | *L) manext=L;; | |
6541 | *L1) manext=L1;; | |
6542 | *) manext=1;; | |
6543 | esac | |
6544 | ||
a0d0e21e LW |
6545 | : see what type is used for mode_t |
6546 | set mode_t modetype int stdio.h sys/types.h | |
6547 | eval $typedef | |
6548 | dflt="$modetype" | |
85e6fe83 | 6549 | echo " " |
a0d0e21e | 6550 | rp="What type is used for file modes?" |
85e6fe83 | 6551 | . ./myread |
a0d0e21e | 6552 | modetype="$ans" |
85e6fe83 | 6553 | |
ecfc5424 AD |
6554 | : set the base revision |
6555 | baserev=5.0 | |
6556 | ||
6557 | : get the patchlevel | |
6558 | echo " " | |
6559 | echo "Getting the current patchlevel..." >&4 | |
6560 | if $test -r ../patchlevel.h;then | |
6561 | patchlevel=`awk '/PATCHLEVEL/ {print $3}' < ../patchlevel.h` | |
6562 | else | |
6563 | patchlevel=0 | |
6564 | fi | |
6565 | echo "(You have $package $baserev PL$patchlevel.)" | |
6566 | ||
2304df62 AD |
6567 | : Cruising for prototypes |
6568 | echo " " | |
6569 | echo "Checking out function prototypes..." >&4 | |
6570 | $cat >prototype.c <<'EOCP' | |
6571 | main(int argc, char *argv[]) { | |
6572 | exit(0);} | |
6573 | EOCP | |
a0d0e21e | 6574 | if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then |
2304df62 AD |
6575 | echo "Your C compiler appears to support function prototypes." |
6576 | val="$define" | |
6577 | else | |
6578 | echo "Your C compiler doesn't seem to understand function prototypes." | |
6579 | val="$undef" | |
6580 | fi | |
6581 | set prototype | |
6582 | eval $setvar | |
6583 | $rm -f prototype* | |
6584 | ||
6585 | : check for size of random number generator | |
6586 | echo " " | |
6587 | case "$randbits" in | |
6588 | '') | |
6589 | echo "Checking to see how many bits your rand function produces..." >&4 | |
6590 | $cat >try.c <<'EOCP' | |
6591 | #include <stdio.h> | |
6592 | main() | |
6593 | { | |
6594 | register int i; | |
6595 | register unsigned long tmp; | |
6596 | register unsigned long max = 0L; | |
6597 | ||
6598 | for (i = 1000; i; i--) { | |
6599 | tmp = (unsigned long)rand(); | |
6600 | if (tmp > max) max = tmp; | |
6601 | } | |
6602 | for (i = 0; max; i++) | |
6603 | max /= 2; | |
6604 | printf("%d\n",i); | |
6605 | } | |
6606 | EOCP | |
6607 | if $cc try.c -o try >/dev/null 2>&1 ; then | |
6608 | dflt=`try` | |
6609 | else | |
6610 | dflt='?' | |
6611 | echo "(I can't seem to compile the test program...)" | |
6612 | fi | |
6613 | ;; | |
6614 | *) | |
6615 | dflt="$randbits" | |
6616 | ;; | |
6617 | esac | |
a0d0e21e LW |
6618 | rp='How many bits does your rand() function produce?' |
6619 | . ./myread | |
6620 | randbits="$ans" | |
6621 | $rm -f try.c try | |
6622 | ||
6623 | : see if ar generates random libraries by itself | |
6624 | echo " " | |
6625 | echo "Checking how to generate random libraries on your machine..." >&4 | |
6626 | echo 'int bar1() { return bar2(); }' > bar1.c | |
6627 | echo 'int bar2() { return 2; }' > bar2.c | |
6628 | $cat > foo.c <<'EOP' | |
6629 | main() { printf("%d\n", bar1()); exit(0); } | |
6630 | EOP | |
6631 | $cc $ccflags -c bar1.c >/dev/null 2>&1 | |
6632 | $cc $ccflags -c bar2.c >/dev/null 2>&1 | |
6633 | $cc $ccflags -c foo.c >/dev/null 2>&1 | |
6634 | ar rc bar.a bar2.o bar1.o >/dev/null 2>&1 | |
ecfc5424 | 6635 | if $cc $ccflags $ldflags -o foobar foo.o bar.a $libs > /dev/null 2>&1 && |
a0d0e21e LW |
6636 | ./foobar >/dev/null 2>&1; then |
6637 | echo "ar appears to generate random libraries itself." | |
6638 | orderlib=false | |
6639 | ranlib=":" | |
6640 | elif ar ts bar.a >/dev/null 2>&1 && | |
6641 | $cc $ccflags $ldflags -o foobar foo.o bar.a $libs > /dev/null 2>&1 && | |
6642 | ./foobar >/dev/null 2>&1; then | |
6643 | echo "a table of contents needs to be added with 'ar ts'." | |
6644 | orderlib=false | |
6645 | ranlib="ar ts" | |
6646 | else | |
ecfc5424 AD |
6647 | case "$ranlib" in |
6648 | :) ranlib='';; | |
6649 | '') | |
6650 | ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin` | |
6651 | $test -f $ranlib || ranlib='' | |
6652 | ;; | |
6653 | esac | |
a0d0e21e | 6654 | if $test -n "$ranlib"; then |
ecfc5424 | 6655 | echo "your system has '$ranlib'; we'll use that." |
a0d0e21e LW |
6656 | orderlib=false |
6657 | else | |
6658 | echo "your system doesn't seem to support random libraries" | |
6659 | echo "so we'll use lorder and tsort to order the libraries." | |
6660 | orderlib=true | |
6661 | ranlib=":" | |
6662 | fi | |
6663 | fi | |
6664 | $rm -f foo* bar* | |
6665 | ||
6666 | : determine where public executable scripts go | |
1aef975c AD |
6667 | set scriptdir scriptdir |
6668 | eval $prefixit | |
a0d0e21e LW |
6669 | case "$scriptdir" in |
6670 | '') | |
6671 | dflt="$bin" | |
6672 | : guess some guesses | |
6673 | $test -d /usr/share/scripts && dflt=/usr/share/scripts | |
6674 | $test -d /usr/share/bin && dflt=/usr/share/bin | |
6675 | $test -d /usr/local/script && dflt=/usr/local/script | |
1aef975c AD |
6676 | $test -d $prefixexp/script && dflt=$prefixexp/script |
6677 | set dflt | |
6678 | eval $prefixup | |
a0d0e21e LW |
6679 | ;; |
6680 | *) dflt="$scriptdir" | |
6681 | ;; | |
6682 | esac | |
6683 | $cat <<EOM | |
6684 | ||
6685 | Some installations have a separate directory just for executable scripts so | |
6686 | that they can mount it across multiple architectures but keep the scripts in | |
6687 | one spot. You might, for example, have a subdirectory of /usr/share for this. | |
6688 | Or you might just lump your scripts in with all your other executables. | |
6689 | ||
6690 | EOM | |
6691 | fn=d~ | |
6692 | rp='Where do you keep publicly executable scripts?' | |
6693 | . ./getfile | |
1aef975c AD |
6694 | if $test "X$ansexp" != "X$scriptdirexp"; then |
6695 | installscript='' | |
6696 | fi | |
a0d0e21e LW |
6697 | scriptdir="$ans" |
6698 | scriptdirexp="$ansexp" | |
6699 | if $afs; then | |
6700 | $cat <<EOM | |
6701 | ||
6702 | Since you are running AFS, I need to distinguish the directory in which | |
6703 | scripts reside from the directory in which they are installed (and from | |
6704 | which they are presumably copied to the former directory by occult means). | |
6705 | ||
6706 | EOM | |
6707 | case "$installscript" in | |
6708 | '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;; | |
6709 | *) dflt="$installscript";; | |
6710 | esac | |
6711 | fn=de~ | |
6712 | rp='Where will public scripts be installed?' | |
6713 | . ./getfile | |
6714 | installscript="$ans" | |
6715 | else | |
6716 | installscript="$scriptdirexp" | |
6717 | fi | |
6718 | ||
6719 | : see if sys/select.h has to be included | |
6720 | set sys/select.h i_sysselct | |
6721 | eval $inhdr | |
6722 | ||
6723 | : see if we should include time.h, sys/time.h, or both | |
6724 | echo " " | |
6725 | echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4 | |
6726 | $echo $n "I'm now running the test program...$c" | |
6727 | $cat >try.c <<'EOCP' | |
6728 | #include <sys/types.h> | |
6729 | #ifdef I_TIME | |
6730 | #include <time.h> | |
6731 | #endif | |
6732 | #ifdef I_SYSTIME | |
6733 | #ifdef SYSTIMEKERNEL | |
6734 | #define KERNEL | |
6735 | #endif | |
6736 | #include <sys/time.h> | |
6737 | #endif | |
6738 | #ifdef I_SYSSELECT | |
6739 | #include <sys/select.h> | |
6740 | #endif | |
6741 | main() | |
6742 | { | |
6743 | struct tm foo; | |
6744 | #ifdef S_TIMEVAL | |
6745 | struct timeval bar; | |
6746 | #endif | |
6747 | #ifdef S_TIMEZONE | |
6748 | struct timezone tzp; | |
6749 | #endif | |
6750 | if (foo.tm_sec == foo.tm_sec) | |
6751 | exit(0); | |
6752 | #ifdef S_TIMEVAL | |
6753 | if (bar.tv_sec == bar.tv_sec) | |
6754 | exit(0); | |
6755 | #endif | |
6756 | exit(1); | |
6757 | } | |
6758 | EOCP | |
6759 | flags='' | |
6760 | s_timezone='' | |
6761 | sysselect='' | |
6762 | for s_timeval in '-DS_TIMEVAL' ''; do | |
6763 | for i_systimek in '' '-DSYSTIMEKERNEL'; do | |
6764 | for i_time in '' '-DI_TIME'; do | |
6765 | for i_systime in '-DI_SYSTIME' ''; do | |
6766 | case "$flags" in | |
6767 | '') $echo $n ".$c" | |
6768 | if $cc $ccflags \ | |
6769 | $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \ | |
6770 | try.c -o try >/dev/null 2>&1 ; then | |
6771 | set X $i_time $i_systime $i_systimek $sysselect $s_timeval | |
6772 | shift | |
6773 | flags="$*" | |
6774 | echo " " | |
6775 | $echo $n "Succeeded with $flags$c" | |
6776 | fi | |
6777 | ;; | |
6778 | esac | |
6779 | done | |
6780 | done | |
6781 | done | |
6782 | done | |
6783 | timeincl='' | |
6784 | echo " " | |
6785 | case "$flags" in | |
6786 | *SYSTIMEKERNEL*) i_systimek="$define" | |
6787 | timeincl=`./findhdr sys/time.h` | |
6788 | echo "We'll include <sys/time.h> with KERNEL defined." >&4;; | |
6789 | *) i_systimek="$undef";; | |
6790 | esac | |
6791 | case "$flags" in | |
6792 | *I_TIME*) i_time="$define" | |
6793 | timeincl=`./findhdr time.h`" $timeincl" | |
6794 | echo "We'll include <time.h>." >&4;; | |
6795 | *) i_time="$undef";; | |
6796 | esac | |
6797 | case "$flags" in | |
6798 | *I_SYSTIME*) i_systime="$define" | |
6799 | timeincl=`./findhdr sys/time.h`" $timeincl" | |
6800 | echo "We'll include <sys/time.h>." >&4;; | |
6801 | *) i_systime="$undef";; | |
6802 | esac | |
2304df62 AD |
6803 | $rm -f try.c try |
6804 | ||
a0d0e21e LW |
6805 | : check for fd_set items |
6806 | $cat <<EOM | |
6807 | ||
6808 | Checking to see how well your C compiler handles fd_set and friends ... | |
6809 | EOM | |
6810 | $cat >fd_set.c <<EOCP | |
6811 | #$i_systime I_SYS_TIME | |
6812 | #$i_sysselct I_SYS_SELECT | |
6813 | #$d_socket HAS_SOCKET | |
6814 | #include <sys/types.h> | |
6815 | #ifdef HAS_SOCKET | |
6816 | #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */ | |
6817 | #endif | |
6818 | #ifdef I_SYS_TIME | |
6819 | #include <sys/time.h> | |
6820 | #else | |
6821 | #ifdef I_SYS_SELECT | |
6822 | #include <sys/select.h> | |
6823 | #endif | |
6824 | #endif | |
6825 | main() { | |
6826 | fd_set fds; | |
6827 | ||
6828 | #ifdef TRYBITS | |
6829 | if(fds.fds_bits); | |
6830 | #endif | |
6831 | ||
6832 | #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO) | |
6833 | exit(0); | |
6834 | #else | |
6835 | exit(1); | |
6836 | #endif | |
6837 | } | |
6838 | EOCP | |
6839 | if $cc $ccflags -DTRYBITS fd_set.c -o fd_set >fd_set.out 2>&1 ; then | |
6840 | d_fds_bits="$define" | |
6841 | d_fd_set="$define" | |
6842 | echo "Well, your system knows about the normal fd_set typedef..." >&4 | |
6843 | if ./fd_set; then | |
6844 | echo "and you have the normal fd_set macros (just as I'd expect)." >&4 | |
6845 | d_fd_macros="$define" | |
85e6fe83 | 6846 | else |
a0d0e21e LW |
6847 | $cat >&4 <<'EOM' |
6848 | but not the normal fd_set macros! Gaaack! I'll have to cover for you. | |
6849 | EOM | |
6850 | d_fd_macros="$undef" | |
85e6fe83 LW |
6851 | fi |
6852 | else | |
a0d0e21e LW |
6853 | $cat <<'EOM' |
6854 | Hmm, your compiler has some difficulty with fd_set. Checking further... | |
6855 | EOM | |
6856 | if $cc $ccflags fd_set.c -o fd_set >fd_set.out 2>&1 ; then | |
6857 | d_fds_bits="$undef" | |
6858 | d_fd_set="$define" | |
6859 | echo "Well, your system has some sort of fd_set available..." >&4 | |
6860 | if ./fd_set; then | |
6861 | echo "and you have the normal fd_set macros." >&4 | |
6862 | d_fd_macros="$define" | |
6863 | else | |
6864 | $cat <<'EOM' | |
6865 | but not the normal fd_set macros! Gross! More work for me... | |
6866 | EOM | |
6867 | d_fd_macros="$undef" | |
6868 | fi | |
85e6fe83 | 6869 | else |
a0d0e21e LW |
6870 | echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4 |
6871 | d_fd_set="$undef" | |
6872 | d_fds_bits="$undef" | |
6873 | d_fd_macros="$undef" | |
85e6fe83 LW |
6874 | fi |
6875 | fi | |
a0d0e21e LW |
6876 | $rm -f fd_set* |
6877 | ||
6878 | ||
6879 | : check for type of arguments to select. This will only really | |
6880 | : work if the system supports prototypes and provides one for | |
6881 | : select. | |
6882 | case "$d_select" in | |
6883 | $define) | |
6884 | : Make initial guess | |
6885 | case "$selecttype" in | |
6886 | ''|' ') | |
6887 | case "$d_fd_set" in | |
6888 | $define) xxx='fd_set *' ;; | |
6889 | *) xxx='int *' ;; | |
6890 | esac | |
6891 | ;; | |
6892 | *) xxx="$selecttype" | |
6893 | ;; | |
6894 | esac | |
6895 | : backup guess | |
6896 | case "$xxx" in | |
6897 | 'fd_set *') yyy='int *' ;; | |
6898 | 'int *') yyy='fd_set *' ;; | |
6899 | esac | |
85e6fe83 | 6900 | |
2304df62 AD |
6901 | $cat <<EOM |
6902 | ||
a0d0e21e | 6903 | Checking to see what type of arguments are expected by select(). |
2304df62 | 6904 | EOM |
a0d0e21e LW |
6905 | $cat >try.c <<EOCP |
6906 | #$i_systime I_SYS_TIME | |
6907 | #$i_sysselct I_SYS_SELECT | |
6908 | #$d_socket HAS_SOCKET | |
6909 | #include <sys/types.h> | |
6910 | #ifdef HAS_SOCKET | |
6911 | #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */ | |
6912 | #endif | |
6913 | #ifdef I_SYS_TIME | |
6914 | #include <sys/time.h> | |
6915 | #else | |
6916 | #ifdef I_SYS_SELECT | |
6917 | #include <sys/select.h> | |
6918 | #endif | |
6919 | #endif | |
6920 | main() | |
6921 | { | |
6922 | int width; | |
6923 | Select_fd_set_t readfds; | |
6924 | Select_fd_set_t writefds; | |
6925 | Select_fd_set_t exceptfds; | |
6926 | struct timeval timeout; | |
6927 | select(width, readfds, writefds, exceptfds, &timeout); | |
6928 | exit(0); | |
6929 | } | |
6930 | EOCP | |
6931 | if $cc $ccflags -c -DSelect_fd_set_t="$xxx" try.c >/dev/null 2>&1 ; then | |
6932 | selecttype="$xxx" | |
6933 | echo "Your system uses $xxx for the arguments to select." >&4 | |
6934 | elif $cc $ccflags -c -DSelect_fd_set_t="$yyy" try.c >/dev/null 2>&1 ; then | |
6935 | selecttype="$yyy" | |
6936 | echo "Your system uses $yyy for the arguments to select." >&4 | |
6937 | else | |
6938 | rp='What is the type for the 2nd, 3rd, and 4th arguments to select?' | |
6939 | dflt="$xxx" | |
6940 | . ./myread | |
6941 | selecttype="$ans" | |
6942 | fi | |
6943 | $rm -f try.[co] | |
6944 | ;; | |
6945 | *) selecttype = 'int *' | |
6946 | ;; | |
6947 | esac | |
2304df62 AD |
6948 | |
6949 | : generate list of signal names | |
6950 | echo " " | |
6951 | case "$sig_name" in | |
6952 | '') | |
6953 | echo "Generating a list of signal names..." >&4 | |
6954 | xxx=`./findhdr signal.h`" "`./findhdr sys/signal.h` | |
6955 | set X `cat $xxx 2>&1 | $awk ' | |
6956 | $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ { | |
6957 | sig[$3] = substr($2,4,20) | |
6958 | if (max < $3 && $3 < 60) { | |
6959 | max = $3 | |
6960 | } | |
6961 | } | |
6962 | ||
6963 | END { | |
6964 | for (i = 1; i <= max; i++) { | |
6965 | if (sig[i] == "") | |
6966 | printf "%d", i | |
6967 | else | |
6968 | printf "%s", sig[i] | |
6969 | if (i < max) | |
6970 | printf " " | |
6971 | } | |
6972 | printf "\n" | |
6973 | } | |
6974 | '` | |
6975 | shift | |
6976 | case $# in | |
6977 | 0) | |
6978 | echo 'kill -l' >/tmp/foo$$ | |
6979 | set X `csh -f </tmp/foo$$` | |
6980 | $rm -f /tmp/foo$$ | |
6981 | shift | |
6982 | case $# in | |
6983 | 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM | |
6984 | ;; | |
6985 | esac | |
6986 | ;; | |
6987 | esac | |
6988 | sig_name="ZERO $*" | |
a0d0e21e | 6989 | ;; |
2304df62 | 6990 | esac |
a0d0e21e LW |
6991 | echo "The following signals are available:" |
6992 | echo " " | |
6993 | echo $sig_name | $awk \ | |
6994 | 'BEGIN { linelen = 0 } | |
6995 | { | |
6996 | for (i = 1; i < NF; i++) { | |
6997 | name = "SIG" $i " " | |
6998 | linelen = linelen + length(name) | |
6999 | if (linelen > 70) { | |
7000 | printf "\n" | |
7001 | linelen = length(name) | |
7002 | } | |
7003 | printf "%s", name | |
7004 | } | |
7005 | }' | |
7006 | echo " " | |
7007 | ||
7008 | : see what type is used for size_t | |
7009 | set size_t sizetype 'unsigned int' stdio.h sys/types.h | |
7010 | eval $typedef | |
7011 | dflt="$sizetype" | |
7012 | echo " " | |
7013 | rp="What type is used for the length parameter for string functions?" | |
2304df62 | 7014 | . ./myread |
a0d0e21e LW |
7015 | sizetype="$ans" |
7016 | ||
7017 | : see what type is used for signed size_t | |
7018 | set ssize_t ssizetype int stdio.h sys/types.h | |
7019 | eval $typedef | |
7020 | dflt="$ssizetype" | |
7021 | $cat > ssize.c <<EOM | |
7022 | #include <stdio.h> | |
7023 | #include <sys/types.h> | |
7024 | #define Size_t $sizetype | |
7025 | #define SSize_t $dflt | |
7026 | main() | |
7027 | { | |
7028 | if (sizeof(Size_t) == sizeof(SSize_t)) | |
7029 | printf("$dflt\n"); | |
7030 | else if (sizeof(Size_t) == sizeof(int)) | |
7031 | printf("int\n"); | |
7032 | else | |
7033 | printf("long\n"); | |
7034 | } | |
7035 | EOM | |
7036 | echo " " | |
7037 | if $cc $ccflags $ldflags -o ssize ssize.c $libs > /dev/null 2>&1 ; then | |
7038 | ssizetype=`./ssize` | |
7039 | echo "I'll be using $ssizetype for functions returning a byte count." >&4 | |
7040 | else | |
7041 | echo "(I can't compile the test program--please enlighten me!)" | |
7042 | $cat <<EOM | |
7043 | ||
7044 | I need a type that is the same size as $sizetype, but is guaranteed to | |
7045 | be signed. Common values are int and long. | |
7046 | ||
7047 | EOM | |
7048 | rp="What signed type is the same size as $sizetype?" | |
7049 | . ./myread | |
7050 | ssizetype="$ans" | |
7051 | fi | |
7052 | $rm -f ssize ssize.[co] | |
7053 | ||
7054 | : see what type of char stdio uses. | |
7055 | echo " " | |
7056 | if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then | |
7057 | echo "Your stdio uses unsigned chars." >&4 | |
7058 | stdchar="unsigned char" | |
7059 | else | |
7060 | echo "Your stdio uses signed chars." >&4 | |
7061 | stdchar="char" | |
7062 | fi | |
7063 | ||
7064 | : see if time exists | |
7065 | echo " " | |
ecfc5424 | 7066 | if set time val -f d_time; eval $csym; $val; then |
a0d0e21e | 7067 | echo 'time() found.' >&4 |
ecfc5424 | 7068 | val="$define" |
a0d0e21e LW |
7069 | set time_t timetype long stdio.h sys/types.h |
7070 | eval $typedef | |
7071 | dflt="$timetype" | |
7072 | echo " " | |
7073 | rp="What type is returned by time() on this sytem?" | |
7074 | . ./myread | |
7075 | timetype="$ans" | |
7076 | else | |
7077 | echo 'time() not found, hope that will do.' >&4 | |
ecfc5424 | 7078 | val="$undef" |
a0d0e21e LW |
7079 | timetype='int'; |
7080 | fi | |
a0d0e21e LW |
7081 | set d_time |
7082 | eval $setvar | |
7083 | ||
7084 | : see what type uids are declared as in the kernel | |
7085 | set uid_t uidtype xxx stdio.h sys/types.h | |
7086 | eval $typedef | |
7087 | case "$uidtype" in | |
7088 | xxx) | |
7089 | xxx=`./findhdr sys/user.h` | |
7090 | set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short | |
7091 | case $1 in | |
7092 | unsigned) dflt="$1 $2" ;; | |
7093 | *) dflt="$1" ;; | |
7094 | esac | |
7095 | ;; | |
7096 | *) dflt="$uidtype";; | |
7097 | esac | |
7098 | echo " " | |
7099 | rp="What is the type for user ids returned by getuid()?" | |
7100 | . ./myread | |
7101 | uidtype="$ans" | |
2304df62 | 7102 | |
2304df62 AD |
7103 | : see if this is a sys/file.h system |
7104 | val='' | |
7105 | set sys/file.h val | |
7106 | eval $inhdr | |
7107 | ||
7108 | : do we need to #include <sys/file.h> ? | |
7109 | case "$val" in | |
7110 | "$define") | |
7111 | echo " " | |
7112 | if $h_sysfile; then | |
7113 | val="$define" | |
7114 | echo "We'll be including <sys/file.h>." >&4 | |
7115 | else | |
7116 | val="$undef" | |
7117 | echo "We won't be including <sys/file.h>." >&4 | |
7118 | fi | |
7119 | ;; | |
7120 | *) | |
7121 | h_sysfile=false | |
7122 | ;; | |
7123 | esac | |
7124 | set i_sysfile | |
7125 | eval $setvar | |
7126 | ||
7127 | : see if fcntl.h is there | |
7128 | val='' | |
7129 | set fcntl.h val | |
7130 | eval $inhdr | |
7131 | ||
7132 | : see if we can include fcntl.h | |
7133 | case "$val" in | |
7134 | "$define") | |
7135 | echo " " | |
7136 | if $h_fcntl; then | |
7137 | val="$define" | |
7138 | echo "We'll be including <fcntl.h>." >&4 | |
7139 | else | |
7140 | val="$undef" | |
7141 | if $h_sysfile; then | |
7142 | echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4 | |
7143 | else | |
7144 | echo "We won't be including <fcntl.h>." >&4 | |
7145 | fi | |
7146 | fi | |
7147 | ;; | |
7148 | *) | |
7149 | h_fcntl=false | |
7150 | val="$undef" | |
7151 | ;; | |
7152 | esac | |
7153 | set i_fcntl | |
7154 | eval $setvar | |
7155 | ||
2304df62 AD |
7156 | : see if this is an grp system |
7157 | set grp.h i_grp | |
7158 | eval $inhdr | |
7159 | ||
a0d0e21e LW |
7160 | : see if this is a math.h system |
7161 | set math.h i_math | |
7162 | eval $inhdr | |
7163 | ||
85e6fe83 | 7164 | : see if memory.h is available. |
a0d0e21e LW |
7165 | val='' |
7166 | set memory.h val | |
2304df62 | 7167 | eval $inhdr |
a0d0e21e | 7168 | |
85e6fe83 | 7169 | : See if it conflicts with string.h |
a0d0e21e LW |
7170 | case "$val" in |
7171 | $define) | |
7172 | case "$strings" in | |
7173 | '') ;; | |
7174 | *) | |
7175 | $cppstdin $cppflags $cppminus < $strings > mem.h | |
7176 | if $contains 'memcpy' mem.h >/dev/null 2>&1; then | |
7177 | echo " " | |
7178 | echo "We won't be including <memory.h>." | |
7179 | val="$undef" | |
7180 | fi | |
7181 | $rm -f mem.h | |
7182 | ;; | |
7183 | esac | |
85e6fe83 | 7184 | esac |
a0d0e21e LW |
7185 | set i_memory |
7186 | eval $setvar | |
2304df62 | 7187 | |
85e6fe83 | 7188 | : see if net/errno.h is available |
a0d0e21e LW |
7189 | val='' |
7190 | set net/errno.h val | |
2304df62 | 7191 | eval $inhdr |
a0d0e21e | 7192 | |
85e6fe83 | 7193 | : Unfortunately, it causes problems on some systems. Arrgh. |
a0d0e21e LW |
7194 | case "$val" in |
7195 | $define) | |
7196 | cat > try.c <<'EOM' | |
85e6fe83 LW |
7197 | #include <stdio.h> |
7198 | #include <errno.h> | |
7199 | #include <net/errno.h> | |
7200 | int func() | |
7201 | { | |
a0d0e21e | 7202 | return ENOTSOCK; |
85e6fe83 LW |
7203 | } |
7204 | EOM | |
a0d0e21e LW |
7205 | if $cc $ccflags -c try.c >/dev/null 2>&1; then |
7206 | echo "We'll be including <net/errno.h>." >&4 | |
7207 | else | |
7208 | echo "We won't be including <net/errno.h>." >&4 | |
7209 | val="$undef" | |
7210 | fi | |
7211 | $rm -f try.* try | |
7212 | ;; | |
85e6fe83 | 7213 | esac |
a0d0e21e LW |
7214 | set i_neterrno |
7215 | eval $setvar | |
2304df62 AD |
7216 | |
7217 | : get C preprocessor symbols handy | |
7218 | echo " " | |
ecfc5424 | 7219 | $echo $n "Hmm... $c" |
a0d0e21e | 7220 | echo $al | $tr ' ' '\012' >Cppsym.know |
2304df62 AD |
7221 | $cat <<EOSS >Cppsym |
7222 | $startsh | |
7223 | case "\$1" in | |
7224 | -l) list=true | |
7225 | shift | |
7226 | ;; | |
7227 | esac | |
7228 | unknown='' | |
7229 | case "\$list\$#" in | |
7230 | 1|2) | |
7231 | for sym do | |
7232 | if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then | |
7233 | exit 0 | |
7234 | elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then | |
7235 | : | |
7236 | else | |
7237 | unknown="\$unknown \$sym" | |
7238 | fi | |
7239 | done | |
7240 | set X \$unknown | |
7241 | shift | |
7242 | ;; | |
7243 | esac | |
7244 | case \$# in | |
7245 | 0) exit 1;; | |
7246 | esac | |
7247 | echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\ | |
7248 | #ifdef \1\\ | |
7249 | exit 0; _ _ _ _\1\\ \1\\ | |
7250 | #endif\\ | |
7251 | /' >Cppsym\$\$ | |
7252 | echo "exit 1; _ _ _" >>Cppsym\$\$ | |
7253 | $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _' >Cppsym2\$\$ | |
7254 | case "\$list" in | |
7255 | true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;; | |
7256 | *) | |
7257 | sh Cppsym2\$\$ | |
7258 | status=\$? | |
7259 | ;; | |
7260 | esac | |
7261 | $rm -f Cppsym\$\$ Cppsym2\$\$ | |
7262 | exit \$status | |
7263 | EOSS | |
7264 | chmod +x Cppsym | |
7265 | $eunicefix Cppsym | |
ecfc5424 AD |
7266 | ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true |
7267 | ||
7268 | : now check the C compiler for additional symbols | |
7269 | $cat >ccsym <<EOS | |
7270 | $startsh | |
7271 | $cat >tmp.c <<EOF | |
7272 | extern int foo; | |
7273 | EOF | |
7274 | for i in \`$cc -v -c tmp.c 2>&1\` | |
7275 | do | |
7276 | case "\$i" in | |
7277 | -D*) echo "\$i" | $sed 's/^-D//';; | |
7278 | -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';; | |
7279 | esac | |
7280 | done | |
7281 | $rm -f try.c | |
7282 | EOS | |
7283 | chmod +x ccsym | |
7284 | $eunicefix ccsym | |
7285 | ./ccsym | $sort | $uniq >ccsym.raw | |
7286 | $awk '/\=/ { print $0; next } { print $0"=1" }' ccsym.raw >ccsym.list | |
7287 | $awk '{ print $0"=1" }' Cppsym.true >ccsym.true | |
7288 | $comm -13 ccsym.true ccsym.list >ccsym.own | |
7289 | $comm -12 ccsym.true ccsym.list >ccsym.com | |
7290 | $comm -23 ccsym.true ccsym.list >ccsym.cpp | |
7291 | also='' | |
7292 | symbols='symbols' | |
7293 | if $test -z ccsym.raw; then | |
7294 | echo "Your C compiler doesn't seem to define any symbol!" >&4 | |
7295 | echo " " | |
7296 | echo "However, your C preprocessor defines the following ones:" | |
7297 | $cat Cppsym.true | |
7298 | else | |
7299 | if $test -s ccsym.com; then | |
7300 | echo "Your C compiler and pre-processor define these symbols:" | |
7301 | $sed -e 's/\(.*\)=.*/\1/' ccsym.com | |
7302 | also='also ' | |
7303 | symbols='ones' | |
7304 | $test "$silent" || sleep 1 | |
7305 | fi | |
7306 | if $test -s ccsym.cpp; then | |
7307 | $test "$also" && echo " " | |
7308 | echo "Your C pre-processor ${also}defines the following $symbols:" | |
7309 | $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp | |
7310 | also='further ' | |
7311 | $test "$silent" || sleep 1 | |
7312 | fi | |
7313 | if $test -s ccsym.own; then | |
7314 | $test "$also" && echo " " | |
7315 | echo "Your C compiler ${also}defines the following cpp variables:" | |
7316 | $sed -e 's/\(.*\)=1/\1/' ccsym.own | |
7317 | $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true | |
7318 | $test "$silent" || sleep 1 | |
7319 | fi | |
7320 | fi | |
7321 | $rm -f ccsym* | |
2304df62 AD |
7322 | |
7323 | : see if this is a termio system | |
7324 | val="$undef" | |
7325 | val2="$undef" | |
7326 | val3="$undef" | |
7327 | if $test `./findhdr termios.h`; then | |
7328 | set tcsetattr i_termios | |
7329 | eval $inlibc | |
7330 | val3="$i_termios" | |
7331 | fi | |
7332 | echo " " | |
7333 | case "$val3" in | |
7334 | "$define") echo "You have POSIX termios.h... good!" >&4;; | |
ecfc5424 | 7335 | *) if ./Cppsym pyr; then |
2304df62 AD |
7336 | case "`/bin/universe`" in |
7337 | ucb) if $test `./findhdr sgtty.h`; then | |
7338 | val2="$define" | |
7339 | echo "<sgtty.h> found." >&4 | |
7340 | else | |
7341 | echo "System is pyramid with BSD universe." | |
7342 | echo "<sgtty.h> not found--you could have problems." >&4 | |
7343 | fi;; | |
7344 | *) if $test `./findhdr termio.h`; then | |
7345 | val="$define" | |
7346 | echo "<termio.h> found." >&4 | |
7347 | else | |
7348 | echo "System is pyramid with USG universe." | |
7349 | echo "<termio.h> not found--you could have problems." >&4 | |
7350 | fi;; | |
7351 | esac | |
ecfc5424 | 7352 | elif ./usg; then |
2304df62 AD |
7353 | if $test `./findhdr termio.h`; then |
7354 | echo "<termio.h> found." >&4 | |
7355 | val="$define" | |
7356 | elif $test `./findhdr sgtty.h`; then | |
7357 | echo "<sgtty.h> found." >&4 | |
7358 | val2="$define" | |
7359 | else | |
7360 | echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4 | |
7361 | fi | |
7362 | else | |
7363 | if $test `./findhdr sgtty.h`; then | |
7364 | echo "<sgtty.h> found." >&4 | |
7365 | val2="$define" | |
7366 | elif $test `./findhdr termio.h`; then | |
7367 | echo "<termio.h> found." >&4 | |
7368 | val="$define" | |
7369 | else | |
7370 | echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4 | |
7371 | fi | |
7372 | fi;; | |
7373 | esac | |
7374 | set i_termio; eval $setvar | |
7375 | val=$val2; set i_sgtty; eval $setvar | |
7376 | val=$val3; set i_termios; eval $setvar | |
7377 | ||
a0d0e21e | 7378 | : see if stdarg is available |
2304df62 | 7379 | echo " " |
a0d0e21e LW |
7380 | if $test `./findhdr stdarg.h`; then |
7381 | echo "<stdarg.h> found." >&4 | |
7382 | valstd="$define" | |
2304df62 | 7383 | else |
a0d0e21e LW |
7384 | echo "<stdarg.h> NOT found." >&4 |
7385 | valstd="$undef" | |
2304df62 | 7386 | fi |
85e6fe83 | 7387 | |
a0d0e21e | 7388 | : see if varags is available |
2304df62 AD |
7389 | echo " " |
7390 | if $test `./findhdr varargs.h`; then | |
2304df62 AD |
7391 | echo "<varargs.h> found." >&4 |
7392 | else | |
2304df62 AD |
7393 | echo "<varargs.h> NOT found, but that's ok (I hope)." >&4 |
7394 | fi | |
2304df62 AD |
7395 | |
7396 | : set up the varargs testing programs | |
7397 | $cat > varargs.c <<EOP | |
7398 | #ifdef I_STDARG | |
7399 | #include <stdarg.h> | |
7400 | #endif | |
7401 | #ifdef I_VARARGS | |
7402 | #include <varargs.h> | |
7403 | #endif | |
7404 | ||
7405 | #ifdef I_STDARG | |
7406 | int f(char *p, ...) | |
7407 | #else | |
7408 | int f(va_alist) | |
7409 | va_dcl | |
7410 | #endif | |
7411 | { | |
7412 | va_list ap; | |
7413 | #ifndef I_STDARG | |
7414 | char *p; | |
7415 | #endif | |
7416 | #ifdef I_STDARG | |
7417 | va_start(ap,p); | |
7418 | #else | |
7419 | va_start(ap); | |
7420 | p = va_arg(ap, char *); | |
7421 | #endif | |
7422 | va_end(ap); | |
7423 | } | |
7424 | EOP | |
7425 | $cat > varargs <<EOP | |
7426 | if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then | |
7427 | echo "true" | |
7428 | else | |
7429 | echo "false" | |
7430 | fi | |
7431 | $rm -f varargs.o | |
7432 | EOP | |
7433 | chmod +x varargs | |
7434 | ||
7435 | : now check which varargs header should be included | |
7436 | echo " " | |
7437 | i_varhdr='' | |
a0d0e21e | 7438 | case "$valstd" in |
2304df62 AD |
7439 | "$define") |
7440 | if `./varargs I_STDARG`; then | |
a0d0e21e | 7441 | val='stdarg.h' |
2304df62 | 7442 | elif `./varargs I_VARARGS`; then |
a0d0e21e | 7443 | val='varargs.h' |
2304df62 AD |
7444 | fi |
7445 | ;; | |
7446 | *) | |
7447 | if `./varargs I_VARARGS`; then | |
a0d0e21e | 7448 | val='varargs.h' |
2304df62 AD |
7449 | fi |
7450 | ;; | |
7451 | esac | |
a0d0e21e | 7452 | case "$val" in |
2304df62 AD |
7453 | '') |
7454 | echo "I could not find the definition for va_dcl... You have problems..." >&4 | |
a0d0e21e LW |
7455 | val="$undef"; set i_stdarg; eval $setvar |
7456 | val="$undef"; set i_varargs; eval $setvar | |
2304df62 | 7457 | ;; |
a0d0e21e LW |
7458 | *) |
7459 | set i_varhdr | |
7460 | eval $setvar | |
7461 | case "$i_varhdr" in | |
7462 | stdarg.h) | |
7463 | val="$define"; set i_stdarg; eval $setvar | |
7464 | val="$undef"; set i_varargs; eval $setvar | |
7465 | ;; | |
7466 | varargs.h) | |
7467 | val="$undef"; set i_stdarg; eval $setvar | |
7468 | val="$define"; set i_varargs; eval $setvar | |
7469 | ;; | |
7470 | esac | |
7471 | echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;; | |
2304df62 AD |
7472 | esac |
7473 | $rm -f varargs* | |
7474 | ||
a0d0e21e LW |
7475 | : see if stddef is available |
7476 | set stddef.h i_stddef | |
7477 | eval $inhdr | |
7478 | ||
7479 | : see if stdlib is available | |
7480 | set stdlib.h i_stdlib | |
7481 | eval $inhdr | |
7482 | ||
7483 | : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl | |
7484 | set sys/filio.h i_sysfilio | |
7485 | eval $inhdr | |
7486 | echo " " | |
7487 | if $test `./findhdr sys/ioctl.h`; then | |
7488 | val="$define" | |
7489 | echo '<sys/ioctl.h> found.' >&4 | |
7490 | else | |
7491 | val="$undef" | |
7492 | if $test $i_sysfilio = "$define"; then | |
7493 | echo '<sys/ioctl.h> NOT found.' >&4 | |
7494 | else | |
7495 | $test $i_sgtty = "$define" && xxx="sgtty.h" | |
7496 | $test $i_termio = "$define" && xxx="termio.h" | |
7497 | $test $i_termios = "$define" && xxx="termios.h" | |
7498 | echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4 | |
7499 | fi | |
7500 | fi | |
7501 | set i_sysioctl | |
7502 | eval $setvar | |
7503 | ||
7504 | : see if this is a sys/param system | |
7505 | set sys/param.h i_sysparam | |
7506 | eval $inhdr | |
7507 | ||
1aef975c AD |
7508 | : see if sys/stat.h is available |
7509 | set sys/stat.h i_sysstat | |
7510 | eval $inhdr | |
7511 | ||
a0d0e21e LW |
7512 | : see if this is a unistd.h system |
7513 | set unistd.h i_unistd | |
7514 | eval $inhdr | |
7515 | ||
7516 | : see if this is an utime system | |
7517 | set utime.h i_utime | |
7518 | eval $inhdr | |
7519 | ||
2304df62 | 7520 | : see if this is a vfork system |
85e6fe83 | 7521 | case "$d_vfork" in |
a0d0e21e LW |
7522 | "$define") |
7523 | set vfork.h i_vfork | |
85e6fe83 LW |
7524 | eval $inhdr |
7525 | ;; | |
a0d0e21e LW |
7526 | *) |
7527 | i_vfork="$undef" | |
7528 | ;; | |
85e6fe83 | 7529 | esac |
a0d0e21e | 7530 | |
2304df62 AD |
7531 | : end of configuration questions |
7532 | echo " " | |
7533 | echo "End of configuration questions." | |
7534 | echo " " | |
7535 | ||
7536 | : back to where it started | |
7537 | if test -d ../UU; then | |
7538 | cd .. | |
7539 | fi | |
7540 | ||
7541 | : configuration may be patched via a 'config.over' file | |
7542 | if $test -f config.over; then | |
7543 | echo " " | |
7544 | dflt=y | |
7545 | rp='I see a config.over file. Do you wish to load it?' | |
7546 | . UU/myread | |
7547 | case "$ans" in | |
7548 | n*) echo "OK, I'll ignore it.";; | |
7549 | *) . ./config.over | |
7550 | echo "Configuration override changes have been loaded." | |
7551 | ;; | |
7552 | esac | |
7553 | fi | |
7554 | ||
ecfc5424 AD |
7555 | : in case they want portability, strip down executable paths |
7556 | case "$d_portable" in | |
7557 | "$define") | |
7558 | echo " " | |
7559 | echo "Stripping down executable paths..." >&4 | |
7560 | for file in $loclist $trylist; do | |
7561 | eval $file="\$file" | |
7562 | done | |
7563 | ;; | |
7564 | esac | |
7565 | ||
2304df62 AD |
7566 | : create config.sh file |
7567 | echo " " | |
7568 | echo "Creating config.sh..." >&4 | |
7569 | $spitshell <<EOT >config.sh | |
7570 | $startsh | |
7571 | # | |
7572 | # This file was produced by running the Configure script. It holds all the | |
7573 | # definitions figured out by Configure. Should you modify one of these values, | |
7574 | # do not forget to propagate your changes by running "Configure -der". You may | |
7575 | # instead choose to run each of the .SH files by yourself, or "Configure -S". | |
7576 | # | |
7577 | ||
7578 | # Configuration time: $cf_time | |
7579 | # Configured by: $cf_by | |
7580 | # Target system: $myuname | |
7581 | ||
2304df62 AD |
7582 | Author='$Author' |
7583 | Date='$Date' | |
7584 | Header='$Header' | |
7585 | Id='$Id' | |
7586 | Locker='$Locker' | |
7587 | Log='$Log' | |
ecfc5424 | 7588 | Mcc='$Mcc' |
2304df62 AD |
7589 | RCSfile='$RCSfile' |
7590 | Revision='$Revision' | |
7591 | Source='$Source' | |
7592 | State='$State' | |
7593 | afs='$afs' | |
a0d0e21e | 7594 | alignbytes='$alignbytes' |
ecfc5424 | 7595 | aphostname='$aphostname' |
a0d0e21e LW |
7596 | archlib='$archlib' |
7597 | archlibexp='$archlibexp' | |
7598 | archname='$archname' | |
ecfc5424 AD |
7599 | awk='$awk' |
7600 | baserev='$baserev' | |
7601 | bash='$bash' | |
2304df62 AD |
7602 | bin='$bin' |
7603 | binexp='$binexp' | |
ecfc5424 AD |
7604 | bison='$bison' |
7605 | byacc='$byacc' | |
2304df62 | 7606 | byteorder='$byteorder' |
ecfc5424 AD |
7607 | c='$c' |
7608 | castflags='$castflags' | |
7609 | cat='$cat' | |
2304df62 | 7610 | cc='$cc' |
ecfc5424 AD |
7611 | cccdlflags='$cccdlflags' |
7612 | ccdlflags='$ccdlflags' | |
2304df62 | 7613 | ccflags='$ccflags' |
2304df62 AD |
7614 | cf_by='$cf_by' |
7615 | cf_time='$cf_time' | |
ecfc5424 AD |
7616 | chgrp='$chgrp' |
7617 | chmod='$chmod' | |
7618 | chown='$chown' | |
7619 | clocktype='$clocktype' | |
7620 | comm='$comm' | |
7621 | compress='$compress' | |
2304df62 | 7622 | contains='$contains' |
ecfc5424 AD |
7623 | cp='$cp' |
7624 | cpio='$cpio' | |
7625 | cpp='$cpp' | |
a0d0e21e | 7626 | cpp_stuff='$cpp_stuff' |
ecfc5424 | 7627 | cppflags='$cppflags' |
2304df62 AD |
7628 | cpplast='$cpplast' |
7629 | cppminus='$cppminus' | |
7630 | cpprun='$cpprun' | |
7631 | cppstdin='$cppstdin' | |
ecfc5424 AD |
7632 | cryptlib='$cryptlib' |
7633 | csh='$csh' | |
7634 | d_Gconvert='$d_Gconvert' | |
2304df62 | 7635 | d_access='$d_access' |
a0d0e21e | 7636 | d_alarm='$d_alarm' |
ecfc5424 AD |
7637 | d_archlib='$d_archlib' |
7638 | d_attribut='$d_attribut' | |
2304df62 AD |
7639 | d_bcmp='$d_bcmp' |
7640 | d_bcopy='$d_bcopy' | |
ecfc5424 AD |
7641 | d_bsd='$d_bsd' |
7642 | d_bsdpgrp='$d_bsdpgrp' | |
1aef975c | 7643 | d_byacc='$d_byacc' |
2304df62 AD |
7644 | d_bzero='$d_bzero' |
7645 | d_casti32='$d_casti32' | |
2304df62 | 7646 | d_castneg='$d_castneg' |
ecfc5424 | 7647 | d_charvspr='$d_charvspr' |
a0d0e21e LW |
7648 | d_chown='$d_chown' |
7649 | d_chroot='$d_chroot' | |
2304df62 | 7650 | d_chsize='$d_chsize' |
a0d0e21e | 7651 | d_closedir='$d_closedir' |
2304df62 | 7652 | d_const='$d_const' |
2304df62 AD |
7653 | d_crypt='$d_crypt' |
7654 | d_csh='$d_csh' | |
a0d0e21e LW |
7655 | d_cuserid='$d_cuserid' |
7656 | d_dbl_dig='$d_dbl_dig' | |
7657 | d_difftime='$d_difftime' | |
ecfc5424 | 7658 | d_dirnamlen='$d_dirnamlen' |
a0d0e21e LW |
7659 | d_dlerror='$d_dlerror' |
7660 | d_dlopen='$d_dlopen' | |
7661 | d_dlsymun='$d_dlsymun' | |
2304df62 | 7662 | d_dosuid='$d_dosuid' |
a0d0e21e | 7663 | d_drem='$d_drem' |
2304df62 | 7664 | d_dup2='$d_dup2' |
ecfc5424 | 7665 | d_eunice='$d_eunice' |
2304df62 AD |
7666 | d_fchmod='$d_fchmod' |
7667 | d_fchown='$d_fchown' | |
7668 | d_fcntl='$d_fcntl' | |
a0d0e21e LW |
7669 | d_fd_macros='$d_fd_macros' |
7670 | d_fd_set='$d_fd_set' | |
7671 | d_fds_bits='$d_fds_bits' | |
7672 | d_fgetpos='$d_fgetpos' | |
2304df62 AD |
7673 | d_flexfnam='$d_flexfnam' |
7674 | d_flock='$d_flock' | |
a0d0e21e LW |
7675 | d_fmod='$d_fmod' |
7676 | d_fork='$d_fork' | |
ecfc5424 | 7677 | d_fpathconf='$d_fpathconf' |
a0d0e21e | 7678 | d_fsetpos='$d_fsetpos' |
2304df62 AD |
7679 | d_getgrps='$d_getgrps' |
7680 | d_gethent='$d_gethent' | |
2304df62 | 7681 | d_gethname='$d_gethname' |
a0d0e21e | 7682 | d_getlogin='$d_getlogin' |
2304df62 AD |
7683 | d_getpgrp2='$d_getpgrp2' |
7684 | d_getpgrp='$d_getpgrp' | |
a0d0e21e | 7685 | d_getppid='$d_getppid' |
2304df62 AD |
7686 | d_getprior='$d_getprior' |
7687 | d_htonl='$d_htonl' | |
ecfc5424 | 7688 | d_index='$d_index' |
2304df62 AD |
7689 | d_isascii='$d_isascii' |
7690 | d_killpg='$d_killpg' | |
7691 | d_link='$d_link' | |
a0d0e21e LW |
7692 | d_linuxstd='$d_linuxstd' |
7693 | d_locconv='$d_locconv' | |
7694 | d_lockf='$d_lockf' | |
2304df62 | 7695 | d_lstat='$d_lstat' |
a0d0e21e LW |
7696 | d_mblen='$d_mblen' |
7697 | d_mbstowcs='$d_mbstowcs' | |
7698 | d_mbtowc='$d_mbtowc' | |
2304df62 AD |
7699 | d_memcmp='$d_memcmp' |
7700 | d_memcpy='$d_memcpy' | |
7701 | d_memmove='$d_memmove' | |
7702 | d_memset='$d_memset' | |
7703 | d_mkdir='$d_mkdir' | |
a0d0e21e LW |
7704 | d_mkfifo='$d_mkfifo' |
7705 | d_mktime='$d_mktime' | |
2304df62 AD |
7706 | d_msg='$d_msg' |
7707 | d_msgctl='$d_msgctl' | |
7708 | d_msgget='$d_msgget' | |
7709 | d_msgrcv='$d_msgrcv' | |
7710 | d_msgsnd='$d_msgsnd' | |
ecfc5424 | 7711 | d_mymalloc='$d_mymalloc' |
a0d0e21e | 7712 | d_nice='$d_nice' |
ecfc5424 | 7713 | d_oldsock='$d_oldsock' |
2304df62 | 7714 | d_open3='$d_open3' |
a0d0e21e LW |
7715 | d_pathconf='$d_pathconf' |
7716 | d_pause='$d_pause' | |
ecfc5424 | 7717 | d_phostname='$d_phostname' |
a0d0e21e | 7718 | d_pipe='$d_pipe' |
2304df62 | 7719 | d_portable='$d_portable' |
ecfc5424 AD |
7720 | d_pwage='$d_pwage' |
7721 | d_pwchange='$d_pwchange' | |
7722 | d_pwclass='$d_pwclass' | |
7723 | d_pwcomment='$d_pwcomment' | |
7724 | d_pwexpire='$d_pwexpire' | |
7725 | d_pwquota='$d_pwquota' | |
2304df62 | 7726 | d_readdir='$d_readdir' |
a0d0e21e | 7727 | d_readlink='$d_readlink' |
2304df62 | 7728 | d_rename='$d_rename' |
ecfc5424 | 7729 | d_rewinddir='$d_rewinddir' |
2304df62 AD |
7730 | d_rmdir='$d_rmdir' |
7731 | d_safebcpy='$d_safebcpy' | |
7732 | d_safemcpy='$d_safemcpy' | |
ecfc5424 | 7733 | d_seekdir='$d_seekdir' |
2304df62 AD |
7734 | d_select='$d_select' |
7735 | d_sem='$d_sem' | |
7736 | d_semctl='$d_semctl' | |
7737 | d_semget='$d_semget' | |
7738 | d_semop='$d_semop' | |
7739 | d_setegid='$d_setegid' | |
7740 | d_seteuid='$d_seteuid' | |
a0d0e21e | 7741 | d_setlinebuf='$d_setlinebuf' |
2304df62 AD |
7742 | d_setlocale='$d_setlocale' |
7743 | d_setpgid='$d_setpgid' | |
7744 | d_setpgrp2='$d_setpgrp2' | |
2304df62 AD |
7745 | d_setpgrp='$d_setpgrp' |
7746 | d_setprior='$d_setprior' | |
7747 | d_setregid='$d_setregid' | |
7748 | d_setresgid='$d_setresgid' | |
7749 | d_setresuid='$d_setresuid' | |
7750 | d_setreuid='$d_setreuid' | |
7751 | d_setrgid='$d_setrgid' | |
7752 | d_setruid='$d_setruid' | |
7753 | d_setsid='$d_setsid' | |
7754 | d_shm='$d_shm' | |
7755 | d_shmat='$d_shmat' | |
a0d0e21e | 7756 | d_shmatprototype='$d_shmatprototype' |
2304df62 AD |
7757 | d_shmctl='$d_shmctl' |
7758 | d_shmdt='$d_shmdt' | |
7759 | d_shmget='$d_shmget' | |
ecfc5424 | 7760 | d_shrplib='$d_shrplib' |
2304df62 AD |
7761 | d_socket='$d_socket' |
7762 | d_sockpair='$d_sockpair' | |
2304df62 AD |
7763 | d_statblks='$d_statblks' |
7764 | d_stdstdio='$d_stdstdio' | |
2304df62 | 7765 | d_strchr='$d_strchr' |
a0d0e21e | 7766 | d_strcoll='$d_strcoll' |
2304df62 AD |
7767 | d_strctcpy='$d_strctcpy' |
7768 | d_strerrm='$d_strerrm' | |
7769 | d_strerror='$d_strerror' | |
a0d0e21e | 7770 | d_strxfrm='$d_strxfrm' |
ecfc5424 | 7771 | d_suidsafe='$d_suidsafe' |
2304df62 AD |
7772 | d_symlink='$d_symlink' |
7773 | d_syscall='$d_syscall' | |
a0d0e21e | 7774 | d_sysconf='$d_sysconf' |
ecfc5424 AD |
7775 | d_sysernlst='$d_sysernlst' |
7776 | d_syserrlst='$d_syserrlst' | |
2304df62 | 7777 | d_system='$d_system' |
a0d0e21e LW |
7778 | d_tcgetpgrp='$d_tcgetpgrp' |
7779 | d_tcsetpgrp='$d_tcsetpgrp' | |
ecfc5424 | 7780 | d_telldir='$d_telldir' |
85e6fe83 | 7781 | d_time='$d_time' |
2304df62 AD |
7782 | d_times='$d_times' |
7783 | d_truncate='$d_truncate' | |
a0d0e21e LW |
7784 | d_tzname='$d_tzname' |
7785 | d_umask='$d_umask' | |
ecfc5424 | 7786 | d_uname='$d_uname' |
2304df62 | 7787 | d_vfork='$d_vfork' |
ecfc5424 | 7788 | d_void_closedir='$d_void_closedir' |
2304df62 | 7789 | d_voidsig='$d_voidsig' |
ecfc5424 | 7790 | d_voidtty='$d_voidtty' |
2304df62 | 7791 | d_volatile='$d_volatile' |
2304df62 AD |
7792 | d_vprintf='$d_vprintf' |
7793 | d_wait4='$d_wait4' | |
7794 | d_waitpid='$d_waitpid' | |
a0d0e21e LW |
7795 | d_wcstombs='$d_wcstombs' |
7796 | d_wctomb='$d_wctomb' | |
ecfc5424 AD |
7797 | d_xenix='$d_xenix' |
7798 | date='$date' | |
7799 | db_hashtype='$db_hashtype' | |
7800 | db_prefixtype='$db_prefixtype' | |
7801 | defvoidused='$defvoidused' | |
7802 | direntrytype='$direntrytype' | |
a0d0e21e | 7803 | dlext='$dlext' |
2304df62 | 7804 | dlsrc='$dlsrc' |
ecfc5424 AD |
7805 | dynamic_ext='$dynamic_ext' |
7806 | echo='$echo' | |
7807 | egrep='$egrep' | |
7808 | emacs='$emacs' | |
7809 | eunicefix='$eunicefix' | |
7810 | expr='$expr' | |
7811 | extensions='$extensions' | |
7812 | find='$find' | |
7813 | flex='$flex' | |
a0d0e21e | 7814 | fpostype='$fpostype' |
1aef975c AD |
7815 | full_csh='$full_csh' |
7816 | full_sed='$full_sed' | |
ecfc5424 AD |
7817 | gcc='$gcc' |
7818 | gccversion='$gccversion' | |
2304df62 | 7819 | gidtype='$gidtype' |
ecfc5424 AD |
7820 | glibpth='$glibpth' |
7821 | grep='$grep' | |
7822 | groupcat='$groupcat' | |
2304df62 AD |
7823 | groupstype='$groupstype' |
7824 | h_fcntl='$h_fcntl' | |
7825 | h_sysfile='$h_sysfile' | |
ecfc5424 AD |
7826 | hint='$hint' |
7827 | hostcat='$hostcat' | |
7828 | huge='$huge' | |
7829 | i_bsdioctl='$i_bsdioctl' | |
a0d0e21e | 7830 | i_db='$i_db' |
2304df62 | 7831 | i_dbm='$i_dbm' |
2304df62 | 7832 | i_dirent='$i_dirent' |
a0d0e21e | 7833 | i_dld='$i_dld' |
2304df62 AD |
7834 | i_dlfcn='$i_dlfcn' |
7835 | i_fcntl='$i_fcntl' | |
a0d0e21e | 7836 | i_float='$i_float' |
2304df62 AD |
7837 | i_gdbm='$i_gdbm' |
7838 | i_grp='$i_grp' | |
a0d0e21e LW |
7839 | i_limits='$i_limits' |
7840 | i_malloc='$i_malloc' | |
7841 | i_math='$i_math' | |
85e6fe83 | 7842 | i_memory='$i_memory' |
2304df62 | 7843 | i_ndbm='$i_ndbm' |
85e6fe83 | 7844 | i_neterrno='$i_neterrno' |
2304df62 | 7845 | i_niin='$i_niin' |
2304df62 | 7846 | i_pwd='$i_pwd' |
ecfc5424 AD |
7847 | i_sgtty='$i_sgtty' |
7848 | i_stdarg='$i_stdarg' | |
2304df62 | 7849 | i_stddef='$i_stddef' |
a0d0e21e | 7850 | i_stdlib='$i_stdlib' |
2304df62 | 7851 | i_string='$i_string' |
2304df62 AD |
7852 | i_sysdir='$i_sysdir' |
7853 | i_sysfile='$i_sysfile' | |
a0d0e21e | 7854 | i_sysfilio='$i_sysfilio' |
ecfc5424 | 7855 | i_sysin='$i_sysin' |
2304df62 | 7856 | i_sysioctl='$i_sysioctl' |
2304df62 | 7857 | i_sysndir='$i_sysndir' |
a0d0e21e | 7858 | i_sysparam='$i_sysparam' |
2304df62 | 7859 | i_sysselct='$i_sysselct' |
ecfc5424 | 7860 | i_syssockio='$i_syssockio' |
1aef975c | 7861 | i_sysstat='$i_sysstat' |
ecfc5424 AD |
7862 | i_systime='$i_systime' |
7863 | i_systimek='$i_systimek' | |
a0d0e21e | 7864 | i_systimes='$i_systimes' |
2304df62 AD |
7865 | i_termio='$i_termio' |
7866 | i_termios='$i_termios' | |
2304df62 | 7867 | i_time='$i_time' |
85e6fe83 | 7868 | i_unistd='$i_unistd' |
2304df62 AD |
7869 | i_utime='$i_utime' |
7870 | i_varargs='$i_varargs' | |
7871 | i_varhdr='$i_varhdr' | |
7872 | i_vfork='$i_vfork' | |
ecfc5424 AD |
7873 | incpath='$incpath' |
7874 | inews='$inews' | |
7875 | installarchlib='$installarchlib' | |
7876 | installbin='$installbin' | |
7877 | installmansrc='$installmansrc' | |
7878 | installprivlib='$installprivlib' | |
7879 | installscript='$installscript' | |
2304df62 | 7880 | intsize='$intsize' |
ecfc5424 AD |
7881 | known_extensions='$known_extensions' |
7882 | ksh='$ksh' | |
7883 | large='$large' | |
7884 | lddlflags='$lddlflags' | |
7885 | ldflags='$ldflags' | |
7886 | less='$less' | |
2304df62 AD |
7887 | libc='$libc' |
7888 | libpth='$libpth' | |
2304df62 | 7889 | libs='$libs' |
ecfc5424 AD |
7890 | libswanted='$libswanted' |
7891 | line='$line' | |
7892 | lint='$lint' | |
7893 | lkflags='$lkflags' | |
7894 | ln='$ln' | |
85e6fe83 | 7895 | lns='$lns' |
ecfc5424 AD |
7896 | lp='$lp' |
7897 | lpr='$lpr' | |
7898 | ls='$ls' | |
85e6fe83 | 7899 | lseektype='$lseektype' |
ecfc5424 AD |
7900 | mail='$mail' |
7901 | mailx='$mailx' | |
7902 | make='$make' | |
2304df62 AD |
7903 | mallocobj='$mallocobj' |
7904 | mallocsrc='$mallocsrc' | |
7905 | malloctype='$malloctype' | |
2304df62 AD |
7906 | manext='$manext' |
7907 | mansrc='$mansrc' | |
7908 | mansrcexp='$mansrcexp' | |
2304df62 | 7909 | medium='$medium' |
ecfc5424 AD |
7910 | mips='$mips' |
7911 | mips_type='$mips_type' | |
7912 | mkdir='$mkdir' | |
2304df62 | 7913 | models='$models' |
a0d0e21e | 7914 | modetype='$modetype' |
ecfc5424 AD |
7915 | more='$more' |
7916 | mv='$mv' | |
2304df62 AD |
7917 | mydomain='$mydomain' |
7918 | myhostname='$myhostname' | |
ecfc5424 | 7919 | myuname='$myuname' |
2304df62 | 7920 | n='$n' |
ecfc5424 AD |
7921 | nm_opt='$nm_opt' |
7922 | nroff='$nroff' | |
7923 | optimize='$optimize' | |
85e6fe83 | 7924 | orderlib='$orderlib' |
ecfc5424 AD |
7925 | osname='$osname' |
7926 | osvers='$osvers' | |
2304df62 | 7927 | package='$package' |
ecfc5424 AD |
7928 | passcat='$passcat' |
7929 | patchlevel='$patchlevel' | |
7930 | perl='$perl' | |
7931 | pg='$pg' | |
7932 | phostname='$phostname' | |
7933 | plibpth='$plibpth' | |
7934 | pmake='$pmake' | |
7935 | pr='$pr' | |
a0d0e21e | 7936 | prefix='$prefix' |
1aef975c | 7937 | prefixexp='$prefixexp' |
2304df62 AD |
7938 | privlib='$privlib' |
7939 | privlibexp='$privlibexp' | |
7940 | prototype='$prototype' | |
7941 | randbits='$randbits' | |
ecfc5424 AD |
7942 | ranlib='$ranlib' |
7943 | rm='$rm' | |
7944 | rmail='$rmail' | |
7945 | runnm='$runnm' | |
2304df62 AD |
7946 | scriptdir='$scriptdir' |
7947 | scriptdirexp='$scriptdirexp' | |
ecfc5424 | 7948 | sed='$sed' |
a0d0e21e | 7949 | selecttype='$selecttype' |
ecfc5424 AD |
7950 | sendmail='$sendmail' |
7951 | sh='$sh' | |
7952 | shar='$shar' | |
7953 | sharpbang='$sharpbang' | |
7954 | shmattype='$shmattype' | |
7955 | shrpdir='$shrpdir' | |
7956 | shsharp='$shsharp' | |
2304df62 | 7957 | sig_name='$sig_name' |
ecfc5424 | 7958 | signal_t='$signal_t' |
a0d0e21e | 7959 | sizetype='$sizetype' |
ecfc5424 AD |
7960 | sleep='$sleep' |
7961 | smail='$smail' | |
7962 | small='$small' | |
a0d0e21e | 7963 | so='$so' |
ecfc5424 AD |
7964 | sockethdr='$sockethdr' |
7965 | socketlib='$socketlib' | |
7966 | sort='$sort' | |
7967 | spackage='$spackage' | |
2304df62 | 7968 | spitshell='$spitshell' |
ecfc5424 | 7969 | split='$split' |
a0d0e21e | 7970 | ssizetype='$ssizetype' |
2304df62 | 7971 | startsh='$startsh' |
ecfc5424 | 7972 | static_ext='$static_ext' |
2304df62 | 7973 | stdchar='$stdchar' |
ecfc5424 AD |
7974 | strings='$strings' |
7975 | submit='$submit' | |
2304df62 | 7976 | sysman='$sysman' |
ecfc5424 AD |
7977 | tail='$tail' |
7978 | tar='$tar' | |
7979 | tbl='$tbl' | |
7980 | test='$test' | |
7981 | timeincl='$timeincl' | |
7982 | timetype='$timetype' | |
7983 | touch='$touch' | |
7984 | tr='$tr' | |
7985 | troff='$troff' | |
2304df62 | 7986 | uidtype='$uidtype' |
ecfc5424 AD |
7987 | uname='$uname' |
7988 | uniq='$uniq' | |
7989 | usedl='$usedl' | |
7990 | usemymalloc='$usemymalloc' | |
2304df62 | 7991 | usenm='$usenm' |
ecfc5424 AD |
7992 | useposix='$useposix' |
7993 | usevfork='$usevfork' | |
2304df62 | 7994 | usrinc='$usrinc' |
ecfc5424 AD |
7995 | uuname='$uuname' |
7996 | vi='$vi' | |
2304df62 | 7997 | voidflags='$voidflags' |
ecfc5424 AD |
7998 | xlibpth='$xlibpth' |
7999 | zcat='$zcat' | |
2304df62 AD |
8000 | EOT |
8001 | ||
8002 | : add special variables | |
8003 | $test -f patchlevel.h && \ | |
8004 | awk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh | |
8005 | echo "CONFIG=true" >>config.sh | |
8006 | ||
8007 | : propagate old symbols | |
8008 | if $test -f UU/config.sh; then | |
8009 | <UU/config.sh sort | uniq >UU/oldconfig.sh | |
8010 | sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\ | |
8011 | sort | uniq -u >UU/oldsyms | |
8012 | set X `cat UU/oldsyms` | |
8013 | shift | |
8014 | case $# in | |
8015 | 0) ;; | |
8016 | *) | |
8017 | cat <<EOM | |
8018 | Hmm...You had some extra variables I don't know about...I'll try to keep 'em... | |
8019 | EOM | |
8020 | echo "# Variables propagated from previous config.sh file." >>config.sh | |
8021 | for sym in `cat UU/oldsyms`; do | |
8022 | echo " Propagating $hint variable "'$'"$sym..." | |
8023 | eval 'tmp="$'"${sym}"'"' | |
8024 | echo "$tmp" | \ | |
8025 | sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh | |
8026 | done | |
8027 | ;; | |
8028 | esac | |
8029 | fi | |
8030 | ||
8031 | : Finish up by extracting the .SH files | |
8032 | case "$alldone" in | |
8033 | exit) | |
8034 | $rm -rf UU | |
8035 | echo "Done." | |
8036 | exit 0 | |
8037 | ;; | |
8038 | cont) | |
8039 | ;; | |
8040 | '') | |
8041 | echo " " | |
8042 | dflt='' | |
8043 | nostick=true | |
8044 | echo "If you didn't make any mistakes, then just type a carriage return here." | |
8045 | rp="If you need to edit config.sh, do it as a shell escape here:" | |
8046 | . UU/myread | |
8047 | nostick='' | |
8048 | case "$ans" in | |
8049 | '') ;; | |
8050 | *) : in case they cannot read | |
8051 | sh 1>&4 -c "$ans";; | |
8052 | esac | |
8053 | ;; | |
8054 | esac | |
8055 | ||
8056 | : if this fails, just run all the .SH files by hand | |
8057 | . ./config.sh | |
8058 | ||
8059 | echo " " | |
8060 | exec 1>&4 | |
8061 | . ./UU/extract | |
8062 | ||
8063 | if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then | |
8064 | dflt=y | |
8065 | case "$silent" in | |
8066 | true) ;; | |
8067 | *) | |
8068 | $cat <<EOM | |
8069 | ||
8070 | Now you need to generate make dependencies by running "make depend". | |
8071 | You might prefer to run it in background: "make depend > makedepend.out &" | |
8072 | It can take a while, so you might not want to run it right now. | |
8073 | ||
8074 | EOM | |
8075 | ;; | |
8076 | esac | |
8077 | rp="Run make depend now?" | |
8078 | . UU/myread | |
8079 | case "$ans" in | |
8080 | y*) | |
8081 | make depend && echo "Now you must run a make." | |
8082 | ;; | |
8083 | *) | |
8084 | echo "You must run 'make depend' then 'make'." | |
8085 | ;; | |
8086 | esac | |
8087 | elif test -f [Mm]akefile; then | |
8088 | echo " " | |
8089 | echo "Now you must run a make." | |
8090 | else | |
8091 | echo "Done." | |
8092 | fi | |
8093 | ||
8094 | $rm -f kit*isdone ark*isdone | |
8095 | $rm -rf UU | |
a0d0e21e | 8096 | |
2304df62 | 8097 | : End of Configure |
a0d0e21e | 8098 |