applied patch, modified logic to avoid reentering lexer at compile-time
[p5sagit/p5-mst-13.2.git] / Configure
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 and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Tue Jun  9 14:56:54 EDT 1998 [metaconfig 3.0 PL70]
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
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 : Proper separator for the PATH environment variable
59 p_=:
60 : On OS/2 this directory should exist if this is not floppy only system :-]
61 if test -d c:/. ; then
62     if test -n "$OS2_SHELL"; then
63                 p_=\;
64                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
65                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
66         elif test -n "$DJGPP"; then
67                 p_=\;
68         fi
69 fi
70
71 : Proper PATH setting
72 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
73 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
74 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
75 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
76 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
77 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
78 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
79 paths="$paths /sbin /usr/sbin /usr/libexec"
80
81 for p in $paths
82 do
83         case "$p_$PATH$p_" in
84         *$p_$p$p_*) ;;
85         *) test -d $p && PATH=$PATH$p_$p ;;
86         esac
87 done
88
89 PATH=.$p_$PATH
90 export PATH
91
92 : shall we be using ksh?
93 inksh=''
94 needksh=''
95 avoidksh=''
96 newsh=/bin/ksh
97 changesh=''
98 if (PATH=.; alias -x) >/dev/null 2>&1; then
99                 inksh=true
100 fi
101 if test -f /hp-ux -a -f /bin/ksh; then
102         needksh='to avoid sh bug in "here document" expansion'
103 fi
104 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
105         if test X`/usr/bin/uname -v` = X4; then
106                 avoidksh="to avoid AIX 4's /bin/sh"
107                 newsh=/usr/bin/bsh
108         fi
109 fi
110 case "$inksh/$needksh" in
111 /[a-z]*)
112                 ENV=''
113                 changesh=true
114                 reason="$needksh"
115         ;;
116 esac
117 case "$inksh/$avoidksh" in
118 true/[a-z]*)
119         changesh=true
120         reason="$avoidksh"
121         ;;
122 esac
123 case "$inksh/$needksh-$avoidksh-" in
124 true/--)
125                 cat <<EOM
126 (I see you are using the Korn shell.  Some ksh's blow up on $me,
127 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
128 EOM
129         ;;
130 esac
131 case "$changesh" in
132 true)
133         echo "(Feeding myself to $newsh $reason.)"
134         case "$0" in
135         Configure|*/Configure) exec $newsh $0 "$@";;
136         *) exec $newsh Configure "$@";;
137         esac
138         ;;
139 esac
140
141 : Configure runs within the UU subdirectory
142 test -d UU || mkdir UU
143 CDPATH='.'
144 cd UU && rm -f ./*
145
146 dynamic_ext=''
147 extensions=''
148 known_extensions=''
149 static_ext=''
150 nonxs_ext=''
151 useopcode=''
152 useposix=''
153 d_bsd=''
154 d_eunice=''
155 d_xenix=''
156 eunicefix=''
157 Mcc=''
158 ar=''
159 awk=''
160 bash=''
161 bison=''
162 byacc=''
163 cat=''
164 chgrp=''
165 chmod=''
166 chown=''
167 comm=''
168 compress=''
169 cp=''
170 cpio=''
171 cpp=''
172 csh=''
173 date=''
174 echo=''
175 egrep=''
176 emacs=''
177 expr=''
178 find=''
179 flex=''
180 grep=''
181 gzip=''
182 inews=''
183 ksh=''
184 less=''
185 line=''
186 lint=''
187 ln=''
188 lp=''
189 lpr=''
190 ls=''
191 mail=''
192 mailx=''
193 make=''
194 mkdir=''
195 more=''
196 mv=''
197 nm=''
198 nroff=''
199 perl=''
200 pg=''
201 pmake=''
202 pr=''
203 rm=''
204 rmail=''
205 sed=''
206 sendmail=''
207 shar=''
208 sleep=''
209 smail=''
210 sort=''
211 submit=''
212 tail=''
213 tar=''
214 tbl=''
215 tee=''
216 test=''
217 touch=''
218 tr=''
219 troff=''
220 uname=''
221 uniq=''
222 uuname=''
223 vi=''
224 zcat=''
225 zip=''
226 full_sed=''
227 libswanted=''
228 hint=''
229 myuname=''
230 osname=''
231 osvers=''
232 Author=''
233 Date=''
234 Header=''
235 Id=''
236 Locker=''
237 Log=''
238 RCSfile=''
239 Revision=''
240 Source=''
241 State=''
242 _a=''
243 _exe=''
244 _o=''
245 archobjs=''
246 exe_ext=''
247 firstmakefile=''
248 lib_ext=''
249 obj_ext=''
250 path_sep=''
251 afs=''
252 alignbytes=''
253 ansi2knr=''
254 archlib=''
255 archlibexp=''
256 d_archlib=''
257 installarchlib=''
258 archname=''
259 myarchname=''
260 baserev=''
261 bin=''
262 binexp=''
263 installbin=''
264 byteorder=''
265 cc=''
266 gccversion=''
267 ccflags=''
268 cppflags=''
269 ldflags=''
270 lkflags=''
271 locincpth=''
272 optimize=''
273 cf_email=''
274 cf_by=''
275 cf_time=''
276 contains=''
277 cpp_stuff=''
278 cpplast=''
279 cppminus=''
280 cpprun=''
281 cppstdin=''
282 d_access=''
283 d_alarm=''
284 d_attribut=''
285 d_bcmp=''
286 d_bcopy=''
287 d_bzero=''
288 d_casti32=''
289 castflags=''
290 d_castneg=''
291 d_chown=''
292 d_chroot=''
293 d_chsize=''
294 d_closedir=''
295 d_void_closedir=''
296 d_const=''
297 cryptlib=''
298 d_crypt=''
299 d_csh=''
300 full_csh=''
301 d_cuserid=''
302 d_dbl_dig=''
303 d_difftime=''
304 d_dlerror=''
305 d_dlopen=''
306 d_dlsymun=''
307 d_dosuid=''
308 d_suidsafe=''
309 d_dup2=''
310 d_endhent=''
311 d_endnent=''
312 d_endpent=''
313 d_endsent=''
314 d_fchmod=''
315 d_fchown=''
316 d_fcntl=''
317 d_fd_macros=''
318 d_fd_set=''
319 d_fds_bits=''
320 d_fgetpos=''
321 d_flexfnam=''
322 d_flock=''
323 d_fork=''
324 d_fsetpos=''
325 d_ftime=''
326 d_gettimeod=''
327 d_Gconvert=''
328 d_getgrps=''
329 d_gethbyaddr=''
330 d_gethbyname=''
331 d_gethent=''
332 aphostname=''
333 d_gethname=''
334 d_phostname=''
335 d_uname=''
336 d_gethostprotos=''
337 d_getlogin=''
338 d_getnbyaddr=''
339 d_getnbyname=''
340 d_getnent=''
341 d_getnetprotos=''
342 d_getpent=''
343 d_getpgid=''
344 d_getpgrp2=''
345 d_bsdgetpgrp=''
346 d_getpgrp=''
347 d_getppid=''
348 d_getprior=''
349 d_getpbyname=''
350 d_getpbynumber=''
351 d_getprotoprotos=''
352 d_getsent=''
353 d_getservprotos=''
354 d_getsbyname=''
355 d_getsbyport=''
356 d_gnulibc=''
357 d_htonl=''
358 d_inetaton=''
359 d_isascii=''
360 d_killpg=''
361 d_lchown=''
362 d_link=''
363 d_locconv=''
364 d_lockf=''
365 d_longdbl=''
366 longdblsize=''
367 d_longlong=''
368 longlongsize=''
369 d_lstat=''
370 d_mblen=''
371 d_mbstowcs=''
372 d_mbtowc=''
373 d_memcmp=''
374 d_memcpy=''
375 d_memmove=''
376 d_memset=''
377 d_mkdir=''
378 d_mkfifo=''
379 d_mktime=''
380 d_msg=''
381 d_msgctl=''
382 d_msgget=''
383 d_msgrcv=''
384 d_msgsnd=''
385 d_nice=''
386 d_open3=''
387 d_fpathconf=''
388 d_pathconf=''
389 d_pause=''
390 d_pipe=''
391 d_poll=''
392 d_portable=''
393 d_pthread_yield=''
394 d_sched_yield=''
395 d_pthreads_created_joinable=''
396 d_readdir=''
397 d_rewinddir=''
398 d_seekdir=''
399 d_telldir=''
400 d_readlink=''
401 d_rename=''
402 d_rmdir=''
403 d_safebcpy=''
404 d_safemcpy=''
405 d_sanemcmp=''
406 d_select=''
407 d_sem=''
408 d_semctl=''
409 d_semget=''
410 d_semop=''
411 d_setegid=''
412 d_seteuid=''
413 d_setgrps=''
414 d_sethent=''
415 d_setlinebuf=''
416 d_setlocale=''
417 d_setnent=''
418 d_setpent=''
419 d_setpgid=''
420 d_setpgrp2=''
421 d_bsdsetpgrp=''
422 d_setpgrp=''
423 d_setprior=''
424 d_setregid=''
425 d_setresgid=''
426 d_setresuid=''
427 d_setreuid=''
428 d_setrgid=''
429 d_setruid=''
430 d_setsent=''
431 d_setsid=''
432 d_setvbuf=''
433 d_sfio=''
434 usesfio=''
435 d_shm=''
436 d_shmat=''
437 d_shmatprototype=''
438 shmattype=''
439 d_shmctl=''
440 d_shmdt=''
441 d_shmget=''
442 d_sigaction=''
443 d_sigsetjmp=''
444 d_oldsock=''
445 d_socket=''
446 d_sockpair=''
447 sockethdr=''
448 socketlib=''
449 d_statblks=''
450 d_stdio_cnt_lval=''
451 d_stdio_ptr_lval=''
452 d_stdiobase=''
453 d_stdstdio=''
454 stdio_base=''
455 stdio_bufsiz=''
456 stdio_cnt=''
457 stdio_filbuf=''
458 stdio_ptr=''
459 d_index=''
460 d_strchr=''
461 d_strcoll=''
462 d_strctcpy=''
463 d_strerrm=''
464 d_strerror=''
465 d_sysernlst=''
466 d_syserrlst=''
467 d_strtod=''
468 d_strtol=''
469 d_strtoul=''
470 d_strxfrm=''
471 d_symlink=''
472 d_syscall=''
473 d_sysconf=''
474 d_system=''
475 d_tcgetpgrp=''
476 d_tcsetpgrp=''
477 d_time=''
478 timetype=''
479 clocktype=''
480 d_times=''
481 d_truncate=''
482 d_tzname=''
483 d_umask=''
484 d_semctl_semid_ds=''
485 d_semctl_semun=''
486 d_union_semun=''
487 d_vfork=''
488 usevfork=''
489 d_voidsig=''
490 signal_t=''
491 d_volatile=''
492 d_charvspr=''
493 d_vprintf=''
494 d_wait4=''
495 d_waitpid=''
496 d_wcstombs=''
497 d_wctomb=''
498 dlext=''
499 cccdlflags=''
500 ccdlflags=''
501 dlsrc=''
502 ld=''
503 lddlflags=''
504 usedl=''
505 doublesize=''
506 fpostype=''
507 gidtype=''
508 groupstype=''
509 h_fcntl=''
510 h_sysfile=''
511 db_hashtype=''
512 db_prefixtype=''
513 i_db=''
514 i_dbm=''
515 i_rpcsvcdbm=''
516 d_dirnamlen=''
517 direntrytype=''
518 i_dirent=''
519 i_dld=''
520 i_dlfcn=''
521 i_fcntl=''
522 i_float=''
523 i_gdbm=''
524 i_grp=''
525 i_limits=''
526 i_locale=''
527 i_malloc=''
528 i_math=''
529 i_memory=''
530 i_ndbm=''
531 i_netdb=''
532 i_neterrno=''
533 i_niin=''
534 i_sysin=''
535 d_pwage=''
536 d_pwchange=''
537 d_pwclass=''
538 d_pwcomment=''
539 d_pwexpire=''
540 d_pwgecos=''
541 d_pwquota=''
542 i_pwd=''
543 i_sfio=''
544 i_stddef=''
545 i_stdlib=''
546 i_string=''
547 strings=''
548 i_sysdir=''
549 i_sysfile=''
550 d_voidtty=''
551 i_bsdioctl=''
552 i_sysfilio=''
553 i_sysioctl=''
554 i_syssockio=''
555 i_sysndir=''
556 i_sysparam=''
557 i_sysresrc=''
558 i_sysselct=''
559 i_sysstat=''
560 i_systimes=''
561 i_systypes=''
562 i_sysun=''
563 i_syswait=''
564 i_sgtty=''
565 i_termio=''
566 i_termios=''
567 i_systime=''
568 i_systimek=''
569 i_time=''
570 timeincl=''
571 i_unistd=''
572 i_utime=''
573 i_values=''
574 i_stdarg=''
575 i_varargs=''
576 i_varhdr=''
577 i_vfork=''
578 intsize=''
579 longsize=''
580 shortsize=''
581 libc=''
582 libperl=''
583 shrpenv=''
584 useshrplib=''
585 glibpth=''
586 libpth=''
587 loclibpth=''
588 plibpth=''
589 xlibpth=''
590 libs=''
591 lns=''
592 lseektype=''
593 make_set_make=''
594 d_mymalloc=''
595 freetype=''
596 mallocobj=''
597 mallocsrc=''
598 malloctype=''
599 usemymalloc=''
600 installman1dir=''
601 man1dir=''
602 man1direxp=''
603 man1ext=''
604 installman3dir=''
605 man3dir=''
606 man3direxp=''
607 man3ext=''
608 huge=''
609 large=''
610 medium=''
611 models=''
612 small=''
613 split=''
614 modetype=''
615 mydomain=''
616 myhostname=''
617 phostname=''
618 c=''
619 n=''
620 d_eofnblk=''
621 eagain=''
622 o_nonblock=''
623 rd_nodata=''
624 netdb_hlen_type=''
625 netdb_host_type=''
626 netdb_name_type=''
627 netdb_net_type=''
628 groupcat=''
629 hostcat=''
630 passcat=''
631 orderlib=''
632 ranlib=''
633 package=''
634 spackage=''
635 pager=''
636 patchlevel=''
637 subversion=''
638 perladmin=''
639 perlpath=''
640 pidtype=''
641 prefix=''
642 prefixexp=''
643 installprivlib=''
644 privlib=''
645 privlibexp=''
646 prototype=''
647 ptrsize=''
648 randbits=''
649 installscript=''
650 scriptdir=''
651 scriptdirexp=''
652 selecttype=''
653 sh=''
654 sig_name=''
655 sig_name_init=''
656 sig_num=''
657 installsitearch=''
658 sitearch=''
659 sitearchexp=''
660 installsitelib=''
661 sitelib=''
662 sitelibexp=''
663 sizetype=''
664 so=''
665 sharpbang=''
666 shsharp=''
667 spitshell=''
668 src=''
669 ssizetype=''
670 startperl=''
671 startsh=''
672 stdchar=''
673 sysman=''
674 uidtype=''
675 nm_opt=''
676 nm_so_opt=''
677 runnm=''
678 usenm=''
679 useperlio=''
680 d_oldpthreads=''
681 usethreads=''
682 incpath=''
683 mips=''
684 mips_type=''
685 usrinc=''
686 defvoidused=''
687 voidflags=''
688 CONFIG=''
689
690 define='define'
691 undef='undef'
692 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
693 rmlist=''
694
695 : We must find out about Eunice early
696 eunicefix=':'
697 if test -f /etc/unixtovms; then
698         eunicefix=/etc/unixtovms
699 fi
700 if test -f /etc/unixtovms.exe; then
701         eunicefix=/etc/unixtovms.exe
702 fi
703
704 : list of known cpp symbols, sorted alphabetically
705 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
706 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
707 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
708 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
709 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
710 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
711 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
712 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
713 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
714 al="$al VMS Xenix286"
715 al="$al _AIX _AIX32 _AIX370 _AM29000 _COFF _CRAY _CX_UX _EPI"
716 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET"
717 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
718 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
719 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
720 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
721 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
722 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
723 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
724 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
725 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
726 al="$al __SVR4_2__ __UMAXV__"
727 al="$al ____386BSD____ __alpha __alpha__ __amiga"
728 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
729 al="$al __host_mips__"
730 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
731 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
732 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
733 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
734 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
735 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
736 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
737 al="$al __mc88100 __mc88100__ __mips __mips__"
738 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
739 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
740 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
741 al="$al _host_mips _mips _unix"
742 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
743 al="$al apollo ardent att386 att3b"
744 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
745 al="$al cadmus clipper concurrent convex cray ctix"
746 al="$al dmert encore gcos gcx gimpel gould"
747 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
748 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
749 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
750 al="$al i186 i286 i386 i486 i8086"
751 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
752 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
753 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
754 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
755 al="$al mc88000 mc88100 merlin mert mips mvs n16"
756 al="$al ncl_el ncl_mr"
757 al="$al news1500 news1700 news1800 news1900 news3700"
758 al="$al news700 news800 news900 ns16000 ns32000"
759 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
760 al="$al parisc pc532 pdp11 plexus posix pyr"
761 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
762 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
763 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
764 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
765 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
766 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
767 al="$al xenix z8000"
768
769 i_whoami=''
770 : change the next line if compiling for Xenix/286 on Xenix/386
771 xlibpth='/usr/lib/386 /lib/386'
772
773 : Possible local library directories to search.
774 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
775 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
776
777 : general looking path for locating libraries
778 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
779 glibpth="$glibpth /lib /usr/lib $xlibpth"
780 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
781 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
782
783 : Private path used by Configure to find libraries.  Its value
784 : is prepended to libpth. This variable takes care of special
785 : machines, like the mips.  Usually, it should be empty.
786 plibpth=''
787
788 : default library list
789 libswanted=''
790 : full support for void wanted by default
791 defvoidused=15
792
793 : Possible local include directories to search.
794 : Set locincpth to "" in a hint file to defeat local include searches.
795 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
796 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
797 :
798 : no include file wanted by default
799 inclwanted=''
800
801 : Trailing extension.  Override this in a hint file, if needed.
802 _exe=''
803 : Extra object files, if any, needed on this platform.
804 archobjs=''
805 groupstype=''
806 : set useposix=false in your hint file to disable the POSIX extension.
807 useposix=true
808 : set useopcode=false in your hint file to disable the Opcode extension.
809 useopcode=true
810 : set usethreads on the Configure command line to enable threads.
811 : List of libraries we want.
812 : If anyone needs -lnet, put it in a hint file.
813 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
814 libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
815 libswanted="$libswanted ucb bsd BSD PW x"
816 : We probably want to search /usr/shlib before most other libraries.
817 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
818 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
819 glibpth="/usr/shlib $glibpth"
820 : Do not use vfork unless overridden by a hint file.
821 usevfork=false
822
823 : Find the basic shell for Bourne shell scripts
824 case "$sh" in
825 '')
826         case "$SYSTYPE" in
827         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
828         *) xxx='/bin/sh';;
829         esac
830         if test -f "$xxx"; then
831                 sh="$xxx"
832         else
833                 : Build up a list and do a single loop so we can 'break' out.
834                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
835                 for xxx in sh bash ksh pdksh ash; do
836                         for p in $pth; do
837                                 try="$try ${p}/${xxx}"
838                         done
839                 done
840                 for xxx in $try; do
841                         if test -f "$xxx"; then
842                                 sh="$xxx";
843                                 break
844                         elif test -f "$xxx.exe"; then
845                                 sh="$xxx";
846                                 break
847                         fi
848                 done
849         fi
850         ;;
851 esac
852
853 case "$sh" in
854 '')     cat <<EOM >&2
855 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
856
857 Usually it's in /bin/sh.  How did you even get this far?
858 Please contact me (Andy Dougherty) at doughera@lafcol.lafayette.edu and 
859 we'll try to straighten this all out.
860 EOM
861         exit 1
862         ;;
863 esac
864
865 : see if sh knows # comments
866 if `$sh -c '#' >/dev/null 2>&1`; then
867         shsharp=true
868         spitshell=cat
869         xcat=/bin/cat
870         test -f $xcat || xcat=/usr/bin/cat
871         echo "#!$xcat" >try
872         $eunicefix try
873         chmod +x try
874         ./try > today
875         if test -s today; then
876                 sharpbang='#!'
877         else
878                 echo "#! $xcat" > try
879                 $eunicefix try
880                 chmod +x try
881                 ./try > today
882                 if test -s today; then
883                         sharpbang='#! '
884                 else
885                         sharpbang=': use '
886                 fi
887         fi
888 else
889         echo " "
890         echo "Your $sh doesn't grok # comments--I will strip them later on."
891         shsharp=false
892         cd ..
893         echo "exec grep -v '^[  ]*#'" >spitshell
894         chmod +x spitshell
895         $eunicefix spitshell
896         spitshell=`pwd`/spitshell
897         cd UU
898         echo "I presume that if # doesn't work, #! won't work either!"
899         sharpbang=': use '
900 fi
901 rm -f try today
902
903 : figure out how to guarantee sh startup
904 case "$startsh" in
905 '') startsh=${sharpbang}${sh} ;;
906 *)
907 esac
908 cat >try <<EOSS
909 $startsh
910 set abc
911 test "$?abc" != 1
912 EOSS
913
914 chmod +x try
915 $eunicefix try
916 if ./try; then
917         : echo "Yup, it does."
918 else
919         echo "Hmm... '$startsh' does not guarantee sh startup..."
920         echo "You may have to fix up the shell scripts to make sure $sh runs them."
921 fi
922 rm -f try
923
924
925 : Save command line options in file UU/cmdline.opt for later use in
926 : generating config.sh.
927 cat > cmdline.opt <<EOSH
928 # Configure command line arguments.
929 config_arg0='$0'
930 config_args='$*'
931 config_argc=$#
932 EOSH
933 argn=1
934 for arg in "$@"; do
935         cat >>cmdline.opt <<EOSH
936 config_arg$argn='$arg'
937 EOSH
938         argn=`expr $argn + 1`
939 done
940
941 : produce awk script to parse command line options
942 cat >options.awk <<'EOF'
943 BEGIN {
944         optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
945
946         len = length(optstr);
947         for (i = 1; i <= len; i++) {
948                 c = substr(optstr, i, 1);
949                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
950                 if (a == ":") {
951                         arg[c] = 1;
952                         i++;
953                 }
954                 opt[c] = 1;
955         }
956 }
957 {
958         expect = 0;
959         str = $0;
960         if (substr(str, 1, 1) != "-") {
961                 printf("'%s'\n", str);
962                 next;
963         }
964         len = length($0);
965         for (i = 2; i <= len; i++) {
966                 c = substr(str, i, 1);
967                 if (!opt[c]) {
968                         printf("-%s\n", substr(str, i));
969                         next;
970                 }
971                 printf("-%s\n", c);
972                 if (arg[c]) {
973                         if (i < len)
974                                 printf("'%s'\n", substr(str, i + 1));
975                         else
976                                 expect = 1;
977                         next;
978                 }
979         }
980 }
981 END {
982         if (expect)
983                 print "?";
984 }
985 EOF
986
987 : process the command line options
988 set X `for arg in "$@"; do echo "X$arg"; done |
989         sed -e s/X// | awk -f options.awk`
990 eval "set $*"
991 shift
992 rm -f options.awk
993
994 : set up default values
995 fastread=''
996 reuseval=false
997 config_sh=''
998 alldone=''
999 error=''
1000 silent=''
1001 extractsh=''
1002 override=''
1003 knowitall=''
1004 rm -f optdef.sh
1005 cat >optdef.sh <<EOS
1006 $startsh
1007 EOS
1008
1009
1010 : option parsing
1011 while test $# -gt 0; do
1012         case "$1" in
1013         -d) shift; fastread=yes;;
1014         -e) shift; alldone=cont;;
1015         -f)
1016                 shift
1017                 cd ..
1018                 if test -r "$1"; then
1019                         config_sh="$1"
1020                 else
1021                         echo "$me: cannot read config file $1." >&2
1022                         error=true
1023                 fi
1024                 cd UU
1025                 shift;;
1026         -h) shift; error=true;;
1027         -r) shift; reuseval=true;;
1028         -s) shift; silent=true; realsilent=true;;
1029         -E) shift; alldone=exit;;
1030         -K) shift; knowitall=true;;
1031         -O) shift; override=true;;
1032         -S) shift; silent=true; extractsh=true;;
1033         -D)
1034                 shift
1035                 case "$1" in
1036                 *=)
1037                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1038                         echo "$me: ignoring -D $1" >&2
1039                         ;;
1040                 *=*) echo "$1" | \
1041                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1042                 *) echo "$1='define'" >> optdef.sh;;
1043                 esac
1044                 shift
1045                 ;;
1046         -U)
1047                 shift
1048                 case "$1" in
1049                 *=) echo "$1" >> optdef.sh;;
1050                 *=*)
1051                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1052                         echo "$me: ignoring -U $1" >&2
1053                         ;;
1054                 *) echo "$1='undef'" >> optdef.sh;;
1055                 esac
1056                 shift
1057                 ;;
1058         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1059                 exit 0;;
1060         --) break;;
1061         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1062         *) break;;
1063         esac
1064 done
1065
1066 case "$error" in
1067 true)
1068         cat >&2 <<EOM
1069 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1070                  [-U symbol] [-U symbol=]
1071   -d : use defaults for all answers.
1072   -e : go on without questioning past the production of config.sh.
1073   -f : specify an alternate default configuration file.
1074   -h : print this help message and exit (with an error status).
1075   -r : reuse C symbols value if possible (skips costly nm extraction).
1076   -s : silent mode, only echoes questions and essential information.
1077   -D : define symbol to have some value:
1078          -D symbol         symbol gets the value 'define'
1079          -D symbol=value   symbol gets the value 'value'
1080   -E : stop at the end of questions, after having produced config.sh.
1081   -K : do not use unless you know what you are doing.
1082   -O : let -D and -U override definitions from loaded configuration file.
1083   -S : perform variable substitutions on all .SH files (can mix with -f)
1084   -U : undefine symbol:
1085          -U symbol    symbol gets the value 'undef'
1086          -U symbol=   symbol gets completely empty
1087   -V : print version number and exit (with a zero status).
1088 EOM
1089         exit 1
1090         ;;
1091 esac
1092
1093 : Sanity checks
1094 case "$fastread$alldone" in
1095 yescont|yesexit) ;;
1096 *)
1097         if test ! -t 0; then
1098                 echo "Say 'sh Configure', not 'sh <Configure'"
1099                 exit 1
1100         fi
1101         ;;
1102 esac
1103
1104 exec 4>&1
1105 case "$silent" in
1106 true) exec 1>/dev/null;;
1107 esac
1108
1109 : run the defines and the undefines, if any, but leave the file out there...
1110 touch optdef.sh
1111 . ./optdef.sh
1112
1113 : set package name
1114 package=perl5
1115 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1116 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1117 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1118 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1119 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1120 esac
1121
1122 : Some greps do not return status, grrr.
1123 echo "grimblepritz" >grimble
1124 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1125         contains=contains
1126 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1127         contains=grep
1128 else
1129         contains=contains
1130 fi
1131 rm -f grimble
1132 : the following should work in any shell
1133 case "$contains" in
1134 contains*)
1135         echo " "
1136         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1137         cat >contains <<'EOSS'
1138 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1139 EOSS
1140 chmod +x contains
1141 esac
1142
1143 : Find the path to the source tree
1144 case "$src" in
1145 '') case "$0" in
1146     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
1147     *)   src='.';;
1148     esac;;
1149 esac
1150 case "$src" in
1151 '')     src=/
1152         rsrc=/
1153         ;;
1154 /*) rsrc="$src";;
1155 *) rsrc="../$src";;
1156 esac
1157 if test -f $rsrc/Configure && \
1158         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1159 then
1160    : found it, so we are ok.
1161 else
1162         rsrc=''
1163         for src in . .. ../.. ../../.. ../../../..; do
1164                 if test -f ../$src/Configure && \
1165                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1166                 then
1167                         rsrc=../$src
1168                         break
1169                 fi
1170         done
1171 fi
1172 case "$rsrc" in
1173 '')
1174         cat <<EOM >&4
1175
1176 Sorry, I can't seem to locate the source dir for $package.  Please start
1177 Configure with an explicit path -- i.e. /some/path/Configure.
1178
1179 EOM
1180         exit 1
1181         ;;
1182 ../.)   rsrc='..';;
1183 *)
1184         echo " "
1185         echo "Sources for $package found in \"$src\"." >&4
1186         ;;
1187 esac
1188
1189 : script used to extract .SH files with variable substitutions
1190 cat >extract <<'EOS'
1191 CONFIG=true
1192 echo "Doing variable substitutions on .SH files..."
1193 if test -f $src/MANIFEST; then
1194         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH'`
1195 else
1196         echo "(Looking for .SH files under the source directory.)"
1197         set x `(cd $src; find . -name "*.SH" -print)`
1198 fi
1199 shift
1200 case $# in
1201 0) set x `(cd $src; echo *.SH)`; shift;;
1202 esac
1203 if test ! -f $src/$1; then
1204         shift
1205 fi
1206 mkdir_p='
1207 name=$1;
1208 create="";
1209 while test $name; do
1210         if test ! -d "$name"; then
1211                 create="$name $create";
1212                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1213                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1214         else
1215                 name="";
1216         fi;
1217 done;
1218 for file in $create; do
1219         mkdir $file;
1220 done
1221 '
1222 for file in $*; do
1223         case "$src" in
1224         ".")
1225                 case "$file" in
1226                 */*)
1227                         dir=`expr X$file : 'X\(.*\)/'`
1228                         file=`expr X$file : 'X.*/\(.*\)'`
1229                         (cd $dir && . ./$file)
1230                         ;;
1231                 *)
1232                         . ./$file
1233                         ;;
1234                 esac
1235                 ;;
1236         *)
1237                 case "$file" in
1238                 */*)
1239                         dir=`expr X$file : 'X\(.*\)/'`
1240                         file=`expr X$file : 'X.*/\(.*\)'`
1241                         (set x $dir; shift; eval $mkdir_p)
1242                         sh <$src/$dir/$file
1243                         ;;
1244                 *)
1245                         sh <$src/$file
1246                         ;;
1247                 esac
1248                 ;;
1249         esac
1250 done
1251 if test -f $src/config_h.SH; then
1252         if test ! -f config.h; then
1253         : oops, they left it out of MANIFEST, probably, so do it anyway.
1254         . $src/config_h.SH
1255         fi
1256 fi
1257 EOS
1258
1259 : extract files and exit if asked to do so
1260 case "$extractsh" in
1261 true)
1262         case "$realsilent" in
1263         true) ;;
1264         *) exec 1>&4;;
1265         esac
1266         case "$config_sh" in
1267         '') config_sh='config.sh';;
1268         esac
1269         echo " "
1270         echo "Fetching answers from $config_sh..."
1271         cd ..
1272         . $config_sh
1273         test "$override" && . ./optdef.sh
1274         echo " "
1275         . UU/extract
1276         rm -rf UU
1277         echo "Done."
1278         exit 0
1279         ;;
1280 esac
1281
1282 : Eunice requires " " instead of "", can you believe it
1283 echo " "
1284 : Here we go...
1285 echo "Beginning of configuration questions for $package."
1286
1287 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1288
1289 : first determine how to suppress newline on echo command
1290 echo " "
1291 echo "Checking echo to see how to suppress newlines..."
1292 (echo "hi there\c" ; echo " ") >.echotmp
1293 if $contains c .echotmp >/dev/null 2>&1 ; then
1294         echo "...using -n."
1295         n='-n'
1296         c=''
1297 else
1298         cat <<'EOM'
1299 ...using \c
1300 EOM
1301         n=''
1302         c='\c'
1303 fi
1304 echo $n "The star should be here-->$c"
1305 echo '*'
1306 rm -f .echotmp
1307
1308 : Now test for existence of everything in MANIFEST
1309 echo " "
1310 if test -f $rsrc/MANIFEST; then
1311         echo "First let's make sure your kit is complete.  Checking..." >&4
1312         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1313         rm -f missing
1314         tmppwd=`pwd`
1315         for filelist in x??; do
1316                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1317         done
1318         if test -s missing; then
1319                 cat missing >&4
1320                 cat >&4 <<'EOM'
1321
1322 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1323
1324 You have the option of continuing the configuration process, despite the
1325 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1326 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1327 and contact the author (doughera@lafcol.lafayette.edu).
1328
1329 EOM
1330                 echo $n "Continue? [n] $c" >&4
1331                 read ans
1332                 case "$ans" in
1333                 y*)
1334                         echo "Continuing..." >&4
1335                         rm -f missing
1336                         ;;
1337                 *)
1338                         echo "ABORTING..." >&4
1339                         kill $$
1340                         ;;
1341                 esac
1342         else
1343                 echo "Looks good..."
1344         fi
1345 else
1346         echo "There is no MANIFEST file.  I hope your kit is complete !"
1347 fi
1348 rm -f missing x??
1349
1350 : compute the number of columns on the terminal for proper question formatting
1351 case "$COLUMNS" in
1352 '') COLUMNS='80';;
1353 esac
1354
1355 : set up the echo used in my read
1356 myecho="case \"\$xxxm\" in
1357 '') echo $n \"\$rp $c\" >&4;;
1358 *) case \"\$rp\" in
1359         '') echo $n \"[\$xxxm] $c\";;
1360         *)
1361                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1362                         echo \"\$rp\" >&4
1363                         echo $n \"[\$xxxm] $c\" >&4
1364                 else
1365                         echo $n \"\$rp [\$xxxm] $c\" >&4
1366                 fi
1367                 ;;
1368         esac;;
1369 esac"
1370
1371 : now set up to do reads with possible shell escape and default assignment
1372 cat <<EOSC >myread
1373 $startsh
1374 xxxm=\$dflt
1375 $myecho
1376 ans='!'
1377 case "\$fastread" in
1378 yes) case "\$dflt" in
1379         '') ;;
1380         *) ans='';
1381                 case "\$silent-\$rp" in
1382                 true-) ;;
1383                 *) echo " " >&4;;
1384                 esac;;
1385         esac;;
1386 *) case "\$silent" in
1387         true) case "\$rp" in
1388                 '') ans='';;
1389                 esac;;
1390         esac;;
1391 esac
1392 while expr "X\$ans" : "X!" >/dev/null; do
1393         read answ
1394         set x \$xxxm
1395         shift
1396         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1397         case  "\$answ" in
1398         "!")
1399                 sh 1>&4
1400                 echo " "
1401                 $myecho
1402                 ;;
1403         !*)
1404                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1405                 shift
1406                 sh 1>&4 -c "\$*"
1407                 echo " "
1408                 $myecho
1409                 ;;
1410         "\$ans")
1411                 case "\$ans" in
1412                 \\&*)
1413                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1414                         shift
1415                         case "\$1" in
1416                         -d)
1417                                 fastread=yes
1418                                 echo "(OK, I'll run with -d after this question.)" >&4
1419                                 ;;
1420                         -*)
1421                                 echo "*** Sorry, \$1 not supported yet." >&4
1422                                 ;;
1423                         esac
1424                         $myecho
1425                         ans=!
1426                         ;;
1427                 esac;;
1428         *)
1429                 case "\$aok" in
1430                 y)
1431                         echo "*** Substitution done -- please confirm."
1432                         xxxm="\$ans"
1433                         ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
1434                         xxxm="\$ans"
1435                         ans=!
1436                         ;;
1437                 *)
1438                         echo "*** Error -- try again."
1439                         ans=!
1440                         ;;
1441                 esac
1442                 $myecho
1443                 ;;
1444         esac
1445         case "\$ans\$xxxm\$nostick" in
1446         '')
1447                 ans=!
1448                 $myecho
1449                 ;;
1450         esac
1451 done
1452 case "\$ans" in
1453 '') ans="\$xxxm";;
1454 esac
1455 EOSC
1456
1457 : create .config dir to save info across Configure sessions
1458 test -d ../.config || mkdir ../.config
1459 cat >../.config/README <<EOF
1460 This directory created by Configure to save information that should
1461 persist across sessions for $package.
1462
1463 You may safely delete it if you wish.
1464 EOF
1465
1466 : general instructions
1467 needman=true
1468 firsttime=true
1469 user=`(logname) 2>/dev/null`
1470 case "$user" in
1471 '') user=`whoami 2>&1`;;
1472 esac
1473 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1474         firsttime=false
1475         echo " "
1476         rp='Would you like to see the instructions?'
1477         dflt=n
1478         . ./myread
1479         case "$ans" in
1480         [yY]*) ;;
1481         *) needman=false;;
1482         esac
1483 fi
1484 if $needman; then
1485         cat <<EOH
1486
1487 This installation shell script will examine your system and ask you questions
1488 to determine how the perl5 package should be installed. If you get
1489 stuck on a question, you may use a ! shell escape to start a subshell or
1490 execute a command.  Many of the questions will have default answers in square
1491 brackets; typing carriage return will give you the default.
1492
1493 On some of the questions which ask for file or directory names you are allowed
1494 to use the ~name construct to specify the login directory belonging to "name",
1495 even if you don't have a shell which knows about that.  Questions where this is
1496 allowed will be marked "(~name ok)".
1497
1498 EOH
1499         rp=''
1500         dflt='Type carriage return to continue'
1501         . ./myread
1502         cat <<'EOH'
1503
1504 The prompter used in this script allows you to use shell variables and
1505 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1506 in the default answer, as if the default line was a set of arguments given to a
1507 script shell.  This means you may also use $* to repeat the whole default line,
1508 so you do not have to re-type everything to add something to the default.
1509
1510 Everytime there is a substitution, you will have to confirm.  If there is an
1511 error (e.g. an unmatched backtick), the default answer will remain unchanged
1512 and you will be prompted again.
1513
1514 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1515 the questions and use the computed defaults (or the previous answers if there
1516 was already a config.sh file). Type 'Configure -h' for a list of options.
1517 You may also start interactively and then answer '& -d' at any prompt to turn
1518 on the non-interactive behaviour for the remainder of the execution.
1519
1520 EOH
1521         . ./myread
1522         cat <<EOH
1523
1524 Much effort has been expended to ensure that this shell script will run on any
1525 Unix system.  If despite that it blows up on yours, your best bet is to edit
1526 Configure and run it again.  If you can't run Configure for some reason,
1527 you'll have to generate a config.sh file by hand.  Whatever problems you
1528 have, let me (doughera@lafcol.lafayette.edu) know how I blew it.
1529
1530 This installation script affects things in two ways:
1531
1532 1) it may do direct variable substitutions on some of the files included
1533    in this kit.
1534 2) it builds a config.h file for inclusion in C programs.  You may edit
1535    any of these files as the need arises after running this script.
1536
1537 If you make a mistake on a question, there is no easy way to back up to it
1538 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1539 files.  Configure will offer to let you do this before it runs the SH files.
1540
1541 EOH
1542         dflt='Type carriage return to continue'
1543         . ./myread
1544         case "$firsttime" in
1545         true) echo $user >>../.config/instruct;;
1546         esac
1547 fi
1548
1549 : find out where common programs are
1550 echo " "
1551 echo "Locating common programs..." >&4
1552 cat <<EOSC >loc
1553 $startsh
1554 case \$# in
1555 0) exit 1;;
1556 esac
1557 thing=\$1
1558 shift
1559 dflt=\$1
1560 shift
1561 for dir in \$*; do
1562         case "\$thing" in
1563         .)
1564         if test -d \$dir/\$thing; then
1565                 echo \$dir
1566                 exit 0
1567         fi
1568         ;;
1569         *)
1570         for thisthing in \$dir/\$thing; do
1571                 : just loop through to pick last item
1572         done
1573         if test -f \$thisthing; then
1574                 echo \$thisthing
1575                 exit 0
1576         elif test -f \$dir/\$thing.exe; then
1577                 if test -n "$DJGPP"; then
1578                         echo \$dir/\$thing.exe
1579                 else
1580                         : on Eunice apparently
1581                         echo \$dir/\$thing
1582                 fi
1583                 exit 0
1584         fi
1585         ;;
1586         esac
1587 done
1588 echo \$dflt
1589 exit 1
1590 EOSC
1591 chmod +x loc
1592 $eunicefix loc
1593 loclist="
1594 awk
1595 cat
1596 comm
1597 cp
1598 echo
1599 expr
1600 find
1601 grep
1602 ls
1603 make
1604 mkdir
1605 rm
1606 sed
1607 sort
1608 touch
1609 tr
1610 uniq
1611 "
1612 trylist="
1613 Mcc
1614 ar
1615 byacc
1616 cpp
1617 csh
1618 date
1619 egrep
1620 gzip
1621 less
1622 line
1623 ln
1624 more
1625 nm
1626 nroff
1627 perl
1628 pg
1629 sendmail
1630 tee
1631 test
1632 uname
1633 zip
1634 "
1635 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1636 pth="$pth /lib /usr/lib"
1637 for file in $loclist; do
1638         eval xxx=\$$file
1639         case "$xxx" in
1640         /*|?:[\\/]*)
1641                 if test -f "$xxx"; then
1642                         : ok
1643                 else
1644                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1645                         xxx=`./loc $file $file $pth`
1646                 fi
1647                 ;;
1648         '') xxx=`./loc $file $file $pth`;;
1649         *) xxx=`./loc $xxx $xxx $pth`;;
1650         esac
1651         eval $file=$xxx
1652         eval _$file=$xxx
1653         case "$xxx" in
1654         /*)
1655                 echo $file is in $xxx.
1656                 ;;
1657         ?:[\\/]*)
1658                 echo $file is in $xxx.
1659                 ;;
1660         *)
1661                 echo "I don't know where '$file' is, and my life depends on it." >&4
1662                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1663                 exit 1
1664                 ;;
1665         esac
1666 done
1667 echo " "
1668 echo "Don't worry if any of the following aren't found..."
1669 say=offhand
1670 for file in $trylist; do
1671         eval xxx=\$$file
1672         case "$xxx" in
1673         /*|?:[\\/]*)
1674                 if test -f "$xxx"; then
1675                         : ok
1676                 else
1677                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1678                         xxx=`./loc $file $file $pth`
1679                 fi
1680                 ;;
1681         '') xxx=`./loc $file $file $pth`;;
1682         *) xxx=`./loc $xxx $xxx $pth`;;
1683         esac
1684         eval $file=$xxx
1685         eval _$file=$xxx
1686         case "$xxx" in
1687         /*)
1688                 echo $file is in $xxx.
1689                 ;;
1690         ?:[\\/]*)
1691                 echo $file is in $xxx.
1692                 ;;
1693         *)
1694                 echo "I don't see $file out there, $say."
1695                 say=either
1696                 ;;
1697         esac
1698 done
1699 case "$egrep" in
1700 egrep)
1701         echo "Substituting grep for egrep."
1702         egrep=$grep
1703         ;;
1704 esac
1705 case "$ln" in
1706 ln)
1707         echo "Substituting cp for ln."
1708         ln=$cp
1709         ;;
1710 esac
1711 case "$test" in
1712 test)
1713         echo "Hopefully test is built into your sh."
1714         ;;
1715 *)
1716         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1717                 echo "Using the test built into your sh."
1718                 test=test
1719                 _test=test
1720         fi
1721         ;;
1722 esac
1723 case "$echo" in
1724 echo)
1725         echo "Hopefully echo is built into your sh."
1726         ;;
1727 '') ;;
1728 *)
1729         echo " "
1730 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1731         $echo $n "hi there$c" >foo1
1732         echo $n "hi there$c" >foo2
1733         if cmp foo1 foo2 >/dev/null 2>&1; then
1734                 echo "They are compatible.  In fact, they may be identical."
1735         else
1736                 case "$n" in
1737                 '-n') n='' c='\c';;
1738                 *) n='-n' c='';;
1739                 esac
1740                 cat <<FOO
1741 They are not compatible!  You are probably running ksh on a non-USG system.
1742 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1743 have echo built in and we may have to run some Bourne shell scripts.  That
1744 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1745
1746 FOO
1747                 $echo $n "The star should be here-->$c"
1748                 $echo "*"
1749         fi
1750         $rm -f foo1 foo2
1751         ;;
1752 esac
1753
1754 : determine whether symbolic links are supported
1755 echo " "
1756 $touch blurfl
1757 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1758         echo "Symbolic links are supported." >&4
1759         lns="$ln -s"
1760 else
1761         echo "Symbolic links are NOT supported." >&4
1762         lns="$ln"
1763 fi
1764 $rm -f blurfl sym
1765
1766 : see whether [:lower:] and [:upper:] are supported character classes
1767 echo " "
1768 up='[A-Z]'
1769 low='[a-z]'
1770 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1771 ABYZ)
1772         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1773         up='[:upper:]'
1774         low='[:lower:]'
1775         ;;
1776 *)
1777         echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4
1778         ;;
1779 esac
1780 : set up the translation script tr, must be called with ./tr of course
1781 cat >tr <<EOSC
1782 $startsh
1783 case "\$1\$2" in
1784 '[A-Z][a-z]') exec $tr '$up' '$low';;
1785 '[a-z][A-Z]') exec $tr '$low' '$up';;
1786 esac
1787 exec $tr "\$@"
1788 EOSC
1789 chmod +x tr
1790 $eunicefix tr
1791
1792 : Try to determine whether config.sh was made on this system
1793 case "$config_sh" in
1794 '')
1795 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1796 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1797         ./tr '[A-Z]' '[a-z]' | tr '\012' ' '`
1798 newmyuname="$myuname"
1799 dflt=n
1800 case "$knowitall" in
1801 '')
1802         if test -f ../config.sh; then
1803                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1804                         eval "`grep myuname= ../config.sh`"
1805                 fi
1806                 if test "X$myuname" = "X$newmyuname"; then
1807                         dflt=y
1808                 fi
1809         fi
1810         ;;
1811 *) dflt=y;;
1812 esac
1813
1814 : Get old answers from old config file if Configure was run on the
1815 : same system, otherwise use the hints.
1816 hint=default
1817 cd ..
1818 if test -f config.sh; then
1819         echo " "
1820         rp="I see a config.sh file.  Shall I use it to set the defaults?"
1821         . UU/myread
1822         case "$ans" in
1823         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1824         *)  echo "Fetching default answers from your old config.sh file..." >&4
1825                 tmp_n="$n"
1826                 tmp_c="$c"
1827                 tmp_sh="$sh"
1828                 . ./config.sh
1829                 cp config.sh UU
1830                 n="$tmp_n"
1831                 c="$tmp_c"
1832                 : Older versions did not always set $sh.  Catch re-use of such
1833                 : an old config.sh.
1834                 case "$sh" in
1835                 '') sh="$tmp_sh" ;;
1836                 esac
1837                 hint=previous
1838                 ;;
1839         esac
1840 fi
1841 if test ! -f config.sh; then
1842         $cat <<EOM
1843
1844 First time through, eh?  I have some defaults handy for some systems
1845 that need some extra help getting the Configure answers right:
1846
1847 EOM
1848         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
1849         dflt=''
1850         : Half the following guesses are probably wrong... If you have better
1851         : tests or hints, please send them to doughera@lafcol.lafayette.edu
1852         : The metaconfig authors would also appreciate a copy...
1853         $test -f /irix && osname=irix
1854         $test -f /xenix && osname=sco_xenix
1855         $test -f /dynix && osname=dynix
1856         $test -f /dnix && osname=dnix
1857         $test -f /lynx.os && osname=lynxos
1858         $test -f /unicos && osname=unicos && osvers=`$uname -r`
1859         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
1860         $test -f /bin/mips && /bin/mips && osname=mips
1861         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
1862                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
1863         $test -d /usr/apollo/bin && osname=apollo
1864         $test -f /etc/saf/_sactab && osname=svr4
1865         $test -d /usr/include/minix && osname=minix
1866         if $test -d /MachTen; then
1867                 osname=machten
1868                 if $test -x /sbin/version; then
1869                         osvers=`/sbin/version | $awk '{print $2}' |
1870                         $sed -e 's/[A-Za-z]$//'`
1871                 elif $test -x /usr/etc/version; then
1872                         osvers=`/usr/etc/version | $awk '{print $2}' |
1873                         $sed -e 's/[A-Za-z]$//'`
1874                 else
1875                         osvers="$2.$3"
1876                 fi
1877         fi
1878         if $test -f $uname; then
1879                 set X $myuname
1880                 shift
1881
1882                 case "$5" in
1883                 fps*) osname=fps ;;
1884                 mips*)
1885                         case "$4" in
1886                         umips) osname=umips ;;
1887                         *) osname=mips ;;
1888                         esac;;
1889                 [23]100) osname=mips ;;
1890                 next*) osname=next ;;
1891                 i386*)
1892                         if $test -f /etc/kconfig; then
1893                                 osname=isc
1894                                 if test "$lns" = "ln -s"; then
1895                                         osvers=4
1896                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1897                                         osvers=3
1898                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
1899                                         osvers=2
1900                                 fi
1901                         fi
1902                         ;;
1903                 pc*)
1904                         if test -n "$DJGPP"; then
1905                                 osname=dos
1906                                 osvers=djgpp
1907                         fi
1908                         ;;
1909                 esac
1910
1911                 case "$1" in
1912                 aix) osname=aix
1913                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
1914                         case "$tmp" in
1915                         'not found') osvers="$4"."$3" ;;
1916                         '<3240'|'<>3240') osvers=3.2.0 ;;
1917                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
1918                         '=3250'|'>3250') osvers=3.2.5 ;;
1919                         *) osvers=$tmp;;
1920                         esac
1921                         ;;
1922                 *dc.osx) osname=dcosx
1923                         osvers="$3"
1924                         ;;
1925                 dnix) osname=dnix
1926                         osvers="$3"
1927                         ;;
1928                 domainos) osname=apollo
1929                         osvers="$3"
1930                         ;;
1931                 dgux) osname=dgux 
1932                         osvers="$3"
1933                         ;;
1934                 dynixptx*) osname=dynixptx
1935                         osvers="$3"
1936                         ;;
1937                 freebsd) osname=freebsd 
1938                         osvers="$3" ;;
1939                 genix) osname=genix ;;
1940                 hp*) osname=hpux 
1941                         case "$3" in
1942                         *.08.*) osvers=9 ;;
1943                         *.09.*) osvers=9 ;;
1944                         *.10.*) osvers=10 ;;
1945                         *.11.*) osvers=11 ;;
1946                         *.12.*) osvers=12 ;;
1947                         *)      osvers="$3" ;;
1948                         esac
1949                         ;;
1950                 irix*) osname=irix
1951                         case "$3" in
1952                         4*) osvers=4 ;;
1953                         5*) osvers=5 ;;
1954                         *)      osvers="$3" ;;
1955                         esac
1956                         ;;
1957                 linux) osname=linux
1958                         case "$3" in
1959                         *)      osvers="$3" ;;
1960                         esac
1961                         ;;
1962                 netbsd*) osname=netbsd 
1963                         osvers="$3"
1964                         ;;
1965                 news-os) osvers="$3"
1966                         case "$3" in
1967                         4*) osname=newsos4 ;;
1968                         *) osname=newsos ;;
1969                         esac
1970                         ;;
1971                 bsd386) osname=bsd386
1972                         osvers=`$uname -r`
1973                         ;;
1974                 powerux | power_ux | powermax_os | powermaxos | \
1975                 powerunix | power_unix) osname=powerux
1976                         osvers="$3"
1977                         ;;
1978                 next*) osname=next ;;
1979                 solaris) osname=solaris
1980                         case "$3" in
1981                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1982                         *)      osvers="$3" ;;
1983                         esac
1984                         ;;
1985                 sunos) osname=sunos
1986                         case "$3" in
1987                         5*) osname=solaris
1988                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1989                         *)      osvers="$3" ;;
1990                         esac
1991                         ;;
1992                 titanos) osname=titanos
1993                         case "$3" in
1994                         1*) osvers=1 ;;
1995                         2*) osvers=2 ;;
1996                         3*) osvers=3 ;;
1997                         4*) osvers=4 ;;
1998                         *)      osvers="$3" ;;
1999                         esac
2000                         ;;
2001                 ultrix) osname=ultrix
2002                         osvers="$3"
2003                         ;;
2004                 osf1|mls+)      case "$5" in
2005                                 alpha)
2006                                         osname=dec_osf
2007                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2008                                         ;;
2009                         hp*)    osname=hp_osf1  ;;
2010                         mips)   osname=mips_osf1 ;;
2011                         esac
2012                         ;;
2013                 uts) osname=uts 
2014                         osvers="$3"
2015                         ;;
2016                 qnx) osname=qnx
2017                         osvers="$4"
2018                         ;;
2019                 $2) case "$osname" in
2020                         *isc*) ;;
2021                         *freebsd*) ;;
2022                         svr*)
2023                                 : svr4.x or possibly later
2024                                 case "svr$3" in 
2025                                 ${osname}*)
2026                                         osname=svr$3
2027                                         osvers=$4
2028                                         ;;
2029                                 esac
2030                                 case "$osname" in
2031                                 svr4.0)
2032                                         : Check for ESIX
2033                                         if test -f /stand/boot ; then
2034                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2035                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2036                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2037                                                         if test -n "$isesix"; then
2038                                                                 osname=esix4
2039                                                         fi
2040                                                 fi
2041                                         fi
2042                                         ;;
2043                                 esac
2044                                 ;;
2045                         *)      if test -f /etc/systemid; then
2046                                         osname=sco
2047                                         set `echo $3 | $sed 's/\./ /g'` $4
2048                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2049                                                 osvers=$1.$2.$3
2050                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2051                                                 osvers=$1.$2
2052                                         elif $test -f $src/hints/sco_$1.sh; then
2053                                                 osvers=$1
2054                                         fi
2055                                 else
2056                                         case "$osname" in
2057                                         '') : Still unknown.  Probably a generic Sys V.
2058                                                 osname="sysv"
2059                                                 osvers="$3"
2060                                                 ;;
2061                                         esac
2062                                 fi
2063                                 ;;
2064                         esac
2065                         ;;
2066                 *)      case "$osname" in
2067                         '') : Still unknown.  Probably a generic BSD.
2068                                 osname="$1"
2069                                 osvers="$3"
2070                                 ;;
2071                         esac
2072                         ;;
2073                 esac
2074         else
2075                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2076                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2077                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2078                                 osname=news_os
2079                         fi
2080                         $rm -f UU/kernel.what
2081                 elif test -d c:/.; then
2082                         set X $myuname
2083                         osname=os2
2084                         osvers="$5"
2085                 fi
2086         fi
2087         
2088         : Now look for a hint file osname_osvers, unless one has been
2089         : specified already.
2090         case "$hintfile" in
2091         ''|' ')
2092                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2093                 : Also try without trailing minor version numbers.
2094                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2095                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2096                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2097                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2098                 case "$file" in
2099                 '') dflt=none ;;
2100                 *)  case "$osvers" in
2101                         '') dflt=$file
2102                                 ;;
2103                         *)  if $test -f $src/hints/$file.sh ; then
2104                                         dflt=$file
2105                                 elif $test -f $src/hints/$xfile.sh ; then
2106                                         dflt=$xfile
2107                                 elif $test -f $src/hints/$xxfile.sh ; then
2108                                         dflt=$xxfile
2109                                 elif $test -f $src/hints/$xxxfile.sh ; then
2110                                         dflt=$xxxfile
2111                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2112                                         dflt=$xxxxfile
2113                                 elif $test -f "$src/hints/${osname}.sh" ; then
2114                                         dflt="${osname}"
2115                                 else
2116                                         dflt=none
2117                                 fi
2118                                 ;;
2119                         esac
2120                         ;;
2121                 esac
2122                 if $test -f Policy.sh ; then
2123                         case "$dflt" in
2124                         *Policy*) ;;
2125                         none) dflt="Policy" ;;
2126                         *) dflt="Policy $dflt" ;;
2127                         esac
2128                 fi
2129                 ;;
2130         *)
2131                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2132                 ;;
2133         esac
2134
2135         if $test -f Policy.sh ; then
2136                 $cat <<EOM
2137
2138 There's also a Policy hint file available, which should make the
2139 site-specific (policy) questions easier to answer.
2140 EOM
2141
2142         fi
2143
2144         $cat <<EOM
2145
2146 You may give one or more space-separated answers, or "none" if appropriate.
2147 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2148 is a good thing.  DO NOT give a wrong version.
2149
2150 EOM
2151
2152         rp="Which of these apply, if any?"
2153         . UU/myread
2154         tans=$ans
2155         for file in $tans; do
2156                 if $test X$file = XPolicy -a -f Policy.sh; then
2157                         . Policy.sh
2158                         $cat Policy.sh >> UU/config.sh
2159                 elif $test -f $src/hints/$file.sh; then
2160                         . $src/hints/$file.sh
2161                         $cat $src/hints/$file.sh >> UU/config.sh
2162                 elif $test X$tans = X -o X$tans = Xnone ; then
2163                         : nothing
2164                 else
2165                         : Give one chance to correct a possible typo.
2166                         echo "$file.sh does not exist"
2167                         dflt=$file
2168                         rp="hint to use instead?"
2169                         . UU/myread
2170                         for file in $ans; do
2171                                 if $test -f "$src/hints/$file.sh"; then
2172                                         . $src/hints/$file.sh
2173                                         $cat $src/hints/$file.sh >> UU/config.sh
2174                                 elif $test X$ans = X -o X$ans = Xnone ; then
2175                                         : nothing
2176                                 else
2177                                         echo "$file.sh does not exist -- ignored."
2178                                 fi
2179                         done
2180                 fi
2181         done
2182
2183         hint=recommended
2184         : Remember our hint file for later.
2185         if $test -f "$src/hints/$file.sh" ; then
2186                 hintfile="$file"
2187         else
2188                 hintfile=''
2189         fi
2190 fi
2191 cd UU
2192 ;;
2193 *)
2194         echo " "
2195         echo "Fetching default answers from $config_sh..." >&4
2196         tmp_n="$n"
2197         tmp_c="$c"
2198         cd ..
2199         cp $config_sh config.sh 2>/dev/null
2200         chmod +w config.sh
2201         . ./config.sh
2202         cd UU
2203         cp ../config.sh .
2204         n="$tmp_n"
2205         c="$tmp_c"
2206         hint=previous
2207         ;;
2208 esac
2209 test "$override" && . ./optdef.sh
2210 myuname="$newmyuname"
2211
2212 : Restore computed paths
2213 for file in $loclist $trylist; do
2214         eval $file="\$_$file"
2215 done
2216
2217 cat << EOM
2218
2219 Configure uses the operating system name and version to set some defaults.
2220 The default value is probably right if the name rings a bell. Otherwise,
2221 since spelling matters for me, either accept the default or answer "none"
2222 to leave it blank.
2223
2224 EOM
2225 case "$osname" in
2226         ''|' ')
2227                 case "$hintfile" in
2228                 ''|' '|none) dflt=none ;;
2229                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2230                 esac
2231                 ;;
2232         *) dflt="$osname" ;;
2233 esac
2234 rp="Operating system name?"
2235 . ./myread
2236 case "$ans" in
2237 none)  osname='' ;;
2238 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2239 esac
2240 echo " "
2241 case "$osvers" in
2242         ''|' ')
2243                 case "$hintfile" in
2244                 ''|' '|none) dflt=none ;;
2245                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2246                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2247                         case "$dflt" in
2248                         ''|' ') dflt=none ;;
2249                         esac
2250                         ;;
2251                 esac
2252                 ;;
2253         *) dflt="$osvers" ;;
2254 esac
2255 rp="Operating system version?"
2256 . ./myread
2257 case "$ans" in
2258 none)  osvers='' ;;
2259 *) osvers="$ans" ;;
2260 esac
2261
2262 : who configured the system
2263 cf_time=`LC_ALL=C; export LC_ALL; $date 2>&1`
2264 cf_by=`(logname) 2>/dev/null`
2265 case "$cf_by" in
2266 "")
2267         cf_by=`(whoami) 2>/dev/null`
2268         case "$cf_by" in
2269         "") cf_by=unknown ;;
2270         esac ;;
2271 esac
2272
2273 : set up the script used to warn in case of inconsistency
2274 cat <<EOS >whoa
2275 $startsh
2276 EOS
2277 cat <<'EOSC' >>whoa
2278 dflt=y
2279 echo " "
2280 echo "*** WHOA THERE!!! ***" >&4
2281 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2282 rp="    Keep the $hint value?"
2283 . ./myread
2284 case "$ans" in
2285 y) td=$was; tu=$was;;
2286 esac
2287 EOSC
2288
2289 : function used to set $1 to $val
2290 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2291 case "$val$was" in
2292 $define$undef) . ./whoa; eval "$var=\$td";;
2293 $undef$define) . ./whoa; eval "$var=\$tu";;
2294 *) eval "$var=$val";;
2295 esac'
2296
2297 cat <<EOM
2298
2299 Perl can be built to take advantage of threads, on some systems.
2300 To do so, Configure must be run with -Dusethreads.
2301 (See README.threads for details.)
2302 EOM
2303 case "$usethreads" in
2304 $define|true|[yY]*)     dflt='y';;
2305 *) dflt='n';;
2306 esac
2307 rp='Build a threading Perl?'
2308 . ./myread
2309 case "$ans" in
2310 y|Y)    val="$define" ;;     
2311 *)      val="$undef" ;;
2312 esac
2313 set usethreads
2314 eval $setvar 
2315 : Look for a hint-file generated 'call-back-unit'.  Now that the
2316 : user has specified if a threading perl is to be built, we may need 
2317 : to set or change some other defaults.
2318 if $test -f usethreads.cbu; then
2319     . ./usethreads.cbu
2320 fi
2321 case "$d_oldpthreads" in
2322 '')     : Configure tests would be welcome here.  For now, assume undef.
2323         val="$undef" ;;
2324 *)      val="$d_oldpthreads" ;;
2325 esac
2326 set d_oldpthreads
2327 eval $setvar
2328
2329 : determine the architecture name
2330 echo " "
2331 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
2332         tarch=`arch`"-$osname"
2333 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
2334         if uname -m > tmparch 2>&1 ; then
2335                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
2336                         -e 's/$/'"-$osname/" tmparch`
2337         else
2338                 tarch="$osname"
2339         fi
2340         $rm -f tmparch
2341 else
2342         tarch="$osname"
2343 fi
2344 case "$myarchname" in
2345 ''|"$tarch") ;;
2346 *)
2347         echo "(Your architecture name used to be $myarchname.)"
2348         archname=''
2349         ;;
2350 esac
2351 case "$archname" in
2352 '') dflt="$tarch";;
2353 *) dflt="$archname";;
2354 esac
2355 rp='What is your architecture name'
2356 . ./myread
2357 case "$usethreads" in
2358 $define)  echo "Threads selected." >&4
2359           case "$ans" in
2360           *-thread) echo "...and architecture name already ends in -thread." >&4
2361                     archname="$ans"
2362                     ;;
2363           *)        archname="$ans-thread"
2364                     echo "...setting architecture name to $archname." >&4
2365                     ;;
2366           esac
2367           ;;
2368 *)        archname="$ans" ;;
2369 esac
2370 myarchname="$tarch"
2371 : is AFS running?
2372 echo " "
2373 case "$afs" in
2374 $define|true)   afs=true ;;
2375 $undef|false)   afs=false ;;
2376 *)      if test -d /afs; then
2377                 afs=true
2378         else
2379                 afs=false
2380         fi
2381         ;;
2382 esac
2383 if $afs; then
2384         echo "AFS may be running... I'll be extra cautious then..." >&4
2385 else
2386         echo "AFS does not seem to be running..." >&4
2387 fi
2388
2389 : decide how portable to be.  Allow command line overrides.
2390 case "$d_portable" in
2391 "$undef") ;;
2392 *)      d_portable="$define" ;;
2393 esac
2394
2395 : set up shell script to do ~ expansion
2396 cat >filexp <<EOSS
2397 $startsh
2398 : expand filename
2399 case "\$1" in
2400  ~/*|~)
2401         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2402         ;;
2403  ~*)
2404         if $test -f /bin/csh; then
2405                 /bin/csh -f -c "glob \$1"
2406                 failed=\$?
2407                 echo ""
2408                 exit \$failed
2409         else
2410                 name=\`$expr x\$1 : '..\([^/]*\)'\`
2411                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2412                 if $test ! -d "\$dir"; then
2413                         me=\`basename \$0\`
2414                         echo "\$me: can't locate home directory for: \$name" >&2
2415                         exit 1
2416                 fi
2417                 case "\$1" in
2418                 */*)
2419                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2420                         ;;
2421                 *)
2422                         echo \$dir
2423                         ;;
2424                 esac
2425         fi
2426         ;;
2427 *)
2428         echo \$1
2429         ;;
2430 esac
2431 EOSS
2432 chmod +x filexp
2433 $eunicefix filexp
2434
2435 : now set up to get a file name
2436 cat <<EOS >getfile
2437 $startsh
2438 EOS
2439 cat <<'EOSC' >>getfile
2440 tilde=''
2441 fullpath=''
2442 already=''
2443 skip=''
2444 none_ok=''
2445 exp_file=''
2446 nopath_ok=''
2447 orig_rp="$rp"
2448 orig_dflt="$dflt"
2449
2450 case "$fn" in
2451 *\(*)
2452         expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok
2453         fn=`echo $fn | sed 's/(.*)//'`
2454         ;;
2455 esac
2456
2457 case "$fn" in
2458 *:*)
2459         loc_file=`expr $fn : '.*:\(.*\)'`
2460         fn=`expr $fn : '\(.*\):.*'`
2461         ;;
2462 esac
2463
2464 case "$fn" in
2465 *~*) tilde=true;;
2466 esac
2467 case "$fn" in
2468 */*) fullpath=true;;
2469 esac
2470 case "$fn" in
2471 *+*) skip=true;;
2472 esac
2473 case "$fn" in
2474 *n*) none_ok=true;;
2475 esac
2476 case "$fn" in
2477 *e*) exp_file=true;;
2478 esac
2479 case "$fn" in
2480 *p*) nopath_ok=true;;
2481 esac
2482
2483 case "$fn" in
2484 *f*) type='File';;
2485 *d*) type='Directory';;
2486 *l*) type='Locate';;
2487 esac
2488
2489 what="$type"
2490 case "$what" in
2491 Locate) what='File';;
2492 esac
2493
2494 case "$exp_file" in
2495 '')
2496         case "$d_portable" in
2497         "$define") ;;
2498         *) exp_file=true;;
2499         esac
2500         ;;
2501 esac
2502
2503 cd ..
2504 while test "$type"; do
2505         redo=''
2506         rp="$orig_rp"
2507         dflt="$orig_dflt"
2508         case "$tilde" in
2509         true) rp="$rp (~name ok)";;
2510         esac
2511         . UU/myread
2512         if test -f UU/getfile.ok && \
2513                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2514         then
2515                 value="$ans"
2516                 ansexp="$ans"
2517                 break
2518         fi
2519         case "$ans" in
2520         none)
2521                 value=''
2522                 ansexp=''
2523                 case "$none_ok" in
2524                 true) type='';;
2525                 esac
2526                 ;;
2527         *)
2528                 case "$tilde" in
2529                 '') value="$ans"
2530                         ansexp="$ans";;
2531                 *)
2532                         value=`UU/filexp $ans`
2533                         case $? in
2534                         0)
2535                                 if test "$ans" != "$value"; then
2536                                         echo "(That expands to $value on this system.)"
2537                                 fi
2538                                 ;;
2539                         *) value="$ans";;
2540                         esac
2541                         ansexp="$value"
2542                         case "$exp_file" in
2543                         '') value="$ans";;
2544                         esac
2545                         ;;
2546                 esac
2547                 case "$fullpath" in
2548                 true)
2549                         case "$ansexp" in
2550                         /*) value="$ansexp" ;;
2551                         *)
2552                                 redo=true
2553                                 case "$already" in
2554                                 true)
2555                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
2556                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
2557                                         ;;
2558                                 *)
2559                                 echo "Please give a full path name, starting with slash." >&4
2560                                         case "$tilde" in
2561                                         true)
2562                                 echo "Note that using ~name is ok provided it expands well." >&4
2563                                                 already=true
2564                                                 ;;
2565                                         esac
2566                                 esac
2567                                 ;;
2568                         esac
2569                         ;;
2570                 esac
2571                 case "$redo" in
2572                 '')
2573                         case "$type" in
2574                         File)
2575                                 if test -f "$ansexp"; then
2576                                         type=''
2577                                 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2578                                 then
2579                                         echo "($value is not a plain file, but that's ok.)"
2580                                         type=''
2581                                 fi
2582                                 ;;
2583                         Directory)
2584                                 if test -d "$ansexp"; then
2585                                         type=''
2586                                 fi
2587                                 ;;
2588                         Locate)
2589                                 if test -d "$ansexp"; then
2590                                         echo "(Looking for $loc_file in directory $value.)"
2591                                         value="$value/$loc_file"
2592                                         ansexp="$ansexp/$loc_file"
2593                                 fi
2594                                 if test -f "$ansexp"; then
2595                                         type=''
2596                                 fi
2597                                 case "$nopath_ok" in
2598                                 true)   case "$value" in
2599                                         */*) ;;
2600                                         *)      echo "Assuming $value will be in people's path."
2601                                                 type=''
2602                                                 ;;
2603                                         esac
2604                                         ;;
2605                                 esac
2606                                 ;;
2607                         esac
2608
2609                         case "$skip" in
2610                         true) type='';
2611                         esac
2612
2613                         case "$type" in
2614                         '') ;;
2615                         *)
2616                                 if test "$fastread" = yes; then
2617                                         dflt=y
2618                                 else
2619                                         dflt=n
2620                                 fi
2621                                 rp="$what $value doesn't exist.  Use that name anyway?"
2622                                 . UU/myread
2623                                 dflt=''
2624                                 case "$ans" in
2625                                 y*) type='';;
2626                                 *) echo " ";;
2627                                 esac
2628                                 ;;
2629                         esac
2630                         ;;
2631                 esac
2632                 ;;
2633         esac
2634 done
2635 cd UU
2636 ans="$value"
2637 rp="$orig_rp"
2638 dflt="$orig_dflt"
2639 rm -f getfile.ok
2640 EOSC
2641
2642 : determine root of directory hierarchy where package will be installed.
2643 case "$prefix" in
2644 '')
2645         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
2646         ;;
2647 *)
2648         dflt="$prefix"
2649         ;;
2650 esac
2651 $cat <<EOM
2652
2653 By default, $package will be installed in $dflt/bin, manual
2654 pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2655 all installation directories. Typically set to /usr/local, but you
2656 may choose /usr if you wish to install $package among your system
2657 binaries. If you wish to have binaries under /bin but manual pages
2658 under /usr/local/man, that's ok: you will be prompted separately
2659 for each of the installation directories, the prefix being only used
2660 to set the defaults.
2661
2662 EOM
2663 fn=d~
2664 rp='Installation prefix to use?'
2665 . ./getfile
2666 oldprefix=''
2667 case "$prefix" in
2668 '') ;;
2669 *)
2670         case "$ans" in
2671         "$prefix") ;;
2672         *) oldprefix="$prefix";;
2673         esac
2674         ;;
2675 esac
2676 prefix="$ans"
2677 prefixexp="$ansexp"
2678
2679 : set the prefixit variable, to compute a suitable default value
2680 prefixit='case "$3" in
2681 ""|none)
2682         case "$oldprefix" in
2683         "") eval "$1=\"\$$2\"";;
2684         *)
2685                 case "$3" in
2686                 "") eval "$1=";;
2687                 none)
2688                         eval "tp=\"\$$2\"";
2689                         case "$tp" in
2690                         ""|" ") eval "$1=\"\$$2\"";;
2691                         *) eval "$1=";;
2692                         esac;;
2693                 esac;;
2694         esac;;
2695 *)
2696         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
2697         case "$tp" in
2698         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
2699         /*-$oldprefix/*|\~*-$oldprefix/*)
2700                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
2701         *) eval "$1=\"\$$2\"";;
2702         esac;;
2703 esac'
2704
2705 : determine where private library files go
2706 : Usual default is /usr/local/lib/perl5.  Also allow things like 
2707 : /opt/perl/lib, since /opt/perl/lib/perl5 would be redundant.
2708 case "$prefix" in
2709 *perl*) set dflt privlib lib ;;
2710 *)       set dflt privlib lib/$package ;;
2711 esac
2712 eval $prefixit
2713 $cat <<EOM
2714
2715 There are some auxiliary files for $package that need to be put into a
2716 private library directory that is accessible by everyone.
2717
2718 EOM
2719 fn=d~+
2720 rp='Pathname where the private library files will reside?'
2721 . ./getfile
2722 if $test "X$privlibexp" != "X$ansexp"; then
2723         installprivlib=''
2724 fi
2725 privlib="$ans"
2726 privlibexp="$ansexp"
2727 if $afs; then
2728         $cat <<EOM
2729
2730 Since you are running AFS, I need to distinguish the directory in which
2731 private files reside from the directory in which they are installed (and from
2732 which they are presumably copied to the former directory by occult means).
2733
2734 EOM
2735         case "$installprivlib" in
2736         '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
2737         *) dflt="$installprivlib";;
2738         esac
2739         fn=de~
2740         rp='Where will private files be installed?'
2741         . ./getfile
2742         installprivlib="$ans"
2743 else
2744         installprivlib="$privlibexp"
2745 fi
2746
2747 : set the base revision
2748 baserev=5.0
2749
2750 : get the patchlevel
2751 echo " "
2752 echo "Getting the current patchlevel..." >&4
2753 if $test -r $rsrc/patchlevel.h;then
2754         patchlevel=`awk '/define[       ]+PATCHLEVEL/ {print $3}' $rsrc/patchlevel.h`
2755         subversion=`awk '/define[       ]+SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
2756 else
2757         patchlevel=0
2758         subversion=0
2759 fi
2760 $echo $n "(You have $package" $c
2761 case "$package" in
2762 "*$baserev")    ;;
2763 *)              $echo $n " $baserev" $c ;;
2764 esac
2765 $echo $n " patchlevel $patchlevel" $c
2766 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
2767 echo ".)"
2768
2769 : set the prefixup variable, to restore leading tilda escape
2770 prefixup='case "$prefixexp" in
2771 "$prefix") ;;
2772 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
2773 esac'
2774
2775 : determine where public architecture dependent libraries go
2776 set archlib archlib
2777 eval $prefixit
2778 case "$archlib" in
2779 '')
2780     case "$privlib" in
2781     '') dflt=`./loc . "." $prefixexp/lib /usr/local/lib /usr/lib /lib`
2782         set dflt
2783         eval $prefixup
2784         ;;
2785     *)  if test 0 -eq "$subversion"; then
2786             version=`LC_ALL=C; export LC_ALL; \
2787                      echo $baserev $patchlevel | \
2788                      $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
2789         else
2790             version=`LC_ALL=C; export LC_ALL; \
2791                      echo $baserev $patchlevel $subversion | \
2792                      $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
2793         fi
2794         dflt="$privlib/$archname/$version"
2795         ;;
2796     esac
2797     ;;
2798 *)
2799     dflt="$archlib"
2800     ;;
2801 esac
2802 cat <<EOM
2803
2804 $spackage contains architecture-dependent library files.  If you are
2805 sharing libraries in a heterogeneous environment, you might store
2806 these files in a separate location.  Otherwise, you can just include
2807 them with the rest of the public library files.
2808
2809 EOM
2810 fn=d+~
2811 rp='Where do you want to put the public architecture-dependent libraries?'
2812 . ./getfile
2813 archlib="$ans"
2814 archlibexp="$ansexp"
2815
2816 if $afs; then
2817         $cat <<EOM
2818
2819 Since you are running AFS, I need to distinguish the directory in
2820 which architecture-dependent library files reside from the directory
2821 in which they are installed (and from which they are presumably copied
2822 to the former directory by occult means).
2823
2824 EOM
2825         case "$installarchlib" in
2826         '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
2827         *) dflt="$installarchlib";;
2828         esac
2829         fn=de~
2830         rp='Where will architecture-dependent library files be installed?'
2831         . ./getfile
2832         installarchlib="$ans"
2833 else
2834         installarchlib="$archlibexp"
2835 fi
2836 if $test X"$archlib" = X"$privlib"; then
2837         d_archlib="$undef"
2838 else
2839         d_archlib="$define"
2840 fi
2841
2842 : make some quick guesses about what we are up against
2843 echo " "
2844 $echo $n "Hmm...  $c"
2845 echo exit 1 >bsd
2846 echo exit 1 >usg
2847 echo exit 1 >v7
2848 echo exit 1 >osf1
2849 echo exit 1 >eunice
2850 echo exit 1 >xenix
2851 echo exit 1 >venix
2852 echo exit 1 >os2
2853 d_bsd="$undef"
2854 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2855 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2856 then
2857         echo "Looks kind of like an OSF/1 system, but we'll see..."
2858         echo exit 0 >osf1
2859 elif test `echo abc | tr a-z A-Z` = Abc ; then
2860         xxx=`./loc addbib blurfl $pth`
2861         if $test -f $xxx; then
2862         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2863                 echo exit 0 >bsd
2864                 echo exit 0 >usg
2865         else
2866                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2867                         echo "Looks kind of like an extended USG system, but we'll see..."
2868                 else
2869                         echo "Looks kind of like a USG system, but we'll see..."
2870                 fi
2871                 echo exit 0 >usg
2872         fi
2873 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2874         echo "Looks kind of like a BSD system, but we'll see..."
2875         d_bsd="$define"
2876         echo exit 0 >bsd
2877 else
2878         echo "Looks kind of like a Version 7 system, but we'll see..."
2879         echo exit 0 >v7
2880 fi
2881 case "$eunicefix" in
2882 *unixtovms*)
2883         $cat <<'EOI'
2884 There is, however, a strange, musty smell in the air that reminds me of
2885 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2886 EOI
2887         echo exit 0 >eunice
2888         d_eunice="$define"
2889 : it so happens the Eunice I know will not run shell scripts in Unix format
2890         ;;
2891 *)
2892         echo " "
2893         echo "Congratulations.  You aren't running Eunice."
2894         d_eunice="$undef"
2895         ;;
2896 esac
2897 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2898 case "$p_" in
2899 :) ;;
2900 *)
2901         $cat <<'EOI'
2902 I have the feeling something is not exactly right, however...don't tell me...
2903 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2904 EOI
2905         echo exit 0 >os2
2906         ;;
2907 esac
2908 if test -f /xenix; then
2909         echo "Actually, this looks more like a XENIX system..."
2910         echo exit 0 >xenix
2911         d_xenix="$define"
2912 else
2913         echo " "
2914         echo "It's not Xenix..."
2915         d_xenix="$undef"
2916 fi
2917 chmod +x xenix
2918 $eunicefix xenix
2919 if test -f /venix; then
2920         echo "Actually, this looks more like a VENIX system..."
2921         echo exit 0 >venix
2922 else
2923         echo " "
2924         if ./xenix; then
2925                 : null
2926         else
2927                 echo "Nor is it Venix..."
2928         fi
2929 fi
2930 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2931 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2932 $rm -f foo
2933
2934 : see if setuid scripts can be secure
2935 $cat <<EOM
2936
2937 Some kernels have a bug that prevents setuid #! scripts from being
2938 secure.  Some sites have disabled setuid #! scripts because of this.
2939
2940 First let's decide if your kernel supports secure setuid #! scripts.
2941 (If setuid #! scripts would be secure but have been disabled anyway,
2942 don't say that they are secure if asked.)
2943
2944 EOM
2945
2946 val="$undef"
2947 if $test -d /dev/fd; then
2948         echo "#!$ls" >reflect
2949         chmod +x,u+s reflect
2950         ./reflect >flect 2>&1
2951         if $contains "/dev/fd" flect >/dev/null; then
2952                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
2953                 val="$define"
2954         else
2955                 $cat <<EOM
2956 If you are not sure if they are secure, I can check but I'll need a
2957 username and password different from the one you are using right now.
2958 If you don't have such a username or don't want me to test, simply
2959 enter 'none'.
2960
2961 EOM
2962                 rp='Other username to test security of setuid scripts with?'
2963                 dflt='none'
2964                 . ./myread
2965                 case "$ans" in
2966                 n|none)
2967                         case "$d_suidsafe" in
2968                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
2969                                 dflt=n;;
2970                         "$undef")
2971                                 echo "Well, the $hint value is *not* secure." >&4
2972                                 dflt=n;;
2973                         *)      echo "Well, the $hint value *is* secure." >&4
2974                                 dflt=y;;
2975                         esac
2976                         ;;
2977                 *)
2978                         $rm -f reflect flect
2979                         echo "#!$ls" >reflect
2980                         chmod +x,u+s reflect
2981                         echo >flect
2982                         chmod a+w flect
2983                         echo '"su" will (probably) prompt you for '"$ans's password."
2984                         su $ans -c './reflect >flect'
2985                         if $contains "/dev/fd" flect >/dev/null; then
2986                                 echo "Okay, it looks like setuid scripts are secure." >&4
2987                                 dflt=y
2988                         else
2989                                 echo "I don't think setuid scripts are secure." >&4
2990                                 dflt=n
2991                         fi
2992                         ;;
2993                 esac
2994                 rp='Does your kernel have *secure* setuid scripts?'
2995                 . ./myread
2996                 case "$ans" in
2997                 [yY]*)  val="$define";;
2998                 *)      val="$undef";;
2999                 esac
3000         fi
3001 else
3002         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3003         echo "(That's for file descriptors, not floppy disks.)"
3004         val="$undef"
3005 fi
3006 set d_suidsafe
3007 eval $setvar
3008
3009 $rm -f reflect flect
3010
3011 : now see if they want to do setuid emulation
3012 echo " "
3013 val="$undef"
3014 case "$d_suidsafe" in
3015 "$define")
3016         val="$undef"
3017         echo "No need to emulate SUID scripts since they are secure here." >& 4
3018         ;;
3019 *)
3020         $cat <<EOM
3021 Some systems have disabled setuid scripts, especially systems where
3022 setuid scripts cannot be secure.  On systems where setuid scripts have
3023 been disabled, the setuid/setgid bits on scripts are currently
3024 useless.  It is possible for $package to detect those bits and emulate
3025 setuid/setgid in a secure fashion.  This emulation will only work if
3026 setuid scripts have been disabled in your kernel.
3027
3028 EOM
3029         case "$d_dosuid" in
3030         "$define") dflt=y ;;
3031         *) dflt=n ;;
3032         esac
3033         rp="Do you want to do setuid/setgid emulation?"
3034         . ./myread
3035         case "$ans" in
3036         [yY]*)  val="$define";;
3037         *)      val="$undef";;
3038         esac
3039         ;;
3040 esac
3041 set d_dosuid
3042 eval $setvar
3043
3044 : determine where manual pages are on this system
3045 echo " "
3046 case "$sysman" in
3047 '') 
3048         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
3049         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
3050         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
3051         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
3052         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
3053         sysman=`./loc . /usr/man/man1 $syspath`
3054         ;;
3055 esac
3056 if $test -d "$sysman"; then
3057         echo "System manual is in $sysman." >&4
3058 else
3059         echo "Could not find manual pages in source form." >&4
3060 fi
3061
3062 : see what memory models we can support
3063 case "$models" in
3064 '')
3065         $cat >pdp11.c <<'EOP'
3066 main() {
3067 #ifdef pdp11
3068         exit(0);
3069 #else
3070         exit(1);
3071 #endif
3072 }
3073 EOP
3074         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
3075         if $test -f pdp11 && ./pdp11 2>/dev/null; then
3076                 dflt='unsplit split'
3077         else
3078                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
3079                 case "$tans" in
3080                 X) dflt='none';;
3081                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
3082                                 dflt='small'
3083                         else
3084                                 dflt=''
3085                         fi
3086                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
3087                                 dflt="$dflt medium"
3088                         fi
3089                         if $test -d /lib/large || $test -d /usr/lib/large; then
3090                                 dflt="$dflt large"
3091                         fi
3092                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
3093                                 dflt="$dflt huge"
3094                         fi
3095                 esac
3096         fi;;
3097 *) dflt="$models";;
3098 esac
3099 $cat <<EOM
3100  
3101 Some systems have different model sizes.  On most systems they are called
3102 small, medium, large, and huge.  On the PDP11 they are called unsplit and
3103 split.  If your system doesn't support different memory models, say "none".
3104 If you wish to force everything to one memory model, say "none" here and
3105 put the appropriate flags later when it asks you for other cc and ld flags.
3106 Venix systems may wish to put "none" and let the compiler figure things out.
3107 (In the following question multiple model names should be space separated.)
3108
3109 The default for most systems is "none".
3110
3111 EOM
3112 rp="Which memory models are supported?"
3113 . ./myread
3114 models="$ans"
3115
3116 case "$models" in
3117 none)
3118         small=''
3119         medium=''
3120         large=''
3121         huge=''
3122         unsplit=''
3123         split=''
3124         ;;
3125 *split)
3126         case "$split" in
3127         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
3128                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
3129                         dflt='-i'
3130                 else
3131                         dflt='none'
3132                 fi;;
3133         *) dflt="$split";;
3134         esac
3135         rp="What flag indicates separate I and D space?"
3136         . ./myread
3137         tans="$ans"
3138         case "$tans" in
3139         none) tans='';;
3140         esac
3141         split="$tans"
3142         unsplit='';;
3143 *large*|*small*|*medium*|*huge*)
3144         case "$models" in
3145         *large*)
3146                 case "$large" in
3147                 '') dflt='-Ml';;
3148                 *) dflt="$large";;
3149                 esac
3150         rp="What flag indicates large model?"
3151         . ./myread
3152         tans="$ans"
3153         case "$tans" in
3154         none) tans='';
3155         esac
3156         large="$tans";;
3157         *) large='';;
3158         esac
3159         case "$models" in
3160         *huge*) case "$huge" in
3161                 '') dflt='-Mh';;
3162                 *) dflt="$huge";;
3163                 esac
3164                 rp="What flag indicates huge model?"
3165                 . ./myread
3166                 tans="$ans"
3167                 case "$tans" in
3168                 none) tans='';
3169                 esac
3170                 huge="$tans";;
3171         *) huge="$large";;
3172         esac
3173         case "$models" in
3174         *medium*) case "$medium" in
3175                 '') dflt='-Mm';;
3176                 *) dflt="$medium";;
3177                 esac
3178                 rp="What flag indicates medium model?"
3179                 . ./myread
3180                 tans="$ans"
3181                 case "$tans" in
3182                 none) tans='';
3183                 esac
3184                 medium="$tans";;
3185         *) medium="$large";;
3186         esac
3187         case "$models" in
3188         *small*) case "$small" in
3189                 '') dflt='none';;
3190                 *) dflt="$small";;
3191                 esac
3192                 rp="What flag indicates small model?"
3193                 . ./myread
3194                 tans="$ans"
3195                 case "$tans" in
3196                 none) tans='';
3197                 esac
3198                 small="$tans";;
3199         *) small='';;
3200         esac
3201         ;;
3202 *)
3203         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3204         ;;
3205 esac
3206 $rm -f pdp11.* pdp11
3207
3208 : see if we need a special compiler
3209 echo " "
3210 if ./usg; then
3211         case "$cc" in
3212         '') case "$Mcc" in
3213                 /*) dflt='Mcc';;
3214                 *) case "$large" in
3215                         -M*) dflt='cc';;
3216                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3217                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3218                                                 dflt='cc'
3219                                         else
3220                                                 dflt='cc -M'
3221                                         fi
3222                                 else
3223                                         dflt='cc'
3224                                 fi;;
3225                         esac;;
3226                 esac;;
3227         *)  dflt="$cc";;
3228         esac
3229         case "$dflt" in
3230         *M*)    $cat <<'EOM'
3231 On some older systems the default C compiler will not resolve multiple global
3232 references that happen to have the same name.  On some such systems the "Mcc"
3233 command may be used to force these to be resolved.  On other systems a "cc -M"
3234 command is required.  (Note that the -M flag on other systems indicates a
3235 memory model to use!) If you have the Gnu C compiler, you might wish to use
3236 that instead.
3237
3238 EOM
3239         ;;
3240         esac
3241         rp="Use which C compiler?"
3242         . ./myread
3243         cc="$ans"
3244 else
3245         case "$cc" in
3246         '') dflt=cc;;
3247         *) dflt="$cc";;
3248         esac
3249         rp="Use which C compiler?"
3250         . ./myread
3251         cc="$ans"
3252 fi
3253 : Look for a hint-file generated 'call-back-unit'.  Now that the
3254 : user has specified the compiler, we may need to set or change some
3255 : other defaults.
3256 if $test -f cc.cbu; then
3257     . ./cc.cbu
3258 fi
3259 echo " "
3260 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3261 $cat >gccvers.c <<EOM
3262 #include <stdio.h>
3263 int main() {
3264 #ifdef __GNUC__
3265 #ifdef __VERSION__
3266         printf("%s\n", __VERSION__);
3267 #else
3268         printf("%s\n", "1");
3269 #endif
3270 #endif
3271         exit(0);
3272 }
3273 EOM
3274 if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
3275         gccversion=`./gccvers`
3276         case "$gccversion" in
3277         '') echo "You are not using GNU cc." ;;
3278         *)  echo "You are using GNU cc $gccversion." ;;
3279         esac
3280 else
3281         echo " "
3282         echo "*** WHOA THERE!!! ***" >&4
3283         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3284         case "$knowitall" in
3285         '')
3286         echo "    You'd better start hunting for one and let me know about it." >&4
3287                 exit 1
3288                 ;;
3289         esac
3290 fi
3291 $rm -f gccvers*
3292 case "$gccversion" in
3293 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3294 esac
3295
3296 : What should the include directory be ?
3297 echo " "
3298 $echo $n "Hmm...  $c"
3299 dflt='/usr/include'
3300 incpath=''
3301 mips_type=''
3302 if $test -f /bin/mips && /bin/mips; then
3303         echo "Looks like a MIPS system..."
3304         $cat >usr.c <<'EOCP'
3305 #ifdef SYSTYPE_BSD43
3306 /bsd43
3307 #endif
3308 EOCP
3309         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3310                 dflt='/bsd43/usr/include'
3311                 incpath='/bsd43'
3312                 mips_type='BSD 4.3'
3313         else
3314                 mips_type='System V'
3315         fi
3316         $rm -f usr.c usr.out
3317         echo "and you're compiling with the $mips_type compiler and libraries."
3318         xxx_prompt=y
3319         echo "exit 0" >mips
3320 else
3321         echo "Doesn't look like a MIPS system."
3322         xxx_prompt=n
3323         echo "exit 1" >mips
3324 fi
3325 chmod +x mips
3326 $eunicefix mips
3327 case "$usrinc" in
3328 '') ;;
3329 *) dflt="$usrinc";;
3330 esac
3331 case "$xxx_prompt" in
3332 y)      fn=d/
3333         echo " "
3334         rp='Where are the include files you want to use?'
3335         . ./getfile
3336         usrinc="$ans"
3337         ;;
3338 *)      usrinc="$dflt"
3339         ;;
3340 esac
3341
3342 : see how we invoke the C preprocessor
3343 echo " "
3344 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3345 cat <<'EOT' >testcpp.c
3346 #define ABC abc
3347 #define XYZ xyz
3348 ABC.XYZ
3349 EOT
3350 cd ..
3351 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3352 chmod 755 cppstdin
3353 wrapper=`pwd`/cppstdin
3354 ok='false'
3355 cd UU
3356
3357 if $test "X$cppstdin" != "X" && \
3358         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3359         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3360 then
3361         echo "You used to use $cppstdin $cppminus so we'll use that again."
3362         case "$cpprun" in
3363         '') echo "But let's see if we can live without a wrapper..." ;;
3364         *)
3365                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3366                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3367                 then
3368                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3369                         ok='true'
3370                 else
3371                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3372                 fi
3373                 ;;
3374         esac
3375 else
3376         case "$cppstdin" in
3377         '') ;;
3378         *)
3379                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3380                 ;;
3381         esac
3382 fi
3383
3384 if $ok; then
3385         : nothing
3386 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3387         $cc -E <testcpp.c >testcpp.out 2>&1; \
3388         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3389         echo "Yup, it does."
3390         x_cpp="$cc -E"
3391         x_minus='';
3392 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3393         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3394         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3395         echo "Yup, it does."
3396         x_cpp="$cc -E"
3397         x_minus='-';
3398 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3399         $cc -P <testcpp.c >testcpp.out 2>&1; \
3400         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3401         echo "Yipee, that works!"
3402         x_cpp="$cc -P"
3403         x_minus='';
3404 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3405         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3406         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3407         echo "At long last!"
3408         x_cpp="$cc -P"
3409         x_minus='-';
3410 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3411         $cpp <testcpp.c >testcpp.out 2>&1; \
3412         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3413         echo "It works!"
3414         x_cpp="$cpp"
3415         x_minus='';
3416 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3417         $cpp - <testcpp.c >testcpp.out 2>&1; \
3418         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3419         echo "Hooray, it works!  I was beginning to wonder."
3420         x_cpp="$cpp"
3421         x_minus='-';
3422 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3423         $wrapper <testcpp.c >testcpp.out 2>&1; \
3424         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3425         x_cpp="$wrapper"
3426         x_minus=''
3427         echo "Eureka!"
3428 else
3429         dflt=''
3430         rp="No dice.  I can't find a C preprocessor.  Name one:"
3431         . ./myread
3432         x_cpp="$ans"
3433         x_minus=''
3434         $x_cpp <testcpp.c >testcpp.out 2>&1
3435         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3436                 echo "OK, that will do." >&4
3437         else
3438 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3439                 exit 1
3440         fi
3441 fi
3442
3443 case "$ok" in
3444 false)
3445         cppstdin="$x_cpp"
3446         cppminus="$x_minus"
3447         cpprun="$x_cpp"
3448         cpplast="$x_minus"
3449         set X $x_cpp
3450         shift
3451         case "$1" in
3452         "$cpp")
3453                 echo "Perhaps can we force $cc -E using a wrapper..."
3454                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3455                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3456                 then
3457                         echo "Yup, we can."
3458                         cppstdin="$wrapper"
3459                         cppminus='';
3460                 else
3461                         echo "Nope, we'll have to live without it..."
3462                 fi
3463                 ;;
3464         esac
3465         case "$cpprun" in
3466         "$wrapper")
3467                 cpprun=''
3468                 cpplast=''
3469                 ;;
3470         esac
3471         ;;
3472 esac
3473
3474 case "$cppstdin" in
3475 "$wrapper") ;;
3476 *) $rm -f $wrapper;;
3477 esac
3478 $rm -f testcpp.c testcpp.out
3479
3480 : Set private lib path
3481 case "$plibpth" in
3482 '') if ./mips; then
3483                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3484         fi;;
3485 esac
3486 case "$libpth" in
3487 ' ') dlist='';;
3488 '') dlist="$loclibpth $plibpth $glibpth";;
3489 *) dlist="$libpth";;
3490 esac
3491
3492 : Now check and see which directories actually exist, avoiding duplicates
3493 libpth=''
3494 for xxx in $dlist
3495 do
3496     if $test -d $xxx; then
3497                 case " $libpth " in
3498                 *" $xxx "*) ;;
3499                 *) libpth="$libpth $xxx";;
3500                 esac
3501     fi
3502 done
3503 $cat <<'EOM'
3504
3505 Some systems have incompatible or broken versions of libraries.  Among
3506 the directories listed in the question below, please remove any you
3507 know not to be holding relevant libraries, and add any that are needed.
3508 Say "none" for none.
3509
3510 EOM
3511 case "$libpth" in
3512 '') dflt='none';;
3513 *)
3514         set X $libpth
3515         shift
3516         dflt=${1+"$@"}
3517         ;;
3518 esac
3519 rp="Directories to use for library searches?"
3520 . ./myread
3521 case "$ans" in
3522 none) libpth=' ';;
3523 *) libpth="$ans";;
3524 esac
3525
3526 : compute shared library extension
3527 case "$so" in
3528 '')
3529         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3530                 dflt='sl'
3531         else
3532                 dflt='so'
3533         fi
3534         ;;
3535 *) dflt="$so";;
3536 esac
3537 $cat <<EOM
3538
3539 On some systems, shared libraries may be available.  Answer 'none' if
3540 you want to suppress searching of shared libraries for the remaining
3541 of this configuration.
3542
3543 EOM
3544 rp='What is the file extension used for shared libraries?'
3545 . ./myread
3546 so="$ans"
3547
3548 : Define several unixisms.
3549 : Hints files or command line option can be used to override them.
3550 : The convoluted testing is in case hints files set either the old
3551 : or the new name.
3552 case "$_exe" in
3553 '')     case "$exe_ext" in
3554     '') ;;
3555         *)      _exe="$exe_ext" ;;
3556         esac
3557         ;;
3558 esac
3559 case "$_a" in
3560 '')     case "$lib_ext" in
3561     '') _a='.a';;
3562         *)      _a="$lib_ext" ;;
3563         esac
3564         ;;
3565 esac
3566 case "$_o" in
3567 '') case "$obj_ext" in
3568         '')     _o='.o';;
3569         *)      _o="$obj_ext";;
3570         esac
3571         ;;
3572 esac
3573 case "$p_" in
3574 '') case "$path_sep" in
3575         '')     p_=':';;
3576         *)      p_="$path_sep";;
3577         esac
3578         ;;
3579 esac
3580 exe_ext=$_exe
3581 lib_ext=$_a
3582 obj_ext=$_o
3583 path_sep=$p_
3584
3585 : Which makefile gets called first.  This is used by make depend.
3586 case "$firstmakefile" in
3587 '') firstmakefile='makefile';;
3588 esac
3589
3590 : Looking for optional libraries
3591 echo " "
3592 echo "Checking for optional libraries..." >&4
3593 case "$libs" in
3594 ' '|'') dflt='';;
3595 *) dflt="$libs";;
3596 esac
3597 case "$libswanted" in
3598 '') libswanted='c_s';;
3599 esac
3600 for thislib in $libswanted; do
3601         
3602         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
3603                 echo "Found -l$thislib (shared)."
3604                 case " $dflt " in
3605                 *"-l$thislib "*);;
3606                 *) dflt="$dflt -l$thislib";;
3607                 esac
3608         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3609                 echo "Found -l$thislib (shared)."
3610                 case " $dflt " in
3611                 *"-l$thislib "*);;
3612                 *) dflt="$dflt -l$thislib";;
3613                 esac
3614         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3615                 echo "Found -l$thislib."
3616                 case " $dflt " in
3617                 *"-l$thislib "*);;
3618                 *) dflt="$dflt -l$thislib";;
3619                 esac
3620         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3621                 echo "Found -l$thislib."
3622                 case " $dflt " in
3623                 *"-l$thislib "*);;
3624                 *) dflt="$dflt -l$thislib";;
3625                 esac
3626         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3627                 echo "Found -l${thislib}_s."
3628                 case " $dflt " in
3629                 *"-l$thislib "*);;
3630                 *) dflt="$dflt -l${thislib}_s";;
3631                 esac
3632         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3633                 echo "Found -l$thislib."
3634                 case " $dflt " in
3635                 *"-l$thislib "*);;
3636                 *) dflt="$dflt -l$thislib";;
3637                 esac
3638         else
3639                 echo "No -l$thislib."
3640         fi
3641 done
3642 set X $dflt
3643 shift
3644 dflt="$*"
3645 case "$libs" in
3646 '') dflt="$dflt";;
3647 *) dflt="$libs";;
3648 esac
3649 case "$dflt" in
3650 ' '|'') dflt='none';;
3651 esac
3652
3653 $cat <<EOM
3654  
3655 Some versions of Unix support shared libraries, which make executables smaller
3656 but make load time slightly longer.
3657
3658 On some systems, mostly System V Release 3's, the shared library is included
3659 by putting the option "-lc_s" as the last thing on the cc command line when
3660 linking.  Other systems use shared libraries by default.  There may be other
3661 libraries needed to compile $package on your machine as well.  If your system
3662 needs the "-lc_s" option, include it here.  Include any other special libraries
3663 here as well.  Say "none" for none.
3664 EOM
3665
3666 echo " "
3667 rp="Any additional libraries?"
3668 . ./myread
3669 case "$ans" in
3670 none) libs=' ';;
3671 *) libs="$ans";;
3672 esac
3673
3674 : determine optimize, if desired, or use for debug flag also
3675 case "$optimize" in
3676 ' '|$undef) dflt='none';;
3677 '') dflt='-O';;
3678 *) dflt="$optimize";;
3679 esac
3680 $cat <<EOH
3681
3682 Some C compilers have problems with their optimizers.  By default, $package
3683 compiles with the -O flag to use the optimizer.  Alternately, you might want
3684 to use the symbolic debugger, which uses the -g flag (on traditional Unix
3685 systems).  Either flag can be specified here.  To use neither flag, specify
3686 the word "none".
3687
3688 EOH
3689 rp="What optimizer/debugger flag should be used?"
3690 . ./myread
3691 optimize="$ans"
3692 case "$optimize" in
3693 'none') optimize=" ";;
3694 esac
3695
3696 dflt=''
3697 : We will not override a previous value, but we might want to
3698 : augment a hint file
3699 case "$hint" in
3700 none|recommended)
3701         case "$gccversion" in
3702         1*) dflt='-fpcc-struct-return' ;;
3703         esac
3704         case "$optimize" in
3705         *-g*) dflt="$dflt -DDEBUGGING";;
3706         esac
3707         case "$gccversion" in
3708         2*) if test -d /etc/conf/kconfig.d &&
3709                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3710                 then
3711                         dflt="$dflt -posix"
3712                 fi
3713                 ;;
3714         esac
3715         ;;
3716 esac
3717
3718 case "$mips_type" in
3719 *BSD*|'') inclwanted="$locincpth $usrinc";;
3720 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3721 esac
3722 for thisincl in $inclwanted; do
3723         if $test -d $thisincl; then
3724                 if $test x$thisincl != x$usrinc; then
3725                         case "$dflt" in
3726                         *$thisincl*);;
3727                         *) dflt="$dflt -I$thisincl";;
3728                         esac
3729                 fi
3730         fi
3731 done
3732
3733 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3734         xxx=true;
3735 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3736         xxx=true;
3737 else
3738         xxx=false;
3739 fi;
3740 if $xxx; then
3741         case "$dflt" in
3742         *$2*);;
3743         *) dflt="$dflt -D$2";;
3744         esac;
3745 fi'
3746
3747 if ./osf1; then
3748         set signal.h __LANGUAGE_C__; eval $inctest
3749 else
3750         set signal.h LANGUAGE_C; eval $inctest
3751 fi
3752
3753 case "$hint" in
3754 none|recommended) dflt="$ccflags $dflt" ;;
3755 *) dflt="$ccflags";;
3756 esac
3757
3758 case "$dflt" in
3759 ''|' ') dflt=none;;
3760 esac
3761 $cat <<EOH
3762
3763 Your C compiler may want other flags.  For this question you should include
3764 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3765 but you should NOT include libraries or ld flags like -lwhatever.  If you
3766 want $package to honor its debug switch, you should include -DDEBUGGING here.
3767 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
3768
3769 To use no flags, specify the word "none".
3770
3771 EOH
3772 set X $dflt
3773 shift
3774 dflt=${1+"$@"}
3775 rp="Any additional cc flags?"
3776 . ./myread
3777 case "$ans" in
3778 none) ccflags='';;
3779 *) ccflags="$ans";;
3780 esac
3781
3782 : the following weeds options from ccflags that are of no interest to cpp
3783 cppflags="$ccflags"
3784 case "$gccversion" in
3785 1*) cppflags="$cppflags -D__GNUC__"
3786 esac
3787 case "$mips_type" in
3788 '');;
3789 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3790 esac
3791 case "$cppflags" in
3792 '');;
3793 *)
3794         echo " "
3795         echo "Let me guess what the preprocessor flags are..." >&4
3796         set X $cppflags
3797         shift
3798         cppflags=''
3799         $cat >cpp.c <<'EOM'
3800 #define BLURFL foo
3801
3802 BLURFL xx LFRULB
3803 EOM
3804         previous=''
3805         for flag in $*
3806         do
3807                 case "$flag" in
3808                 -*) ftry="$flag";;
3809                 *) ftry="$previous $flag";;
3810                 esac
3811                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
3812                         >cpp1.out 2>/dev/null && \
3813                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
3814                         >cpp2.out 2>/dev/null && \
3815                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3816                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3817                 then
3818                         cppflags="$cppflags $ftry"
3819                         previous=''
3820                 else
3821                         previous="$flag"
3822                 fi
3823         done
3824         set X $cppflags
3825         shift
3826         cppflags=${1+"$@"}
3827         case "$cppflags" in
3828         *-*)  echo "They appear to be: $cppflags";;
3829         esac
3830         $rm -f cpp.c cpp?.out
3831         ;;
3832 esac
3833
3834 : flags used in final linking phase
3835 case "$ldflags" in
3836 '') if ./venix; then
3837                 dflt='-i -z'
3838         else
3839                 dflt=''
3840         fi
3841         case "$ccflags" in
3842         *-posix*) dflt="$dflt -posix" ;;
3843         esac
3844         ;;
3845 *) dflt="$ldflags";;
3846 esac
3847
3848 : Try to guess additional flags to pick up local libraries.
3849 for thislibdir in $libpth; do
3850         case " $loclibpth " in
3851         *" $thislibdir "*)
3852                 case "$dflt " in 
3853                 *"-L$thislibdir "*) ;;
3854                 *)  dflt="$dflt -L$thislibdir" ;;
3855                 esac
3856                 ;;
3857         esac
3858 done
3859
3860 case "$dflt" in
3861 '') dflt='none' ;;
3862 esac
3863
3864 $cat <<EOH
3865
3866 Your C linker may need flags.  For this question you should
3867 include -L/whatever and any other flags used by the C linker, but you
3868 should NOT include libraries like -lwhatever.
3869
3870 Make sure you include the appropriate -L/path flags if your C linker
3871 does not normally search all of the directories you specified above,
3872 namely
3873         $libpth
3874 To use no flags, specify the word "none".
3875
3876 EOH
3877
3878 rp="Any additional ld flags (NOT including libraries)?"
3879 . ./myread
3880 case "$ans" in
3881 none) ldflags='';;
3882 *) ldflags="$ans";;
3883 esac
3884 rmlist="$rmlist pdp11"
3885
3886 : coherency check
3887 echo " "
3888 echo "Checking your choice of C compiler and flags for coherency..." >&4
3889 set X $cc $optimize $ccflags $ldflags -o try try.c $libs
3890 shift
3891 $cat >try.msg <<EOM
3892 I've tried to compile and run a simple program with:
3893
3894         $*
3895         ./try
3896
3897 and I got the following output:
3898
3899 EOM
3900 $cat > try.c <<'EOF'
3901 #include <stdio.h>
3902 main() { printf("Ok\n"); exit(0); }
3903 EOF
3904 dflt=y
3905 if sh -c "$cc $optimize $ccflags $ldflags -o try try.c $libs" >>try.msg 2>&1; then
3906         if sh -c './try' >>try.msg 2>&1; then
3907                 xxx=`./try`
3908                 case "$xxx" in
3909                 "Ok") dflt=n ;;
3910                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
3911                         case " $libs " in
3912                         *" -lsfio "*)
3913                                 cat >> try.msg <<'EOQS'
3914 If $libs contains -lsfio, and sfio is mis-configured, then it
3915 sometimes (apparently) runs and exits with a 0 status, but with no
3916 output!  It may have to do with sfio's use of _exit vs. exit.
3917
3918 EOQS
3919                                 rp="You have a big problem.  Shall I abort Configure"
3920                                 dflt=y
3921                                 ;;
3922                         esac
3923                         ;;
3924                 esac
3925         else
3926                 echo "The program compiled OK, but exited with status $?." >>try.msg
3927                 rp="You have a problem.  Shall I abort Configure"
3928                 dflt=y
3929         fi
3930 else
3931         echo "I can't compile the test program." >>try.msg
3932         rp="You have a BIG problem.  Shall I abort Configure"
3933         dflt=y
3934 fi
3935 case "$dflt" in
3936 y)
3937         $cat try.msg >&4
3938         case "$knowitall" in
3939         '')
3940                 echo "(The supplied flags might be incorrect with this C compiler.)"
3941                 ;;
3942         *) dflt=n;;
3943         esac
3944         echo " "
3945         . ./myread
3946         case "$ans" in
3947         n*|N*) ;;
3948         *)      echo "Ok.  Stopping Configure." >&4
3949                 exit 1
3950                 ;;
3951         esac
3952         ;;
3953 n) echo "OK, that should do.";;
3954 esac
3955 $rm -f try try.* core
3956
3957 : Cruising for prototypes
3958 echo " "
3959 echo "Checking out function prototypes..." >&4
3960 $cat >prototype.c <<'EOCP'
3961 main(int argc, char *argv[]) {
3962         exit(0);}
3963 EOCP
3964 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
3965         echo "Your C compiler appears to support function prototypes."
3966         val="$define"
3967 else
3968         echo "Your C compiler doesn't seem to understand function prototypes."
3969         val="$undef"
3970 fi
3971 set prototype
3972 eval $setvar
3973 $rm -f prototype*
3974
3975 case "$prototype" in
3976 "$define") ;;
3977 *)      ansi2knr='ansi2knr'
3978         echo " "
3979         cat <<EOM >&4
3980
3981 $me:  FATAL ERROR:
3982 This version of $package can only be compiled by a compiler that 
3983 understands function prototypes.  Unfortunately, your C compiler 
3984         $cc $ccflags
3985 doesn't seem to understand them.  Sorry about that.
3986
3987 If GNU cc is avaiable for your system, perhaps you could try that instead.  
3988
3989 Eventually, we hope to support building Perl with pre-ANSI compilers.
3990 If you would like to help in that effort, please contact <perlbug@perl.org>.
3991
3992 Aborting Configure now.
3993 EOM
3994         exit 2
3995         ;;
3996 esac
3997
3998 : determine where public executables go
3999 echo " "
4000 set dflt bin bin
4001 eval $prefixit
4002 fn=d~
4003 rp='Pathname where the public executables will reside?'
4004 . ./getfile
4005 if $test "X$ansexp" != "X$binexp"; then
4006         installbin=''
4007 fi
4008 bin="$ans"
4009 binexp="$ansexp"
4010 if $afs; then
4011         $cat <<EOM
4012
4013 Since you are running AFS, I need to distinguish the directory in which
4014 executables reside from the directory in which they are installed (and from
4015 which they are presumably copied to the former directory by occult means).
4016
4017 EOM
4018         case "$installbin" in
4019         '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
4020         *) dflt="$installbin";;
4021         esac
4022         fn=de~
4023         rp='Where will public executables be installed?'
4024         . ./getfile
4025         installbin="$ans"
4026 else
4027         installbin="$binexp"
4028 fi
4029
4030 : define a shorthand compile call
4031 compile='
4032 mc_file=$1;
4033 shift;
4034 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4035 : define a shorthand compile call for compilations that should be ok.
4036 compile_ok='
4037 mc_file=$1;
4038 shift;
4039 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4040
4041 echo " "
4042 echo "Checking for GNU C Library..." >&4
4043 cat >gnulibc.c <<EOM
4044 #include <stdio.h>
4045 int
4046 main()
4047 {
4048 #ifdef __GLIBC__
4049     exit(0);
4050 #else
4051     exit(1);
4052 #endif
4053 }
4054 EOM
4055 set gnulibc
4056 if eval $compile_ok && ./gnulibc; then
4057         val="$define"
4058         echo "You are using the GNU C Library"
4059 else
4060         val="$undef"
4061         echo "You are not using the GNU C Library"
4062 fi
4063 $rm -f gnulibc*
4064 set d_gnulibc
4065 eval $setvar
4066
4067 : see if nm is to be used to determine whether a symbol is defined or not
4068 case "$usenm" in
4069 '')
4070         dflt=''
4071         case "$d_gnulibc" in
4072         "$define")
4073                 echo " "
4074                 echo "nm probably won't work on the GNU C Library." >&4
4075                 dflt=n
4076                 ;;
4077         esac
4078         case "$dflt" in
4079         '') 
4080                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4081                         echo " "
4082                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4083                         echo "'nm' won't be sufficient on this sytem." >&4
4084                         dflt=n
4085                 fi
4086                 ;;
4087         esac
4088         case "$dflt" in
4089         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4090                 if $test $dflt -gt 20; then
4091                         dflt=y
4092                 else
4093                         dflt=n
4094                 fi
4095                 ;;
4096         esac
4097         ;;
4098 *)
4099         case "$usenm" in
4100         true|$define) dflt=y;;
4101         *) dflt=n;;
4102         esac
4103         ;;
4104 esac
4105 $cat <<EOM
4106
4107 I can use $nm to extract the symbols from your C libraries. This
4108 is a time consuming task which may generate huge output on the disk (up
4109 to 3 megabytes) but that should make the symbols extraction faster. The
4110 alternative is to skip the 'nm' extraction part and to compile a small
4111 test program instead to determine whether each symbol is present. If
4112 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4113 this may be the best solution.
4114
4115 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4116
4117 EOM
4118 rp="Shall I use $nm to extract C symbols from the libraries?"
4119 . ./myread
4120 case "$ans" in
4121 [Nn]*) usenm=false;;
4122 *) usenm=true;;
4123 esac
4124
4125 runnm=$usenm
4126 case "$reuseval" in
4127 true) runnm=false;;
4128 esac
4129
4130 : nm options which may be necessary
4131 case "$nm_opt" in
4132 '') if $test -f /mach_boot; then
4133                 nm_opt=''       # Mach
4134         elif $test -d /usr/ccs/lib; then
4135                 nm_opt='-p'     # Solaris (and SunOS?)
4136         elif $test -f /dgux; then
4137                 nm_opt='-p'     # DG-UX
4138         elif $test -f /lib64/rld; then
4139                 nm_opt='-p'     # 64-bit Irix
4140         else
4141                 nm_opt=''
4142         fi;;
4143 esac
4144
4145 : nm options which may be necessary for shared libraries but illegal
4146 : for archive libraries.  Thank you, Linux.
4147 case "$nm_so_opt" in
4148 '')     case "$myuname" in
4149         *linux*)
4150                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4151                         nm_so_opt='--dynamic'
4152                 fi
4153                 ;;
4154         esac
4155         ;;
4156 esac
4157
4158 case "$runnm" in
4159 true)
4160 : get list of predefined functions in a handy place
4161 echo " "
4162 case "$libc" in
4163 '') libc=unknown
4164         case "$libs" in
4165         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4166         esac
4167         ;;
4168 esac
4169 libnames='';
4170 case "$libs" in
4171 '') ;;
4172 *)  for thislib in $libs; do
4173         case "$thislib" in
4174         -lc|-lc_s)
4175                 : Handle C library specially below.
4176                 ;;
4177         -l*)
4178                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4179                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4180                         :
4181                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4182                         :
4183                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4184                         :
4185                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4186                         :
4187                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4188                         :
4189                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4190                         :
4191                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4192                         :
4193                 else
4194                         try=''
4195                 fi
4196                 libnames="$libnames $try"
4197                 ;;
4198         *) libnames="$libnames $thislib" ;;
4199         esac
4200         done
4201         ;;
4202 esac
4203 xxx=normal
4204 case "$libc" in
4205 unknown)
4206         set /lib/libc.$so
4207         for xxx in $libpth; do
4208                 $test -r $1 || set $xxx/libc.$so
4209                 : The messy sed command sorts on library version numbers.
4210                 $test -r $1 || \
4211                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4212                         tr ' ' '\012' | egrep -v '\.[A-Za-z]*$' | $sed -e '
4213                                 h
4214                                 s/[0-9][0-9]*/0000&/g
4215                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4216                                 G
4217                                 s/\n/ /' | \
4218                          sort | $sed -e 's/^.* //'`
4219                 eval set \$$#
4220         done
4221         $test -r $1 || set /usr/ccs/lib/libc.$so
4222         $test -r $1 || set /lib/libsys_s$_a
4223         ;;
4224 *)
4225         set blurfl
4226         ;;
4227 esac
4228 if $test -r "$1"; then
4229         echo "Your (shared) C library seems to be in $1."
4230         libc="$1"
4231 elif $test -r /lib/libc && $test -r /lib/clib; then
4232         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4233         xxx=apollo
4234         libc='/lib/clib /lib/libc'
4235         if $test -r /lib/syslib; then
4236                 echo "(Your math library is in /lib/syslib.)"
4237                 libc="$libc /lib/syslib"
4238         fi
4239 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4240         echo "Your C library seems to be in $libc, as you said before."
4241 elif $test -r $incpath/usr/lib/libc$_a; then
4242         libc=$incpath/usr/lib/libc$_a;
4243         echo "Your C library seems to be in $libc.  That's fine."
4244 elif $test -r /lib/libc$_a; then
4245         libc=/lib/libc$_a;
4246         echo "Your C library seems to be in $libc.  You're normal."
4247 else
4248         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4249                 :
4250         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4251                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4252         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4253                 :
4254         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4255                 :
4256         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4257                 :
4258         else
4259                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4260         fi
4261         if $test -r "$tans"; then
4262                 echo "Your C library seems to be in $tans, of all places."
4263                 libc=$tans
4264         else
4265                 libc='blurfl'
4266         fi
4267 fi
4268 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4269         dflt="$libc"
4270         cat <<EOM
4271
4272 If the guess above is wrong (which it might be if you're using a strange
4273 compiler, or your machine supports multiple models), you can override it here.
4274
4275 EOM
4276 else
4277         dflt=''
4278         echo $libpth | tr ' ' '\012' | sort | uniq > libpath
4279         cat >&4 <<EOM
4280 I can't seem to find your C library.  I've looked in the following places:
4281
4282 EOM
4283         $sed 's/^/      /' libpath
4284         cat <<EOM
4285
4286 None of these seems to contain your C library. I need to get its name...
4287
4288 EOM
4289 fi
4290 fn=f
4291 rp='Where is your C library?'
4292 . ./getfile
4293 libc="$ans"
4294
4295 echo " "
4296 echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
4297 set X `cat libnames`
4298 shift
4299 xxx=files
4300 case $# in 1) xxx=file; esac
4301 echo "Extracting names from the following $xxx for later perusal:" >&4
4302 echo " "
4303 $sed 's/^/      /' libnames >&4
4304 echo " "
4305 $echo $n "This may take a while...$c" >&4
4306
4307 for file in $*; do
4308         case $file in
4309         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4310         *) $nm $nm_opt $file 2>/dev/null;;
4311         esac
4312 done >libc.tmp
4313
4314 $echo $n ".$c"
4315 $grep fprintf libc.tmp > libc.ptf
4316 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4317 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4318 xxx='[ADTSIW]'
4319 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4320         eval $xscan;\
4321         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4322                 eval $xrun
4323 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4324         eval $xscan;\
4325         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4326                 eval $xrun
4327 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4328         eval $xscan;\
4329         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4330                 eval $xrun
4331 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4332         eval $xscan;\
4333         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4334                 eval $xrun
4335 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4336         eval $xscan;\
4337         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4338                 eval $xrun
4339 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4340         eval $xscan;\
4341         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4342                 eval $xrun
4343 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4344                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4345         eval $xscan;\
4346         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4347                 eval $xrun
4348 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4349         eval $xscan;\
4350         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4351                 eval $xrun
4352 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4353         eval $xscan;\
4354         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4355                 eval $xrun
4356 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4357         eval $xscan;\
4358         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4359                 eval $xrun
4360 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4361         eval $xscan;\
4362         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4363                 eval $xrun
4364 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4365         eval $xscan;\
4366         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4367                 eval $xrun
4368 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4369         eval $xscan;\
4370         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4371                 eval $xrun
4372 else
4373         $nm -p $* 2>/dev/null >libc.tmp
4374         $grep fprintf libc.tmp > libc.ptf
4375         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4376                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4377         then
4378                 nm_opt='-p'
4379                 eval $xrun
4380         else
4381                 echo " "
4382                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4383                 com=''
4384                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4385                         for thisname in $libnames $libc; do
4386                                 $ar t $thisname >>libc.tmp
4387                         done
4388                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4389                         echo "Ok." >&4
4390                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4391                         # Repeat libc to extract forwarders to DLL entries too
4392                         for thisname in $libnames $libc; do
4393                                 $ar tv $thisname >>libc.tmp
4394                                 # Revision 50 of EMX has bug in $ar.
4395                                 # it will not extract forwarders to DLL entries
4396                                 # Use emximp which will extract exactly them.
4397                                 emximp -o tmp.imp $thisname \
4398                                     2>/dev/null && \
4399                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4400                                     < tmp.imp >>libc.tmp
4401                                 $rm tmp.imp
4402                         done
4403                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4404                         echo "Ok." >&4
4405                 else
4406                         echo "$ar didn't seem to work right." >&4
4407                         echo "Maybe this is a Cray...trying bld instead..." >&4
4408                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4409                         then
4410                                 for thisname in $libnames; do
4411                                         bld t $libnames | \
4412                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4413                                         $ar t $thisname >>libc.tmp
4414                                 done
4415                                 echo "Ok." >&4
4416                         else
4417                                 echo "That didn't work either.  Giving up." >&4
4418                                 exit 1
4419                         fi
4420                 fi
4421         fi
4422 fi
4423 nm_extract="$com"
4424 if $test -f /lib/syscalls.exp; then
4425         echo " "
4426         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4427         $sed -n 's/^\([^        ]*\)[   ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
4428 fi
4429 ;;
4430 esac
4431 $rm -f libnames libpath
4432
4433 : determine filename position in cpp output
4434 echo " "
4435 echo "Computing filename position in cpp output for #include directives..." >&4
4436 echo '#include <stdio.h>' > foo.c
4437 $cat >fieldn <<EOF
4438 $startsh
4439 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4440 $grep '^[       ]*#.*stdio\.h' | \
4441 while read cline; do
4442         pos=1
4443         set \$cline
4444         while $test \$# -gt 0; do
4445                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4446                         echo "\$pos"
4447                         exit 0
4448                 fi
4449                 shift
4450                 pos=\`expr \$pos + 1\`
4451         done
4452 done
4453 EOF
4454 chmod +x fieldn
4455 fieldn=`./fieldn`
4456 $rm -f foo.c fieldn
4457 case $fieldn in
4458 '') pos='???';;
4459 1) pos=first;;
4460 2) pos=second;;
4461 3) pos=third;;
4462 *) pos="${fieldn}th";;
4463 esac
4464 echo "Your cpp writes the filename in the $pos field of the line."
4465
4466 : locate header file
4467 $cat >findhdr <<EOF
4468 $startsh
4469 wanted=\$1
4470 name=''
4471 if test -f $usrinc/\$wanted; then
4472         echo "$usrinc/\$wanted"
4473         exit 0
4474 fi
4475 awkprg='{ print \$$fieldn }'
4476 echo "#include <\$wanted>" > foo\$\$.c
4477 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4478 $grep "^[       ]*#.*\$wanted" | \
4479 while read cline; do
4480         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4481         case "\$name" in
4482         */\$wanted) echo "\$name"; exit 0;;
4483         *) name='';;
4484         esac;
4485 done;
4486 $rm -f foo\$\$.c;
4487 case "\$name" in
4488 '') exit 1;;
4489 esac
4490 EOF
4491 chmod +x findhdr
4492
4493 : define an alternate in-header-list? function
4494 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4495 cont=true; xxf="echo \"<\$1> found.\" >&4";
4496 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4497 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4498 esac;
4499 case $# in 4) instead=instead;; *) instead="at last";; esac;
4500 while $test "$cont"; do
4501         xxx=`./findhdr $1`
4502         var=$2; eval "was=\$$2";
4503         if $test "$xxx" && $test -r "$xxx";
4504         then eval $xxf;
4505         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4506                 cont="";
4507         else eval $xxnf;
4508         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4509         set $yyy; shift; shift; yyy=$@;
4510         case $# in 0) cont="";;
4511         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4512                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4513         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4514                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4515         esac;
4516 done;
4517 while $test "$yyy";
4518 do set $yyy; var=$2; eval "was=\$$2";
4519         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4520         set $yyy; shift; shift; yyy=$@;
4521 done'
4522
4523 : see if dld is available
4524 set dld.h i_dld
4525 eval $inhdr
4526
4527 : is a C symbol defined?
4528 csym='tlook=$1;
4529 case "$3" in
4530 -v) tf=libc.tmp; tc=""; tdc="";;
4531 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4532 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4533 esac;
4534 tx=yes;
4535 case "$reuseval-$4" in
4536 true-) ;;
4537 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4538 esac;
4539 case "$tx" in
4540 yes)
4541         case "$runnm" in
4542         true)
4543                 if $contains $tlook $tf >/dev/null 2>&1;
4544                 then tval=true;
4545                 else tval=false;
4546                 fi;;
4547         *)
4548                 echo "main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
4549                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
4550                 then tval=true;
4551                 else tval=false;
4552                 fi;
4553                 $rm -f t t.c;;
4554         esac;;
4555 *)
4556         case "$tval" in
4557         $define) tval=true;;
4558         *) tval=false;;
4559         esac;;
4560 esac;
4561 eval "$2=$tval"'
4562
4563 : define an is-in-libc? function
4564 inlibc='echo " "; td=$define; tu=$undef;
4565 sym=$1; var=$2; eval "was=\$$2";
4566 tx=yes;
4567 case "$reuseval$was" in
4568 true) ;;
4569 true*) tx=no;;
4570 esac;
4571 case "$tx" in
4572 yes)
4573         set $sym tres -f;
4574         eval $csym;
4575         case "$tres" in
4576         true)
4577                 echo "$sym() found." >&4;
4578                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
4579         *)
4580                 echo "$sym() NOT found." >&4;
4581                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
4582         esac;;
4583 *)
4584         case "$was" in
4585         $define) echo "$sym() found." >&4;;
4586         *) echo "$sym() NOT found." >&4;;
4587         esac;;
4588 esac'
4589
4590 : see if dlopen exists
4591 xxx_runnm="$runnm"
4592 runnm=false
4593 set dlopen d_dlopen
4594 eval $inlibc
4595 runnm="$xxx_runnm"
4596
4597 : determine which dynamic loading, if any, to compile in
4598 echo " "
4599 dldir="ext/DynaLoader"
4600 case "$usedl" in
4601 $define|y|true)
4602         dflt='y'
4603         usedl="$define"
4604         ;;
4605 $undef|n|false)
4606         dflt='n'
4607         usedl="$undef"
4608         ;;
4609 *) 
4610         dflt='n'
4611         case "$d_dlopen" in
4612             $define) dflt='y' ;;
4613         esac
4614         case "$i_dld" in
4615             $define) dflt='y' ;;
4616         esac
4617         : Does a dl_xxx.xs file exist for this operating system
4618         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
4619         ;;
4620 esac
4621 rp="Do you wish to use dynamic loading?"
4622 . ./myread
4623 usedl="$ans"
4624 case "$ans" in
4625 y*) usedl="$define"
4626         case "$dlsrc" in
4627         '')
4628                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
4629                         dflt="$dldir/dl_${osname}.xs"
4630                 elif $test "$d_dlopen" = "$define" ; then
4631                         dflt="$dldir/dl_dlopen.xs"
4632                 elif $test "$i_dld" = "$define" ; then
4633                         dflt="$dldir/dl_dld.xs"
4634                 else
4635                         dflt=''
4636                 fi
4637                 ;;
4638         *)      dflt="$dldir/$dlsrc"
4639                 ;;
4640         esac
4641     echo "The following dynamic loading files are available:"
4642         : Can not go over to $dldir because getfile has path hard-coded in.
4643         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
4644         rp="Source file to use for dynamic loading"
4645         fn="fne"
4646         # XXX This getfile call will fail the existence check if you try 
4647         # building away from $src (this is not supported yet).
4648         . ./getfile
4649         usedl="$define"
4650         : emulate basename
4651         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
4652
4653         $cat << EOM
4654
4655 Some systems may require passing special flags to $cc -c to
4656 compile modules that will be used to create a shared library.
4657 To use no flags, say "none".
4658
4659 EOM
4660     case "$cccdlflags" in
4661     '') case "$gccversion" in
4662                 '') case "$osname" in
4663                         hpux)   dflt='+z' ;;
4664                         next)   dflt='none' ;;
4665                         irix*)  dflt='-KPIC' ;;
4666                         svr4*|esix*|solaris)
4667                                 case "$ccflags" in
4668                                         *-DDEBUGGING*)  dflt='-KPIC' ;;
4669                                         *)      dflt='-Kpic' ;;
4670                                 esac 
4671                                 ;;
4672                         sunos)  dflt='-pic' ;;
4673                         *)      dflt='none' ;;
4674                     esac
4675                         ;;
4676                 *)  case "$osname" in
4677                         svr4*|esix*|solaris)
4678                                 case "$ccflags" in
4679                                         *-DDEBUGGING*)  dflt='-fPIC' ;;
4680                                         *)      dflt='-fpic' ;;
4681                                 esac 
4682                                 ;;
4683                         *)      dflt='-fpic' ;;
4684                     esac ;;
4685             esac ;;
4686     *)  dflt="$cccdlflags" ;;
4687     esac
4688     rp="Any special flags to pass to $cc -c to compile shared library modules?"
4689     . ./myread
4690     case "$ans" in
4691     none) cccdlflags=' ' ;;
4692     *) cccdlflags="$ans" ;;
4693     esac
4694
4695     cat << EOM
4696
4697 Some systems use ld to create libraries that can be dynamically loaded,
4698 while other systems (such as those using ELF) use $cc.
4699
4700 EOM
4701         case "$ld" in
4702         '')     $cat >try.c <<'EOM'
4703 /* Test for whether ELF binaries are produced */
4704 #include <fcntl.h>
4705 #include <stdlib.h>
4706 main() {
4707         char b[4];
4708         int i = open("a.out",O_RDONLY);
4709         if(i == -1) 
4710                 exit(1); /* fail */
4711         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
4712                 exit(0); /* succeed (yes, it's ELF) */
4713         else
4714                 exit(1); /* fail */
4715 }
4716 EOM
4717                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
4718                         cat <<EOM
4719 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
4720 EOM
4721                         dflt="$cc"
4722                 else
4723                         echo "I'll use ld to build dynamic libraries."
4724                         dflt='ld'
4725                 fi
4726                 rm -f try.c a.out
4727                 ;;
4728         *)      dflt="$ld"
4729                 ;;
4730         esac
4731
4732     rp="What command should be used to create dynamic libraries?"
4733     . ./myread
4734         ld="$ans"
4735
4736     cat << EOM
4737
4738 Some systems may require passing special flags to $ld to create a
4739 library that can be dynamically loaded.  If your ld flags include
4740 -L/other/path options to locate libraries outside your loader's normal
4741 search path, you may need to specify those -L options here as well.  To
4742 use no flags, say "none".
4743
4744 EOM
4745     case "$lddlflags" in
4746     '') case "$osname" in
4747                         hpux)  dflt='-b' ;;
4748                         linux|irix*)    dflt='-shared' ;;
4749                         next)  dflt='none' ;;
4750                         solaris) dflt='-G' ;;
4751                         sunos) dflt='-assert nodefinitions' ;;
4752                         svr4*|esix*) dflt="-G $ldflags" ;;
4753                 *)     dflt='none' ;;
4754                         esac
4755                         ;;
4756     *) dflt="$lddlflags" ;;
4757     esac
4758
4759 : Try to guess additional flags to pick up local libraries.
4760 for thisflag in $ldflags; do
4761         case "$thisflag" in
4762         -L*)
4763                 case " $dflt " in
4764                 *" $thisflag "*) ;;
4765                 *) dflt="$dflt $thisflag" ;;
4766                 esac
4767                 ;;
4768         esac
4769 done
4770
4771 case "$dflt" in
4772 '') dflt='none' ;;
4773 esac
4774
4775     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
4776     . ./myread
4777     case "$ans" in
4778     none) lddlflags=' ' ;;
4779     *) lddlflags="$ans" ;;
4780     esac
4781
4782         cat <<EOM
4783
4784 Some systems may require passing special flags to $cc to indicate that
4785 the resulting executable will use dynamic linking.  To use no flags,
4786 say "none".
4787
4788 EOM
4789     case "$ccdlflags" in
4790     '') case "$osname" in
4791                 hpux)   dflt='-Wl,-E' ;;
4792                 linux)  dflt='-rdynamic' ;;
4793                 next)   dflt='none' ;;
4794                 sunos)  dflt='none' ;;
4795                 *)      dflt='none' ;;
4796             esac ;;
4797     *)  dflt="$ccdlflags" ;;
4798     esac
4799     rp="Any special flags to pass to $cc to use dynamic loading?"
4800     . ./myread
4801     case "$ans" in
4802     none) ccdlflags=' ' ;;
4803     *) ccdlflags="$ans" ;;
4804     esac
4805     ;;
4806 *)  usedl="$undef"
4807         ld='ld'
4808     dlsrc='dl_none.xs'
4809     lddlflags=''
4810     ccdlflags=''
4811     ;;
4812 esac
4813
4814 also=''
4815 case "$usedl" in
4816 $undef)
4817         # No dynamic loading being used, so don't bother even to prompt.
4818         useshrplib='false'
4819         ;;
4820 *)      case "$useshrplib" in
4821         '')     case "$osname" in
4822                 svr4*|dgux|dynixptx|esix|powerux)
4823                         dflt=y
4824                         also='Building a shared libperl is required for dynamic loading to work on your system.'
4825                         ;;
4826                 next*)
4827                         case "$osvers" in
4828                         4*)     dflt=y
4829                                 also='Building a shared libperl is needed for MAB support.'
4830                                 ;;
4831                         *)      dflt=n
4832                                 ;;
4833                         esac
4834                         ;;
4835                 *)      dflt=n
4836                         ;;
4837                 esac
4838                 ;;
4839         $define|true|[Yy]*)
4840                 dflt=y
4841                 ;;
4842         *)      dflt=n
4843                 ;;
4844         esac
4845         $cat << EOM
4846
4847 The perl executable is normally obtained by linking perlmain.c with
4848 libperl${_a}, any static extensions (usually just DynaLoader), and
4849 any other libraries needed on this system (such as -lm, etc.).  Since
4850 your system supports dynamic loading, it is probably possible to build
4851 a shared libperl.$so.  If you will have more than one executable linked
4852 to libperl.$so, this will significantly reduce the size of each
4853 executable, but it may have a noticeable affect on performance.  The
4854 default is probably sensible for your system.
4855 $also
4856
4857 EOM
4858         rp="Build a shared libperl.$so (y/n)"
4859         . ./myread
4860         case "$ans" in
4861         true|$define|[Yy]*)
4862                 useshrplib='true'
4863                 # Why does next4 have to be so different?
4864                 case "${osname}${osvers}" in
4865                 next4*) xxx='DYLD_LIBRARY_PATH' ;;
4866                 os2*)   xxx='' ;; # Nothing special needed.
4867                 *)              xxx='LD_LIBRARY_PATH' ;;
4868                 esac
4869                 if test X"$xxx" != "X"; then
4870                         $cat <<EOM  | $tee -a ../config.msg >&4
4871
4872 To build perl, you must add the current working directory to your
4873 $xxx environment variable before running make.  You can do
4874 this with
4875    $xxx=\`pwd\`; export $xxx
4876 for Bourne-style shells, or
4877    setenv $xxx \`pwd\`
4878 for Csh-style shells.  You *MUST* do this before running make.
4879
4880 EOM
4881                 fi
4882                 ;;
4883         *)      useshrplib='false' ;;
4884         esac
4885         ;;
4886 esac
4887
4888 case "$useshrplib" in
4889 true)
4890         case "$libperl" in
4891         '')
4892                 # Figure out a good name for libperl.so.  Since it gets stored in
4893                 # a version-specific architecture-dependent library, the version
4894                 # number isn't really that important, except for making cc/ld happy.
4895                 #
4896                 # A name such as libperl.so.3.1
4897                 majmin="libperl.$so.$patchlevel.$subversion"
4898                 # A name such as libperl.so.301
4899                 majonly=`echo $patchlevel $subversion |
4900                         $awk '{printf "%d%02d", $1, $2}'`
4901                 majonly=libperl.$so.$majonly
4902                 # I'd prefer to keep the os-specific stuff here to a minimum, and
4903                 # rely on figuring it out from the naming of libc.
4904                 case "${osname}${osvers}" in
4905                 next4*)
4906                         dflt=libperl.5.$so
4907                         # XXX How handle the --version stuff for MAB?
4908                         ;;
4909                 linux*)  # ld won't link with a bare -lperl otherwise.
4910                         dflt=libperl.$so
4911                         ;;
4912                 *)      # Try to guess based on whether libc has major.minor.
4913                         case "$libc" in
4914                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
4915                         *libc.$so.[0-9]*) dflt=$majonly ;;
4916                         *)      dflt=libperl.$so ;;
4917                         esac
4918                         ;;
4919                 esac
4920                 ;;
4921         *)      dflt=$libperl
4922                 ;;
4923         esac
4924         cat << EOM
4925
4926 I need to select a good name for the shared libperl.  If your system uses
4927 library names with major and minor numbers, then you might want something
4928 like $majmin.  Alternatively, if your system uses a single version
4929 number for shared libraries, then you might want to use $majonly.
4930 Or, your system might be quite happy with a simple libperl.$so.
4931
4932 Since the shared libperl will get installed into a version-specific
4933 architecture-dependent directory, the version number of the shared perl
4934 library probably isn't important, so the default should be o.k.
4935
4936 EOM
4937         rp='What name do you want to give to the shared libperl?'
4938         . ./myread
4939         libperl=$ans
4940         echo "Ok, I'll use $libperl"
4941         ;;
4942 *)
4943         libperl="libperl${_a}"
4944         ;;
4945 esac
4946
4947 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
4948 case "$shrpdir" in
4949 '') ;;
4950 *)      $cat >&4 <<EOM
4951 WARNING:  Use of the shrpdir variable for the installation location of
4952 the shared $libperl is not supported.  It was never documented and
4953 will not work in this version.  Let me (doughera@lafcol.lafayette.edu)
4954 know of any problems this may cause.
4955
4956 EOM
4957         case "$shrpdir" in
4958         "$archlibexp/CORE")
4959                 $cat >&4 <<EOM
4960 But your current setting of $shrpdir is
4961 the default anyway, so it's harmless.
4962 EOM
4963                 ;;
4964         *)
4965                 $cat >&4 <<EOM
4966 Further, your current attempted setting of $shrpdir
4967 conflicts with the value of $archlibexp/CORE
4968 that installperl will use.
4969 EOM
4970                 ;;
4971         esac
4972         ;;
4973 esac
4974
4975 # How will the perl executable find the installed shared $libperl?
4976 # Add $xxx to ccdlflags.
4977 # If we can't figure out a command-line option, use $shrpenv to
4978 # set env LD_RUN_PATH.  The main perl makefile uses this.
4979 shrpdir=$archlibexp/CORE
4980 xxx=''
4981 tmp_shrpenv=''
4982 if "$useshrplib"; then
4983     case "$osname" in 
4984         aix)
4985                 # We'll set it in Makefile.SH...
4986                 ;;
4987         solaris|netbsd)
4988                 xxx="-R $shrpdir"
4989                 ;;
4990         freebsd)
4991                 xxx="-Wl,-R$shrpdir"
4992                 ;;
4993         linux|irix*|dec_osf)
4994                 xxx="-Wl,-rpath,$shrpdir"
4995                 ;;
4996         next)
4997                 # next doesn't like the default...
4998                 ;;
4999         *)
5000                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5001                 ;;
5002         esac
5003         case "$xxx" in
5004         '') ;;
5005         *)      
5006                 # Only add $xxx if it isn't already in ccdlflags.
5007                 case " $ccdlflags " in
5008                 *" $xxx "*)     ;;
5009                 *)      ccdlflags="$ccdlflags $xxx"
5010                         cat <<EOM >&4
5011
5012 Adding $xxx to the flags
5013 passed to $ld so that the perl executable will find the 
5014 installed shared $libperl.
5015
5016 EOM
5017                         ;;
5018                 esac
5019                 ;;
5020         esac
5021 fi
5022 # Respect a hint or command-line value.
5023 case "$shrpenv" in
5024 '') shrpenv="$tmp_shrpenv" ;;
5025 esac
5026
5027 : determine where manual pages go
5028 set man1dir man1dir none
5029 eval $prefixit
5030 $cat <<EOM
5031
5032 $spackage has manual pages available in source form.
5033 EOM
5034 case "$nroff" in
5035 nroff)
5036         echo "However, you don't have nroff, so they're probably useless to you."
5037         case "$man1dir" in
5038         '') man1dir="none";;
5039         esac;;
5040 esac
5041 echo "If you don't want the manual sources installed, answer 'none'."
5042 case "$man1dir" in
5043 ' ') dflt=none
5044         ;;
5045 '')
5046         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5047         lookpath="$lookpath $prefixexp/man/p_man/man1"
5048         lookpath="$lookpath $prefixexp/man/u_man/man1"
5049         lookpath="$lookpath $prefixexp/man/man.1"
5050         case "$sysman" in
5051         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5052         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5053         esac
5054         set dflt
5055         eval $prefixup
5056         ;;
5057 *)  dflt="$man1dir"
5058         ;;
5059 esac
5060 echo " "
5061 fn=dn+~
5062 rp="Where do the main $spackage manual pages (source) go?"
5063 . ./getfile
5064 if $test "X$man1direxp" != "X$ansexp"; then
5065         installman1dir=''
5066 fi
5067 man1dir="$ans"
5068 man1direxp="$ansexp"
5069 case "$man1dir" in
5070 '') man1dir=' '
5071         installman1dir='';;
5072 esac
5073 if $afs; then
5074         $cat <<EOM
5075
5076 Since you are running AFS, I need to distinguish the directory in which
5077 manual pages reside from the directory in which they are installed (and from
5078 which they are presumably copied to the former directory by occult means).
5079
5080 EOM
5081         case "$installman1dir" in
5082         '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
5083         *) dflt="$installman1dir";;
5084         esac
5085         fn=de~
5086         rp='Where will man pages be installed?'
5087         . ./getfile
5088         installman1dir="$ans"
5089 else
5090         installman1dir="$man1direxp"
5091 fi
5092
5093 : What suffix to use on installed man pages
5094
5095 case "$man1dir" in
5096 ' ')
5097         man1ext='0'
5098         ;;
5099 *)
5100         rp="What suffix should be used for the main $spackage man pages?"
5101         case "$man1ext" in
5102         '')     case "$man1dir" in
5103                 *1)  dflt=1 ;;
5104                 *1p) dflt=1p ;;
5105                 *1pm) dflt=1pm ;;
5106                 *l) dflt=l;;
5107                 *n) dflt=n;;
5108                 *o) dflt=o;;
5109                 *p) dflt=p;;
5110                 *C) dflt=C;;
5111                 *L) dflt=L;;
5112                 *L1) dflt=L1;;
5113                 *) dflt=1;;
5114                 esac
5115                 ;;
5116         *)      dflt="$man1ext";;
5117         esac
5118         . ./myread
5119         man1ext="$ans"
5120         ;;
5121 esac
5122
5123 : see if we can have long filenames
5124 echo " "
5125 rmlist="$rmlist /tmp/cf$$"
5126 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5127 first=123456789abcdef
5128 second=/tmp/cf$$/$first
5129 $rm -f $first $second
5130 if (echo hi >$first) 2>/dev/null; then
5131         if $test -f 123456789abcde; then
5132                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5133                 val="$undef"
5134         else
5135                 if (echo hi >$second) 2>/dev/null; then
5136                         if $test -f /tmp/cf$$/123456789abcde; then
5137                                 $cat <<'EOM'
5138 That's peculiar... You can have filenames longer than 14 characters, but only
5139 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5140 I shall consider your system cannot support long filenames at all.
5141 EOM
5142                                 val="$undef"
5143                         else
5144                                 echo 'You can have filenames longer than 14 characters.' >&4
5145                                 val="$define"
5146                         fi
5147                 else
5148                         $cat <<'EOM'
5149 How confusing! Some of your filesystems are sane enough to allow filenames
5150 longer than 14 characters but some others like /tmp can't even think about them.
5151 So, for now on, I shall assume your kernel does not allow them at all.
5152 EOM
5153                         val="$undef"
5154                 fi
5155         fi
5156 else
5157         $cat <<'EOM'
5158 You can't have filenames longer than 14 chars.  You can't even think about them!
5159 EOM
5160         val="$undef"
5161 fi 
5162 set d_flexfnam
5163 eval $setvar
5164 $rm -rf /tmp/cf$$ 123456789abcde*
5165
5166 : determine where library module manual pages go
5167 set man3dir man3dir none
5168 eval $prefixit
5169 $cat <<EOM
5170
5171 $spackage has manual pages for many of the library modules.
5172 EOM
5173
5174 case "$nroff" in
5175 nroff)
5176         $cat <<'EOM'
5177 However, you don't have nroff, so they're probably useless to you.
5178 EOM
5179         case "$man3dir" in
5180         '') man3dir="none";;
5181         esac;;
5182 esac
5183
5184 case "$d_flexfnam" in
5185 undef)
5186         $cat <<'EOM'
5187 However, your system can't handle the long file names like File::Basename.3. 
5188 EOM
5189         case "$man3dir" in
5190         '') man3dir="none";;
5191         esac;;
5192 esac
5193
5194 echo "If you don't want the manual sources installed, answer 'none'."
5195 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5196 case "$man3dir" in
5197 '')     case "$prefix" in 
5198         *$prog*) dflt=`echo $man1dir | 
5199                         $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
5200         *)      dflt="$privlib/man/man3" ;;
5201         esac
5202         ;;
5203 ' ') dflt=none;;
5204 *)      dflt="$man3dir" ;;
5205 esac
5206 echo " "
5207
5208 fn=dn+~
5209 rp="Where do the $package library man pages (source) go?"
5210 . ./getfile
5211 if test "X$man3direxp" != "X$ansexp"; then
5212         installman3dir=''
5213 fi
5214
5215 man3dir="$ans"
5216 man3direxp="$ansexp"
5217 case "$man3dir" in
5218 '') man3dir=' '
5219         installman3dir='';;
5220 esac
5221 if $afs; then
5222         $cat <<EOM
5223
5224 Since you are running AFS, I need to distinguish the directory in which
5225 manual pages reside from the directory in which they are installed (and from
5226 which they are presumably copied to the former directory by occult means).
5227
5228 EOM
5229         case "$installman3dir" in
5230         '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
5231         *) dflt="$installman3dir";;
5232         esac
5233         fn=de~
5234         rp='Where will man pages be installed?'
5235         . ./getfile
5236         installman3dir="$ans"
5237 else
5238         installman3dir="$man3direxp"
5239 fi
5240
5241 : What suffix to use on installed man pages
5242
5243 case "$man3dir" in
5244 ' ')
5245         man3ext='0'
5246         ;;
5247 *)
5248         rp="What suffix should be used for the $package library man pages?"
5249         case "$man3ext" in
5250         '')     case "$man3dir" in
5251                 *3)  dflt=3 ;;
5252                 *3p) dflt=3p ;;
5253                 *3pm) dflt=3pm ;;
5254                 *l) dflt=l;;
5255                 *n) dflt=n;;
5256                 *o) dflt=o;;
5257                 *p) dflt=p;;
5258                 *C) dflt=C;;
5259                 *L) dflt=L;;
5260                 *L3) dflt=L3;;
5261                 *) dflt=3;;
5262                 esac
5263                 ;;
5264         *)      dflt="$man3ext";;
5265         esac
5266         . ./myread
5267         man3ext="$ans"
5268         ;;
5269 esac
5270
5271 : see if we have to deal with yellow pages, now NIS.
5272 if $test -d /usr/etc/yp || $test -d /etc/yp; then
5273         if $test -f /usr/etc/nibindd; then
5274                 echo " "
5275                 echo "I'm fairly confident you're on a NeXT."
5276                 echo " "
5277                 rp='Do you get the hosts file via NetInfo?'
5278                 dflt=y
5279                 case "$hostcat" in
5280                 nidump*) ;;
5281                 '') ;;
5282                 *) dflt=n;;
5283                 esac
5284                 . ./myread
5285                 case "$ans" in
5286                 y*) hostcat='nidump hosts .';;
5287                 *)      case "$hostcat" in
5288                         nidump*) hostcat='';;
5289                         esac
5290                         ;;
5291                 esac
5292         fi
5293         case "$hostcat" in
5294         nidump*) ;;
5295         *)
5296                 case "$hostcat" in
5297                 *ypcat*) dflt=y;;
5298                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5299                                 dflt=y
5300                         else
5301                                 dflt=n
5302                         fi;;
5303                 *) dflt=n;;
5304                 esac
5305                 echo " "
5306                 rp='Are you getting the hosts file via yellow pages?'
5307                 . ./myread
5308                 case "$ans" in
5309                 y*) hostcat='ypcat hosts';;
5310                 *) hostcat='cat /etc/hosts';;
5311                 esac
5312                 ;;
5313         esac
5314 fi
5315 case "$hostcat" in
5316 '') hostcat='cat /etc/hosts';;
5317 esac
5318 case "$groupcat" in
5319 '') groupcat='cat /etc/group';;
5320 esac
5321 case "$passcat" in
5322 '') passcat='cat /etc/passwd';;
5323 esac
5324
5325 : now get the host name
5326 echo " "
5327 echo "Figuring out host name..." >&4
5328 case "$myhostname" in
5329 '') cont=true
5330         echo 'Maybe "hostname" will work...'
5331         if tans=`sh -c hostname 2>&1` ; then
5332                 myhostname=$tans
5333                 phostname=hostname
5334                 cont=''
5335         fi
5336         ;;
5337 *) cont='';;
5338 esac
5339 if $test "$cont"; then
5340         if ./xenix; then
5341                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
5342                 if tans=`cat /etc/systemid 2>&1` ; then
5343                         myhostname=$tans
5344                         phostname='cat /etc/systemid'
5345                         echo "Whadyaknow.  Xenix always was a bit strange..."
5346                         cont=''
5347                 fi
5348         elif $test -r /etc/systemid; then
5349                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
5350         fi
5351 fi
5352 if $test "$cont"; then
5353         echo 'No, maybe "uuname -l" will work...'
5354         if tans=`sh -c 'uuname -l' 2>&1` ; then
5355                 myhostname=$tans
5356                 phostname='uuname -l'
5357         else
5358                 echo 'Strange.  Maybe "uname -n" will work...'
5359                 if tans=`sh -c 'uname -n' 2>&1` ; then
5360                         myhostname=$tans
5361                         phostname='uname -n'
5362                 else
5363                         echo 'Oh well, maybe I can mine it out of whoami.h...'
5364                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
5365                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
5366                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
5367                         else
5368                                 case "$myhostname" in
5369                                 '') echo "Does this machine have an identity crisis or something?"
5370                                         phostname='';;
5371                                 *)
5372                                         echo "Well, you said $myhostname before..."
5373                                         phostname='echo $myhostname';;
5374                                 esac
5375                         fi
5376                 fi
5377         fi
5378 fi
5379 : you do not want to know about this
5380 set $myhostname
5381 myhostname=$1
5382
5383 : verify guess
5384 if $test "$myhostname" ; then
5385         dflt=y
5386         rp='Your host name appears to be "'$myhostname'".'" Right?"
5387         . ./myread
5388         case "$ans" in
5389         y*) ;;
5390         *) myhostname='';;
5391         esac
5392 fi
5393
5394 : bad guess or no guess
5395 while $test "X$myhostname" = X ; do
5396         dflt=''
5397         rp="Please type the (one word) name of your host:"
5398         . ./myread
5399         myhostname="$ans"
5400 done
5401
5402 : translate upper to lower if necessary
5403 case "$myhostname" in
5404 *[A-Z]*)
5405         echo "(Normalizing case in your host name)"
5406         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
5407         ;;
5408 esac
5409
5410 case "$myhostname" in
5411 *.*)
5412         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
5413         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
5414         echo "(Trimming domain name from host name--host name is now $myhostname)"
5415         ;;
5416 *) case "$mydomain" in
5417         '')
5418                 {
5419                         test "X$hostcat" = "Xypcat hosts" &&
5420                         ypmatch "$myhostname" hosts 2>/dev/null |\
5421                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
5422                         $test -s hosts
5423                 } || {
5424                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
5425                                         /[       ]$myhostname[  . ]/p" > hosts
5426                 }
5427                 tmp_re="[       . ]"
5428                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
5429                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
5430                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
5431                         hosts | $sort | $uniq | \
5432                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
5433                 case `$echo X$dflt` in
5434                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
5435                         dflt=.
5436                         ;;
5437                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
5438                         ;;
5439                 esac
5440                 case "$dflt" in
5441                 .)
5442                         tans=`./loc resolv.conf X /etc /usr/etc`
5443                         if $test -f "$tans"; then
5444                                 echo "(Attempting domain name extraction from $tans)"
5445                                 dflt=.`$sed -n -e 's/   / /g' \
5446                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
5447                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
5448                                 case "$dflt" in
5449                                 .) dflt=.`$sed -n -e 's/        / /g' \
5450                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
5451                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
5452                                         ;;
5453                                 esac
5454                         fi
5455                         ;;
5456                 esac
5457                 case "$dflt" in
5458                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
5459                         dflt=.`sh -c domainname 2>/dev/null`
5460                         case "$dflt" in
5461                         '') dflt='.';;
5462                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
5463                         esac
5464                         ;;
5465                 esac
5466                 case "$dflt" in
5467                 .) echo "(Lost all hope -- silly guess then)"
5468                         dflt='.uucp'
5469                         ;;
5470                 esac
5471                 $rm -f hosts
5472                 ;;
5473         *) dflt="$mydomain";;
5474         esac;;
5475 esac
5476 echo " "
5477 rp="What is your domain name?"
5478 . ./myread
5479 tans="$ans"
5480 case "$ans" in
5481 '') ;;
5482 .*) ;;
5483 *) tans=".$tans";;
5484 esac
5485 mydomain="$tans"
5486
5487 : translate upper to lower if necessary
5488 case "$mydomain" in
5489 *[A-Z]*)
5490         echo "(Normalizing case in your domain name)"
5491         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
5492         ;;
5493 esac
5494
5495 : a little sanity check here
5496 case "$phostname" in
5497 '') ;;
5498 *)
5499         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
5500         $myhostname$mydomain|$myhostname) ;;
5501         *)
5502                 case "$phostname" in
5503                 sed*)
5504                         echo "(That doesn't agree with your whoami.h file, by the way.)"
5505                         ;;
5506                 *)
5507                         echo "(That doesn't agree with your $phostname command, by the way.)"
5508                         ;;
5509                 esac
5510         ;;
5511         esac
5512         ;;
5513 esac
5514
5515 $cat <<EOM
5516
5517 I need to get your e-mail address in Internet format if possible, i.e.
5518 something like user@host.domain. Please answer accurately since I have
5519 no easy means to double check it. The default value provided below
5520 is most probably close to the reality but may not be valid from outside
5521 your organization...
5522
5523 EOM
5524 cont=x
5525 while test "$cont"; do
5526         case "$cf_email" in
5527         '') dflt="$cf_by@$myhostname$mydomain";;
5528         *) dflt="$cf_email";;
5529         esac
5530         rp='What is your e-mail address?'
5531         . ./myread
5532         cf_email="$ans"
5533         case "$cf_email" in
5534         *@*.*) cont='' ;;
5535         *)
5536                 rp='Address does not look like an Internet one.  Use it anyway?'
5537                 case "$fastread" in
5538                 yes) dflt=y ;;
5539                 *) dflt=n ;;
5540                 esac
5541                 . ./myread
5542                 case "$ans" in
5543                 y*) cont='' ;;
5544                 *) echo " " ;;
5545                 esac
5546                 ;;
5547         esac
5548 done
5549
5550 $cat <<EOM
5551
5552 If you or somebody else will be maintaining perl at your site, please
5553 fill in the correct e-mail address here so that they may be contacted
5554 if necessary. Currently, the "perlbug" program included with perl
5555 will send mail to this address in addition to perlbug@perl.com. You may
5556 enter "none" for no administrator.
5557
5558 EOM
5559 case "$perladmin" in
5560 '') dflt="$cf_email";;
5561 *) dflt="$perladmin";;
5562 esac
5563 rp='Perl administrator e-mail address'
5564 . ./myread
5565 perladmin="$ans"
5566
5567 : figure out how to guarantee perl startup
5568 case "$startperl" in
5569 '')
5570         case "$sharpbang" in
5571         *!)
5572                 $cat <<EOH
5573
5574 I can use the #! construct to start perl on your system. This will
5575 make startup of perl scripts faster, but may cause problems if you
5576 want to share those scripts and perl is not in a standard place
5577 ($binexp/perl) on all your platforms. The alternative is to force
5578 a shell by starting the script with a single ':' character.
5579
5580 EOH
5581                 dflt="$binexp/perl"
5582                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
5583                 . ./myread
5584                 case "$ans" in
5585                 none)   startperl=": # use perl";;
5586                 *)      startperl="#!$ans"
5587                         if $test 30 -lt `echo "$ans" | wc -c`; then
5588                                 $cat >&4 <<EOM
5589
5590 WARNING:  Some systems limit the #! command to 32 characters.
5591 If you experience difficulty running Perl scripts with #!, try
5592 installing Perl in a directory with a shorter pathname.
5593
5594 EOM
5595                         fi ;;
5596                 esac
5597                 ;;
5598         *) startperl=": # use perl"
5599                 ;;
5600         esac
5601         ;;
5602 esac
5603 echo "I'll use $startperl to start perl scripts."
5604
5605 : figure best path for perl in scripts
5606 case "$perlpath" in
5607 '')
5608         perlpath="$binexp/perl"
5609         case "$startperl" in
5610         *!*) ;;
5611         *)
5612                 $cat <<EOH
5613
5614 I will use the "eval 'exec'" idiom to start Perl on your system.
5615 I can use the full path of your Perl binary for this purpose, but
5616 doing so may cause problems if you want to share those scripts and
5617 Perl is not always in a standard place ($binexp/perl).
5618
5619 EOH
5620                 dflt="$binexp/perl"
5621                 rp="What path shall I use in \"eval 'exec'\"?"
5622                 . ./myread
5623                 perlpath="$ans"
5624                 ;;
5625         esac
5626         ;;
5627 esac
5628 case "$startperl" in
5629 *!*)    ;;
5630 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
5631 esac
5632
5633 : determine where public executable scripts go
5634 set scriptdir scriptdir
5635 eval $prefixit
5636 case "$scriptdir" in
5637 '')
5638         dflt="$bin"
5639         : guess some guesses
5640         $test -d /usr/share/scripts && dflt=/usr/share/scripts
5641         $test -d /usr/share/bin && dflt=/usr/share/bin
5642         $test -d /usr/local/script && dflt=/usr/local/script
5643         $test -d $prefixexp/script && dflt=$prefixexp/script
5644         set dflt
5645         eval $prefixup
5646         ;;
5647 *)  dflt="$scriptdir"
5648         ;;
5649 esac
5650 $cat <<EOM
5651  
5652 Some installations have a separate directory just for executable scripts so
5653 that they can mount it across multiple architectures but keep the scripts in
5654 one spot.  You might, for example, have a subdirectory of /usr/share for this.
5655 Or you might just lump your scripts in with all your other executables.
5656  
5657 EOM
5658 fn=d~
5659 rp='Where do you keep publicly executable scripts?'
5660 . ./getfile
5661 if $test "X$ansexp" != "X$scriptdirexp"; then
5662         installscript=''
5663 fi
5664 scriptdir="$ans"
5665 scriptdirexp="$ansexp"
5666 if $afs; then
5667         $cat <<EOM
5668
5669 Since you are running AFS, I need to distinguish the directory in which
5670 scripts reside from the directory in which they are installed (and from
5671 which they are presumably copied to the former directory by occult means).
5672
5673 EOM
5674         case "$installscript" in
5675         '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
5676         *) dflt="$installscript";;
5677         esac
5678         fn=de~
5679         rp='Where will public scripts be installed?'
5680         . ./getfile
5681         installscript="$ans"
5682 else
5683         installscript="$scriptdirexp"
5684 fi
5685
5686 : determine where site specific libraries go.
5687 set sitelib sitelib
5688 eval $prefixit
5689 case "$sitelib" in
5690 '')
5691         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5692         dflt="$privlib/site_$prog" ;;
5693 *)      dflt="$sitelib" ;;
5694 esac
5695 $cat <<EOM
5696
5697 The installation process will also create a directory for
5698 site-specific extensions and modules.  Some users find it convenient
5699 to place all local files in this directory rather than in the main
5700 distribution directory.
5701
5702 EOM
5703 fn=d~+
5704 rp='Pathname for the site-specific library files?'
5705 . ./getfile
5706 if $test "X$sitelibexp" != "X$ansexp"; then
5707         installsitelib=''
5708 fi
5709 sitelib="$ans"
5710 sitelibexp="$ansexp"
5711 if $afs; then
5712         $cat <<EOM
5713
5714 Since you are running AFS, I need to distinguish the directory in
5715 which site-specific files reside from the directory in which they are
5716 installed (and from which they are presumably copied to the former
5717 directory by occult means).
5718
5719 EOM
5720         case "$installsitelib" in
5721         '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
5722         *) dflt="$installsitelib";;
5723         esac
5724         fn=de~
5725         rp='Where will site-specific files be installed?'
5726         . ./getfile
5727         installsitelib="$ans"
5728 else
5729         installsitelib="$sitelibexp"
5730 fi
5731
5732 : determine where site specific architecture-dependent libraries go.
5733 xxx=`echo $sitelib/$archname | sed 's!^$prefix!!'`
5734 : xxx is usuually lib/site_perl/archname.
5735 set sitearch sitearch none
5736 eval $prefixit
5737 case "$sitearch" in
5738 '')     dflt="$sitelib/$archname" ;;
5739 *)      dflt="$sitearch" ;;
5740 esac
5741 $cat <<EOM
5742
5743 The installation process will also create a directory for
5744 architecture-dependent site-specific extensions and modules.
5745
5746 EOM
5747 fn=nd~+
5748 rp='Pathname for the site-specific architecture-dependent library files?'
5749 . ./getfile
5750 if $test "X$sitearchexp" != "X$ansexp"; then
5751         installsitearch=''
5752 fi
5753 sitearch="$ans"
5754 sitearchexp="$ansexp"
5755 if $afs; then
5756         $cat <<EOM
5757
5758 Since you are running AFS, I need to distinguish the directory in
5759 which site-specific architecture-dependent library files reside from
5760 the directory in which they are installed (and from which they are
5761 presumably copied to the former directory by occult means).
5762
5763 EOM
5764         case "$installsitearch" in
5765         '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
5766         *) dflt="$installsitearch";;
5767         esac
5768         fn=de~
5769         rp='Where will site-specific architecture-dependent files be installed?'
5770         . ./getfile
5771         installsitearch="$ans"
5772 else
5773         installsitearch="$sitearchexp"
5774 fi
5775
5776 cat <<EOM
5777
5778 Previous version of $package used the standard IO mechanisms as defined
5779 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
5780 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
5781 the default.  This abstraction layer can use AT&T's sfio (if you already
5782 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
5783 problems with some extension modules.  Using PerlIO with stdio is safe,
5784 but it is slower than plain stdio and therefore is not the default.
5785
5786 If this doesn't make any sense to you, just accept the default 'n'.
5787 EOM
5788 case "$useperlio" in
5789 $define|true|[yY]*)     dflt='y';;
5790 *) dflt='n';;
5791 esac
5792 rp='Use the experimental PerlIO abstraction layer?'
5793 . ./myread
5794 case "$ans" in
5795 y|Y) 
5796         val="$define"
5797         ;;     
5798 *)      
5799         echo "Ok, doing things the stdio way"
5800         val="$undef"
5801         ;;
5802 esac
5803 set useperlio
5804 eval $setvar 
5805
5806 : Check how to convert floats to strings.
5807 echo " "
5808 echo "Checking for an efficient way to convert floats to strings."
5809 $cat >try.c <<'EOP'
5810 #ifdef TRY_gconvert
5811 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
5812 char *myname = "gconvert";
5813 #endif
5814 #ifdef TRY_gcvt
5815 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
5816 char *myname = "gcvt";
5817 #endif
5818 #ifdef TRY_sprintf
5819 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
5820 char *myname = "sprintf";
5821 #endif
5822
5823 #include <stdio.h>
5824
5825 int
5826 checkit(expect, got)
5827 char *expect;
5828 char *got;
5829 {
5830     if (strcmp(expect, got)) {
5831                 printf("%s oddity:  Expected %s, got %s\n",
5832                         myname, expect, got);
5833                 exit(1);
5834         }
5835 }
5836
5837 int
5838 main()
5839
5840         char buf[64]; 
5841         buf[63] = '\0';
5842
5843         /* This must be 1st test on (which?) platform */
5844         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
5845         Gconvert(0.1, 8, 0, buf);
5846         checkit("0.1", buf);
5847
5848         Gconvert(1.0, 8, 0, buf); 
5849         checkit("1", buf);
5850
5851         Gconvert(0.0, 8, 0, buf); 
5852         checkit("0", buf);
5853
5854         Gconvert(-1.0, 8, 0, buf); 
5855         checkit("-1", buf);
5856
5857         /* Some Linux gcvt's give 1.e+5 here. */
5858         Gconvert(100000.0, 8, 0, buf); 
5859         checkit("100000", buf);
5860         
5861         /* Some Linux gcvt's give -1.e+5 here. */
5862         Gconvert(-100000.0, 8, 0, buf); 
5863         checkit("-100000", buf);
5864
5865         exit(0);
5866 }
5867 EOP
5868 case "$d_Gconvert" in
5869 gconvert*) xxx_list='gconvert gcvt sprintf' ;;
5870 gcvt*) xxx_list='gcvt gconvert sprintf' ;;
5871 sprintf*) xxx_list='sprintf gconvert gcvt' ;;
5872 *) xxx_list='gconvert gcvt sprintf' ;;
5873 esac
5874
5875 for xxx_convert in $xxx_list; do
5876         echo "Trying $xxx_convert"
5877         $rm -f try try$_o
5878         set try -DTRY_$xxx_convert
5879         if eval $compile; then
5880                 echo "$xxx_convert" found. >&4
5881                 if ./try; then
5882                         echo "I'll use $xxx_convert to convert floats into a string." >&4
5883                         break;
5884                 else
5885                         echo "...But $xxx_convert didn't work as I expected."
5886                 fi
5887         else
5888                 echo "$xxx_convert NOT found." >&4
5889         fi
5890 done
5891                 
5892 case "$xxx_convert" in
5893 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
5894 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
5895 *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
5896 esac
5897
5898 : Initialize h_fcntl
5899 h_fcntl=false
5900
5901 : Initialize h_sysfile
5902 h_sysfile=false
5903
5904 : access call always available on UNIX
5905 set access d_access
5906 eval $inlibc
5907
5908 : locate the flags for 'access()'
5909 case "$d_access" in
5910 "$define")
5911         echo " "
5912         $cat >access.c <<'EOCP'
5913 #include <sys/types.h>
5914 #ifdef I_FCNTL
5915 #include <fcntl.h>
5916 #endif
5917 #ifdef I_SYS_FILE
5918 #include <sys/file.h>
5919 #endif
5920 #ifdef I_UNISTD
5921 #include <unistd.h>
5922 #endif
5923 main() {
5924         exit(R_OK);
5925 }
5926 EOCP
5927         : check sys/file.h first, no particular reason here
5928         if $test `./findhdr sys/file.h` && \
5929                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
5930                 h_sysfile=true;
5931                 echo "<sys/file.h> defines the *_OK access constants." >&4
5932         elif $test `./findhdr fcntl.h` && \
5933                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
5934                 h_fcntl=true;
5935                 echo "<fcntl.h> defines the *_OK access constants." >&4
5936         elif $test `./findhdr unistd.h` && \
5937                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
5938                 echo "<unistd.h> defines the *_OK access constants." >&4
5939         else
5940                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
5941         fi
5942         ;;
5943 esac
5944 $rm -f access*
5945
5946 : see if alarm exists
5947 set alarm d_alarm
5948 eval $inlibc
5949
5950 : Look for GNU-cc style attribute checking
5951 echo " "
5952 echo "Checking whether your compiler can handle __attribute__ ..." >&4
5953 $cat >attrib.c <<'EOCP'
5954 #include <stdio.h>
5955 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
5956 EOCP
5957 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
5958         if $contains 'warning' attrib.out >/dev/null 2>&1; then
5959                 echo "Your C compiler doesn't fully support __attribute__."
5960                 val="$undef"
5961         else
5962                 echo "Your C compiler supports __attribute__."
5963                 val="$define"
5964         fi
5965 else
5966         echo "Your C compiler doesn't seem to understand __attribute__ at all."
5967         val="$undef"
5968 fi
5969 set d_attribut
5970 eval $setvar
5971 $rm -f attrib*
5972
5973 : see if bcmp exists
5974 set bcmp d_bcmp
5975 eval $inlibc
5976
5977 : see if bcopy exists
5978 set bcopy d_bcopy
5979 eval $inlibc
5980
5981 : see if this is a unistd.h system
5982 set unistd.h i_unistd
5983 eval $inhdr
5984
5985 : see if getpgrp exists
5986 set getpgrp d_getpgrp
5987 eval $inlibc
5988
5989 case "$d_getpgrp" in
5990 "$define")
5991         echo " "
5992         echo "Checking to see which flavor of getpgrp is in use..."
5993         $cat >set.c <<EOP
5994 #$i_unistd I_UNISTD
5995 #include <sys/types.h>
5996 #ifdef I_UNISTD
5997 #  include <unistd.h>
5998 #endif
5999 main()
6000 {
6001         if (getuid() == 0) {
6002                 printf("(I see you are running Configure as super-user...)\n");
6003                 setuid(1);
6004         }
6005 #ifdef TRY_BSD_PGRP
6006         if (getpgrp(1) == 0)
6007                 exit(0);
6008 #else
6009         if (getpgrp() > 0)
6010                 exit(0);
6011 #endif
6012         exit(1);
6013 }
6014 EOP
6015         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6016                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
6017                 val="$define"
6018         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6019                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
6020                 val="$undef"
6021         else
6022                 echo "I can't seem to compile and run the test program."
6023                 if ./usg; then
6024                         xxx="a USG one, i.e. you use getpgrp()."
6025                 else
6026                         # SVR4 systems can appear rather BSD-ish.
6027                         case "$i_unistd" in
6028                         $undef)
6029                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
6030                                 val="$define"
6031                                 ;;
6032                         $define)
6033                                 xxx="probably a USG one, i.e. you use getpgrp()."
6034                                 val="$undef"
6035                                 ;;
6036                         esac
6037                 fi
6038                 echo "Assuming your getpgrp is $xxx" >&4
6039         fi
6040         ;;
6041 *) val="$undef";;
6042 esac
6043 set d_bsdgetpgrp
6044 eval $setvar
6045 $rm -f set set.c
6046
6047 : see if setpgrp exists
6048 set setpgrp d_setpgrp
6049 eval $inlibc
6050
6051 case "$d_setpgrp" in
6052 "$define")
6053         echo " "
6054         echo "Checking to see which flavor of setpgrp is in use..."
6055         $cat >set.c <<EOP
6056 #$i_unistd I_UNISTD
6057 #include <sys/types.h>
6058 #ifdef I_UNISTD
6059 #  include <unistd.h>
6060 #endif
6061 main()
6062 {
6063         if (getuid() == 0) {
6064                 printf("(I see you are running Configure as super-user...)\n");
6065                 setuid(1);
6066         }
6067 #ifdef TRY_BSD_PGRP
6068         if (-1 == setpgrp(1, 1))
6069                 exit(0);
6070 #else
6071         if (setpgrp() != -1)
6072                 exit(0);
6073 #endif
6074         exit(1);
6075 }
6076 EOP
6077         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6078                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
6079                 val="$define"
6080         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6081                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
6082                 val="$undef"
6083         else
6084                 echo "(I can't seem to compile and run the test program.)"
6085                 if ./usg; then
6086                         xxx="a USG one, i.e. you use setpgrp()."
6087                 else
6088                         # SVR4 systems can appear rather BSD-ish.
6089                         case "$i_unistd" in
6090                         $undef)
6091                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
6092                                 val="$define"
6093                                 ;;
6094                         $define)
6095                                 xxx="probably a USG one, i.e. you use setpgrp()."
6096                                 val="$undef"
6097                                 ;;
6098                         esac
6099                 fi
6100                 echo "Assuming your setpgrp is $xxx" >&4
6101         fi
6102         ;;
6103 *) val="$undef";;
6104 esac
6105 set d_bsdsetpgrp
6106 eval $setvar
6107 $rm -f set set.c
6108 : see if bzero exists
6109 set bzero d_bzero
6110 eval $inlibc
6111
6112 : check for lengths of integral types
6113 echo " "
6114 case "$intsize" in
6115 '')
6116         echo "Checking to see how big your integers are..." >&4
6117         $cat >intsize.c <<'EOCP'
6118 #include <stdio.h>
6119 main()
6120 {
6121         printf("intsize=%d;\n", sizeof(int));
6122         printf("longsize=%d;\n", sizeof(long));
6123         printf("shortsize=%d;\n", sizeof(short));
6124         exit(0);
6125 }
6126 EOCP
6127         set intsize
6128         if eval $compile_ok && ./intsize > /dev/null; then
6129                 eval `./intsize`
6130                 echo "Your integers are $intsize bytes long."
6131                 echo "Your long integers are $longsize bytes long."
6132                 echo "Your short integers are $shortsize bytes long."
6133         else
6134                 $cat >&4 <<EOM
6135 !
6136 Help! I can't compile and run the intsize test program: please enlighten me!
6137 (This is probably a misconfiguration in your system or libraries, and
6138 you really ought to fix it.  Still, I'll try anyway.)
6139 !
6140 EOM
6141                 dflt=4
6142                 rp="What is the size of an integer (in bytes)?"
6143                 . ./myread
6144                 intsize="$ans"
6145                 dflt=$intsize
6146                 rp="What is the size of a long integer (in bytes)?"
6147                 . ./myread
6148                 longsize="$ans"
6149                 dflt=2
6150                 rp="What is the size of a short integer (in bytes)?"
6151                 . ./myread
6152                 shortsize="$ans"
6153         fi
6154         ;;
6155 esac
6156 $rm -f intsize intsize.*
6157
6158 : see if signal is declared as pointer to function returning int or void
6159 echo " "
6160 xxx=`./findhdr signal.h`
6161 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
6162 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
6163         echo "You have int (*signal())() instead of void." >&4
6164         val="$undef"
6165 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
6166         echo "You have void (*signal())()." >&4
6167         val="$define"
6168 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
6169         echo "You have int (*signal())() instead of void." >&4
6170         val="$undef"
6171 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
6172         echo "You have void (*signal())()." >&4
6173         val="$define"
6174 else
6175         case "$d_voidsig" in
6176         '')
6177         echo "I can't determine whether signal handler returns void or int..." >&4
6178                 dflt=void
6179                 rp="What type does your signal handler return?"
6180                 . ./myread
6181                 case "$ans" in
6182                 v*) val="$define";;
6183                 *) val="$undef";;
6184                 esac;;
6185         "$define")
6186                 echo "As you already told me, signal handler returns void." >&4
6187                 val="$define"
6188                 ;;
6189         *)      echo "As you already told me, signal handler returns int." >&4
6190                 val="$undef"
6191                 ;;
6192         esac
6193 fi
6194 set d_voidsig
6195 eval $setvar
6196 case "$d_voidsig" in
6197 "$define") signal_t="void";;
6198 *) signal_t="int";;
6199 esac
6200 $rm -f $$.tmp
6201
6202 : check for ability to cast large floats to 32-bit ints.
6203 echo " "
6204 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
6205 if $test "$intsize" -ge 4; then
6206         xxx=int
6207 else
6208         xxx=long
6209 fi
6210 $cat >try.c <<EOCP
6211 #include <stdio.h>
6212 #include <sys/types.h>
6213 #include <signal.h>
6214 $signal_t blech(s) int s; { exit(3); }
6215 main()
6216 {
6217         $xxx i32;
6218         double f, g;
6219         int result = 0;
6220         char str[16];
6221         signal(SIGFPE, blech);
6222
6223         /* Don't let compiler optimize the test away.  Store the number 
6224            in a writable string for gcc to pass to sscanf under HP/UX.
6225         */
6226         sprintf(str, "2147483647");
6227         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
6228         g = 10 * f;
6229         i32  = ($xxx) g;
6230
6231         /* x86 processors will probably give 0x8000 0000, which is a
6232        sign change.  We don't want that.  We want to mimic SPARC
6233            behavior here, which is to preserve the sign and give
6234            back 0x7fff ffff.
6235         */
6236         if (i32 != ($xxx) f)
6237                 result |= 1;
6238         exit(result);
6239 }
6240 EOCP
6241 set try
6242 if eval $compile_ok; then
6243         ./try
6244         yyy=$?
6245 else
6246         echo "(I can't seem to compile the test program--assuming it can't)"
6247         yyy=1
6248 fi
6249 case "$yyy" in
6250 0)      val="$define"
6251         echo "Yup, it can."
6252         ;;
6253 *)      val="$undef"
6254         echo "Nope, it can't."
6255         ;;
6256 esac
6257 set d_casti32
6258 eval $setvar
6259 $rm -f try try.*
6260
6261 : check for ability to cast negative floats to unsigned
6262 echo " "
6263 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
6264 $cat >try.c <<EOCP
6265 #include <stdio.h>
6266 #include <sys/types.h>
6267 #include <signal.h>
6268 $signal_t blech(s) int s; { exit(7); }
6269 $signal_t blech_in_list(s) int s; { exit(4); }
6270 unsigned long dummy_long(p) unsigned long p; { return p; }
6271 unsigned int dummy_int(p) unsigned int p; { return p; }
6272 unsigned short dummy_short(p) unsigned short p; { return p; }
6273 main()
6274 {
6275         double f;
6276         unsigned long along;
6277         unsigned int aint;
6278         unsigned short ashort;
6279         int result = 0;
6280         char str[16];
6281         
6282         /* Frustrate gcc-2.7.2's optimizer which failed this test with
6283            a direct f = -123. assignment.  gcc-2.8.0 reportedly
6284            optimized the whole file away
6285         */
6286         /* Store the number in a writable string for gcc to pass to 
6287            sscanf under HP/UX.
6288         */
6289         sprintf(str, "-123");
6290         sscanf(str, "%lf", &f);  /* f = -123.; */
6291
6292         signal(SIGFPE, blech);
6293         along = (unsigned long)f;
6294         aint = (unsigned int)f;
6295         ashort = (unsigned short)f;
6296         if (along != (unsigned long)-123)
6297                 result |= 1;
6298         if (aint != (unsigned int)-123)
6299                 result |= 1;
6300         if (ashort != (unsigned short)-123)
6301                 result |= 1;
6302         sprintf(str, "1073741824.");
6303         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
6304         f = f + f;
6305         along = 0;
6306         along = (unsigned long)f;
6307         if (along != 0x80000000)
6308                 result |= 2;
6309         f -= 1.;
6310         along = 0;
6311         along = (unsigned long)f;
6312         if (along != 0x7fffffff)
6313                 result |= 1;
6314         f += 2.;
6315         along = 0;
6316         along = (unsigned long)f;
6317         if (along != 0x80000001)
6318                 result |= 2;
6319         if (result)
6320                 exit(result);
6321         signal(SIGFPE, blech_in_list);
6322         sprintf(str, "123.");
6323         sscanf(str, "%lf", &f);  /* f = 123.; */
6324         along = dummy_long((unsigned long)f);
6325         aint = dummy_int((unsigned int)f);
6326         ashort = dummy_short((unsigned short)f);
6327         if (along != (unsigned long)123)
6328                 result |= 4;
6329         if (aint != (unsigned int)123)
6330                 result |= 4;
6331         if (ashort != (unsigned short)123)
6332                 result |= 4;
6333         exit(result);
6334
6335 }
6336 EOCP
6337 set try
6338 if eval $compile_ok; then
6339         ./try
6340         castflags=$?
6341 else
6342         echo "(I can't seem to compile the test program--assuming it can't)"
6343         castflags=7
6344 fi
6345 case "$castflags" in
6346 0)      val="$define"
6347         echo "Yup, it can."
6348         ;;
6349 *)      val="$undef"
6350         echo "Nope, it can't."
6351         ;;
6352 esac
6353 set d_castneg
6354 eval $setvar
6355 $rm -f try.*
6356
6357 : see if vprintf exists
6358 echo " "
6359 if set vprintf val -f d_vprintf; eval $csym; $val; then
6360         echo 'vprintf() found.' >&4
6361         val="$define"
6362         $cat >vprintf.c <<'EOF'
6363 #include <varargs.h>
6364
6365 main() { xxx("foo"); }
6366
6367 xxx(va_alist)
6368 va_dcl
6369 {
6370         va_list args;
6371         char buf[10];
6372
6373         va_start(args);
6374         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
6375 }
6376 EOF
6377         set vprintf
6378         if eval $compile && ./vprintf; then
6379                 echo "Your vsprintf() returns (int)." >&4
6380                 val2="$undef"
6381         else
6382                 echo "Your vsprintf() returns (char*)." >&4
6383                 val2="$define"
6384         fi
6385 else
6386         echo 'vprintf() NOT found.' >&4
6387                 val="$undef"
6388                 val2="$undef"
6389 fi
6390 set d_vprintf
6391 eval $setvar
6392 val=$val2
6393 set d_charvspr
6394 eval $setvar
6395
6396 : see if chown exists
6397 set chown d_chown
6398 eval $inlibc
6399
6400 : see if chroot exists
6401 set chroot d_chroot
6402 eval $inlibc
6403
6404 : see if chsize exists
6405 set chsize d_chsize
6406 eval $inlibc
6407
6408 : check for const keyword
6409 echo " "
6410 echo 'Checking to see if your C compiler knows about "const"...' >&4
6411 $cat >const.c <<'EOCP'
6412 typedef struct spug { int drokk; } spug;
6413 main()
6414 {
6415         const char *foo;
6416         const spug y;
6417 }
6418 EOCP
6419 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
6420         val="$define"
6421         echo "Yup, it does."
6422 else
6423         val="$undef"
6424         echo "Nope, it doesn't."
6425 fi
6426 set d_const
6427 eval $setvar
6428
6429 : see if crypt exists
6430 echo " "
6431 if set crypt val -f d_crypt; eval $csym; $val; then
6432         echo 'crypt() found.' >&4
6433         val="$define"
6434         cryptlib=''
6435 else
6436         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
6437         if $test -z "$cryptlib"; then
6438                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
6439         else
6440                 cryptlib=-lcrypt
6441         fi
6442         if $test -z "$cryptlib"; then
6443                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
6444         else
6445                 cryptlib=-lcrypt
6446         fi
6447         if $test -z "$cryptlib"; then
6448                 cryptlib=`./loc libcrypt$_a "" $libpth`
6449         else
6450                 cryptlib=-lcrypt
6451         fi
6452         if $test -z "$cryptlib"; then
6453                 echo 'crypt() NOT found.' >&4
6454                 val="$undef"
6455         else
6456                 val="$define"
6457         fi
6458 fi
6459 set d_crypt
6460 eval $setvar
6461
6462 : see if cuserid exists
6463 set cuserid d_cuserid
6464 eval $inlibc
6465
6466 : see if this is a limits.h system
6467 set limits.h i_limits
6468 eval $inhdr
6469
6470 : see if this is a float.h system
6471 set float.h i_float
6472 eval $inhdr
6473
6474 : See if number of significant digits in a double precision number is known
6475 echo " "
6476 $cat >dbl_dig.c <<EOM
6477 #$i_limits I_LIMITS
6478 #$i_float I_FLOAT
6479 #ifdef I_LIMITS
6480 #include <limits.h>
6481 #endif
6482 #ifdef I_FLOAT
6483 #include <float.h>
6484 #endif
6485 #ifdef DBL_DIG
6486 printf("Contains DBL_DIG");
6487 #endif
6488 EOM
6489 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
6490 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
6491         echo "DBL_DIG found." >&4
6492         val="$define"
6493 else
6494         echo "DBL_DIG NOT found." >&4
6495         val="$undef"
6496 fi
6497 $rm -f dbl_dig.?
6498 set d_dbl_dig
6499 eval $setvar
6500
6501 : see if difftime exists
6502 set difftime d_difftime
6503 eval $inlibc
6504
6505 : see if this is a dirent system
6506 echo " "
6507 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
6508         val="$define"
6509         echo "<dirent.h> found." >&4
6510 else
6511         val="$undef"
6512         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
6513                 echo "<sys/dir.h> found." >&4
6514                 echo " "
6515         else
6516                 xinc=`./findhdr sys/ndir.h`
6517         fi
6518         echo "<dirent.h> NOT found." >&4
6519 fi
6520 set i_dirent
6521 eval $setvar
6522
6523 : Look for type of directory structure.
6524 echo " "
6525 $cppstdin $cppflags $cppminus < "$xinc" > try.c
6526
6527 case "$direntrytype" in
6528 ''|' ')
6529         case "$i_dirent" in
6530         $define) guess1='struct dirent' ;;
6531         *) guess1='struct direct'  ;;
6532         esac
6533         ;;
6534 *)      guess1="$direntrytype"
6535         ;;
6536 esac
6537
6538 case "$guess1" in
6539 'struct dirent') guess2='struct direct' ;;
6540 *) guess2='struct dirent' ;;
6541 esac
6542                 
6543 if $contains "$guess1" try.c >/dev/null 2>&1; then
6544         direntrytype="$guess1"
6545         echo "Your directory entries are $direntrytype." >&4
6546 elif $contains "$guess2" try.c >/dev/null 2>&1; then
6547         direntrytype="$guess2"
6548         echo "Your directory entries seem to be $direntrytype." >&4
6549 else
6550         echo "I don't recognize your system's directory entries." >&4
6551         rp="What type is used for directory entries on this system?"
6552         dflt="$guess1"
6553         . ./myread
6554         direntrytype="$ans"
6555 fi
6556 $rm -f try.c
6557
6558
6559 : see if the directory entry stores field length
6560 echo " "
6561 $cppstdin $cppflags $cppminus < "$xinc" > try.c
6562 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
6563         echo "Good, your directory entry keeps length information in d_namlen." >&4
6564         val="$define"
6565 else
6566         echo "Your directory entry does not know about the d_namlen field." >&4
6567         val="$undef"
6568 fi
6569 set d_dirnamlen
6570 eval $setvar
6571 $rm -f try.c
6572
6573 : see if dlerror exists
6574 xxx_runnm="$runnm"
6575 runnm=false
6576 set dlerror d_dlerror
6577 eval $inlibc
6578 runnm="$xxx_runnm"
6579
6580 : see if dlfcn is available
6581 set dlfcn.h i_dlfcn
6582 eval $inhdr
6583
6584 case "$usedl" in
6585 $define|y|true)
6586         $cat << EOM
6587
6588 On a few systems, the dynamically loaded modules that perl generates and uses
6589 will need a different extension than shared libs. The default will probably
6590 be appropriate.
6591
6592 EOM
6593         case "$dlext" in
6594         '')     dflt="$so" ;;
6595         *)      dflt="$dlext" ;;
6596         esac
6597         rp='What is the extension of dynamically loaded modules'
6598         . ./myread
6599         dlext="$ans"
6600         ;;
6601 *)
6602         dlext="none"
6603         ;;
6604 esac
6605
6606 : Check if dlsym need a leading underscore
6607 echo " "
6608 val="$undef"
6609
6610 case "$dlsrc" in
6611 dl_dlopen.xs)
6612         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
6613         $cat >dyna.c <<'EOM'
6614 fred () { }
6615 EOM
6616
6617 $cat >fred.c<<EOM
6618
6619 #include <stdio.h>
6620 #$i_dlfcn I_DLFCN
6621 #ifdef I_DLFCN
6622 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
6623 #else
6624 #include <sys/types.h>
6625 #include <nlist.h>
6626 #include <link.h>
6627 #endif
6628
6629 extern int fred() ;
6630
6631 main()
6632 {
6633     void * handle ;
6634     void * symbol ;
6635 #ifndef RTLD_LAZY
6636     int mode = 1 ;
6637 #else
6638     int mode = RTLD_LAZY ;
6639 #endif
6640     handle = dlopen("./dyna.$dlext", mode) ;
6641     if (handle == NULL) {
6642         printf ("1\n") ;
6643         fflush (stdout) ;
6644         exit(0);
6645     }
6646     symbol = dlsym(handle, "fred") ;
6647     if (symbol == NULL) {
6648         /* try putting a leading underscore */
6649         symbol = dlsym(handle, "_fred") ;
6650         if (symbol == NULL) {
6651             printf ("2\n") ;
6652             fflush (stdout) ;
6653             exit(0);
6654         }
6655         printf ("3\n") ;
6656     }
6657     else
6658         printf ("4\n") ;
6659     fflush (stdout) ;
6660     exit(0);
6661 }
6662 EOM
6663         : Call the object file tmp-dyna.o in case dlext=o.
6664         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
6665                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
6666                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
6667                 $cc $ccflags $ldflags $cccdlflags $ccdlflags fred.c -o fred $libs > /dev/null 2>&1; then
6668                 xxx=`./fred`
6669                 case $xxx in
6670                 1)      echo "Test program failed using dlopen." >&4
6671                         echo "Perhaps you should not use dynamic loading." >&4;;
6672                 2)      echo "Test program failed using dlsym." >&4
6673                         echo "Perhaps you should not use dynamic loading." >&4;;
6674                 3)      echo "dlsym needs a leading underscore" >&4
6675                         val="$define" ;;
6676                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
6677                 esac
6678         else
6679                 echo "I can't compile and run the test program." >&4
6680         fi
6681         ;;
6682 esac
6683                 
6684 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
6685
6686 set d_dlsymun
6687 eval $setvar
6688
6689 : see if dup2 exists
6690 set dup2 d_dup2
6691 eval $inlibc
6692
6693 : see if endhostent exists
6694 set endhostent d_endhent
6695 eval $inlibc
6696
6697 : see if endnetent exists
6698 set endnetent d_endnent
6699 eval $inlibc
6700
6701 : see if endprotoent exists
6702 set endprotoent d_endpent
6703 eval $inlibc
6704
6705 : see if endservent exists
6706 set endservent d_endsent
6707 eval $inlibc
6708
6709 : Locate the flags for 'open()'
6710 echo " "
6711 $cat >open3.c <<'EOCP'
6712 #include <sys/types.h>
6713 #ifdef I_FCNTL
6714 #include <fcntl.h>
6715 #endif
6716 #ifdef I_SYS_FILE
6717 #include <sys/file.h>
6718 #endif
6719 main() {
6720         if(O_RDONLY);
6721 #ifdef O_TRUNC
6722         exit(0);
6723 #else
6724         exit(1);
6725 #endif
6726 }
6727 EOCP
6728 : check sys/file.h first to get FREAD on Sun
6729 if $test `./findhdr sys/file.h` && \
6730                 set open3 -DI_SYS_FILE && eval $compile; then
6731         h_sysfile=true;
6732         echo "<sys/file.h> defines the O_* constants..." >&4
6733         if ./open3; then
6734                 echo "and you have the 3 argument form of open()." >&4
6735                 val="$define"
6736         else
6737                 echo "but not the 3 argument form of open().  Oh, well." >&4
6738                 val="$undef"
6739         fi
6740 elif $test `./findhdr fcntl.h` && \
6741                 set open3 -DI_FCNTL && eval $compile; then
6742         h_fcntl=true;
6743         echo "<fcntl.h> defines the O_* constants..." >&4
6744         if ./open3; then
6745                 echo "and you have the 3 argument form of open()." >&4
6746                 val="$define"
6747         else
6748                 echo "but not the 3 argument form of open().  Oh, well." >&4
6749                 val="$undef"
6750         fi
6751 else
6752         val="$undef"
6753         echo "I can't find the O_* constant definitions!  You got problems." >&4
6754 fi
6755 set d_open3
6756 eval $setvar
6757 $rm -f open3*
6758
6759 : check for non-blocking I/O stuff
6760 case "$h_sysfile" in
6761 true) echo "#include <sys/file.h>" > head.c;;
6762 *)
6763         case "$h_fcntl" in
6764         true) echo "#include <fcntl.h>" > head.c;;
6765         *) echo "#include <sys/fcntl.h>" > head.c;;
6766         esac
6767         ;;
6768 esac
6769 echo " "
6770 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
6771 case "$o_nonblock" in
6772 '')
6773         $cat head.c > try.c
6774         $cat >>try.c <<'EOCP'
6775 main() {
6776 #ifdef O_NONBLOCK
6777         printf("O_NONBLOCK\n");
6778         exit(0);
6779 #endif
6780 #ifdef O_NDELAY
6781         printf("O_NDELAY\n");
6782         exit(0);
6783 #endif
6784 #ifdef FNDELAY
6785         printf("FNDELAY\n");
6786         exit(0);
6787 #endif
6788         exit(0);
6789 }
6790 EOCP
6791         set try
6792         if eval $compile_ok; then
6793                 o_nonblock=`./try`
6794                 case "$o_nonblock" in
6795                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
6796                 *) echo "Seems like we can use $o_nonblock.";;
6797                 esac
6798         else
6799                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
6800         fi
6801         ;;
6802 *) echo "Using $hint value $o_nonblock.";;
6803 esac
6804 $rm -f try try.* .out core
6805
6806 echo " "
6807 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
6808 case "$eagain" in
6809 '')
6810         $cat head.c > try.c
6811         $cat >>try.c <<EOCP
6812 #include <errno.h>
6813 #include <sys/types.h>
6814 #include <signal.h>
6815 #define MY_O_NONBLOCK $o_nonblock
6816 #ifndef errno  /* XXX need better Configure test */
6817 extern int errno;
6818 #endif
6819 $signal_t blech(x) int x; { exit(3); }
6820 EOCP
6821         $cat >> try.c <<'EOCP'
6822 main()
6823 {
6824         int pd[2];
6825         int pu[2];
6826         char buf[1];
6827         char string[100];
6828
6829         pipe(pd);       /* Down: child -> parent */
6830         pipe(pu);       /* Up: parent -> child */
6831         if (0 != fork()) {
6832                 int ret;
6833                 close(pd[1]);   /* Parent reads from pd[0] */
6834                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
6835                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
6836                         exit(1);
6837                 signal(SIGALRM, blech);
6838                 alarm(5);
6839                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
6840                         exit(2);
6841                 sprintf(string, "%d\n", ret);
6842                 write(2, string, strlen(string));
6843                 alarm(0);
6844 #ifdef EAGAIN
6845                 if (errno == EAGAIN) {
6846                         printf("EAGAIN\n");
6847                         goto ok;
6848                 }
6849 #endif
6850 #ifdef EWOULDBLOCK
6851                 if (errno == EWOULDBLOCK)
6852                         printf("EWOULDBLOCK\n");
6853 #endif
6854         ok:
6855                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
6856                 sleep(2);                               /* Give it time to close our pipe */
6857                 alarm(5);
6858                 ret = read(pd[0], buf, 1);      /* Should read EOF */
6859                 alarm(0);
6860                 sprintf(string, "%d\n", ret);
6861                 write(3, string, strlen(string));
6862                 exit(0);
6863         }
6864
6865         close(pd[0]);                   /* We write to pd[1] */
6866         close(pu[1]);                   /* We read from pu[0] */
6867         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
6868         close(pd[1]);                   /* Pipe pd is now fully closed! */
6869         exit(0);                                /* Bye bye, thank you for playing! */
6870 }
6871 EOCP
6872         set try
6873         if eval $compile_ok; then
6874                 echo "$startsh" >mtry
6875                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
6876                 chmod +x mtry
6877                 ./mtry >/dev/null 2>&1
6878                 case $? in
6879                 0) eagain=`$cat try.out`;;
6880                 1) echo "Could not perform non-blocking setting!";;
6881                 2) echo "I did a successful read() for something that was not there!";;
6882                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
6883                 *) echo "Something terribly wrong happened during testing.";;
6884                 esac
6885                 rd_nodata=`$cat try.ret`
6886                 echo "A read() system call with no data present returns $rd_nodata."
6887                 case "$rd_nodata" in
6888                 0|-1) ;;
6889                 *)
6890                         echo "(That's peculiar, fixing that to be -1.)"
6891                         rd_nodata=-1
6892                         ;;
6893                 esac
6894                 case "$eagain" in
6895                 '')
6896                         echo "Forcing errno EAGAIN on read() with no data available."
6897                         eagain=EAGAIN
6898                         ;;
6899                 *)
6900                         echo "Your read() sets errno to $eagain when no data is available."
6901                         ;;
6902                 esac
6903                 status=`$cat try.err`
6904                 case "$status" in
6905                 0) echo "And it correctly returns 0 to signal EOF.";;
6906                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
6907                 *) echo "However, your read() returns '$status' on EOF??";;
6908                 esac
6909                 val="$define"
6910                 if test "$status" = "$rd_nodata"; then
6911                         echo "WARNING: you can't distinguish between EOF and no data!"
6912                         val="$undef"
6913                 fi
6914         else
6915                 echo "I can't compile the test program--assuming errno EAGAIN will do."
6916                 eagain=EAGAIN
6917         fi
6918         set d_eofnblk
6919         eval $setvar
6920         ;;
6921 *)
6922         echo "Using $hint value $eagain."
6923         echo "Your read() returns $rd_nodata when no data is present."
6924         case "$d_eofnblk" in
6925         "$define") echo "And you can see EOF because read() returns 0.";;
6926         "$undef") echo "But you can't see EOF status from read() returned value.";;
6927         *)
6928                 echo "(Assuming you can't see EOF status from read anyway.)"
6929                 d_eofnblk=$undef
6930                 ;;
6931         esac
6932         ;;
6933 esac
6934 $rm -f try try.* .out core head.c mtry
6935
6936 : see if fchmod exists
6937 set fchmod d_fchmod
6938 eval $inlibc
6939
6940 : see if fchown exists
6941 set fchown d_fchown
6942 eval $inlibc
6943
6944 : see if this is an fcntl system
6945 set fcntl d_fcntl
6946 eval $inlibc
6947
6948 : see if fgetpos exists
6949 set fgetpos d_fgetpos
6950 eval $inlibc
6951
6952 : see if flock exists
6953 set flock d_flock
6954 eval $inlibc
6955
6956 : see if fork exists
6957 set fork d_fork
6958 eval $inlibc
6959
6960 : see if pathconf exists
6961 set pathconf d_pathconf
6962 eval $inlibc
6963
6964 : see if fpathconf exists
6965 set fpathconf d_fpathconf
6966 eval $inlibc
6967
6968 : see if fsetpos exists
6969 set fsetpos d_fsetpos
6970 eval $inlibc
6971
6972 : see if gethostbyaddr exists
6973 set gethostbyaddr d_gethbyaddr
6974 eval $inlibc
6975
6976 : see if gethostbyname exists
6977 set gethostbyname d_gethbyname
6978 eval $inlibc
6979
6980 : see if gethostent exists
6981 set gethostent d_gethent
6982 eval $inlibc
6983
6984 hasproto='varname=$1; func=$2; shift; shift;
6985 while $test $# -ge 2; do
6986         case "$1" in
6987         $define) echo "#include <$2>";;
6988         esac ;
6989     shift 2;
6990 done > try.c;
6991 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
6992 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
6993         echo "$func() prototype found.";
6994         val="$define";
6995 else
6996         echo "$func() prototype NOT found.";
6997         val="$undef";
6998 fi;
6999 set $varname;
7000 eval $setvar;
7001 $rm -f try.c tryout.c'
7002
7003 : see if this is a netdb.h system
7004 set netdb.h i_netdb
7005 eval $inhdr
7006
7007 : see if prototypes for various gethostxxx netdb.h functions are available
7008 echo " "
7009 set d_gethostprotos gethostent $i_netdb netdb.h
7010 eval $hasproto
7011
7012 : see if getlogin exists
7013 set getlogin d_getlogin
7014 eval $inlibc
7015
7016 : see if getnetbyaddr exists
7017 set getnetbyaddr d_getnbyaddr
7018 eval $inlibc
7019
7020 : see if getnetbyname exists
7021 set getnetbyname d_getnbyname
7022 eval $inlibc
7023
7024 : see if getnetent exists
7025 set getnetent d_getnent
7026 eval $inlibc
7027
7028 : see if prototypes for various getnetxxx netdb.h functions are available
7029 echo " "
7030 set d_getnetprotos getnetent $i_netdb netdb.h
7031 eval $hasproto
7032
7033
7034 : see if getprotobyname exists
7035 set getprotobyname d_getpbyname
7036 eval $inlibc
7037
7038 : see if getprotobynumber exists
7039 set getprotobynumber d_getpbynumber
7040 eval $inlibc
7041
7042 : see if getprotoent exists
7043 set getprotoent d_getpent
7044 eval $inlibc
7045
7046 : see if getpgid exists
7047 set getpgid d_getpgid
7048 eval $inlibc
7049
7050 : see if getpgrp2 exists
7051 set getpgrp2 d_getpgrp2
7052 eval $inlibc
7053
7054 : see if getppid exists
7055 set getppid d_getppid
7056 eval $inlibc
7057
7058 : see if getpriority exists
7059 set getpriority d_getprior
7060 eval $inlibc
7061
7062 : see if prototypes for various getprotoxxx netdb.h functions are available
7063 echo " "
7064 set d_getprotoprotos getprotoent $i_netdb netdb.h
7065 eval $hasproto
7066
7067
7068 : see if getservbyname exists
7069 set getservbyname d_getsbyname
7070 eval $inlibc
7071
7072 : see if getservbyport exists
7073 set getservbyport d_getsbyport
7074 eval $inlibc
7075
7076 : see if getservent exists
7077 set getservent d_getsent
7078 eval $inlibc
7079
7080 : see if prototypes for various getservxxx netdb.h functions are available
7081 echo " "
7082 set d_getservprotos getservent $i_netdb netdb.h
7083 eval $hasproto
7084
7085 : see if gettimeofday or ftime exists
7086 set gettimeofday d_gettimeod
7087 eval $inlibc
7088 case "$d_gettimeod" in
7089 "$undef")
7090         set ftime d_ftime 
7091         eval $inlibc
7092         ;;
7093 *)
7094         val="$undef"; set d_ftime; eval $setvar
7095         ;;
7096 esac
7097 case "$d_gettimeod$d_ftime" in
7098 "$undef$undef")
7099         echo " "
7100         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
7101         ;;
7102 esac
7103
7104 : see if this is a netinet/in.h or sys/in.h system
7105 set netinet/in.h i_niin sys/in.h i_sysin
7106 eval $inhdr
7107
7108 : see if htonl --and friends-- exists
7109 val=''
7110 set htonl val
7111 eval $inlibc
7112
7113 : Maybe they are macros.
7114 case "$val" in
7115 $undef)
7116         $cat >htonl.c <<EOM
7117 #include <stdio.h>
7118 #include <sys/types.h>
7119 #$i_niin I_NETINET_IN
7120 #$i_sysin I_SYS_IN
7121 #ifdef I_NETINET_IN
7122 #include <netinet/in.h>
7123 #endif
7124 #ifdef I_SYS_IN
7125 #include <sys/in.h>
7126 #endif
7127 #ifdef htonl
7128 printf("Defined as a macro.");
7129 #endif
7130 EOM
7131         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
7132         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
7133                 val="$define"
7134                 echo "But it seems to be defined as a macro." >&4
7135         fi
7136         $rm -f htonl.?
7137         ;;
7138 esac
7139 set d_htonl
7140 eval $setvar
7141
7142 : see which of string.h or strings.h is needed
7143 echo " "
7144 strings=`./findhdr string.h`
7145 if $test "$strings" && $test -r "$strings"; then
7146         echo "Using <string.h> instead of <strings.h>." >&4
7147         val="$define"
7148 else
7149         val="$undef"
7150         strings=`./findhdr strings.h`
7151         if $test "$strings" && $test -r "$strings"; then
7152                 echo "Using <strings.h> instead of <string.h>." >&4
7153         else
7154                 echo "No string header found -- You'll surely have problems." >&4
7155         fi
7156 fi
7157 set i_string
7158 eval $setvar
7159 case "$i_string" in
7160 "$undef") strings=`./findhdr strings.h`;;
7161 *)        strings=`./findhdr string.h`;;
7162 esac
7163
7164 : index or strchr
7165 echo " "
7166 if set index val -f; eval $csym; $val; then
7167         if set strchr val -f d_strchr; eval $csym; $val; then
7168                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
7169                         val="$define"
7170                         vali="$undef"
7171                         echo "strchr() found." >&4
7172                 else
7173                         val="$undef"
7174                         vali="$define"
7175                         echo "index() found." >&4
7176                 fi
7177         else
7178                 val="$undef"
7179                 vali="$define"
7180                 echo "index() found." >&4
7181         fi
7182 else
7183         if set strchr val -f d_strchr; eval $csym; $val; then
7184                 val="$define"
7185                 vali="$undef"
7186                 echo "strchr() found." >&4
7187         else
7188                 echo "No index() or strchr() found!" >&4
7189                 val="$undef"
7190                 vali="$undef"
7191         fi
7192 fi
7193 set d_strchr; eval $setvar
7194 val="$vali"
7195 set d_index; eval $setvar
7196
7197 : check whether inet_aton exists
7198 set inet_aton d_inetaton
7199 eval $inlibc
7200
7201 : Look for isascii
7202 echo " "
7203 $cat >isascii.c <<'EOCP'
7204 #include <stdio.h>
7205 #include <ctype.h>
7206 main() {
7207         int c = 'A';
7208         if (isascii(c))
7209                 exit(0);
7210         else
7211                 exit(1);
7212 }
7213 EOCP
7214 set isascii
7215 if eval $compile; then
7216         echo "isascii() found." >&4
7217         val="$define"
7218 else
7219         echo "isascii() NOT found." >&4
7220         val="$undef"
7221 fi
7222 set d_isascii
7223 eval $setvar
7224 $rm -f isascii*
7225
7226 : see if killpg exists
7227 set killpg d_killpg
7228 eval $inlibc
7229
7230 : see if lchown exists
7231 echo " "
7232 $cat > try.c <<'EOCP'
7233 /* System header to define __stub macros and hopefully few prototypes,
7234     which can conflict with char lchown(); below.  */
7235 #include <assert.h>
7236 /* Override any gcc2 internal prototype to avoid an error.  */
7237 /* We use char because int might match the return type of a gcc2
7238    builtin and then its argument prototype would still apply.  */
7239 char lchown();
7240 int main() {
7241     /*  The GNU C library defines this for functions which it implements
7242         to always fail with ENOSYS.  Some functions are actually named
7243         something starting with __ and the normal name is an alias.  */
7244 #if defined (__stub_lchown) || defined (__stub___lchown)
7245 choke me
7246 #else
7247 lchown();
7248 #endif
7249 ; return 0; }
7250 EOCP
7251 set try
7252 if eval $compile; then
7253     $echo "lchown() found." >&4
7254     val="$define"
7255 else
7256     $echo "lchown() NOT found." >&4
7257     val="$undef"
7258 fi
7259 set d_lchown
7260 eval $setvar
7261
7262 : see if link exists
7263 set link d_link
7264 eval $inlibc
7265
7266 : see if localeconv exists
7267 set localeconv d_locconv
7268 eval $inlibc
7269
7270 : see if lockf exists
7271 set lockf d_lockf
7272 eval $inlibc
7273
7274 : check for long doubles
7275 echo " "
7276 echo $n "Checking to see if your system supports long doubles...$c" >&4
7277 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
7278 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7279         val="$define"
7280         echo " Yup, it does." >&4
7281 else
7282         val="$undef"
7283         echo " Nope, it doesn't." >&4
7284 fi
7285 $rm try.*
7286 set d_longdbl
7287 eval $setvar
7288
7289 : check for length of long double
7290 case "${d_longdbl}${longdblsize}" in
7291 $define)
7292         echo " "
7293         $echo $n "Checking to see how big your long doubles are...$c" >&4
7294         $cat >try.c <<'EOCP'
7295 #include <stdio.h>
7296 main()
7297 {
7298         printf("%d\n", sizeof(long double));
7299 }
7300 EOCP
7301         set try
7302         if eval $compile; then
7303                 longdblsize=`./try`
7304                 $echo " $longdblsize bytes." >&4
7305         else
7306                 dflt='8'
7307                 echo " "
7308                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7309                 rp="What is the size of a long double (in bytes)?"
7310                 . ./myread
7311                 longdblsize="$ans"
7312         fi
7313         ;;
7314 esac
7315 $rm -f try.c try
7316
7317 : check for long long
7318 echo " "
7319 echo $n "Checking to see if your system supports long long...$c" >&4
7320 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
7321 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7322         val="$define"
7323         echo " Yup, it does." >&4
7324 else
7325         val="$undef"
7326         echo " Nope, it doesn't." >&4
7327 fi
7328 $rm try.*
7329 set d_longlong
7330 eval $setvar
7331
7332 : check for length of long long
7333 case "${d_longlong}${longlongsize}" in
7334 $define)
7335         echo " "
7336         $echo $n "Checking to see how big your long longs are...$c" >&4
7337         $cat >try.c <<'EOCP'
7338 #include <stdio.h>
7339 main()
7340 {
7341         printf("%d\n", sizeof(long long));
7342 }
7343 EOCP
7344         set try
7345         if eval $compile_ok; then
7346                 longlongsize=`./try`
7347                 $echo " $longlongsize bytes." >&4
7348         else
7349                 dflt='8'
7350                 echo " "
7351                 echo "(I can't seem to compile the test program.  Guessing...)"
7352                 rp="What is the size of a long long (in bytes)?"
7353                 . ./myread
7354                 longlongsize="$ans"
7355         fi
7356         ;;
7357 esac
7358 $rm -f try.c try
7359
7360 : see if lstat exists
7361 set lstat d_lstat
7362 eval $inlibc
7363
7364 : see if mblen exists
7365 set mblen d_mblen
7366 eval $inlibc
7367
7368 : see if mbstowcs exists
7369 set mbstowcs d_mbstowcs
7370 eval $inlibc
7371
7372 : see if mbtowc exists
7373 set mbtowc d_mbtowc
7374 eval $inlibc
7375
7376 : see if memcmp exists
7377 set memcmp d_memcmp
7378 eval $inlibc
7379
7380 : see if memcpy exists
7381 set memcpy d_memcpy
7382 eval $inlibc
7383
7384 : see if memmove exists
7385 set memmove d_memmove
7386 eval $inlibc
7387
7388 : see if memset exists
7389 set memset d_memset
7390 eval $inlibc
7391
7392 : see if mkdir exists
7393 set mkdir d_mkdir
7394 eval $inlibc
7395
7396 : see if mkfifo exists
7397 set mkfifo d_mkfifo
7398 eval $inlibc
7399
7400 : see if mktime exists
7401 set mktime d_mktime
7402 eval $inlibc
7403
7404 : see if msgctl exists
7405 set msgctl d_msgctl
7406 eval $inlibc
7407
7408 : see if msgget exists
7409 set msgget d_msgget
7410 eval $inlibc
7411
7412 : see if msgsnd exists
7413 set msgsnd d_msgsnd
7414 eval $inlibc
7415
7416 : see if msgrcv exists
7417 set msgrcv d_msgrcv
7418 eval $inlibc
7419
7420 : see how much of the 'msg*(2)' library is present.
7421 h_msg=true
7422 echo " "
7423 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
7424 *"$undef"*) h_msg=false;;
7425 esac
7426 : we could also check for sys/ipc.h ...
7427 if $h_msg && $test `./findhdr sys/msg.h`; then
7428         echo "You have the full msg*(2) library." >&4
7429         val="$define"
7430 else
7431         echo "You don't have the full msg*(2) library." >&4
7432         val="$undef"
7433 fi
7434 set d_msg
7435 eval $setvar
7436
7437 : see if this is a malloc.h system
7438 set malloc.h i_malloc
7439 eval $inhdr
7440
7441 : see if stdlib is available
7442 set stdlib.h i_stdlib
7443 eval $inhdr
7444
7445 : determine which malloc to compile in
7446 echo " "
7447 case "$usemymalloc" in
7448 ''|y*|true)     dflt='y' ;;
7449 n*|false)       dflt='n' ;;
7450 *)      dflt="$usemymalloc" ;;
7451 esac
7452 rp="Do you wish to attempt to use the malloc that comes with $package?"
7453 . ./myread
7454 usemymalloc="$ans"
7455 case "$ans" in
7456 y*|true)
7457         usemymalloc='y'
7458         mallocsrc='malloc.c'
7459         mallocobj="malloc$_o"
7460         d_mymalloc="$define"
7461         case "$libs" in
7462         *-lmalloc*)
7463                 : Remove malloc from list of libraries to use
7464                 echo "Removing unneeded -lmalloc from library list" >&4
7465                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
7466                 shift
7467                 libs="$*"
7468                 echo "libs = $libs" >&4
7469                 ;;
7470         esac
7471         ;;
7472 *)
7473         usemymalloc='n'
7474         mallocsrc=''
7475         mallocobj=''
7476         d_mymalloc="$undef"
7477         ;;
7478 esac
7479
7480 : compute the return types of malloc and free
7481 echo " "
7482 $cat >malloc.c <<END
7483 #$i_malloc I_MALLOC
7484 #$i_stdlib I_STDLIB
7485 #include <stdio.h>
7486 #include <sys/types.h>
7487 #ifdef I_MALLOC
7488 #include <malloc.h>
7489 #endif
7490 #ifdef I_STDLIB
7491 #include <stdlib.h>
7492 #endif
7493 #ifdef TRY_MALLOC
7494 void *malloc();
7495 #endif
7496 #ifdef TRY_FREE
7497 void free();
7498 #endif
7499 END
7500 case "$malloctype" in
7501 '')
7502         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7503                 malloctype='void *'
7504         else
7505                 malloctype='char *'
7506         fi
7507         ;;
7508 esac
7509 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7510
7511 case "$freetype" in
7512 '')
7513         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7514                 freetype='void'
7515         else
7516                 freetype='int'
7517         fi
7518         ;;
7519 esac
7520 echo "Your system uses $freetype free(), it would seem." >&4
7521 $rm -f malloc.[co]
7522 : see if nice exists
7523 set nice d_nice
7524 eval $inlibc
7525
7526 : see if pause exists
7527 set pause d_pause
7528 eval $inlibc
7529
7530 : see if pipe exists
7531 set pipe d_pipe
7532 eval $inlibc
7533
7534 : see if poll exists
7535 set poll d_poll
7536 eval $inlibc
7537
7538
7539 : see whether the various POSIXish _yields exist within given cccmd
7540 $cat >try.c <<EOP
7541 #include <pthread.h>
7542 main() {
7543         YIELD();
7544         exit(0);
7545 }
7546 EOP
7547 : see if pthread_yield exists within given cccmd,
7548 : if we do not usethreads this may well end up undef.
7549 set try -DYIELD=pthread_yield
7550 if eval $compile; then
7551     val="$define"
7552     echo 'pthread_yield() found.' >&4
7553 else
7554     val="$undef"
7555     echo 'pthread_yield() NOT found.' >&4
7556 fi
7557 set d_pthread_yield
7558 eval $setvar
7559
7560 : see if sched_yield exists within given cccmd,
7561 : if we do not usethreads this may well end up undef.
7562 set try -DYIELD=sched_yield
7563 if eval $compile; then
7564     val="$define"
7565     echo 'sched_yield() found.' >&4
7566 else
7567     val="$undef"
7568     echo 'sched_yield() NOT found.' >&4
7569 fi
7570 set d_sched_yield
7571 eval $setvar
7572 $rm -f try try.*
7573
7574 : test whether pthreads are created in joinable -- aka undetached -- state
7575 if test "X$usethreads" = "X$define"; then
7576         echo $n "Checking whether pthreads are created joinable. $c" >&4 
7577         $cat >try.c <<'EOCP'
7578 #include <pthread.h>
7579 #include <stdio.h>
7580 int main() {
7581     pthread_attr_t attr;
7582     int detachstate;
7583     printf("%s\n",
7584         pthread_attr_init(&attr) == 0 &&
7585         pthread_attr_getdetachstate(&attr, &detachstate) == 0 &&
7586         detachstate == PTHREAD_CREATE_DETACHED ?
7587         "detached" : "joinable");
7588     exit(0);
7589 }
7590 EOCP
7591         set try
7592         if eval $compile; then
7593                 yyy=`./try`
7594                 case "$yyy" in
7595                         detached) echo "Nope, they aren't." >&4 ;;
7596                         *) echo "Yup, they are." >&4 ;;
7597                 esac
7598         else
7599                 echo " "
7600                 echo "(I can't execute the test program--assuming they are.)" >&4
7601                 yyy=joinable
7602         fi
7603         $rm -f try try.*
7604         case "$yyy" in
7605                 detached) val="$undef" ;;
7606                 *) val="$define" ;;
7607         esac
7608         set d_pthreads_created_joinable
7609         eval $setvar
7610 else
7611     d_pthreads_created_joinable="$undef"
7612 fi
7613
7614 : see if this is a pwd.h system
7615 set pwd.h i_pwd
7616 eval $inhdr
7617
7618 case "$i_pwd" in
7619 $define)
7620         xxx=`./findhdr pwd.h`
7621         $cppstdin $cppflags $cppminus < $xxx >$$.h
7622
7623         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
7624                 val="$define"
7625         else
7626                 val="$undef"
7627         fi
7628         set d_pwquota
7629         eval $setvar
7630
7631         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
7632                 val="$define"
7633         else
7634                 val="$undef"
7635         fi
7636         set d_pwage
7637         eval $setvar
7638
7639         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
7640                 val="$define"
7641         else
7642                 val="$undef"
7643         fi
7644         set d_pwchange
7645         eval $setvar
7646
7647         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
7648                 val="$define"
7649         else
7650                 val="$undef"
7651         fi
7652         set d_pwclass
7653         eval $setvar
7654
7655         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
7656                 val="$define"
7657         else
7658                 val="$undef"
7659         fi
7660         set d_pwexpire
7661         eval $setvar
7662
7663         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
7664                 val="$define"
7665         else
7666                 val="$undef"
7667         fi
7668         set d_pwcomment
7669         eval $setvar
7670
7671         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
7672                 val="$define"
7673         else
7674                 val="$undef"
7675         fi
7676         set d_pwgecos
7677         eval $setvar
7678
7679         $rm -f $$.h
7680         ;;
7681 *)
7682         val="$undef"; 
7683         set d_pwquota; eval $setvar
7684         set d_pwage; eval $setvar
7685         set d_pwchange; eval $setvar
7686         set d_pwclass; eval $setvar
7687         set d_pwexpire; eval $setvar
7688         set d_pwcomment; eval $setvar
7689         set d_pwgecos; eval $setvar
7690         ;;
7691 esac
7692
7693 : see if readdir and friends exist
7694 set readdir d_readdir
7695 eval $inlibc
7696 set seekdir d_seekdir
7697 eval $inlibc
7698 set telldir d_telldir
7699 eval $inlibc
7700 set rewinddir d_rewinddir
7701 eval $inlibc
7702
7703 : see if readlink exists
7704 set readlink d_readlink
7705 eval $inlibc
7706
7707 : see if rename exists
7708 set rename d_rename
7709 eval $inlibc
7710
7711 : see if rmdir exists
7712 set rmdir d_rmdir
7713 eval $inlibc
7714
7715 : see if memory.h is available.
7716 val=''
7717 set memory.h val
7718 eval $inhdr
7719
7720 : See if it conflicts with string.h
7721 case "$val" in
7722 $define)
7723         case "$strings" in
7724         '') ;;
7725         *)
7726                 $cppstdin $cppflags $cppminus < $strings > mem.h
7727                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
7728                         echo " "
7729                         echo "We won't be including <memory.h>."
7730                         val="$undef"
7731                 fi
7732                 $rm -f mem.h
7733                 ;;
7734         esac
7735 esac
7736 set i_memory
7737 eval $setvar
7738
7739 : can bcopy handle overlapping blocks?
7740 val="$undef"
7741 case "$d_bcopy" in
7742 "$define")
7743         echo " "
7744         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
7745         $cat >try.c <<EOCP
7746 #$i_memory I_MEMORY
7747 #$i_stdlib I_STDLIB
7748 #$i_string I_STRING
7749 #$i_unistd I_UNISTD
7750 EOCP
7751         $cat >>try.c <<'EOCP'
7752 #include <stdio.h>
7753 #ifdef I_MEMORY
7754 #  include <memory.h>
7755 #endif
7756 #ifdef I_STDLIB
7757 #  include <stdlib.h>
7758 #endif
7759 #ifdef I_STRING
7760 #  include <string.h>
7761 #else
7762 #  include <strings.h>
7763 #endif
7764 #ifdef I_UNISTD
7765 #  include <unistd.h>  /* Needed for NetBSD */
7766 #endif
7767 main()
7768 {
7769 char buf[128], abc[128];
7770 char *b;
7771 int len;
7772 int off;
7773 int align;
7774
7775 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
7776
7777 for (align = 7; align >= 0; align--) {
7778         for (len = 36; len; len--) {
7779                 b = buf+align;
7780                 bcopy(abc, b, len);
7781                 for (off = 1; off <= len; off++) {
7782                         bcopy(b, b+off, len);
7783                         bcopy(b+off, b, len);
7784                         if (bcmp(b, abc, len))
7785                                 exit(1);
7786                 }
7787         }
7788 }
7789 exit(0);
7790 }
7791 EOCP
7792         set try
7793         if eval $compile_ok; then
7794                 if ./try 2>/dev/null; then
7795                         echo "Yes, it can."
7796                         val="$define"
7797                 else
7798                         echo "It can't, sorry."
7799                         case "$d_memmove" in
7800                         "$define") echo "But that's Ok since you have memmove()." ;;
7801                         esac
7802                 fi
7803         else
7804                 echo "(I can't compile the test program, so we'll assume not...)"
7805                 case "$d_memmove" in
7806                 "$define") echo "But that's Ok since you have memmove()." ;;
7807                 esac
7808         fi
7809         ;;
7810 esac
7811 $rm -f try.* try core
7812 set d_safebcpy
7813 eval $setvar
7814
7815 : can memcpy handle overlapping blocks?
7816 val="$undef"
7817 case "$d_memcpy" in
7818 "$define")
7819         echo " "
7820         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
7821         $cat >try.c <<EOCP
7822 #$i_memory I_MEMORY
7823 #$i_stdlib I_STDLIB
7824 #$i_string I_STRING
7825 #$i_unistd I_UNISTD
7826 EOCP
7827         $cat >>try.c <<'EOCP'
7828 #include <stdio.h>
7829 #ifdef I_MEMORY
7830 #  include <memory.h>
7831 #endif
7832 #ifdef I_STDLIB
7833 #  include <stdlib.h>
7834 #endif
7835 #ifdef I_STRING
7836 #  include <string.h>
7837 #else
7838 #  include <strings.h>
7839 #endif
7840 #ifdef I_UNISTD
7841 #  include <unistd.h>  /* Needed for NetBSD */
7842 #endif
7843 main()
7844 {
7845 char buf[128], abc[128];
7846 char *b;
7847 int len;
7848 int off;
7849 int align;
7850
7851 /* Copy "abcde..." string to char abc[] so that gcc doesn't
7852    try to store the string in read-only memory. */
7853 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
7854
7855 for (align = 7; align >= 0; align--) {
7856         for (len = 36; len; len--) {
7857                 b = buf+align;
7858                 memcpy(b, abc, len);
7859                 for (off = 1; off <= len; off++) {
7860                         memcpy(b+off, b, len);
7861                         memcpy(b, b+off, len);
7862                         if (memcmp(b, abc, len))
7863                                 exit(1);
7864                 }
7865         }
7866 }
7867 exit(0);
7868 }
7869 EOCP
7870         set try
7871         if eval $compile_ok; then
7872                 if ./try 2>/dev/null; then
7873                         echo "Yes, it can."
7874                         val="$define"
7875                 else
7876                         echo "It can't, sorry."
7877                         case "$d_memmove" in
7878                         "$define") echo "But that's Ok since you have memmove()." ;;
7879                         esac
7880                 fi
7881         else
7882                 echo "(I can't compile the test program, so we'll assume not...)"
7883                 case "$d_memmove" in
7884                 "$define") echo "But that's Ok since you have memmove()." ;;
7885                 esac
7886         fi
7887         ;;
7888 esac
7889 $rm -f try.* try core
7890 set d_safemcpy
7891 eval $setvar
7892
7893 : can memcmp be trusted to compare relative magnitude?
7894 val="$undef"
7895 case "$d_memcmp" in
7896 "$define")
7897         echo " "
7898         echo "Checking if your memcmp() can compare relative magnitude..." >&4
7899         $cat >try.c <<EOCP
7900 #$i_memory I_MEMORY
7901 #$i_stdlib I_STDLIB
7902 #$i_string I_STRING
7903 #$i_unistd I_UNISTD
7904 EOCP
7905         $cat >>try.c <<'EOCP'
7906 #include <stdio.h>
7907 #ifdef I_MEMORY
7908 #  include <memory.h>
7909 #endif
7910 #ifdef I_STDLIB
7911 #  include <stdlib.h>
7912 #endif
7913 #ifdef I_STRING
7914 #  include <string.h>
7915 #else
7916 #  include <strings.h>
7917 #endif
7918 #ifdef I_UNISTD
7919 #  include <unistd.h>  /* Needed for NetBSD */
7920 #endif
7921 main()
7922 {
7923 char a = -1;
7924 char b = 0;
7925 if ((a < b) && memcmp(&a, &b, 1) < 0)
7926         exit(1);
7927 exit(0);
7928 }
7929 EOCP
7930         set try
7931         if eval $compile_ok; then
7932                 if ./try 2>/dev/null; then
7933                         echo "Yes, it can."
7934                         val="$define"
7935                 else
7936                         echo "No, it can't (it uses signed chars)."
7937                 fi
7938         else
7939                 echo "(I can't compile the test program, so we'll assume not...)"
7940         fi
7941         ;;
7942 esac
7943 $rm -f try.* try core
7944 set d_sanemcmp
7945 eval $setvar
7946
7947 : see if select exists
7948 set select d_select
7949 eval $inlibc
7950
7951 : see if semctl exists
7952 set semctl d_semctl
7953 eval $inlibc
7954
7955 : see if semget exists
7956 set semget d_semget
7957 eval $inlibc
7958
7959 : see if semop exists
7960 set semop d_semop
7961 eval $inlibc
7962
7963 : see how much of the 'sem*(2)' library is present.
7964 h_sem=true
7965 echo " "
7966 case "$d_semctl$d_semget$d_semop" in
7967 *"$undef"*) h_sem=false;;
7968 esac
7969 : we could also check for sys/ipc.h ...
7970 if $h_sem && $test `./findhdr sys/sem.h`; then
7971         echo "You have the full sem*(2) library." >&4
7972         val="$define"
7973 else
7974         echo "You don't have the full sem*(2) library." >&4
7975         val="$undef"
7976 fi
7977 set d_sem
7978 eval $setvar
7979
7980 : see whether sys/sem.h defines union semun
7981 echo " "
7982 $cat > try.c <<'END'
7983 #include <sys/types.h>
7984 #include <sys/ipc.h>
7985 #include <sys/sem.h>
7986 int main () { union semun semun; semun.buf = 0; }
7987 END
7988 set try
7989 if eval $compile; then
7990     echo "You have union semun in <sys/sem.h>." >&4
7991     val="$define"
7992 else
7993     echo "You do not have union semun in <sys/sem.h>." >&4
7994     val="$undef"
7995 fi
7996 $rm -f try try.c
7997 set d_union_semun
7998 eval $setvar
7999
8000 : see how to do semctl IPC_STAT
8001 case "$d_sem" in
8002 $define)
8003     : see whether semctl IPC_STAT can use union semun
8004     echo " "
8005     $cat > try.c <<END
8006 #include <sys/types.h>
8007 #include <sys/ipc.h>
8008 #include <sys/sem.h>
8009 #include <sys/stat.h>
8010 #include <stdio.h>
8011 #include <errno.h>
8012 #ifndef errno
8013 extern int errno;
8014 #endif
8015 #$d_union_semun HAS_UNION_SEMUN
8016 int main() {
8017     union semun
8018 #ifndef HAS_UNION_SEMUN
8019     {
8020         int val;
8021         struct semid_ds *buf;
8022         unsigned short *array;
8023     }
8024 #endif
8025     arg;
8026     int sem, st;
8027
8028 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
8029     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
8030     if (sem > -1) {
8031         struct semid_ds argbuf;
8032         arg.buf = &argbuf;
8033 #       ifdef IPC_STAT
8034         st = semctl(sem, 0, IPC_STAT, arg);
8035         if (st == 0)
8036             printf("semun\n");
8037         else
8038 #       endif /* IPC_STAT */
8039             printf("semctl IPC_STAT failed: errno = %d\n", errno);
8040 #       ifdef IPC_RMID
8041         if (semctl(sem, 0, IPC_RMID, arg) != 0)
8042 #       endif /* IPC_RMID */
8043             printf("semctl IPC_RMID failed: errno = %d\n", errno);
8044     } else
8045 #endif /* IPC_PRIVATE && ... */
8046         printf("semget failed: errno = %d\n", errno);
8047   return 0;
8048 }
8049 END
8050     val="$undef"
8051     set try
8052     if eval $compile; then
8053         xxx=`./try`
8054         case "$xxx" in
8055         semun) val="$define" ;;
8056         esac
8057     fi
8058     $rm -f try try.c
8059     set d_semctl_semun
8060     eval $setvar
8061     case "$d_semctl_semun" in
8062     $define)
8063         echo "You can use union semun for semctl IPC_STAT." >&4
8064         also='also'
8065         ;;
8066     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
8067         also=''
8068         ;;
8069     esac
8070
8071     : see whether semctl IPC_STAT can use struct semid_ds pointer
8072     $cat > try.c <<'END'
8073 #include <sys/types.h>
8074 #include <sys/ipc.h>
8075 #include <sys/sem.h>
8076 #include <sys/stat.h>
8077 #include <stdio.h>
8078 #include <errno.h>
8079 #ifndef errno
8080 extern int errno;
8081 #endif
8082 int main() {
8083     struct semid_ds arg;
8084     int sem, st;
8085
8086 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
8087     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
8088     if (sem > -1) {
8089 #       ifdef IPC_STAT
8090         st = semctl(sem, 0, IPC_STAT, &arg);
8091         if (st == 0)
8092             printf("semid_ds\n");
8093         else
8094 #       endif /* IPC_STAT */
8095             printf("semctl IPC_STAT failed: errno = %d\n", errno);
8096 #       ifdef IPC_RMID
8097         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
8098 #       endif /* IPC_RMID */
8099             printf("semctl IPC_RMID failed: errno = %d\n", errno);
8100     } else
8101 #endif /* IPC_PRIVATE && ... */
8102         printf("semget failed: errno = %d\n", errno);
8103
8104     return 0;
8105 }
8106 END
8107     val="$undef"
8108     set try
8109     if eval $compile; then
8110         xxx=`./try`
8111         case "$xxx" in
8112         semid_ds) val="$define" ;;
8113         esac
8114     fi
8115     $rm -f try try.c
8116     set d_semctl_semid_ds
8117     eval $setvar
8118     case "$d_semctl_semid_ds" in
8119     $define)
8120         echo "You can $also use struct semid_ds * for semctl IPC_STAT." >&4
8121         ;;
8122     *)  echo "You cannot use struct semid_ds * for semctl IPC_STAT." >&4
8123         ;;
8124     esac
8125     ;;
8126 *)  val="$undef"
8127
8128     # We do not have the full sem*(2) library, so assume we can not
8129     # use either.
8130
8131     set d_semctl_semun
8132     eval $setvar
8133
8134     set d_semctl_semid_ds
8135     eval $setvar
8136     ;;
8137 esac
8138
8139 : see if setegid exists
8140 set setegid d_setegid
8141 eval $inlibc
8142
8143 : see if seteuid exists
8144 set seteuid d_seteuid
8145 eval $inlibc
8146
8147 : see if sethostent exists
8148 set sethostent d_sethent
8149 eval $inlibc
8150
8151 : see if setlinebuf exists
8152 set setlinebuf d_setlinebuf
8153 eval $inlibc
8154
8155 : see if setlocale exists
8156 set setlocale d_setlocale
8157 eval $inlibc
8158
8159 : see if setnetent exists
8160 set setnetent d_setnent
8161 eval $inlibc
8162
8163 : see if setprotoent exists
8164 set setprotoent d_setpent
8165 eval $inlibc
8166
8167 : see if setpgid exists
8168 set setpgid d_setpgid
8169 eval $inlibc
8170
8171 : see if setpgrp2 exists
8172 set setpgrp2 d_setpgrp2
8173 eval $inlibc
8174
8175 : see if setpriority exists
8176 set setpriority d_setprior
8177 eval $inlibc
8178
8179 : see if setregid exists
8180 set setregid d_setregid
8181 eval $inlibc
8182 set setresgid d_setresgid
8183 eval $inlibc
8184
8185 : see if setreuid exists
8186 set setreuid d_setreuid
8187 eval $inlibc
8188 set setresuid d_setresuid
8189 eval $inlibc
8190
8191 : see if setrgid exists
8192 set setrgid d_setrgid
8193 eval $inlibc
8194
8195 : see if setruid exists
8196 set setruid d_setruid
8197 eval $inlibc
8198
8199 : see if setservent exists
8200 set setservent d_setsent
8201 eval $inlibc
8202
8203 : see if setsid exists
8204 set setsid d_setsid
8205 eval $inlibc
8206
8207 : see if setvbuf exists
8208 set setvbuf d_setvbuf
8209 eval $inlibc
8210
8211 : see if sfio.h is available
8212 set sfio.h i_sfio
8213 eval $inhdr
8214
8215
8216 : see if sfio library is available
8217 case "$i_sfio" in
8218 $define)
8219         val=''
8220         set sfreserve val
8221         eval $inlibc
8222         ;;
8223 *)
8224         val="$undef"
8225         ;;
8226 esac
8227 : Ok, but do we want to use it.
8228 case "$val" in
8229 $define)
8230         case "$usesfio" in
8231         true|$define|[yY]*) dflt='y';;
8232         *) dflt='n';;
8233         esac
8234         echo "$package can use the sfio library, but it is experimental."
8235         rp="You seem to have sfio available, do you want to try using it?"
8236         . ./myread
8237         case "$ans" in
8238         y|Y) ;;
8239         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
8240                 val="$undef"
8241                 : Remove sfio from list of libraries to use
8242                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
8243                 shift
8244                 libs="$*"
8245                 echo "libs = $libs" >&4
8246                 ;;
8247         esac
8248         ;;
8249 *)      case "$usesfio" in
8250         true|$define|[yY]*)
8251                 echo "Sorry, cannot find sfio on this machine" >&4
8252                 echo "Ignoring your setting of usesfio=$usesfio" >&4
8253                 ;;
8254         esac
8255         ;;
8256 esac
8257 set d_sfio
8258 eval $setvar
8259 case "$d_sfio" in
8260 $define) usesfio='true';;
8261 *) usesfio='false';;
8262 esac
8263
8264 : see if shmctl exists
8265 set shmctl d_shmctl
8266 eval $inlibc
8267
8268 : see if shmget exists
8269 set shmget d_shmget
8270 eval $inlibc
8271
8272 : see if shmat exists
8273 set shmat d_shmat
8274 eval $inlibc
8275 : see what shmat returns
8276 case "$d_shmat" in
8277 "$define")
8278         $cat >shmat.c <<'END'
8279 #include <sys/shm.h>
8280 void *shmat();
8281 END
8282         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
8283                 shmattype='void *'
8284         else
8285                 shmattype='char *'
8286         fi
8287         echo "and it returns ($shmattype)." >&4
8288         : see if a prototype for shmat is available
8289         xxx=`./findhdr sys/shm.h`
8290         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
8291         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
8292                 val="$define"
8293         else
8294                 val="$undef"
8295         fi
8296         $rm -f shmat.[co]
8297         ;;
8298 *)
8299         val="$undef"
8300         ;;
8301 esac
8302 set d_shmatprototype
8303 eval $setvar
8304
8305 : see if shmdt exists
8306 set shmdt d_shmdt
8307 eval $inlibc
8308
8309 : see how much of the 'shm*(2)' library is present.
8310 h_shm=true
8311 echo " "
8312 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
8313 *"$undef"*) h_shm=false;;
8314 esac
8315 : we could also check for sys/ipc.h ...
8316 if $h_shm && $test `./findhdr sys/shm.h`; then
8317         echo "You have the full shm*(2) library." >&4
8318         val="$define"
8319 else
8320         echo "You don't have the full shm*(2) library." >&4
8321         val="$undef"
8322 fi
8323 set d_shm
8324 eval $setvar
8325
8326 echo " "
8327 : see if we have sigaction
8328 if set sigaction val -f d_sigaction; eval $csym; $val; then
8329         echo 'sigaction() found.' >&4
8330         $cat > try.c <<'EOP'
8331 #include <stdio.h>
8332 #include <sys/types.h>
8333 #include <signal.h>
8334 main()
8335 {
8336     struct sigaction act, oact;
8337 }
8338 EOP
8339         set try
8340         if eval $compile_ok; then
8341                 val="$define"
8342         else
8343                 echo "But you don't seem to have a useable struct sigaction." >&4
8344                 val="$undef"
8345         fi
8346 else
8347         echo 'sigaction NOT found.' >&4
8348         val="$undef"
8349 fi
8350 set d_sigaction; eval $setvar
8351 $rm -f try try$_o try.c
8352
8353 : see if sigsetjmp exists
8354 echo " "
8355 case "$d_sigsetjmp" in
8356 '')
8357         $cat >try.c <<'EOP'
8358 #include <setjmp.h>
8359 sigjmp_buf env;
8360 int set = 1;
8361 main()
8362 {
8363         if (sigsetjmp(env,1))
8364                 exit(set);
8365         set = 0;
8366         siglongjmp(env, 1);
8367         exit(1);
8368 }
8369 EOP
8370         set try
8371         if eval $compile; then
8372                 if ./try >/dev/null 2>&1; then
8373                         echo "POSIX sigsetjmp found." >&4
8374                         val="$define"
8375                 else
8376                         $cat >&4 <<EOM
8377 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
8378 I'll ignore them.
8379 EOM
8380                         val="$undef"
8381                 fi
8382         else
8383                 echo "sigsetjmp not found." >&4
8384                 val="$undef"
8385         fi
8386         ;;
8387 *) val="$d_sigsetjmp"
8388         case "$d_sigsetjmp" in
8389         $define) echo "POSIX sigsetjmp found." >&4;;
8390         $undef) echo "sigsetjmp not found." >&4;;
8391         esac
8392         ;;
8393 esac
8394 set d_sigsetjmp
8395 eval $setvar
8396 $rm -f try.c try
8397
8398 socketlib=''
8399 sockethdr=''
8400 : see whether socket exists
8401 echo " "
8402 $echo $n "Hmm... $c" >&4
8403 if set socket val -f d_socket; eval $csym; $val; then
8404         echo "Looks like you have Berkeley networking support." >&4
8405         d_socket="$define"
8406         if set setsockopt val -f; eval $csym; $val; then
8407                 d_oldsock="$undef"
8408         else
8409                 echo "...but it uses the old 4.1c interface, rather than 4.2" >&4
8410                 d_oldsock="$define"
8411         fi
8412 else
8413         if $contains socklib libc.list >/dev/null 2>&1; then
8414                 echo "Looks like you have Berkeley networking support." >&4
8415                 d_socket="$define"
8416                 : we will have to assume that it supports the 4.2 BSD interface
8417                 d_oldsock="$undef"
8418         else
8419                 echo "You don't have Berkeley networking in libc$_a..." >&4
8420                 if test -f /usr/lib/libnet$_a; then
8421                         ( ($nm $nm_opt /usr/lib/libnet$_a | eval $nm_extract) ||  \
8422                         $ar t /usr/lib/libnet$_a) 2>/dev/null >> libc.list
8423                         if $contains socket libc.list >/dev/null 2>&1; then
8424                         echo "...but the Wollongong group seems to have hacked it in." >&4
8425                                 socketlib="-lnet"
8426                                 sockethdr="-I/usr/netinclude"
8427                                 d_socket="$define"
8428                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
8429                                         d_oldsock="$undef"
8430                                 else
8431                                         echo "...using the old 4.1c interface, rather than 4.2" >&4
8432                                         d_oldsock="$define"
8433                                 fi
8434                         else
8435                                 echo "or even in libnet$_a, which is peculiar." >&4
8436                                 d_socket="$undef"
8437                                 d_oldsock="$undef"
8438                         fi
8439                 else
8440                         echo "or anywhere else I see." >&4
8441                         d_socket="$undef"
8442                         d_oldsock="$undef"
8443                 fi
8444         fi
8445 fi
8446
8447 : see if socketpair exists
8448 set socketpair d_sockpair
8449 eval $inlibc
8450
8451 : see if stat knows about block sizes
8452 echo " "
8453 xxx=`./findhdr sys/stat.h`
8454 if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then
8455         if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then
8456                 echo "Your stat() knows about block sizes." >&4
8457                 val="$define"
8458         else
8459                 echo "Your stat() doesn't know about block sizes." >&4
8460                 val="$undef"
8461         fi
8462 else
8463         echo "Your stat() doesn't know about block sizes." >&4
8464         val="$undef"
8465 fi
8466 set d_statblks
8467 eval $setvar
8468
8469 : see if _ptr and _cnt from stdio act std
8470 echo " "
8471 if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then
8472         echo "(Looks like you have stdio.h from Linux.)"
8473         case "$stdio_ptr" in
8474         '') stdio_ptr='((fp)->_IO_read_ptr)'
8475                 ptr_lval=$define
8476                 ;;
8477         *)      ptr_lval=$d_stdio_ptr_lval;;
8478         esac
8479         case "$stdio_cnt" in
8480         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
8481                 cnt_lval=$undef
8482                 ;;
8483         *)      cnt_lval=$d_stdio_cnt_lval;;
8484         esac
8485         case "$stdio_base" in
8486         '') stdio_base='((fp)->_IO_read_base)';;
8487         esac
8488         case "$stdio_bufsiz" in
8489         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
8490         esac
8491 else
8492         case "$stdio_ptr" in
8493         '') stdio_ptr='((fp)->_ptr)'
8494                 ptr_lval=$define
8495                 ;;
8496         *)      ptr_lval=$d_stdio_ptr_lval;;
8497         esac
8498         case "$stdio_cnt" in
8499         '') stdio_cnt='((fp)->_cnt)'
8500                 cnt_lval=$define
8501                 ;;
8502         *)      cnt_lval=$d_stdio_cnt_lval;;
8503         esac
8504         case "$stdio_base" in
8505         '') stdio_base='((fp)->_base)';;
8506         esac
8507         case "$stdio_bufsiz" in
8508         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
8509         esac
8510 fi
8511 : test whether _ptr and _cnt really work
8512 echo "Checking how std your stdio is..." >&4
8513 $cat >try.c <<EOP
8514 #include <stdio.h>
8515 #define FILE_ptr(fp)    $stdio_ptr
8516 #define FILE_cnt(fp)    $stdio_cnt
8517 main() {
8518         FILE *fp = fopen("try.c", "r");
8519         char c = getc(fp);
8520         if (
8521                 18 <= FILE_cnt(fp) &&
8522                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
8523         )
8524                 exit(0);
8525         exit(1);
8526 }
8527 EOP
8528 val="$undef"
8529 set try
8530 if eval $compile; then
8531         if ./try; then
8532                 echo "Your stdio acts pretty std."
8533                 val="$define"
8534         else
8535                 echo "Your stdio isn't very std."
8536         fi
8537 else
8538         echo "Your stdio doesn't appear very std."
8539 fi
8540 $rm -f try.c try
8541 set d_stdstdio
8542 eval $setvar
8543
8544 : Can _ptr be used as an lvalue?
8545 case "$d_stdstdio$ptr_lval" in
8546 $define$define) val=$define ;;
8547 *) val=$undef ;;
8548 esac
8549 set d_stdio_ptr_lval
8550 eval $setvar
8551
8552 : Can _cnt be used as an lvalue?
8553 case "$d_stdstdio$cnt_lval" in
8554 $define$define) val=$define ;;
8555 *) val=$undef ;;
8556 esac
8557 set d_stdio_cnt_lval
8558 eval $setvar
8559
8560 : see if _base is also standard
8561 val="$undef"
8562 case "$d_stdstdio" in
8563 $define)
8564         $cat >try.c <<EOP
8565 #include <stdio.h>
8566 #define FILE_base(fp)   $stdio_base
8567 #define FILE_bufsiz(fp) $stdio_bufsiz
8568 main() {
8569         FILE *fp = fopen("try.c", "r");
8570         char c = getc(fp);
8571         if (
8572                 19 <= FILE_bufsiz(fp) &&
8573                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
8574         )
8575                 exit(0);
8576         exit(1);
8577 }
8578 EOP
8579         set try
8580         if eval $compile; then
8581                 if ./try; then
8582                         echo "And its _base field acts std."
8583                         val="$define"
8584                 else
8585                         echo "But its _base field isn't std."
8586                 fi
8587         else
8588                 echo "However, it seems to be lacking the _base field."
8589         fi
8590         $rm -f try.c try
8591         ;;
8592 esac
8593 set d_stdiobase
8594 eval $setvar
8595
8596 : see if strcoll exists
8597 set strcoll d_strcoll
8598 eval $inlibc
8599
8600 : check for structure copying
8601 echo " "
8602 echo "Checking to see if your C compiler can copy structs..." >&4
8603 $cat >try.c <<'EOCP'
8604 main()
8605 {
8606         struct blurfl {
8607                 int dyick;
8608         } foo, bar;
8609
8610         foo = bar;
8611 }
8612 EOCP
8613 if $cc -c try.c >/dev/null 2>&1 ; then
8614         val="$define"
8615         echo "Yup, it can."
8616 else
8617         val="$undef"
8618         echo "Nope, it can't."
8619 fi
8620 set d_strctcpy
8621 eval $setvar
8622 $rm -f try.*
8623
8624 : see if strerror and/or sys_errlist[] exist
8625 echo " "
8626 if set strerror val -f d_strerror; eval $csym; $val; then
8627         echo 'strerror() found.' >&4
8628         d_strerror="$define"
8629         d_strerrm='strerror(e)'
8630         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
8631                 echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
8632                 d_syserrlst="$define"
8633         else
8634         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
8635                 d_syserrlst="$undef"
8636         fi
8637 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
8638         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
8639         echo 'strerror() found in string header.' >&4
8640         d_strerror="$define"
8641         d_strerrm='strerror(e)'
8642         if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
8643                 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
8644                 d_syserrlst="$define"
8645         else
8646                 echo "(You don't appear to have any sys_errlist[], how can this be?)"
8647                 d_syserrlst="$undef"
8648         fi
8649 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
8650 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
8651         d_strerror="$undef"
8652         d_syserrlst="$define"
8653         d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
8654 else
8655         echo 'strerror() and sys_errlist[] NOT found.' >&4
8656         d_strerror="$undef"
8657         d_syserrlst="$undef"
8658         d_strerrm='"unknown"'
8659 fi
8660
8661 : see if strtod exists
8662 set strtod d_strtod
8663 eval $inlibc
8664
8665 : see if strtol exists
8666 set strtol d_strtol
8667 eval $inlibc
8668
8669 : see if strtoul exists
8670 set strtoul d_strtoul
8671 eval $inlibc
8672
8673 : see if strxfrm exists
8674 set strxfrm d_strxfrm
8675 eval $inlibc
8676
8677 : see if symlink exists
8678 set symlink d_symlink
8679 eval $inlibc
8680
8681 : see if syscall exists
8682 set syscall d_syscall
8683 eval $inlibc
8684
8685 : see if sysconf exists
8686 set sysconf d_sysconf
8687 eval $inlibc
8688
8689 : see if system exists
8690 set system d_system
8691 eval $inlibc
8692
8693 : see if tcgetpgrp exists
8694 set tcgetpgrp d_tcgetpgrp
8695 eval $inlibc
8696
8697 : see if tcsetpgrp exists
8698 set tcsetpgrp d_tcsetpgrp
8699 eval $inlibc
8700
8701 : define an is-a-typedef? function
8702 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8703 case "$inclist" in
8704 "") inclist="sys/types.h";;
8705 esac;
8706 eval "varval=\$$var";
8707 case "$varval" in
8708 "")
8709         $rm -f temp.c;
8710         for inc in $inclist; do
8711                 echo "#include <$inc>" >>temp.c;
8712         done;
8713         echo "#ifdef $type" >> temp.c;
8714         echo "printf(\"We have $type\");" >> temp.c;
8715         echo "#endif" >> temp.c;
8716         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8717         if $contains $type temp.E >/dev/null 2>&1; then
8718                 eval "$var=\$type";
8719         else
8720                 eval "$var=\$def";
8721         fi;
8722         $rm -f temp.?;;
8723 *) eval "$var=\$varval";;
8724 esac'
8725
8726 : define an is-a-typedef? function that prompts if the type is not available.
8727 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8728 case "$inclist" in
8729 "") inclist="sys/types.h";;
8730 esac;
8731 eval "varval=\$$var";
8732 case "$varval" in
8733 "")
8734         $rm -f temp.c;
8735         for inc in $inclist; do
8736                 echo "#include <$inc>" >>temp.c;
8737         done;
8738         echo "#ifdef $type" >> temp.c;
8739         echo "printf(\"We have $type\");" >> temp.c;
8740         echo "#endif" >> temp.c;
8741         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8742         echo " " ;
8743         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8744         if $contains $type temp.E >/dev/null 2>&1; then
8745                 echo "$type found." >&4;
8746                 eval "$var=\$type";
8747         else
8748                 echo "$type NOT found." >&4;
8749                 dflt="$def";
8750                 . ./myread ;
8751                 eval "$var=\$ans";
8752         fi;
8753         $rm -f temp.?;;
8754 *) eval "$var=\$varval";;
8755 esac'
8756
8757 : see if this is a sys/times.h system
8758 set sys/times.h i_systimes
8759 eval $inhdr
8760
8761 : see if times exists
8762 echo " "
8763 if set times val -f d_times; eval $csym; $val; then
8764         echo 'times() found.' >&4
8765         d_times="$define"
8766         inc=''
8767         case "$i_systimes" in
8768         "$define") inc='sys/times.h';;
8769         esac
8770         rp="What is the type returned by times() on this system?"
8771         set clock_t clocktype long stdio.h sys/types.h $inc
8772         eval $typedef_ask
8773 else
8774         echo 'times() NOT found, hope that will do.' >&4
8775         d_times="$undef"
8776         clocktype='int'
8777 fi
8778
8779 : see if truncate exists
8780 set truncate d_truncate
8781 eval $inlibc
8782
8783 : see if tzname[] exists
8784 echo " "
8785 if set tzname val -a d_tzname; eval $csym; $val; then
8786         val="$define"
8787         echo 'tzname[] found.' >&4
8788 else
8789         val="$undef"
8790         echo 'tzname[] NOT found.' >&4
8791 fi
8792 set d_tzname
8793 eval $setvar
8794
8795 : see if umask exists
8796 set umask d_umask
8797 eval $inlibc
8798
8799 : see how we will look up host name
8800 echo " "
8801 if false; then
8802         : dummy stub to allow use of elif
8803 elif set uname val -f d_uname; eval $csym; $val; then
8804         if ./xenix; then
8805                 $cat <<'EOM'
8806 uname() was found, but you're running xenix, and older versions of xenix
8807 have a broken uname(). If you don't really know whether your xenix is old
8808 enough to have a broken system call, use the default answer.
8809
8810 EOM
8811                 dflt=y
8812                 case "$d_uname" in
8813                 "$define") dflt=n;;
8814                 esac
8815                 rp='Is your uname() broken?'
8816                 . ./myread
8817                 case "$ans" in
8818                 n*) d_uname="$define"; call=uname;;
8819                 esac
8820         else
8821                 echo 'uname() found.' >&4
8822                 d_uname="$define"
8823                 call=uname
8824         fi
8825 fi
8826 case "$d_gethname" in
8827 '') d_gethname="$undef";;
8828 esac
8829 case "$d_uname" in
8830 '') d_uname="$undef";;
8831 esac
8832 case "$d_phostname" in
8833 '') d_phostname="$undef";;
8834 esac
8835
8836 : backward compatibility for d_hvfork
8837 if test X$d_hvfork != X; then
8838         d_vfork="$d_hvfork"
8839         d_hvfork=''
8840 fi
8841 : see if there is a vfork
8842 val=''
8843 set vfork val
8844 eval $inlibc
8845
8846 : Ok, but do we want to use it. vfork is reportedly unreliable in 
8847 : perl on Solaris 2.x, and probably elsewhere.
8848 case "$val" in
8849 $define)
8850         echo " "
8851         case "$usevfork" in
8852         false) dflt='n';;
8853         *) dflt='y';;
8854         esac
8855         rp="Some systems have problems with vfork().  Do you want to use it?"
8856         . ./myread
8857         case "$ans" in
8858         y|Y) ;;
8859         *)
8860                 echo "Ok, we won't use vfork()."
8861                 val="$undef"
8862                 ;;
8863         esac
8864         ;;
8865 esac
8866 set d_vfork
8867 eval $setvar
8868 case "$d_vfork" in
8869 $define) usevfork='true';;
8870 *) usevfork='false';;
8871 esac
8872
8873 : see if this is an sysdir system
8874 set sys/dir.h i_sysdir
8875 eval $inhdr
8876
8877 : see if this is an sysndir system
8878 set sys/ndir.h i_sysndir
8879 eval $inhdr
8880
8881 : see if closedir exists
8882 set closedir d_closedir
8883 eval $inlibc
8884
8885 case "$d_closedir" in
8886 "$define")
8887         echo " "
8888         echo "Checking whether closedir() returns a status..." >&4
8889         cat > closedir.c <<EOM
8890 #$i_dirent I_DIRENT             /**/
8891 #$i_sysdir I_SYS_DIR            /**/
8892 #$i_sysndir I_SYS_NDIR          /**/
8893
8894 #if defined(I_DIRENT)
8895 #include <dirent.h>
8896 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
8897 #include <sys/dir.h>
8898 #endif
8899 #else
8900 #ifdef I_SYS_NDIR
8901 #include <sys/ndir.h>
8902 #else
8903 #ifdef I_SYS_DIR
8904 #ifdef hp9000s500
8905 #include <ndir.h>       /* may be wrong in the future */
8906 #else
8907 #include <sys/dir.h>
8908 #endif
8909 #endif
8910 #endif
8911 #endif 
8912 int main() { return closedir(opendir(".")); }
8913 EOM
8914         set closedir
8915         if eval $compile_ok; then
8916                 if ./closedir > /dev/null 2>&1 ; then
8917                         echo "Yes, it does."
8918                         val="$undef"
8919                 else
8920                         echo "No, it doesn't."
8921                         val="$define"
8922                 fi
8923         else
8924                 echo "(I can't seem to compile the test program--assuming it doesn't)"
8925                 val="$define"
8926         fi
8927         ;;
8928 *)
8929         val="$undef";
8930         ;;
8931 esac
8932 set d_void_closedir
8933 eval $setvar
8934 $rm -f closedir*
8935 : check for volatile keyword
8936 echo " "
8937 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
8938 $cat >try.c <<'EOCP'
8939 main()
8940 {
8941         typedef struct _goo_struct goo_struct;
8942         goo_struct * volatile goo = ((goo_struct *)0);
8943         struct _goo_struct {
8944                 long long_int;
8945                 int reg_int;
8946                 char char_var;
8947         };
8948         typedef unsigned short foo_t;
8949         char *volatile foo;
8950         volatile int bar;
8951         volatile foo_t blech;
8952         foo = foo;
8953 }
8954 EOCP
8955 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
8956         val="$define"
8957         echo "Yup, it does."
8958 else
8959         val="$undef"
8960         echo "Nope, it doesn't."
8961 fi
8962 set d_volatile
8963 eval $setvar
8964 $rm -f try.*
8965
8966 : see if there is a wait4
8967 set wait4 d_wait4
8968 eval $inlibc
8969
8970 : see if waitpid exists
8971 set waitpid d_waitpid
8972 eval $inlibc
8973
8974 : see if wcstombs exists
8975 set wcstombs d_wcstombs
8976 eval $inlibc
8977
8978 : see if wctomb exists
8979 set wctomb d_wctomb
8980 eval $inlibc
8981
8982 : preserve RCS keywords in files with variable substitution, grrr
8983 Date='$Date'
8984 Id='$Id'
8985 Log='$Log'
8986 RCSfile='$RCSfile'
8987 Revision='$Revision'
8988
8989 : check for alignment requirements
8990 echo " "
8991 case "$alignbytes" in
8992 '') echo "Checking alignment constraints..." >&4
8993         $cat >try.c <<'EOCP'
8994 struct foobar {
8995         char foo;
8996         double bar;
8997 } try;
8998 main()
8999 {
9000         printf("%d\n", (char *)&try.bar - (char *)&try.foo);
9001 }
9002 EOCP
9003         set try
9004         if eval $compile_ok; then
9005                 dflt=`./try`
9006         else
9007                 dflt='8'
9008                 echo "(I can't seem to compile the test program...)"
9009         fi
9010         ;;
9011 *) dflt="$alignbytes"
9012         ;;
9013 esac
9014 rp="Doubles must be aligned on a how-many-byte boundary?"
9015 . ./myread
9016 alignbytes="$ans"
9017 $rm -f try.c try
9018
9019 : check for ordering of bytes in a long
9020 case "$byteorder" in
9021 '')
9022         $cat <<'EOM'
9023   
9024 In the following, larger digits indicate more significance.  A big-endian
9025 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
9026 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
9027 machines may have weird orders like 3412.  A Cray will report 87654321. If
9028 the test program works the default is probably right.
9029 I'm now running the test program...
9030 EOM
9031         $cat >try.c <<'EOCP'
9032 #include <stdio.h>
9033 main()
9034 {
9035         int i;
9036         union {
9037                 unsigned long l;
9038                 char c[sizeof(long)];
9039         } u;
9040
9041         if (sizeof(long) > 4)
9042                 u.l = (0x08070605L << 32) | 0x04030201L;
9043         else
9044                 u.l = 0x04030201L;
9045         for (i = 0; i < sizeof(long); i++)
9046                 printf("%c", u.c[i]+'0');
9047         printf("\n");
9048         exit(0);
9049 }
9050 EOCP
9051         xxx_prompt=y
9052         set try
9053         if eval $compile && ./try > /dev/null; then
9054                 dflt=`./try`
9055                 case "$dflt" in
9056                 [1-4][1-4][1-4][1-4]|12345678|87654321)
9057                         echo "(The test program ran ok.)"
9058                         echo "byteorder=$dflt"
9059                         xxx_prompt=n
9060                         ;;
9061                 ????|????????) echo "(The test program ran ok.)" ;;
9062                 *) echo "(The test program didn't run right for some reason.)" ;;
9063                 esac
9064         else
9065                 dflt='4321'
9066                 cat <<'EOM'
9067 (I can't seem to compile the test program.  Guessing big-endian...)
9068 EOM
9069         fi
9070         case "$xxx_prompt" in
9071         y)
9072                 rp="What is the order of bytes in a long?"
9073                 . ./myread
9074                 byteorder="$ans"
9075                 ;;
9076         *)      byteorder=$dflt
9077                 ;;
9078         esac
9079         ;;
9080 esac
9081 $rm -f try.c try
9082
9083 : how do we catenate cpp tokens here?
9084 echo " "
9085 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
9086 $cat >cpp_stuff.c <<'EOCP'
9087 #define RCAT(a,b)a/**/b
9088 #define ACAT(a,b)a ## b
9089 RCAT(Rei,ser)
9090 ACAT(Cir,cus)
9091 EOCP
9092 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
9093 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
9094         echo "Oh!  Smells like ANSI's been here." >&4
9095         echo "We can catify or stringify, separately or together!"
9096         cpp_stuff=42
9097 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
9098         echo "Ah, yes!  The good old days!" >&4
9099         echo "However, in the good old days we don't know how to stringify and"
9100         echo "catify at the same time."
9101         cpp_stuff=1
9102 else
9103         $cat >&4 <<EOM
9104 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
9105 to have to edit the values of CAT[2-5] in config.h...
9106 EOM
9107         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
9108 fi
9109 $rm -f cpp_stuff.*
9110
9111 : see if this is a db.h system
9112 set db.h i_db
9113 eval $inhdr
9114
9115 case "$i_db" in
9116 $define)
9117         : Check db version.
9118         echo " "
9119         echo "Checking Berkeley DB version ..." >&4
9120         $cat >try.c <<EOCP
9121 #$d_const HASCONST
9122 #ifndef HASCONST
9123 #define const
9124 #endif
9125 #include <sys/types.h>
9126 #include <stdio.h>
9127 #include <db.h>
9128 main()
9129 {
9130 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
9131     int Major, Minor, Patch ;
9132     unsigned long Version ;
9133     (void)db_version(&Major, &Minor, &Patch) ;
9134     printf("You have Berkeley DB Version 2 or greater\n");
9135
9136     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
9137                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
9138     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
9139                 Major, Minor, Patch) ;
9140
9141     /* check that db.h & libdb are compatible */
9142     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
9143         printf("db.h and libdb are incompatible\n") ;
9144         exit(3);        
9145     }
9146
9147     printf("db.h and libdb are compatible\n") ;
9148
9149     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
9150                 + DB_VERSION_PATCH ;
9151
9152     /* needs to be >= 2.3.4 */
9153     if (Version < 2003004) {
9154     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
9155         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
9156         exit(2);        
9157     }
9158
9159     exit(0);
9160 #else
9161 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
9162     printf("You have Berkeley DB Version 1\n");
9163     exit(0);    /* DB version < 2: the coast is clear. */
9164 #else
9165     exit(1);    /* <db.h> not Berkeley DB? */
9166 #endif
9167 #endif
9168 }
9169 EOCP
9170         set try
9171         if eval $compile && ./try; then
9172                 echo 'Looks OK.' >&4
9173         else
9174                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
9175                 i_db=$undef
9176                 case " $libs " in
9177                 *"-ldb "*)
9178                         : Remove db from list of libraries to use
9179                         echo "Removing unusable -ldb from library list" >&4
9180                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
9181                         shift
9182                         libs="$*"
9183                         echo "libs = $libs" >&4
9184                         ;;
9185                 esac
9186         fi
9187         $rm -f try.*
9188         ;;
9189 esac
9190
9191 case "$i_db" in
9192 define)
9193         : Check the return type needed for hash 
9194         echo " "
9195         echo "Checking return type needed for hash for Berkeley DB ..." >&4
9196         $cat >try.c <<EOCP
9197 #$d_const HASCONST
9198 #ifndef HASCONST
9199 #define const
9200 #endif
9201 #include <sys/types.h>
9202 #include <db.h>
9203
9204 #ifndef DB_VERSION_MAJOR
9205 u_int32_t hash_cb (ptr, size)
9206 const void *ptr;
9207 size_t size;
9208 {
9209 }
9210 HASHINFO info;
9211 main()
9212 {
9213         info.hash = hash_cb;
9214 }
9215 #endif
9216 EOCP
9217         if $cc $ccflags -c try.c >try.out 2>&1 ; then
9218                 if $contains warning try.out >>/dev/null 2>&1 ; then
9219                         db_hashtype='int'
9220                 else
9221                         db_hashtype='u_int32_t'
9222                 fi
9223         else
9224                 : XXX Maybe we should just give up here.
9225                 db_hashtype=u_int32_t
9226                 $cat try.out >&4
9227                 echo "Help:  I can't seem to compile the db test program." >&4
9228                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
9229         fi
9230         $rm -f try.*
9231         echo "Your version of Berkeley DB uses $db_hashtype for hash."
9232         ;;
9233 *)      db_hashtype=u_int32_t
9234         ;;
9235 esac
9236 case "$i_db" in
9237 define)
9238         : Check the return type needed for prefix 
9239         echo " "
9240         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
9241         cat >try.c <<EOCP
9242 #$d_const HASCONST
9243 #ifndef HASCONST
9244 #define const
9245 #endif
9246 #include <sys/types.h>
9247 #include <db.h>
9248
9249 #ifndef DB_VERSION_MAJOR
9250 size_t prefix_cb (key1, key2)
9251 const DBT *key1;
9252 const DBT *key2;
9253 {
9254 }
9255 BTREEINFO info;
9256 main()
9257 {
9258         info.prefix = prefix_cb;
9259 }
9260 #endif
9261 EOCP
9262         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
9263                 if $contains warning try.out >>/dev/null 2>&1 ; then
9264                         db_prefixtype='int'
9265                 else
9266                         db_prefixtype='size_t'
9267                 fi
9268         else
9269                 db_prefixtype='size_t'
9270                 : XXX Maybe we should just give up here.
9271                 $cat try.out >&4
9272                 echo "Help:  I can't seem to compile the db test program." >&4
9273                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
9274         fi
9275         $rm -f try.*
9276         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
9277         ;;
9278 *)      db_prefixtype='size_t'
9279         ;;
9280 esac
9281
9282 : check for void type
9283 echo " "
9284 echo "Checking to see how well your C compiler groks the void type..." >&4
9285 echo " "
9286 $cat >&4 <<EOM
9287   Support flag bits are:
9288     1: basic void declarations.
9289     2: arrays of pointers to functions returning void.
9290     4: operations between pointers to and addresses of void functions.
9291     8: generic void pointers.
9292 EOM
9293 echo " "
9294 case "$voidflags" in
9295 '')
9296         $cat >try.c <<'EOCP'
9297 #if TRY & 1
9298 void sub() {
9299 #else
9300 sub() {
9301 #endif
9302         extern void moo();      /* function returning void */
9303         void (*goo)();          /* ptr to func returning void */
9304 #if TRY & 8
9305         void *hue;              /* generic ptr */
9306 #endif
9307 #if TRY & 2
9308         void (*foo[10])();
9309 #endif
9310
9311 #if TRY & 4
9312         if(goo == moo) {
9313                 exit(0);
9314         }
9315 #endif
9316         exit(0);
9317 }
9318 main() { sub(); }
9319 EOCP
9320         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
9321                 voidflags=$defvoidused
9322         echo "It appears to support void to the level $package wants ($defvoidused)."
9323                 if $contains warning .out >/dev/null 2>&1; then
9324                         echo "However, you might get some warnings that look like this:"
9325                         $cat .out
9326                 fi
9327         else
9328 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
9329                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
9330                         echo "It supports 1..."
9331                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
9332                                 echo "It also supports 2..."
9333                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
9334                                         voidflags=7
9335                                         echo "And it supports 4 but not 8 definitely."
9336                                 else
9337                                         echo "It doesn't support 4..."
9338                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
9339                                                 voidflags=11
9340                                                 echo "But it supports 8."
9341                                         else
9342                                                 voidflags=3
9343                                                 echo "Neither does it support 8."
9344                                         fi
9345                                 fi
9346                         else
9347                                 echo "It does not support 2..."
9348                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
9349                                         voidflags=13
9350                                         echo "But it supports 4 and 8."
9351                                 else
9352                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
9353                                                 voidflags=5
9354                                                 echo "And it supports 4 but has not heard about 8."
9355                                         else
9356                                                 echo "However it supports 8 but not 4."
9357                                         fi
9358                                 fi
9359                         fi
9360                 else
9361                         echo "There is no support at all for void."
9362                         voidflags=0
9363                 fi
9364         fi
9365 esac
9366 case "$voidflags" in
9367 "$defvoidused") ;;
9368 *)
9369         dflt="$voidflags";
9370         rp="Your void support flags add up to what?"
9371         . ./myread
9372         voidflags="$ans"
9373         ;;
9374 esac
9375 $rm -f try.* .out
9376
9377 : check for length of double
9378 echo " "
9379 case "$doublesize" in
9380 '')
9381         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
9382         $cat >try.c <<'EOCP'
9383 #include <stdio.h>
9384 main()
9385 {
9386         printf("%d\n", sizeof(double));
9387 }
9388 EOCP
9389         set try
9390         if eval $compile_ok; then
9391                 doublesize=`./try`
9392                 $echo " $doublesize bytes." >&4
9393         else
9394                 dflt='8'
9395                 echo "(I can't seem to compile the test program.  Guessing...)"
9396                 rp="What is the size of a double precision number (in bytes)?"
9397                 . ./myread
9398                 doublesize="$ans"
9399         fi
9400         ;;
9401 esac
9402 $rm -f try.c try
9403
9404 : see what type file positions are declared as in the library
9405 rp="What is the type for file position used by fsetpos()?"
9406 set fpos_t fpostype long stdio.h sys/types.h
9407 eval $typedef_ask
9408
9409 : get csh whereabouts
9410 case "$csh" in
9411 'csh') val="$undef" ;;
9412 *) val="$define" ;;
9413 esac
9414 set d_csh
9415 eval $setvar
9416 : Respect a hint or command line value for full_csh.
9417 case "$full_csh" in
9418 '') full_csh=$csh ;;
9419 esac
9420
9421 : Store the full pathname to the sed program for use in the C program
9422 full_sed=$sed
9423
9424 : see what type gids are declared as in the kernel
9425 echo " "
9426 echo "Looking for the type for group ids returned by getgid()."
9427 set gid_t gidtype xxx stdio.h sys/types.h
9428 eval $typedef
9429 case "$gidtype" in
9430 xxx)
9431         xxx=`./findhdr sys/user.h`
9432         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
9433         case $1 in
9434         unsigned) dflt="$1 $2" ;;
9435         *) dflt="$1" ;;
9436         esac
9437         ;;
9438 *) dflt="$gidtype";;
9439 esac
9440 case "$gidtype" in
9441 gid_t) echo "gid_t found." ;;
9442 *)      rp="What is the type for group ids returned by getgid()?"
9443         . ./myread
9444         gidtype="$ans"
9445         ;;
9446 esac
9447
9448 : see if getgroups exists
9449 set getgroups d_getgrps
9450 eval $inlibc
9451
9452 : see if setgroups exists
9453 set setgroups d_setgrps
9454 eval $inlibc
9455
9456
9457 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
9458 echo " "
9459 case "$d_getgrps$d_setgrps" in
9460 *define*)
9461         case "$groupstype" in
9462         '') dflt="$gidtype" ;;
9463         *)  dflt="$groupstype" ;;
9464         esac
9465         $cat <<EOM
9466 What type of pointer is the second argument to getgroups() and setgroups()?
9467 Usually this is the same as group ids, $gidtype, but not always.
9468
9469 EOM
9470         rp='What type pointer is the second argument to getgroups() and setgroups()?'
9471         . ./myread
9472         groupstype="$ans"
9473         ;;
9474 *)  groupstype="$gidtype";;
9475 esac
9476
9477 : see what type lseek is declared as in the kernel
9478 rp="What is the type used for lseek's offset on this system?"
9479 set off_t lseektype long stdio.h sys/types.h
9480 eval $typedef_ask
9481
9482 echo " "
9483 echo "Checking if your $make program sets \$(MAKE)..." >&4
9484 case "$make_set_make" in
9485 '')
9486         $sed 's/^X //' > testmake.mak << 'EOF'
9487 Xall:
9488 X       @echo 'maketemp="$(MAKE)"'
9489 EOF
9490         case "`$make -f testmake.mak 2>/dev/null`" in
9491         *maketemp=*) make_set_make='#' ;;
9492         *)      make_set_make="MAKE=$make" ;;
9493         esac
9494         $rm -f testmake.mak
9495         ;;
9496 esac
9497 case "$make_set_make" in
9498 '#') echo "Yup, it does.";;
9499 *) echo "Nope, it doesn't.";;
9500 esac
9501
9502 : see what type is used for mode_t
9503 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
9504 set mode_t modetype int stdio.h sys/types.h
9505 eval $typedef_ask
9506
9507 : define a fucntion to check prototypes
9508 $cat > protochk <<EOSH
9509 $startsh
9510 cc="$cc"
9511 optimize="$optimize"
9512 ccflags="$ccflags"
9513 prototype="$prototype"
9514 define="$define"
9515 rm=$rm
9516 EOSH
9517
9518 $cat >> protochk <<'EOSH'
9519
9520 $rm -f try.c
9521 foo="$1"
9522 shift
9523 while test $# -ge 2; do
9524         case "$1" in
9525                 $define) echo "#include <$2>" >> try.c ;;
9526                 literal) echo "$2" >> try.c ;;
9527         esac
9528     shift 2
9529 done
9530 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9531 cat >> try.c <<'EOCP'
9532 #ifdef CAN_PROTOTYPE
9533 #define _(args) args
9534 #else
9535 #define _(args) ()
9536 #endif
9537 EOCP
9538 echo "$foo" >> try.c
9539 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9540 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9541 status=$?
9542 $rm -f try.[co]
9543 exit $status
9544 EOSH
9545 chmod +x protochk
9546 $eunicefix protochk
9547
9548 : see what type is used for size_t
9549 rp="What is the type used for the length parameter for string functions?"
9550 set size_t sizetype 'unsigned int' stdio.h sys/types.h
9551 eval $typedef_ask
9552
9553 : check for type of arguments to gethostbyaddr. 
9554 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
9555         case "$d_gethbyaddr" in
9556         $define)
9557                 $cat <<EOM
9558
9559 Checking to see what type of arguments are accepted by gethostbyaddr().
9560 EOM
9561                 hdrs="$define sys/types.h
9562                         $d_socket sys/socket.h 
9563                         $i_niin netinet/in.h 
9564                         $i_netdb netdb.h
9565                         $i_unistd unistd.h"
9566                 : The first arg can 'char *' or 'void *'
9567                 : The second arg is some of integral type
9568                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
9569                         for yyy in size_t long int; do
9570                                 case "$netdb_host_type" in
9571                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
9572                                         if ./protochk "$try" $hdrs; then
9573                                                 echo "Your system accepts $xxx for the first arg."
9574                                                 echo "...and $yyy for the second arg."
9575                                                 netdb_host_type="$xxx"
9576                                                 netdb_hlen_type="$yyy"
9577                                         fi
9578                                         ;;
9579                                 esac
9580                         done
9581                 done
9582                 : In case none of those worked, prompt the user.
9583                 case "$netdb_host_type" in
9584                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
9585                         dflt='char *'
9586                         . ./myread
9587                         netdb_host_type=$ans
9588                         rp='What is the type for the 2nd argument to gethostbyaddr?'
9589                         dflt="$sizetype"
9590                         . ./myread
9591                         netdb_hlen_type=$ans
9592                         ;;
9593                 esac
9594                 ;;
9595         *)      : no gethostbyaddr, so pick harmless defaults
9596                 netdb_host_type='char *'
9597                 netdb_hlen_type="$sizetype"
9598                 ;;
9599         esac
9600         # Remove the "const" if needed. -- but then we'll have a 
9601         # prototype clash!
9602         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
9603 fi
9604
9605 : check for type of argument to gethostbyname. 
9606 if test "X$netdb_name_type" = X ; then
9607         case "$d_gethbyname" in
9608         $define)
9609                 $cat <<EOM
9610
9611 Checking to see what type of argument is accepted by gethostbyname().
9612 EOM
9613                 hdrs="$define sys/types.h
9614                         $d_socket sys/socket.h 
9615                         $i_niin netinet/in.h 
9616                         $i_netdb netdb.h
9617                         $i_unistd unistd.h"
9618                 for xxx in "const char *" "char *"; do
9619                         case "$netdb_name_type" in
9620                         '')     try="extern struct hostent *gethostbyname($xxx);"
9621                                 if ./protochk "$try" $hdrs; then
9622                                         echo "Your system accepts $xxx."
9623                                         netdb_name_type="$xxx"
9624                                 fi
9625                                 ;;
9626                         esac
9627                 done
9628                 : In case none of those worked, prompt the user.
9629                 case "$netdb_name_type" in
9630                 '')     rp='What is the type for the 1st argument to gethostbyname?'
9631                         dflt='char *'
9632                         . ./myread
9633                         netdb_name_type=$ans
9634                         ;;
9635                 esac
9636                 ;;
9637         *)      : no gethostbyname, so pick harmless default
9638                 netdb_name_type='char *'
9639                 ;;
9640         esac
9641 fi
9642
9643 : check for type of 1st argument to getnetbyaddr. 
9644 if test "X$netdb_net_type" = X ; then
9645         case "$d_getnbyaddr" in
9646         $define)
9647                 $cat <<EOM
9648
9649 Checking to see what type of 1st argument is accepted by getnetbyaddr().
9650 EOM
9651                 hdrs="$define sys/types.h
9652                         $d_socket sys/socket.h 
9653                         $i_niin netinet/in.h 
9654                         $i_netdb netdb.h
9655                         $i_unistd unistd.h"
9656                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
9657                         case "$netdb_net_type" in
9658                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
9659                                 if ./protochk "$try" $hdrs; then
9660                                         echo "Your system accepts $xxx."
9661                                         netdb_net_type="$xxx"
9662                                 fi
9663                                 ;;
9664                         esac
9665                 done
9666                 : In case none of those worked, prompt the user.
9667                 case "$netdb_net_type" in
9668                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
9669                         dflt='long'
9670                         . ./myread
9671                         netdb_net_type=$ans
9672                         ;;
9673                 esac
9674                 ;;
9675         *)      : no getnetbyaddr, so pick harmless default
9676                 netdb_net_type='long'
9677                 ;;
9678         esac
9679 fi
9680 : locate the preferred pager for this system
9681 case "$pager" in
9682 '')
9683         dflt=''
9684         case "$pg" in
9685         /*) dflt=$pg;;
9686         esac
9687         case "$more" in
9688         /*) dflt=$more;;
9689         esac
9690         case "$less" in
9691         /*) dflt=$less;;
9692         esac
9693         case "$dflt" in
9694         '') dflt=/usr/ucb/more;;
9695         esac
9696         ;;
9697 *) dflt="$pager";;
9698 esac
9699 echo " "
9700 fn=f/
9701 rp='What pager is used on your system?'
9702 . ./getfile
9703 pager="$ans"
9704
9705 : see what type pids are declared as in the kernel
9706 rp="What is the type of process ids on this system?"
9707 set pid_t pidtype int stdio.h sys/types.h
9708 eval $typedef_ask
9709
9710 : check for length of pointer
9711 echo " "
9712 case "$ptrsize" in
9713 '')
9714         $echo $n "Checking to see how big your pointers are...$c" >&4
9715         if test "$voidflags" -gt 7; then
9716                 echo '#define VOID_PTR char *' > try.c
9717         else
9718                 echo '#define VOID_PTR void *' > try.c
9719         fi
9720         $cat >>try.c <<'EOCP'
9721 #include <stdio.h>
9722 main()
9723 {
9724         printf("%d\n", sizeof(VOID_PTR));
9725         exit(0);
9726 }
9727 EOCP
9728         set try
9729         if eval $compile_ok; then
9730                 ptrsize=`./try`
9731                 $echo " $ptrsize bytes." >&4
9732         else
9733                 dflt='4'
9734                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
9735                 rp="What is the size of a pointer (in bytes)?"
9736                 . ./myread
9737                 ptrsize="$ans"
9738         fi
9739         ;;
9740 esac
9741 $rm -f try.c try
9742
9743 : check for size of random number generator
9744 echo " "
9745 case "$randbits" in
9746 '')
9747         echo "Checking to see how many bits your rand function produces..." >&4
9748         $cat >try.c <<EOCP
9749 #$i_unistd I_UNISTD
9750 #$i_stdlib I_STDLIB
9751 #include <stdio.h>
9752 #ifdef I_UNISTD
9753 #  include <unistd.h>
9754 #endif
9755 #ifdef I_STDLIB
9756 #  include <stdlib.h>
9757 #endif
9758 EOCP
9759         $cat >>try.c <<'EOCP'
9760 main()
9761 {
9762         register int i;
9763         register unsigned long tmp;
9764         register unsigned long max = 0L;
9765
9766         for (i = 1000; i; i--) {
9767                 tmp = (unsigned long)rand();
9768                 if (tmp > max) max = tmp;
9769         }
9770         for (i = 0; max; i++)
9771                 max /= 2;
9772         printf("%d\n",i);
9773 }
9774 EOCP
9775         set try
9776         if eval $compile_ok; then
9777                 dflt=`./try$_exe`
9778         else
9779                 dflt='?'
9780                 echo "(I can't seem to compile the test program...)"
9781         fi
9782         ;;
9783 *)
9784         dflt="$randbits"
9785         ;;
9786 esac
9787 rp='How many bits does your rand() function produce?'
9788 . ./myread
9789 randbits="$ans"
9790 $rm -f try.* try
9791
9792 : see if ar generates random libraries by itself
9793 echo " "
9794 echo "Checking how to generate random libraries on your machine..." >&4
9795 echo 'int bar1() { return bar2(); }' > bar1.c
9796 echo 'int bar2() { return 2; }' > bar2.c
9797 $cat > foo.c <<'EOP'
9798 main() { printf("%d\n", bar1()); exit(0); }
9799 EOP
9800 $cc $ccflags -c bar1.c >/dev/null 2>&1
9801 $cc $ccflags -c bar2.c >/dev/null 2>&1
9802 $cc $ccflags -c foo.c >/dev/null 2>&1
9803 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
9804 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
9805         ./foobar >/dev/null 2>&1; then
9806         echo "$ar appears to generate random libraries itself."
9807         orderlib=false
9808         ranlib=":"
9809 elif $ar ts bar$_a >/dev/null 2>&1 &&
9810         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
9811         ./foobar >/dev/null 2>&1; then
9812                 echo "a table of contents needs to be added with '$ar ts'."
9813                 orderlib=false
9814                 ranlib="$ar ts"
9815 else
9816         case "$ranlib" in
9817         :) ranlib='';;
9818         '')
9819                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
9820                 $test -f $ranlib || ranlib=''
9821                 ;;
9822         esac
9823         if $test -n "$ranlib"; then
9824                 echo "your system has '$ranlib'; we'll use that."
9825                 orderlib=false
9826         else
9827                 echo "your system doesn't seem to support random libraries"
9828                 echo "so we'll use lorder and tsort to order the libraries."
9829                 orderlib=true
9830                 ranlib=":"
9831         fi
9832 fi
9833 $rm -f foo* bar* 
9834
9835 : see if sys/select.h has to be included
9836 set sys/select.h i_sysselct
9837 eval $inhdr
9838
9839 : see if we should include time.h, sys/time.h, or both
9840 echo " "
9841 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9842 $echo $n "I'm now running the test program...$c"
9843 $cat >try.c <<'EOCP'
9844 #include <sys/types.h>
9845 #ifdef I_TIME
9846 #include <time.h>
9847 #endif
9848 #ifdef I_SYSTIME
9849 #ifdef SYSTIMEKERNEL
9850 #define KERNEL
9851 #endif
9852 #include <sys/time.h>
9853 #endif
9854 #ifdef I_SYSSELECT
9855 #include <sys/select.h>
9856 #endif
9857 main()
9858 {
9859         struct tm foo;
9860 #ifdef S_TIMEVAL
9861         struct timeval bar;
9862 #endif
9863 #ifdef S_TIMEZONE
9864         struct timezone tzp;
9865 #endif
9866         if (foo.tm_sec == foo.tm_sec)
9867                 exit(0);
9868 #ifdef S_TIMEVAL
9869         if (bar.tv_sec == bar.tv_sec)
9870                 exit(0);
9871 #endif
9872         exit(1);
9873 }
9874 EOCP
9875 flags=''
9876 for s_timezone in '-DS_TIMEZONE' ''; do
9877 sysselect=''
9878 for s_timeval in '-DS_TIMEVAL' ''; do
9879 for i_systimek in '' '-DSYSTIMEKERNEL'; do
9880 for i_time in '' '-DI_TIME'; do
9881 for i_systime in '-DI_SYSTIME' ''; do
9882         case "$flags" in
9883         '') $echo $n ".$c"
9884                 set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9885                 if eval $compile; then
9886                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9887                         shift
9888                         flags="$*"
9889                         echo " "
9890                         $echo $n "Succeeded with $flags$c"
9891                 fi
9892                 ;;
9893         esac
9894 done
9895 done
9896 done
9897 done
9898 done
9899 timeincl=''
9900 echo " "
9901 case "$flags" in
9902 *SYSTIMEKERNEL*) i_systimek="$define"
9903         timeincl=`./findhdr sys/time.h`
9904         echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9905 *) i_systimek="$undef";;
9906 esac
9907 case "$flags" in
9908 *I_TIME*) i_time="$define"
9909         timeincl=`./findhdr time.h`" $timeincl"
9910         echo "We'll include <time.h>." >&4;;
9911 *) i_time="$undef";;
9912 esac
9913 case "$flags" in
9914 *I_SYSTIME*) i_systime="$define"
9915         timeincl=`./findhdr sys/time.h`" $timeincl"
9916         echo "We'll include <sys/time.h>." >&4;;
9917 *) i_systime="$undef";;
9918 esac
9919 $rm -f try.c try
9920
9921 : check for fd_set items
9922 $cat <<EOM
9923
9924 Checking to see how well your C compiler handles fd_set and friends ...
9925 EOM
9926 $cat >fd_set.c <<EOCP
9927 #$i_systime I_SYS_TIME
9928 #$i_sysselct I_SYS_SELECT
9929 #$d_socket HAS_SOCKET
9930 #include <sys/types.h>
9931 #ifdef HAS_SOCKET
9932 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
9933 #endif
9934 #ifdef I_SYS_TIME
9935 #include <sys/time.h>
9936 #endif
9937 #ifdef I_SYS_SELECT
9938 #include <sys/select.h>
9939 #endif
9940 main() {
9941         fd_set fds;
9942
9943 #ifdef TRYBITS
9944         if(fds.fds_bits);
9945 #endif
9946
9947 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
9948         exit(0);
9949 #else
9950         exit(1);
9951 #endif
9952 }
9953 EOCP
9954 set fd_set -DTRYBITS
9955 if eval $compile; then
9956         d_fds_bits="$define"
9957         d_fd_set="$define"
9958         echo "Well, your system knows about the normal fd_set typedef..." >&4
9959         if ./fd_set; then
9960                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
9961                 d_fd_macros="$define"
9962         else
9963                 $cat >&4 <<'EOM'
9964 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
9965 EOM
9966                 d_fd_macros="$undef"
9967         fi
9968 else
9969         $cat <<'EOM'
9970 Hmm, your compiler has some difficulty with fd_set.  Checking further...
9971 EOM
9972         set fd_set
9973         if eval $compile; then
9974                 d_fds_bits="$undef"
9975                 d_fd_set="$define"
9976                 echo "Well, your system has some sort of fd_set available..." >&4
9977                 if ./fd_set; then
9978                         echo "and you have the normal fd_set macros." >&4
9979                         d_fd_macros="$define"
9980                 else
9981                         $cat <<'EOM'
9982 but not the normal fd_set macros!  Gross!  More work for me...
9983 EOM
9984                         d_fd_macros="$undef"
9985                 fi
9986         else
9987         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
9988                 d_fd_set="$undef"
9989                 d_fds_bits="$undef"
9990                 d_fd_macros="$undef"
9991         fi
9992 fi
9993 $rm -f fd_set*
9994
9995 : check for type of arguments to select. 
9996 case "$selecttype" in
9997 '') case "$d_select" in
9998         $define)
9999                 $cat <<EOM
10000 Checking to see what type of arguments are accepted by select().
10001 EOM
10002                 hdrs="$define sys/types.h
10003                         $i_systime sys/time.h 
10004                         $i_sysselct sys/select.h
10005                         $d_socket sys/socket.h"
10006                 : The first arg can be int, unsigned, or size_t
10007                 : The last arg may or may not be 'const'
10008                 val=''
10009                 for xxx in 'fd_set *' 'int *'; do
10010                         for nfd in 'int' 'size_t' 'unsigned' ; do
10011                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
10012                                         case "$val" in
10013                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
10014                                                 if ./protochk "$try" $hdrs; then
10015                                                         echo "Your system accepts $xxx."
10016                                                         val="$xxx"
10017                                                 fi
10018                                                 ;;
10019                                         esac
10020                                 done
10021                         done
10022                 done
10023                 case "$val" in
10024                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
10025                         case "$d_fd_set" in
10026                                 $define) dflt="fd_set *" ;;
10027                                 *)              dflt="int *" ;;
10028                         esac
10029                         . ./myread
10030                         val=$ans
10031                         ;;
10032                 esac
10033                 selecttype="$val"
10034                 ;;
10035         *)      : no select, so pick a harmless default
10036                 selecttype='int *'
10037                 ;;
10038         esac
10039         ;;
10040 esac
10041
10042 : Trace out the files included by signal.h, then look for SIGxxx names.
10043 : Remove SIGARRAYSIZE used by HPUX.
10044 : Remove SIGTYP void lines used by OS2.
10045 xxx=`echo '#include <signal.h>' |
10046         $cppstdin $cppminus $cppflags 2>/dev/null |
10047         $grep '^[       ]*#.*include' | 
10048         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
10049 : Check this list of files to be sure we have parsed the cpp output ok.
10050 : This will also avoid potentially non-existent files, such 
10051 : as ../foo/bar.h
10052 xxxfiles=''
10053 for xx in $xxx /dev/null ; do
10054         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
10055 done
10056 : If we have found no files, at least try signal.h
10057 case "$xxxfiles" in
10058 '')     xxxfiles=`./findhdr signal.h` ;;
10059 esac
10060 xxx=`awk '
10061 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $3 !~ /void/ {
10062         print substr($2, 4, 20)
10063 }
10064 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
10065         print substr($3, 4, 20)
10066 }' $xxxfiles`
10067 : Append some common names just in case the awk scan failed.
10068 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
10069 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
10070 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
10071 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
10072 : generate a few handy files for later
10073 $cat > signal.c <<'EOCP'
10074 #include <sys/types.h>
10075 #include <signal.h>
10076 #include <stdio.h>
10077 int main() {
10078
10079 /* Strange style to avoid deeply-nested #if/#else/#endif */
10080 #ifndef NSIG
10081 #  ifdef _NSIG
10082 #    define NSIG (_NSIG)
10083 #  endif
10084 #endif
10085
10086 #ifndef NSIG
10087 #  ifdef SIGMAX
10088 #    define NSIG (SIGMAX+1)
10089 #  endif
10090 #endif
10091
10092 #ifndef NSIG
10093 #  ifdef SIG_MAX
10094 #    define NSIG (SIG_MAX+1)
10095 #  endif
10096 #endif
10097
10098 #ifndef NSIG
10099 #  ifdef MAXSIG
10100 #    define NSIG (MAXSIG+1)
10101 #  endif
10102 #endif
10103
10104 #ifndef NSIG
10105 #  ifdef MAX_SIG
10106 #    define NSIG (MAX_SIG+1)
10107 #  endif
10108 #endif
10109
10110 #ifndef NSIG
10111 #  ifdef SIGARRAYSIZE
10112 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
10113 #  endif
10114 #endif
10115
10116 #ifndef NSIG
10117 #  ifdef _sys_nsig
10118 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
10119 #  endif
10120 #endif
10121
10122 /* Default to some arbitrary number that's big enough to get most
10123    of the common signals.
10124 */
10125 #ifndef NSIG
10126 #    define NSIG 50
10127 #endif
10128
10129 printf("NSIG %d\n", NSIG);
10130
10131 #ifndef JUST_NSIG
10132
10133 EOCP
10134
10135 echo $xxx | $tr ' ' '\012' | $sort | $uniq | $awk '
10136 {
10137         printf "#ifdef SIG"; printf $1; printf "\n"
10138         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
10139         printf $1; printf ");\n"
10140         printf "#endif\n"
10141 }
10142 END {
10143         printf "#endif /* JUST_NSIG */\n";
10144         printf "}\n";
10145 }
10146 ' >>signal.c
10147 $cat >signal.awk <<'EOP'
10148 BEGIN { ndups = 0 }
10149 $1 ~ /^NSIG$/ { nsig = $2 }
10150 ($1 !~ /^NSIG$/) && (NF == 2) {
10151     if ($2 > maxsig) { maxsig = $2 }
10152     if (sig_name[$2]) {
10153         dup_name[ndups] = $1
10154         dup_num[ndups] = $2
10155         ndups++ 
10156     }
10157     else {
10158         sig_name[$2] = $1
10159         sig_num[$2] = $2
10160     }
10161
10162 }
10163 END { 
10164     if (nsig == 0) { nsig = maxsig + 1 }
10165         for (n = 1; n < nsig; n++) {
10166                 if (sig_name[n]) {
10167                         printf("%s %d\n", sig_name[n], sig_num[n])
10168                 }
10169                 else {
10170                         printf("NUM%d %d\n", n, n) 
10171                 }
10172         }
10173     for (n = 0; n < ndups; n++) {
10174                 printf("%s %d\n", dup_name[n], dup_num[n])
10175     }
10176 }
10177 EOP
10178 $cat >signal_cmd <<EOS
10179 $startsh
10180 if $test -s signal.lst; then
10181     echo "Using your existing signal.lst file"
10182         exit 0
10183 fi
10184 xxx="$xxx"
10185 EOS
10186 $cat >>signal_cmd <<'EOS'
10187
10188 set signal
10189 if eval $compile_ok; then
10190         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
10191 else
10192         echo "(I can't seem be able to compile the whole test program)" >&4
10193         echo "(I'll try it in little pieces.)" >&4
10194         set signal -DJUST_NSIG
10195         if eval $compile_ok; then
10196                 ./signal$_exe > signal.nsg
10197                 $cat signal.nsg
10198         else
10199                 echo "I can't seem to figure out how many signals you have." >&4
10200                 echo "Guessing 50." >&4
10201                 echo 'NSIG 50' > signal.nsg
10202         fi
10203         : Now look at all the signal names, one at a time.
10204         for xx in `echo $xxx | $tr ' ' '\012' | $sort | $uniq`; do
10205                 $cat > signal.c <<EOCP
10206 #include <sys/types.h>
10207 #include <signal.h>
10208 #include <stdio.h>
10209 int main() {
10210 printf("$xx %d\n", SIG${xx});
10211 return 0;
10212 }
10213 EOCP
10214                 set signal
10215                 if eval $compile; then
10216                         echo "SIG${xx} found."
10217                         ./signal$_exe  >> signal.ls1
10218                 else
10219                         echo "SIG${xx} NOT found."
10220                 fi
10221         done
10222         if $test -s signal.ls1; then
10223                 $cat signal.nsg signal.ls1 |
10224                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
10225         fi
10226
10227 fi
10228 if $test -s signal.lst; then
10229         :
10230 else
10231         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
10232         echo 'kill -l' >signal
10233         set X `csh -f <signal`
10234         $rm -f signal
10235         shift
10236         case $# in
10237         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
10238         esac
10239         echo $@ | $tr ' ' '\012' | \
10240                 $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst
10241 fi
10242 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
10243 EOS
10244 chmod a+x signal_cmd
10245 $eunicefix signal_cmd
10246
10247 : generate list of signal names
10248 echo " "
10249 case "$sig_name_init" in
10250 '')
10251         echo "Generating a list of signal names and numbers..." >&4
10252         . ./signal_cmd
10253         sig_name=`$awk '{printf "%s ", $1}' signal.lst`
10254         sig_name="ZERO $sig_name"
10255         sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
10256                                                 { printf "\"%s\", ", $1 }
10257                                                 END { printf "0\n" }' signal.lst`
10258         sig_num=`$awk 'BEGIN { printf "0, " }
10259                                         { printf "%d, ", $2}
10260                                         END { printf "0\n"}' signal.lst`
10261         ;;
10262 esac
10263 echo "The following signals are available:"
10264 echo " "
10265 echo $sig_name | $awk \
10266 'BEGIN { linelen = 0 }
10267 {
10268         for (i = 1; i <= NF; i++) {
10269                 name = "SIG" $i " "
10270                 linelen = linelen + length(name)
10271                 if (linelen > 70) {
10272                         printf "\n"
10273                         linelen = length(name)
10274                 }
10275                 printf "%s", name
10276         }
10277         printf "\n"
10278 }'
10279 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
10280
10281 : see what type is used for signed size_t
10282 set ssize_t ssizetype int stdio.h sys/types.h
10283 eval $typedef
10284 dflt="$ssizetype"
10285 $cat > ssize.c <<EOM
10286 #include <stdio.h>
10287 #include <sys/types.h>
10288 #define Size_t $sizetype
10289 #define SSize_t $dflt
10290 main()
10291 {
10292         if (sizeof(Size_t) == sizeof(SSize_t))
10293                 printf("$dflt\n");
10294         else if (sizeof(Size_t) == sizeof(int))
10295                 printf("int\n");
10296         else 
10297                 printf("long\n");
10298         exit(0);
10299 }
10300 EOM
10301 echo " "
10302 set ssize
10303 if eval $compile_ok && ./ssize > /dev/null; then
10304         ssizetype=`./ssize`
10305         echo "I'll be using $ssizetype for functions returning a byte count." >&4
10306 else
10307         $cat >&4 <<EOM
10308 Help! I can't compile and run the ssize_t test program: please enlighten me!
10309 (This is probably a misconfiguration in your system or libraries, and
10310 you really ought to fix it.  Still, I'll try anyway.)
10311
10312 I need a type that is the same size as $sizetype, but is guaranteed to
10313 be signed.  Common values are ssize_t, int and long.
10314
10315 EOM
10316         rp="What signed type is the same size as $sizetype?"
10317         . ./myread
10318         ssizetype="$ans"
10319 fi
10320 $rm -f ssize ssize.*
10321
10322 : see what type of char stdio uses.
10323 echo " "
10324 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
10325         echo "Your stdio uses unsigned chars." >&4
10326         stdchar="unsigned char"
10327 else
10328         echo "Your stdio uses signed chars." >&4
10329         stdchar="char"
10330 fi
10331
10332 : see if time exists
10333 echo " "
10334 if set time val -f d_time; eval $csym; $val; then
10335         echo 'time() found.' >&4
10336         val="$define"
10337         rp="What is the type returned by time() on this system?"
10338         set time_t timetype long stdio.h sys/types.h
10339         eval $typedef_ask
10340 else
10341         echo 'time() not found, hope that will do.' >&4
10342         val="$undef"
10343         timetype='int';
10344 fi
10345 set d_time
10346 eval $setvar
10347
10348 : see what type uids are declared as in the kernel
10349 echo " "
10350 echo "Looking for the type for user ids returned by getuid()."
10351 set uid_t uidtype xxx stdio.h sys/types.h
10352 eval $typedef
10353 case "$uidtype" in
10354 xxx)
10355         xxx=`./findhdr sys/user.h`
10356         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
10357         case $1 in
10358         unsigned) dflt="$1 $2" ;;
10359         *) dflt="$1" ;;
10360         esac
10361         ;;
10362 *) dflt="$uidtype";;
10363 esac
10364 case "$uidtype" in
10365 uid_t)  echo "uid_t found." ;;
10366 *)      rp="What is the type for user ids returned by getuid()?"
10367         . ./myread
10368         uidtype="$ans"
10369         ;;
10370 esac
10371
10372 : see if dbm.h is available
10373 : see if dbmclose exists
10374 set dbmclose d_dbmclose
10375 eval $inlibc
10376
10377 case "$d_dbmclose" in
10378 $define)
10379         set dbm.h i_dbm
10380         eval $inhdr
10381         case "$i_dbm" in
10382         $define)
10383                 val="$undef"
10384                 set i_rpcsvcdbm
10385                 eval $setvar
10386                 ;;
10387         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10388                 eval $inhdr
10389                 ;;
10390         esac
10391         ;;
10392 *)      echo "We won't be including <dbm.h>"
10393         val="$undef"
10394         set i_dbm
10395         eval $setvar
10396         val="$undef"
10397         set i_rpcsvcdbm
10398         eval $setvar
10399         ;;
10400 esac
10401
10402 : see if this is a sys/file.h system
10403 val=''
10404 set sys/file.h val
10405 eval $inhdr
10406
10407 : do we need to include sys/file.h ?
10408 case "$val" in
10409 "$define")
10410         echo " "
10411         if $h_sysfile; then
10412                 val="$define"
10413                 echo "We'll be including <sys/file.h>." >&4
10414         else
10415                 val="$undef"
10416                 echo "We won't be including <sys/file.h>." >&4
10417         fi
10418         ;;
10419 *)
10420         h_sysfile=false
10421         ;;
10422 esac
10423 set i_sysfile
10424 eval $setvar
10425
10426 : see if fcntl.h is there
10427 val=''
10428 set fcntl.h val
10429 eval $inhdr
10430
10431 : see if we can include fcntl.h
10432 case "$val" in
10433 "$define")
10434         echo " "
10435         if $h_fcntl; then
10436                 val="$define"
10437                 echo "We'll be including <fcntl.h>." >&4
10438         else
10439                 val="$undef"
10440                 if $h_sysfile; then
10441         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
10442                 else
10443                         echo "We won't be including <fcntl.h>." >&4
10444                 fi
10445         fi
10446         ;;
10447 *)
10448         h_fcntl=false
10449         val="$undef"
10450         ;;
10451 esac
10452 set i_fcntl
10453 eval $setvar
10454
10455 : see if this is an grp system
10456 set grp.h i_grp
10457 eval $inhdr
10458
10459 : see if locale.h is available
10460 set locale.h i_locale
10461 eval $inhdr
10462
10463 : see if this is a math.h system
10464 set math.h i_math
10465 eval $inhdr
10466
10467 : see if ndbm.h is available
10468 set ndbm.h t_ndbm
10469 eval $inhdr
10470 case "$t_ndbm" in
10471 $define)
10472         : see if dbm_open exists
10473         set dbm_open d_dbm_open
10474         eval $inlibc
10475         case "$d_dbm_open" in
10476         $undef)
10477                 t_ndbm="$undef"
10478                 echo "We won't be including <ndbm.h>"
10479                 ;;
10480         esac
10481         ;;
10482 esac
10483 val="$t_ndbm"
10484 set i_ndbm
10485 eval $setvar
10486
10487 : see if net/errno.h is available
10488 val=''
10489 set net/errno.h val
10490 eval $inhdr
10491
10492 : Unfortunately, it causes problems on some systems.  Arrgh.
10493 case "$val" in
10494 $define)
10495         cat > try.c <<'EOM'
10496 #include <stdio.h>
10497 #include <errno.h>
10498 #include <net/errno.h>
10499 int func()
10500 {
10501         return ENOTSOCK;
10502 }
10503 EOM
10504         if $cc $ccflags -c try.c >/dev/null 2>&1; then
10505                 echo "We'll be including <net/errno.h>." >&4
10506         else
10507                 echo "We won't be including <net/errno.h>." >&4
10508                 val="$undef"
10509         fi
10510         $rm -f try.* try
10511         ;;
10512 esac
10513 set i_neterrno
10514 eval $setvar
10515
10516 : get C preprocessor symbols handy
10517 echo " "
10518 $echo $n "Hmm... $c"
10519 echo $al | $tr ' ' '\012' >Cppsym.know
10520 $cat <<EOSS >Cppsym
10521 $startsh
10522 case "\$1" in
10523 -l) list=true
10524         shift
10525         ;;
10526 esac
10527 unknown=''
10528 case "\$list\$#" in
10529 1|2)
10530         for sym do
10531                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
10532                         exit 0
10533                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
10534                         :
10535                 else
10536                         unknown="\$unknown \$sym"
10537                 fi
10538         done
10539         set X \$unknown
10540         shift
10541         ;;
10542 esac
10543 case \$# in
10544 0) exit 1;;
10545 esac
10546 echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\
10547 #ifdef \1\\
10548 exit 0; _ _ _ _\1\\      \1\\
10549 #endif\\
10550 /' >Cppsym\$\$
10551 echo "exit 1; _ _ _" >>Cppsym\$\$
10552 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
10553 case "\$list" in
10554 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
10555 *)
10556         sh Cppsym2\$\$
10557         status=\$?
10558         ;;
10559 esac
10560 $rm -f Cppsym\$\$ Cppsym2\$\$
10561 exit \$status
10562 EOSS
10563 chmod +x Cppsym
10564 $eunicefix Cppsym
10565 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
10566
10567 : now check the C compiler for additional symbols
10568 $cat >ccsym <<EOS
10569 $startsh
10570 $cat >tmp.c <<EOF
10571 extern int foo;
10572 EOF
10573 for i in \`$cc -v -c tmp.c 2>&1\`
10574 do
10575         case "\$i" in
10576         -D*) echo "\$i" | $sed 's/^-D//';;
10577         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
10578         esac
10579 done
10580 $rm -f try.c
10581 EOS
10582 chmod +x ccsym
10583 $eunicefix ccsym
10584 ./ccsym | $sort | $uniq >ccsym.raw
10585 $awk '/\=/ { print $0; next }
10586         { print $0"=1" }' ccsym.raw >ccsym.list
10587 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
10588 $comm -13 ccsym.true ccsym.list >ccsym.own
10589 $comm -12 ccsym.true ccsym.list >ccsym.com
10590 $comm -23 ccsym.true ccsym.list >ccsym.cpp
10591 also=''
10592 symbols='symbols'
10593 if $test -z ccsym.raw; then
10594         echo "Your C compiler doesn't seem to define any symbol!" >&4
10595         echo " "
10596         echo "However, your C preprocessor defines the following ones:"
10597         $cat Cppsym.true
10598 else
10599         if $test -s ccsym.com; then
10600                 echo "Your C compiler and pre-processor define these symbols:"
10601                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
10602                 also='also '
10603                 symbols='ones'
10604                 $test "$silent" || sleep 1
10605         fi
10606         if $test -s ccsym.cpp; then
10607                 $test "$also" && echo " "
10608                 echo "Your C pre-processor ${also}defines the following $symbols:"
10609                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
10610                 also='further '
10611                 $test "$silent" || sleep 1
10612         fi
10613         if $test -s ccsym.own; then
10614                 $test "$also" && echo " "
10615                 echo "Your C compiler ${also}defines the following cpp variables:"
10616                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
10617                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
10618                 $test "$silent" || sleep 1
10619         fi
10620 fi
10621 $rm -f ccsym*
10622
10623 : see if this is a termio system
10624 val="$undef"
10625 val2="$undef"
10626 val3="$undef"
10627 if $test `./findhdr termios.h`; then
10628         set tcsetattr i_termios
10629         eval $inlibc
10630         val3="$i_termios"
10631 fi
10632 echo " "
10633 case "$val3" in
10634 "$define") echo "You have POSIX termios.h... good!" >&4;;
10635 *) if ./Cppsym pyr; then
10636                 case "`/bin/universe`" in
10637                 ucb) if $test `./findhdr sgtty.h`; then
10638                                 val2="$define"
10639                                 echo "<sgtty.h> found." >&4
10640                         else
10641                                 echo "System is pyramid with BSD universe."
10642                                 echo "<sgtty.h> not found--you could have problems." >&4
10643                         fi;;
10644                 *) if $test `./findhdr termio.h`; then
10645                                 val="$define"
10646                                 echo "<termio.h> found." >&4
10647                         else
10648                                 echo "System is pyramid with USG universe."
10649                                 echo "<termio.h> not found--you could have problems." >&4
10650                         fi;;
10651                 esac
10652         elif ./usg; then
10653                 if $test `./findhdr termio.h`; then
10654                         echo "<termio.h> found." >&4
10655                         val="$define"
10656                 elif $test `./findhdr sgtty.h`; then
10657                         echo "<sgtty.h> found." >&4
10658                         val2="$define"
10659                 else
10660 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
10661                 fi
10662         else
10663                 if $test `./findhdr sgtty.h`; then
10664                         echo "<sgtty.h> found." >&4
10665                         val2="$define"
10666                 elif $test `./findhdr termio.h`; then
10667                         echo "<termio.h> found." >&4
10668                         val="$define"
10669                 else
10670 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
10671                 fi
10672         fi;;
10673 esac
10674 set i_termio; eval $setvar
10675 val=$val2; set i_sgtty; eval $setvar
10676 val=$val3; set i_termios; eval $setvar
10677
10678 : see if stdarg is available
10679 echo " "
10680 if $test `./findhdr stdarg.h`; then
10681         echo "<stdarg.h> found." >&4
10682         valstd="$define"
10683 else
10684         echo "<stdarg.h> NOT found." >&4
10685         valstd="$undef"
10686 fi
10687
10688 : see if varags is available
10689 echo " "
10690 if $test `./findhdr varargs.h`; then
10691         echo "<varargs.h> found." >&4
10692 else
10693         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10694 fi
10695
10696 : set up the varargs testing programs
10697 $cat > varargs.c <<EOP
10698 #ifdef I_STDARG
10699 #include <stdarg.h>
10700 #endif
10701 #ifdef I_VARARGS
10702 #include <varargs.h>
10703 #endif
10704
10705 #ifdef I_STDARG
10706 int f(char *p, ...)
10707 #else
10708 int f(va_alist)
10709 va_dcl
10710 #endif
10711 {
10712         va_list ap;
10713 #ifndef I_STDARG
10714         char *p;
10715 #endif
10716 #ifdef I_STDARG
10717         va_start(ap,p);
10718 #else
10719         va_start(ap);
10720         p = va_arg(ap, char *);
10721 #endif
10722         va_end(ap);
10723 }
10724 EOP
10725 $cat > varargs <<EOP
10726 $startsh
10727 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10728         echo "true"
10729 else
10730         echo "false"
10731 fi
10732 $rm -f varargs$_o
10733 EOP
10734 chmod +x varargs
10735
10736 : now check which varargs header should be included
10737 echo " "
10738 i_varhdr=''
10739 case "$valstd" in
10740 "$define")
10741         if `./varargs I_STDARG`; then
10742                 val='stdarg.h'
10743         elif `./varargs I_VARARGS`; then
10744                 val='varargs.h'
10745         fi
10746         ;;
10747 *)
10748         if `./varargs I_VARARGS`; then
10749                 val='varargs.h'
10750         fi
10751         ;;
10752 esac
10753 case "$val" in
10754 '')
10755 echo "I could not find the definition for va_dcl... You have problems..." >&4
10756         val="$undef"; set i_stdarg; eval $setvar
10757         val="$undef"; set i_varargs; eval $setvar
10758         ;;
10759 *) 
10760         set i_varhdr
10761         eval $setvar
10762         case "$i_varhdr" in
10763         stdarg.h)
10764                 val="$define"; set i_stdarg; eval $setvar
10765                 val="$undef"; set i_varargs; eval $setvar
10766                 ;;
10767         varargs.h)
10768                 val="$undef"; set i_stdarg; eval $setvar
10769                 val="$define"; set i_varargs; eval $setvar
10770                 ;;
10771         esac
10772         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10773 esac
10774 $rm -f varargs*
10775
10776 : see if stddef is available
10777 set stddef.h i_stddef
10778 eval $inhdr
10779
10780 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
10781 set sys/filio.h i_sysfilio
10782 eval $inhdr
10783 echo " "
10784 if $test `./findhdr sys/ioctl.h`; then
10785         val="$define"
10786         echo '<sys/ioctl.h> found.' >&4
10787 else
10788         val="$undef"
10789         if $test $i_sysfilio = "$define"; then
10790             echo '<sys/ioctl.h> NOT found.' >&4
10791         else
10792                 $test $i_sgtty = "$define" && xxx="sgtty.h"
10793                 $test $i_termio = "$define" && xxx="termio.h"
10794                 $test $i_termios = "$define" && xxx="termios.h"
10795 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
10796         fi
10797 fi
10798 set i_sysioctl
10799 eval $setvar
10800
10801 : see if this is a sys/param system
10802 set sys/param.h i_sysparam
10803 eval $inhdr
10804
10805 : see if sys/resource.h has to be included
10806 set sys/resource.h i_sysresrc
10807 eval $inhdr
10808
10809 : see if sys/stat.h is available
10810 set sys/stat.h i_sysstat
10811 eval $inhdr
10812
10813 : see if sys/types.h has to be included
10814 set sys/types.h i_systypes
10815 eval $inhdr
10816
10817 : see if this is a sys/un.h system
10818 set sys/un.h i_sysun
10819 eval $inhdr
10820
10821 : see if this is a syswait system
10822 set sys/wait.h i_syswait
10823 eval $inhdr
10824
10825 : see if this is an utime system
10826 set utime.h i_utime
10827 eval $inhdr
10828
10829 : see if this is a values.h system
10830 set values.h i_values
10831 eval $inhdr
10832
10833 : see if this is a vfork system
10834 case "$d_vfork" in
10835 "$define")
10836         set vfork.h i_vfork
10837         eval $inhdr
10838         ;;
10839 *)
10840         i_vfork="$undef"
10841         ;;
10842 esac
10843
10844 : see if gdbm.h is available
10845 set gdbm.h t_gdbm
10846 eval $inhdr
10847 case "$t_gdbm" in
10848 $define)
10849         : see if gdbm_open exists
10850         set gdbm_open d_gdbm_open
10851         eval $inlibc
10852         case "$d_gdbm_open" in
10853         $undef)
10854                 t_gdbm="$undef"
10855                 echo "We won't be including <gdbm.h>"
10856                 ;;
10857         esac
10858         ;;
10859 esac
10860 val="$t_gdbm"
10861 set i_gdbm
10862 eval $setvar
10863
10864 echo " "
10865 echo "Looking for extensions..." >&4
10866 tdir=`pwd`
10867 cd $rsrc/ext
10868 : If we are using the old config.sh, known_extensions may contain
10869 : old or inaccurate or duplicate values.
10870 known_extensions=''
10871 nonxs_extensions=''
10872 : We do not use find because it might not be available.
10873 : We do not just use MANIFEST because the user may have dropped
10874 : some additional extensions into the source tree and expect them
10875 : to be built.
10876 for xxx in * ; do
10877         case "$xxx" in
10878         DynaLoader) ;;
10879         *)      if $test -f $xxx/$xxx.xs; then
10880                         known_extensions="$known_extensions $xxx"
10881                 else
10882                         if $test -d $xxx; then
10883                                 cd $xxx
10884                                 zzz=$known_extensions
10885                                 for yyy in * ; do
10886                                 if $test -f $yyy/$yyy.xs; then
10887                                         known_extensions="$known_extensions $xxx/$yyy"
10888                                 fi
10889                                 done
10890                                 cd ..
10891                                 if $test "$zzz" = "$known_extensions"; then
10892                                         if $test -f $xxx/Makefile.PL; then
10893                                                 known_extensions="$known_extensions $xxx"
10894                                                 nonxs_extensions="$nonxs_extensions $xxx"
10895                                         fi
10896                                 fi
10897                         fi
10898                 fi 
10899                 ;;
10900         esac
10901 done
10902 set X $nonxs_extensions
10903 shift
10904 nonxs_extensions="$*"
10905 set X $known_extensions
10906 shift
10907 known_extensions="$*"
10908 cd $tdir
10909
10910 : Now see which are supported on this system.
10911 avail_ext=''
10912 for xxx in $known_extensions ; do
10913         case "$xxx" in
10914         DB_File|db_file)
10915                 case "$i_db" in
10916                 $define) avail_ext="$avail_ext $xxx" ;;
10917                 esac
10918                 ;;
10919         GDBM_File|gdbm_fil)
10920                 case "$i_gdbm" in 
10921                 $define) avail_ext="$avail_ext $xxx" ;;
10922                 esac
10923                 ;;
10924         NDBM_File|ndbm_fil)
10925                 case "$i_ndbm" in
10926                 $define) avail_ext="$avail_ext $xxx" ;;
10927                 esac
10928                 ;;
10929         ODBM_File|odbm_fil) 
10930                 case "${i_dbm}${i_rpcsvcdbm}" in
10931                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
10932                 esac
10933                 ;;
10934         POSIX|posix)
10935                 case "$useposix" in
10936                 true|define|y) avail_ext="$avail_ext $xxx" ;;
10937                 esac
10938                 ;;
10939         Opcode|opcode)
10940                 case "$useopcode" in
10941                 true|define|y) avail_ext="$avail_ext $xxx" ;;
10942                 esac
10943                 ;;
10944         Socket|socket)
10945                 case "$d_socket" in 
10946                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
10947                 esac
10948                 ;;
10949         Thread|thread)
10950                 case "$usethreads" in 
10951                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
10952                 esac
10953                 ;;
10954         *)
10955                 case " $nonxs_extensions " in
10956                 *" $xxx "*) ;;
10957                 *) avail_ext="$avail_ext $xxx" ;;
10958                 esac
10959                 ;;
10960         esac
10961 done
10962
10963 set X $avail_ext
10964 shift
10965 avail_ext="$*"
10966
10967 : Now see which nonxs extensions are supported on this system.
10968 nonxs_ext=''
10969 for xxx in $nonxs_extensions ; do
10970         case "$xxx" in
10971         *)      nonxs_ext="$nonxs_ext $xxx"
10972                 ;;
10973         esac
10974 done
10975
10976 set X $nonxs_ext
10977 shift
10978 nonxs_ext="$*"
10979
10980 case $usedl in
10981 $define)
10982         $cat <<EOM
10983 A number of extensions are supplied with $package.  You may choose to
10984 compile these extensions for dynamic loading (the default), compile
10985 them into the $package executable (static loading), or not include
10986 them at all.  Answer "none" to include no extensions.
10987 Note that DynaLoader is always built and need not be mentioned here.
10988
10989 EOM
10990         case "$dynamic_ext" in
10991         '') dflt="$avail_ext" ;;
10992         *)      dflt="$dynamic_ext"
10993                 # Perhaps we are reusing an old out-of-date config.sh.
10994                 case "$hint" in
10995                 previous)
10996                         if test X"$dynamic_ext" != X"$avail_ext"; then
10997                                 $cat <<EOM
10998 NOTICE:  Your previous config.sh list may be incorrect. 
10999 The extensions now available to you are 
11000         ${avail_ext}
11001 but the default list from your previous config.sh is
11002         ${dynamic_ext} 
11003
11004 EOM
11005                         fi
11006                         ;;
11007                 esac
11008                 ;;
11009         esac
11010         : Exclude those that are not xs extensions
11011         case "$dflt" in
11012         '')     dflt=none;;
11013         esac
11014         rp="What extensions do you wish to load dynamically?"
11015         . ./myread
11016         case "$ans" in
11017         none) dynamic_ext=' ' ;;
11018         *) dynamic_ext="$ans" ;;
11019         esac
11020
11021         case "$static_ext" in
11022         '')
11023                 : Exclude those already listed in dynamic linking
11024                 dflt=''
11025                 for xxx in $avail_ext; do
11026                         case " $dynamic_ext $nonxs_ext " in
11027                         *" $xxx "*) ;;
11028                         *) dflt="$dflt $xxx" ;;
11029                         esac
11030                 done
11031                 set X $dflt
11032                 shift
11033                 dflt="$*"
11034                 ;;
11035         *)  dflt="$static_ext" 
11036                 ;;
11037         esac
11038
11039         case "$dflt" in
11040         '')     dflt=none;;
11041         esac
11042         rp="What extensions do you wish to load statically?"
11043         . ./myread
11044         case "$ans" in
11045         none) static_ext=' ' ;;
11046         *) static_ext="$ans" ;;
11047         esac
11048         ;;
11049 *)
11050         $cat <<EOM
11051 A number of extensions are supplied with $package.  Answer "none" 
11052 to include no extensions. 
11053 Note that DynaLoader is always built and need not be mentioned here.
11054
11055 EOM
11056         case "$static_ext" in
11057         '') dflt="$avail_ext" ;;
11058         *)      dflt="$static_ext"
11059                 # Perhaps we are reusing an old out-of-date config.sh.
11060                 case "$hint" in
11061                 previous)
11062                         if test X"$static_ext" != X"$avail_ext"; then
11063                                 $cat <<EOM
11064 NOTICE:  Your previous config.sh list may be incorrect. 
11065 The extensions now available to you are 
11066         ${avail_ext}
11067 but the default list from your previous config.sh is
11068         ${static_ext} 
11069
11070 EOM
11071                         fi
11072                         ;;
11073                 esac
11074                 ;;
11075         esac
11076         case "$dflt" in
11077         '')     dflt=none;;
11078         esac
11079         rp="What extensions do you wish to include?"
11080         . ./myread
11081         case "$ans" in
11082         none) static_ext=' ' ;;
11083         *) static_ext="$ans" ;;
11084         esac
11085         ;;
11086 esac
11087
11088 set X $dynamic_ext $static_ext
11089 shift
11090 extensions="$*"
11091
11092 : Remove build directory name from cppstdin so it can be used from
11093 : either the present location or the final installed location.
11094 echo " "
11095 : Get out of the UU directory to get correct path name.
11096 cd ..
11097 case "$cppstdin" in
11098 `pwd`/cppstdin)
11099         echo "Stripping down cppstdin path name"
11100         cppstdin=cppstdin
11101         ;;
11102 esac
11103 cd UU
11104
11105 : end of configuration questions
11106 echo " "
11107 echo "End of configuration questions."
11108 echo " "
11109
11110 : back to where it started
11111 if test -d ../UU; then
11112         cd ..
11113 fi
11114
11115 : configuration may be patched via a 'config.over' file
11116 if $test -f config.over; then
11117         echo " "
11118         dflt=y
11119         rp='I see a config.over file.  Do you wish to load it?'
11120         . UU/myread
11121         case "$ans" in
11122         n*) echo "OK, I'll ignore it.";;
11123         *)      . ./config.over
11124                 echo "Configuration override changes have been loaded."
11125                 ;;
11126         esac
11127 fi
11128
11129 : in case they want portability, strip down executable paths
11130 case "$d_portable" in
11131 "$define")
11132         echo " "
11133         echo "Stripping down executable paths..." >&4
11134         for file in $loclist $trylist; do
11135                 if test X$file != Xln -a X$file != Xar -o X$osname != Xos2; then
11136                         eval $file="\$file"
11137                 fi
11138         done
11139         ;;
11140 esac
11141
11142 : create config.sh file
11143 echo " "
11144 echo "Creating config.sh..." >&4
11145 $spitshell <<EOT >config.sh
11146 $startsh
11147 #
11148 # This file was produced by running the Configure script. It holds all the
11149 # definitions figured out by Configure. Should you modify one of these values,
11150 # do not forget to propagate your changes by running "Configure -der". You may
11151 # instead choose to run each of the .SH files by yourself, or "Configure -S".
11152 #
11153
11154 # Package name      : $package
11155 # Source directory  : $src
11156 # Configuration time: $cf_time
11157 # Configured by     : $cf_by
11158 # Target system     : $myuname
11159
11160 Author='$Author'
11161 Date='$Date'
11162 Header='$Header'
11163 Id='$Id'
11164 Locker='$Locker'
11165 Log='$Log'
11166 Mcc='$Mcc'
11167 RCSfile='$RCSfile'
11168 Revision='$Revision'
11169 Source='$Source'
11170 State='$State'
11171 _a='$_a'
11172 _exe='$_exe'
11173 _o='$_o'
11174 afs='$afs'
11175 alignbytes='$alignbytes'
11176 ansi2knr='$ansi2knr'
11177 aphostname='$aphostname'
11178 ar='$ar'
11179 archlib='$archlib'
11180 archlibexp='$archlibexp'
11181 archname='$archname'
11182 archobjs='$archobjs'
11183 awk='$awk'
11184 baserev='$baserev'
11185 bash='$bash'
11186 bin='$bin'
11187 binexp='$binexp'
11188 bison='$bison'
11189 byacc='$byacc'
11190 byteorder='$byteorder'
11191 c='$c'
11192 castflags='$castflags'
11193 cat='$cat'
11194 cc='$cc'
11195 cccdlflags='$cccdlflags'
11196 ccdlflags='$ccdlflags'
11197 ccflags='$ccflags'
11198 cf_by='$cf_by'
11199 cf_email='$cf_email'
11200 cf_time='$cf_time'
11201 chgrp='$chgrp'
11202 chmod='$chmod'
11203 chown='$chown'
11204 clocktype='$clocktype'
11205 comm='$comm'
11206 compress='$compress'
11207 contains='$contains'
11208 cp='$cp'
11209 cpio='$cpio'
11210 cpp='$cpp'
11211 cpp_stuff='$cpp_stuff'
11212 cppflags='$cppflags'
11213 cpplast='$cpplast'
11214 cppminus='$cppminus'
11215 cpprun='$cpprun'
11216 cppstdin='$cppstdin'
11217 cryptlib='$cryptlib'
11218 csh='$csh'
11219 d_Gconvert='$d_Gconvert'
11220 d_access='$d_access'
11221 d_alarm='$d_alarm'
11222 d_archlib='$d_archlib'
11223 d_attribut='$d_attribut'
11224 d_bcmp='$d_bcmp'
11225 d_bcopy='$d_bcopy'
11226 d_bsd='$d_bsd'
11227 d_bsdgetpgrp='$d_bsdgetpgrp'
11228 d_bsdsetpgrp='$d_bsdsetpgrp'
11229 d_bzero='$d_bzero'
11230 d_casti32='$d_casti32'
11231 d_castneg='$d_castneg'
11232 d_charvspr='$d_charvspr'
11233 d_chown='$d_chown'
11234 d_chroot='$d_chroot'
11235 d_chsize='$d_chsize'
11236 d_closedir='$d_closedir'
11237 d_const='$d_const'
11238 d_crypt='$d_crypt'
11239 d_csh='$d_csh'
11240 d_cuserid='$d_cuserid'
11241 d_dbl_dig='$d_dbl_dig'
11242 d_difftime='$d_difftime'
11243 d_dirnamlen='$d_dirnamlen'
11244 d_dlerror='$d_dlerror'
11245 d_dlopen='$d_dlopen'
11246 d_dlsymun='$d_dlsymun'
11247 d_dosuid='$d_dosuid'
11248 d_dup2='$d_dup2'
11249 d_endhent='$d_endhent'
11250 d_endnent='$d_endnent'
11251 d_endpent='$d_endpent'
11252 d_endsent='$d_endsent'
11253 d_eofnblk='$d_eofnblk'
11254 d_eunice='$d_eunice'
11255 d_fchmod='$d_fchmod'
11256 d_fchown='$d_fchown'
11257 d_fcntl='$d_fcntl'
11258 d_fd_macros='$d_fd_macros'
11259 d_fd_set='$d_fd_set'
11260 d_fds_bits='$d_fds_bits'
11261 d_fgetpos='$d_fgetpos'
11262 d_flexfnam='$d_flexfnam'
11263 d_flock='$d_flock'
11264 d_fork='$d_fork'
11265 d_fpathconf='$d_fpathconf'
11266 d_fsetpos='$d_fsetpos'
11267 d_ftime='$d_ftime'
11268 d_getgrps='$d_getgrps'
11269 d_gethbyaddr='$d_gethbyaddr'
11270 d_gethbyname='$d_gethbyname'
11271 d_gethent='$d_gethent'
11272 d_gethname='$d_gethname'
11273 d_gethostprotos='$d_gethostprotos'
11274 d_getlogin='$d_getlogin'
11275 d_getnbyaddr='$d_getnbyaddr'
11276 d_getnbyname='$d_getnbyname'
11277 d_getnent='$d_getnent'
11278 d_getnetprotos='$d_getnetprotos'
11279 d_getpbyname='$d_getpbyname'
11280 d_getpbynumber='$d_getpbynumber'
11281 d_getpent='$d_getpent'
11282 d_getpgid='$d_getpgid'
11283 d_getpgrp2='$d_getpgrp2'
11284 d_getpgrp='$d_getpgrp'
11285 d_getppid='$d_getppid'
11286 d_getprior='$d_getprior'
11287 d_getprotoprotos='$d_getprotoprotos'
11288 d_getsbyname='$d_getsbyname'
11289 d_getsbyport='$d_getsbyport'
11290 d_getsent='$d_getsent'
11291 d_getservprotos='$d_getservprotos'
11292 d_gettimeod='$d_gettimeod'
11293 d_gnulibc='$d_gnulibc'
11294 d_htonl='$d_htonl'
11295 d_index='$d_index'
11296 d_inetaton='$d_inetaton'
11297 d_isascii='$d_isascii'
11298 d_killpg='$d_killpg'
11299 d_lchown='$d_lchown'
11300 d_link='$d_link'
11301 d_locconv='$d_locconv'
11302 d_lockf='$d_lockf'
11303 d_longdbl='$d_longdbl'
11304 d_longlong='$d_longlong'
11305 d_lstat='$d_lstat'
11306 d_mblen='$d_mblen'
11307 d_mbstowcs='$d_mbstowcs'
11308 d_mbtowc='$d_mbtowc'
11309 d_memcmp='$d_memcmp'
11310 d_memcpy='$d_memcpy'
11311 d_memmove='$d_memmove'
11312 d_memset='$d_memset'
11313 d_mkdir='$d_mkdir'
11314 d_mkfifo='$d_mkfifo'
11315 d_mktime='$d_mktime'
11316 d_msg='$d_msg'
11317 d_msgctl='$d_msgctl'
11318 d_msgget='$d_msgget'
11319 d_msgrcv='$d_msgrcv'
11320 d_msgsnd='$d_msgsnd'
11321 d_mymalloc='$d_mymalloc'
11322 d_nice='$d_nice'
11323 d_oldpthreads='$d_oldpthreads'
11324 d_oldsock='$d_oldsock'
11325 d_open3='$d_open3'
11326 d_pathconf='$d_pathconf'
11327 d_pause='$d_pause'
11328 d_phostname='$d_phostname'
11329 d_pipe='$d_pipe'
11330 d_poll='$d_poll'
11331 d_portable='$d_portable'
11332 d_pthread_yield='$d_pthread_yield'
11333 d_pthreads_created_joinable='$d_pthreads_created_joinable'
11334 d_pwage='$d_pwage'
11335 d_pwchange='$d_pwchange'
11336 d_pwclass='$d_pwclass'
11337 d_pwcomment='$d_pwcomment'
11338 d_pwexpire='$d_pwexpire'
11339 d_pwgecos='$d_pwgecos'
11340 d_pwquota='$d_pwquota'
11341 d_readdir='$d_readdir'
11342 d_readlink='$d_readlink'
11343 d_rename='$d_rename'
11344 d_rewinddir='$d_rewinddir'
11345 d_rmdir='$d_rmdir'
11346 d_safebcpy='$d_safebcpy'
11347 d_safemcpy='$d_safemcpy'
11348 d_sanemcmp='$d_sanemcmp'
11349 d_sched_yield='$d_sched_yield'
11350 d_seekdir='$d_seekdir'
11351 d_select='$d_select'
11352 d_sem='$d_sem'
11353 d_semctl='$d_semctl'
11354 d_semctl_semid_ds='$d_semctl_semid_ds'
11355 d_semctl_semun='$d_semctl_semun'
11356 d_semget='$d_semget'
11357 d_semop='$d_semop'
11358 d_setegid='$d_setegid'
11359 d_seteuid='$d_seteuid'
11360 d_setgrps='$d_setgrps'
11361 d_sethent='$d_sethent'
11362 d_setlinebuf='$d_setlinebuf'
11363 d_setlocale='$d_setlocale'
11364 d_setnent='$d_setnent'
11365 d_setpent='$d_setpent'
11366 d_setpgid='$d_setpgid'
11367 d_setpgrp2='$d_setpgrp2'
11368 d_setpgrp='$d_setpgrp'
11369 d_setprior='$d_setprior'
11370 d_setregid='$d_setregid'
11371 d_setresgid='$d_setresgid'
11372 d_setresuid='$d_setresuid'
11373 d_setreuid='$d_setreuid'
11374 d_setrgid='$d_setrgid'
11375 d_setruid='$d_setruid'
11376 d_setsent='$d_setsent'
11377 d_setsid='$d_setsid'
11378 d_setvbuf='$d_setvbuf'
11379 d_sfio='$d_sfio'
11380 d_shm='$d_shm'
11381 d_shmat='$d_shmat'
11382 d_shmatprototype='$d_shmatprototype'
11383 d_shmctl='$d_shmctl'
11384 d_shmdt='$d_shmdt'
11385 d_shmget='$d_shmget'
11386 d_sigaction='$d_sigaction'
11387 d_sigsetjmp='$d_sigsetjmp'
11388 d_socket='$d_socket'
11389 d_sockpair='$d_sockpair'
11390 d_statblks='$d_statblks'
11391 d_stdio_cnt_lval='$d_stdio_cnt_lval'
11392 d_stdio_ptr_lval='$d_stdio_ptr_lval'
11393 d_stdiobase='$d_stdiobase'
11394 d_stdstdio='$d_stdstdio'
11395 d_strchr='$d_strchr'
11396 d_strcoll='$d_strcoll'
11397 d_strctcpy='$d_strctcpy'
11398 d_strerrm='$d_strerrm'
11399 d_strerror='$d_strerror'
11400 d_strtod='$d_strtod'
11401 d_strtol='$d_strtol'
11402 d_strtoul='$d_strtoul'
11403 d_strxfrm='$d_strxfrm'
11404 d_suidsafe='$d_suidsafe'
11405 d_symlink='$d_symlink'
11406 d_syscall='$d_syscall'
11407 d_sysconf='$d_sysconf'
11408 d_sysernlst='$d_sysernlst'
11409 d_syserrlst='$d_syserrlst'
11410 d_system='$d_system'
11411 d_tcgetpgrp='$d_tcgetpgrp'
11412 d_tcsetpgrp='$d_tcsetpgrp'
11413 d_telldir='$d_telldir'
11414 d_time='$d_time'
11415 d_times='$d_times'
11416 d_truncate='$d_truncate'
11417 d_tzname='$d_tzname'
11418 d_umask='$d_umask'
11419 d_uname='$d_uname'
11420 d_union_semun='$d_union_semun'
11421 d_vfork='$d_vfork'
11422 d_void_closedir='$d_void_closedir'
11423 d_voidsig='$d_voidsig'
11424 d_voidtty='$d_voidtty'
11425 d_volatile='$d_volatile'
11426 d_vprintf='$d_vprintf'
11427 d_wait4='$d_wait4'
11428 d_waitpid='$d_waitpid'
11429 d_wcstombs='$d_wcstombs'
11430 d_wctomb='$d_wctomb'
11431 d_xenix='$d_xenix'
11432 date='$date'
11433 db_hashtype='$db_hashtype'
11434 db_prefixtype='$db_prefixtype'
11435 defvoidused='$defvoidused'
11436 direntrytype='$direntrytype'
11437 dlext='$dlext'
11438 dlsrc='$dlsrc'
11439 doublesize='$doublesize'
11440 dynamic_ext='$dynamic_ext'
11441 eagain='$eagain'
11442 echo='$echo'
11443 egrep='$egrep'
11444 emacs='$emacs'
11445 eunicefix='$eunicefix'
11446 exe_ext='$exe_ext'
11447 expr='$expr'
11448 extensions='$extensions'
11449 find='$find'
11450 firstmakefile='$firstmakefile'
11451 flex='$flex'
11452 fpostype='$fpostype'
11453 freetype='$freetype'
11454 full_csh='$full_csh'
11455 full_sed='$full_sed'
11456 gccversion='$gccversion'
11457 gidtype='$gidtype'
11458 glibpth='$glibpth'
11459 grep='$grep'
11460 groupcat='$groupcat'
11461 groupstype='$groupstype'
11462 gzip='$gzip'
11463 h_fcntl='$h_fcntl'
11464 h_sysfile='$h_sysfile'
11465 hint='$hint'
11466 hostcat='$hostcat'
11467 huge='$huge'
11468 i_bsdioctl='$i_bsdioctl'
11469 i_db='$i_db'
11470 i_dbm='$i_dbm'
11471 i_dirent='$i_dirent'
11472 i_dld='$i_dld'
11473 i_dlfcn='$i_dlfcn'
11474 i_fcntl='$i_fcntl'
11475 i_float='$i_float'
11476 i_gdbm='$i_gdbm'
11477 i_grp='$i_grp'
11478 i_limits='$i_limits'
11479 i_locale='$i_locale'
11480 i_malloc='$i_malloc'
11481 i_math='$i_math'
11482 i_memory='$i_memory'
11483 i_ndbm='$i_ndbm'
11484 i_netdb='$i_netdb'
11485 i_neterrno='$i_neterrno'
11486 i_niin='$i_niin'
11487 i_pwd='$i_pwd'
11488 i_rpcsvcdbm='$i_rpcsvcdbm'
11489 i_sfio='$i_sfio'
11490 i_sgtty='$i_sgtty'
11491 i_stdarg='$i_stdarg'
11492 i_stddef='$i_stddef'
11493 i_stdlib='$i_stdlib'
11494 i_string='$i_string'
11495 i_sysdir='$i_sysdir'
11496 i_sysfile='$i_sysfile'
11497 i_sysfilio='$i_sysfilio'
11498 i_sysin='$i_sysin'
11499 i_sysioctl='$i_sysioctl'
11500 i_sysndir='$i_sysndir'
11501 i_sysparam='$i_sysparam'
11502 i_sysresrc='$i_sysresrc'
11503 i_sysselct='$i_sysselct'
11504 i_syssockio='$i_syssockio'
11505 i_sysstat='$i_sysstat'
11506 i_systime='$i_systime'
11507 i_systimek='$i_systimek'
11508 i_systimes='$i_systimes'
11509 i_systypes='$i_systypes'
11510 i_sysun='$i_sysun'
11511 i_syswait='$i_syswait'
11512 i_termio='$i_termio'
11513 i_termios='$i_termios'
11514 i_time='$i_time'
11515 i_unistd='$i_unistd'
11516 i_utime='$i_utime'
11517 i_values='$i_values'
11518 i_varargs='$i_varargs'
11519 i_varhdr='$i_varhdr'
11520 i_vfork='$i_vfork'
11521 incpath='$incpath'
11522 inews='$inews'
11523 installarchlib='$installarchlib'
11524 installbin='$installbin'
11525 installman1dir='$installman1dir'
11526 installman3dir='$installman3dir'
11527 installprivlib='$installprivlib'
11528 installscript='$installscript'
11529 installsitearch='$installsitearch'
11530 installsitelib='$installsitelib'
11531 intsize='$intsize'
11532 known_extensions='$known_extensions'
11533 ksh='$ksh'
11534 large='$large'
11535 ld='$ld'
11536 lddlflags='$lddlflags'
11537 ldflags='$ldflags'
11538 less='$less'
11539 lib_ext='$lib_ext'
11540 libc='$libc'
11541 libperl='$libperl'
11542 libpth='$libpth'
11543 libs='$libs'
11544 libswanted='$libswanted'
11545 line='$line'
11546 lint='$lint'
11547 lkflags='$lkflags'
11548 ln='$ln'
11549 lns='$lns'
11550 locincpth='$locincpth'
11551 loclibpth='$loclibpth'
11552 longdblsize='$longdblsize'
11553 longlongsize='$longlongsize'
11554 longsize='$longsize'
11555 lp='$lp'
11556 lpr='$lpr'
11557 ls='$ls'
11558 lseektype='$lseektype'
11559 mail='$mail'
11560 mailx='$mailx'
11561 make='$make'
11562 make_set_make='$make_set_make'
11563 mallocobj='$mallocobj'
11564 mallocsrc='$mallocsrc'
11565 malloctype='$malloctype'
11566 man1dir='$man1dir'
11567 man1direxp='$man1direxp'
11568 man1ext='$man1ext'
11569 man3dir='$man3dir'
11570 man3direxp='$man3direxp'
11571 man3ext='$man3ext'
11572 medium='$medium'
11573 mips='$mips'
11574 mips_type='$mips_type'
11575 mkdir='$mkdir'
11576 models='$models'
11577 modetype='$modetype'
11578 more='$more'
11579 mv='$mv'
11580 myarchname='$myarchname'
11581 mydomain='$mydomain'
11582 myhostname='$myhostname'
11583 myuname='$myuname'
11584 n='$n'
11585 netdb_hlen_type='$netdb_hlen_type'
11586 netdb_host_type='$netdb_host_type'
11587 netdb_name_type='$netdb_name_type'
11588 netdb_net_type='$netdb_net_type'
11589 nm='$nm'
11590 nm_opt='$nm_opt'
11591 nm_so_opt='$nm_so_opt'
11592 nroff='$nroff'
11593 o_nonblock='$o_nonblock'
11594 obj_ext='$obj_ext'
11595 optimize='$optimize'
11596 orderlib='$orderlib'
11597 osname='$osname'
11598 osvers='$osvers'
11599 package='$package'
11600 pager='$pager'
11601 passcat='$passcat'
11602 patchlevel='$patchlevel'
11603 path_sep='$path_sep'
11604 perl='$perl'
11605 perladmin='$perladmin'
11606 perlpath='$perlpath'
11607 nonxs_ext='$nonxs_ext'
11608 pg='$pg'
11609 phostname='$phostname'
11610 pidtype='$pidtype'
11611 plibpth='$plibpth'
11612 pmake='$pmake'
11613 pr='$pr'
11614 prefix='$prefix'
11615 prefixexp='$prefixexp'
11616 privlib='$privlib'
11617 privlibexp='$privlibexp'
11618 prototype='$prototype'
11619 ptrsize='$ptrsize'
11620 randbits='$randbits'
11621 ranlib='$ranlib'
11622 rd_nodata='$rd_nodata'
11623 rm='$rm'
11624 rmail='$rmail'
11625 runnm='$runnm'
11626 scriptdir='$scriptdir'
11627 scriptdirexp='$scriptdirexp'
11628 sed='$sed'
11629 selecttype='$selecttype'
11630 sendmail='$sendmail'
11631 sh='$sh'
11632 shar='$shar'
11633 sharpbang='$sharpbang'
11634 shmattype='$shmattype'
11635 shortsize='$shortsize'
11636 shrpenv='$shrpenv'
11637 shsharp='$shsharp'
11638 sig_name='$sig_name'
11639 sig_name_init='$sig_name_init'
11640 sig_num='$sig_num'
11641 signal_t='$signal_t'
11642 sitearch='$sitearch'
11643 sitearchexp='$sitearchexp'
11644 sitelib='$sitelib'
11645 sitelibexp='$sitelibexp'
11646 sizetype='$sizetype'
11647 sleep='$sleep'
11648 smail='$smail'
11649 small='$small'
11650 so='$so'
11651 sockethdr='$sockethdr'
11652 socketlib='$socketlib'
11653 sort='$sort'
11654 spackage='$spackage'
11655 spitshell='$spitshell'
11656 split='$split'
11657 src='$src'
11658 ssizetype='$ssizetype'
11659 startperl='$startperl'
11660 startsh='$startsh'
11661 static_ext='$static_ext'
11662 stdchar='$stdchar'
11663 stdio_base='$stdio_base'
11664 stdio_bufsiz='$stdio_bufsiz'
11665 stdio_cnt='$stdio_cnt'
11666 stdio_filbuf='$stdio_filbuf'
11667 stdio_ptr='$stdio_ptr'
11668 strings='$strings'
11669 submit='$submit'
11670 subversion='$subversion'
11671 sysman='$sysman'
11672 tail='$tail'
11673 tar='$tar'
11674 tbl='$tbl'
11675 tee='$tee'
11676 test='$test'
11677 timeincl='$timeincl'
11678 timetype='$timetype'
11679 touch='$touch'
11680 tr='$tr'
11681 troff='$troff'
11682 uidtype='$uidtype'
11683 uname='$uname'
11684 uniq='$uniq'
11685 usedl='$usedl'
11686 usemymalloc='$usemymalloc'
11687 usenm='$usenm'
11688 useopcode='$useopcode'
11689 useperlio='$useperlio'
11690 useposix='$useposix'
11691 usesfio='$usesfio'
11692 useshrplib='$useshrplib'
11693 usethreads='$usethreads'
11694 usevfork='$usevfork'
11695 usrinc='$usrinc'
11696 uuname='$uuname'
11697 vi='$vi'
11698 voidflags='$voidflags'
11699 xlibpth='$xlibpth'
11700 zcat='$zcat'
11701 zip='$zip'
11702 EOT
11703
11704 : Add in command line options if available
11705 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
11706
11707 : add special variables
11708 $test -f $src/patchlevel.h && \
11709 awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
11710 echo "CONFIG=true" >>config.sh
11711
11712 : propagate old symbols
11713 if $test -f UU/config.sh; then
11714         <UU/config.sh sort | uniq >UU/oldconfig.sh
11715         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
11716         sort | uniq -u >UU/oldsyms
11717         set X `cat UU/oldsyms`
11718         shift
11719         case $# in
11720         0) ;;
11721         *)
11722                 cat <<EOM
11723 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
11724 EOM
11725                 echo "# Variables propagated from previous config.sh file." >>config.sh
11726                 for sym in `cat UU/oldsyms`; do
11727                         echo "    Propagating $hint variable "'$'"$sym..."
11728                         eval 'tmp="$'"${sym}"'"'
11729                         echo "$tmp" | \
11730                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
11731                 done
11732                 ;;
11733         esac
11734 fi
11735
11736 : Finish up by extracting the .SH files
11737 case "$alldone" in
11738 exit)
11739         $rm -rf UU
11740         echo "Done."
11741         exit 0
11742         ;;
11743 cont)
11744         ;;
11745 '')
11746         dflt=''
11747         nostick=true
11748         $cat <<EOM
11749
11750 If you'd like to make any changes to the config.sh file before I begin
11751 to configure things, do it as a shell escape now (e.g. !vi config.sh).
11752
11753 EOM
11754         rp="Press return or use a shell escape to edit config.sh:"
11755         . UU/myread
11756         nostick=''
11757         case "$ans" in
11758         '') ;;
11759         *) : in case they cannot read
11760                 sh 1>&4 -c "$ans";;
11761         esac
11762         ;;
11763 esac
11764
11765 : if this fails, just run all the .SH files by hand
11766 . ./config.sh
11767
11768 echo " "
11769 exec 1>&4
11770 . ./UU/extract
11771
11772 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
11773         dflt=y
11774         case "$silent" in
11775         true) ;;
11776         *)
11777                 $cat <<EOM
11778
11779 Now you need to generate make dependencies by running "make depend".
11780 You might prefer to run it in background: "make depend > makedepend.out &"
11781 It can take a while, so you might not want to run it right now.
11782
11783 EOM
11784                 ;;
11785         esac
11786         rp="Run make depend now?"
11787         . UU/myread
11788         case "$ans" in
11789         y*)
11790                 make depend && echo "Now you must run a make."
11791                 ;;
11792         *)
11793                 echo "You must run 'make depend' then 'make'."
11794                 ;;
11795         esac
11796 elif test -f [Mm]akefile; then
11797         echo " "
11798         echo "Now you must run a make."
11799 else
11800         echo "Done."
11801 fi
11802
11803 if $test -f Policy.sh; then
11804     $cat <<EOM
11805
11806 If you compile $package on a different machine or from a different object
11807 directory, copy the Policy.sh file from this object directory to the
11808 new one before you run Configure -- this will help you with most of
11809 the policy defaults.
11810
11811 EOM
11812 fi
11813 if $test -f config.msg; then
11814     echo "Hmm.  I also noted the following information while running:"
11815     echo " "
11816     $cat config.msg >&4
11817     $rm -f config.msg
11818 fi
11819 $rm -f kit*isdone ark*isdone
11820 $rm -rf UU
11821
11822 : End of Configure
11823