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