Configure update: fstatvfs/fstafs/getmntent/hasmntopt were
[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 Fri Feb 19 21:44:45 EET 1999 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 case "$inksh/$needksh" in
112 /[a-z]*)
113                 ENV=''
114                 changesh=true
115                 reason="$needksh"
116         ;;
117 esac
118 case "$inksh/$avoidksh" in
119 true/[a-z]*)
120         changesh=true
121         reason="$avoidksh"
122         ;;
123 esac
124 case "$inksh/$needksh-$avoidksh-" in
125 true/--)
126                 cat <<EOM
127 (I see you are using the Korn shell.  Some ksh's blow up on $me,
128 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
129 EOM
130         ;;
131 esac
132 case "$changesh" in
133 true)
134         echo "(Feeding myself to $newsh $reason.)"
135         case "$0" in
136         Configure|*/Configure) exec $newsh $0 "$@";;
137         *) exec $newsh Configure "$@";;
138         esac
139         ;;
140 esac
141
142 : if needed set CDPATH to a harmless value that is not chatty
143 : avoid bash 2.02 problems with empty CDPATH.
144 case "$CDPATH" in
145 '')     ;;
146 *)      case "$SHELL" in
147         *bash*) CDPATH='.' ;;
148         *)              CDPATH='' ;;
149         esac
150         ;;
151 esac
152 : Configure runs within the UU subdirectory
153 test -d UU || mkdir UU
154 cd UU && rm -f ./*
155
156 ccsymbols=''
157 cppccsymbols=''
158 cppsymbols=''
159 dynamic_ext=''
160 extensions=''
161 known_extensions=''
162 nonxs_ext=''
163 static_ext=''
164 useopcode=''
165 useposix=''
166 d_bsd=''
167 d_eunice=''
168 d_xenix=''
169 eunicefix=''
170 Mcc=''
171 ar=''
172 awk=''
173 bash=''
174 bison=''
175 byacc=''
176 cat=''
177 chgrp=''
178 chmod=''
179 chown=''
180 comm=''
181 compress=''
182 cp=''
183 cpio=''
184 cpp=''
185 csh=''
186 date=''
187 echo=''
188 egrep=''
189 emacs=''
190 expr=''
191 find=''
192 flex=''
193 grep=''
194 gzip=''
195 inews=''
196 ksh=''
197 less=''
198 line=''
199 lint=''
200 ln=''
201 lp=''
202 lpr=''
203 ls=''
204 mail=''
205 mailx=''
206 make=''
207 mkdir=''
208 more=''
209 mv=''
210 nm=''
211 nroff=''
212 perl=''
213 pg=''
214 pmake=''
215 pr=''
216 rm=''
217 rmail=''
218 sed=''
219 sendmail=''
220 shar=''
221 sleep=''
222 smail=''
223 sort=''
224 submit=''
225 tail=''
226 tar=''
227 tbl=''
228 tee=''
229 test=''
230 touch=''
231 tr=''
232 troff=''
233 uname=''
234 uniq=''
235 uuname=''
236 vi=''
237 zcat=''
238 zip=''
239 full_ar=''
240 full_sed=''
241 libswanted=''
242 hint=''
243 myuname=''
244 osname=''
245 osvers=''
246 Author=''
247 Date=''
248 Header=''
249 Id=''
250 Locker=''
251 Log=''
252 RCSfile=''
253 Revision=''
254 Source=''
255 State=''
256 _a=''
257 _exe=''
258 _o=''
259 archobjs=''
260 exe_ext=''
261 firstmakefile=''
262 lib_ext=''
263 obj_ext=''
264 path_sep=''
265 afs=''
266 alignbytes=''
267 ansi2knr=''
268 archlib=''
269 archlibexp=''
270 d_archlib=''
271 installarchlib=''
272 archname=''
273 myarchname=''
274 baserev=''
275 bin=''
276 binexp=''
277 installbin=''
278 byteorder=''
279 cc=''
280 gccversion=''
281 ccflags=''
282 cppflags=''
283 ldflags=''
284 lkflags=''
285 locincpth=''
286 optimize=''
287 cf_email=''
288 cf_by=''
289 cf_time=''
290 contains=''
291 cpp_stuff=''
292 cpplast=''
293 cppminus=''
294 cpprun=''
295 cppstdin=''
296 d_access=''
297 d_accessx=''
298 d_alarm=''
299 d_attribut=''
300 d_bcmp=''
301 d_bcopy=''
302 d_bzero=''
303 d_casti32=''
304 castflags=''
305 d_castneg=''
306 d_chown=''
307 d_chroot=''
308 d_chsize=''
309 d_closedir=''
310 d_void_closedir=''
311 d_const=''
312 cryptlib=''
313 d_crypt=''
314 d_csh=''
315 full_csh=''
316 d_cuserid=''
317 d_dbl_dig=''
318 d_difftime=''
319 d_dlerror=''
320 d_dlopen=''
321 d_dlsymun=''
322 d_dosuid=''
323 d_suidsafe=''
324 d_drand48proto=''
325 d_dup2=''
326 d_eaccess=''
327 d_endgrent=''
328 d_endhent=''
329 d_endnent=''
330 d_endpent=''
331 d_endpwent=''
332 d_endsent=''
333 d_fchmod=''
334 d_fchown=''
335 d_fcntl=''
336 d_fd_macros=''
337 d_fd_set=''
338 d_fds_bits=''
339 d_fgetpos=''
340 d_flexfnam=''
341 d_flock=''
342 d_fork=''
343 d_fseeko=''
344 d_fsetpos=''
345 d_ftello=''
346 d_ftime=''
347 d_gettimeod=''
348 d_Gconvert=''
349 d_getgrent=''
350 d_getgrps=''
351 d_gethbyaddr=''
352 d_gethbyname=''
353 d_gethent=''
354 aphostname=''
355 d_gethname=''
356 d_phostname=''
357 d_uname=''
358 d_gethostprotos=''
359 d_getlogin=''
360 d_getmntent=''
361 d_getnbyaddr=''
362 d_getnbyname=''
363 d_getnent=''
364 d_getnetprotos=''
365 d_getpent=''
366 d_getpgid=''
367 d_getpgrp2=''
368 d_bsdgetpgrp=''
369 d_getpgrp=''
370 d_getppid=''
371 d_getprior=''
372 d_getpbyname=''
373 d_getpbynumber=''
374 d_getprotoprotos=''
375 d_getpwent=''
376 d_getsent=''
377 d_getservprotos=''
378 d_getsbyname=''
379 d_getsbyport=''
380 d_gnulibc=''
381 d_hasmntopt=''
382 d_htonl=''
383 d_inetaton=''
384 d_isascii=''
385 d_killpg=''
386 d_lchown=''
387 d_link=''
388 d_locconv=''
389 d_lockf=''
390 d_longdbl=''
391 longdblsize=''
392 d_longlong=''
393 longlongsize=''
394 d_lstat=''
395 d_madvise=''
396 d_mblen=''
397 d_mbstowcs=''
398 d_mbtowc=''
399 d_memcmp=''
400 d_memcpy=''
401 d_memmove=''
402 d_memset=''
403 d_mkdir=''
404 d_mkfifo=''
405 d_mktime=''
406 d_mmap=''
407 mmaptype=''
408 d_mprotect=''
409 d_msg=''
410 d_msgctl=''
411 d_msgget=''
412 d_msgrcv=''
413 d_msgsnd=''
414 d_msync=''
415 d_munmap=''
416 d_nice=''
417 d_open3=''
418 d_fpathconf=''
419 d_pathconf=''
420 d_pause=''
421 d_pipe=''
422 d_poll=''
423 d_portable=''
424 d_old_pthread_create_joinable=''
425 old_pthread_create_joinable=''
426 d_pthread_yield=''
427 d_sched_yield=''
428 sched_yield=''
429 d_readdir=''
430 d_rewinddir=''
431 d_seekdir=''
432 d_telldir=''
433 d_readlink=''
434 d_readv=''
435 d_rename=''
436 d_rmdir=''
437 d_safebcpy=''
438 d_safemcpy=''
439 d_sanemcmp=''
440 d_select=''
441 d_sem=''
442 d_semctl=''
443 d_semget=''
444 d_semop=''
445 d_setegid=''
446 d_seteuid=''
447 d_setgrent=''
448 d_setgrps=''
449 d_sethent=''
450 d_setlinebuf=''
451 d_setlocale=''
452 d_setnent=''
453 d_setpent=''
454 d_setpgid=''
455 d_setpgrp2=''
456 d_bsdsetpgrp=''
457 d_setpgrp=''
458 d_setprior=''
459 d_setpwent=''
460 d_setregid=''
461 d_setresgid=''
462 d_setresuid=''
463 d_setreuid=''
464 d_setrgid=''
465 d_setruid=''
466 d_setsent=''
467 d_setsid=''
468 d_setvbuf=''
469 d_sfio=''
470 usesfio=''
471 d_shm=''
472 d_shmat=''
473 d_shmatprototype=''
474 shmattype=''
475 d_shmctl=''
476 d_shmdt=''
477 d_shmget=''
478 d_sigaction=''
479 d_sigsetjmp=''
480 d_cmsghdr_s=''
481 d_msg_ctrunc=''
482 d_msg_dontroute=''
483 d_msg_oob=''
484 d_msg_peek=''
485 d_msg_proxy=''
486 d_msghdr_s=''
487 d_oldsock=''
488 d_recvmsg=''
489 d_scm_rights=''
490 d_sendmsg=''
491 d_socket=''
492 d_sockpair=''
493 sockethdr=''
494 socketlib=''
495 d_statblks=''
496 d_fstatfs=''
497 d_statfs=''
498 d_statfsflags=''
499 d_fstatvfs=''
500 d_statvfs=''
501 d_stdio_cnt_lval=''
502 d_stdio_ptr_lval=''
503 d_stdiobase=''
504 d_stdstdio=''
505 stdio_base=''
506 stdio_bufsiz=''
507 stdio_cnt=''
508 stdio_filbuf=''
509 stdio_ptr=''
510 d_index=''
511 d_strchr=''
512 d_strcoll=''
513 d_strctcpy=''
514 d_strerrm=''
515 d_strerror=''
516 d_sysernlst=''
517 d_syserrlst=''
518 d_strtod=''
519 d_strtol=''
520 d_strtoul=''
521 d_strxfrm=''
522 d_symlink=''
523 d_syscall=''
524 d_sysconf=''
525 d_system=''
526 d_tcgetpgrp=''
527 d_tcsetpgrp=''
528 d_telldirproto=''
529 d_time=''
530 timetype=''
531 clocktype=''
532 d_times=''
533 d_truncate=''
534 d_tzname=''
535 d_umask=''
536 d_semctl_semid_ds=''
537 d_semctl_semun=''
538 d_union_semun=''
539 d_vfork=''
540 usevfork=''
541 d_voidsig=''
542 signal_t=''
543 d_volatile=''
544 d_charvspr=''
545 d_vprintf=''
546 d_wait4=''
547 d_waitpid=''
548 d_wcstombs=''
549 d_wctomb=''
550 d_writev=''
551 d_dbmclose64=''
552 d_dbminit64=''
553 d_delete64=''
554 d_fetch64=''
555 d_firstkey64=''
556 d_nextkey64=''
557 d_store64=''
558 dlext=''
559 cccdlflags=''
560 ccdlflags=''
561 dlsrc=''
562 ld=''
563 lddlflags=''
564 usedl=''
565 doublesize=''
566 ebcdic=''
567 fpostype=''
568 gidtype=''
569 groupstype=''
570 h_fcntl=''
571 h_sysfile=''
572 i_arpainet=''
573 db_hashtype=''
574 db_prefixtype=''
575 i_db=''
576 i_dbm=''
577 i_rpcsvcdbm=''
578 d_dirnamlen=''
579 direntrytype=''
580 i_dirent=''
581 i_dld=''
582 i_dlfcn=''
583 i_fcntl=''
584 i_float=''
585 i_gdbm=''
586 d_grpasswd=''
587 i_grp=''
588 d_int64t=''
589 i_inttypes=''
590 i_limits=''
591 i_locale=''
592 i_machcthr=''
593 i_malloc=''
594 i_math=''
595 i_memory=''
596 i_mntent=''
597 i_ndbm=''
598 i_netdb=''
599 i_neterrno=''
600 i_niin=''
601 i_sysin=''
602 i_poll=''
603 d_pwage=''
604 d_pwchange=''
605 d_pwclass=''
606 d_pwcomment=''
607 d_pwexpire=''
608 d_pwgecos=''
609 d_pwpasswd=''
610 d_pwquota=''
611 i_pwd=''
612 i_sfio=''
613 i_stddef=''
614 i_stdlib=''
615 i_string=''
616 strings=''
617 i_sysaccess=''
618 i_sysdir=''
619 i_sysfile=''
620 d_voidtty=''
621 i_bsdioctl=''
622 i_sysfilio=''
623 i_sysioctl=''
624 i_syssockio=''
625 i_sysmman=''
626 i_sysmount=''
627 i_sysndir=''
628 i_sysparam=''
629 i_sysresrc=''
630 i_syssecrt=''
631 i_sysselct=''
632 i_sysstat=''
633 i_sysstatvfs=''
634 i_systimes=''
635 i_systypes=''
636 d_iovec_s=''
637 i_sysuio=''
638 i_sysun=''
639 i_syswait=''
640 i_sgtty=''
641 i_termio=''
642 i_termios=''
643 i_systime=''
644 i_systimek=''
645 i_time=''
646 timeincl=''
647 i_unistd=''
648 i_utime=''
649 i_values=''
650 i_stdarg=''
651 i_varargs=''
652 i_varhdr=''
653 i_vfork=''
654 installusrbinperl=''
655 intsize=''
656 longsize=''
657 shortsize=''
658 d_dirent64_s=''
659 d_flock64_s=''
660 d_fstat64=''
661 d_ftruncate64=''
662 d_ino64t=''
663 d_lockf64=''
664 d_lseek64=''
665 d_lstat64=''
666 d_off64t=''
667 d_open64=''
668 d_opendir64=''
669 d_readdir64=''
670 d_seekdir64=''
671 d_stat64=''
672 d_telldir64=''
673 d_truncate64=''
674 libc=''
675 libperl=''
676 shrpenv=''
677 useshrplib=''
678 glibpth=''
679 libpth=''
680 loclibpth=''
681 plibpth=''
682 xlibpth=''
683 ignore_versioned_solibs=''
684 libs=''
685 lns=''
686 lseeksize=''
687 lseektype=''
688 make_set_make=''
689 d_mymalloc=''
690 freetype=''
691 mallocobj=''
692 mallocsrc=''
693 malloctype=''
694 usemymalloc=''
695 installman1dir=''
696 man1dir=''
697 man1direxp=''
698 man1ext=''
699 installman3dir=''
700 man3dir=''
701 man3direxp=''
702 man3ext=''
703 huge=''
704 large=''
705 medium=''
706 models=''
707 small=''
708 split=''
709 modetype=''
710 mydomain=''
711 myhostname=''
712 phostname=''
713 c=''
714 n=''
715 d_eofnblk=''
716 eagain=''
717 o_nonblock=''
718 rd_nodata=''
719 netdb_hlen_type=''
720 netdb_host_type=''
721 netdb_name_type=''
722 netdb_net_type=''
723 groupcat=''
724 hostcat=''
725 passcat=''
726 orderlib=''
727 ranlib=''
728 package=''
729 spackage=''
730 pager=''
731 apiversion=''
732 patchlevel=''
733 subversion=''
734 version=''
735 perladmin=''
736 perlpath=''
737 pidtype=''
738 prefix=''
739 prefixexp=''
740 installprivlib=''
741 privlib=''
742 privlibexp=''
743 prototype=''
744 ptrsize=''
745 drand01=''
746 randbits=''
747 randfunc=''
748 randseedtype=''
749 seedfunc=''
750 installscript=''
751 scriptdir=''
752 scriptdirexp=''
753 selectminbits=''
754 selecttype=''
755 sh=''
756 sig_name=''
757 sig_name_init=''
758 sig_num=''
759 sig_num_init=''
760 installsitearch=''
761 sitearch=''
762 sitearchexp=''
763 installsitelib=''
764 sitelib=''
765 sitelibexp=''
766 sizetype=''
767 so=''
768 sharpbang=''
769 shsharp=''
770 spitshell=''
771 src=''
772 ssizetype=''
773 startperl=''
774 startsh=''
775 stdchar=''
776 d_fgetpos64=''
777 d_fopen64=''
778 d_freopen64=''
779 d_fseek64=''
780 d_fseeko64=''
781 d_fsetpos64=''
782 d_ftell64=''
783 d_ftello64=''
784 d_tmpfile64=''
785 sysman=''
786 trnl=''
787 uidtype=''
788 archname64=''
789 use64bits=''
790 usemultiplicity=''
791 nm_opt=''
792 nm_so_opt=''
793 runnm=''
794 usenm=''
795 useperlio=''
796 d_oldpthreads=''
797 usethreads=''
798 incpath=''
799 mips=''
800 mips_type=''
801 usrinc=''
802 defvoidused=''
803 voidflags=''
804 CONFIG=''
805
806 define='define'
807 undef='undef'
808 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
809 rmlist=''
810
811 : We must find out about Eunice early
812 eunicefix=':'
813 if test -f /etc/unixtovms; then
814         eunicefix=/etc/unixtovms
815 fi
816 if test -f /etc/unixtovms.exe; then
817         eunicefix=/etc/unixtovms.exe
818 fi
819
820 i_whoami=''
821 : change the next line if compiling for Xenix/286 on Xenix/386
822 xlibpth='/usr/lib/386 /lib/386'
823
824 : Possible local library directories to search.
825 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
826 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
827
828 : general looking path for locating libraries
829 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
830 glibpth="$glibpth /lib /usr/lib $xlibpth"
831 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
832 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
833
834 : Private path used by Configure to find libraries.  Its value
835 : is prepended to libpth. This variable takes care of special
836 : machines, like the mips.  Usually, it should be empty.
837 plibpth=''
838
839 : Possible local include directories to search.
840 : Set locincpth to "" in a hint file to defeat local include searches.
841 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
842 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
843 :
844 : no include file wanted by default
845 inclwanted=''
846
847 : list of known cpp symbols, sorted alphabetically
848 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
849 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
850 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
851 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
852 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
853 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
854 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
855 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
856 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
857 al="$al VMS Xenix286"
858 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
859 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
860 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
861 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
862 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
863 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
864 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
865 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
866 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
867 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
868 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
869 al="$al __SVR4_2__ __UMAXV__"
870 al="$al ____386BSD____ __alpha __alpha__ __amiga"
871 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
872 al="$al __host_mips__"
873 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
874 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
875 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
876 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
877 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
878 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
879 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
880 al="$al __mc88100 __mc88100__ __mips __mips__"
881 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
882 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
883 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
884 al="$al _host_mips _mips _unix"
885 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
886 al="$al apollo ardent att386 att3b"
887 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
888 al="$al cadmus clipper concurrent convex cray ctix"
889 al="$al dmert encore gcos gcx gimpel gould"
890 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
891 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
892 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
893 al="$al i186 i286 i386 i486 i8086"
894 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
895 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
896 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
897 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
898 al="$al mc88000 mc88100 merlin mert mips mvs n16"
899 al="$al ncl_el ncl_mr"
900 al="$al news1500 news1700 news1800 news1900 news3700"
901 al="$al news700 news800 news900 ns16000 ns32000"
902 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
903 al="$al parisc pc532 pdp11 plexus posix pyr"
904 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
905 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
906 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
907 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
908 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
909 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
910 al="$al xenix z8000"
911
912 : Trailing extension.  Override this in a hint file, if needed.
913 _exe=''
914 : Extra object files, if any, needed on this platform.
915 archobjs=''
916 groupstype=''
917 : default library list
918 libswanted=''
919 : some systems want to use only the non-versioned libso:s
920 ignore_versioned_solibs=''
921 : full support for void wanted by default
922 defvoidused=15
923
924 : set useposix=false in your hint file to disable the POSIX extension.
925 useposix=true
926 : set useopcode=false in your hint file to disable the Opcode extension.
927 useopcode=true
928 : set usemultiplicity on the Configure command line to enable multiplicity.
929 : set usethreads on the Configure command line to enable threads.
930 : List of libraries we want.
931 : If anyone needs -lnet, put it in a hint file.
932 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
933 libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
934 libswanted="$libswanted ucb bsd BSD PW x"
935 : We probably want to search /usr/shlib before most other libraries.
936 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
937 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
938 glibpth="/usr/shlib $glibpth"
939 : Do not use vfork unless overridden by a hint file.
940 usevfork=false
941
942 : Find the basic shell for Bourne shell scripts
943 case "$sh" in
944 '')
945         case "$SYSTYPE" in
946         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
947         *) xxx='/bin/sh';;
948         esac
949         if test -f "$xxx"; then
950                 sh="$xxx"
951         else
952                 : Build up a list and do a single loop so we can 'break' out.
953                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
954                 for xxx in sh bash ksh pdksh ash; do
955                         for p in $pth; do
956                                 try="$try ${p}/${xxx}"
957                         done
958                 done
959                 for xxx in $try; do
960                         if test -f "$xxx"; then
961                                 sh="$xxx";
962                                 break
963                         elif test -f "$xxx.exe"; then
964                                 sh="$xxx";
965                                 break
966                         fi
967                 done
968         fi
969         ;;
970 esac
971
972 case "$sh" in
973 '')     cat <<EOM >&2
974 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
975
976 Usually it's in /bin/sh.  How did you even get this far?
977 Please contact me (Perl Maintainers) at perlbug@perl.com and 
978 we'll try to straighten this all out.
979 EOM
980         exit 1
981         ;;
982 esac
983
984 : see if sh knows # comments
985 if `$sh -c '#' >/dev/null 2>&1`; then
986         shsharp=true
987         spitshell=cat
988         xcat=/bin/cat
989         test -f $xcat || xcat=/usr/bin/cat
990         echo "#!$xcat" >try
991         $eunicefix try
992         chmod +x try
993         ./try > today
994         if test -s today; then
995                 sharpbang='#!'
996         else
997                 echo "#! $xcat" > try
998                 $eunicefix try
999                 chmod +x try
1000                 ./try > today
1001                 if test -s today; then
1002                         sharpbang='#! '
1003                 else
1004                         sharpbang=': use '
1005                 fi
1006         fi
1007 else
1008         echo " "
1009         echo "Your $sh doesn't grok # comments--I will strip them later on."
1010         shsharp=false
1011         cd ..
1012         echo "exec grep -v '^[  ]*#'" >spitshell
1013         chmod +x spitshell
1014         $eunicefix spitshell
1015         spitshell=`pwd`/spitshell
1016         cd UU
1017         echo "I presume that if # doesn't work, #! won't work either!"
1018         sharpbang=': use '
1019 fi
1020 rm -f try today
1021
1022 : figure out how to guarantee sh startup
1023 case "$startsh" in
1024 '') startsh=${sharpbang}${sh} ;;
1025 *)
1026 esac
1027 cat >try <<EOSS
1028 $startsh
1029 set abc
1030 test "$?abc" != 1
1031 EOSS
1032
1033 chmod +x try
1034 $eunicefix try
1035 if ./try; then
1036         : echo "Yup, it does."
1037 else
1038         echo "Hmm... '$startsh' does not guarantee sh startup..."
1039         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1040 fi
1041 rm -f try
1042
1043
1044 : Save command line options in file UU/cmdline.opt for later use in
1045 : generating config.sh.
1046 cat > cmdline.opt <<EOSH
1047 # Configure command line arguments.
1048 config_arg0='$0'
1049 config_args='$*'
1050 config_argc=$#
1051 EOSH
1052 argn=1
1053 for arg in "$@"; do
1054         cat >>cmdline.opt <<EOSH
1055 config_arg$argn='$arg'
1056 EOSH
1057         argn=`expr $argn + 1`
1058 done
1059
1060 : produce awk script to parse command line options
1061 cat >options.awk <<'EOF'
1062 BEGIN {
1063         optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
1064
1065         len = length(optstr);
1066         for (i = 1; i <= len; i++) {
1067                 c = substr(optstr, i, 1);
1068                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1069                 if (a == ":") {
1070                         arg[c] = 1;
1071                         i++;
1072                 }
1073                 opt[c] = 1;
1074         }
1075 }
1076 {
1077         expect = 0;
1078         str = $0;
1079         if (substr(str, 1, 1) != "-") {
1080                 printf("'%s'\n", str);
1081                 next;
1082         }
1083         len = length($0);
1084         for (i = 2; i <= len; i++) {
1085                 c = substr(str, i, 1);
1086                 if (!opt[c]) {
1087                         printf("-%s\n", substr(str, i));
1088                         next;
1089                 }
1090                 printf("-%s\n", c);
1091                 if (arg[c]) {
1092                         if (i < len)
1093                                 printf("'%s'\n", substr(str, i + 1));
1094                         else
1095                                 expect = 1;
1096                         next;
1097                 }
1098         }
1099 }
1100 END {
1101         if (expect)
1102                 print "?";
1103 }
1104 EOF
1105
1106 : process the command line options
1107 set X `for arg in "$@"; do echo "X$arg"; done |
1108         sed -e s/X// | awk -f options.awk`
1109 eval "set $*"
1110 shift
1111 rm -f options.awk
1112
1113 : set up default values
1114 fastread=''
1115 reuseval=false
1116 config_sh=''
1117 alldone=''
1118 error=''
1119 silent=''
1120 extractsh=''
1121 override=''
1122 knowitall=''
1123 rm -f optdef.sh
1124 cat >optdef.sh <<EOS
1125 $startsh
1126 EOS
1127
1128
1129 : option parsing
1130 while test $# -gt 0; do
1131         case "$1" in
1132         -d) shift; fastread=yes;;
1133         -e) shift; alldone=cont;;
1134         -f)
1135                 shift
1136                 cd ..
1137                 if test -r "$1"; then
1138                         config_sh="$1"
1139                 else
1140                         echo "$me: cannot read config file $1." >&2
1141                         error=true
1142                 fi
1143                 cd UU
1144                 shift;;
1145         -h) shift; error=true;;
1146         -r) shift; reuseval=true;;
1147         -s) shift; silent=true; realsilent=true;;
1148         -E) shift; alldone=exit;;
1149         -K) shift; knowitall=true;;
1150         -O) shift; override=true;;
1151         -S) shift; silent=true; extractsh=true;;
1152         -D)
1153                 shift
1154                 case "$1" in
1155                 *=)
1156                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1157                         echo "$me: ignoring -D $1" >&2
1158                         ;;
1159                 *=*) echo "$1" | \
1160                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1161                 *) echo "$1='define'" >> optdef.sh;;
1162                 esac
1163                 shift
1164                 ;;
1165         -U)
1166                 shift
1167                 case "$1" in
1168                 *=) echo "$1" >> optdef.sh;;
1169                 *=*)
1170                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1171                         echo "$me: ignoring -U $1" >&2
1172                         ;;
1173                 *) echo "$1='undef'" >> optdef.sh;;
1174                 esac
1175                 shift
1176                 ;;
1177         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1178                 exit 0;;
1179         --) break;;
1180         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1181         *) break;;
1182         esac
1183 done
1184
1185 case "$error" in
1186 true)
1187         cat >&2 <<EOM
1188 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1189                  [-U symbol] [-U symbol=]
1190   -d : use defaults for all answers.
1191   -e : go on without questioning past the production of config.sh.
1192   -f : specify an alternate default configuration file.
1193   -h : print this help message and exit (with an error status).
1194   -r : reuse C symbols value if possible (skips costly nm extraction).
1195   -s : silent mode, only echoes questions and essential information.
1196   -D : define symbol to have some value:
1197          -D symbol         symbol gets the value 'define'
1198          -D symbol=value   symbol gets the value 'value'
1199   -E : stop at the end of questions, after having produced config.sh.
1200   -K : do not use unless you know what you are doing.
1201   -O : let -D and -U override definitions from loaded configuration file.
1202   -S : perform variable substitutions on all .SH files (can mix with -f)
1203   -U : undefine symbol:
1204          -U symbol    symbol gets the value 'undef'
1205          -U symbol=   symbol gets completely empty
1206   -V : print version number and exit (with a zero status).
1207 EOM
1208         exit 1
1209         ;;
1210 esac
1211
1212 : Sanity checks
1213 case "$fastread$alldone" in
1214 yescont|yesexit) ;;
1215 *)
1216         if test ! -t 0; then
1217                 echo "Say 'sh Configure', not 'sh <Configure'"
1218                 exit 1
1219         fi
1220         ;;
1221 esac
1222
1223 exec 4>&1
1224 case "$silent" in
1225 true) exec 1>/dev/null;;
1226 esac
1227
1228 : run the defines and the undefines, if any, but leave the file out there...
1229 touch optdef.sh
1230 . ./optdef.sh
1231
1232 : set package name
1233 package=perl5
1234 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1235 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1236 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1237 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1238 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1239 esac
1240
1241 : Some greps do not return status, grrr.
1242 echo "grimblepritz" >grimble
1243 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1244         contains=contains
1245 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1246         contains=grep
1247 else
1248         contains=contains
1249 fi
1250 rm -f grimble
1251 : the following should work in any shell
1252 case "$contains" in
1253 contains*)
1254         echo " "
1255         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1256         cat >contains <<'EOSS'
1257 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1258 EOSS
1259 chmod +x contains
1260 esac
1261
1262 : Find the path to the source tree
1263 case "$src" in
1264 '') case "$0" in
1265     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;;
1266     *)   src='.';;
1267     esac;;
1268 esac
1269 case "$src" in
1270 '')     src=/
1271         rsrc=/
1272         ;;
1273 /*) rsrc="$src";;
1274 *) rsrc="../$src";;
1275 esac
1276 if test -f $rsrc/Configure && \
1277         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1278 then
1279    : found it, so we are ok.
1280 else
1281         rsrc=''
1282         for src in . .. ../.. ../../.. ../../../..; do
1283                 if test -f ../$src/Configure && \
1284                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1285                 then
1286                         rsrc=../$src
1287                         break
1288                 fi
1289         done
1290 fi
1291 case "$rsrc" in
1292 '')
1293         cat <<EOM >&4
1294
1295 Sorry, I can't seem to locate the source dir for $package.  Please start
1296 Configure with an explicit path -- i.e. /some/path/Configure.
1297
1298 EOM
1299         exit 1
1300         ;;
1301 ../.)   rsrc='..';;
1302 *)
1303         echo " "
1304         echo "Sources for $package found in \"$src\"." >&4
1305         ;;
1306 esac
1307
1308 : script used to extract .SH files with variable substitutions
1309 cat >extract <<'EOS'
1310 CONFIG=true
1311 echo "Doing variable substitutions on .SH files..."
1312 if test -f $src/MANIFEST; then
1313         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1314 else
1315         echo "(Looking for .SH files under the source directory.)"
1316         set x `(cd $src; find . -name "*.SH" -print)`
1317 fi
1318 shift
1319 case $# in
1320 0) set x `(cd $src; echo *.SH)`; shift;;
1321 esac
1322 if test ! -f $src/$1; then
1323         shift
1324 fi
1325 mkdir_p='
1326 name=$1;
1327 create="";
1328 while test $name; do
1329         if test ! -d "$name"; then
1330                 create="$name $create";
1331                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1332                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1333         else
1334                 name="";
1335         fi;
1336 done;
1337 for file in $create; do
1338         mkdir $file;
1339 done
1340 '
1341 for file in $*; do
1342         case "$src" in
1343         ".")
1344                 case "$file" in
1345                 */*)
1346                         dir=`expr X$file : 'X\(.*\)/'`
1347                         file=`expr X$file : 'X.*/\(.*\)'`
1348                         (cd $dir && . ./$file)
1349                         ;;
1350                 *)
1351                         . ./$file
1352                         ;;
1353                 esac
1354                 ;;
1355         *)
1356                 case "$file" in
1357                 */*)
1358                         dir=`expr X$file : 'X\(.*\)/'`
1359                         file=`expr X$file : 'X.*/\(.*\)'`
1360                         (set x $dir; shift; eval $mkdir_p)
1361                         sh <$src/$dir/$file
1362                         ;;
1363                 *)
1364                         sh <$src/$file
1365                         ;;
1366                 esac
1367                 ;;
1368         esac
1369 done
1370 if test -f $src/config_h.SH; then
1371         if test ! -f config.h; then
1372         : oops, they left it out of MANIFEST, probably, so do it anyway.
1373         . $src/config_h.SH
1374         fi
1375 fi
1376 EOS
1377
1378 : extract files and exit if asked to do so
1379 case "$extractsh" in
1380 true)
1381         case "$realsilent" in
1382         true) ;;
1383         *) exec 1>&4;;
1384         esac
1385         case "$config_sh" in
1386         '') config_sh='config.sh';;
1387         esac
1388         echo " "
1389         echo "Fetching answers from $config_sh..."
1390         cd ..
1391         . $config_sh
1392         test "$override" && . ./optdef.sh
1393         echo " "
1394         . UU/extract
1395         rm -rf UU
1396         echo "Done."
1397         exit 0
1398         ;;
1399 esac
1400
1401 : Eunice requires " " instead of "", can you believe it
1402 echo " "
1403 : Here we go...
1404 echo "Beginning of configuration questions for $package."
1405
1406 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1407
1408 : first determine how to suppress newline on echo command
1409 echo " "
1410 echo "Checking echo to see how to suppress newlines..."
1411 (echo "hi there\c" ; echo " ") >.echotmp
1412 if $contains c .echotmp >/dev/null 2>&1 ; then
1413         echo "...using -n."
1414         n='-n'
1415         c=''
1416 else
1417         cat <<'EOM'
1418 ...using \c
1419 EOM
1420         n=''
1421         c='\c'
1422 fi
1423 echo $n "The star should be here-->$c"
1424 echo '*'
1425 rm -f .echotmp
1426
1427 : Now test for existence of everything in MANIFEST
1428 echo " "
1429 if test -f $rsrc/MANIFEST; then
1430         echo "First let's make sure your kit is complete.  Checking..." >&4
1431         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1432         rm -f missing
1433         tmppwd=`pwd`
1434         for filelist in x??; do
1435                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1436         done
1437         if test -s missing; then
1438                 cat missing >&4
1439                 cat >&4 <<'EOM'
1440
1441 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1442
1443 You have the option of continuing the configuration process, despite the
1444 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1445 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1446 and contact the author (perlbug@perl.com).
1447
1448 EOM
1449                 echo $n "Continue? [n] $c" >&4
1450                 read ans
1451                 case "$ans" in
1452                 y*)
1453                         echo "Continuing..." >&4
1454                         rm -f missing
1455                         ;;
1456                 *)
1457                         echo "ABORTING..." >&4
1458                         kill $$
1459                         ;;
1460                 esac
1461         else
1462                 echo "Looks good..."
1463         fi
1464 else
1465         echo "There is no MANIFEST file.  I hope your kit is complete !"
1466 fi
1467 rm -f missing x??
1468
1469 echo " "
1470 : Find the appropriate value for a newline for tr
1471 if test -n "$DJGPP"; then
1472        trnl='\012'
1473 fi
1474 if test X"$trnl" = X; then
1475         case "`echo foo|tr '\n' x 2>/dev/null`" in
1476         foox) trnl='\n' ;;
1477         esac
1478 fi
1479 if test X"$trnl" = X; then
1480         case "`echo foo|tr '\012' x 2>/dev/null`" in
1481         foox) trnl='\012' ;;
1482         esac
1483 fi
1484 if test X"$trnl" = X; then
1485         cat <<EOM >&2
1486
1487 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1488
1489 EOM
1490         exit 1
1491 fi
1492
1493 : compute the number of columns on the terminal for proper question formatting
1494 case "$COLUMNS" in
1495 '') COLUMNS='80';;
1496 esac
1497
1498 : set up the echo used in my read
1499 myecho="case \"\$xxxm\" in
1500 '') echo $n \"\$rp $c\" >&4;;
1501 *) case \"\$rp\" in
1502         '') echo $n \"[\$xxxm] $c\";;
1503         *)
1504                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1505                         echo \"\$rp\" >&4
1506                         echo $n \"[\$xxxm] $c\" >&4
1507                 else
1508                         echo $n \"\$rp [\$xxxm] $c\" >&4
1509                 fi
1510                 ;;
1511         esac;;
1512 esac"
1513
1514 : now set up to do reads with possible shell escape and default assignment
1515 cat <<EOSC >myread
1516 $startsh
1517 xxxm=\$dflt
1518 $myecho
1519 ans='!'
1520 case "\$fastread" in
1521 yes) case "\$dflt" in
1522         '') ;;
1523         *) ans='';
1524                 case "\$silent-\$rp" in
1525                 true-) ;;
1526                 *) echo " " >&4;;
1527                 esac;;
1528         esac;;
1529 *) case "\$silent" in
1530         true) case "\$rp" in
1531                 '') ans='';;
1532                 esac;;
1533         esac;;
1534 esac
1535 while expr "X\$ans" : "X!" >/dev/null; do
1536         read answ
1537         set x \$xxxm
1538         shift
1539         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1540         case  "\$answ" in
1541         "!")
1542                 sh 1>&4
1543                 echo " "
1544                 $myecho
1545                 ;;
1546         !*)
1547                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1548                 shift
1549                 sh 1>&4 -c "\$*"
1550                 echo " "
1551                 $myecho
1552                 ;;
1553         "\$ans")
1554                 case "\$ans" in
1555                 \\&*)
1556                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1557                         shift
1558                         case "\$1" in
1559                         -d)
1560                                 fastread=yes
1561                                 echo "(OK, I'll run with -d after this question.)" >&4
1562                                 ;;
1563                         -*)
1564                                 echo "*** Sorry, \$1 not supported yet." >&4
1565                                 ;;
1566                         esac
1567                         $myecho
1568                         ans=!
1569                         ;;
1570                 esac;;
1571         *)
1572                 case "\$aok" in
1573                 y)
1574                         echo "*** Substitution done -- please confirm."
1575                         xxxm="\$ans"
1576                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1577                         xxxm="\$ans"
1578                         ans=!
1579                         ;;
1580                 *)
1581                         echo "*** Error -- try again."
1582                         ans=!
1583                         ;;
1584                 esac
1585                 $myecho
1586                 ;;
1587         esac
1588         case "\$ans\$xxxm\$nostick" in
1589         '')
1590                 ans=!
1591                 $myecho
1592                 ;;
1593         esac
1594 done
1595 case "\$ans" in
1596 '') ans="\$xxxm";;
1597 esac
1598 EOSC
1599
1600 : create .config dir to save info across Configure sessions
1601 test -d ../.config || mkdir ../.config
1602 cat >../.config/README <<EOF
1603 This directory created by Configure to save information that should
1604 persist across sessions for $package.
1605
1606 You may safely delete it if you wish.
1607 EOF
1608
1609 : general instructions
1610 needman=true
1611 firsttime=true
1612 user=`(logname) 2>/dev/null`
1613 case "$user" in
1614 '') user=`whoami 2>&1`;;
1615 esac
1616 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1617         firsttime=false
1618         echo " "
1619         rp='Would you like to see the instructions?'
1620         dflt=n
1621         . ./myread
1622         case "$ans" in
1623         [yY]*) ;;
1624         *) needman=false;;
1625         esac
1626 fi
1627 if $needman; then
1628         cat <<EOH
1629
1630 This installation shell script will examine your system and ask you questions
1631 to determine how the perl5 package should be installed. If you get
1632 stuck on a question, you may use a ! shell escape to start a subshell or
1633 execute a command.  Many of the questions will have default answers in square
1634 brackets; typing carriage return will give you the default.
1635
1636 On some of the questions which ask for file or directory names you are allowed
1637 to use the ~name construct to specify the login directory belonging to "name",
1638 even if you don't have a shell which knows about that.  Questions where this is
1639 allowed will be marked "(~name ok)".
1640
1641 EOH
1642         rp=''
1643         dflt='Type carriage return to continue'
1644         . ./myread
1645         cat <<'EOH'
1646
1647 The prompter used in this script allows you to use shell variables and
1648 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1649 in the default answer, as if the default line was a set of arguments given to a
1650 script shell.  This means you may also use $* to repeat the whole default line,
1651 so you do not have to re-type everything to add something to the default.
1652
1653 Everytime there is a substitution, you will have to confirm.  If there is an
1654 error (e.g. an unmatched backtick), the default answer will remain unchanged
1655 and you will be prompted again.
1656
1657 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1658 the questions and use the computed defaults (or the previous answers if there
1659 was already a config.sh file). Type 'Configure -h' for a list of options.
1660 You may also start interactively and then answer '& -d' at any prompt to turn
1661 on the non-interactive behaviour for the remainder of the execution.
1662
1663 EOH
1664         . ./myread
1665         cat <<EOH
1666
1667 Much effort has been expended to ensure that this shell script will run on any
1668 Unix system.  If despite that it blows up on yours, your best bet is to edit
1669 Configure and run it again.  If you can't run Configure for some reason,
1670 you'll have to generate a config.sh file by hand.  Whatever problems you
1671 have, let me (perlbug@perl.com) know how I blew it.
1672
1673 This installation script affects things in two ways:
1674
1675 1) it may do direct variable substitutions on some of the files included
1676    in this kit.
1677 2) it builds a config.h file for inclusion in C programs.  You may edit
1678    any of these files as the need arises after running this script.
1679
1680 If you make a mistake on a question, there is no easy way to back up to it
1681 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1682 files.  Configure will offer to let you do this before it runs the SH files.
1683
1684 EOH
1685         dflt='Type carriage return to continue'
1686         . ./myread
1687         case "$firsttime" in
1688         true) echo $user >>../.config/instruct;;
1689         esac
1690 fi
1691
1692 : find out where common programs are
1693 echo " "
1694 echo "Locating common programs..." >&4
1695 cat <<EOSC >loc
1696 $startsh
1697 case \$# in
1698 0) exit 1;;
1699 esac
1700 thing=\$1
1701 shift
1702 dflt=\$1
1703 shift
1704 for dir in \$*; do
1705         case "\$thing" in
1706         .)
1707         if test -d \$dir/\$thing; then
1708                 echo \$dir
1709                 exit 0
1710         fi
1711         ;;
1712         *)
1713         for thisthing in \$dir/\$thing; do
1714                 : just loop through to pick last item
1715         done
1716         if test -f \$thisthing; then
1717                 echo \$thisthing
1718                 exit 0
1719         elif test -f \$dir/\$thing.exe; then
1720                 if test -n "$DJGPP"; then
1721                         echo \$dir/\$thing.exe
1722                 else
1723                         : on Eunice apparently
1724                         echo \$dir/\$thing
1725                 fi
1726                 exit 0
1727         fi
1728         ;;
1729         esac
1730 done
1731 echo \$dflt
1732 exit 1
1733 EOSC
1734 chmod +x loc
1735 $eunicefix loc
1736 loclist="
1737 awk
1738 cat
1739 comm
1740 cp
1741 echo
1742 expr
1743 grep
1744 ls
1745 make
1746 mkdir
1747 rm
1748 sed
1749 sort
1750 touch
1751 tr
1752 uniq
1753 "
1754 trylist="
1755 Mcc
1756 ar
1757 byacc
1758 cpp
1759 csh
1760 date
1761 egrep
1762 gzip
1763 less
1764 ln
1765 more
1766 nm
1767 nroff
1768 pg
1769 tee
1770 test
1771 uname
1772 zip
1773 "
1774 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1775 pth="$pth /lib /usr/lib"
1776 for file in $loclist; do
1777         eval xxx=\$$file
1778         case "$xxx" in
1779         /*|?:[\\/]*)
1780                 if test -f "$xxx"; then
1781                         : ok
1782                 else
1783                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1784                         xxx=`./loc $file $file $pth`
1785                 fi
1786                 ;;
1787         '') xxx=`./loc $file $file $pth`;;
1788         *) xxx=`./loc $xxx $xxx $pth`;;
1789         esac
1790         eval $file=$xxx
1791         eval _$file=$xxx
1792         case "$xxx" in
1793         /*)
1794                 echo $file is in $xxx.
1795                 ;;
1796         ?:[\\/]*)
1797                 echo $file is in $xxx.
1798                 ;;
1799         *)
1800                 echo "I don't know where '$file' is, and my life depends on it." >&4
1801                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1802                 exit 1
1803                 ;;
1804         esac
1805 done
1806 echo " "
1807 echo "Don't worry if any of the following aren't found..."
1808 say=offhand
1809 for file in $trylist; do
1810         eval xxx=\$$file
1811         case "$xxx" in
1812         /*|?:[\\/]*)
1813                 if test -f "$xxx"; then
1814                         : ok
1815                 else
1816                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1817                         xxx=`./loc $file $file $pth`
1818                 fi
1819                 ;;
1820         '') xxx=`./loc $file $file $pth`;;
1821         *) xxx=`./loc $xxx $xxx $pth`;;
1822         esac
1823         eval $file=$xxx
1824         eval _$file=$xxx
1825         case "$xxx" in
1826         /*)
1827                 echo $file is in $xxx.
1828                 ;;
1829         ?:[\\/]*)
1830                 echo $file is in $xxx.
1831                 ;;
1832         *)
1833                 echo "I don't see $file out there, $say."
1834                 say=either
1835                 ;;
1836         esac
1837 done
1838 case "$egrep" in
1839 egrep)
1840         echo "Substituting grep for egrep."
1841         egrep=$grep
1842         ;;
1843 esac
1844 case "$ln" in
1845 ln)
1846         echo "Substituting cp for ln."
1847         ln=$cp
1848         ;;
1849 esac
1850 case "$test" in
1851 test)
1852         echo "Hopefully test is built into your sh."
1853         ;;
1854 *)
1855         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1856                 echo "Using the test built into your sh."
1857                 test=test
1858                 _test=test
1859         fi
1860         ;;
1861 esac
1862 case "$echo" in
1863 echo)
1864         echo "Hopefully echo is built into your sh."
1865         ;;
1866 '') ;;
1867 *)
1868         echo " "
1869 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1870         $echo $n "hi there$c" >foo1
1871         echo $n "hi there$c" >foo2
1872         if cmp foo1 foo2 >/dev/null 2>&1; then
1873                 echo "They are compatible.  In fact, they may be identical."
1874         else
1875                 case "$n" in
1876                 '-n') n='' c='\c';;
1877                 *) n='-n' c='';;
1878                 esac
1879                 cat <<FOO
1880 They are not compatible!  You are probably running ksh on a non-USG system.
1881 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1882 have echo built in and we may have to run some Bourne shell scripts.  That
1883 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1884
1885 FOO
1886                 $echo $n "The star should be here-->$c"
1887                 $echo "*"
1888         fi
1889         $rm -f foo1 foo2
1890         ;;
1891 esac
1892
1893 : determine whether symbolic links are supported
1894 echo " "
1895 $touch blurfl
1896 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1897         echo "Symbolic links are supported." >&4
1898         lns="$ln -s"
1899 else
1900         echo "Symbolic links are NOT supported." >&4
1901         lns="$ln"
1902 fi
1903 $rm -f blurfl sym
1904
1905 : see whether [:lower:] and [:upper:] are supported character classes
1906 echo " "
1907 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1908 ABYZ)
1909         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1910         up='[:upper:]'
1911         low='[:lower:]'
1912         ;;
1913 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
1914         # (0xc9 and 0xd1), therefore that is a nice testing point.
1915         if test "X$up" = X -o "X$low" = X; then
1916             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
1917             ij) up='[A-Z]'
1918                 low='[a-z]'
1919                 ;;
1920             esac
1921         fi
1922         if test "X$up" = X -o "X$low" = X; then
1923             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
1924             ij) up='A-Z'
1925                 low='a-z'
1926                 ;;
1927             esac
1928         fi
1929         if test "X$up" = X -o "X$low" = X; then
1930             case "`echo IJ | od -x 2>/dev/null`" in
1931             *C9D1*|*c9d1*)
1932                 echo "Hey, this might be EBCDIC." >&4
1933                 if test "X$up" = X -o "X$low" = X; then
1934                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
1935                     ij) up='[A-IJ-RS-Z]'
1936                         low='[a-ij-rs-z]'
1937                         ;;
1938                     esac
1939                 fi
1940                 if test "X$up" = X -o "X$low" = X; then
1941                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
1942                     ij) up='A-IJ-RS-Z'
1943                         low='a-ij-rs-z'
1944                         ;;
1945                     esac
1946                 fi
1947                 ;;
1948             esac
1949         fi
1950 esac
1951 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
1952 ij)
1953     echo "Using $up and $low to convert case." >&4
1954     ;;
1955 *)
1956     echo "I don't know how to translate letters from upper to lower case." >&4
1957     echo "Your tr is not acting any way I know of." >&4
1958     exit 1
1959     ;;
1960 esac
1961 : set up the translation script tr, must be called with ./tr of course
1962 cat >tr <<EOSC
1963 $startsh
1964 case "\$1\$2" in
1965 '[A-Z][a-z]') exec $tr '$up' '$low';;
1966 '[a-z][A-Z]') exec $tr '$low' '$up';;
1967 esac
1968 exec $tr "\$@"
1969 EOSC
1970 chmod +x tr
1971 $eunicefix tr
1972
1973 : Try to determine whether config.sh was made on this system
1974 case "$config_sh" in
1975 '')
1976 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1977 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
1978 # because the A-Z/a-z are not consecutive.
1979 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1980         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1981 newmyuname="$myuname"
1982 dflt=n
1983 case "$knowitall" in
1984 '')
1985         if test -f ../config.sh; then
1986                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1987                         eval "`grep myuname= ../config.sh`"
1988                 fi
1989                 if test "X$myuname" = "X$newmyuname"; then
1990                         dflt=y
1991                 fi
1992         fi
1993         ;;
1994 *) dflt=y;;
1995 esac
1996
1997 : Get old answers from old config file if Configure was run on the
1998 : same system, otherwise use the hints.
1999 hint=default
2000 cd ..
2001 if test -f config.sh; then
2002         echo " "
2003         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2004         . UU/myread
2005         case "$ans" in
2006         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2007         *)  echo "Fetching default answers from your old config.sh file..." >&4
2008                 tmp_n="$n"
2009                 tmp_c="$c"
2010                 tmp_sh="$sh"
2011                 . ./config.sh
2012                 cp config.sh UU
2013                 n="$tmp_n"
2014                 c="$tmp_c"
2015                 : Older versions did not always set $sh.  Catch re-use of such
2016                 : an old config.sh.
2017                 case "$sh" in
2018                 '') sh="$tmp_sh" ;;
2019                 esac
2020                 hint=previous
2021                 ;;
2022         esac
2023 fi
2024 if test ! -f config.sh; then
2025         $cat <<EOM
2026
2027 First time through, eh?  I have some defaults handy for some systems
2028 that need some extra help getting the Configure answers right:
2029
2030 EOM
2031         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2032         dflt=''
2033         : Half the following guesses are probably wrong... If you have better
2034         : tests or hints, please send them to perlbug@perl.com
2035         : The metaconfig authors would also appreciate a copy...
2036         $test -f /irix && osname=irix
2037         $test -f /xenix && osname=sco_xenix
2038         $test -f /dynix && osname=dynix
2039         $test -f /dnix && osname=dnix
2040         $test -f /lynx.os && osname=lynxos
2041         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2042         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2043         $test -f /bin/mips && /bin/mips && osname=mips
2044         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2045                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2046         $test -d /usr/apollo/bin && osname=apollo
2047         $test -f /etc/saf/_sactab && osname=svr4
2048         $test -d /usr/include/minix && osname=minix
2049         if $test -d /MachTen -o -d /MachTen_Folder; then
2050                 osname=machten
2051                 if $test -x /sbin/version; then
2052                         osvers=`/sbin/version | $awk '{print $2}' |
2053                         $sed -e 's/[A-Za-z]$//'`
2054                 elif $test -x /usr/etc/version; then
2055                         osvers=`/usr/etc/version | $awk '{print $2}' |
2056                         $sed -e 's/[A-Za-z]$//'`
2057                 else
2058                         osvers="$2.$3"
2059                 fi
2060         fi
2061        $test -f /sys/posix.dll &&
2062                $test -f /usr/bin/what &&
2063                set X `/usr/bin/what /sys/posix.dll` &&
2064                $test "$3" = UWIN &&
2065                osname=uwin &&
2066                osvers="$5"
2067         if $test -f $uname; then
2068                 set X $myuname
2069                 shift
2070
2071                 case "$5" in
2072                 fps*) osname=fps ;;
2073                 mips*)
2074                         case "$4" in
2075                         umips) osname=umips ;;
2076                         *) osname=mips ;;
2077                         esac;;
2078                 [23]100) osname=mips ;;
2079                 next*) osname=next ;;
2080                 i386*)
2081                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2082                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2083                                 osname='sco'
2084                                 osvers=$tmp
2085                         elif $test -f /etc/kconfig; then
2086                                 osname=isc
2087                                 if test "$lns" = "ln -s"; then
2088                                         osvers=4
2089                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2090                                         osvers=3
2091                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2092                                         osvers=2
2093                                 fi
2094                         fi
2095                         unset tmp
2096                         ;;
2097                 pc*)
2098                         if test -n "$DJGPP"; then
2099                                 osname=dos
2100                                 osvers=djgpp
2101                         fi
2102                         ;;
2103                 esac
2104
2105                 case "$1" in
2106                 aix) osname=aix
2107                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2108                         case "$tmp" in
2109                         'not found') osvers="$4"."$3" ;;
2110                         '<3240'|'<>3240') osvers=3.2.0 ;;
2111                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2112                         '=3250'|'>3250') osvers=3.2.5 ;;
2113                         *) osvers=$tmp;;
2114                         esac
2115                         ;;
2116                 *dc.osx) osname=dcosx
2117                         osvers="$3"
2118                         ;;
2119                 dnix) osname=dnix
2120                         osvers="$3"
2121                         ;;
2122                 domainos) osname=apollo
2123                         osvers="$3"
2124                         ;;
2125                 dgux) osname=dgux 
2126                         osvers="$3"
2127                         ;;
2128                 dynixptx*) osname=dynixptx
2129                         osvers=`echo "$4"|sed 's/^v//'`
2130                         ;;
2131                 freebsd) osname=freebsd 
2132                         osvers="$3" ;;
2133                 genix) osname=genix ;;
2134                 hp*) osname=hpux 
2135                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2136                         ;;
2137                 irix*) osname=irix
2138                         case "$3" in
2139                         4*) osvers=4 ;;
2140                         5*) osvers=5 ;;
2141                         *)      osvers="$3" ;;
2142                         esac
2143                         ;;
2144                 linux) osname=linux
2145                         case "$3" in
2146                         *)      osvers="$3" ;;
2147                         esac
2148                         ;;
2149                 MiNT) osname=mint
2150                         ;;
2151                 netbsd*) osname=netbsd
2152                         osvers="$3"
2153                         ;;
2154                 news-os) osvers="$3"
2155                         case "$3" in
2156                         4*) osname=newsos4 ;;
2157                         *) osname=newsos ;;
2158                         esac
2159                         ;;
2160                 bsd386) osname=bsd386
2161                         osvers=`$uname -r`
2162                         ;;
2163                 POSIX-BC | posix-bc ) osname=posix-bc
2164                         osvers="$3"
2165                         ;;
2166                 powerux | power_ux | powermax_os | powermaxos | \
2167                 powerunix | power_unix) osname=powerux
2168                         osvers="$3"
2169                         ;;
2170                 next*) osname=next ;;
2171                 solaris) osname=solaris
2172                         case "$3" in
2173                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2174                         *)      osvers="$3" ;;
2175                         esac
2176                         ;;
2177                 sunos) osname=sunos
2178                         case "$3" in
2179                         5*) osname=solaris
2180                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2181                         *)      osvers="$3" ;;
2182                         esac
2183                         ;;
2184                 titanos) osname=titanos
2185                         case "$3" in
2186                         1*) osvers=1 ;;
2187                         2*) osvers=2 ;;
2188                         3*) osvers=3 ;;
2189                         4*) osvers=4 ;;
2190                         *)      osvers="$3" ;;
2191                         esac
2192                         ;;
2193                 ultrix) osname=ultrix
2194                         osvers="$3"
2195                         ;;
2196                 osf1|mls+)      case "$5" in
2197                                 alpha)
2198                                         osname=dec_osf
2199                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2200                                         ;;
2201                         hp*)    osname=hp_osf1  ;;
2202                         mips)   osname=mips_osf1 ;;
2203                         esac
2204                         ;;
2205                 uts) osname=uts 
2206                         osvers="$3"
2207                         ;;
2208                 qnx) osname=qnx
2209                         osvers="$4"
2210                         ;;
2211                 $2) case "$osname" in
2212                         *isc*) ;;
2213                         *freebsd*) ;;
2214                         svr*)
2215                                 : svr4.x or possibly later
2216                                 case "svr$3" in 
2217                                 ${osname}*)
2218                                         osname=svr$3
2219                                         osvers=$4
2220                                         ;;
2221                                 esac
2222                                 case "$osname" in
2223                                 svr4.0)
2224                                         : Check for ESIX
2225                                         if test -f /stand/boot ; then
2226                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2227                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2228                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2229                                                         if test -n "$isesix"; then
2230                                                                 osname=esix4
2231                                                         fi
2232                                                 fi
2233                                         fi
2234                                         ;;
2235                                 esac
2236                                 ;;
2237                         *)      if test -f /etc/systemid; then
2238                                         osname=sco
2239                                         set `echo $3 | $sed 's/\./ /g'` $4
2240                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2241                                                 osvers=$1.$2.$3
2242                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2243                                                 osvers=$1.$2
2244                                         elif $test -f $src/hints/sco_$1.sh; then
2245                                                 osvers=$1
2246                                         fi
2247                                 else
2248                                         case "$osname" in
2249                                         '') : Still unknown.  Probably a generic Sys V.
2250                                                 osname="sysv"
2251                                                 osvers="$3"
2252                                                 ;;
2253                                         esac
2254                                 fi
2255                                 ;;
2256                         esac
2257                         ;;
2258                 *)      case "$osname" in
2259                         '') : Still unknown.  Probably a generic BSD.
2260                                 osname="$1"
2261                                 osvers="$3"
2262                                 ;;
2263                         esac
2264                         ;;
2265                 esac
2266         else
2267                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2268                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2269                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2270                                 osname=news_os
2271                         fi
2272                         $rm -f UU/kernel.what
2273                 elif test -d c:/.; then
2274                         set X $myuname
2275                         osname=os2
2276                         osvers="$5"
2277                 fi
2278         fi
2279         
2280         : Now look for a hint file osname_osvers, unless one has been
2281         : specified already.
2282         case "$hintfile" in
2283         ''|' ')
2284                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2285                 : Also try without trailing minor version numbers.
2286                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2287                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2288                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2289                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2290                 case "$file" in
2291                 '') dflt=none ;;
2292                 *)  case "$osvers" in
2293                         '') dflt=$file
2294                                 ;;
2295                         *)  if $test -f $src/hints/$file.sh ; then
2296                                         dflt=$file
2297                                 elif $test -f $src/hints/$xfile.sh ; then
2298                                         dflt=$xfile
2299                                 elif $test -f $src/hints/$xxfile.sh ; then
2300                                         dflt=$xxfile
2301                                 elif $test -f $src/hints/$xxxfile.sh ; then
2302                                         dflt=$xxxfile
2303                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2304                                         dflt=$xxxxfile
2305                                 elif $test -f "$src/hints/${osname}.sh" ; then
2306                                         dflt="${osname}"
2307                                 else
2308                                         dflt=none
2309                                 fi
2310                                 ;;
2311                         esac
2312                         ;;
2313                 esac
2314                 if $test -f Policy.sh ; then
2315                         case "$dflt" in
2316                         *Policy*) ;;
2317                         none) dflt="Policy" ;;
2318                         *) dflt="Policy $dflt" ;;
2319                         esac
2320                 fi
2321                 ;;
2322         *)
2323                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2324                 ;;
2325         esac
2326
2327         if $test -f Policy.sh ; then
2328                 $cat <<EOM
2329
2330 There's also a Policy hint file available, which should make the
2331 site-specific (policy) questions easier to answer.
2332 EOM
2333
2334         fi
2335
2336         $cat <<EOM
2337
2338 You may give one or more space-separated answers, or "none" if appropriate.
2339 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2340 is a good thing.  DO NOT give a wrong version.
2341
2342 EOM
2343
2344         rp="Which of these apply, if any?"
2345         . UU/myread
2346         tans=$ans
2347         for file in $tans; do
2348                 if $test X$file = XPolicy -a -f Policy.sh; then
2349                         . Policy.sh
2350                         $cat Policy.sh >> UU/config.sh
2351                 elif $test -f $src/hints/$file.sh; then
2352                         . $src/hints/$file.sh
2353                         $cat $src/hints/$file.sh >> UU/config.sh
2354                 elif $test X$tans = X -o X$tans = Xnone ; then
2355                         : nothing
2356                 else
2357                         : Give one chance to correct a possible typo.
2358                         echo "$file.sh does not exist"
2359                         dflt=$file
2360                         rp="hint to use instead?"
2361                         . UU/myread
2362                         for file in $ans; do
2363                                 if $test -f "$src/hints/$file.sh"; then
2364                                         . $src/hints/$file.sh
2365                                         $cat $src/hints/$file.sh >> UU/config.sh
2366                                 elif $test X$ans = X -o X$ans = Xnone ; then
2367                                         : nothing
2368                                 else
2369                                         echo "$file.sh does not exist -- ignored."
2370                                 fi
2371                         done
2372                 fi
2373         done
2374
2375         hint=recommended
2376         : Remember our hint file for later.
2377         if $test -f "$src/hints/$file.sh" ; then
2378                 hintfile="$file"
2379         else
2380                 hintfile=''
2381         fi
2382 fi
2383 cd UU
2384 ;;
2385 *)
2386         echo " "
2387         echo "Fetching default answers from $config_sh..." >&4
2388         tmp_n="$n"
2389         tmp_c="$c"
2390         cd ..
2391         cp $config_sh config.sh 2>/dev/null
2392         chmod +w config.sh
2393         . ./config.sh
2394         cd UU
2395         cp ../config.sh .
2396         n="$tmp_n"
2397         c="$tmp_c"
2398         hint=previous
2399         ;;
2400 esac
2401 test "$override" && . ./optdef.sh
2402 myuname="$newmyuname"
2403
2404 : Restore computed paths
2405 for file in $loclist $trylist; do
2406         eval $file="\$_$file"
2407 done
2408
2409 cat << EOM
2410
2411 Configure uses the operating system name and version to set some defaults.
2412 The default value is probably right if the name rings a bell. Otherwise,
2413 since spelling matters for me, either accept the default or answer "none"
2414 to leave it blank.
2415
2416 EOM
2417 case "$osname" in
2418         ''|' ')
2419                 case "$hintfile" in
2420                 ''|' '|none) dflt=none ;;
2421                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2422                 esac
2423                 ;;
2424         *) dflt="$osname" ;;
2425 esac
2426 rp="Operating system name?"
2427 . ./myread
2428 case "$ans" in
2429 none)  osname='' ;;
2430 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2431 esac
2432 echo " "
2433 case "$osvers" in
2434         ''|' ')
2435                 case "$hintfile" in
2436                 ''|' '|none) dflt=none ;;
2437                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2438                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2439                         case "$dflt" in
2440                         ''|' ') dflt=none ;;
2441                         esac
2442                         ;;
2443                 esac
2444                 ;;
2445         *) dflt="$osvers" ;;
2446 esac
2447 rp="Operating system version?"
2448 . ./myread
2449 case "$ans" in
2450 none)  osvers='' ;;
2451 *) osvers="$ans" ;;
2452 esac
2453
2454 : who configured the system
2455 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2456 cf_by=`(logname) 2>/dev/null`
2457 case "$cf_by" in
2458 "")
2459         cf_by=`(whoami) 2>/dev/null`
2460         case "$cf_by" in
2461         "") cf_by=unknown ;;
2462         esac ;;
2463 esac
2464
2465 : set up the script used to warn in case of inconsistency
2466 cat <<EOS >whoa
2467 $startsh
2468 EOS
2469 cat <<'EOSC' >>whoa
2470 dflt=y
2471 echo " "
2472 echo "*** WHOA THERE!!! ***" >&4
2473 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2474 rp="    Keep the $hint value?"
2475 . ./myread
2476 case "$ans" in
2477 y) td=$was; tu=$was;;
2478 esac
2479 EOSC
2480
2481 : function used to set $1 to $val
2482 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2483 case "$val$was" in
2484 $define$undef) . ./whoa; eval "$var=\$td";;
2485 $undef$define) . ./whoa; eval "$var=\$tu";;
2486 *) eval "$var=$val";;
2487 esac'
2488
2489 cat <<EOM
2490
2491 Perl can be built to take advantage of threads, on some systems.
2492 To do so, Configure must be run with -Dusethreads.
2493
2494 Note that threading is a highly experimental feature, and
2495 some known race conditions still remain.  If you choose to try
2496 it, be very sure to not actually deploy it for production
2497 purposes.  README.threads has more details, and is required
2498 reading if you enable threads.
2499 EOM
2500 case "$usethreads" in
2501 $define|true|[yY]*)     dflt='y';;
2502 *) dflt='n';;
2503 esac
2504 rp='Build a threading Perl?'
2505 . ./myread
2506 case "$ans" in
2507 y|Y)    val="$define" ;;     
2508 *)      val="$undef" ;;
2509 esac
2510 set usethreads
2511 eval $setvar 
2512
2513 case "$d_oldpthreads" in
2514 '')     : Configure tests would be welcome here.  For now, assume undef.
2515         val="$undef" ;;
2516 *)      val="$d_oldpthreads" ;;
2517 esac
2518 set d_oldpthreads
2519 eval $setvar
2520
2521
2522 case "$usethreads" in
2523 "$define"|true|[yY]*)
2524 : Look for a hint-file generated 'call-back-unit'.  If the
2525 : user has specified that a threading perl is to be built,
2526 : we may need to set or change some other defaults.
2527         if $test -f usethreads.cbu; then
2528                 . ./usethreads.cbu
2529         fi
2530         case "$osname" in
2531         aix|dec_osf|dos_djgpp|freebsd|hpux|irix|linux|openbsd|os2|solaris|vmesa)
2532                 # Known thread-capable platforms.
2533                 ;;
2534         *)
2535                 cat >&4 <<EOM
2536 $osname is not known to support threads.
2537 Please let perlbug@perl.com know how to do that.
2538
2539 Cannot continue, aborting.
2540 EOM
2541                 exit 1
2542         ;;
2543         esac # $osname
2544     ;;
2545 esac # $usethreads
2546
2547 cat <<EOM
2548
2549 Perl can be built so that multiple Perl interpreters can coexist
2550 within the same Perl executable.  To do so, Configure must be run with
2551 -Dusemultiplicity.
2552
2553 Normally you do not need this and you should answer no.
2554
2555 EOM
2556 case "$usemultiplicity" in
2557 $define|true|[yY]*)     dflt='y';;
2558 *) dflt='n';;
2559 esac
2560 rp='Build Perl for multiplicity?'
2561 . ./myread
2562 case "$ans" in
2563 y|Y)    val="$define" ;;     
2564 *)      val="$undef" ;;
2565 esac
2566 set usemultiplicity
2567 eval $setvar 
2568
2569 cat <<EOM
2570
2571 Perl can be built to take advantage of explicit 64-bit interfaces,
2572 on some systems.  To do so, Configure must be run with -Duse64bits.
2573
2574 If this doesn't make any sense to you, just accept the default 'n'.
2575 EOM
2576 case "$use64bits" in
2577 $define|true|[yY]*)     dflt='y';;
2578 *) dflt='n';;
2579 esac
2580 rp='Try to use explicit 64-bit interfaces, if available?'
2581 . ./myread
2582 case "$ans" in
2583 y|Y) 
2584         val="$define"
2585         ;;     
2586 *)      
2587         val="$undef"
2588         ;;
2589 esac
2590 set use64bits
2591 eval $setvar
2592
2593 case "$archname64" in
2594 '') archname64='' ;;    # not a typo
2595 esac
2596
2597 case "$use64bits" in
2598 "$define"|true|[yY]*)
2599 : Look for a hint-file generated 'call-back-unit'.  If the
2600 : user has specified that a threading perl is to be built,
2601 : we may need to set or change some other defaults.
2602         if $test -f use64bits.cbu; then
2603                 . ./use64bits.cbu
2604         fi
2605         case "$osname" in
2606         dec_osf|hpux|irix|solaris|unicos)
2607                 # Known 64-bit capable platforms.
2608                 ;;
2609         *)
2610                 cat >&4 <<EOM
2611 $osname is not known to support 64-bit interfaces.
2612 Please let perlbug@perl.com know how to do that.
2613
2614 Cannot continue, aborting.
2615 EOM
2616                 exit 1
2617                 ;;
2618         esac
2619         ;;
2620 esac
2621
2622 : determine the architecture name
2623 echo " "
2624 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
2625         tarch=`arch`"-$osname"
2626 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
2627         if uname -m > tmparch 2>&1 ; then
2628                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
2629                         -e 's/$/'"-$osname/" tmparch`
2630         else
2631                 tarch="$osname"
2632         fi
2633         $rm -f tmparch
2634 else
2635         tarch="$osname"
2636 fi
2637 case "$myarchname" in
2638 ''|"$tarch") ;;
2639 *)
2640         echo "(Your architecture name used to be $myarchname.)"
2641         archname=''
2642         ;;
2643 esac
2644 myarchname="$tarch"
2645 case "$archname" in
2646 '') dflt="$tarch";;
2647 *) dflt="$archname";;
2648 esac
2649 rp='What is your architecture name'
2650 . ./myread
2651 archname="$ans"
2652 case "$usethreads" in
2653 $define)
2654         echo "Threads selected." >&4
2655         case "$archname" in
2656         *-thread*) echo "...and architecture name already has -thread." >&4
2657                 ;;
2658         *)      archname="$archname-thread"
2659                 echo "...setting architecture name to $archname." >&4
2660                 ;;
2661         esac
2662         ;;
2663 esac
2664 case "$usemultiplicity" in
2665 $define)
2666         echo "Multiplicity selected." >&4
2667         case "$archname" in
2668         *-multi*) echo "...and architecture name already has -multi." >&4
2669                 ;;
2670         *)      archname="$archname-multi"
2671                 echo "...setting architecture name to $archname." >&4
2672                 ;;
2673         esac
2674         ;;
2675 esac
2676 case "$use64bits" in
2677 $define)
2678         echo "Explicit 64-bitness selected." >&4
2679         case "$archname64" in
2680         '')
2681                 ;;
2682         *)
2683                 case "$archname" in
2684                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
2685                         ;;
2686                 *)      archname="$archname-$archname64"
2687                         echo "...setting architecture name to $archname." >&4
2688                         ;;
2689                 esac
2690                 ;;
2691         esac
2692 esac
2693
2694 : is AFS running?
2695 echo " "
2696 case "$afs" in
2697 $define|true)   afs=true ;;
2698 $undef|false)   afs=false ;;
2699 *)      if test -d /afs; then
2700                 afs=true
2701         else
2702                 afs=false
2703         fi
2704         ;;
2705 esac
2706 if $afs; then
2707         echo "AFS may be running... I'll be extra cautious then..." >&4
2708 else
2709         echo "AFS does not seem to be running..." >&4
2710 fi
2711
2712 : decide how portable to be.  Allow command line overrides.
2713 case "$d_portable" in
2714 "$undef") ;;
2715 *)      d_portable="$define" ;;
2716 esac
2717
2718 : set up shell script to do ~ expansion
2719 cat >filexp <<EOSS
2720 $startsh
2721 : expand filename
2722 case "\$1" in
2723  ~/*|~)
2724         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2725         ;;
2726  ~*)
2727         if $test -f /bin/csh; then
2728                 /bin/csh -f -c "glob \$1"
2729                 failed=\$?
2730                 echo ""
2731                 exit \$failed
2732         else
2733                 name=\`$expr x\$1 : '..\([^/]*\)'\`
2734                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2735                 if $test ! -d "\$dir"; then
2736                         me=\`basename \$0\`
2737                         echo "\$me: can't locate home directory for: \$name" >&2
2738                         exit 1
2739                 fi
2740                 case "\$1" in
2741                 */*)
2742                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2743                         ;;
2744                 *)
2745                         echo \$dir
2746                         ;;
2747                 esac
2748         fi
2749         ;;
2750 *)
2751         echo \$1
2752         ;;
2753 esac
2754 EOSS
2755 chmod +x filexp
2756 $eunicefix filexp
2757
2758 : now set up to get a file name
2759 cat <<EOS >getfile
2760 $startsh
2761 EOS
2762 cat <<'EOSC' >>getfile
2763 tilde=''
2764 fullpath=''
2765 already=''
2766 skip=''
2767 none_ok=''
2768 exp_file=''
2769 nopath_ok=''
2770 orig_rp="$rp"
2771 orig_dflt="$dflt"
2772
2773 case "$fn" in
2774 *\(*)
2775         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
2776         fn=`echo $fn | sed 's/(.*)//'`
2777         ;;
2778 esac
2779
2780 case "$fn" in
2781 *:*)
2782         loc_file=`expr $fn : '.*:\(.*\)'`
2783         fn=`expr $fn : '\(.*\):.*'`
2784         ;;
2785 esac
2786
2787 case "$fn" in
2788 *~*) tilde=true;;
2789 esac
2790 case "$fn" in
2791 */*) fullpath=true;;
2792 esac
2793 case "$fn" in
2794 *+*) skip=true;;
2795 esac
2796 case "$fn" in
2797 *n*) none_ok=true;;
2798 esac
2799 case "$fn" in
2800 *e*) exp_file=true;;
2801 esac
2802 case "$fn" in
2803 *p*) nopath_ok=true;;
2804 esac
2805
2806 case "$fn" in
2807 *f*) type='File';;
2808 *d*) type='Directory';;
2809 *l*) type='Locate';;
2810 esac
2811
2812 what="$type"
2813 case "$what" in
2814 Locate) what='File';;
2815 esac
2816
2817 case "$exp_file" in
2818 '')
2819         case "$d_portable" in
2820         "$define") ;;
2821         *) exp_file=true;;
2822         esac
2823         ;;
2824 esac
2825
2826 cd ..
2827 while test "$type"; do
2828         redo=''
2829         rp="$orig_rp"
2830         dflt="$orig_dflt"
2831         case "$tilde" in
2832         true) rp="$rp (~name ok)";;
2833         esac
2834         . UU/myread
2835         if test -f UU/getfile.ok && \
2836                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2837         then
2838                 value="$ans"
2839                 ansexp="$ans"
2840                 break
2841         fi
2842         case "$ans" in
2843         none)
2844                 value=''
2845                 ansexp=''
2846                 case "$none_ok" in
2847                 true) type='';;
2848                 esac
2849                 ;;
2850         *)
2851                 case "$tilde" in
2852                 '') value="$ans"
2853                         ansexp="$ans";;
2854                 *)
2855                         value=`UU/filexp $ans`
2856                         case $? in
2857                         0)
2858                                 if test "$ans" != "$value"; then
2859                                         echo "(That expands to $value on this system.)"
2860                                 fi
2861                                 ;;
2862                         *) value="$ans";;
2863                         esac
2864                         ansexp="$value"
2865                         case "$exp_file" in
2866                         '') value="$ans";;
2867                         esac
2868                         ;;
2869                 esac
2870                 case "$fullpath" in
2871                 true)
2872                         case "$ansexp" in
2873                         /*) value="$ansexp" ;;
2874                         *)
2875                                 redo=true
2876                                 case "$already" in
2877                                 true)
2878                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
2879                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
2880                                         ;;
2881                                 *)
2882                                 echo "Please give a full path name, starting with slash." >&4
2883                                         case "$tilde" in
2884                                         true)
2885                                 echo "Note that using ~name is ok provided it expands well." >&4
2886                                                 already=true
2887                                                 ;;
2888                                         esac
2889                                 esac
2890                                 ;;
2891                         esac
2892                         ;;
2893                 esac
2894                 case "$redo" in
2895                 '')
2896                         case "$type" in
2897                         File)
2898                                 if test -f "$ansexp"; then
2899                                         type=''
2900                                 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2901                                 then
2902                                         echo "($value is not a plain file, but that's ok.)"
2903                                         type=''
2904                                 fi
2905                                 ;;
2906                         Directory)
2907                                 if test -d "$ansexp"; then
2908                                         type=''
2909                                 fi
2910                                 ;;
2911                         Locate)
2912                                 if test -d "$ansexp"; then
2913                                         echo "(Looking for $loc_file in directory $value.)"
2914                                         value="$value/$loc_file"
2915                                         ansexp="$ansexp/$loc_file"
2916                                 fi
2917                                 if test -f "$ansexp"; then
2918                                         type=''
2919                                 fi
2920                                 case "$nopath_ok" in
2921                                 true)   case "$value" in
2922                                         */*) ;;
2923                                         *)      echo "Assuming $value will be in people's path."
2924                                                 type=''
2925                                                 ;;
2926                                         esac
2927                                         ;;
2928                                 esac
2929                                 ;;
2930                         esac
2931
2932                         case "$skip" in
2933                         true) type='';
2934                         esac
2935
2936                         case "$type" in
2937                         '') ;;
2938                         *)
2939                                 if test "$fastread" = yes; then
2940                                         dflt=y
2941                                 else
2942                                         dflt=n
2943                                 fi
2944                                 rp="$what $value doesn't exist.  Use that name anyway?"
2945                                 . UU/myread
2946                                 dflt=''
2947                                 case "$ans" in
2948                                 y*) type='';;
2949                                 *) echo " ";;
2950                                 esac
2951                                 ;;
2952                         esac
2953                         ;;
2954                 esac
2955                 ;;
2956         esac
2957 done
2958 cd UU
2959 ans="$value"
2960 rp="$orig_rp"
2961 dflt="$orig_dflt"
2962 rm -f getfile.ok
2963 EOSC
2964
2965 : determine root of directory hierarchy where package will be installed.
2966 case "$prefix" in
2967 '')
2968         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
2969         ;;
2970 *)
2971         dflt="$prefix"
2972         ;;
2973 esac
2974 $cat <<EOM
2975
2976 By default, $package will be installed in $dflt/bin, manual
2977 pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2978 all installation directories. Typically set to /usr/local, but you
2979 may choose /usr if you wish to install $package among your system
2980 binaries. If you wish to have binaries under /bin but manual pages
2981 under /usr/local/man, that's ok: you will be prompted separately
2982 for each of the installation directories, the prefix being only used
2983 to set the defaults.
2984
2985 EOM
2986 fn=d~
2987 rp='Installation prefix to use?'
2988 . ./getfile
2989 oldprefix=''
2990 case "$prefix" in
2991 '') ;;
2992 *)
2993         case "$ans" in
2994         "$prefix") ;;
2995         *) oldprefix="$prefix";;
2996         esac
2997         ;;
2998 esac
2999 prefix="$ans"
3000 prefixexp="$ansexp"
3001
3002 : set the prefixit variable, to compute a suitable default value
3003 prefixit='case "$3" in
3004 ""|none)
3005         case "$oldprefix" in
3006         "") eval "$1=\"\$$2\"";;
3007         *)
3008                 case "$3" in
3009                 "") eval "$1=";;
3010                 none)
3011                         eval "tp=\"\$$2\"";
3012                         case "$tp" in
3013                         ""|" ") eval "$1=\"\$$2\"";;
3014                         *) eval "$1=";;
3015                         esac;;
3016                 esac;;
3017         esac;;
3018 *)
3019         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3020         case "$tp" in
3021         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3022         /*-$oldprefix/*|\~*-$oldprefix/*)
3023                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3024         *) eval "$1=\"\$$2\"";;
3025         esac;;
3026 esac'
3027
3028 : set the base revision
3029 baserev=5.0
3030
3031 : get the patchlevel
3032 echo " "
3033 echo "Getting the current patchlevel..." >&4
3034 if $test -r $rsrc/patchlevel.h;then
3035         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3036         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3037 else
3038         patchlevel=0
3039         subversion=0
3040 fi
3041 $echo $n "(You have $package" $c
3042 case "$package" in
3043 "*$baserev")    ;;
3044 *)              $echo $n " $baserev" $c ;;
3045 esac
3046 $echo $n " patchlevel $patchlevel" $c
3047 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3048 echo ".)"
3049
3050 if test 0 -eq "$subversion"; then
3051         version=`LC_ALL=C; export LC_ALL; \
3052                  echo $baserev $patchlevel | \
3053                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3054 else
3055         version=`LC_ALL=C; export LC_ALL; \
3056                  echo $baserev $patchlevel $subversion | \
3057                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3058 fi
3059 : Figure out perl API version.  Perhaps this should be in patchlevel.h
3060 if test "$subversion" -lt 50; then
3061         apiversion=`LC_ALL=C; export LC_ALL; \
3062                  LANGUAGE=C; export LANGUAGE; \
3063                  echo $baserev $patchlevel | \
3064                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3065 else
3066         apiversion="$version"
3067 fi
3068
3069 : determine where private library files go
3070 : Usual default is /usr/local/lib/perl5/$version.
3071 : Also allow things like /opt/perl/lib/$version, since 
3072 : /opt/perl/lib/perl5... would be redundant.
3073 case "$prefix" in
3074 *perl*) set dflt privlib lib/$version ;;
3075 *)       set dflt privlib lib/$package/$version ;;
3076 esac
3077 eval $prefixit
3078 $cat <<EOM
3079
3080 There are some auxiliary files for $package that need to be put into a
3081 private library directory that is accessible by everyone.
3082
3083 EOM
3084 fn=d~+
3085 rp='Pathname where the private library files will reside?'
3086 . ./getfile
3087 if $test "X$privlibexp" != "X$ansexp"; then
3088         installprivlib=''
3089 fi
3090 privlib="$ans"
3091 privlibexp="$ansexp"
3092 if $afs; then
3093         $cat <<EOM
3094
3095 Since you are running AFS, I need to distinguish the directory in which
3096 private files reside from the directory in which they are installed (and from
3097 which they are presumably copied to the former directory by occult means).
3098
3099 EOM
3100         case "$installprivlib" in
3101         '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
3102         *) dflt="$installprivlib";;
3103         esac
3104         fn=de~
3105         rp='Where will private files be installed?'
3106         . ./getfile
3107         installprivlib="$ans"
3108 else
3109         installprivlib="$privlibexp"
3110 fi
3111
3112 : set the prefixup variable, to restore leading tilda escape
3113 prefixup='case "$prefixexp" in
3114 "$prefix") ;;
3115 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3116 esac'
3117
3118 : determine where public architecture dependent libraries go
3119 set archlib archlib
3120 eval $prefixit
3121 : privlib default is /usr/local/lib/$package/$version
3122 : archlib default is /usr/local/lib/$package/$version/$archname
3123 : privlib may have an optional trailing /share.
3124 tdflt=`echo $privlib | $sed 's,/share$,,'`
3125 tdflt=$tdflt/$archname
3126 case "$archlib" in
3127 '')     dflt=$tdflt
3128         ;;
3129 *)      dflt="$archlib"
3130     ;;
3131 esac
3132 cat <<EOM
3133
3134 $spackage contains architecture-dependent library files.  If you are
3135 sharing libraries in a heterogeneous environment, you might store
3136 these files in a separate location.  Otherwise, you can just include
3137 them with the rest of the public library files.
3138
3139 EOM
3140 fn=d+~
3141 rp='Where do you want to put the public architecture-dependent libraries?'
3142 . ./getfile
3143 archlib="$ans"
3144 archlibexp="$ansexp"
3145
3146 if $afs; then
3147         $cat <<EOM
3148
3149 Since you are running AFS, I need to distinguish the directory in
3150 which architecture-dependent library files reside from the directory
3151 in which they are installed (and from which they are presumably copied
3152 to the former directory by occult means).
3153
3154 EOM
3155         case "$installarchlib" in
3156         '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
3157         *) dflt="$installarchlib";;
3158         esac
3159         fn=de~
3160         rp='Where will architecture-dependent library files be installed?'
3161         . ./getfile
3162         installarchlib="$ans"
3163 else
3164         installarchlib="$archlibexp"
3165 fi
3166 if $test X"$archlib" = X"$privlib"; then
3167         d_archlib="$undef"
3168 else
3169         d_archlib="$define"
3170 fi
3171
3172 : make some quick guesses about what we are up against
3173 echo " "
3174 $echo $n "Hmm...  $c"
3175 echo exit 1 >bsd
3176 echo exit 1 >usg
3177 echo exit 1 >v7
3178 echo exit 1 >osf1
3179 echo exit 1 >eunice
3180 echo exit 1 >xenix
3181 echo exit 1 >venix
3182 echo exit 1 >os2
3183 d_bsd="$undef"
3184 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3185 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3186 then
3187         echo "Looks kind of like an OSF/1 system, but we'll see..."
3188         echo exit 0 >osf1
3189 elif test `echo abc | tr a-z A-Z` = Abc ; then
3190         xxx=`./loc addbib blurfl $pth`
3191         if $test -f $xxx; then
3192         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3193                 echo exit 0 >bsd
3194                 echo exit 0 >usg
3195         else
3196                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3197                         echo "Looks kind of like an extended USG system, but we'll see..."
3198                 else
3199                         echo "Looks kind of like a USG system, but we'll see..."
3200                 fi
3201                 echo exit 0 >usg
3202         fi
3203 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3204         echo "Looks kind of like a BSD system, but we'll see..."
3205         d_bsd="$define"
3206         echo exit 0 >bsd
3207 else
3208         echo "Looks kind of like a Version 7 system, but we'll see..."
3209         echo exit 0 >v7
3210 fi
3211 case "$eunicefix" in
3212 *unixtovms*)
3213         $cat <<'EOI'
3214 There is, however, a strange, musty smell in the air that reminds me of
3215 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3216 EOI
3217         echo exit 0 >eunice
3218         d_eunice="$define"
3219 : it so happens the Eunice I know will not run shell scripts in Unix format
3220         ;;
3221 *)
3222         echo " "
3223         echo "Congratulations.  You aren't running Eunice."
3224         d_eunice="$undef"
3225         ;;
3226 esac
3227 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3228 case "$p_" in
3229 :) ;;
3230 *)
3231         $cat <<'EOI'
3232 I have the feeling something is not exactly right, however...don't tell me...
3233 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3234 EOI
3235         echo exit 0 >os2
3236         ;;
3237 esac
3238 if test -f /xenix; then
3239         echo "Actually, this looks more like a XENIX system..."
3240         echo exit 0 >xenix
3241         d_xenix="$define"
3242 else
3243         echo " "
3244         echo "It's not Xenix..."
3245         d_xenix="$undef"
3246 fi
3247 chmod +x xenix
3248 $eunicefix xenix
3249 if test -f /venix; then
3250         echo "Actually, this looks more like a VENIX system..."
3251         echo exit 0 >venix
3252 else
3253         echo " "
3254         if ./xenix; then
3255                 : null
3256         else
3257                 echo "Nor is it Venix..."
3258         fi
3259 fi
3260 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3261 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3262 $rm -f foo
3263
3264 : see if setuid scripts can be secure
3265 $cat <<EOM
3266
3267 Some kernels have a bug that prevents setuid #! scripts from being
3268 secure.  Some sites have disabled setuid #! scripts because of this.
3269
3270 First let's decide if your kernel supports secure setuid #! scripts.
3271 (If setuid #! scripts would be secure but have been disabled anyway,
3272 don't say that they are secure if asked.)
3273
3274 EOM
3275
3276 val="$undef"
3277 if $test -d /dev/fd; then
3278         echo "#!$ls" >reflect
3279         chmod +x,u+s reflect
3280         ./reflect >flect 2>&1
3281         if $contains "/dev/fd" flect >/dev/null; then
3282                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3283                 val="$define"
3284         else
3285                 $cat <<EOM
3286 If you are not sure if they are secure, I can check but I'll need a
3287 username and password different from the one you are using right now.
3288 If you don't have such a username or don't want me to test, simply
3289 enter 'none'.
3290
3291 EOM
3292                 rp='Other username to test security of setuid scripts with?'
3293                 dflt='none'
3294                 . ./myread
3295                 case "$ans" in
3296                 n|none)
3297                         case "$d_suidsafe" in
3298                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3299                                 dflt=n;;
3300                         "$undef")
3301                                 echo "Well, the $hint value is *not* secure." >&4
3302                                 dflt=n;;
3303                         *)      echo "Well, the $hint value *is* secure." >&4
3304                                 dflt=y;;
3305                         esac
3306                         ;;
3307                 *)
3308                         $rm -f reflect flect
3309                         echo "#!$ls" >reflect
3310                         chmod +x,u+s reflect
3311                         echo >flect
3312                         chmod a+w flect
3313                         echo '"su" will (probably) prompt you for '"$ans's password."
3314                         su $ans -c './reflect >flect'
3315                         if $contains "/dev/fd" flect >/dev/null; then
3316                                 echo "Okay, it looks like setuid scripts are secure." >&4
3317                                 dflt=y
3318                         else
3319                                 echo "I don't think setuid scripts are secure." >&4
3320                                 dflt=n
3321                         fi
3322                         ;;
3323                 esac
3324                 rp='Does your kernel have *secure* setuid scripts?'
3325                 . ./myread
3326                 case "$ans" in
3327                 [yY]*)  val="$define";;
3328                 *)      val="$undef";;
3329                 esac
3330         fi
3331 else
3332         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3333         echo "(That's for file descriptors, not floppy disks.)"
3334         val="$undef"
3335 fi
3336 set d_suidsafe
3337 eval $setvar
3338
3339 $rm -f reflect flect
3340
3341 : now see if they want to do setuid emulation
3342 echo " "
3343 val="$undef"
3344 case "$d_suidsafe" in
3345 "$define")
3346         val="$undef"
3347         echo "No need to emulate SUID scripts since they are secure here." >& 4
3348         ;;
3349 *)
3350         $cat <<EOM
3351 Some systems have disabled setuid scripts, especially systems where
3352 setuid scripts cannot be secure.  On systems where setuid scripts have
3353 been disabled, the setuid/setgid bits on scripts are currently
3354 useless.  It is possible for $package to detect those bits and emulate
3355 setuid/setgid in a secure fashion.  This emulation will only work if
3356 setuid scripts have been disabled in your kernel.
3357
3358 EOM
3359         case "$d_dosuid" in
3360         "$define") dflt=y ;;
3361         *) dflt=n ;;
3362         esac
3363         rp="Do you want to do setuid/setgid emulation?"
3364         . ./myread
3365         case "$ans" in
3366         [yY]*)  val="$define";;
3367         *)      val="$undef";;
3368         esac
3369         ;;
3370 esac
3371 set d_dosuid
3372 eval $setvar
3373
3374 : determine where manual pages are on this system
3375 echo " "
3376 case "$sysman" in
3377 '') 
3378         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
3379         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
3380         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
3381         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
3382         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
3383         sysman=`./loc . /usr/man/man1 $syspath`
3384         ;;
3385 esac
3386 if $test -d "$sysman"; then
3387         echo "System manual is in $sysman." >&4
3388 else
3389         echo "Could not find manual pages in source form." >&4
3390 fi
3391
3392 : see what memory models we can support
3393 case "$models" in
3394 '')
3395         $cat >pdp11.c <<'EOP'
3396 int main() {
3397 #ifdef pdp11
3398         exit(0);
3399 #else
3400         exit(1);
3401 #endif
3402 }
3403 EOP
3404         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
3405         if $test -f pdp11 && ./pdp11 2>/dev/null; then
3406                 dflt='unsplit split'
3407         else
3408                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
3409                 case "$tans" in
3410                 X) dflt='none';;
3411                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
3412                                 dflt='small'
3413                         else
3414                                 dflt=''
3415                         fi
3416                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
3417                                 dflt="$dflt medium"
3418                         fi
3419                         if $test -d /lib/large || $test -d /usr/lib/large; then
3420                                 dflt="$dflt large"
3421                         fi
3422                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
3423                                 dflt="$dflt huge"
3424                         fi
3425                 esac
3426         fi;;
3427 *) dflt="$models";;
3428 esac
3429 $cat <<EOM
3430  
3431 Some systems have different model sizes.  On most systems they are called
3432 small, medium, large, and huge.  On the PDP11 they are called unsplit and
3433 split.  If your system doesn't support different memory models, say "none".
3434 If you wish to force everything to one memory model, say "none" here and
3435 put the appropriate flags later when it asks you for other cc and ld flags.
3436 Venix systems may wish to put "none" and let the compiler figure things out.
3437 (In the following question multiple model names should be space separated.)
3438
3439 The default for most systems is "none".
3440
3441 EOM
3442 rp="Which memory models are supported?"
3443 . ./myread
3444 models="$ans"
3445
3446 case "$models" in
3447 none)
3448         small=''
3449         medium=''
3450         large=''
3451         huge=''
3452         unsplit=''
3453         split=''
3454         ;;
3455 *split)
3456         case "$split" in
3457         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
3458                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
3459                         dflt='-i'
3460                 else
3461                         dflt='none'
3462                 fi;;
3463         *) dflt="$split";;
3464         esac
3465         rp="What flag indicates separate I and D space?"
3466         . ./myread
3467         tans="$ans"
3468         case "$tans" in
3469         none) tans='';;
3470         esac
3471         split="$tans"
3472         unsplit='';;
3473 *large*|*small*|*medium*|*huge*)
3474         case "$models" in
3475         *large*)
3476                 case "$large" in
3477                 '') dflt='-Ml';;
3478                 *) dflt="$large";;
3479                 esac
3480         rp="What flag indicates large model?"
3481         . ./myread
3482         tans="$ans"
3483         case "$tans" in
3484         none) tans='';
3485         esac
3486         large="$tans";;
3487         *) large='';;
3488         esac
3489         case "$models" in
3490         *huge*) case "$huge" in
3491                 '') dflt='-Mh';;
3492                 *) dflt="$huge";;
3493                 esac
3494                 rp="What flag indicates huge model?"
3495                 . ./myread
3496                 tans="$ans"
3497                 case "$tans" in
3498                 none) tans='';
3499                 esac
3500                 huge="$tans";;
3501         *) huge="$large";;
3502         esac
3503         case "$models" in
3504         *medium*) case "$medium" in
3505                 '') dflt='-Mm';;
3506                 *) dflt="$medium";;
3507                 esac
3508                 rp="What flag indicates medium model?"
3509                 . ./myread
3510                 tans="$ans"
3511                 case "$tans" in
3512                 none) tans='';
3513                 esac
3514                 medium="$tans";;
3515         *) medium="$large";;
3516         esac
3517         case "$models" in
3518         *small*) case "$small" in
3519                 '') dflt='none';;
3520                 *) dflt="$small";;
3521                 esac
3522                 rp="What flag indicates small model?"
3523                 . ./myread
3524                 tans="$ans"
3525                 case "$tans" in
3526                 none) tans='';
3527                 esac
3528                 small="$tans";;
3529         *) small='';;
3530         esac
3531         ;;
3532 *)
3533         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
3534         ;;
3535 esac
3536 $rm -f pdp11.* pdp11
3537
3538 : see if we need a special compiler
3539 echo " "
3540 if ./usg; then
3541         case "$cc" in
3542         '') case "$Mcc" in
3543                 /*) dflt='Mcc';;
3544                 *) case "$large" in
3545                         -M*) dflt='cc';;
3546                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
3547                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
3548                                                 dflt='cc'
3549                                         else
3550                                                 dflt='cc -M'
3551                                         fi
3552                                 else
3553                                         dflt='cc'
3554                                 fi;;
3555                         esac;;
3556                 esac;;
3557         *)  dflt="$cc";;
3558         esac
3559         case "$dflt" in
3560         *M*)    $cat <<'EOM'
3561 On some older systems the default C compiler will not resolve multiple global
3562 references that happen to have the same name.  On some such systems the "Mcc"
3563 command may be used to force these to be resolved.  On other systems a "cc -M"
3564 command is required.  (Note that the -M flag on other systems indicates a
3565 memory model to use!) If you have the Gnu C compiler, you might wish to use
3566 that instead.
3567
3568 EOM
3569         ;;
3570         esac
3571         rp="Use which C compiler?"
3572         . ./myread
3573         cc="$ans"
3574 else
3575         case "$cc" in
3576         '') dflt=cc;;
3577         *) dflt="$cc";;
3578         esac
3579         rp="Use which C compiler?"
3580         . ./myread
3581         cc="$ans"
3582 fi
3583 : Look for a hint-file generated 'call-back-unit'.  Now that the
3584 : user has specified the compiler, we may need to set or change some
3585 : other defaults.
3586 if $test -f cc.cbu; then
3587     . ./cc.cbu
3588 fi
3589 echo " "
3590 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3591 $cat >gccvers.c <<EOM
3592 #include <stdio.h>
3593 int main() {
3594 #ifdef __GNUC__
3595 #ifdef __VERSION__
3596         printf("%s\n", __VERSION__);
3597 #else
3598         printf("%s\n", "1");
3599 #endif
3600 #endif
3601         exit(0);
3602 }
3603 EOM
3604 if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
3605         gccversion=`./gccvers`
3606         case "$gccversion" in
3607         '') echo "You are not using GNU cc." ;;
3608         *)  echo "You are using GNU cc $gccversion." ;;
3609         esac
3610 else
3611         echo " "
3612         echo "*** WHOA THERE!!! ***" >&4
3613         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3614         case "$knowitall" in
3615         '')
3616         echo "    You'd better start hunting for one and let me know about it." >&4
3617                 exit 1
3618                 ;;
3619         esac
3620 fi
3621 $rm -f gccvers*
3622 case "$gccversion" in
3623 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3624 esac
3625
3626 : What should the include directory be ?
3627 echo " "
3628 $echo $n "Hmm...  $c"
3629 dflt='/usr/include'
3630 incpath=''
3631 mips_type=''
3632 if $test -f /bin/mips && /bin/mips; then
3633         echo "Looks like a MIPS system..."
3634         $cat >usr.c <<'EOCP'
3635 #ifdef SYSTYPE_BSD43
3636 /bsd43
3637 #endif
3638 EOCP
3639         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3640                 dflt='/bsd43/usr/include'
3641                 incpath='/bsd43'
3642                 mips_type='BSD 4.3'
3643         else
3644                 mips_type='System V'
3645         fi
3646         $rm -f usr.c usr.out
3647         echo "and you're compiling with the $mips_type compiler and libraries."
3648         xxx_prompt=y
3649         echo "exit 0" >mips
3650 else
3651         echo "Doesn't look like a MIPS system."
3652         xxx_prompt=n
3653         echo "exit 1" >mips
3654 fi
3655 chmod +x mips
3656 $eunicefix mips
3657 case "$usrinc" in
3658 '') ;;
3659 *) dflt="$usrinc";;
3660 esac
3661 case "$xxx_prompt" in
3662 y)      fn=d/
3663         echo " "
3664         rp='Where are the include files you want to use?'
3665         . ./getfile
3666         usrinc="$ans"
3667         ;;
3668 *)      usrinc="$dflt"
3669         ;;
3670 esac
3671
3672 : see how we invoke the C preprocessor
3673 echo " "
3674 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3675 cat <<'EOT' >testcpp.c
3676 #define ABC abc
3677 #define XYZ xyz
3678 ABC.XYZ
3679 EOT
3680 cd ..
3681 if test ! -f cppstdin; then
3682         echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3683 else
3684         echo "Keeping your $hint cppstdin wrapper."
3685 fi
3686 chmod 755 cppstdin
3687 wrapper=`pwd`/cppstdin
3688 ok='false'
3689 cd UU
3690
3691 if $test "X$cppstdin" != "X" && \
3692         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3693         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3694 then
3695         echo "You used to use $cppstdin $cppminus so we'll use that again."
3696         case "$cpprun" in
3697         '') echo "But let's see if we can live without a wrapper..." ;;
3698         *)
3699                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3700                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3701                 then
3702                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3703                         ok='true'
3704                 else
3705                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3706                 fi
3707                 ;;
3708         esac
3709 else
3710         case "$cppstdin" in
3711         '') ;;
3712         *)
3713                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3714                 ;;
3715         esac
3716 fi
3717
3718 if $ok; then
3719         : nothing
3720 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3721         $cc -E <testcpp.c >testcpp.out 2>&1; \
3722         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3723         echo "Yup, it does."
3724         x_cpp="$cc -E"
3725         x_minus='';
3726 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3727         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3728         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3729         echo "Yup, it does."
3730         x_cpp="$cc -E"
3731         x_minus='-';
3732 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3733         $cc -P <testcpp.c >testcpp.out 2>&1; \
3734         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3735         echo "Yipee, that works!"
3736         x_cpp="$cc -P"
3737         x_minus='';
3738 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3739         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3740         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3741         echo "At long last!"
3742         x_cpp="$cc -P"
3743         x_minus='-';
3744 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3745         $cpp <testcpp.c >testcpp.out 2>&1; \
3746         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3747         echo "It works!"
3748         x_cpp="$cpp"
3749         x_minus='';
3750 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3751         $cpp - <testcpp.c >testcpp.out 2>&1; \
3752         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3753         echo "Hooray, it works!  I was beginning to wonder."
3754         x_cpp="$cpp"
3755         x_minus='-';
3756 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3757         $wrapper <testcpp.c >testcpp.out 2>&1; \
3758         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3759         x_cpp="$wrapper"
3760         x_minus=''
3761         echo "Eureka!"
3762 else
3763         dflt=''
3764         rp="No dice.  I can't find a C preprocessor.  Name one:"
3765         . ./myread
3766         x_cpp="$ans"
3767         x_minus=''
3768         $x_cpp <testcpp.c >testcpp.out 2>&1
3769         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3770                 echo "OK, that will do." >&4
3771         else
3772 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3773                 exit 1
3774         fi
3775 fi
3776
3777 case "$ok" in
3778 false)
3779         cppstdin="$x_cpp"
3780         cppminus="$x_minus"
3781         cpprun="$x_cpp"
3782         cpplast="$x_minus"
3783         set X $x_cpp
3784         shift
3785         case "$1" in
3786         "$cpp")
3787                 echo "Perhaps can we force $cc -E using a wrapper..."
3788                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3789                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3790                 then
3791                         echo "Yup, we can."
3792                         cppstdin="$wrapper"
3793                         cppminus='';
3794                 else
3795                         echo "Nope, we'll have to live without it..."
3796                 fi
3797                 ;;
3798         esac
3799         case "$cpprun" in
3800         "$wrapper")
3801                 cpprun=''
3802                 cpplast=''
3803                 ;;
3804         esac
3805         ;;
3806 esac
3807
3808 case "$cppstdin" in
3809 "$wrapper"|'cppstdin') ;;
3810 *) $rm -f $wrapper;;
3811 esac
3812 $rm -f testcpp.c testcpp.out
3813
3814 : Set private lib path
3815 case "$plibpth" in
3816 '') if ./mips; then
3817                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3818         fi;;
3819 esac
3820 case "$libpth" in
3821 ' ') dlist='';;
3822 '') dlist="$loclibpth $plibpth $glibpth";;
3823 *) dlist="$libpth";;
3824 esac
3825
3826 : Now check and see which directories actually exist, avoiding duplicates
3827 libpth=''
3828 for xxx in $dlist
3829 do
3830     if $test -d $xxx; then
3831                 case " $libpth " in
3832                 *" $xxx "*) ;;
3833                 *) libpth="$libpth $xxx";;
3834                 esac
3835     fi
3836 done
3837 $cat <<'EOM'
3838
3839 Some systems have incompatible or broken versions of libraries.  Among
3840 the directories listed in the question below, please remove any you
3841 know not to be holding relevant libraries, and add any that are needed.
3842 Say "none" for none.
3843
3844 EOM
3845 case "$libpth" in
3846 '') dflt='none';;
3847 *)
3848         set X $libpth
3849         shift
3850         dflt=${1+"$@"}
3851         ;;
3852 esac
3853 rp="Directories to use for library searches?"
3854 . ./myread
3855 case "$ans" in
3856 none) libpth=' ';;
3857 *) libpth="$ans";;
3858 esac
3859
3860 : compute shared library extension
3861 case "$so" in
3862 '')
3863         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3864                 dflt='sl'
3865         else
3866                 dflt='so'
3867         fi
3868         ;;
3869 *) dflt="$so";;
3870 esac
3871 $cat <<EOM
3872
3873 On some systems, shared libraries may be available.  Answer 'none' if
3874 you want to suppress searching of shared libraries for the remaining
3875 of this configuration.
3876
3877 EOM
3878 rp='What is the file extension used for shared libraries?'
3879 . ./myread
3880 so="$ans"
3881
3882 : Define several unixisms.
3883 : Hints files or command line option can be used to override them.
3884 : The convoluted testing is in case hints files set either the old
3885 : or the new name.
3886 case "$_exe" in
3887 '')     case "$exe_ext" in
3888     '') ;;
3889         *)      _exe="$exe_ext" ;;
3890         esac
3891         ;;
3892 esac
3893 case "$_a" in
3894 '')     case "$lib_ext" in
3895     '') _a='.a';;
3896         *)      _a="$lib_ext" ;;
3897         esac
3898         ;;
3899 esac
3900 case "$_o" in
3901 '') case "$obj_ext" in
3902         '')     _o='.o';;
3903         *)      _o="$obj_ext";;
3904         esac
3905         ;;
3906 esac
3907 case "$p_" in
3908 '') case "$path_sep" in
3909         '')     p_=':';;
3910         *)      p_="$path_sep";;
3911         esac
3912         ;;
3913 esac
3914 exe_ext=$_exe
3915 lib_ext=$_a
3916 obj_ext=$_o
3917 path_sep=$p_
3918
3919 : Which makefile gets called first.  This is used by make depend.
3920 case "$firstmakefile" in
3921 '') firstmakefile='makefile';;
3922 esac
3923
3924 : Looking for optional libraries
3925 echo " "
3926 echo "Checking for optional libraries..." >&4
3927 case "$libs" in
3928 ' '|'') dflt='';;
3929 *) dflt="$libs";;
3930 esac
3931 case "$libswanted" in
3932 '') libswanted='c_s';;
3933 esac
3934 for thislib in $libswanted; do
3935         
3936         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
3937                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
3938                 echo "Found -l$thislib (shared)."
3939                 case " $dflt " in
3940                 *"-l$thislib "*);;
3941                 *) dflt="$dflt -l$thislib";;
3942                 esac
3943         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
3944                 echo "Found -l$thislib (shared)."
3945                 case " $dflt " in
3946                 *"-l$thislib "*);;
3947                 *) dflt="$dflt -l$thislib";;
3948                 esac
3949         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
3950                 echo "Found -l$thislib."
3951                 case " $dflt " in
3952                 *"-l$thislib "*);;
3953                 *) dflt="$dflt -l$thislib";;
3954                 esac
3955         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
3956                 echo "Found -l$thislib."
3957                 case " $dflt " in
3958                 *"-l$thislib "*);;
3959                 *) dflt="$dflt -l$thislib";;
3960                 esac
3961         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
3962                 echo "Found -l${thislib}_s."
3963                 case " $dflt " in
3964                 *"-l$thislib "*);;
3965                 *) dflt="$dflt -l${thislib}_s";;
3966                 esac
3967         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
3968                 echo "Found -l$thislib."
3969                 case " $dflt " in
3970                 *"-l$thislib "*);;
3971                 *) dflt="$dflt -l$thislib";;
3972                 esac
3973         else
3974                 echo "No -l$thislib."
3975         fi
3976 done
3977 set X $dflt
3978 shift
3979 dflt="$*"
3980 case "$libs" in
3981 '') dflt="$dflt";;
3982 *) dflt="$libs";;
3983 esac
3984 case "$dflt" in
3985 ' '|'') dflt='none';;
3986 esac
3987
3988 $cat <<EOM
3989  
3990 Some versions of Unix support shared libraries, which make executables smaller
3991 but make load time slightly longer.
3992
3993 On some systems, mostly System V Release 3's, the shared library is included
3994 by putting the option "-lc_s" as the last thing on the cc command line when
3995 linking.  Other systems use shared libraries by default.  There may be other
3996 libraries needed to compile $package on your machine as well.  If your system
3997 needs the "-lc_s" option, include it here.  Include any other special libraries
3998 here as well.  Say "none" for none.
3999 EOM
4000
4001 echo " "
4002 rp="Any additional libraries?"
4003 . ./myread
4004 case "$ans" in
4005 none) libs=' ';;
4006 *) libs="$ans";;
4007 esac
4008
4009 : determine optimize, if desired, or use for debug flag also
4010 case "$optimize" in
4011 ' '|$undef) dflt='none';;
4012 '') dflt='-O';;
4013 *) dflt="$optimize";;
4014 esac
4015 $cat <<EOH
4016
4017 Some C compilers have problems with their optimizers.  By default, $package
4018 compiles with the -O flag to use the optimizer.  Alternately, you might want
4019 to use the symbolic debugger, which uses the -g flag (on traditional Unix
4020 systems).  Either flag can be specified here.  To use neither flag, specify
4021 the word "none".
4022
4023 EOH
4024 rp="What optimizer/debugger flag should be used?"
4025 . ./myread
4026 optimize="$ans"
4027 case "$optimize" in
4028 'none') optimize=" ";;
4029 esac
4030
4031 dflt=''
4032 : We will not override a previous value, but we might want to
4033 : augment a hint file
4034 case "$hint" in
4035 none|recommended)
4036         case "$gccversion" in
4037         1*) dflt='-fpcc-struct-return' ;;
4038         esac
4039         case "$optimize" in
4040         *-g*) dflt="$dflt -DDEBUGGING";;
4041         esac
4042         case "$gccversion" in
4043         2*) if test -d /etc/conf/kconfig.d &&
4044                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4045                 then
4046                         dflt="$dflt -posix"
4047                 fi
4048                 ;;
4049         esac
4050         ;;
4051 esac
4052
4053 case "$mips_type" in
4054 *BSD*|'') inclwanted="$locincpth $usrinc";;
4055 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4056 esac
4057 for thisincl in $inclwanted; do
4058         if $test -d $thisincl; then
4059                 if $test x$thisincl != x$usrinc; then
4060                         case "$dflt" in
4061                         *$thisincl*);;
4062                         *) dflt="$dflt -I$thisincl";;
4063                         esac
4064                 fi
4065         fi
4066 done
4067
4068 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4069         xxx=true;
4070 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4071         xxx=true;
4072 else
4073         xxx=false;
4074 fi;
4075 if $xxx; then
4076         case "$dflt" in
4077         *$2*);;
4078         *) dflt="$dflt -D$2";;
4079         esac;
4080 fi'
4081
4082 set signal.h LANGUAGE_C; eval $inctest
4083
4084 case "$hint" in
4085 none|recommended) dflt="$ccflags $dflt" ;;
4086 *) dflt="$ccflags";;
4087 esac
4088
4089 case "$dflt" in
4090 ''|' ') dflt=none;;
4091 esac
4092 $cat <<EOH
4093
4094 Your C compiler may want other flags.  For this question you should include
4095 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4096 but you should NOT include libraries or ld flags like -lwhatever.  If you
4097 want $package to honor its debug switch, you should include -DDEBUGGING here.
4098 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4099
4100 To use no flags, specify the word "none".
4101
4102 EOH
4103 set X $dflt
4104 shift
4105 dflt=${1+"$@"}
4106 rp="Any additional cc flags?"
4107 . ./myread
4108 case "$ans" in
4109 none) ccflags='';;
4110 *) ccflags="$ans";;
4111 esac
4112
4113 : the following weeds options from ccflags that are of no interest to cpp
4114 cppflags="$ccflags"
4115 case "$gccversion" in
4116 1*) cppflags="$cppflags -D__GNUC__"
4117 esac
4118 case "$mips_type" in
4119 '');;
4120 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4121 esac
4122 case "$cppflags" in
4123 '');;
4124 *)
4125         echo " "
4126         echo "Let me guess what the preprocessor flags are..." >&4
4127         set X $cppflags
4128         shift
4129         cppflags=''
4130         $cat >cpp.c <<'EOM'
4131 #define BLURFL foo
4132
4133 BLURFL xx LFRULB
4134 EOM
4135         previous=''
4136         for flag in $*
4137         do
4138                 case "$flag" in
4139                 -*) ftry="$flag";;
4140                 *) ftry="$previous $flag";;
4141                 esac
4142                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4143                         >cpp1.out 2>/dev/null && \
4144                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4145                         >cpp2.out 2>/dev/null && \
4146                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4147                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4148                 then
4149                         cppflags="$cppflags $ftry"
4150                         previous=''
4151                 else
4152                         previous="$flag"
4153                 fi
4154         done
4155         set X $cppflags
4156         shift
4157         cppflags=${1+"$@"}
4158         case "$cppflags" in
4159         *-*)  echo "They appear to be: $cppflags";;
4160         esac
4161         $rm -f cpp.c cpp?.out
4162         ;;
4163 esac
4164
4165 : flags used in final linking phase
4166 case "$ldflags" in
4167 '') if ./venix; then
4168                 dflt='-i -z'
4169         else
4170                 dflt=''
4171         fi
4172         case "$ccflags" in
4173         *-posix*) dflt="$dflt -posix" ;;
4174         esac
4175         ;;
4176 *) dflt="$ldflags";;
4177 esac
4178
4179 : Try to guess additional flags to pick up local libraries.
4180 for thislibdir in $libpth; do
4181         case " $loclibpth " in
4182         *" $thislibdir "*)
4183                 case "$dflt " in 
4184                 *"-L$thislibdir "*) ;;
4185                 *)  dflt="$dflt -L$thislibdir" ;;
4186                 esac
4187                 ;;
4188         esac
4189 done
4190
4191 case "$dflt" in
4192 '') dflt='none' ;;
4193 esac
4194
4195 $cat <<EOH
4196
4197 Your C linker may need flags.  For this question you should
4198 include -L/whatever and any other flags used by the C linker, but you
4199 should NOT include libraries like -lwhatever.
4200
4201 Make sure you include the appropriate -L/path flags if your C linker
4202 does not normally search all of the directories you specified above,
4203 namely
4204         $libpth
4205 To use no flags, specify the word "none".
4206
4207 EOH
4208
4209 rp="Any additional ld flags (NOT including libraries)?"
4210 . ./myread
4211 case "$ans" in
4212 none) ldflags='';;
4213 *) ldflags="$ans";;
4214 esac
4215 rmlist="$rmlist pdp11"
4216
4217 : coherency check
4218 echo " "
4219 echo "Checking your choice of C compiler and flags for coherency..." >&4
4220 $cat > try.c <<'EOF'
4221 #include <stdio.h>
4222 main() { printf("Ok\n"); exit(0); }
4223 EOF
4224 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4225 shift
4226 $cat >try.msg <<'EOM'
4227 I've tried to compile and run the following simple program:
4228
4229 EOM
4230 $cat try.c >> try.msg
4231
4232 $cat >> try.msg <<EOM
4233
4234 I used the command:
4235
4236         $*
4237         ./try
4238
4239 and I got the following output:
4240
4241 EOM
4242 dflt=y
4243 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4244         if sh -c './try' >>try.msg 2>&1; then
4245                 xxx=`./try`
4246                 case "$xxx" in
4247                 "Ok") dflt=n ;;
4248                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4249                         case " $libs " in
4250                         *" -lsfio "*)
4251                                 cat >> try.msg <<'EOQS'
4252 If $libs contains -lsfio, and sfio is mis-configured, then it
4253 sometimes (apparently) runs and exits with a 0 status, but with no
4254 output!  It may have to do with sfio's use of _exit vs. exit.
4255
4256 EOQS
4257                                 rp="You have a big problem.  Shall I abort Configure"
4258                                 dflt=y
4259                                 ;;
4260                         esac
4261                         ;;
4262                 esac
4263         else
4264                 echo "The program compiled OK, but exited with status $?." >>try.msg
4265                 rp="You have a problem.  Shall I abort Configure"
4266                 dflt=y
4267         fi
4268 else
4269         echo "I can't compile the test program." >>try.msg
4270         rp="You have a BIG problem.  Shall I abort Configure"
4271         dflt=y
4272 fi
4273 case "$dflt" in
4274 y)
4275         $cat try.msg >&4
4276         case "$knowitall" in
4277         '')
4278                 echo "(The supplied flags or libraries might be incorrect.)"
4279                 ;;
4280         *) dflt=n;;
4281         esac
4282         echo " "
4283         . ./myread
4284         case "$ans" in
4285         n*|N*) ;;
4286         *)      echo "Ok.  Stopping Configure." >&4
4287                 exit 1
4288                 ;;
4289         esac
4290         ;;
4291 n) echo "OK, that should do.";;
4292 esac
4293 $rm -f try try.* core
4294
4295 : determine filename position in cpp output
4296 echo " "
4297 echo "Computing filename position in cpp output for #include directives..." >&4
4298 echo '#include <stdio.h>' > foo.c
4299 $cat >fieldn <<EOF
4300 $startsh
4301 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4302 $grep '^[       ]*#.*stdio\.h' | \
4303 while read cline; do
4304         pos=1
4305         set \$cline
4306         while $test \$# -gt 0; do
4307                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4308                         echo "\$pos"
4309                         exit 0
4310                 fi
4311                 shift
4312                 pos=\`expr \$pos + 1\`
4313         done
4314 done
4315 EOF
4316 chmod +x fieldn
4317 fieldn=`./fieldn`
4318 $rm -f foo.c fieldn
4319 case $fieldn in
4320 '') pos='???';;
4321 1) pos=first;;
4322 2) pos=second;;
4323 3) pos=third;;
4324 *) pos="${fieldn}th";;
4325 esac
4326 echo "Your cpp writes the filename in the $pos field of the line."
4327
4328 : locate header file
4329 $cat >findhdr <<EOF
4330 $startsh
4331 wanted=\$1
4332 name=''
4333 if test -f $usrinc/\$wanted; then
4334         echo "$usrinc/\$wanted"
4335         exit 0
4336 fi
4337 awkprg='{ print \$$fieldn }'
4338 echo "#include <\$wanted>" > foo\$\$.c
4339 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4340 $grep "^[       ]*#.*\$wanted" | \
4341 while read cline; do
4342         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4343         case "\$name" in
4344         */\$wanted) echo "\$name"; exit 0;;
4345         *) name='';;
4346         esac;
4347 done;
4348 $rm -f foo\$\$.c;
4349 case "\$name" in
4350 '') exit 1;;
4351 esac
4352 EOF
4353 chmod +x findhdr
4354
4355 : define an alternate in-header-list? function
4356 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4357 cont=true; xxf="echo \"<\$1> found.\" >&4";
4358 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4359 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4360 esac;
4361 case $# in 4) instead=instead;; *) instead="at last";; esac;
4362 while $test "$cont"; do
4363         xxx=`./findhdr $1`
4364         var=$2; eval "was=\$$2";
4365         if $test "$xxx" && $test -r "$xxx";
4366         then eval $xxf;
4367         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4368                 cont="";
4369         else eval $xxnf;
4370         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4371         set $yyy; shift; shift; yyy=$@;
4372         case $# in 0) cont="";;
4373         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4374                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4375         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4376                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4377         esac;
4378 done;
4379 while $test "$yyy";
4380 do set $yyy; var=$2; eval "was=\$$2";
4381         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4382         set $yyy; shift; shift; yyy=$@;
4383 done'
4384
4385 : see if this is a malloc.h system
4386 set malloc.h i_malloc
4387 eval $inhdr
4388
4389 : see if stdlib is available
4390 set stdlib.h i_stdlib
4391 eval $inhdr
4392
4393 : determine which malloc to compile in
4394 echo " "
4395 case "$usemymalloc" in
4396 ''|[yY]*|true|$define)  dflt='y' ;;
4397 *)      dflt='n' ;;
4398 esac
4399 rp="Do you wish to attempt to use the malloc that comes with $package?"
4400 . ./myread
4401 usemymalloc="$ans"
4402 case "$ans" in
4403 y*|true)
4404         usemymalloc='y'
4405         mallocsrc='malloc.c'
4406         mallocobj="malloc$_o"
4407         d_mymalloc="$define"
4408         case "$libs" in
4409         *-lmalloc*)
4410                 : Remove malloc from list of libraries to use
4411                 echo "Removing unneeded -lmalloc from library list" >&4
4412                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4413                 shift
4414                 libs="$*"
4415                 echo "libs = $libs" >&4
4416                 ;;
4417         esac
4418         ;;
4419 *)
4420         usemymalloc='n'
4421         mallocsrc=''
4422         mallocobj=''
4423         d_mymalloc="$undef"
4424         ;;
4425 esac
4426
4427 : compute the return types of malloc and free
4428 echo " "
4429 $cat >malloc.c <<END
4430 #$i_malloc I_MALLOC
4431 #$i_stdlib I_STDLIB
4432 #include <stdio.h>
4433 #include <sys/types.h>
4434 #ifdef I_MALLOC
4435 #include <malloc.h>
4436 #endif
4437 #ifdef I_STDLIB
4438 #include <stdlib.h>
4439 #endif
4440 #ifdef TRY_MALLOC
4441 void *malloc();
4442 #endif
4443 #ifdef TRY_FREE
4444 void free();
4445 #endif
4446 END
4447 case "$malloctype" in
4448 '')
4449         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4450                 malloctype='void *'
4451         else
4452                 malloctype='char *'
4453         fi
4454         ;;
4455 esac
4456 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4457
4458 case "$freetype" in
4459 '')
4460         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4461                 freetype='void'
4462         else
4463                 freetype='int'
4464         fi
4465         ;;
4466 esac
4467 echo "Your system uses $freetype free(), it would seem." >&4
4468 $rm -f malloc.[co]
4469 : Cruising for prototypes
4470 echo " "
4471 echo "Checking out function prototypes..." >&4
4472 $cat >prototype.c <<'EOCP'
4473 int main(int argc, char *argv[]) {
4474         exit(0);}
4475 EOCP
4476 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4477         echo "Your C compiler appears to support function prototypes."
4478         val="$define"
4479 else
4480         echo "Your C compiler doesn't seem to understand function prototypes."
4481         val="$undef"
4482 fi
4483 set prototype
4484 eval $setvar
4485 $rm -f prototype*
4486
4487 case "$prototype" in
4488 "$define") ;;
4489 *)      ansi2knr='ansi2knr'
4490         echo " "
4491         cat <<EOM >&4
4492
4493 $me:  FATAL ERROR:
4494 This version of $package can only be compiled by a compiler that 
4495 understands function prototypes.  Unfortunately, your C compiler 
4496         $cc $ccflags
4497 doesn't seem to understand them.  Sorry about that.
4498
4499 If GNU cc is available for your system, perhaps you could try that instead.  
4500
4501 Eventually, we hope to support building Perl with pre-ANSI compilers.
4502 If you would like to help in that effort, please contact <perlbug@perl.org>.
4503
4504 Aborting Configure now.
4505 EOM
4506         exit 2
4507         ;;
4508 esac
4509
4510 : determine where public executables go
4511 echo " "
4512 set dflt bin bin
4513 eval $prefixit
4514 fn=d~
4515 rp='Pathname where the public executables will reside?'
4516 . ./getfile
4517 if $test "X$ansexp" != "X$binexp"; then
4518         installbin=''
4519 fi
4520 bin="$ans"
4521 binexp="$ansexp"
4522 if $afs; then
4523         $cat <<EOM
4524
4525 Since you are running AFS, I need to distinguish the directory in which
4526 executables reside from the directory in which they are installed (and from
4527 which they are presumably copied to the former directory by occult means).
4528
4529 EOM
4530         case "$installbin" in
4531         '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
4532         *) dflt="$installbin";;
4533         esac
4534         fn=de~
4535         rp='Where will public executables be installed?'
4536         . ./getfile
4537         installbin="$ans"
4538 else
4539         installbin="$binexp"
4540 fi
4541
4542 : determine whether to install perl also as /usr/bin/perl
4543
4544 echo " "
4545 if test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4546         $cat <<EOM
4547 Many scripts expect to perl to be installed as /usr/bin/perl.
4548 I can install the perl you are about to compile also as /usr/bin/perl
4549 (in addition to $installbin/perl).
4550 EOM
4551         case "$installusrbinperl" in
4552         "$undef"|[nN]*) dflt='n';;
4553         *)              dflt='y';;
4554         esac
4555         rp="Do you want to install perl as /usr/bin/perl?"
4556         . ./myread
4557         case "$ans" in
4558         [yY]*)  val="$define";;
4559         *)      val="$undef" ;;
4560         esac
4561 else
4562         val="$undef"
4563 fi
4564 set installusrbinperl
4565 eval $setvar
4566
4567 : define a shorthand compile call
4568 compile='
4569 mc_file=$1;
4570 shift;
4571 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4572 : define a shorthand compile call for compilations that should be ok.
4573 compile_ok='
4574 mc_file=$1;
4575 shift;
4576 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4577
4578 echo " "
4579 echo "Checking for GNU C Library..." >&4
4580 cat >gnulibc.c <<EOM
4581 #include <stdio.h>
4582 int main()
4583 {
4584 #ifdef __GLIBC__
4585     exit(0);
4586 #else
4587     exit(1);
4588 #endif
4589 }
4590 EOM
4591 set gnulibc
4592 if eval $compile_ok && ./gnulibc; then
4593         val="$define"
4594         echo "You are using the GNU C Library"
4595 else
4596         val="$undef"
4597         echo "You are not using the GNU C Library"
4598 fi
4599 $rm -f gnulibc*
4600 set d_gnulibc
4601 eval $setvar
4602
4603 : see if nm is to be used to determine whether a symbol is defined or not
4604 case "$usenm" in
4605 '')
4606         dflt=''
4607         case "$d_gnulibc" in
4608         "$define")
4609                 echo " "
4610                 echo "nm probably won't work on the GNU C Library." >&4
4611                 dflt=n
4612                 ;;
4613         esac
4614         case "$dflt" in
4615         '') 
4616                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4617                         echo " "
4618                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4619                         echo "'nm' won't be sufficient on this sytem." >&4
4620                         dflt=n
4621                 fi
4622                 ;;
4623         esac
4624         case "$dflt" in
4625         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4626                 if $test $dflt -gt 20; then
4627                         dflt=y
4628                 else
4629                         dflt=n
4630                 fi
4631                 ;;
4632         esac
4633         ;;
4634 *)
4635         case "$usenm" in
4636         true|$define) dflt=y;;
4637         *) dflt=n;;
4638         esac
4639         ;;
4640 esac
4641 $cat <<EOM
4642
4643 I can use $nm to extract the symbols from your C libraries. This
4644 is a time consuming task which may generate huge output on the disk (up
4645 to 3 megabytes) but that should make the symbols extraction faster. The
4646 alternative is to skip the 'nm' extraction part and to compile a small
4647 test program instead to determine whether each symbol is present. If
4648 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4649 this may be the best solution.
4650
4651 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4652
4653 EOM
4654 rp="Shall I use $nm to extract C symbols from the libraries?"
4655 . ./myread
4656 case "$ans" in
4657 [Nn]*) usenm=false;;
4658 *) usenm=true;;
4659 esac
4660
4661 runnm=$usenm
4662 case "$reuseval" in
4663 true) runnm=false;;
4664 esac
4665
4666 : nm options which may be necessary
4667 case "$nm_opt" in
4668 '') if $test -f /mach_boot; then
4669                 nm_opt=''       # Mach
4670         elif $test -d /usr/ccs/lib; then
4671                 nm_opt='-p'     # Solaris (and SunOS?)
4672         elif $test -f /dgux; then
4673                 nm_opt='-p'     # DG-UX
4674         elif $test -f /lib64/rld; then
4675                 nm_opt='-p'     # 64-bit Irix
4676         else
4677                 nm_opt=''
4678         fi;;
4679 esac
4680
4681 : nm options which may be necessary for shared libraries but illegal
4682 : for archive libraries.  Thank you, Linux.
4683 case "$nm_so_opt" in
4684 '')     case "$myuname" in
4685         *linux*)
4686                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4687                         nm_so_opt='--dynamic'
4688                 fi
4689                 ;;
4690         esac
4691         ;;
4692 esac
4693
4694 case "$runnm" in
4695 true)
4696 : get list of predefined functions in a handy place
4697 echo " "
4698 case "$libc" in
4699 '') libc=unknown
4700         case "$libs" in
4701         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4702         esac
4703         ;;
4704 esac
4705 libnames='';
4706 case "$libs" in
4707 '') ;;
4708 *)  for thislib in $libs; do
4709         case "$thislib" in
4710         -lc|-lc_s)
4711                 : Handle C library specially below.
4712                 ;;
4713         -l*)
4714                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4715                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4716                         :
4717                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4718                         :
4719                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4720                         :
4721                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4722                         :
4723                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4724                         :
4725                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4726                         :
4727                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4728                         :
4729                 else
4730                         try=''
4731                 fi
4732                 libnames="$libnames $try"
4733                 ;;
4734         *) libnames="$libnames $thislib" ;;
4735         esac
4736         done
4737         ;;
4738 esac
4739 xxx=normal
4740 case "$libc" in
4741 unknown)
4742         set /lib/libc.$so
4743         for xxx in $libpth; do
4744                 $test -r $1 || set $xxx/libc.$so
4745                 : The messy sed command sorts on library version numbers.
4746                 $test -r $1 || \
4747                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4748                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4749                                 h
4750                                 s/[0-9][0-9]*/0000&/g
4751                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4752                                 G
4753                                 s/\n/ /' | \
4754                          sort | $sed -e 's/^.* //'`
4755                 eval set \$$#
4756         done
4757         $test -r $1 || set /usr/ccs/lib/libc.$so
4758         $test -r $1 || set /lib/libsys_s$_a
4759         ;;
4760 *)
4761         set blurfl
4762         ;;
4763 esac
4764 if $test -r "$1"; then
4765         echo "Your (shared) C library seems to be in $1."
4766         libc="$1"
4767 elif $test -r /lib/libc && $test -r /lib/clib; then
4768         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4769         xxx=apollo
4770         libc='/lib/clib /lib/libc'
4771         if $test -r /lib/syslib; then
4772                 echo "(Your math library is in /lib/syslib.)"
4773                 libc="$libc /lib/syslib"
4774         fi
4775 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4776         echo "Your C library seems to be in $libc, as you said before."
4777 elif $test -r $incpath/usr/lib/libc$_a; then
4778         libc=$incpath/usr/lib/libc$_a;
4779         echo "Your C library seems to be in $libc.  That's fine."
4780 elif $test -r /lib/libc$_a; then
4781         libc=/lib/libc$_a;
4782         echo "Your C library seems to be in $libc.  You're normal."
4783 else
4784         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
4785                 :
4786         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
4787                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
4788         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
4789                 :
4790         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4791                 :
4792         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
4793                 :
4794         else
4795                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
4796         fi
4797         if $test -r "$tans"; then
4798                 echo "Your C library seems to be in $tans, of all places."
4799                 libc=$tans
4800         else
4801                 libc='blurfl'
4802         fi
4803 fi
4804 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
4805         dflt="$libc"
4806         cat <<EOM
4807
4808 If the guess above is wrong (which it might be if you're using a strange
4809 compiler, or your machine supports multiple models), you can override it here.
4810
4811 EOM
4812 else
4813         dflt=''
4814         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
4815         cat >&4 <<EOM
4816 I can't seem to find your C library.  I've looked in the following places:
4817
4818 EOM
4819         $sed 's/^/      /' libpath
4820         cat <<EOM
4821
4822 None of these seems to contain your C library. I need to get its name...
4823
4824 EOM
4825 fi
4826 fn=f
4827 rp='Where is your C library?'
4828 . ./getfile
4829 libc="$ans"
4830
4831 echo " "
4832 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
4833 set X `cat libnames`
4834 shift
4835 xxx=files
4836 case $# in 1) xxx=file; esac
4837 echo "Extracting names from the following $xxx for later perusal:" >&4
4838 echo " "
4839 $sed 's/^/      /' libnames >&4
4840 echo " "
4841 $echo $n "This may take a while...$c" >&4
4842
4843 for file in $*; do
4844         case $file in
4845         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
4846         *) $nm $nm_opt $file 2>/dev/null;;
4847         esac
4848 done >libc.tmp
4849
4850 $echo $n ".$c"
4851 $grep fprintf libc.tmp > libc.ptf
4852 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
4853 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
4854 xxx='[ADTSIW]'
4855 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
4856         eval $xscan;\
4857         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4858                 eval $xrun
4859 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
4860         eval $xscan;\
4861         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4862                 eval $xrun
4863 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
4864         eval $xscan;\
4865         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4866                 eval $xrun
4867 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
4868         eval $xscan;\
4869         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4870                 eval $xrun
4871 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
4872         eval $xscan;\
4873         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4874                 eval $xrun
4875 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
4876         eval $xscan;\
4877         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4878                 eval $xrun
4879 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
4880                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
4881         eval $xscan;\
4882         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4883                 eval $xrun
4884 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
4885         eval $xscan;\
4886         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4887                 eval $xrun
4888 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
4889         eval $xscan;\
4890         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4891                 eval $xrun
4892 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
4893         eval $xscan;\
4894         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4895                 eval $xrun
4896 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
4897         eval $xscan;\
4898         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4899                 eval $xrun
4900 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
4901         eval $xscan;\
4902         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4903                 eval $xrun
4904 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
4905         eval $xscan;\
4906         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4907                 eval $xrun
4908 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
4909         eval $xscan;\
4910         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
4911                 eval $xrun
4912 else
4913         $nm -p $* 2>/dev/null >libc.tmp
4914         $grep fprintf libc.tmp > libc.ptf
4915         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
4916                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
4917         then
4918                 nm_opt='-p'
4919                 eval $xrun
4920         else
4921                 echo " "
4922                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
4923                 com=''
4924                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
4925                         for thisname in $libnames $libc; do
4926                                 $ar t $thisname >>libc.tmp
4927                         done
4928                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
4929                         echo "Ok." >&4
4930                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
4931                         # Repeat libc to extract forwarders to DLL entries too
4932                         for thisname in $libnames $libc; do
4933                                 $ar tv $thisname >>libc.tmp
4934                                 # Revision 50 of EMX has bug in $ar.
4935                                 # it will not extract forwarders to DLL entries
4936                                 # Use emximp which will extract exactly them.
4937                                 emximp -o tmp.imp $thisname \
4938                                     2>/dev/null && \
4939                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
4940                                     < tmp.imp >>libc.tmp
4941                                 $rm tmp.imp
4942                         done
4943                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
4944                         echo "Ok." >&4
4945                 else
4946                         echo "$ar didn't seem to work right." >&4
4947                         echo "Maybe this is a Cray...trying bld instead..." >&4
4948                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
4949                         then
4950                                 for thisname in $libnames; do
4951                                         bld t $libnames | \
4952                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
4953                                         $ar t $thisname >>libc.tmp
4954                                 done
4955                                 echo "Ok." >&4
4956                         else
4957                                 echo "That didn't work either.  Giving up." >&4
4958                                 exit 1
4959                         fi
4960                 fi
4961         fi
4962 fi
4963 nm_extract="$com"
4964 if $test -f /lib/syscalls.exp; then
4965         echo " "
4966         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
4967         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
4968 fi
4969 ;;
4970 esac
4971 $rm -f libnames libpath
4972
4973 : see if dld is available
4974 set dld.h i_dld
4975 eval $inhdr
4976
4977 : is a C symbol defined?
4978 csym='tlook=$1;
4979 case "$3" in
4980 -v) tf=libc.tmp; tc=""; tdc="";;
4981 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
4982 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
4983 esac;
4984 tx=yes;
4985 case "$reuseval-$4" in
4986 true-) ;;
4987 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
4988 esac;
4989 case "$tx" in
4990 yes)
4991         case "$runnm" in
4992         true)
4993                 if $contains $tlook $tf >/dev/null 2>&1;
4994                 then tval=true;
4995                 else tval=false;
4996                 fi;;
4997         *)
4998                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
4999                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5000                 then tval=true;
5001                 else tval=false;
5002                 fi;
5003                 $rm -f t t.c;;
5004         esac;;
5005 *)
5006         case "$tval" in
5007         $define) tval=true;;
5008         *) tval=false;;
5009         esac;;
5010 esac;
5011 eval "$2=$tval"'
5012
5013 : define an is-in-libc? function
5014 inlibc='echo " "; td=$define; tu=$undef;
5015 sym=$1; var=$2; eval "was=\$$2";
5016 tx=yes;
5017 case "$reuseval$was" in
5018 true) ;;
5019 true*) tx=no;;
5020 esac;
5021 case "$tx" in
5022 yes)
5023         set $sym tres -f;
5024         eval $csym;
5025         case "$tres" in
5026         true)
5027                 echo "$sym() found." >&4;
5028                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5029         *)
5030                 echo "$sym() NOT found." >&4;
5031                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5032         esac;;
5033 *)
5034         case "$was" in
5035         $define) echo "$sym() found." >&4;;
5036         *) echo "$sym() NOT found." >&4;;
5037         esac;;
5038 esac'
5039
5040 : see if dlopen exists
5041 xxx_runnm="$runnm"
5042 runnm=false
5043 set dlopen d_dlopen
5044 eval $inlibc
5045 runnm="$xxx_runnm"
5046
5047 : determine which dynamic loading, if any, to compile in
5048 echo " "
5049 dldir="ext/DynaLoader"
5050 case "$usedl" in
5051 $define|y|true)
5052         dflt='y'
5053         usedl="$define"
5054         ;;
5055 $undef|n|false)
5056         dflt='n'
5057         usedl="$undef"
5058         ;;
5059 *) 
5060         dflt='n'
5061         case "$d_dlopen" in
5062             $define) dflt='y' ;;
5063         esac
5064         case "$i_dld" in
5065             $define) dflt='y' ;;
5066         esac
5067         : Does a dl_xxx.xs file exist for this operating system
5068         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5069         ;;
5070 esac
5071 rp="Do you wish to use dynamic loading?"
5072 . ./myread
5073 usedl="$ans"
5074 case "$ans" in
5075 y*) usedl="$define"
5076         case "$dlsrc" in
5077         '')
5078                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5079                         dflt="$dldir/dl_${osname}.xs"
5080                 elif $test "$d_dlopen" = "$define" ; then
5081                         dflt="$dldir/dl_dlopen.xs"
5082                 elif $test "$i_dld" = "$define" ; then
5083                         dflt="$dldir/dl_dld.xs"
5084                 else
5085                         dflt=''
5086                 fi
5087                 ;;
5088         *)      dflt="$dldir/$dlsrc"
5089                 ;;
5090         esac
5091     echo "The following dynamic loading files are available:"
5092         : Can not go over to $dldir because getfile has path hard-coded in.
5093         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5094         rp="Source file to use for dynamic loading"
5095         fn="fne"
5096         # XXX This getfile call will fail the existence check if you try 
5097         # building away from $src (this is not supported yet).
5098         . ./getfile
5099         usedl="$define"
5100         : emulate basename
5101         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5102
5103         $cat << EOM
5104
5105 Some systems may require passing special flags to $cc -c to
5106 compile modules that will be used to create a shared library.
5107 To use no flags, say "none".
5108
5109 EOM
5110     case "$cccdlflags" in
5111     '') case "$gccversion" in
5112                 '') case "$osname" in
5113                         hpux)   dflt='+z' ;;
5114                         next)   dflt='none' ;;
5115                         irix*)  dflt='-KPIC' ;;
5116                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5117                         sunos)  dflt='-pic' ;;
5118                         *)      dflt='none' ;;
5119                     esac
5120                         ;;
5121                 *)  case "$osname" in
5122                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5123                         *)      dflt='-fpic' ;;
5124                     esac ;;
5125             esac ;;
5126         ' ') dflt='none' ;;
5127     *)  dflt="$cccdlflags" ;;
5128     esac
5129     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5130     . ./myread
5131     case "$ans" in
5132     none) cccdlflags=' ' ;;
5133     *) cccdlflags="$ans" ;;
5134     esac
5135
5136     cat << EOM
5137
5138 Some systems use ld to create libraries that can be dynamically loaded,
5139 while other systems (such as those using ELF) use $cc.
5140
5141 EOM
5142         case "$ld" in
5143         '')     $cat >try.c <<'EOM'
5144 /* Test for whether ELF binaries are produced */
5145 #include <fcntl.h>
5146 #include <stdlib.h>
5147 int main() {
5148         char b[4];
5149         int i = open("a.out",O_RDONLY);
5150         if(i == -1) 
5151                 exit(1); /* fail */
5152         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5153                 exit(0); /* succeed (yes, it's ELF) */
5154         else
5155                 exit(1); /* fail */
5156 }
5157 EOM
5158                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5159                         cat <<EOM
5160 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5161 EOM
5162                         dflt="$cc"
5163                 else
5164                         echo "I'll use ld to build dynamic libraries."
5165                         dflt='ld'
5166                 fi
5167                 rm -f try.c a.out
5168                 ;;
5169         *)      dflt="$ld"
5170                 ;;
5171         esac
5172
5173     rp="What command should be used to create dynamic libraries?"
5174     . ./myread
5175         ld="$ans"
5176
5177     cat << EOM
5178
5179 Some systems may require passing special flags to $ld to create a
5180 library that can be dynamically loaded.  If your ld flags include
5181 -L/other/path options to locate libraries outside your loader's normal
5182 search path, you may need to specify those -L options here as well.  To
5183 use no flags, say "none".
5184
5185 EOM
5186     case "$lddlflags" in
5187     '') case "$osname" in
5188                         beos) dflt='-nostart' ;;
5189                         hpux)  dflt='-b' ;;
5190                         linux|irix*)    dflt='-shared' ;;
5191                         next)  dflt='none' ;;
5192                         solaris) dflt='-G' ;;
5193                         sunos) dflt='-assert nodefinitions' ;;
5194                         svr4*|esix*) dflt="-G $ldflags" ;;
5195                 *)     dflt='none' ;;
5196                         esac
5197                         ;;
5198     *) dflt="$lddlflags" ;;
5199     esac
5200
5201         : Try to guess additional flags to pick up local libraries.
5202         : Be careful not to append to a plain 'none'
5203         case "$dflt" in
5204         none) dflt='' ;;
5205         esac
5206         for thisflag in $ldflags; do
5207                 case "$thisflag" in
5208                 -L*)
5209                         case " $dflt " in
5210                         *" $thisflag "*) ;;
5211                         *) dflt="$dflt $thisflag" ;;
5212                         esac
5213                         ;;
5214                 esac
5215         done
5216
5217         case "$dflt" in
5218         ''|' ') dflt='none' ;;
5219         esac
5220
5221     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5222     . ./myread
5223     case "$ans" in
5224     none) lddlflags=' ' ;;
5225     *) lddlflags="$ans" ;;
5226     esac
5227
5228         cat <<EOM
5229
5230 Some systems may require passing special flags to $cc to indicate that
5231 the resulting executable will use dynamic linking.  To use no flags,
5232 say "none".
5233
5234 EOM
5235     case "$ccdlflags" in
5236     '') case "$osname" in
5237                 hpux)   dflt='-Wl,-E' ;;
5238                 linux)  dflt='-rdynamic' ;;
5239                 next)   dflt='none' ;;
5240                 sunos)  dflt='none' ;;
5241                 *)      dflt='none' ;;
5242             esac ;;
5243     ' ')  dflt='none' ;;
5244     *)  dflt="$ccdlflags" ;;
5245     esac
5246     rp="Any special flags to pass to $cc to use dynamic loading?"
5247     . ./myread
5248     case "$ans" in
5249     none) ccdlflags=' ' ;;
5250     *) ccdlflags="$ans" ;;
5251     esac
5252     ;;
5253 *)  usedl="$undef"
5254         ld='ld'
5255     dlsrc='dl_none.xs'
5256     lddlflags=''
5257     ccdlflags=''
5258     ;;
5259 esac
5260
5261 also=''
5262 case "$usedl" in
5263 $undef)
5264         # No dynamic loading being used, so don't bother even to prompt.
5265         useshrplib='false'
5266         ;;
5267 *)      case "$useshrplib" in
5268         '')     case "$osname" in
5269                 svr4*|dgux|dynixptx|esix|powerux|beos)
5270                         dflt=y
5271                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5272                         ;;
5273                 next*)
5274                         case "$osvers" in
5275                         4*)     dflt=y
5276                                 also='Building a shared libperl is needed for MAB support.'
5277                                 ;;
5278                         *)      dflt=n
5279                                 ;;
5280                         esac
5281                         ;;
5282                 *)      dflt=n
5283                         ;;
5284                 esac
5285                 ;;
5286         $define|true|[Yy]*)
5287                 dflt=y
5288                 ;;
5289         *)      dflt=n
5290                 ;;
5291         esac
5292         $cat << EOM
5293
5294 The perl executable is normally obtained by linking perlmain.c with
5295 libperl${_a}, any static extensions (usually just DynaLoader), and
5296 any other libraries needed on this system (such as -lm, etc.).  Since
5297 your system supports dynamic loading, it is probably possible to build
5298 a shared libperl.$so.  If you will have more than one executable linked
5299 to libperl.$so, this will significantly reduce the size of each
5300 executable, but it may have a noticeable affect on performance.  The
5301 default is probably sensible for your system.
5302 $also
5303
5304 EOM
5305         rp="Build a shared libperl.$so (y/n)"
5306         . ./myread
5307         case "$ans" in
5308         true|$define|[Yy]*)
5309                 useshrplib='true'
5310                 # Why does next4 have to be so different?
5311                 case "${osname}${osvers}" in
5312                 next4*) xxx='DYLD_LIBRARY_PATH' ;;
5313                 os2*)   xxx='' ;; # Nothing special needed.
5314                 beos*)  xxx='' ;;
5315                 *)              xxx='LD_LIBRARY_PATH' ;;
5316                 esac
5317                 if test X"$xxx" != "X"; then
5318                         $cat <<EOM  | $tee -a ../config.msg >&4
5319
5320 To build perl, you must add the current working directory to your
5321 $xxx environment variable before running make.  You can do
5322 this with
5323    $xxx=\`pwd\`:\$$xxx; export $xxx
5324 for Bourne-style shells, or
5325    setenv $xxx \`pwd\`
5326 for Csh-style shells.  You *MUST* do this before running make.
5327
5328 EOM
5329                 fi
5330                 ;;
5331         *)      useshrplib='false' ;;
5332         esac
5333         ;;
5334 esac
5335
5336 case "$useshrplib" in
5337 true)
5338         case "$libperl" in
5339         '')
5340                 # Figure out a good name for libperl.so.  Since it gets stored in
5341                 # a version-specific architecture-dependent library, the version
5342                 # number isn't really that important, except for making cc/ld happy.
5343                 #
5344                 # A name such as libperl.so.3.1
5345                 majmin="libperl.$so.$patchlevel.$subversion"
5346                 # A name such as libperl.so.301
5347                 majonly=`echo $patchlevel $subversion |
5348                         $awk '{printf "%d%02d", $1, $2}'`
5349                 majonly=libperl.$so.$majonly
5350                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5351                 # rely on figuring it out from the naming of libc.
5352                 case "${osname}${osvers}" in
5353                 next4*)
5354                         dflt=libperl.5.$so
5355                         # XXX How handle the --version stuff for MAB?
5356                         ;;
5357                 linux*)  # ld won't link with a bare -lperl otherwise.
5358                         dflt=libperl.$so
5359                         ;;
5360                 *)      # Try to guess based on whether libc has major.minor.
5361                         case "$libc" in
5362                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5363                         *libc.$so.[0-9]*) dflt=$majonly ;;
5364                         *)      dflt=libperl.$so ;;
5365                         esac
5366                         ;;
5367                 esac
5368                 ;;
5369         *)      dflt=$libperl
5370                 ;;
5371         esac
5372         cat << EOM
5373
5374 I need to select a good name for the shared libperl.  If your system uses
5375 library names with major and minor numbers, then you might want something
5376 like $majmin.  Alternatively, if your system uses a single version
5377 number for shared libraries, then you might want to use $majonly.
5378 Or, your system might be quite happy with a simple libperl.$so.
5379
5380 Since the shared libperl will get installed into a version-specific
5381 architecture-dependent directory, the version number of the shared perl
5382 library probably isn't important, so the default should be o.k.
5383
5384 EOM
5385         rp='What name do you want to give to the shared libperl?'
5386         . ./myread
5387         libperl=$ans
5388         echo "Ok, I'll use $libperl"
5389         ;;
5390 *)
5391         libperl="libperl${_a}"
5392         ;;
5393 esac
5394
5395 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5396 case "$shrpdir" in
5397 '') ;;
5398 *)      $cat >&4 <<EOM
5399 WARNING:  Use of the shrpdir variable for the installation location of
5400 the shared $libperl is not supported.  It was never documented and
5401 will not work in this version.  Let me (perlbug@perl.com)
5402 know of any problems this may cause.
5403
5404 EOM
5405         case "$shrpdir" in
5406         "$archlibexp/CORE")
5407                 $cat >&4 <<EOM
5408 But your current setting of $shrpdir is
5409 the default anyway, so it's harmless.
5410 EOM
5411                 ;;
5412         *)
5413                 $cat >&4 <<EOM
5414 Further, your current attempted setting of $shrpdir
5415 conflicts with the value of $archlibexp/CORE
5416 that installperl will use.
5417 EOM
5418                 ;;
5419         esac
5420         ;;
5421 esac
5422
5423 # How will the perl executable find the installed shared $libperl?
5424 # Add $xxx to ccdlflags.
5425 # If we can't figure out a command-line option, use $shrpenv to
5426 # set env LD_RUN_PATH.  The main perl makefile uses this.
5427 shrpdir=$archlibexp/CORE
5428 xxx=''
5429 tmp_shrpenv=''
5430 if "$useshrplib"; then
5431     case "$osname" in 
5432         aix)
5433                 # We'll set it in Makefile.SH...
5434                 ;;
5435         solaris|netbsd)
5436                 xxx="-R $shrpdir"
5437                 ;;
5438         freebsd)
5439                 xxx="-Wl,-R$shrpdir"
5440                 ;;
5441         linux|irix*|dec_osf)
5442                 xxx="-Wl,-rpath,$shrpdir"
5443                 ;;
5444         next)
5445                 # next doesn't like the default...
5446                 ;;
5447         beos)
5448                 # beos doesn't like the default, either.
5449                 ;;
5450         *)
5451                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5452                 ;;
5453         esac
5454         case "$xxx" in
5455         '') ;;
5456         *)      
5457                 # Only add $xxx if it isn't already in ccdlflags.
5458                 case " $ccdlflags " in
5459                 *" $xxx "*)     ;;
5460                 *)      ccdlflags="$ccdlflags $xxx"
5461                         cat <<EOM >&4
5462
5463 Adding $xxx to the flags
5464 passed to $ld so that the perl executable will find the 
5465 installed shared $libperl.
5466
5467 EOM
5468                         ;;
5469                 esac
5470                 ;;
5471         esac
5472 fi
5473 # Respect a hint or command-line value.
5474 case "$shrpenv" in
5475 '') shrpenv="$tmp_shrpenv" ;;
5476 esac
5477
5478 : determine where manual pages go
5479 set man1dir man1dir none
5480 eval $prefixit
5481 $cat <<EOM
5482
5483 $spackage has manual pages available in source form.
5484 EOM
5485 case "$nroff" in
5486 nroff)
5487         echo "However, you don't have nroff, so they're probably useless to you."
5488         case "$man1dir" in
5489         '') man1dir="none";;
5490         esac;;
5491 esac
5492 echo "If you don't want the manual sources installed, answer 'none'."
5493 case "$man1dir" in
5494 ' ') dflt=none
5495         ;;
5496 '')
5497         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5498         lookpath="$lookpath $prefixexp/man/p_man/man1"
5499         lookpath="$lookpath $prefixexp/man/u_man/man1"
5500         lookpath="$lookpath $prefixexp/man/man.1"
5501         case "$sysman" in
5502         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5503         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5504         esac
5505         set dflt
5506         eval $prefixup
5507         ;;
5508 *)  dflt="$man1dir"
5509         ;;
5510 esac
5511 echo " "
5512 fn=dn+~
5513 rp="Where do the main $spackage manual pages (source) go?"
5514 . ./getfile
5515 if $test "X$man1direxp" != "X$ansexp"; then
5516         installman1dir=''
5517 fi
5518 man1dir="$ans"
5519 man1direxp="$ansexp"
5520 case "$man1dir" in
5521 '') man1dir=' '
5522         installman1dir='';;
5523 esac
5524 if $afs; then
5525         $cat <<EOM
5526
5527 Since you are running AFS, I need to distinguish the directory in which
5528 manual pages reside from the directory in which they are installed (and from
5529 which they are presumably copied to the former directory by occult means).
5530
5531 EOM
5532         case "$installman1dir" in
5533         '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;;
5534         *) dflt="$installman1dir";;
5535         esac
5536         fn=de~
5537         rp='Where will man pages be installed?'
5538         . ./getfile
5539         installman1dir="$ans"
5540 else
5541         installman1dir="$man1direxp"
5542 fi
5543
5544 : What suffix to use on installed man pages
5545
5546 case "$man1dir" in
5547 ' ')
5548         man1ext='0'
5549         ;;
5550 *)
5551         rp="What suffix should be used for the main $spackage man pages?"
5552         case "$man1ext" in
5553         '')     case "$man1dir" in
5554                 *1)  dflt=1 ;;
5555                 *1p) dflt=1p ;;
5556                 *1pm) dflt=1pm ;;
5557                 *l) dflt=l;;
5558                 *n) dflt=n;;
5559                 *o) dflt=o;;
5560                 *p) dflt=p;;
5561                 *C) dflt=C;;
5562                 *L) dflt=L;;
5563                 *L1) dflt=L1;;
5564                 *) dflt=1;;
5565                 esac
5566                 ;;
5567         *)      dflt="$man1ext";;
5568         esac
5569         . ./myread
5570         man1ext="$ans"
5571         ;;
5572 esac
5573
5574 : see if we can have long filenames
5575 echo " "
5576 rmlist="$rmlist /tmp/cf$$"
5577 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5578 first=123456789abcdef
5579 second=/tmp/cf$$/$first
5580 $rm -f $first $second
5581 if (echo hi >$first) 2>/dev/null; then
5582         if $test -f 123456789abcde; then
5583                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5584                 val="$undef"
5585         else
5586                 if (echo hi >$second) 2>/dev/null; then
5587                         if $test -f /tmp/cf$$/123456789abcde; then
5588                                 $cat <<'EOM'
5589 That's peculiar... You can have filenames longer than 14 characters, but only
5590 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5591 I shall consider your system cannot support long filenames at all.
5592 EOM
5593                                 val="$undef"
5594                         else
5595                                 echo 'You can have filenames longer than 14 characters.' >&4
5596                                 val="$define"
5597                         fi
5598                 else
5599                         $cat <<'EOM'
5600 How confusing! Some of your filesystems are sane enough to allow filenames
5601 longer than 14 characters but some others like /tmp can't even think about them.
5602 So, for now on, I shall assume your kernel does not allow them at all.
5603 EOM
5604                         val="$undef"
5605                 fi
5606         fi
5607 else
5608         $cat <<'EOM'
5609 You can't have filenames longer than 14 chars.  You can't even think about them!
5610 EOM
5611         val="$undef"
5612 fi 
5613 set d_flexfnam
5614 eval $setvar
5615 $rm -rf /tmp/cf$$ 123456789abcde*
5616
5617 : determine where library module manual pages go
5618 set man3dir man3dir none
5619 eval $prefixit
5620 $cat <<EOM
5621
5622 $spackage has manual pages for many of the library modules.
5623 EOM
5624
5625 case "$nroff" in
5626 nroff)
5627         $cat <<'EOM'
5628 However, you don't have nroff, so they're probably useless to you.
5629 EOM
5630         case "$man3dir" in
5631         '') man3dir="none";;
5632         esac;;
5633 esac
5634
5635 case "$d_flexfnam" in
5636 undef)
5637         $cat <<'EOM'
5638 However, your system can't handle the long file names like File::Basename.3. 
5639 EOM
5640         case "$man3dir" in
5641         '') man3dir="none";;
5642         esac;;
5643 esac
5644
5645 echo "If you don't want the manual sources installed, answer 'none'."
5646 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5647 case "$man3dir" in
5648 '')     case "$prefix" in 
5649         *$prog*) dflt=`echo $man1dir | 
5650                         $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;;
5651         *)      dflt="$privlib/man/man3" ;;
5652         esac
5653         ;;
5654 ' ') dflt=none;;
5655 *)      dflt="$man3dir" ;;
5656 esac
5657 echo " "
5658
5659 fn=dn+~
5660 rp="Where do the $package library man pages (source) go?"
5661 . ./getfile
5662 if test "X$man3direxp" != "X$ansexp"; then
5663         installman3dir=''
5664 fi
5665
5666 man3dir="$ans"
5667 man3direxp="$ansexp"
5668 case "$man3dir" in
5669 '') man3dir=' '
5670         installman3dir='';;
5671 esac
5672 if $afs; then
5673         $cat <<EOM
5674
5675 Since you are running AFS, I need to distinguish the directory in which
5676 manual pages reside from the directory in which they are installed (and from
5677 which they are presumably copied to the former directory by occult means).
5678
5679 EOM
5680         case "$installman3dir" in
5681         '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;;
5682         *) dflt="$installman3dir";;
5683         esac
5684         fn=de~
5685         rp='Where will man pages be installed?'
5686         . ./getfile
5687         installman3dir="$ans"
5688 else
5689         installman3dir="$man3direxp"
5690 fi
5691
5692 : What suffix to use on installed man pages
5693
5694 case "$man3dir" in
5695 ' ')
5696         man3ext='0'
5697         ;;
5698 *)
5699         rp="What suffix should be used for the $package library man pages?"
5700         case "$man3ext" in
5701         '')     case "$man3dir" in
5702                 *3)  dflt=3 ;;
5703                 *3p) dflt=3p ;;
5704                 *3pm) dflt=3pm ;;
5705                 *l) dflt=l;;
5706                 *n) dflt=n;;
5707                 *o) dflt=o;;
5708                 *p) dflt=p;;
5709                 *C) dflt=C;;
5710                 *L) dflt=L;;
5711                 *L3) dflt=L3;;
5712                 *) dflt=3;;
5713                 esac
5714                 ;;
5715         *)      dflt="$man3ext";;
5716         esac
5717         . ./myread
5718         man3ext="$ans"
5719         ;;
5720 esac
5721
5722 : see if we have to deal with yellow pages, now NIS.
5723 if $test -d /usr/etc/yp || $test -d /etc/yp; then
5724         if $test -f /usr/etc/nibindd; then
5725                 echo " "
5726                 echo "I'm fairly confident you're on a NeXT."
5727                 echo " "
5728                 rp='Do you get the hosts file via NetInfo?'
5729                 dflt=y
5730                 case "$hostcat" in
5731                 nidump*) ;;
5732                 '') ;;
5733                 *) dflt=n;;
5734                 esac
5735                 . ./myread
5736                 case "$ans" in
5737                 y*) hostcat='nidump hosts .';;
5738                 *)      case "$hostcat" in
5739                         nidump*) hostcat='';;
5740                         esac
5741                         ;;
5742                 esac
5743         fi
5744         case "$hostcat" in
5745         nidump*) ;;
5746         *)
5747                 case "$hostcat" in
5748                 *ypcat*) dflt=y;;
5749                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5750                                 dflt=y
5751                         else
5752                                 dflt=n
5753                         fi;;
5754                 *) dflt=n;;
5755                 esac
5756                 echo " "
5757                 rp='Are you getting the hosts file via yellow pages?'
5758                 . ./myread
5759                 case "$ans" in
5760                 y*) hostcat='ypcat hosts';;
5761                 *) hostcat='cat /etc/hosts';;
5762                 esac
5763                 ;;
5764         esac
5765 fi
5766 case "$hostcat" in
5767 '') hostcat='cat /etc/hosts';;
5768 esac
5769 case "$groupcat" in
5770 '') groupcat='cat /etc/group';;
5771 esac
5772 case "$passcat" in
5773 '') passcat='cat /etc/passwd';;
5774 esac
5775
5776 : now get the host name
5777 echo " "
5778 echo "Figuring out host name..." >&4
5779 case "$myhostname" in
5780 '') cont=true
5781         echo 'Maybe "hostname" will work...'
5782         if tans=`sh -c hostname 2>&1` ; then
5783                 myhostname=$tans
5784                 phostname=hostname
5785                 cont=''
5786         fi
5787         ;;
5788 *) cont='';;
5789 esac
5790 if $test "$cont"; then
5791         if ./xenix; then
5792                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
5793                 if tans=`cat /etc/systemid 2>&1` ; then
5794                         myhostname=$tans
5795                         phostname='cat /etc/systemid'
5796                         echo "Whadyaknow.  Xenix always was a bit strange..."
5797                         cont=''
5798                 fi
5799         elif $test -r /etc/systemid; then
5800                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
5801         fi
5802 fi
5803 if $test "$cont"; then
5804         echo 'No, maybe "uuname -l" will work...'
5805         if tans=`sh -c 'uuname -l' 2>&1` ; then
5806                 myhostname=$tans
5807                 phostname='uuname -l'
5808         else
5809                 echo 'Strange.  Maybe "uname -n" will work...'
5810                 if tans=`sh -c 'uname -n' 2>&1` ; then
5811                         myhostname=$tans
5812                         phostname='uname -n'
5813                 else
5814                         echo 'Oh well, maybe I can mine it out of whoami.h...'
5815                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
5816                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
5817                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
5818                         else
5819                                 case "$myhostname" in
5820                                 '') echo "Does this machine have an identity crisis or something?"
5821                                         phostname='';;
5822                                 *)
5823                                         echo "Well, you said $myhostname before..."
5824                                         phostname='echo $myhostname';;
5825                                 esac
5826                         fi
5827                 fi
5828         fi
5829 fi
5830 : you do not want to know about this
5831 set $myhostname
5832 myhostname=$1
5833
5834 : verify guess
5835 if $test "$myhostname" ; then
5836         dflt=y
5837         rp='Your host name appears to be "'$myhostname'".'" Right?"
5838         . ./myread
5839         case "$ans" in
5840         y*) ;;
5841         *) myhostname='';;
5842         esac
5843 fi
5844
5845 : bad guess or no guess
5846 while $test "X$myhostname" = X ; do
5847         dflt=''
5848         rp="Please type the (one word) name of your host:"
5849         . ./myread
5850         myhostname="$ans"
5851 done
5852
5853 : translate upper to lower if necessary
5854 case "$myhostname" in
5855 *[A-Z]*)
5856         echo "(Normalizing case in your host name)"
5857         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
5858         ;;
5859 esac
5860
5861 case "$myhostname" in
5862 *.*)
5863         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
5864         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
5865         echo "(Trimming domain name from host name--host name is now $myhostname)"
5866         ;;
5867 *) case "$mydomain" in
5868         '')
5869                 {
5870                         test "X$hostcat" = "Xypcat hosts" &&
5871                         ypmatch "$myhostname" hosts 2>/dev/null |\
5872                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
5873                         $test -s hosts
5874                 } || {
5875                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
5876                                         /[       ]$myhostname[  . ]/p" > hosts
5877                 }
5878                 tmp_re="[       . ]"
5879                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
5880                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
5881                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
5882                         hosts | $sort | $uniq | \
5883                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
5884                 case `$echo X$dflt` in
5885                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
5886                         dflt=.
5887                         ;;
5888                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
5889                         ;;
5890                 esac
5891                 case "$dflt" in
5892                 .)
5893                         tans=`./loc resolv.conf X /etc /usr/etc`
5894                         if $test -f "$tans"; then
5895                                 echo "(Attempting domain name extraction from $tans)"
5896                                 dflt=.`$sed -n -e 's/   / /g' \
5897                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
5898                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
5899                                 case "$dflt" in
5900                                 .) dflt=.`$sed -n -e 's/        / /g' \
5901                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
5902                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
5903                                         ;;
5904                                 esac
5905                         fi
5906                         ;;
5907                 esac
5908                 case "$dflt" in
5909                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
5910                         dflt=.`sh -c domainname 2>/dev/null`
5911                         case "$dflt" in
5912                         '') dflt='.';;
5913                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
5914                         esac
5915                         ;;
5916                 esac
5917                 case "$dflt" in
5918                 .) echo "(Lost all hope -- silly guess then)"
5919                         dflt='.uucp'
5920                         ;;
5921                 esac
5922                 $rm -f hosts
5923                 ;;
5924         *) dflt="$mydomain";;
5925         esac;;
5926 esac
5927 echo " "
5928 rp="What is your domain name?"
5929 . ./myread
5930 tans="$ans"
5931 case "$ans" in
5932 '') ;;
5933 .*) ;;
5934 *) tans=".$tans";;
5935 esac
5936 mydomain="$tans"
5937
5938 : translate upper to lower if necessary
5939 case "$mydomain" in
5940 *[A-Z]*)
5941         echo "(Normalizing case in your domain name)"
5942         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
5943         ;;
5944 esac
5945
5946 : a little sanity check here
5947 case "$phostname" in
5948 '') ;;
5949 *)
5950         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
5951         $myhostname$mydomain|$myhostname) ;;
5952         *)
5953                 case "$phostname" in
5954                 sed*)
5955                         echo "(That doesn't agree with your whoami.h file, by the way.)"
5956                         ;;
5957                 *)
5958                         echo "(That doesn't agree with your $phostname command, by the way.)"
5959                         ;;
5960                 esac
5961         ;;
5962         esac
5963         ;;
5964 esac
5965
5966 $cat <<EOM
5967
5968 I need to get your e-mail address in Internet format if possible, i.e.
5969 something like user@host.domain. Please answer accurately since I have
5970 no easy means to double check it. The default value provided below
5971 is most probably close to the reality but may not be valid from outside
5972 your organization...
5973
5974 EOM
5975 cont=x
5976 while test "$cont"; do
5977         case "$cf_email" in
5978         '') dflt="$cf_by@$myhostname$mydomain";;
5979         *) dflt="$cf_email";;
5980         esac
5981         rp='What is your e-mail address?'
5982         . ./myread
5983         cf_email="$ans"
5984         case "$cf_email" in
5985         *@*.*) cont='' ;;
5986         *)
5987                 rp='Address does not look like an Internet one.  Use it anyway?'
5988                 case "$fastread" in
5989                 yes) dflt=y ;;
5990                 *) dflt=n ;;
5991                 esac
5992                 . ./myread
5993                 case "$ans" in
5994                 y*) cont='' ;;
5995                 *) echo " " ;;
5996                 esac
5997                 ;;
5998         esac
5999 done
6000
6001 $cat <<EOM
6002
6003 If you or somebody else will be maintaining perl at your site, please
6004 fill in the correct e-mail address here so that they may be contacted
6005 if necessary. Currently, the "perlbug" program included with perl
6006 will send mail to this address in addition to perlbug@perl.com. You may
6007 enter "none" for no administrator.
6008
6009 EOM
6010 case "$perladmin" in
6011 '') dflt="$cf_email";;
6012 *) dflt="$perladmin";;
6013 esac
6014 rp='Perl administrator e-mail address'
6015 . ./myread
6016 perladmin="$ans"
6017
6018 : figure out how to guarantee perl startup
6019 case "$startperl" in
6020 '')
6021         case "$sharpbang" in
6022         *!)
6023                 $cat <<EOH
6024
6025 I can use the #! construct to start perl on your system. This will
6026 make startup of perl scripts faster, but may cause problems if you
6027 want to share those scripts and perl is not in a standard place
6028 ($binexp/perl) on all your platforms. The alternative is to force
6029 a shell by starting the script with a single ':' character.
6030
6031 EOH
6032                 dflt="$binexp/perl"
6033                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6034                 . ./myread
6035                 case "$ans" in
6036                 none)   startperl=": # use perl";;
6037                 *)      startperl="#!$ans"
6038                         if $test 30 -lt `echo "$ans" | wc -c`; then
6039                                 $cat >&4 <<EOM
6040
6041 WARNING:  Some systems limit the #! command to 32 characters.
6042 If you experience difficulty running Perl scripts with #!, try
6043 installing Perl in a directory with a shorter pathname.
6044
6045 EOM
6046                         fi ;;
6047                 esac
6048                 ;;
6049         *) startperl=": # use perl"
6050                 ;;
6051         esac
6052         ;;
6053 esac
6054 echo "I'll use $startperl to start perl scripts."
6055
6056 : figure best path for perl in scripts
6057 case "$perlpath" in
6058 '')
6059         perlpath="$binexp/perl"
6060         case "$startperl" in
6061         *!*) ;;
6062         *)
6063                 $cat <<EOH
6064
6065 I will use the "eval 'exec'" idiom to start Perl on your system.
6066 I can use the full path of your Perl binary for this purpose, but
6067 doing so may cause problems if you want to share those scripts and
6068 Perl is not always in a standard place ($binexp/perl).
6069
6070 EOH
6071                 dflt="$binexp/perl"
6072                 rp="What path shall I use in \"eval 'exec'\"?"
6073                 . ./myread
6074                 perlpath="$ans"
6075                 ;;
6076         esac
6077         ;;
6078 esac
6079 case "$startperl" in
6080 *!*)    ;;
6081 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6082 esac
6083
6084 : determine where public executable scripts go
6085 set scriptdir scriptdir
6086 eval $prefixit
6087 case "$scriptdir" in
6088 '')
6089         dflt="$bin"
6090         : guess some guesses
6091         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6092         $test -d /usr/share/bin && dflt=/usr/share/bin
6093         $test -d /usr/local/script && dflt=/usr/local/script
6094         $test -d $prefixexp/script && dflt=$prefixexp/script
6095         set dflt
6096         eval $prefixup
6097         ;;
6098 *)  dflt="$scriptdir"
6099         ;;
6100 esac
6101 $cat <<EOM
6102  
6103 Some installations have a separate directory just for executable scripts so
6104 that they can mount it across multiple architectures but keep the scripts in
6105 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6106 Or you might just lump your scripts in with all your other executables.
6107  
6108 EOM
6109 fn=d~
6110 rp='Where do you keep publicly executable scripts?'
6111 . ./getfile
6112 if $test "X$ansexp" != "X$scriptdirexp"; then
6113         installscript=''
6114 fi
6115 scriptdir="$ans"
6116 scriptdirexp="$ansexp"
6117 if $afs; then
6118         $cat <<EOM
6119
6120 Since you are running AFS, I need to distinguish the directory in which
6121 scripts reside from the directory in which they are installed (and from
6122 which they are presumably copied to the former directory by occult means).
6123
6124 EOM
6125         case "$installscript" in
6126         '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
6127         *) dflt="$installscript";;
6128         esac
6129         fn=de~
6130         rp='Where will public scripts be installed?'
6131         . ./getfile
6132         installscript="$ans"
6133 else
6134         installscript="$scriptdirexp"
6135 fi
6136
6137 : determine where site specific libraries go.
6138 : Usual default is /usr/local/lib/perl5/site_perl/$apiversion
6139 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6140 case "$prefix" in
6141 *perl*) set dflt sitelib lib/site_$prog/$apiversion ;;
6142 *)       set dflt sitelib lib/$package/site_$prog/$apiversion ;;
6143 esac
6144 eval $prefixit
6145 $cat <<EOM
6146
6147 The installation process will also create a directory for
6148 site-specific extensions and modules.  Some users find it convenient
6149 to place all local files in this directory rather than in the main
6150 distribution directory.
6151
6152 EOM
6153 fn=d~+
6154 rp='Pathname for the site-specific library files?'
6155 . ./getfile
6156 if $test "X$sitelibexp" != "X$ansexp"; then
6157         installsitelib=''
6158 fi
6159 sitelib="$ans"
6160 sitelibexp="$ansexp"
6161 if $afs; then
6162         $cat <<EOM
6163
6164 Since you are running AFS, I need to distinguish the directory in
6165 which site-specific files reside from the directory in which they are
6166 installed (and from which they are presumably copied to the former
6167 directory by occult means).
6168
6169 EOM
6170         case "$installsitelib" in
6171         '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;;
6172         *) dflt="$installsitelib";;
6173         esac
6174         fn=de~
6175         rp='Where will site-specific files be installed?'
6176         . ./getfile
6177         installsitelib="$ans"
6178 else
6179         installsitelib="$sitelibexp"
6180 fi
6181
6182 : determine where site specific architecture-dependent libraries go.
6183 : sitelib  default is /usr/local/lib/perl5/site_perl/$apiversion
6184 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6185 : sitelib may have an optional trailing /share.
6186 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6187 tdflt="$tdflt/$archname"
6188 set sitearch sitearch none
6189 eval $prefixit
6190 case "$sitearch" in
6191 '')     dflt="$tdflt" ;;
6192 *)      dflt="$sitearch" ;;
6193 esac
6194 $cat <<EOM
6195
6196 The installation process will also create a directory for
6197 architecture-dependent site-specific extensions and modules.
6198
6199 EOM
6200 fn=nd~+
6201 rp='Pathname for the site-specific architecture-dependent library files?'
6202 . ./getfile
6203 if $test "X$sitearchexp" != "X$ansexp"; then
6204         installsitearch=''
6205 fi
6206 sitearch="$ans"
6207 sitearchexp="$ansexp"
6208 if $afs; then
6209         $cat <<EOM
6210
6211 Since you are running AFS, I need to distinguish the directory in
6212 which site-specific architecture-dependent library files reside from
6213 the directory in which they are installed (and from which they are
6214 presumably copied to the former directory by occult means).
6215
6216 EOM
6217         case "$installsitearch" in
6218         '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;;
6219         *) dflt="$installsitearch";;
6220         esac
6221         fn=de~
6222         rp='Where will site-specific architecture-dependent files be installed?'
6223         . ./getfile
6224         installsitearch="$ans"
6225 else
6226         installsitearch="$sitearchexp"
6227 fi
6228
6229 cat <<EOM
6230
6231 Previous version of $package used the standard IO mechanisms as defined
6232 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6233 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6234 the default.  This abstraction layer can use AT&T's sfio (if you already
6235 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6236 problems with some extension modules.  Using PerlIO with stdio is safe,
6237 but it is slower than plain stdio and therefore is not the default.
6238
6239 If this doesn't make any sense to you, just accept the default 'n'.
6240 EOM
6241 case "$useperlio" in
6242 $define|true|[yY]*)     dflt='y';;
6243 *) dflt='n';;
6244 esac
6245 rp='Use the experimental PerlIO abstraction layer?'
6246 . ./myread
6247 case "$ans" in
6248 y|Y) 
6249         val="$define"
6250         ;;     
6251 *)      
6252         echo "Ok, doing things the stdio way"
6253         val="$undef"
6254         ;;
6255 esac
6256 set useperlio
6257 eval $setvar 
6258
6259 : Check how to convert floats to strings.
6260 if test "X$d_Gconvert" = X; then
6261         echo " "
6262         echo "Checking for an efficient way to convert floats to strings."
6263         $cat >try.c <<'EOP'
6264 #ifdef TRY_gconvert
6265 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6266 char *myname = "gconvert";
6267 #endif
6268 #ifdef TRY_gcvt
6269 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6270 char *myname = "gcvt";
6271 #endif
6272 #ifdef TRY_sprintf
6273 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6274 char *myname = "sprintf";
6275 #endif
6276
6277 #include <stdio.h>
6278
6279 int
6280 checkit(expect, got)
6281 char *expect;
6282 char *got;
6283 {
6284     if (strcmp(expect, got)) {
6285                 printf("%s oddity:  Expected %s, got %s\n",
6286                         myname, expect, got);
6287                 exit(1);
6288         }
6289 }
6290
6291 int main()
6292
6293         char buf[64]; 
6294         buf[63] = '\0';
6295
6296         /* This must be 1st test on (which?) platform */
6297         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6298         Gconvert(0.1, 8, 0, buf);
6299         checkit("0.1", buf);
6300
6301         Gconvert(1.0, 8, 0, buf); 
6302         checkit("1", buf);
6303
6304         Gconvert(0.0, 8, 0, buf); 
6305         checkit("0", buf);
6306
6307         Gconvert(-1.0, 8, 0, buf); 
6308         checkit("-1", buf);
6309
6310         /* Some Linux gcvt's give 1.e+5 here. */
6311         Gconvert(100000.0, 8, 0, buf); 
6312         checkit("100000", buf);
6313         
6314         /* Some Linux gcvt's give -1.e+5 here. */
6315         Gconvert(-100000.0, 8, 0, buf); 
6316         checkit("-100000", buf);
6317
6318         exit(0);
6319 }
6320 EOP
6321         case "$d_Gconvert" in
6322         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6323         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6324         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6325         *) xxx_list='gconvert gcvt sprintf' ;;
6326         esac
6327
6328         for xxx_convert in $xxx_list; do
6329                 echo "Trying $xxx_convert"
6330                 $rm -f try try$_o
6331                 set try -DTRY_$xxx_convert
6332                 if eval $compile; then
6333                         echo "$xxx_convert" found. >&4
6334                         if ./try; then
6335                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6336                                 break;
6337                         else
6338                                 echo "...But $xxx_convert didn't work as I expected."
6339                         fi
6340                 else
6341                         echo "$xxx_convert NOT found." >&4
6342                 fi
6343         done
6344                 
6345         case "$xxx_convert" in
6346         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6347         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6348         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6349         esac
6350 fi
6351
6352 : Initialize h_fcntl
6353 h_fcntl=false
6354
6355 : Initialize h_sysfile
6356 h_sysfile=false
6357
6358 : access call always available on UNIX
6359 set access d_access
6360 eval $inlibc
6361
6362 : locate the flags for 'access()'
6363 case "$d_access" in
6364 "$define")
6365         echo " "
6366         $cat >access.c <<'EOCP'
6367 #include <sys/types.h>
6368 #ifdef I_FCNTL
6369 #include <fcntl.h>
6370 #endif
6371 #ifdef I_SYS_FILE
6372 #include <sys/file.h>
6373 #endif
6374 #ifdef I_UNISTD
6375 #include <unistd.h>
6376 #endif
6377 int main() {
6378         exit(R_OK);
6379 }
6380 EOCP
6381         : check sys/file.h first, no particular reason here
6382         if $test `./findhdr sys/file.h` && \
6383                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
6384                 h_sysfile=true;
6385                 echo "<sys/file.h> defines the *_OK access constants." >&4
6386         elif $test `./findhdr fcntl.h` && \
6387                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
6388                 h_fcntl=true;
6389                 echo "<fcntl.h> defines the *_OK access constants." >&4
6390         elif $test `./findhdr unistd.h` && \
6391                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
6392                 echo "<unistd.h> defines the *_OK access constants." >&4
6393         else
6394                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
6395         fi
6396         ;;
6397 esac
6398 $rm -f access*
6399
6400 : see if accessx exists
6401 set accessx d_accessx
6402 eval $inlibc
6403
6404 : see if alarm exists
6405 set alarm d_alarm
6406 eval $inlibc
6407
6408 : Look for GNU-cc style attribute checking
6409 echo " "
6410 echo "Checking whether your compiler can handle __attribute__ ..." >&4
6411 $cat >attrib.c <<'EOCP'
6412 #include <stdio.h>
6413 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
6414 EOCP
6415 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
6416         if $contains 'warning' attrib.out >/dev/null 2>&1; then
6417                 echo "Your C compiler doesn't fully support __attribute__."
6418                 val="$undef"
6419         else
6420                 echo "Your C compiler supports __attribute__."
6421                 val="$define"
6422         fi
6423 else
6424         echo "Your C compiler doesn't seem to understand __attribute__ at all."
6425         val="$undef"
6426 fi
6427 set d_attribut
6428 eval $setvar
6429 $rm -f attrib*
6430
6431 : see if bcmp exists
6432 set bcmp d_bcmp
6433 eval $inlibc
6434
6435 : see if bcopy exists
6436 set bcopy d_bcopy
6437 eval $inlibc
6438
6439 : see if this is a unistd.h system
6440 set unistd.h i_unistd
6441 eval $inhdr
6442
6443 : see if getpgrp exists
6444 set getpgrp d_getpgrp
6445 eval $inlibc
6446
6447 case "$d_getpgrp" in
6448 "$define")
6449         echo " "
6450         echo "Checking to see which flavor of getpgrp is in use..."
6451         $cat >set.c <<EOP
6452 #$i_unistd I_UNISTD
6453 #include <sys/types.h>
6454 #ifdef I_UNISTD
6455 #  include <unistd.h>
6456 #endif
6457 int main()
6458 {
6459         if (getuid() == 0) {
6460                 printf("(I see you are running Configure as super-user...)\n");
6461                 setuid(1);
6462         }
6463 #ifdef TRY_BSD_PGRP
6464         if (getpgrp(1) == 0)
6465                 exit(0);
6466 #else
6467         if (getpgrp() > 0)
6468                 exit(0);
6469 #endif
6470         exit(1);
6471 }
6472 EOP
6473         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6474                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
6475                 val="$define"
6476         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6477                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
6478                 val="$undef"
6479         else
6480                 echo "I can't seem to compile and run the test program."
6481                 if ./usg; then
6482                         xxx="a USG one, i.e. you use getpgrp()."
6483                 else
6484                         # SVR4 systems can appear rather BSD-ish.
6485                         case "$i_unistd" in
6486                         $undef)
6487                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
6488                                 val="$define"
6489                                 ;;
6490                         $define)
6491                                 xxx="probably a USG one, i.e. you use getpgrp()."
6492                                 val="$undef"
6493                                 ;;
6494                         esac
6495                 fi
6496                 echo "Assuming your getpgrp is $xxx" >&4
6497         fi
6498         ;;
6499 *) val="$undef";;
6500 esac
6501 set d_bsdgetpgrp
6502 eval $setvar
6503 $rm -f set set.c
6504
6505 : see if setpgrp exists
6506 set setpgrp d_setpgrp
6507 eval $inlibc
6508
6509 case "$d_setpgrp" in
6510 "$define")
6511         echo " "
6512         echo "Checking to see which flavor of setpgrp is in use..."
6513         $cat >set.c <<EOP
6514 #$i_unistd I_UNISTD
6515 #include <sys/types.h>
6516 #ifdef I_UNISTD
6517 #  include <unistd.h>
6518 #endif
6519 int main()
6520 {
6521         if (getuid() == 0) {
6522                 printf("(I see you are running Configure as super-user...)\n");
6523                 setuid(1);
6524         }
6525 #ifdef TRY_BSD_PGRP
6526         if (-1 == setpgrp(1, 1))
6527                 exit(0);
6528 #else
6529         if (setpgrp() != -1)
6530                 exit(0);
6531 #endif
6532         exit(1);
6533 }
6534 EOP
6535         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6536                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
6537                 val="$define"
6538         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
6539                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
6540                 val="$undef"
6541         else
6542                 echo "(I can't seem to compile and run the test program.)"
6543                 if ./usg; then
6544                         xxx="a USG one, i.e. you use setpgrp()."
6545                 else
6546                         # SVR4 systems can appear rather BSD-ish.
6547                         case "$i_unistd" in
6548                         $undef)
6549                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
6550                                 val="$define"
6551                                 ;;
6552                         $define)
6553                                 xxx="probably a USG one, i.e. you use setpgrp()."
6554                                 val="$undef"
6555                                 ;;
6556                         esac
6557                 fi
6558                 echo "Assuming your setpgrp is $xxx" >&4
6559         fi
6560         ;;
6561 *) val="$undef";;
6562 esac
6563 set d_bsdsetpgrp
6564 eval $setvar
6565 $rm -f set set.c
6566 : see if bzero exists
6567 set bzero d_bzero
6568 eval $inlibc
6569
6570 : check for lengths of integral types
6571 echo " "
6572 case "$intsize" in
6573 '')
6574         echo "Checking to see how big your integers are..." >&4
6575         $cat >intsize.c <<'EOCP'
6576 #include <stdio.h>
6577 int main()
6578 {
6579         printf("intsize=%d;\n", sizeof(int));
6580         printf("longsize=%d;\n", sizeof(long));
6581         printf("shortsize=%d;\n", sizeof(short));
6582         exit(0);
6583 }
6584 EOCP
6585         set intsize
6586         if eval $compile_ok && ./intsize > /dev/null; then
6587                 eval `./intsize`
6588                 echo "Your integers are $intsize bytes long."
6589                 echo "Your long integers are $longsize bytes long."
6590                 echo "Your short integers are $shortsize bytes long."
6591         else
6592                 $cat >&4 <<EOM
6593 !
6594 Help! I can't compile and run the intsize test program: please enlighten me!
6595 (This is probably a misconfiguration in your system or libraries, and
6596 you really ought to fix it.  Still, I'll try anyway.)
6597 !
6598 EOM
6599                 dflt=4
6600                 rp="What is the size of an integer (in bytes)?"
6601                 . ./myread
6602                 intsize="$ans"
6603                 dflt=$intsize
6604                 rp="What is the size of a long integer (in bytes)?"
6605                 . ./myread
6606                 longsize="$ans"
6607                 dflt=2
6608                 rp="What is the size of a short integer (in bytes)?"
6609                 . ./myread
6610                 shortsize="$ans"
6611         fi
6612         ;;
6613 esac
6614 $rm -f intsize intsize.*
6615
6616 : see if signal is declared as pointer to function returning int or void
6617 echo " "
6618 xxx=`./findhdr signal.h`
6619 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
6620 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
6621         echo "You have int (*signal())() instead of void." >&4
6622         val="$undef"
6623 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
6624         echo "You have void (*signal())()." >&4
6625         val="$define"
6626 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
6627         echo "You have int (*signal())() instead of void." >&4
6628         val="$undef"
6629 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
6630         echo "You have void (*signal())()." >&4
6631         val="$define"
6632 else
6633         case "$d_voidsig" in
6634         '')
6635         echo "I can't determine whether signal handler returns void or int..." >&4
6636                 dflt=void
6637                 rp="What type does your signal handler return?"
6638                 . ./myread
6639                 case "$ans" in
6640                 v*) val="$define";;
6641                 *) val="$undef";;
6642                 esac;;
6643         "$define")
6644                 echo "As you already told me, signal handler returns void." >&4
6645                 val="$define"
6646                 ;;
6647         *)      echo "As you already told me, signal handler returns int." >&4
6648                 val="$undef"
6649                 ;;
6650         esac
6651 fi
6652 set d_voidsig
6653 eval $setvar
6654 case "$d_voidsig" in
6655 "$define") signal_t="void";;
6656 *) signal_t="int";;
6657 esac
6658 $rm -f $$.tmp
6659
6660 : check for ability to cast large floats to 32-bit ints.
6661 echo " "
6662 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
6663 if $test "$intsize" -ge 4; then
6664         xxx=int
6665 else
6666         xxx=long
6667 fi
6668 $cat >try.c <<EOCP
6669 #include <stdio.h>
6670 #include <sys/types.h>
6671 #include <signal.h>
6672 $signal_t blech(s) int s; { exit(3); }
6673 int main()
6674 {
6675         $xxx i32;
6676         double f, g;
6677         int result = 0;
6678         char str[16];
6679         signal(SIGFPE, blech);
6680
6681         /* Don't let compiler optimize the test away.  Store the number 
6682            in a writable string for gcc to pass to sscanf under HP/UX.
6683         */
6684         sprintf(str, "2147483647");
6685         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
6686         g = 10 * f;
6687         i32  = ($xxx) g;
6688
6689         /* x86 processors will probably give 0x8000 0000, which is a
6690        sign change.  We don't want that.  We want to mimic SPARC
6691            behavior here, which is to preserve the sign and give
6692            back 0x7fff ffff.
6693         */
6694         if (i32 != ($xxx) f)
6695                 result |= 1;
6696         exit(result);
6697 }
6698 EOCP
6699 set try
6700 if eval $compile_ok; then
6701         ./try
6702         yyy=$?
6703 else
6704         echo "(I can't seem to compile the test program--assuming it can't)"
6705         yyy=1
6706 fi
6707 case "$yyy" in
6708 0)      val="$define"
6709         echo "Yup, it can."
6710         ;;
6711 *)      val="$undef"
6712         echo "Nope, it can't."
6713         ;;
6714 esac
6715 set d_casti32
6716 eval $setvar
6717 $rm -f try try.*
6718
6719 : check for ability to cast negative floats to unsigned
6720 echo " "
6721 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
6722 $cat >try.c <<EOCP
6723 #include <stdio.h>
6724 #include <sys/types.h>
6725 #include <signal.h>
6726 $signal_t blech(s) int s; { exit(7); }
6727 $signal_t blech_in_list(s) int s; { exit(4); }
6728 unsigned long dummy_long(p) unsigned long p; { return p; }
6729 unsigned int dummy_int(p) unsigned int p; { return p; }
6730 unsigned short dummy_short(p) unsigned short p; { return p; }
6731 int main()
6732 {
6733         double f;
6734         unsigned long along;
6735         unsigned int aint;
6736         unsigned short ashort;
6737         int result = 0;
6738         char str[16];
6739         
6740         /* Frustrate gcc-2.7.2's optimizer which failed this test with
6741            a direct f = -123. assignment.  gcc-2.8.0 reportedly
6742            optimized the whole file away
6743         */
6744         /* Store the number in a writable string for gcc to pass to 
6745            sscanf under HP/UX.
6746         */
6747         sprintf(str, "-123");
6748         sscanf(str, "%lf", &f);  /* f = -123.; */
6749
6750         signal(SIGFPE, blech);
6751         along = (unsigned long)f;
6752         aint = (unsigned int)f;
6753         ashort = (unsigned short)f;
6754         if (along != (unsigned long)-123)
6755                 result |= 1;
6756         if (aint != (unsigned int)-123)
6757                 result |= 1;
6758         if (ashort != (unsigned short)-123)
6759                 result |= 1;
6760         sprintf(str, "1073741824.");
6761         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
6762         f = f + f;
6763         along = 0;
6764         along = (unsigned long)f;
6765         if (along != 0x80000000)
6766                 result |= 2;
6767         f -= 1.;
6768         along = 0;
6769         along = (unsigned long)f;
6770         if (along != 0x7fffffff)
6771                 result |= 1;
6772         f += 2.;
6773         along = 0;
6774         along = (unsigned long)f;
6775         if (along != 0x80000001)
6776                 result |= 2;
6777         if (result)
6778                 exit(result);
6779         signal(SIGFPE, blech_in_list);
6780         sprintf(str, "123.");
6781         sscanf(str, "%lf", &f);  /* f = 123.; */
6782         along = dummy_long((unsigned long)f);
6783         aint = dummy_int((unsigned int)f);
6784         ashort = dummy_short((unsigned short)f);
6785         if (along != (unsigned long)123)
6786                 result |= 4;
6787         if (aint != (unsigned int)123)
6788                 result |= 4;
6789         if (ashort != (unsigned short)123)
6790                 result |= 4;
6791         exit(result);
6792
6793 }
6794 EOCP
6795 set try
6796 if eval $compile_ok; then
6797         ./try
6798         castflags=$?
6799 else
6800         echo "(I can't seem to compile the test program--assuming it can't)"
6801         castflags=7
6802 fi
6803 case "$castflags" in
6804 0)      val="$define"
6805         echo "Yup, it can."
6806         ;;
6807 *)      val="$undef"
6808         echo "Nope, it can't."
6809         ;;
6810 esac
6811 set d_castneg
6812 eval $setvar
6813 $rm -f try.*
6814
6815 : see if vprintf exists
6816 echo " "
6817 if set vprintf val -f d_vprintf; eval $csym; $val; then
6818         echo 'vprintf() found.' >&4
6819         val="$define"
6820         $cat >vprintf.c <<'EOF'
6821 #include <varargs.h>
6822
6823 int main() { xxx("foo"); }
6824
6825 xxx(va_alist)
6826 va_dcl
6827 {
6828         va_list args;
6829         char buf[10];
6830
6831         va_start(args);
6832         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
6833 }
6834 EOF
6835         set vprintf
6836         if eval $compile && ./vprintf; then
6837                 echo "Your vsprintf() returns (int)." >&4
6838                 val2="$undef"
6839         else
6840                 echo "Your vsprintf() returns (char*)." >&4
6841                 val2="$define"
6842         fi
6843 else
6844         echo 'vprintf() NOT found.' >&4
6845                 val="$undef"
6846                 val2="$undef"
6847 fi
6848 set d_vprintf
6849 eval $setvar
6850 val=$val2
6851 set d_charvspr
6852 eval $setvar
6853
6854 : see if chown exists
6855 set chown d_chown
6856 eval $inlibc
6857
6858 : see if chroot exists
6859 set chroot d_chroot
6860 eval $inlibc
6861
6862 : see if chsize exists
6863 set chsize d_chsize
6864 eval $inlibc
6865
6866 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
6867 while $test $# -ge 2; do
6868         case "$1" in
6869         $define) echo "#include <$2>";;
6870         esac ;
6871     shift 2;
6872 done > try.c;
6873 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
6874 if eval $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6875         val="$define";
6876 else
6877         val="$undef";
6878 fi;
6879 set $varname;
6880 eval $setvar;
6881 $rm -f try.c try.o'
6882
6883 : see if this is a sys/uio.h system
6884 set sys/uio.h i_sysuio
6885 eval $inhdr
6886
6887 echo "Checking to see if your system supports struct iovec..." >&4
6888 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
6889 eval $hasfield
6890 case "$d_iovec_s" in
6891 "$define")      echo "Yup, it does." >&4
6892                 ;;
6893 *)              echo "Nope, it doesn't." >&4
6894                 ;;
6895 esac
6896
6897 socketlib=''
6898 sockethdr=''
6899 : see whether socket exists
6900 echo " "
6901 $echo $n "Hmm... $c" >&4
6902 if set socket val -f d_socket; eval $csym; $val; then
6903         echo "Looks like you have Berkeley networking support." >&4
6904         d_socket="$define"
6905         if set setsockopt val -f; eval $csym; $val; then
6906                 d_oldsock="$undef"
6907         else
6908                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
6909                 d_oldsock="$define"
6910         fi
6911 else
6912         if $contains socklib libc.list >/dev/null 2>&1; then
6913                 echo "Looks like you have Berkeley networking support." >&4
6914                 d_socket="$define"
6915                 : we will have to assume that it supports the 4.2 BSD interface
6916                 d_oldsock="$undef"
6917         else
6918                 echo "You don't have Berkeley networking in libc$_a..." >&4
6919                 if test "X$d_socket" = "X$define"; then
6920                    echo "...but you seem to believe that you have sockets." >&4
6921                 else
6922                         for net in net socket
6923                         do
6924                                 if test -f /usr/lib/lib$net$_a; then
6925                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
6926                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
6927                                         if $contains socket libc.list >/dev/null 2>&1; then
6928                                                 d_socket="$define"
6929                                                 socketlib="-l$net"
6930                                                 case "$net" in
6931                                                 net)
6932                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
6933                                                         sockethdr="-I/usr/netinclude"
6934                                                         ;;
6935                                                 esac
6936                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
6937                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
6938                                                         d_oldsock="$undef"
6939                                                 else
6940                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
6941                                                         d_oldsock="$define"
6942                                                 fi
6943                                                 break
6944                                         fi
6945                                 fi
6946                         done
6947                         if test "X$d_socket" != "X$define"; then
6948                            echo "or anywhere else I see." >&4
6949                            d_socket="$undef"
6950                            d_oldsock="$undef"
6951                         fi
6952                 fi
6953         fi
6954 fi
6955
6956 : see if socketpair exists
6957 set socketpair d_sockpair
6958 eval $inlibc
6959
6960
6961 echo " "
6962 echo "Checking the availability of certain socket constants..." >& 4
6963 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
6964         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
6965         $cat >try.c <<EOF
6966 #include <sys/types.h>
6967 #include <sys/socket.h>
6968 int main() {
6969     int i = $ENUM;
6970 }
6971 EOF
6972         val="$undef"
6973         set try; if eval $compile; then
6974                 val="$define"
6975         fi
6976         set d_${enum}; eval $setvar
6977         $rm -f try.c try
6978 done
6979
6980 set sendmsg d_sendmsg
6981 eval $inlibc
6982
6983 set recvmsg d_recvmsg
6984 eval $inlibc
6985
6986 echo " "
6987 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
6988 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
6989 eval $hasfield
6990 case "$d_msghdr_s" in
6991 "$define")      echo "Yup, it does." >&4
6992                 ;;
6993 *)              echo "Nope, it doesn't." >&4
6994                 ;;
6995 esac
6996
6997 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
6998 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
6999 eval $hasfield
7000 case "$d_cmsghdr_s" in
7001 "$define")      echo "Yup, it does." >&4
7002                 ;;
7003 *)              echo "Nope, it doesn't." >&4
7004                 ;;
7005 esac
7006
7007 : check for const keyword
7008 echo " "
7009 echo 'Checking to see if your C compiler knows about "const"...' >&4
7010 $cat >const.c <<'EOCP'
7011 typedef struct spug { int drokk; } spug;
7012 int main()
7013 {
7014         const char *foo;
7015         const spug y;
7016 }
7017 EOCP
7018 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7019         val="$define"
7020         echo "Yup, it does."
7021 else
7022         val="$undef"
7023         echo "Nope, it doesn't."
7024 fi
7025 set d_const
7026 eval $setvar
7027
7028 : see if crypt exists
7029 echo " "
7030 if set crypt val -f d_crypt; eval $csym; $val; then
7031         echo 'crypt() found.' >&4
7032         val="$define"
7033         cryptlib=''
7034 else
7035         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7036         if $test -z "$cryptlib"; then
7037                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7038         else
7039                 cryptlib=-lcrypt
7040         fi
7041         if $test -z "$cryptlib"; then
7042                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7043         else
7044                 cryptlib=-lcrypt
7045         fi
7046         if $test -z "$cryptlib"; then
7047                 cryptlib=`./loc libcrypt$_a "" $libpth`
7048         else
7049                 cryptlib=-lcrypt
7050         fi
7051         if $test -z "$cryptlib"; then
7052                 echo 'crypt() NOT found.' >&4
7053                 val="$undef"
7054         else
7055                 val="$define"
7056         fi
7057 fi
7058 set d_crypt
7059 eval $setvar
7060
7061 : get csh whereabouts
7062 case "$csh" in
7063 'csh') val="$undef" ;;
7064 *) val="$define" ;;
7065 esac
7066 set d_csh
7067 eval $setvar
7068 : Respect a hint or command line value for full_csh.
7069 case "$full_csh" in
7070 '') full_csh=$csh ;;
7071 esac
7072
7073 : see if cuserid exists
7074 set cuserid d_cuserid
7075 eval $inlibc
7076
7077 : see if this is a limits.h system
7078 set limits.h i_limits
7079 eval $inhdr
7080
7081 : see if this is a float.h system
7082 set float.h i_float
7083 eval $inhdr
7084
7085 : See if number of significant digits in a double precision number is known
7086 echo " "
7087 $cat >dbl_dig.c <<EOM
7088 #$i_limits I_LIMITS
7089 #$i_float I_FLOAT
7090 #ifdef I_LIMITS
7091 #include <limits.h>
7092 #endif
7093 #ifdef I_FLOAT
7094 #include <float.h>
7095 #endif
7096 #ifdef DBL_DIG
7097 printf("Contains DBL_DIG");
7098 #endif
7099 EOM
7100 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7101 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7102         echo "DBL_DIG found." >&4
7103         val="$define"
7104 else
7105         echo "DBL_DIG NOT found." >&4
7106         val="$undef"
7107 fi
7108 $rm -f dbl_dig.?
7109 set d_dbl_dig
7110 eval $setvar
7111
7112
7113 if $test X"$use64bits" = X"$define"; then
7114         : see if dbminit64 exists
7115         set dbminit64 d_dbminit64
7116         eval $inlibc
7117
7118         : see if dbmclose64 exists
7119         set dbmclose64 d_dbmclose64
7120         eval $inlibc
7121
7122         : see if fetch64 exists
7123         set fetch64 d_fetch64
7124         eval $inlibc
7125
7126         : see if store64 exists
7127         set store64 d_store64
7128         eval $inlibc
7129
7130         : see if delete64 exists
7131         set delete64 d_delete64
7132         eval $inlibc
7133
7134         : see if firstkey64 exists
7135         set firstkey64 d_firstkey64
7136         eval $inlibc
7137
7138         : see if nextkey64 exists
7139         set nextkey64 d_nextkey64
7140         eval $inlibc
7141 else
7142         val="$undef"
7143         for xxx in d_dbminit64 d_dbmclose64 d_fetch64 d_store64 d_delete64 d_firstkey64 d_nextkey64
7144         do
7145                 set $xxx
7146                 eval $setvar
7147         done
7148 fi
7149
7150 : see if difftime exists
7151 set difftime d_difftime
7152 eval $inlibc
7153
7154 : see if sys/stat.h is available
7155 set sys/stat.h i_sysstat
7156 eval $inhdr
7157
7158 : see if this is a dirent system
7159 echo " "
7160 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7161         val="$define"
7162         echo "<dirent.h> found." >&4
7163 else
7164         val="$undef"
7165         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7166                 echo "<sys/dir.h> found." >&4
7167                 echo " "
7168         else
7169                 xinc=`./findhdr sys/ndir.h`
7170         fi
7171         echo "<dirent.h> NOT found." >&4
7172 fi
7173 set i_dirent
7174 eval $setvar
7175
7176 : Look for type of directory structure.
7177 echo " "
7178 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7179
7180 case "$direntrytype" in
7181 ''|' ')
7182         case "$i_dirent" in
7183         $define) guess1='struct dirent' ;;
7184         *) guess1='struct direct'  ;;
7185         esac
7186         ;;
7187 *)      guess1="$direntrytype"
7188         ;;
7189 esac
7190
7191 case "$guess1" in
7192 'struct dirent') guess2='struct direct' ;;
7193 *) guess2='struct dirent' ;;
7194 esac
7195                 
7196 if $contains "$guess1" try.c >/dev/null 2>&1; then
7197         direntrytype="$guess1"
7198         echo "Your directory entries are $direntrytype." >&4
7199 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7200         direntrytype="$guess2"
7201         echo "Your directory entries seem to be $direntrytype." >&4
7202 else
7203         echo "I don't recognize your system's directory entries." >&4
7204         rp="What type is used for directory entries on this system?"
7205         dflt="$guess1"
7206         . ./myread
7207         direntrytype="$ans"
7208 fi
7209 $rm -f try.c
7210
7211
7212 : see if the directory entry stores field length
7213 echo " "
7214 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7215 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7216         echo "Good, your directory entry keeps length information in d_namlen." >&4
7217         val="$define"
7218 else
7219         echo "Your directory entry does not know about the d_namlen field." >&4
7220         val="$undef"
7221 fi
7222 set d_dirnamlen
7223 eval $setvar
7224 $rm -f try.c
7225
7226
7227 if $test X"$use64bits" = X"$define"; then
7228         : see if fstat64 exists
7229         set fstat64 d_fstat64
7230         eval $inlibc
7231
7232         : see if ftruncate64 exists
7233         set ftruncate64 d_ftruncate64
7234         eval $inlibc
7235
7236         : see if lockf64 exists
7237         set lockf64 d_lockf64
7238         eval $inlibc
7239
7240         : see if lseek64 exists
7241         set lseek64 d_lseek64
7242         eval $inlibc
7243
7244         : see if lstat64 exists
7245         set lstat64 d_lstat64
7246         eval $inlibc
7247
7248         : see if open64 exists
7249         set open64 d_open64
7250         eval $inlibc
7251
7252         : see if opendir64 exists
7253         set opendir64 d_opendir64
7254         eval $inlibc
7255
7256         : see if readdir64 exists
7257         set readdir64 d_readdir64
7258         eval $inlibc
7259
7260         : see if seekdir64 exists
7261         set seekdir64 d_seekdir64
7262         eval $inlibc
7263
7264         : see if stat64 exists
7265         set stat64 d_stat64
7266         eval $inlibc
7267
7268         : see if telldir64 exists
7269         set telldir64 d_telldir64
7270         eval $inlibc
7271
7272         : see if truncate64 exists
7273         set truncate64 d_truncate64
7274         eval $inlibc
7275
7276         : check for off64_t
7277         echo " "
7278         echo $n "Checking to see if your system supports off64_t...$c" >&4
7279         $cat >try.c <<EOCP
7280 #include <sys/types.h>
7281 off64_t foo() { off64_t x; x = 7; return x; }'
7282 EOCP
7283         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7284                 val="$define"
7285                 echo " Yup, it does." >&4
7286         else
7287                 val="$undef"
7288                 echo " Nope, it doesn't." >&4
7289         fi
7290         $rm -f try.*
7291         set d_off64t
7292         eval $setvar
7293
7294         : check for ino64_t
7295         echo " "
7296         echo $n "Checking to see if your system supports ino64_t...$c" >&4
7297         val="$undef"
7298         case "$i_sysstat" in
7299         "$define" )
7300                 $cat >try.c <<EOCP
7301 #include <sys/types.h>
7302 #include <sys/stat.h>
7303 ino64_t foo() { ino64_t x; x = 7; return x; }'
7304 EOCP
7305                 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7306                         val="$define"
7307                 fi
7308                 $rm -f try.*
7309                 ;;
7310         esac
7311         if $test "X$val" = X"$define"; then
7312                 echo " Yup, it does." >&4
7313         else
7314                 echo " Nope, it doesn't." >&4
7315         fi
7316         set d_ino64t
7317         eval $setvar
7318
7319         : check for struct flock64
7320         echo " "
7321         echo "Checking to see if your system supports struct flock64..." >&4
7322         if $h_fcntl; then
7323                 set d_flock64_s flock64 l_len define fcntl.h
7324                 eval $hasfield
7325         else
7326                 val="$undef"
7327                 set d_flock64_s
7328                 eval $setvar
7329         fi
7330         case "$d_flock64_s" in
7331         "$define")      echo "Yup, it does." >&4
7332                         ;;
7333         *)              echo "Nope, it doesn't." >&4
7334                         ;;
7335         esac
7336
7337         : check for struct dirent64
7338         echo " "
7339         echo "Checking to see if your system supports struct dirent64..." >&4
7340         set d_dirent64_s dirent64 d_off $i_dirent dirent.h
7341         eval $hasfield
7342         case "$d_dirent64_s" in
7343         "$define")      echo "Yup, it does." >&4
7344                         ;;
7345         *)              echo "Nope, it doesn't." >&4
7346                         ;;
7347         esac
7348
7349 else
7350         val="$undef"
7351         for xxx in d_fstat64 d_ftruncate64 d_lockf64 d_lseek64 d_lstat64 d_open64 d_opendir64 d_readdir64 d_seekdir64 d_stat64 d_telldir64 d_truncate64 d_off64t d_ino64t d_flock64_s d_dirent64_s
7352         do
7353                 set $xxx
7354                 eval $setvar
7355         done
7356 fi
7357
7358 : see if dlerror exists
7359 xxx_runnm="$runnm"
7360 runnm=false
7361 set dlerror d_dlerror
7362 eval $inlibc
7363 runnm="$xxx_runnm"
7364
7365 : see if dlfcn is available
7366 set dlfcn.h i_dlfcn
7367 eval $inhdr
7368
7369 case "$usedl" in
7370 $define|y|true)
7371         $cat << EOM
7372
7373 On a few systems, the dynamically loaded modules that perl generates and uses
7374 will need a different extension than shared libs. The default will probably
7375 be appropriate.
7376
7377 EOM
7378         case "$dlext" in
7379         '')     dflt="$so" ;;
7380         *)      dflt="$dlext" ;;
7381         esac
7382         rp='What is the extension of dynamically loaded modules'
7383         . ./myread
7384         dlext="$ans"
7385         ;;
7386 *)
7387         dlext="none"
7388         ;;
7389 esac
7390
7391 : Check if dlsym need a leading underscore
7392 echo " "
7393 val="$undef"
7394
7395 case "$dlsrc" in
7396 dl_dlopen.xs)
7397         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7398         $cat >dyna.c <<'EOM'
7399 fred () { }
7400 EOM
7401
7402 $cat >fred.c<<EOM
7403
7404 #include <stdio.h>
7405 #$i_dlfcn I_DLFCN
7406 #ifdef I_DLFCN
7407 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
7408 #else
7409 #include <sys/types.h>
7410 #include <nlist.h>
7411 #include <link.h>
7412 #endif
7413
7414 extern int fred() ;
7415
7416 int main()
7417 {
7418     void * handle ;
7419     void * symbol ;
7420 #ifndef RTLD_LAZY
7421     int mode = 1 ;
7422 #else
7423     int mode = RTLD_LAZY ;
7424 #endif
7425     handle = dlopen("./dyna.$dlext", mode) ;
7426     if (handle == NULL) {
7427         printf ("1\n") ;
7428         fflush (stdout) ;
7429         exit(0);
7430     }
7431     symbol = dlsym(handle, "fred") ;
7432     if (symbol == NULL) {
7433         /* try putting a leading underscore */
7434         symbol = dlsym(handle, "_fred") ;
7435         if (symbol == NULL) {
7436             printf ("2\n") ;
7437             fflush (stdout) ;
7438             exit(0);
7439         }
7440         printf ("3\n") ;
7441     }
7442     else
7443         printf ("4\n") ;
7444     fflush (stdout) ;
7445     exit(0);
7446 }
7447 EOM
7448         : Call the object file tmp-dyna.o in case dlext=o.
7449         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
7450                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
7451                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
7452                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
7453                 xxx=`./fred`
7454                 case $xxx in
7455                 1)      echo "Test program failed using dlopen." >&4
7456                         echo "Perhaps you should not use dynamic loading." >&4;;
7457                 2)      echo "Test program failed using dlsym." >&4
7458                         echo "Perhaps you should not use dynamic loading." >&4;;
7459                 3)      echo "dlsym needs a leading underscore" >&4
7460                         val="$define" ;;
7461                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
7462                 esac
7463         else
7464                 echo "I can't compile and run the test program." >&4
7465         fi
7466         ;;
7467 esac
7468                 
7469 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
7470
7471 set d_dlsymun
7472 eval $setvar
7473
7474 hasproto='varname=$1; func=$2; shift; shift;
7475 while $test $# -ge 2; do
7476         case "$1" in
7477         $define) echo "#include <$2>";;
7478         esac ;
7479     shift 2;
7480 done > try.c;
7481 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
7482 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
7483         echo "$func() prototype found.";
7484         val="$define";
7485 else
7486         echo "$func() prototype NOT found.";
7487         val="$undef";
7488 fi;
7489 set $varname;
7490 eval $setvar;
7491 $rm -f try.c tryout.c'
7492
7493 : see if prototype for drand48 is available
7494 echo " "
7495 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
7496 eval $hasproto
7497
7498 : see if dup2 exists
7499 set dup2 d_dup2
7500 eval $inlibc
7501
7502 : see if eaccess exists
7503 set eaccess d_eaccess
7504 eval $inlibc
7505
7506 : see if endgrent exists
7507 set endgrent d_endgrent
7508 eval $inlibc
7509
7510 : see if endhostent exists
7511 set endhostent d_endhent
7512 eval $inlibc
7513
7514 : see if endnetent exists
7515 set endnetent d_endnent
7516 eval $inlibc
7517
7518 : see if endprotoent exists
7519 set endprotoent d_endpent
7520 eval $inlibc
7521
7522 : see if endpwent exists
7523 set endpwent d_endpwent
7524 eval $inlibc
7525
7526 : see if endservent exists
7527 set endservent d_endsent
7528 eval $inlibc
7529
7530 : Locate the flags for 'open()'
7531 echo " "
7532 $cat >open3.c <<'EOCP'
7533 #include <sys/types.h>
7534 #ifdef I_FCNTL
7535 #include <fcntl.h>
7536 #endif
7537 #ifdef I_SYS_FILE
7538 #include <sys/file.h>
7539 #endif
7540 int main() {
7541         if(O_RDONLY);
7542 #ifdef O_TRUNC
7543         exit(0);
7544 #else
7545         exit(1);
7546 #endif
7547 }
7548 EOCP
7549 : check sys/file.h first to get FREAD on Sun
7550 if $test `./findhdr sys/file.h` && \
7551                 set open3 -DI_SYS_FILE && eval $compile; then
7552         h_sysfile=true;
7553         echo "<sys/file.h> defines the O_* constants..." >&4
7554         if ./open3; then
7555                 echo "and you have the 3 argument form of open()." >&4
7556                 val="$define"
7557         else
7558                 echo "but not the 3 argument form of open().  Oh, well." >&4
7559                 val="$undef"
7560         fi
7561 elif $test `./findhdr fcntl.h` && \
7562                 set open3 -DI_FCNTL && eval $compile; then
7563         h_fcntl=true;
7564         echo "<fcntl.h> defines the O_* constants..." >&4
7565         if ./open3; then
7566                 echo "and you have the 3 argument form of open()." >&4
7567                 val="$define"
7568         else
7569                 echo "but not the 3 argument form of open().  Oh, well." >&4
7570                 val="$undef"
7571         fi
7572 else
7573         val="$undef"
7574         echo "I can't find the O_* constant definitions!  You got problems." >&4
7575 fi
7576 set d_open3
7577 eval $setvar
7578 $rm -f open3*
7579
7580 : check for non-blocking I/O stuff
7581 case "$h_sysfile" in
7582 true) echo "#include <sys/file.h>" > head.c;;
7583 *)
7584         case "$h_fcntl" in
7585         true) echo "#include <fcntl.h>" > head.c;;
7586         *) echo "#include <sys/fcntl.h>" > head.c;;
7587         esac
7588         ;;
7589 esac
7590 echo " "
7591 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
7592 case "$o_nonblock" in
7593 '')
7594         $cat head.c > try.c
7595         $cat >>try.c <<'EOCP'
7596 int main() {
7597 #ifdef O_NONBLOCK
7598         printf("O_NONBLOCK\n");
7599         exit(0);
7600 #endif
7601 #ifdef O_NDELAY
7602         printf("O_NDELAY\n");
7603         exit(0);
7604 #endif
7605 #ifdef FNDELAY
7606         printf("FNDELAY\n");
7607         exit(0);
7608 #endif
7609         exit(0);
7610 }
7611 EOCP
7612         set try
7613         if eval $compile_ok; then
7614                 o_nonblock=`./try`
7615                 case "$o_nonblock" in
7616                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
7617                 *) echo "Seems like we can use $o_nonblock.";;
7618                 esac
7619         else
7620                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
7621         fi
7622         ;;
7623 *) echo "Using $hint value $o_nonblock.";;
7624 esac
7625 $rm -f try try.* .out core
7626
7627 echo " "
7628 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
7629 case "$eagain" in
7630 '')
7631         $cat head.c > try.c
7632         $cat >>try.c <<EOCP
7633 #include <errno.h>
7634 #include <sys/types.h>
7635 #include <signal.h>
7636 #define MY_O_NONBLOCK $o_nonblock
7637 #ifndef errno  /* XXX need better Configure test */
7638 extern int errno;
7639 #endif
7640 $signal_t blech(x) int x; { exit(3); }
7641 EOCP
7642         $cat >> try.c <<'EOCP'
7643 int main()
7644 {
7645         int pd[2];
7646         int pu[2];
7647         char buf[1];
7648         char string[100];
7649
7650         pipe(pd);       /* Down: child -> parent */
7651         pipe(pu);       /* Up: parent -> child */
7652         if (0 != fork()) {
7653                 int ret;
7654                 close(pd[1]);   /* Parent reads from pd[0] */
7655                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
7656                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
7657                         exit(1);
7658                 signal(SIGALRM, blech);
7659                 alarm(5);
7660                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
7661                         exit(2);
7662                 sprintf(string, "%d\n", ret);
7663                 write(2, string, strlen(string));
7664                 alarm(0);
7665 #ifdef EAGAIN
7666                 if (errno == EAGAIN) {
7667                         printf("EAGAIN\n");
7668                         goto ok;
7669                 }
7670 #endif
7671 #ifdef EWOULDBLOCK
7672                 if (errno == EWOULDBLOCK)
7673                         printf("EWOULDBLOCK\n");
7674 #endif
7675         ok:
7676                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
7677                 sleep(2);                               /* Give it time to close our pipe */
7678                 alarm(5);
7679                 ret = read(pd[0], buf, 1);      /* Should read EOF */
7680                 alarm(0);
7681                 sprintf(string, "%d\n", ret);
7682                 write(3, string, strlen(string));
7683                 exit(0);
7684         }
7685
7686         close(pd[0]);                   /* We write to pd[1] */
7687         close(pu[1]);                   /* We read from pu[0] */
7688         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
7689         close(pd[1]);                   /* Pipe pd is now fully closed! */
7690         exit(0);                                /* Bye bye, thank you for playing! */
7691 }
7692 EOCP
7693         set try
7694         if eval $compile_ok; then
7695                 echo "$startsh" >mtry
7696                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
7697                 chmod +x mtry
7698                 ./mtry >/dev/null 2>&1
7699                 case $? in
7700                 0) eagain=`$cat try.out`;;
7701                 1) echo "Could not perform non-blocking setting!";;
7702                 2) echo "I did a successful read() for something that was not there!";;
7703                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
7704                 *) echo "Something terribly wrong happened during testing.";;
7705                 esac
7706                 rd_nodata=`$cat try.ret`
7707                 echo "A read() system call with no data present returns $rd_nodata."
7708                 case "$rd_nodata" in
7709                 0|-1) ;;
7710                 *)
7711                         echo "(That's peculiar, fixing that to be -1.)"
7712                         rd_nodata=-1
7713                         ;;
7714                 esac
7715                 case "$eagain" in
7716                 '')
7717                         echo "Forcing errno EAGAIN on read() with no data available."
7718                         eagain=EAGAIN
7719                         ;;
7720                 *)
7721                         echo "Your read() sets errno to $eagain when no data is available."
7722                         ;;
7723                 esac
7724                 status=`$cat try.err`
7725                 case "$status" in
7726                 0) echo "And it correctly returns 0 to signal EOF.";;
7727                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
7728                 *) echo "However, your read() returns '$status' on EOF??";;
7729                 esac
7730                 val="$define"
7731                 if test "$status" = "$rd_nodata"; then
7732                         echo "WARNING: you can't distinguish between EOF and no data!"
7733                         val="$undef"
7734                 fi
7735         else
7736                 echo "I can't compile the test program--assuming errno EAGAIN will do."
7737                 eagain=EAGAIN
7738         fi
7739         set d_eofnblk
7740         eval $setvar
7741         ;;
7742 *)
7743         echo "Using $hint value $eagain."
7744         echo "Your read() returns $rd_nodata when no data is present."
7745         case "$d_eofnblk" in
7746         "$define") echo "And you can see EOF because read() returns 0.";;
7747         "$undef") echo "But you can't see EOF status from read() returned value.";;
7748         *)
7749                 echo "(Assuming you can't see EOF status from read anyway.)"
7750                 d_eofnblk=$undef
7751                 ;;
7752         esac
7753         ;;
7754 esac
7755 $rm -f try try.* .out core head.c mtry
7756
7757 : see if fchmod exists
7758 set fchmod d_fchmod
7759 eval $inlibc
7760
7761 : see if fchown exists
7762 set fchown d_fchown
7763 eval $inlibc
7764
7765 : see if this is an fcntl system
7766 set fcntl d_fcntl
7767 eval $inlibc
7768
7769 : see if sys/select.h has to be included
7770 set sys/select.h i_sysselct
7771 eval $inhdr
7772
7773 : see if we should include time.h, sys/time.h, or both
7774 echo " "
7775 if test "X$timeincl" = X; then
7776         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
7777         $echo $n "I'm now running the test program...$c"
7778         $cat >try.c <<'EOCP'
7779 #include <sys/types.h>
7780 #ifdef I_TIME
7781 #include <time.h>
7782 #endif
7783 #ifdef I_SYSTIME
7784 #ifdef SYSTIMEKERNEL
7785 #define KERNEL
7786 #endif
7787 #include <sys/time.h>
7788 #endif
7789 #ifdef I_SYSSELECT
7790 #include <sys/select.h>
7791 #endif
7792 int main()
7793 {
7794         struct tm foo;
7795 #ifdef S_TIMEVAL
7796         struct timeval bar;
7797 #endif
7798 #ifdef S_TIMEZONE
7799         struct timezone tzp;
7800 #endif
7801         if (foo.tm_sec == foo.tm_sec)
7802                 exit(0);
7803 #ifdef S_TIMEVAL
7804         if (bar.tv_sec == bar.tv_sec)
7805                 exit(0);
7806 #endif
7807         exit(1);
7808 }
7809 EOCP
7810         flags=''
7811         for s_timezone in '-DS_TIMEZONE' ''; do
7812         sysselect=''
7813         for s_timeval in '-DS_TIMEVAL' ''; do
7814         for i_systimek in '' '-DSYSTIMEKERNEL'; do
7815         for i_time in '' '-DI_TIME'; do
7816         for i_systime in '-DI_SYSTIME' ''; do
7817                 case "$flags" in
7818                 '') $echo $n ".$c"
7819                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
7820                         if eval $compile; then
7821                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
7822                                 shift
7823                                 flags="$*"
7824                                 echo " "
7825                                 $echo $n "Succeeded with $flags$c"
7826                         fi
7827                         ;;
7828                 esac
7829         done
7830         done
7831         done
7832         done
7833         done
7834         timeincl=''
7835         echo " "
7836         case "$flags" in
7837         *SYSTIMEKERNEL*) i_systimek="$define"
7838                 timeincl=`./findhdr sys/time.h`
7839                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
7840         *) i_systimek="$undef";;
7841         esac
7842         case "$flags" in
7843         *I_TIME*) i_time="$define"
7844                 timeincl=`./findhdr time.h`" $timeincl"
7845                 echo "We'll include <time.h>." >&4;;
7846         *) i_time="$undef";;
7847         esac
7848         case "$flags" in
7849         *I_SYSTIME*) i_systime="$define"
7850                 timeincl=`./findhdr sys/time.h`" $timeincl"
7851                 echo "We'll include <sys/time.h>." >&4;;
7852         *) i_systime="$undef";;
7853         esac
7854         $rm -f try.c try
7855 fi
7856
7857 : check for fd_set items
7858 $cat <<EOM
7859
7860 Checking to see how well your C compiler handles fd_set and friends ...
7861 EOM
7862 $cat >fd_set.c <<EOCP
7863 #$i_systime I_SYS_TIME
7864 #$i_sysselct I_SYS_SELECT
7865 #$d_socket HAS_SOCKET
7866 #include <sys/types.h>
7867 #ifdef HAS_SOCKET
7868 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
7869 #endif
7870 #ifdef I_SYS_TIME
7871 #include <sys/time.h>
7872 #endif
7873 #ifdef I_SYS_SELECT
7874 #include <sys/select.h>
7875 #endif
7876 int main() {
7877         fd_set fds;
7878
7879 #ifdef TRYBITS
7880         if(fds.fds_bits);
7881 #endif
7882
7883 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
7884         exit(0);
7885 #else
7886         exit(1);
7887 #endif
7888 }
7889 EOCP
7890 set fd_set -DTRYBITS
7891 if eval $compile; then
7892         d_fds_bits="$define"
7893         d_fd_set="$define"
7894         echo "Well, your system knows about the normal fd_set typedef..." >&4
7895         if ./fd_set; then
7896                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
7897                 d_fd_macros="$define"
7898         else
7899                 $cat >&4 <<'EOM'
7900 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
7901 EOM
7902                 d_fd_macros="$undef"
7903         fi
7904 else
7905         $cat <<'EOM'
7906 Hmm, your compiler has some difficulty with fd_set.  Checking further...
7907 EOM
7908         set fd_set
7909         if eval $compile; then
7910                 d_fds_bits="$undef"
7911                 d_fd_set="$define"
7912                 echo "Well, your system has some sort of fd_set available..." >&4
7913                 if ./fd_set; then
7914                         echo "and you have the normal fd_set macros." >&4
7915                         d_fd_macros="$define"
7916                 else
7917                         $cat <<'EOM'
7918 but not the normal fd_set macros!  Gross!  More work for me...
7919 EOM
7920                         d_fd_macros="$undef"
7921                 fi
7922         else
7923         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
7924                 d_fd_set="$undef"
7925                 d_fds_bits="$undef"
7926                 d_fd_macros="$undef"
7927         fi
7928 fi
7929 $rm -f fd_set*
7930
7931 : see if fgetpos exists
7932 set fgetpos d_fgetpos
7933 eval $inlibc
7934
7935
7936 if $test X"$use64bits" = X"$define"; then
7937         : see if fgetpos64 exists
7938         set fgetpos64 d_fgetpos64
7939         eval $inlibc
7940
7941         : see if fopen64 exists
7942         set freopen64 d_fopen64
7943         eval $inlibc
7944
7945         : see if freopen64 exists
7946         set freopen64 d_freopen64
7947         eval $inlibc
7948
7949         : see if fseek64 exists
7950         set fseek64 d_fseek64
7951         eval $inlibc
7952
7953         : see if fseeko64 exists
7954         set fseeko64 d_fseeko64
7955         eval $inlibc
7956
7957         : see if fsetpos64 exists
7958         set fsetpos64 d_fsetpos64
7959         eval $inlibc
7960
7961         : see if ftell64 exists
7962         set ftell64 d_ftell64
7963         eval $inlibc
7964
7965         : see if ftello64 exists
7966         set ftello64 d_ftello64
7967         eval $inlibc
7968
7969         : see if tmpfile64 exists
7970         set tmpfile64 d_tmpfile64
7971         eval $inlibc
7972 else
7973         val="$undef"
7974         for xxx in d_fgetpos64 d_fopen64 d_freopen64 d_fseek64 d_fseeko64 d_fsetpos64 d_ftell64 d_ftello64 d_tmpfile64
7975         do
7976                 set $xxx
7977                 eval $setvar
7978         done
7979 fi
7980
7981 : see if flock exists
7982 set flock d_flock
7983 eval $inlibc
7984
7985 : see if fork exists
7986 set fork d_fork
7987 eval $inlibc
7988
7989 : see if pathconf exists
7990 set pathconf d_pathconf
7991 eval $inlibc
7992
7993 : see if fpathconf exists
7994 set fpathconf d_fpathconf
7995 eval $inlibc
7996
7997 : see if fseeko exists
7998 set fseeko d_fseeko
7999 eval $inlibc
8000
8001 : see if fsetpos exists
8002 set fsetpos d_fsetpos
8003 eval $inlibc
8004
8005 : see if this is a sys/param system
8006 set sys/param.h i_sysparam
8007 eval $inhdr
8008
8009 : see if this is a sys/mount.h system
8010 set sys/mount.h i_sysmount
8011 eval $inhdr
8012
8013
8014 : see if statfs exists
8015 set statfs d_statfs
8016 eval $inlibc
8017
8018 : see if fstatfs exists
8019 set fstatfs d_fstatfs
8020 eval $inlibc
8021
8022 : see if statfs knows about mount flags
8023 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8024 eval $hasfield
8025
8026
8027 : see if statvfs exists
8028 set statvfs d_statvfs
8029 eval $inlibc
8030
8031 : see if fstatvfs exists
8032 set fstatvfs d_fstatvfs
8033 eval $inlibc
8034
8035
8036 : see if ftello exists
8037 set ftello d_ftello
8038 eval $inlibc
8039
8040 : see if getgrent exists
8041 set getgrent d_getgrent
8042 eval $inlibc
8043
8044 : see if gethostbyaddr exists
8045 set gethostbyaddr d_gethbyaddr
8046 eval $inlibc
8047
8048 : see if gethostbyname exists
8049 set gethostbyname d_gethbyname
8050 eval $inlibc
8051
8052 : see if gethostent exists
8053 set gethostent d_gethent
8054 eval $inlibc
8055
8056 : see how we will look up host name
8057 echo " "
8058 if false; then
8059         : dummy stub to allow use of elif
8060 elif set gethostname val -f d_gethname; eval $csym; $val; then
8061         echo 'gethostname() found.' >&4
8062         d_gethname="$define"
8063         call=gethostname
8064 elif set uname val -f d_uname; eval $csym; $val; then
8065         if ./xenix; then
8066                 $cat <<'EOM'
8067 uname() was found, but you're running xenix, and older versions of xenix
8068 have a broken uname(). If you don't really know whether your xenix is old
8069 enough to have a broken system call, use the default answer.
8070
8071 EOM
8072                 dflt=y
8073                 case "$d_uname" in
8074                 "$define") dflt=n;;
8075                 esac
8076                 rp='Is your uname() broken?'
8077                 . ./myread
8078                 case "$ans" in
8079                 n*) d_uname="$define"; call=uname;;
8080                 esac
8081         else
8082                 echo 'uname() found.' >&4
8083                 d_uname="$define"
8084                 call=uname
8085         fi
8086 fi
8087 case "$d_gethname" in
8088 '') d_gethname="$undef";;
8089 esac
8090 case "$d_uname" in
8091 '') d_uname="$undef";;
8092 esac
8093 case "$d_uname$d_gethname" in
8094 *define*)
8095         dflt=n
8096         cat <<EOM
8097  
8098 Every now and then someone has a $call() that lies about the hostname
8099 but can't be fixed for political or economic reasons.  If you wish, I can
8100 pretend $call() isn't there and maybe compute hostname at run-time
8101 thanks to the '$phostname' command.
8102
8103 EOM
8104         rp="Shall I ignore $call() from now on?"
8105         . ./myread
8106         case "$ans" in
8107         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8108         esac;;
8109 esac
8110 case "$phostname" in
8111 '') aphostname='';;
8112 *) case "$aphostname" in
8113         /*) ;;
8114         *) set X $phostname
8115                 shift
8116                 file=$1
8117                 shift
8118                 file=`./loc $file $file $pth`
8119                 aphostname=`echo $file $*`
8120                 ;;
8121         esac
8122         ;;
8123 esac
8124 case "$d_uname$d_gethname" in
8125 *define*) ;;
8126 *)
8127         case "$phostname" in
8128         '')
8129                 echo "There will be no way for $package to get your hostname." >&4;;
8130         *)
8131         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8132                 ;;
8133         esac;;
8134 esac
8135 case "$d_phostname" in
8136 '') d_phostname="$undef";;
8137 esac
8138
8139 : see if this is a netdb.h system
8140 set netdb.h i_netdb
8141 eval $inhdr
8142
8143 : see if prototypes for various gethostxxx netdb.h functions are available
8144 echo " "
8145 set d_gethostprotos gethostent $i_netdb netdb.h
8146 eval $hasproto
8147
8148 : see if getlogin exists
8149 set getlogin d_getlogin
8150 eval $inlibc
8151
8152 : see if getmntent exists
8153 set getmntent d_getmntent
8154 eval $inlibc
8155
8156 : see if getnetbyaddr exists
8157 set getnetbyaddr d_getnbyaddr
8158 eval $inlibc
8159
8160 : see if getnetbyname exists
8161 set getnetbyname d_getnbyname
8162 eval $inlibc
8163
8164 : see if getnetent exists
8165 set getnetent d_getnent
8166 eval $inlibc
8167
8168 : see if prototypes for various getnetxxx netdb.h functions are available
8169 echo " "
8170 set d_getnetprotos getnetent $i_netdb netdb.h
8171 eval $hasproto
8172
8173
8174 : see if getprotobyname exists
8175 set getprotobyname d_getpbyname
8176 eval $inlibc
8177
8178 : see if getprotobynumber exists
8179 set getprotobynumber d_getpbynumber
8180 eval $inlibc
8181
8182 : see if getprotoent exists
8183 set getprotoent d_getpent
8184 eval $inlibc
8185
8186 : see if getpgid exists
8187 set getpgid d_getpgid
8188 eval $inlibc
8189
8190 : see if getpgrp2 exists
8191 set getpgrp2 d_getpgrp2
8192 eval $inlibc
8193
8194 : see if getppid exists
8195 set getppid d_getppid
8196 eval $inlibc
8197
8198 : see if getpriority exists
8199 set getpriority d_getprior
8200 eval $inlibc
8201
8202 : see if prototypes for various getprotoxxx netdb.h functions are available
8203 echo " "
8204 set d_getprotoprotos getprotoent $i_netdb netdb.h
8205 eval $hasproto
8206
8207 : see if getpwent exists
8208 set getpwent d_getpwent
8209 eval $inlibc
8210
8211
8212 : see if getservbyname exists
8213 set getservbyname d_getsbyname
8214 eval $inlibc
8215
8216 : see if getservbyport exists
8217 set getservbyport d_getsbyport
8218 eval $inlibc
8219
8220 : see if getservent exists
8221 set getservent d_getsent
8222 eval $inlibc
8223
8224 : see if prototypes for various getservxxx netdb.h functions are available
8225 echo " "
8226 set d_getservprotos getservent $i_netdb netdb.h
8227 eval $hasproto
8228
8229 : see if gettimeofday or ftime exists
8230 set gettimeofday d_gettimeod
8231 eval $inlibc
8232 case "$d_gettimeod" in
8233 "$undef")
8234         set ftime d_ftime 
8235         eval $inlibc
8236         ;;
8237 *)
8238         val="$undef"; set d_ftime; eval $setvar
8239         ;;
8240 esac
8241 case "$d_gettimeod$d_ftime" in
8242 "$undef$undef")
8243         echo " "
8244         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8245         ;;
8246 esac
8247
8248 : see if this is an grp system
8249 set grp.h i_grp
8250 eval $inhdr
8251
8252 case "$i_grp" in
8253 $define)
8254         xxx=`./findhdr grp.h`
8255         $cppstdin $cppflags $cppminus < $xxx >$$.h
8256
8257         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8258                 val="$define"
8259         else
8260                 val="$undef"
8261         fi
8262         set d_grpasswd
8263         eval $setvar
8264
8265         $rm -f $$.h
8266         ;;
8267 *)
8268         val="$undef";
8269         set d_grpasswd; eval $setvar
8270         ;;
8271 esac
8272
8273 : see if hasmntopt exists
8274 set hasmntopt d_hasmntopt
8275 eval $inlibc
8276
8277 : see if this is a netinet/in.h or sys/in.h system
8278 set netinet/in.h i_niin sys/in.h i_sysin
8279 eval $inhdr
8280
8281 : see if arpa/inet.h has to be included
8282 set arpa/inet.h i_arpainet
8283 eval $inhdr
8284
8285 : see if htonl --and friends-- exists
8286 val=''
8287 set htonl val
8288 eval $inlibc
8289
8290 : Maybe they are macros.
8291 case "$val" in
8292 $undef)
8293         $cat >htonl.c <<EOM
8294 #include <stdio.h>
8295 #include <sys/types.h>
8296 #$i_niin I_NETINET_IN
8297 #$i_sysin I_SYS_IN
8298 #$i_arpainet I_ARPA_INET
8299 #ifdef I_NETINET_IN
8300 #include <netinet/in.h>
8301 #endif
8302 #ifdef I_SYS_IN
8303 #include <sys/in.h>
8304 #endif
8305 #ifdef I_ARPA_INET
8306 #include <arpa/inet.h>
8307 #endif
8308 #ifdef htonl
8309 printf("Defined as a macro.");
8310 #endif
8311 EOM
8312         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8313         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8314                 val="$define"
8315                 echo "But it seems to be defined as a macro." >&4
8316         fi
8317         $rm -f htonl.?
8318         ;;
8319 esac
8320 set d_htonl
8321 eval $setvar
8322
8323 : see which of string.h or strings.h is needed
8324 echo " "
8325 strings=`./findhdr string.h`
8326 if $test "$strings" && $test -r "$strings"; then
8327         echo "Using <string.h> instead of <strings.h>." >&4
8328         val="$define"
8329 else
8330         val="$undef"
8331         strings=`./findhdr strings.h`
8332         if $test "$strings" && $test -r "$strings"; then
8333                 echo "Using <strings.h> instead of <string.h>." >&4
8334         else
8335                 echo "No string header found -- You'll surely have problems." >&4
8336         fi
8337 fi
8338 set i_string
8339 eval $setvar
8340 case "$i_string" in
8341 "$undef") strings=`./findhdr strings.h`;;
8342 *)        strings=`./findhdr string.h`;;
8343 esac
8344
8345 : index or strchr
8346 echo " "
8347 if set index val -f; eval $csym; $val; then
8348         if set strchr val -f d_strchr; eval $csym; $val; then
8349                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8350                         val="$define"
8351                         vali="$undef"
8352                         echo "strchr() found." >&4
8353                 else
8354                         val="$undef"
8355                         vali="$define"
8356                         echo "index() found." >&4
8357                 fi
8358         else
8359                 val="$undef"
8360                 vali="$define"
8361                 echo "index() found." >&4
8362         fi
8363 else
8364         if set strchr val -f d_strchr; eval $csym; $val; then
8365                 val="$define"
8366                 vali="$undef"
8367                 echo "strchr() found." >&4
8368         else
8369                 echo "No index() or strchr() found!" >&4
8370                 val="$undef"
8371                 vali="$undef"
8372         fi
8373 fi
8374 set d_strchr; eval $setvar
8375 val="$vali"
8376 set d_index; eval $setvar
8377
8378 : check whether inet_aton exists
8379 set inet_aton d_inetaton
8380 eval $inlibc
8381
8382 : see if inttypes.h is available
8383 : we want a real compile instead of Inhdr because some systems
8384 : have an inttypes.h which includes non-existent headers
8385 echo " "
8386 $cat >try.c <<EOCP
8387 #include <inttypes.h>
8388 int main() {
8389         static int32_t foo32 = 0x12345678;
8390 }
8391 EOCP
8392 set try
8393 if eval $compile; then
8394         echo "<inttypes.h> found." >&4
8395         val="$define"
8396 else
8397         echo "<inttypes.h> NOT found." >&4
8398         val="$undef"
8399 fi
8400 $rm -f try.c try
8401 set i_inttypes
8402 eval $setvar
8403
8404 : check for int64_t
8405 case "$use64bits" in
8406 "$define" )
8407         echo " "
8408         echo $n "Checking to see if your system supports int64_t...$c" >&4
8409         $cat >try.c <<EOCP
8410 #include <sys/types.h>
8411 #$i_inttypes I_INTTYPES
8412 #ifdef I_INTTYPES
8413 #include <inttypes.h>
8414 #endif
8415 int64_t foo() { int64_t x; x = 7; return x; }
8416 EOCP
8417         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8418                 val="$define"
8419                 echo " Yup, it does." >&4
8420         else
8421                 val="$undef"
8422                 echo " Nope, it doesn't." >&4
8423         fi
8424         $rm -f try.*
8425         ;;
8426 *)      val="$undef"
8427         ;;
8428 esac
8429 set d_int64t
8430 eval $setvar
8431
8432
8433 : Look for isascii
8434 echo " "
8435 $cat >isascii.c <<'EOCP'
8436 #include <stdio.h>
8437 #include <ctype.h>
8438 int main() {
8439         int c = 'A';
8440         if (isascii(c))
8441                 exit(0);
8442         else
8443                 exit(1);
8444 }
8445 EOCP
8446 set isascii
8447 if eval $compile; then
8448         echo "isascii() found." >&4
8449         val="$define"
8450 else
8451         echo "isascii() NOT found." >&4
8452         val="$undef"
8453 fi
8454 set d_isascii
8455 eval $setvar
8456 $rm -f isascii*
8457
8458 : see if killpg exists
8459 set killpg d_killpg
8460 eval $inlibc
8461
8462 : see if lchown exists
8463 echo " "
8464 $cat > try.c <<'EOCP'
8465 /* System header to define __stub macros and hopefully few prototypes,
8466     which can conflict with char lchown(); below.  */
8467 #include <assert.h>
8468 /* Override any gcc2 internal prototype to avoid an error.  */
8469 /* We use char because int might match the return type of a gcc2
8470    builtin and then its argument prototype would still apply.  */
8471 char lchown();
8472 int main() {
8473     /*  The GNU C library defines this for functions which it implements
8474         to always fail with ENOSYS.  Some functions are actually named
8475         something starting with __ and the normal name is an alias.  */
8476 #if defined (__stub_lchown) || defined (__stub___lchown)
8477 choke me
8478 #else
8479 lchown();
8480 #endif
8481 ; return 0; }
8482 EOCP
8483 set try
8484 if eval $compile; then
8485     $echo "lchown() found." >&4
8486     val="$define"
8487 else
8488     $echo "lchown() NOT found." >&4
8489     val="$undef"
8490 fi
8491 set d_lchown
8492 eval $setvar
8493
8494 : see if link exists
8495 set link d_link
8496 eval $inlibc
8497
8498 : see if localeconv exists
8499 set localeconv d_locconv
8500 eval $inlibc
8501
8502 : see if lockf exists
8503 set lockf d_lockf
8504 eval $inlibc
8505
8506 : check for length of double
8507 echo " "
8508 case "$doublesize" in
8509 '')
8510         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
8511         $cat >try.c <<'EOCP'
8512 #include <stdio.h>
8513 int main()
8514 {
8515         printf("%d\n", sizeof(double));
8516 }
8517 EOCP
8518         set try
8519         if eval $compile_ok; then
8520                 doublesize=`./try`
8521                 $echo " $doublesize bytes." >&4
8522         else
8523                 dflt='8'
8524                 echo "(I can't seem to compile the test program.  Guessing...)"
8525                 rp="What is the size of a double precision number (in bytes)?"
8526                 . ./myread
8527                 doublesize="$ans"
8528         fi
8529         ;;
8530 esac
8531 $rm -f try.c try
8532
8533 : check for long doubles
8534 echo " "
8535 echo $n "Checking to see if your system supports long doubles...$c" >&4
8536 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
8537 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8538         val="$define"
8539         echo " Yup, it does." >&4
8540 else
8541         val="$undef"
8542         echo " Nope, it doesn't." >&4
8543 fi
8544 $rm try.*
8545 set d_longdbl
8546 eval $setvar
8547
8548 : check for length of long double
8549 case "${d_longdbl}${longdblsize}" in
8550 $define)
8551         echo " "
8552         $echo $n "Checking to see how big your long doubles are...$c" >&4
8553         $cat >try.c <<'EOCP'
8554 #include <stdio.h>
8555 int main()
8556 {
8557         printf("%d\n", sizeof(long double));
8558 }
8559 EOCP
8560         set try
8561         if eval $compile; then
8562                 longdblsize=`./try`
8563                 $echo " $longdblsize bytes." >&4
8564         else
8565                 dflt='8'
8566                 echo " "
8567                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
8568                 rp="What is the size of a long double (in bytes)?"
8569                 . ./myread
8570                 longdblsize="$ans"
8571         fi
8572         if $test "X$doublesize" = "X$longdblsize"; then
8573                 echo "(That isn't any different from an ordinary double.)"
8574         fi      
8575         ;;
8576 esac
8577 $rm -f try.c try
8578
8579 : check for long long
8580 echo " "
8581 echo $n "Checking to see if your system supports long long...$c" >&4
8582 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
8583 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8584         val="$define"
8585         echo " Yup, it does." >&4
8586 else
8587         val="$undef"
8588         echo " Nope, it doesn't." >&4
8589 fi
8590 $rm try.*
8591 set d_longlong
8592 eval $setvar
8593
8594 : check for length of long long
8595 case "${d_longlong}${longlongsize}" in
8596 $define)
8597         echo " "
8598         $echo $n "Checking to see how big your long longs are...$c" >&4
8599         $cat >try.c <<'EOCP'
8600 #include <stdio.h>
8601 int main()
8602 {
8603         printf("%d\n", sizeof(long long));
8604 }
8605 EOCP
8606         set try
8607         if eval $compile_ok; then
8608                 longlongsize=`./try`
8609                 $echo " $longlongsize bytes." >&4
8610         else
8611                 dflt='8'
8612                 echo " "
8613                 echo "(I can't seem to compile the test program.  Guessing...)"
8614                 rp="What is the size of a long long (in bytes)?"
8615                 . ./myread
8616                 longlongsize="$ans"
8617         fi
8618         if $test "X$longsize" = "X$longlongsize"; then
8619                 echo "(That isn't any different from an ordinary long.)"
8620         fi      
8621         ;;
8622 esac
8623 $rm -f try.c try
8624
8625 : see if lstat exists
8626 set lstat d_lstat
8627 eval $inlibc
8628
8629 : see if madvise exists
8630 set madvise d_madvise
8631 eval $inlibc
8632
8633 : see if mblen exists
8634 set mblen d_mblen
8635 eval $inlibc
8636
8637 : see if mbstowcs exists
8638 set mbstowcs d_mbstowcs
8639 eval $inlibc
8640
8641 : see if mbtowc exists
8642 set mbtowc d_mbtowc
8643 eval $inlibc
8644
8645 : see if memcmp exists
8646 set memcmp d_memcmp
8647 eval $inlibc
8648
8649 : see if memcpy exists
8650 set memcpy d_memcpy
8651 eval $inlibc
8652
8653 : see if memmove exists
8654 set memmove d_memmove
8655 eval $inlibc
8656
8657 : see if memset exists
8658 set memset d_memset
8659 eval $inlibc
8660
8661 : see if mkdir exists
8662 set mkdir d_mkdir
8663 eval $inlibc
8664
8665 : see if mkfifo exists
8666 set mkfifo d_mkfifo
8667 eval $inlibc
8668
8669 : see if mktime exists
8670 set mktime d_mktime
8671 eval $inlibc
8672
8673 : see if this is a sys/mman.h system
8674 set sys/mman.h i_sysmman
8675 eval $inhdr
8676
8677 : see if mmap exists
8678 set mmap d_mmap
8679 eval $inlibc
8680 : see what shmat returns
8681 : default to something harmless
8682 mmaptype='void *'
8683 case "$i_sysmman$d_mmap" in
8684 "$define$define")
8685         $cat >mmap.c <<'END'
8686 #include <sys/mman.h>
8687 void *mmap();
8688 END
8689         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
8690                 mmaptype='void *'
8691         else
8692                 mmaptype='caddr_t'
8693         fi
8694         echo "and it returns ($mmaptype)." >&4
8695         ;;
8696 esac
8697
8698
8699
8700 : see if mprotect exists
8701 set mprotect d_mprotect
8702 eval $inlibc
8703
8704 : see if msgctl exists
8705 set msgctl d_msgctl
8706 eval $inlibc
8707
8708 : see if msgget exists
8709 set msgget d_msgget
8710 eval $inlibc
8711
8712 : see if msgsnd exists
8713 set msgsnd d_msgsnd
8714 eval $inlibc
8715
8716 : see if msgrcv exists
8717 set msgrcv d_msgrcv
8718 eval $inlibc
8719
8720 : see how much of the 'msg*(2)' library is present.
8721 h_msg=true
8722 echo " "
8723 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
8724 *"$undef"*) h_msg=false;;
8725 esac
8726 case "$osname" in
8727 freebsd)
8728     case "`ipcs 2>&1`" in
8729     "SVID messages"*"not configured"*)
8730         echo "Your $osname does not have the msg*(2) configured." >&4
8731         h_msg=false
8732         val="$undef"
8733         set msgctl d_msgctl
8734         eval $setvar
8735         set msgget d_msgget
8736         eval $setvar
8737         set msgsnd d_msgsnd
8738         eval $setvar
8739         set msgrcv d_msgrcv
8740         eval $setvar
8741         ;;
8742     esac
8743     ;;
8744 esac
8745 : we could also check for sys/ipc.h ...
8746 if $h_msg && $test `./findhdr sys/msg.h`; then
8747         echo "You have the full msg*(2) library." >&4
8748         val="$define"
8749 else
8750         echo "You don't have the full msg*(2) library." >&4
8751         val="$undef"
8752 fi
8753 set d_msg
8754 eval $setvar
8755
8756 : see if msync exists
8757 set msync d_msync
8758 eval $inlibc
8759
8760 : see if munmap exists
8761 set munmap d_munmap
8762 eval $inlibc
8763
8764 : see if nice exists
8765 set nice d_nice
8766 eval $inlibc
8767
8768 : how to create joinable pthreads
8769 if test "X$usethreads" = "X$define"; then
8770         echo " "
8771         echo "Checking what constant to use for creating joinable pthreads..." >&4 
8772         $cat >try.c <<'EOCP'
8773 #include <pthread.h>
8774 int main() {
8775     int detachstate = JOINABLE;
8776 }
8777 EOCP
8778         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
8779         if eval $compile; then
8780                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
8781                 val="$undef" # Yes, undef.
8782                 set d_old_pthread_create_joinable
8783                 eval $setvar
8784                 val=""
8785                 set old_pthread_create_joinable
8786                 eval $setvar
8787         else
8788                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
8789                 if eval $compile; then
8790                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
8791                         val="$define"
8792                         set d_old_pthread_create_joinable
8793                         eval $setvar
8794                         val=PTHREAD_CREATE_UNDETACHED
8795                         set old_pthread_create_joinable
8796                         eval $setvar
8797                 else            
8798                         set try -DJOINABLE=__UNDETACHED
8799                         if eval $compile; then
8800                                 echo "You seem to use __UNDETACHED." >&4
8801                                 val="$define"
8802                                 set d_old_pthread_create_joinable
8803                                 eval $setvar
8804                                 val=__UNDETACHED
8805                                 set old_pthread_create_joinable
8806                                 eval $setvar
8807                         else
8808                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
8809                                 val="$define"
8810                                 set d_old_pthread_create_joinable
8811                                 eval $setvar
8812                                 val=0
8813                                 set old_pthread_create_joinable
8814                                 eval $setvar
8815                         fi
8816                 fi
8817         fi
8818         $rm -f try try.*
8819 else
8820     d_old_pthread_create_joinable="$undef"
8821     old_pthread_create_joinable=""
8822 fi
8823
8824 : see if pause exists
8825 set pause d_pause
8826 eval $inlibc
8827
8828 : see if pipe exists
8829 set pipe d_pipe
8830 eval $inlibc
8831
8832 : see if poll exists
8833 set poll d_poll
8834 eval $inlibc
8835
8836
8837 : see whether the various POSIXish _yields exist
8838 $cat >try.c <<EOP
8839 #include <pthread.h>
8840 #include <stdio.h>
8841 int main() {
8842 #ifdef SCHED_YIELD
8843         sched_yield();
8844 #else
8845 #ifdef PTHREAD_YIELD
8846         pthread_yield();
8847 #else
8848 #ifdef PTHREAD_YIELD_NULL
8849         pthread_yield(NULL);
8850 #endif
8851 #endif
8852 #endif
8853 }
8854 EOP
8855 : see if sched_yield exists
8856 set try -DSCHED_YIELD
8857 if eval $compile; then
8858     val="$define"
8859     sched_yield='sched_yield()'
8860 else
8861     val="$undef"
8862 fi
8863 case "$usethreads" in
8864 $define)
8865         case "$val" in
8866         $define) echo 'sched_yield() found.' >&4        ;;
8867         *)       echo 'sched_yield() NOT found.' >&4    ;;
8868         esac
8869 esac
8870 set d_sched_yield
8871 eval $setvar
8872
8873 : see if pthread_yield exists
8874 set try -DPTHREAD_YIELD
8875 if eval $compile; then
8876     val="$define"
8877     case "$sched_yield" in
8878     '') sched_yield='pthread_yield()' ;;
8879     esac
8880 else
8881     set try -DPTHREAD_YIELD_NULL
8882     if eval $compile; then
8883         val="$define"
8884         case "$sched_yield" in
8885         '') sched_yield='pthread_yield(NULL)' ;;
8886         esac
8887     else
8888         val="$undef"
8889     fi
8890 fi
8891 case "$usethreads" in
8892 $define)
8893         case "$val" in
8894         $define) echo 'pthread_yield() found.' >&4      ;;
8895         *)       echo 'pthread_yield() NOT found.' >&4  ;;
8896         esac
8897         ;;
8898 esac
8899 set d_pthread_yield
8900 eval $setvar
8901
8902 case "$sched_yield" in
8903 '') sched_yield=undef ;;
8904 esac
8905
8906 $rm -f try try.*
8907
8908 : see if this is a pwd.h system
8909 set pwd.h i_pwd
8910 eval $inhdr
8911
8912 case "$i_pwd" in
8913 $define)
8914         xxx=`./findhdr pwd.h`
8915         $cppstdin $cppflags $cppminus < $xxx >$$.h
8916
8917         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
8918                 val="$define"
8919         else
8920                 val="$undef"
8921         fi
8922         set d_pwquota
8923         eval $setvar
8924
8925         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
8926                 val="$define"
8927         else
8928                 val="$undef"
8929         fi
8930         set d_pwage
8931         eval $setvar
8932
8933         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
8934                 val="$define"
8935         else
8936                 val="$undef"
8937         fi
8938         set d_pwchange
8939         eval $setvar
8940
8941         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
8942                 val="$define"
8943         else
8944                 val="$undef"
8945         fi
8946         set d_pwclass
8947         eval $setvar
8948
8949         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
8950                 val="$define"
8951         else
8952                 val="$undef"
8953         fi
8954         set d_pwexpire
8955         eval $setvar
8956
8957         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
8958                 val="$define"
8959         else
8960                 val="$undef"
8961         fi
8962         set d_pwcomment
8963         eval $setvar
8964
8965         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
8966                 val="$define"
8967         else
8968                 val="$undef"
8969         fi
8970         set d_pwgecos
8971         eval $setvar
8972
8973         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
8974                 val="$define"
8975         else
8976                 val="$undef"
8977         fi
8978         set d_pwpasswd
8979         eval $setvar
8980
8981         $rm -f $$.h
8982         ;;
8983 *)
8984         val="$undef"; 
8985         set d_pwquota; eval $setvar
8986         set d_pwage; eval $setvar
8987         set d_pwchange; eval $setvar
8988         set d_pwclass; eval $setvar
8989         set d_pwexpire; eval $setvar
8990         set d_pwcomment; eval $setvar
8991         set d_pwgecos; eval $setvar
8992         set d_pwpasswd; eval $setvar
8993         ;;
8994 esac
8995
8996 : see if readdir and friends exist
8997 set readdir d_readdir
8998 eval $inlibc
8999 set seekdir d_seekdir
9000 eval $inlibc
9001 set telldir d_telldir
9002 eval $inlibc
9003 set rewinddir d_rewinddir
9004 eval $inlibc
9005
9006 : see if readlink exists
9007 set readlink d_readlink
9008 eval $inlibc
9009
9010 : see if readv exists
9011 set readv d_readv
9012 eval $inlibc
9013
9014 : see if rename exists
9015 set rename d_rename
9016 eval $inlibc
9017
9018 : see if rmdir exists
9019 set rmdir d_rmdir
9020 eval $inlibc
9021
9022 : see if memory.h is available.
9023 val=''
9024 set memory.h val
9025 eval $inhdr
9026
9027 : See if it conflicts with string.h
9028 case "$val" in
9029 $define)
9030         case "$strings" in
9031         '') ;;
9032         *)
9033                 $cppstdin $cppflags $cppminus < $strings > mem.h
9034                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9035                         echo " "
9036                         echo "We won't be including <memory.h>."
9037                         val="$undef"
9038                 fi
9039                 $rm -f mem.h
9040                 ;;
9041         esac
9042 esac
9043 set i_memory
9044 eval $setvar
9045
9046 : can bcopy handle overlapping blocks?
9047 val="$undef"
9048 case "$d_bcopy" in
9049 "$define")
9050         echo " "
9051         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9052         $cat >try.c <<EOCP
9053 #$i_memory I_MEMORY
9054 #$i_stdlib I_STDLIB
9055 #$i_string I_STRING
9056 #$i_unistd I_UNISTD
9057 EOCP
9058         $cat >>try.c <<'EOCP'
9059 #include <stdio.h>
9060 #ifdef I_MEMORY
9061 #  include <memory.h>
9062 #endif
9063 #ifdef I_STDLIB
9064 #  include <stdlib.h>
9065 #endif
9066 #ifdef I_STRING
9067 #  include <string.h>
9068 #else
9069 #  include <strings.h>
9070 #endif
9071 #ifdef I_UNISTD
9072 #  include <unistd.h>  /* Needed for NetBSD */
9073 #endif
9074 int main()
9075 {
9076 char buf[128], abc[128];
9077 char *b;
9078 int len;
9079 int off;
9080 int align;
9081
9082 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9083
9084 for (align = 7; align >= 0; align--) {
9085         for (len = 36; len; len--) {
9086                 b = buf+align;
9087                 bcopy(abc, b, len);
9088                 for (off = 1; off <= len; off++) {
9089                         bcopy(b, b+off, len);
9090                         bcopy(b+off, b, len);
9091                         if (bcmp(b, abc, len))
9092                                 exit(1);
9093                 }
9094         }
9095 }
9096 exit(0);
9097 }
9098 EOCP
9099         set try
9100         if eval $compile_ok; then
9101                 if ./try 2>/dev/null; then
9102                         echo "Yes, it can."
9103                         val="$define"
9104                 else
9105                         echo "It can't, sorry."
9106                         case "$d_memmove" in
9107                         "$define") echo "But that's Ok since you have memmove()." ;;
9108                         esac
9109                 fi
9110         else
9111                 echo "(I can't compile the test program, so we'll assume not...)"
9112                 case "$d_memmove" in
9113                 "$define") echo "But that's Ok since you have memmove()." ;;
9114                 esac
9115         fi
9116         ;;
9117 esac
9118 $rm -f try.* try core
9119 set d_safebcpy
9120 eval $setvar
9121
9122 : can memcpy handle overlapping blocks?
9123 val="$undef"
9124 case "$d_memcpy" in
9125 "$define")
9126         echo " "
9127         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9128         $cat >try.c <<EOCP
9129 #$i_memory I_MEMORY
9130 #$i_stdlib I_STDLIB
9131 #$i_string I_STRING
9132 #$i_unistd I_UNISTD
9133 EOCP
9134         $cat >>try.c <<'EOCP'
9135 #include <stdio.h>
9136 #ifdef I_MEMORY
9137 #  include <memory.h>
9138 #endif
9139 #ifdef I_STDLIB
9140 #  include <stdlib.h>
9141 #endif
9142 #ifdef I_STRING
9143 #  include <string.h>
9144 #else
9145 #  include <strings.h>
9146 #endif
9147 #ifdef I_UNISTD
9148 #  include <unistd.h>  /* Needed for NetBSD */
9149 #endif
9150 int main()
9151 {
9152 char buf[128], abc[128];
9153 char *b;
9154 int len;
9155 int off;
9156 int align;
9157
9158 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9159    try to store the string in read-only memory. */
9160 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9161
9162 for (align = 7; align >= 0; align--) {
9163         for (len = 36; len; len--) {
9164                 b = buf+align;
9165                 memcpy(b, abc, len);
9166                 for (off = 1; off <= len; off++) {
9167                         memcpy(b+off, b, len);
9168                         memcpy(b, b+off, len);
9169                         if (memcmp(b, abc, len))
9170                                 exit(1);
9171                 }
9172         }
9173 }
9174 exit(0);
9175 }
9176 EOCP
9177         set try
9178         if eval $compile_ok; then
9179                 if ./try 2>/dev/null; then
9180                         echo "Yes, it can."
9181                         val="$define"
9182                 else
9183                         echo "It can't, sorry."
9184                         case "$d_memmove" in
9185                         "$define") echo "But that's Ok since you have memmove()." ;;
9186                         esac
9187                 fi
9188         else
9189                 echo "(I can't compile the test program, so we'll assume not...)"
9190                 case "$d_memmove" in
9191                 "$define") echo "But that's Ok since you have memmove()." ;;
9192                 esac
9193         fi
9194         ;;
9195 esac
9196 $rm -f try.* try core
9197 set d_safemcpy
9198 eval $setvar
9199
9200 : can memcmp be trusted to compare relative magnitude?
9201 val="$undef"
9202 case "$d_memcmp" in
9203 "$define")
9204         echo " "
9205         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9206         $cat >try.c <<EOCP
9207 #$i_memory I_MEMORY
9208 #$i_stdlib I_STDLIB
9209 #$i_string I_STRING
9210 #$i_unistd I_UNISTD
9211 EOCP
9212         $cat >>try.c <<'EOCP'
9213 #include <stdio.h>
9214 #ifdef I_MEMORY
9215 #  include <memory.h>
9216 #endif
9217 #ifdef I_STDLIB
9218 #  include <stdlib.h>
9219 #endif
9220 #ifdef I_STRING
9221 #  include <string.h>
9222 #else
9223 #  include <strings.h>
9224 #endif
9225 #ifdef I_UNISTD
9226 #  include <unistd.h>  /* Needed for NetBSD */
9227 #endif
9228 int main()
9229 {
9230 char a = -1;
9231 char b = 0;
9232 if ((a < b) && memcmp(&a, &b, 1) < 0)
9233         exit(1);
9234 exit(0);
9235 }
9236 EOCP
9237         set try
9238         if eval $compile_ok; then
9239                 if ./try 2>/dev/null; then
9240                         echo "Yes, it can."
9241                         val="$define"
9242                 else
9243                         echo "No, it can't (it uses signed chars)."
9244                 fi
9245         else
9246                 echo "(I can't compile the test program, so we'll assume not...)"
9247         fi
9248         ;;
9249 esac
9250 $rm -f try.* try core
9251 set d_sanemcmp
9252 eval $setvar
9253
9254 : see if select exists
9255 set select d_select
9256 eval $inlibc
9257
9258 : see if semctl exists
9259 set semctl d_semctl
9260 eval $inlibc
9261
9262 : see if semget exists
9263 set semget d_semget
9264 eval $inlibc
9265
9266 : see if semop exists
9267 set semop d_semop
9268 eval $inlibc
9269
9270 : see how much of the 'sem*(2)' library is present.
9271 h_sem=true
9272 echo " "
9273 case "$d_semctl$d_semget$d_semop" in
9274 *"$undef"*) h_sem=false;;
9275 esac
9276 case "$osname" in
9277 freebsd)
9278     case "`ipcs 2>&1`" in
9279     "SVID messages"*"not configured"*)
9280         echo "Your $osname does not have the sem*(2) configured." >&4
9281         h_sem=false
9282         val="$undef"
9283         set semctl d_semctl
9284         eval $setvar
9285         set semget d_semget
9286         eval $setvar
9287         set semop d_semop
9288         eval $setvar
9289         ;;
9290     esac
9291     ;;
9292 esac
9293 : we could also check for sys/ipc.h ...
9294 if $h_sem && $test `./findhdr sys/sem.h`; then
9295         echo "You have the full sem*(2) library." >&4
9296         val="$define"
9297 else
9298         echo "You don't have the full sem*(2) library." >&4
9299         val="$undef"
9300 fi
9301 set d_sem
9302 eval $setvar
9303
9304 : see whether sys/sem.h defines union semun
9305 echo " "
9306 $cat > try.c <<'END'
9307 #include <sys/types.h>
9308 #include <sys/ipc.h>
9309 #include <sys/sem.h>
9310 int main () { union semun semun; semun.buf = 0; }
9311 END
9312 set try
9313 if eval $compile; then
9314     echo "You have union semun in <sys/sem.h>." >&4
9315     val="$define"
9316 else
9317     echo "You do not have union semun in <sys/sem.h>." >&4
9318     val="$undef"
9319 fi
9320 $rm -f try try.c try.h
9321 set d_union_semun
9322 eval $setvar
9323
9324 : see how to do semctl IPC_STAT
9325 case "$d_sem" in
9326 $define)
9327     : see whether semctl IPC_STAT can use union semun
9328     echo " "
9329     $cat > try.h <<END
9330 #ifndef S_IRUSR
9331 #   ifdef S_IREAD
9332 #       define S_IRUSR S_IREAD
9333 #       define S_IWUSR S_IWRITE
9334 #       define S_IXUSR S_IEXEC
9335 #   else
9336 #       define S_IRUSR 0400
9337 #       define S_IWUSR 0200
9338 #       define S_IXUSR 0100
9339 #   endif
9340 #   define S_IRGRP (S_IRUSR>>3)
9341 #   define S_IWGRP (S_IWUSR>>3)
9342 #   define S_IXGRP (S_IXUSR>>3)
9343 #   define S_IROTH (S_IRUSR>>6)
9344 #   define S_IWOTH (S_IWUSR>>6)
9345 #   define S_IXOTH (S_IXUSR>>6)
9346 #endif
9347 #ifndef S_IRWXU
9348 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9349 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9350 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9351 #endif
9352 END
9353
9354     $cat > try.c <<END
9355 #include <sys/types.h>
9356 #include <sys/ipc.h>
9357 #include <sys/sem.h>
9358 #include <sys/stat.h>
9359 #include <stdio.h>
9360 #include <errno.h>
9361 #include "try.h"
9362 #ifndef errno
9363 extern int errno;
9364 #endif
9365 #$d_union_semun HAS_UNION_SEMUN
9366 int main() {
9367     union semun
9368 #ifndef HAS_UNION_SEMUN
9369     {
9370         int val;
9371         struct semid_ds *buf;
9372         unsigned short *array;
9373     }
9374 #endif
9375     arg;
9376     int sem, st;
9377
9378 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9379     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9380     if (sem > -1) {
9381         struct semid_ds argbuf;
9382         arg.buf = &argbuf;
9383 #       ifdef IPC_STAT
9384         st = semctl(sem, 0, IPC_STAT, arg);
9385         if (st == 0)
9386             printf("semun\n");
9387         else
9388 #       endif /* IPC_STAT */
9389             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9390 #       ifdef IPC_RMID
9391         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9392 #       endif /* IPC_RMID */
9393             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9394     } else
9395 #endif /* IPC_PRIVATE && ... */
9396         printf("semget failed: errno = %d\n", errno);
9397   return 0;
9398 }
9399 END
9400     val="$undef"
9401     set try
9402     if eval $compile; then
9403         xxx=`./try`
9404         case "$xxx" in
9405         semun) val="$define" ;;
9406         esac
9407     fi
9408     $rm -f try try.c
9409     set d_semctl_semun
9410     eval $setvar
9411     case "$d_semctl_semun" in
9412     $define)
9413         echo "You can use union semun for semctl IPC_STAT." >&4
9414         also='also'
9415         ;;
9416     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9417         also=''
9418         ;;
9419     esac
9420
9421     : see whether semctl IPC_STAT can use struct semid_ds pointer
9422     $cat > try.c <<'END'
9423 #include <sys/types.h>
9424 #include <sys/ipc.h>
9425 #include <sys/sem.h>
9426 #include <sys/stat.h>
9427 #include "try.h"
9428 #include <stdio.h>
9429 #include <errno.h>
9430 #ifndef errno
9431 extern int errno;
9432 #endif
9433 int main() {
9434     struct semid_ds arg;
9435     int sem, st;
9436
9437 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9438     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9439     if (sem > -1) {
9440 #       ifdef IPC_STAT
9441         st = semctl(sem, 0, IPC_STAT, &arg);
9442         if (st == 0)
9443             printf("semid_ds\n");
9444         else
9445 #       endif /* IPC_STAT */
9446             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9447 #       ifdef IPC_RMID
9448         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9449 #       endif /* IPC_RMID */
9450             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9451     } else
9452 #endif /* IPC_PRIVATE && ... */
9453         printf("semget failed: errno = %d\n", errno);
9454
9455     return 0;
9456 }
9457 END
9458     val="$undef"
9459     set try
9460     if eval $compile; then
9461         xxx=`./try`
9462         case "$xxx" in
9463         semid_ds) val="$define" ;;
9464         esac
9465     fi
9466     $rm -f try try.c
9467     set d_semctl_semid_ds
9468     eval $setvar
9469     case "$d_semctl_semid_ds" in
9470     $define)
9471         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
9472         ;;
9473     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
9474         ;;
9475     esac
9476     $rm -f try.h
9477     ;;
9478 *)  val="$undef"
9479
9480     # We do not have the full sem*(2) library, so assume we can not
9481     # use either.
9482
9483     set d_semctl_semun
9484     eval $setvar
9485
9486     set d_semctl_semid_ds
9487     eval $setvar
9488     ;;
9489 esac
9490
9491 : see if setegid exists
9492 set setegid d_setegid
9493 eval $inlibc
9494
9495 : see if seteuid exists
9496 set seteuid d_seteuid
9497 eval $inlibc
9498
9499 : see if setgrent exists
9500 set setgrent d_setgrent
9501 eval $inlibc
9502
9503 : see if sethostent exists
9504 set sethostent d_sethent
9505 eval $inlibc
9506
9507 : see if setlinebuf exists
9508 set setlinebuf d_setlinebuf
9509 eval $inlibc
9510
9511 : see if setlocale exists
9512 set setlocale d_setlocale
9513 eval $inlibc
9514
9515 : see if setnetent exists
9516 set setnetent d_setnent
9517 eval $inlibc
9518
9519 : see if setprotoent exists
9520 set setprotoent d_setpent
9521 eval $inlibc
9522
9523 : see if setpgid exists
9524 set setpgid d_setpgid
9525 eval $inlibc
9526
9527 : see if setpgrp2 exists
9528 set setpgrp2 d_setpgrp2
9529 eval $inlibc
9530
9531 : see if setpriority exists
9532 set setpriority d_setprior
9533 eval $inlibc
9534
9535 : see if setpwent exists
9536 set setpwent d_setpwent
9537 eval $inlibc
9538
9539 : see if setregid exists
9540 set setregid d_setregid
9541 eval $inlibc
9542 set setresgid d_setresgid
9543 eval $inlibc
9544
9545 : see if setreuid exists
9546 set setreuid d_setreuid
9547 eval $inlibc
9548 set setresuid d_setresuid
9549 eval $inlibc
9550
9551 : see if setrgid exists
9552 set setrgid d_setrgid
9553 eval $inlibc
9554
9555 : see if setruid exists
9556 set setruid d_setruid
9557 eval $inlibc
9558
9559 : see if setservent exists
9560 set setservent d_setsent
9561 eval $inlibc
9562
9563 : see if setsid exists
9564 set setsid d_setsid
9565 eval $inlibc
9566
9567 : see if setvbuf exists
9568 set setvbuf d_setvbuf
9569 eval $inlibc
9570
9571 : see if sfio.h is available
9572 set sfio.h i_sfio
9573 eval $inhdr
9574
9575
9576 : see if sfio library is available
9577 case "$i_sfio" in
9578 $define)
9579         val=''
9580         set sfreserve val
9581         eval $inlibc
9582         ;;
9583 *)
9584         val="$undef"
9585         ;;
9586 esac
9587 : Ok, but do we want to use it.
9588 case "$val" in
9589 $define)
9590         case "$usesfio" in
9591         true|$define|[yY]*) dflt='y';;
9592         *) dflt='n';;
9593         esac
9594         echo "$package can use the sfio library, but it is experimental."
9595         rp="You seem to have sfio available, do you want to try using it?"
9596         . ./myread
9597         case "$ans" in
9598         y|Y) ;;
9599         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
9600                 val="$undef"
9601                 : Remove sfio from list of libraries to use
9602                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
9603                 shift
9604                 libs="$*"
9605                 echo "libs = $libs" >&4
9606                 ;;
9607         esac
9608         ;;
9609 *)      case "$usesfio" in
9610         true|$define|[yY]*)
9611                 echo "Sorry, cannot find sfio on this machine" >&4
9612                 echo "Ignoring your setting of usesfio=$usesfio" >&4
9613                 ;;
9614         esac
9615         ;;
9616 esac
9617 set d_sfio
9618 eval $setvar
9619 case "$d_sfio" in
9620 $define) usesfio='true';;
9621 *) usesfio='false';;
9622 esac
9623
9624 : see if shmctl exists
9625 set shmctl d_shmctl
9626 eval $inlibc
9627
9628 : see if shmget exists
9629 set shmget d_shmget
9630 eval $inlibc
9631
9632 : see if shmat exists
9633 set shmat d_shmat
9634 eval $inlibc
9635 : see what shmat returns
9636 case "$d_shmat" in
9637 "$define")
9638         $cat >shmat.c <<'END'
9639 #include <sys/shm.h>
9640 void *shmat();
9641 END
9642         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
9643                 shmattype='void *'
9644         else
9645                 shmattype='char *'
9646         fi
9647         echo "and it returns ($shmattype)." >&4
9648         : see if a prototype for shmat is available
9649         xxx=`./findhdr sys/shm.h`
9650         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
9651         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
9652                 val="$define"
9653         else
9654                 val="$undef"
9655         fi
9656         $rm -f shmat.[co]
9657         ;;
9658 *)
9659         val="$undef"
9660         ;;
9661 esac
9662 set d_shmatprototype
9663 eval $setvar
9664
9665 : see if shmdt exists
9666 set shmdt d_shmdt
9667 eval $inlibc
9668
9669 : see how much of the 'shm*(2)' library is present.
9670 h_shm=true
9671 echo " "
9672 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
9673 *"$undef"*) h_shm=false;;
9674 esac
9675 case "$osname" in
9676 freebsd)
9677     case "`ipcs 2>&1`" in
9678     "SVID shared memory"*"not configured"*)
9679         echo "Your $osname does not have the shm*(2) configured." >&4
9680         h_shm=false
9681         val="$undef"
9682         set shmctl d_shmctl
9683         evat $setvar
9684         set shmget d_shmget
9685         evat $setvar
9686         set shmat d_shmat
9687         evat $setvar
9688         set shmdt d_shmdt
9689         evat $setvar
9690         ;;
9691     esac
9692     ;;
9693 esac
9694 : we could also check for sys/ipc.h ...
9695 if $h_shm && $test `./findhdr sys/shm.h`; then
9696         echo "You have the full shm*(2) library." >&4
9697         val="$define"
9698 else
9699         echo "You don't have the full shm*(2) library." >&4
9700         val="$undef"
9701 fi
9702 set d_shm
9703 eval $setvar
9704
9705 echo " "
9706 : see if we have sigaction
9707 if set sigaction val -f d_sigaction; eval $csym; $val; then
9708         echo 'sigaction() found.' >&4
9709         $cat > try.c <<'EOP'
9710 #include <stdio.h>
9711 #include <sys/types.h>
9712 #include <signal.h>
9713 int main()
9714 {
9715     struct sigaction act, oact;
9716 }
9717 EOP
9718         set try
9719         if eval $compile_ok; then
9720                 val="$define"
9721         else
9722                 echo "But you don't seem to have a useable struct sigaction." >&4
9723                 val="$undef"
9724         fi
9725 else
9726         echo 'sigaction NOT found.' >&4
9727         val="$undef"
9728 fi
9729 set d_sigaction; eval $setvar
9730 $rm -f try try$_o try.c
9731
9732 : see if sigsetjmp exists
9733 echo " "
9734 case "$d_sigsetjmp" in
9735 '')
9736         $cat >try.c <<'EOP'
9737 #include <setjmp.h>
9738 sigjmp_buf env;
9739 int set = 1;
9740 int main()
9741 {
9742         if (sigsetjmp(env,1))
9743                 exit(set);
9744         set = 0;
9745         siglongjmp(env, 1);
9746         exit(1);
9747 }
9748 EOP
9749         set try
9750         if eval $compile; then
9751                 if ./try >/dev/null 2>&1; then
9752                         echo "POSIX sigsetjmp found." >&4
9753                         val="$define"
9754                 else
9755                         $cat >&4 <<EOM
9756 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
9757 I'll ignore them.
9758 EOM
9759                         val="$undef"
9760                 fi
9761         else
9762                 echo "sigsetjmp not found." >&4
9763                 val="$undef"
9764         fi
9765         ;;
9766 *) val="$d_sigsetjmp"
9767         case "$d_sigsetjmp" in
9768         $define) echo "POSIX sigsetjmp found." >&4;;
9769         $undef) echo "sigsetjmp not found." >&4;;
9770         esac
9771         ;;
9772 esac
9773 set d_sigsetjmp
9774 eval $setvar
9775 $rm -f try.c try
9776
9777 : see if stat knows about block sizes
9778 echo " "
9779 set d_statblks stat st_blocks $i_sysstat sys/stat.h
9780 eval $hasfield
9781
9782 : see if _ptr and _cnt from stdio act std
9783 echo " "
9784 if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then
9785         echo "(Looks like you have stdio.h from Linux.)"
9786         case "$stdio_ptr" in
9787         '') stdio_ptr='((fp)->_IO_read_ptr)'
9788                 ptr_lval=$define
9789                 ;;
9790         *)      ptr_lval=$d_stdio_ptr_lval;;
9791         esac
9792         case "$stdio_cnt" in
9793         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
9794                 cnt_lval=$undef
9795                 ;;
9796         *)      cnt_lval=$d_stdio_cnt_lval;;
9797         esac
9798         case "$stdio_base" in
9799         '') stdio_base='((fp)->_IO_read_base)';;
9800         esac
9801         case "$stdio_bufsiz" in
9802         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
9803         esac
9804 else
9805         case "$stdio_ptr" in
9806         '') stdio_ptr='((fp)->_ptr)'
9807                 ptr_lval=$define
9808                 ;;
9809         *)      ptr_lval=$d_stdio_ptr_lval;;
9810         esac
9811         case "$stdio_cnt" in
9812         '') stdio_cnt='((fp)->_cnt)'
9813                 cnt_lval=$define
9814                 ;;
9815         *)      cnt_lval=$d_stdio_cnt_lval;;
9816         esac
9817         case "$stdio_base" in
9818         '') stdio_base='((fp)->_base)';;
9819         esac
9820         case "$stdio_bufsiz" in
9821         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
9822         esac
9823 fi
9824 : test whether _ptr and _cnt really work
9825 echo "Checking how std your stdio is..." >&4
9826 $cat >try.c <<EOP
9827 #include <stdio.h>
9828 #define FILE_ptr(fp)    $stdio_ptr
9829 #define FILE_cnt(fp)    $stdio_cnt
9830 int main() {
9831         FILE *fp = fopen("try.c", "r");
9832         char c = getc(fp);
9833         if (
9834                 18 <= FILE_cnt(fp) &&
9835                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
9836         )
9837                 exit(0);
9838         exit(1);
9839 }
9840 EOP
9841 val="$undef"
9842 set try
9843 if eval $compile; then
9844         if ./try; then
9845                 echo "Your stdio acts pretty std."
9846                 val="$define"
9847         else
9848                 echo "Your stdio isn't very std."
9849         fi
9850 else
9851         echo "Your stdio doesn't appear very std."
9852 fi
9853 $rm -f try.c try
9854 set d_stdstdio
9855 eval $setvar
9856
9857 : Can _ptr be used as an lvalue?
9858 case "$d_stdstdio$ptr_lval" in
9859 $define$define) val=$define ;;
9860 *) val=$undef ;;
9861 esac
9862 set d_stdio_ptr_lval
9863 eval $setvar
9864
9865 : Can _cnt be used as an lvalue?
9866 case "$d_stdstdio$cnt_lval" in
9867 $define$define) val=$define ;;
9868 *) val=$undef ;;
9869 esac
9870 set d_stdio_cnt_lval
9871 eval $setvar
9872
9873 : see if _base is also standard
9874 val="$undef"
9875 case "$d_stdstdio" in
9876 $define)
9877         $cat >try.c <<EOP
9878 #include <stdio.h>
9879 #define FILE_base(fp)   $stdio_base
9880 #define FILE_bufsiz(fp) $stdio_bufsiz
9881 int main() {
9882         FILE *fp = fopen("try.c", "r");
9883         char c = getc(fp);
9884         if (
9885                 19 <= FILE_bufsiz(fp) &&
9886                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
9887         )
9888                 exit(0);
9889         exit(1);
9890 }
9891 EOP
9892         set try
9893         if eval $compile; then
9894                 if ./try; then
9895                         echo "And its _base field acts std."
9896                         val="$define"
9897                 else
9898                         echo "But its _base field isn't std."
9899                 fi
9900         else
9901                 echo "However, it seems to be lacking the _base field."
9902         fi
9903         $rm -f try.c try
9904         ;;
9905 esac
9906 set d_stdiobase
9907 eval $setvar
9908
9909 : see if strcoll exists
9910 set strcoll d_strcoll
9911 eval $inlibc
9912
9913 : check for structure copying
9914 echo " "
9915 echo "Checking to see if your C compiler can copy structs..." >&4
9916 $cat >try.c <<'EOCP'
9917 int main()
9918 {
9919         struct blurfl {
9920                 int dyick;
9921         } foo, bar;
9922
9923         foo = bar;
9924 }
9925 EOCP
9926 if $cc -c try.c >/dev/null 2>&1 ; then
9927         val="$define"
9928         echo "Yup, it can."
9929 else
9930         val="$undef"
9931         echo "Nope, it can't."
9932 fi
9933 set d_strctcpy
9934 eval $setvar
9935 $rm -f try.*
9936
9937 : see if strerror and/or sys_errlist[] exist
9938 echo " "
9939 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
9940     if set strerror val -f d_strerror; eval $csym; $val; then
9941                 echo 'strerror() found.' >&4
9942                 d_strerror="$define"
9943                 d_strerrm='strerror(e)'
9944                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
9945                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
9946                         d_syserrlst="$define"
9947                 else
9948                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
9949                         d_syserrlst="$undef"
9950                 fi
9951     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
9952                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
9953                 echo 'strerror() found in string header.' >&4
9954                 d_strerror="$define"
9955                 d_strerrm='strerror(e)'
9956                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
9957                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
9958                                 d_syserrlst="$define"
9959                 else
9960                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
9961                         d_syserrlst="$undef"
9962                 fi
9963     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
9964                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
9965                 d_strerror="$undef"
9966                 d_syserrlst="$define"
9967                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
9968     else
9969                 echo 'strerror() and sys_errlist[] NOT found.' >&4
9970                 d_strerror="$undef"
9971                 d_syserrlst="$undef"
9972                 d_strerrm='"unknown"'
9973     fi
9974 fi
9975
9976 : see if strtod exists
9977 set strtod d_strtod
9978 eval $inlibc
9979
9980 : see if strtol exists
9981 set strtol d_strtol
9982 eval $inlibc
9983
9984 : see if strtoul exists
9985 set strtoul d_strtoul
9986 eval $inlibc
9987
9988 : see if strxfrm exists
9989 set strxfrm d_strxfrm
9990 eval $inlibc
9991
9992 : see if symlink exists
9993 set symlink d_symlink
9994 eval $inlibc
9995
9996 : see if syscall exists
9997 set syscall d_syscall
9998 eval $inlibc
9999
10000 : see if sysconf exists
10001 set sysconf d_sysconf
10002 eval $inlibc
10003
10004 : see if system exists
10005 set system d_system
10006 eval $inlibc
10007
10008 : see if tcgetpgrp exists
10009 set tcgetpgrp d_tcgetpgrp
10010 eval $inlibc
10011
10012 : see if tcsetpgrp exists
10013 set tcsetpgrp d_tcsetpgrp
10014 eval $inlibc
10015
10016 : see if sys/types.h has to be included
10017 set sys/types.h i_systypes
10018 eval $inhdr
10019
10020 : see if prototype for telldir is available
10021 echo " "
10022 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10023 eval $hasproto
10024
10025 : define an is-a-typedef? function
10026 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10027 case "$inclist" in
10028 "") inclist="sys/types.h";;
10029 esac;
10030 eval "varval=\$$var";
10031 case "$varval" in
10032 "")
10033         $rm -f temp.c;
10034         for inc in $inclist; do
10035                 echo "#include <$inc>" >>temp.c;
10036         done;
10037         echo "#ifdef $type" >> temp.c;
10038         echo "printf(\"We have $type\");" >> temp.c;
10039         echo "#endif" >> temp.c;
10040         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10041         if $contains $type temp.E >/dev/null 2>&1; then
10042                 eval "$var=\$type";
10043         else
10044                 eval "$var=\$def";
10045         fi;
10046         $rm -f temp.?;;
10047 *) eval "$var=\$varval";;
10048 esac'
10049
10050 : define an is-a-typedef? function that prompts if the type is not available.
10051 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10052 case "$inclist" in
10053 "") inclist="sys/types.h";;
10054 esac;
10055 eval "varval=\$$var";
10056 case "$varval" in
10057 "")
10058         $rm -f temp.c;
10059         for inc in $inclist; do
10060                 echo "#include <$inc>" >>temp.c;
10061         done;
10062         echo "#ifdef $type" >> temp.c;
10063         echo "printf(\"We have $type\");" >> temp.c;
10064         echo "#endif" >> temp.c;
10065         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10066         echo " " ;
10067         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10068         if $contains $type temp.E >/dev/null 2>&1; then
10069                 echo "$type found." >&4;
10070                 eval "$var=\$type";
10071         else
10072                 echo "$type NOT found." >&4;
10073                 dflt="$def";
10074                 . ./myread ;
10075                 eval "$var=\$ans";
10076         fi;
10077         $rm -f temp.?;;
10078 *) eval "$var=\$varval";;
10079 esac'
10080
10081 : see if this is a sys/times.h system
10082 set sys/times.h i_systimes
10083 eval $inhdr
10084
10085 : see if times exists
10086 echo " "
10087 if set times val -f d_times; eval $csym; $val; then
10088         echo 'times() found.' >&4
10089         d_times="$define"
10090         inc=''
10091         case "$i_systimes" in
10092         "$define") inc='sys/times.h';;
10093         esac
10094         rp="What is the type returned by times() on this system?"
10095         set clock_t clocktype long stdio.h sys/types.h $inc
10096         eval $typedef_ask
10097 else
10098         echo 'times() NOT found, hope that will do.' >&4
10099         d_times="$undef"
10100         clocktype='int'
10101 fi
10102
10103 : see if truncate exists
10104 set truncate d_truncate
10105 eval $inlibc
10106
10107 : see if tzname[] exists
10108 echo " "
10109 if set tzname val -a d_tzname; eval $csym; $val; then
10110         val="$define"
10111         echo 'tzname[] found.' >&4
10112 else
10113         val="$undef"
10114         echo 'tzname[] NOT found.' >&4
10115 fi
10116 set d_tzname
10117 eval $setvar
10118
10119 : see if umask exists
10120 set umask d_umask
10121 eval $inlibc
10122
10123 : backward compatibility for d_hvfork
10124 if test X$d_hvfork != X; then
10125         d_vfork="$d_hvfork"
10126         d_hvfork=''
10127 fi
10128 : see if there is a vfork
10129 val=''
10130 set vfork val
10131 eval $inlibc
10132
10133 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10134 : perl on Solaris 2.x, and probably elsewhere.
10135 case "$val" in
10136 $define)
10137         echo " "
10138         case "$usevfork" in
10139         false) dflt='n';;
10140         *) dflt='y';;
10141         esac
10142         rp="Some systems have problems with vfork().  Do you want to use it?"
10143         . ./myread
10144         case "$ans" in
10145         y|Y) ;;
10146         *)
10147                 echo "Ok, we won't use vfork()."
10148                 val="$undef"
10149                 ;;
10150         esac
10151         ;;
10152 esac
10153 set d_vfork
10154 eval $setvar
10155 case "$d_vfork" in
10156 $define) usevfork='true';;
10157 *) usevfork='false';;
10158 esac
10159
10160 : see if this is an sysdir system
10161 set sys/dir.h i_sysdir
10162 eval $inhdr
10163
10164 : see if this is an sysndir system
10165 set sys/ndir.h i_sysndir
10166 eval $inhdr
10167
10168 : see if closedir exists
10169 set closedir d_closedir
10170 eval $inlibc
10171
10172 case "$d_closedir" in
10173 "$define")
10174         echo " "
10175         echo "Checking whether closedir() returns a status..." >&4
10176         cat > closedir.c <<EOM
10177 #$i_dirent I_DIRENT             /**/
10178 #$i_sysdir I_SYS_DIR            /**/
10179 #$i_sysndir I_SYS_NDIR          /**/
10180 #$i_systypes I_SYS_TYPES        /**/
10181
10182 #if defined(I_SYS_TYPES)
10183 #include <sys/types.h>
10184 #endif
10185 #if defined(I_DIRENT)
10186 #include <dirent.h>
10187 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10188 #include <sys/dir.h>
10189 #endif
10190 #else
10191 #ifdef I_SYS_NDIR
10192 #include <sys/ndir.h>
10193 #else
10194 #ifdef I_SYS_DIR
10195 #ifdef hp9000s500
10196 #include <ndir.h>       /* may be wrong in the future */
10197 #else
10198 #include <sys/dir.h>
10199 #endif
10200 #endif
10201 #endif
10202 #endif 
10203 int main() { return closedir(opendir(".")); }
10204 EOM
10205         set closedir
10206         if eval $compile_ok; then
10207                 if ./closedir > /dev/null 2>&1 ; then
10208                         echo "Yes, it does."
10209                         val="$undef"
10210                 else
10211                         echo "No, it doesn't."
10212                         val="$define"
10213                 fi
10214         else
10215                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10216                 val="$define"
10217         fi
10218         ;;
10219 *)
10220         val="$undef";
10221         ;;
10222 esac
10223 set d_void_closedir
10224 eval $setvar
10225 $rm -f closedir*
10226 : check for volatile keyword
10227 echo " "
10228 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10229 $cat >try.c <<'EOCP'
10230 int main()
10231 {
10232         typedef struct _goo_struct goo_struct;
10233         goo_struct * volatile goo = ((goo_struct *)0);
10234         struct _goo_struct {
10235                 long long_int;
10236                 int reg_int;
10237                 char char_var;
10238         };
10239         typedef unsigned short foo_t;
10240         char *volatile foo;
10241         volatile int bar;
10242         volatile foo_t blech;
10243         foo = foo;
10244 }
10245 EOCP
10246 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10247         val="$define"
10248         echo "Yup, it does."
10249 else
10250         val="$undef"
10251         echo "Nope, it doesn't."
10252 fi
10253 set d_volatile
10254 eval $setvar
10255 $rm -f try.*
10256
10257 : see if there is a wait4
10258 set wait4 d_wait4
10259 eval $inlibc
10260
10261 : see if waitpid exists
10262 set waitpid d_waitpid
10263 eval $inlibc
10264
10265 : see if wcstombs exists
10266 set wcstombs d_wcstombs
10267 eval $inlibc
10268
10269 : see if wctomb exists
10270 set wctomb d_wctomb
10271 eval $inlibc
10272
10273 : see if writev exists
10274 set writev d_writev
10275 eval $inlibc
10276
10277 : preserve RCS keywords in files with variable substitution, grrr
10278 Date='$Date'
10279 Id='$Id'
10280 Log='$Log'
10281 RCSfile='$RCSfile'
10282 Revision='$Revision'
10283
10284 : check for alignment requirements
10285 echo " "
10286 case "$alignbytes" in
10287 '') echo "Checking alignment constraints..." >&4
10288         $cat >try.c <<'EOCP'
10289 struct foobar {
10290         char foo;
10291         double bar;
10292 } try;
10293 int main()
10294 {
10295         printf("%d\n", (char *)&try.bar - (char *)&try.foo);
10296 }
10297 EOCP
10298         set try
10299         if eval $compile_ok; then
10300                 dflt=`./try`
10301         else
10302                 dflt='8'
10303                 echo "(I can't seem to compile the test program...)"
10304         fi
10305         ;;
10306 *) dflt="$alignbytes"
10307         ;;
10308 esac
10309 rp="Doubles must be aligned on a how-many-byte boundary?"
10310 . ./myread
10311 alignbytes="$ans"
10312 $rm -f try.c try
10313
10314 : check for ordering of bytes in a long
10315 case "$byteorder" in
10316 '')
10317         $cat <<'EOM'
10318   
10319 In the following, larger digits indicate more significance.  A big-endian
10320 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10321 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10322 machines may have weird orders like 3412.  A Cray will report 87654321. If
10323 the test program works the default is probably right.
10324 I'm now running the test program...
10325 EOM
10326         $cat >try.c <<'EOCP'
10327 #include <stdio.h>
10328 int main()
10329 {
10330         int i;
10331         union {
10332                 unsigned long l;
10333                 char c[sizeof(long)];
10334         } u;
10335
10336         if (sizeof(long) > 4)
10337                 u.l = (0x08070605L << 32) | 0x04030201L;
10338         else
10339                 u.l = 0x04030201L;
10340         for (i = 0; i < sizeof(long); i++)
10341                 printf("%c", u.c[i]+'0');
10342         printf("\n");
10343         exit(0);
10344 }
10345 EOCP
10346         xxx_prompt=y
10347         set try
10348         if eval $compile && ./try > /dev/null; then
10349                 dflt=`./try`
10350                 case "$dflt" in
10351                 [1-4][1-4][1-4][1-4]|12345678|87654321)
10352                         echo "(The test program ran ok.)"
10353                         echo "byteorder=$dflt"
10354                         xxx_prompt=n
10355                         ;;
10356                 ????|????????) echo "(The test program ran ok.)" ;;
10357                 *) echo "(The test program didn't run right for some reason.)" ;;
10358                 esac
10359         else
10360                 dflt='4321'
10361                 cat <<'EOM'
10362 (I can't seem to compile the test program.  Guessing big-endian...)
10363 EOM
10364         fi
10365         case "$xxx_prompt" in
10366         y)
10367                 rp="What is the order of bytes in a long?"
10368                 . ./myread
10369                 byteorder="$ans"
10370                 ;;
10371         *)      byteorder=$dflt
10372                 ;;
10373         esac
10374         ;;
10375 esac
10376 $rm -f try.c try
10377
10378 : how do we catenate cpp tokens here?
10379 echo " "
10380 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10381 $cat >cpp_stuff.c <<'EOCP'
10382 #define RCAT(a,b)a/**/b
10383 #define ACAT(a,b)a ## b
10384 RCAT(Rei,ser)
10385 ACAT(Cir,cus)
10386 EOCP
10387 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10388 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
10389         echo "Oh!  Smells like ANSI's been here." >&4
10390         echo "We can catify or stringify, separately or together!"
10391         cpp_stuff=42
10392 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
10393         echo "Ah, yes!  The good old days!" >&4
10394         echo "However, in the good old days we don't know how to stringify and"
10395         echo "catify at the same time."
10396         cpp_stuff=1
10397 else
10398         $cat >&4 <<EOM
10399 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
10400 to have to edit the values of CAT[2-5] in config.h...
10401 EOM
10402         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
10403 fi
10404 $rm -f cpp_stuff.*
10405
10406 : see if this is a db.h system
10407 set db.h i_db
10408 eval $inhdr
10409
10410 case "$i_db" in
10411 $define)
10412         : Check db version.
10413         echo " "
10414         echo "Checking Berkeley DB version ..." >&4
10415         $cat >try.c <<EOCP
10416 #$d_const HASCONST
10417 #ifndef HASCONST
10418 #define const
10419 #endif
10420 #include <sys/types.h>
10421 #include <stdio.h>
10422 #include <db.h>
10423 int main()
10424 {
10425 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
10426     int Major, Minor, Patch ;
10427     unsigned long Version ;
10428     (void)db_version(&Major, &Minor, &Patch) ;
10429     printf("You have Berkeley DB Version 2 or greater\n");
10430
10431     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
10432                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
10433     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
10434                 Major, Minor, Patch) ;
10435
10436     /* check that db.h & libdb are compatible */
10437     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
10438         printf("db.h and libdb are incompatible\n") ;
10439         exit(3);        
10440     }
10441
10442     printf("db.h and libdb are compatible\n") ;
10443
10444     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
10445                 + DB_VERSION_PATCH ;
10446
10447     /* needs to be >= 2.3.4 */
10448     if (Version < 2003004) {
10449     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
10450         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
10451         exit(2);        
10452     }
10453
10454     exit(0);
10455 #else
10456 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
10457     printf("You have Berkeley DB Version 1\n");
10458     exit(0);    /* DB version < 2: the coast is clear. */
10459 #else
10460     exit(1);    /* <db.h> not Berkeley DB? */
10461 #endif
10462 #endif
10463 }
10464 EOCP
10465         set try
10466         if eval $compile && ./try; then
10467                 echo 'Looks OK.' >&4
10468         else
10469                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
10470                 i_db=$undef
10471                 case " $libs " in
10472                 *"-ldb "*)
10473                         : Remove db from list of libraries to use
10474                         echo "Removing unusable -ldb from library list" >&4
10475                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
10476                         shift
10477                         libs="$*"
10478                         echo "libs = $libs" >&4
10479                         ;;
10480                 esac
10481         fi
10482         $rm -f try.*
10483         ;;
10484 esac
10485
10486 case "$i_db" in
10487 define)
10488         : Check the return type needed for hash 
10489         echo " "
10490         echo "Checking return type needed for hash for Berkeley DB ..." >&4
10491         $cat >try.c <<EOCP
10492 #$d_const HASCONST
10493 #ifndef HASCONST
10494 #define const
10495 #endif
10496 #include <sys/types.h>
10497 #include <db.h>
10498
10499 #ifndef DB_VERSION_MAJOR
10500 u_int32_t hash_cb (ptr, size)
10501 const void *ptr;
10502 size_t size;
10503 {
10504 }
10505 HASHINFO info;
10506 int main()
10507 {
10508         info.hash = hash_cb;
10509 }
10510 #endif
10511 EOCP
10512         if $cc $ccflags -c try.c >try.out 2>&1 ; then
10513                 if $contains warning try.out >>/dev/null 2>&1 ; then
10514                         db_hashtype='int'
10515                 else
10516                         db_hashtype='u_int32_t'
10517                 fi
10518         else
10519                 : XXX Maybe we should just give up here.
10520                 db_hashtype=u_int32_t
10521                 $cat try.out >&4
10522                 echo "Help:  I can't seem to compile the db test program." >&4
10523                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
10524         fi
10525         $rm -f try.*
10526         echo "Your version of Berkeley DB uses $db_hashtype for hash."
10527         ;;
10528 *)      db_hashtype=u_int32_t
10529         ;;
10530 esac
10531 case "$i_db" in
10532 define)
10533         : Check the return type needed for prefix 
10534         echo " "
10535         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
10536         cat >try.c <<EOCP
10537 #$d_const HASCONST
10538 #ifndef HASCONST
10539 #define const
10540 #endif
10541 #include <sys/types.h>
10542 #include <db.h>
10543
10544 #ifndef DB_VERSION_MAJOR
10545 size_t prefix_cb (key1, key2)
10546 const DBT *key1;
10547 const DBT *key2;
10548 {
10549 }
10550 BTREEINFO info;
10551 int main()
10552 {
10553         info.prefix = prefix_cb;
10554 }
10555 #endif
10556 EOCP
10557         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
10558                 if $contains warning try.out >>/dev/null 2>&1 ; then
10559                         db_prefixtype='int'
10560                 else
10561                         db_prefixtype='size_t'
10562                 fi
10563         else
10564                 db_prefixtype='size_t'
10565                 : XXX Maybe we should just give up here.
10566                 $cat try.out >&4
10567                 echo "Help:  I can't seem to compile the db test program." >&4
10568                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
10569         fi
10570         $rm -f try.*
10571         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
10572         ;;
10573 *)      db_prefixtype='size_t'
10574         ;;
10575 esac
10576
10577 : check for void type
10578 echo " "
10579 echo "Checking to see how well your C compiler groks the void type..." >&4
10580 case "$voidflags" in
10581 '')
10582         $cat >try.c <<'EOCP'
10583 #if TRY & 1
10584 void sub() {
10585 #else
10586 sub() {
10587 #endif
10588         extern void moo();      /* function returning void */
10589         void (*goo)();          /* ptr to func returning void */
10590 #if TRY & 8
10591         void *hue;              /* generic ptr */
10592 #endif
10593 #if TRY & 2
10594         void (*foo[10])();
10595 #endif
10596
10597 #if TRY & 4
10598         if(goo == moo) {
10599                 exit(0);
10600         }
10601 #endif
10602         exit(0);
10603 }
10604 int main() { sub(); }
10605 EOCP
10606         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
10607                 voidflags=$defvoidused
10608         echo "Good.  It appears to support void to the level $package wants.">&4
10609                 if $contains warning .out >/dev/null 2>&1; then
10610                         echo "However, you might get some warnings that look like this:"
10611                         $cat .out
10612                 fi
10613         else
10614 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
10615                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
10616                         echo "It supports 1..."
10617                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
10618                                 echo "It also supports 2..."
10619                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
10620                                         voidflags=7
10621                                         echo "And it supports 4 but not 8 definitely."
10622                                 else
10623                                         echo "It doesn't support 4..."
10624                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
10625                                                 voidflags=11
10626                                                 echo "But it supports 8."
10627                                         else
10628                                                 voidflags=3
10629                                                 echo "Neither does it support 8."
10630                                         fi
10631                                 fi
10632                         else
10633                                 echo "It does not support 2..."
10634                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
10635                                         voidflags=13
10636                                         echo "But it supports 4 and 8."
10637                                 else
10638                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
10639                                                 voidflags=5
10640                                                 echo "And it supports 4 but has not heard about 8."
10641                                         else
10642                                                 echo "However it supports 8 but not 4."
10643                                         fi
10644                                 fi
10645                         fi
10646                 else
10647                         echo "There is no support at all for void."
10648                         voidflags=0
10649                 fi
10650         fi
10651 esac
10652 case "$voidflags" in
10653 "$defvoidused") ;;
10654 *)      $cat >&4 <<'EOM'
10655   Support flag bits are:
10656     1: basic void declarations.
10657     2: arrays of pointers to functions returning void.
10658     4: operations between pointers to and addresses of void functions.
10659     8: generic void pointers.
10660 EOM
10661         dflt="$voidflags";
10662         rp="Your void support flags add up to what?"
10663         . ./myread
10664         voidflags="$ans"
10665         ;;
10666 esac
10667 $rm -f try.* .out
10668
10669
10670 : How can we generate normalized random numbers ?
10671 echo " "
10672 echo "Looking for a random number function..." >&4
10673 case "$randfunc" in
10674 '')
10675         if set drand48 val -f; eval $csym; $val; then
10676                 dflt="drand48"
10677                 echo "Good, found drand48()." >&4
10678         elif set random val -f; eval $csym; $val; then
10679                 dflt="random"
10680                 echo "OK, found random()." >&4
10681         else
10682                 dflt="rand"
10683                 echo "Yick, looks like I have to use rand()." >&4
10684         fi
10685         echo " "
10686         ;;
10687 *)
10688         dflt="$randfunc"
10689         ;;
10690 esac
10691 cont=true
10692
10693 case "$ccflags" in
10694 *-Dmy_rand=*|*-Dmy_srand=*)
10695         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
10696         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
10697         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
10698         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
10699         ;;
10700 esac
10701
10702 while $test "$cont"; do
10703         rp="Use which function to generate random numbers?"
10704         . ./myread
10705         if $test "$ans" = "$dflt"; then
10706                 : null
10707         else
10708                 randbits=''
10709         fi
10710         randfunc="$ans"
10711         if set $ans val -f; eval $csym; $val; then
10712                 cont=''
10713         else
10714                 dflt=y
10715                 rp="I cannot find function $ans. Use that name anyway?"
10716                 . ./myread
10717                 dflt=rand
10718                 case "$ans" in
10719                         [yY]*) cont='';;
10720                 esac
10721         fi
10722         case "$cont" in
10723         '')
10724                 case "$randfunc" in
10725                 drand48)
10726                         drand01="drand48()"
10727                         seedfunc="srand48"
10728                         randbits=48
10729                         randseedtype=long
10730                         ;;
10731                 rand|random)
10732                         case "$randbits" in
10733                         '')
10734 echo "Checking to see how many bits your $randfunc() function produces..." >&4
10735                                 $cat >try.c <<EOCP
10736 #$i_unistd I_UNISTD
10737 #$i_stdlib I_STDLIB
10738 #include <stdio.h>
10739 #ifdef I_UNISTD
10740 #  include <unistd.h>
10741 #endif
10742 #ifdef I_STDLIB
10743 #  include <stdlib.h>
10744 #endif
10745 int main()
10746 {
10747         register int i;
10748         register unsigned long tmp;
10749         register unsigned long max = 0L;
10750
10751         for (i = 1000; i; i--) {
10752                 tmp = (unsigned long) $randfunc();
10753                 if (tmp > max) max = tmp;
10754         }
10755         for (i = 0; max; i++)
10756                 max /= 2;
10757         printf("%d\n",i);
10758 }
10759 EOCP
10760                                 set try
10761                                 if eval $compile_ok; then
10762                                         dflt=`try`
10763                                 else
10764                                         dflt='?'
10765                                         echo "(I can't seem to compile the test program...)"
10766                                 fi
10767                                 ;;
10768                         *)
10769                                 dflt="$randbits"
10770                                 ;;
10771                         esac
10772                         rp="How many bits does your $randfunc() function produce?"
10773                         . ./myread
10774                         randbits="$ans"
10775                         $rm -f try.c try
10776                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
10777                         seedfunc="s$randfunc"
10778                         randseedtype=unsigned
10779                         ;;
10780                 *)
10781                         dflt="31"
10782                         rp="How many bits does your $randfunc() function produce?"
10783                         . ./myread
10784                         randbits="$ans"
10785                         seedfunc="s$randfunc"
10786                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
10787                         if set $seedfunc val -f; eval $csym; $val; then
10788                                 echo "(Using $seedfunc() to seed random generator)"
10789                         else
10790                                 echo "(Warning: no $seedfunc() to seed random generator)"
10791                                 seedfunc=rand
10792                         fi
10793                         randseedtype=unsigned
10794                         ;;
10795                 esac
10796                 ;;
10797         esac
10798 done
10799
10800 echo " "
10801 echo "Determining whether or not we are on an EBCDIC system..." >&4
10802 $cat >tebcdic.c <<'EOM'
10803 int main()
10804 {
10805   if ('M'==0xd4) return 0;
10806   return 1;
10807 }
10808 EOM
10809
10810 val=$undef
10811 set tebcdic
10812 if eval $compile_ok; then
10813         if ./tebcdic; then
10814                 echo "You have EBCDIC." >&4
10815                 val="$define"
10816         else
10817                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin." >&4
10818         fi
10819 else
10820         echo "I'm unable to compile the test program." >&4
10821         echo "I'll assume ASCII or some ISO Latin." >&4
10822 fi
10823 $rm -f tebcdic.c tebcdic
10824 set ebcdic
10825 eval $setvar
10826
10827 : see what type file positions are declared as in the library
10828 rp="What is the type for file position used by fsetpos()?"
10829 set fpos_t fpostype long stdio.h sys/types.h
10830 eval $typedef_ask
10831
10832 : Store the full pathname to the ar program for use in the C program
10833 : Respect a hint or command line value for full_ar.
10834 case "$full_ar" in
10835 '') full_ar=$ar ;;
10836 esac
10837
10838 : Store the full pathname to the sed program for use in the C program
10839 full_sed=$sed
10840
10841 : see what type gids are declared as in the kernel
10842 echo " "
10843 echo "Looking for the type for group ids returned by getgid()."
10844 set gid_t gidtype xxx stdio.h sys/types.h
10845 eval $typedef
10846 case "$gidtype" in
10847 xxx)
10848         xxx=`./findhdr sys/user.h`
10849         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
10850         case $1 in
10851         unsigned) dflt="$1 $2" ;;
10852         *) dflt="$1" ;;
10853         esac
10854         ;;
10855 *) dflt="$gidtype";;
10856 esac
10857 case "$gidtype" in
10858 gid_t) echo "gid_t found." ;;
10859 *)      rp="What is the type for group ids returned by getgid()?"
10860         . ./myread
10861         gidtype="$ans"
10862         ;;
10863 esac
10864
10865 : see if getgroups exists
10866 set getgroups d_getgrps
10867 eval $inlibc
10868
10869 : see if setgroups exists
10870 set setgroups d_setgrps
10871 eval $inlibc
10872
10873
10874 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
10875 echo " "
10876 case "$d_getgrps$d_setgrps" in
10877 *define*)
10878         case "$groupstype" in
10879         '') dflt="$gidtype" ;;
10880         *)  dflt="$groupstype" ;;
10881         esac
10882         $cat <<EOM
10883 What type of pointer is the second argument to getgroups() and setgroups()?
10884 Usually this is the same as group ids, $gidtype, but not always.
10885
10886 EOM
10887         rp='What type pointer is the second argument to getgroups() and setgroups()?'
10888         . ./myread
10889         groupstype="$ans"
10890         ;;
10891 *)  groupstype="$gidtype";;
10892 esac
10893
10894 : see what type lseek is declared as in the kernel
10895 rp="What is the type used for lseek's offset on this system?"
10896 set off_t lseektype long stdio.h sys/types.h
10897 eval $typedef_ask
10898
10899 echo " "
10900 $echo $n "Checking to see how big your file offsets are...$c" >&4
10901 $cat >try.c <<EOCP
10902 #include <sys/types.h>
10903 #include <stdio.h>
10904 int main()
10905 {
10906         printf("%d\n", sizeof($lseektype));
10907 }
10908 EOCP
10909 set try
10910 if eval $compile_ok; then
10911         lseeksize=`./try`
10912         $echo " $lseeksize bytes." >&4
10913 else
10914         dflt='4'
10915         echo " "
10916         echo "(I can't seem to compile the test program.  Guessing...)"
10917         rp="What is the size of your file offsets (in bytes)?"
10918         . ./myread
10919         lseeksize="$ans"
10920 fi
10921 $rm -f try.c try
10922
10923 echo " "
10924 echo "Checking if your $make program sets \$(MAKE)..." >&4
10925 case "$make_set_make" in
10926 '')
10927         $sed 's/^X //' > testmake.mak << 'EOF'
10928 Xall:
10929 X       @echo 'maketemp="$(MAKE)"'
10930 EOF
10931         case "`$make -f testmake.mak 2>/dev/null`" in
10932         *maketemp=*) make_set_make='#' ;;
10933         *)      make_set_make="MAKE=$make" ;;
10934         esac
10935         $rm -f testmake.mak
10936         ;;
10937 esac
10938 case "$make_set_make" in
10939 '#') echo "Yup, it does.";;
10940 *) echo "Nope, it doesn't.";;
10941 esac
10942
10943 : see what type is used for mode_t
10944 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
10945 set mode_t modetype int stdio.h sys/types.h
10946 eval $typedef_ask
10947
10948 : define a fucntion to check prototypes
10949 $cat > protochk <<EOSH
10950 $startsh
10951 cc="$cc"
10952 optimize="$optimize"
10953 ccflags="$ccflags"
10954 prototype="$prototype"
10955 define="$define"
10956 rm=$rm
10957 EOSH
10958
10959 $cat >> protochk <<'EOSH'
10960
10961 $rm -f try.c
10962 foo="$1"
10963 shift
10964 while test $# -ge 2; do
10965         case "$1" in
10966                 $define) echo "#include <$2>" >> try.c ;;
10967                 literal) echo "$2" >> try.c ;;
10968         esac
10969     shift 2
10970 done
10971 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
10972 cat >> try.c <<'EOCP'
10973 #ifdef CAN_PROTOTYPE
10974 #define _(args) args
10975 #else
10976 #define _(args) ()
10977 #endif
10978 EOCP
10979 echo "$foo" >> try.c
10980 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
10981 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
10982 status=$?
10983 $rm -f try.[co]
10984 exit $status
10985 EOSH
10986 chmod +x protochk
10987 $eunicefix protochk
10988
10989 : see what type is used for size_t
10990 rp="What is the type used for the length parameter for string functions?"
10991 set size_t sizetype 'unsigned int' stdio.h sys/types.h
10992 eval $typedef_ask
10993
10994 : check for type of arguments to gethostbyaddr. 
10995 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
10996         case "$d_gethbyaddr" in
10997         $define)
10998                 $cat <<EOM
10999
11000 Checking to see what type of arguments are accepted by gethostbyaddr().
11001 EOM
11002                 hdrs="$define sys/types.h
11003                         $d_socket sys/socket.h 
11004                         $i_niin netinet/in.h 
11005                         $i_netdb netdb.h
11006                         $i_unistd unistd.h"
11007                 : The first arg can 'char *' or 'void *'
11008                 : The second arg is some of integral type
11009                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11010                         for yyy in size_t long int; do
11011                                 case "$netdb_host_type" in
11012                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11013                                         if ./protochk "$try" $hdrs; then
11014                                                 echo "Your system accepts $xxx for the first arg."
11015                                                 echo "...and $yyy for the second arg."
11016                                                 netdb_host_type="$xxx"
11017                                                 netdb_hlen_type="$yyy"
11018                                         fi
11019                                         ;;
11020                                 esac
11021                         done
11022                 done
11023                 : In case none of those worked, prompt the user.
11024                 case "$netdb_host_type" in
11025                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11026                         dflt='char *'
11027                         . ./myread
11028                         netdb_host_type=$ans
11029                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11030                         dflt="$sizetype"
11031                         . ./myread
11032                         netdb_hlen_type=$ans
11033                         ;;
11034                 esac
11035                 ;;
11036         *)      : no gethostbyaddr, so pick harmless defaults
11037                 netdb_host_type='char *'
11038                 netdb_hlen_type="$sizetype"
11039                 ;;
11040         esac
11041         # Remove the "const" if needed. -- but then we'll have a 
11042         # prototype clash!
11043         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11044 fi
11045
11046 : check for type of argument to gethostbyname. 
11047 if test "X$netdb_name_type" = X ; then
11048         case "$d_gethbyname" in
11049         $define)
11050                 $cat <<EOM
11051
11052 Checking to see what type of argument is accepted by gethostbyname().
11053 EOM
11054                 hdrs="$define sys/types.h
11055                         $d_socket sys/socket.h 
11056                         $i_niin netinet/in.h 
11057                         $i_netdb netdb.h
11058                         $i_unistd unistd.h"
11059                 for xxx in "const char *" "char *"; do
11060                         case "$netdb_name_type" in
11061                         '')     try="extern struct hostent *gethostbyname($xxx);"
11062                                 if ./protochk "$try" $hdrs; then
11063                                         echo "Your system accepts $xxx."
11064                                         netdb_name_type="$xxx"
11065                                 fi
11066                                 ;;
11067                         esac
11068                 done
11069                 : In case none of those worked, prompt the user.
11070                 case "$netdb_name_type" in
11071                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11072                         dflt='char *'
11073                         . ./myread
11074                         netdb_name_type=$ans
11075                         ;;
11076                 esac
11077                 ;;
11078         *)      : no gethostbyname, so pick harmless default
11079                 netdb_name_type='char *'
11080                 ;;
11081         esac
11082 fi
11083
11084 : check for type of 1st argument to getnetbyaddr. 
11085 if test "X$netdb_net_type" = X ; then
11086         case "$d_getnbyaddr" in
11087         $define)
11088                 $cat <<EOM
11089
11090 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11091 EOM
11092                 hdrs="$define sys/types.h
11093                         $d_socket sys/socket.h 
11094                         $i_niin netinet/in.h 
11095                         $i_netdb netdb.h
11096                         $i_unistd unistd.h"
11097                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11098                         case "$netdb_net_type" in
11099                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11100                                 if ./protochk "$try" $hdrs; then
11101                                         echo "Your system accepts $xxx."
11102                                         netdb_net_type="$xxx"
11103                                 fi
11104                                 ;;
11105                         esac
11106                 done
11107                 : In case none of those worked, prompt the user.
11108                 case "$netdb_net_type" in
11109                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11110                         dflt='long'
11111                         . ./myread
11112                         netdb_net_type=$ans
11113                         ;;
11114                 esac
11115                 ;;
11116         *)      : no getnetbyaddr, so pick harmless default
11117                 netdb_net_type='long'
11118                 ;;
11119         esac
11120 fi
11121 : locate the preferred pager for this system
11122 case "$pager" in
11123 '')
11124         dflt=''
11125         case "$pg" in
11126         /*) dflt=$pg;;
11127         esac
11128         case "$more" in
11129         /*) dflt=$more;;
11130         esac
11131         case "$less" in
11132         /*) dflt=$less;;
11133         esac
11134         case "$dflt" in
11135         '') dflt=/usr/ucb/more;;
11136         esac
11137         ;;
11138 *) dflt="$pager";;
11139 esac
11140 echo " "
11141 fn=f/
11142 rp='What pager is used on your system?'
11143 . ./getfile
11144 pager="$ans"
11145
11146 : see what type pids are declared as in the kernel
11147 rp="What is the type of process ids on this system?"
11148 set pid_t pidtype int stdio.h sys/types.h
11149 eval $typedef_ask
11150
11151 : check for length of pointer
11152 echo " "
11153 case "$ptrsize" in
11154 '')
11155         $echo $n "Checking to see how big your pointers are...$c" >&4
11156         if test "$voidflags" -gt 7; then
11157                 echo '#define VOID_PTR char *' > try.c
11158         else
11159                 echo '#define VOID_PTR void *' > try.c
11160         fi
11161         $cat >>try.c <<'EOCP'
11162 #include <stdio.h>
11163 int main()
11164 {
11165         printf("%d\n", sizeof(VOID_PTR));
11166         exit(0);
11167 }
11168 EOCP
11169         set try
11170         if eval $compile_ok; then
11171                 ptrsize=`./try`
11172                 $echo " $ptrsize bytes." >&4
11173         else
11174                 dflt='4'
11175                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
11176                 rp="What is the size of a pointer (in bytes)?"
11177                 . ./myread
11178                 ptrsize="$ans"
11179         fi
11180         ;;
11181 esac
11182 $rm -f try.c try
11183
11184 : see if ar generates random libraries by itself
11185 echo " "
11186 echo "Checking how to generate random libraries on your machine..." >&4
11187 echo 'int bar1() { return bar2(); }' > bar1.c
11188 echo 'int bar2() { return 2; }' > bar2.c
11189 $cat > foo.c <<'EOP'
11190 int main() { printf("%d\n", bar1()); exit(0); }
11191 EOP
11192 $cc $ccflags -c bar1.c >/dev/null 2>&1
11193 $cc $ccflags -c bar2.c >/dev/null 2>&1
11194 $cc $ccflags -c foo.c >/dev/null 2>&1
11195 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11196 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11197         ./foobar >/dev/null 2>&1; then
11198         echo "$ar appears to generate random libraries itself."
11199         orderlib=false
11200         ranlib=":"
11201 elif $ar ts bar$_a >/dev/null 2>&1 &&
11202         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11203         ./foobar >/dev/null 2>&1; then
11204                 echo "a table of contents needs to be added with '$ar ts'."
11205                 orderlib=false
11206                 ranlib="$ar ts"
11207 else
11208         case "$ranlib" in
11209         :) ranlib='';;
11210         '')
11211                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
11212                 $test -f $ranlib || ranlib=''
11213                 ;;
11214         esac
11215         if $test -n "$ranlib"; then
11216                 echo "your system has '$ranlib'; we'll use that."
11217                 orderlib=false
11218         else
11219                 echo "your system doesn't seem to support random libraries"
11220                 echo "so we'll use lorder and tsort to order the libraries."
11221                 orderlib=true
11222                 ranlib=":"
11223         fi
11224 fi
11225 $rm -f foo* bar* 
11226
11227 : check for type of arguments to select. 
11228 case "$selecttype" in
11229 '') case "$d_select" in
11230         $define)
11231                 $cat <<EOM
11232 Checking to see what type of arguments are accepted by select().
11233 EOM
11234                 hdrs="$define sys/types.h
11235                         $i_systime sys/time.h 
11236                         $i_sysselct sys/select.h
11237                         $d_socket sys/socket.h"
11238                 : The first arg can be int, unsigned, or size_t
11239                 : The last arg may or may not be 'const'
11240                 val=''
11241                 : void pointer has been seen but using that
11242                 : breaks the selectminbits test
11243                 for xxx in 'fd_set *' 'int *'; do
11244                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
11245                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
11246                                         case "$val" in
11247                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
11248                                                 if ./protochk "$try" $hdrs; then
11249                                                         echo "Your system accepts $xxx."
11250                                                         val="$xxx"
11251                                                 fi
11252                                                 ;;
11253                                         esac
11254                                 done
11255                         done
11256                 done
11257                 case "$val" in
11258                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
11259                         case "$d_fd_set" in
11260                                 $define) dflt="fd_set *" ;;
11261                                 *)              dflt="int *" ;;
11262                         esac
11263                         . ./myread
11264                         val=$ans
11265                         ;;
11266                 esac
11267                 selecttype="$val"
11268                 ;;
11269         *)      : no select, so pick a harmless default
11270                 selecttype='int *'
11271                 ;;
11272         esac
11273         ;;
11274 esac
11275
11276 : check for the select 'width'
11277 case "$selectminbits" in
11278 '') case "$d_select" in
11279         $define)
11280                 $cat <<EOM
11281
11282 Checking to see on how many bits at a time your select() operates...
11283 EOM
11284                 $cat >try.c <<EOCP
11285 #include <sys/types.h>
11286 #$i_time I_TIME
11287 #$i_systime I_SYS_TIME
11288 #$i_systimek I_SYS_TIME_KERNEL
11289 #ifdef I_TIME
11290 #   include <time.h>
11291 #endif
11292 #ifdef I_SYS_TIME
11293 #   ifdef I_SYS_TIME_KERNEL
11294 #       define KERNEL
11295 #   endif
11296 #   include <sys/time.h>
11297 #   ifdef I_SYS_TIME_KERNEL
11298 #       undef KERNEL
11299 #   endif
11300 #endif
11301 #$i_sysselct I_SYS_SELECT
11302 #ifdef I_SYS_SELECT
11303 #include <sys/select.h>
11304 #endif
11305 #include <stdio.h>
11306 $selecttype b;
11307 #define S sizeof(*(b))
11308 #define MINBITS 64
11309 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
11310 #define NBITS  (NBYTES * 8)
11311 int main() {
11312     char s[NBYTES];
11313     struct timeval t;
11314     int i;
11315     FILE* fp;
11316     int fd;
11317
11318     fclose(stdin);
11319     fp = fopen("try.c", "r");
11320     if (fp == 0)
11321       exit(1);
11322     fd = fileno(fp);
11323     if (fd < 0)
11324       exit(2);
11325     b = ($selecttype)s;
11326     for (i = 0; i < NBITS; i++)
11327         FD_SET(i, b);
11328     t.tv_sec  = 0;
11329     t.tv_usec = 0;
11330     select(fd + 1, b, 0, 0, &t);
11331     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
11332     printf("%d\n", i + 1);
11333     return 0;
11334 }
11335 EOCP
11336                 set try
11337                 if eval $compile_ok; then
11338                         selectminbits=`./try`
11339                         case "$selectminbits" in
11340                         '')     cat >&4 <<EOM
11341 Cannot figure out on how many bits at a time your select() operates.
11342 I'll play safe and guess it is 32 bits.
11343 EOM
11344                                 selectminbits=32
11345                                 bits="32 bits"
11346                                 ;;
11347                         1)      bits="1 bit" ;;
11348                         *)      bits="$selectminbits bits" ;;
11349                         esac
11350                         echo "Your select() operates on $bits at a time." >&4
11351                 else
11352                         rp='What is the minimum number of bits your select() operates on?'
11353                         case "$byteorder" in
11354                         1234|12345678)  dflt=32 ;;
11355                         *)              dflt=1  ;;
11356                         esac
11357                         . ./myread
11358                         val=$ans
11359                         selectminbits="$val"
11360                 fi
11361                 $rm -f try.* try
11362                 ;;
11363         *)      : no select, so pick a harmless default
11364                 selectminbits='32'
11365                 ;;
11366         esac
11367         ;;
11368 esac
11369
11370 : Trace out the files included by signal.h, then look for SIGxxx names.
11371 : Remove SIGARRAYSIZE used by HPUX.
11372 : Remove SIGTYP void lines used by OS2.
11373 xxx=`echo '#include <signal.h>' |
11374         $cppstdin $cppminus $cppflags 2>/dev/null |
11375         $grep '^[       ]*#.*include' | 
11376         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
11377 : Check this list of files to be sure we have parsed the cpp output ok.
11378 : This will also avoid potentially non-existent files, such 
11379 : as ../foo/bar.h
11380 xxxfiles=''
11381 for xx in $xxx /dev/null ; do
11382         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
11383 done
11384 : If we have found no files, at least try signal.h
11385 case "$xxxfiles" in
11386 '')     xxxfiles=`./findhdr signal.h` ;;
11387 esac
11388 xxx=`awk '
11389 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $3 !~ /void/ {
11390         print substr($2, 4, 20)
11391 }
11392 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
11393         print substr($3, 4, 20)
11394 }' $xxxfiles`
11395 : Append some common names just in case the awk scan failed.
11396 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
11397 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
11398 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
11399 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
11400 : generate a few handy files for later
11401 $cat > signal.c <<'EOCP'
11402 #include <sys/types.h>
11403 #include <signal.h>
11404 #include <stdio.h>
11405 int main() {
11406
11407 /* Strange style to avoid deeply-nested #if/#else/#endif */
11408 #ifndef NSIG
11409 #  ifdef _NSIG
11410 #    define NSIG (_NSIG)
11411 #  endif
11412 #endif
11413
11414 #ifndef NSIG
11415 #  ifdef SIGMAX
11416 #    define NSIG (SIGMAX+1)
11417 #  endif
11418 #endif
11419
11420 #ifndef NSIG
11421 #  ifdef SIG_MAX
11422 #    define NSIG (SIG_MAX+1)
11423 #  endif
11424 #endif
11425
11426 #ifndef NSIG
11427 #  ifdef MAXSIG
11428 #    define NSIG (MAXSIG+1)
11429 #  endif
11430 #endif
11431
11432 #ifndef NSIG
11433 #  ifdef MAX_SIG
11434 #    define NSIG (MAX_SIG+1)
11435 #  endif
11436 #endif
11437
11438 #ifndef NSIG
11439 #  ifdef SIGARRAYSIZE
11440 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
11441 #  endif
11442 #endif
11443
11444 #ifndef NSIG
11445 #  ifdef _sys_nsig
11446 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
11447 #  endif
11448 #endif
11449
11450 /* Default to some arbitrary number that's big enough to get most
11451    of the common signals.
11452 */
11453 #ifndef NSIG
11454 #    define NSIG 50
11455 #endif
11456
11457 printf("NSIG %d\n", NSIG);
11458
11459 #ifndef JUST_NSIG
11460
11461 EOCP
11462
11463 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
11464 {
11465         printf "#ifdef SIG"; printf $1; printf "\n"
11466         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
11467         printf $1; printf ");\n"
11468         printf "#endif\n"
11469 }
11470 END {
11471         printf "#endif /* JUST_NSIG */\n";
11472         printf "}\n";
11473 }
11474 ' >>signal.c
11475 $cat >signal.awk <<'EOP'
11476 BEGIN { ndups = 0 }
11477 $1 ~ /^NSIG$/ { nsig = $2 }
11478 ($1 !~ /^NSIG$/) && (NF == 2) {
11479     if ($2 > maxsig) { maxsig = $2 }
11480     if (sig_name[$2]) {
11481         dup_name[ndups] = $1
11482         dup_num[ndups] = $2
11483         ndups++ 
11484     }
11485     else {
11486         sig_name[$2] = $1
11487         sig_num[$2] = $2
11488     }
11489
11490 }
11491 END { 
11492     if (nsig == 0) { nsig = maxsig + 1 }
11493         for (n = 1; n < nsig; n++) {
11494                 if (sig_name[n]) {
11495                         printf("%s %d\n", sig_name[n], sig_num[n])
11496                 }
11497                 else {
11498                         printf("NUM%d %d\n", n, n) 
11499                 }
11500         }
11501     for (n = 0; n < ndups; n++) {
11502                 printf("%s %d\n", dup_name[n], dup_num[n])
11503     }
11504 }
11505 EOP
11506 $cat >signal_cmd <<EOS
11507 $startsh
11508 if $test -s signal.lst; then
11509     echo "Using your existing signal.lst file"
11510         exit 0
11511 fi
11512 xxx="$xxx"
11513 EOS
11514 $cat >>signal_cmd <<'EOS'
11515
11516 set signal
11517 if eval $compile_ok; then
11518         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
11519 else
11520         echo "(I can't seem be able to compile the whole test program)" >&4
11521         echo "(I'll try it in little pieces.)" >&4
11522         set signal -DJUST_NSIG
11523         if eval $compile_ok; then
11524                 ./signal$_exe > signal.nsg
11525                 $cat signal.nsg
11526         else
11527                 echo "I can't seem to figure out how many signals you have." >&4
11528                 echo "Guessing 50." >&4
11529                 echo 'NSIG 50' > signal.nsg
11530         fi
11531         : Now look at all the signal names, one at a time.
11532         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
11533                 $cat > signal.c <<EOCP
11534 #include <sys/types.h>
11535 #include <signal.h>
11536 #include <stdio.h>
11537 int main() {
11538 printf("$xx %d\n", SIG${xx});
11539 return 0;
11540 }
11541 EOCP
11542                 set signal
11543                 if eval $compile; then
11544                         echo "SIG${xx} found."
11545                         ./signal$_exe  >> signal.ls1
11546                 else
11547                         echo "SIG${xx} NOT found."
11548                 fi
11549         done
11550         if $test -s signal.ls1; then
11551                 $cat signal.nsg signal.ls1 |
11552                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
11553         fi
11554
11555 fi
11556 if $test -s signal.lst; then
11557         :
11558 else
11559         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
11560         echo 'kill -l' >signal
11561         set X `csh -f <signal`
11562         $rm -f signal
11563         shift
11564         case $# in
11565         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
11566         esac
11567         echo $@ | $tr ' ' $trnl | \
11568                 $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst
11569 fi
11570 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
11571 EOS
11572 chmod a+x signal_cmd
11573 $eunicefix signal_cmd
11574
11575 : generate list of signal names
11576 echo " "
11577 case "$sig_name_init" in
11578 '') doinit=yes ;;
11579 *)  case "$sig_num_init" in
11580     ''|*,*) doinit=yes ;;
11581     esac ;;
11582 esac
11583 case "$doinit" in
11584 yes)
11585         echo "Generating a list of signal names and numbers..." >&4
11586         . ./signal_cmd
11587         sig_name=`$awk '{printf "%s ", $1}' signal.lst`
11588         sig_name="ZERO $sig_name"
11589         sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " }
11590                                                 { printf "\"%s\", ", $1 }
11591                                                 END { printf "0\n" }' signal.lst`
11592         sig_num=`$awk '{printf "%d ", $2}' signal.lst`
11593         sig_num="0 $sig_num"
11594         sig_num_init=`$awk 'BEGIN { printf "0, " }
11595                                         { printf "%d, ", $2}
11596                                         END { printf "0\n"}' signal.lst`
11597         ;;
11598 esac
11599 echo "The following signals are available:"
11600 echo " "
11601 echo $sig_name | $awk \
11602 'BEGIN { linelen = 0 }
11603 {
11604         for (i = 1; i <= NF; i++) {
11605                 name = "SIG" $i " "
11606                 linelen = linelen + length(name)
11607                 if (linelen > 70) {
11608                         printf "\n"
11609                         linelen = length(name)
11610                 }
11611                 printf "%s", name
11612         }
11613         printf "\n"
11614 }'
11615 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
11616
11617 : see what type is used for signed size_t
11618 set ssize_t ssizetype int stdio.h sys/types.h
11619 eval $typedef
11620 dflt="$ssizetype"
11621 $cat > ssize.c <<EOM
11622 #include <stdio.h>
11623 #include <sys/types.h>
11624 #define Size_t $sizetype
11625 #define SSize_t $dflt
11626 int main()
11627 {
11628         if (sizeof(Size_t) == sizeof(SSize_t))
11629                 printf("$dflt\n");
11630         else if (sizeof(Size_t) == sizeof(int))
11631                 printf("int\n");
11632         else 
11633                 printf("long\n");
11634         exit(0);
11635 }
11636 EOM
11637 echo " "
11638 set ssize
11639 if eval $compile_ok && ./ssize > /dev/null; then
11640         ssizetype=`./ssize`
11641         echo "I'll be using $ssizetype for functions returning a byte count." >&4
11642 else
11643         $cat >&4 <<EOM
11644 Help! I can't compile and run the ssize_t test program: please enlighten me!
11645 (This is probably a misconfiguration in your system or libraries, and
11646 you really ought to fix it.  Still, I'll try anyway.)
11647
11648 I need a type that is the same size as $sizetype, but is guaranteed to
11649 be signed.  Common values are ssize_t, int and long.
11650
11651 EOM
11652         rp="What signed type is the same size as $sizetype?"
11653         . ./myread
11654         ssizetype="$ans"
11655 fi
11656 $rm -f ssize ssize.*
11657
11658 : see what type of char stdio uses.
11659 echo " "
11660 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11661         echo "Your stdio uses unsigned chars." >&4
11662         stdchar="unsigned char"
11663 else
11664         echo "Your stdio uses signed chars." >&4
11665         stdchar="char"
11666 fi
11667
11668 : see if time exists
11669 echo " "
11670 if test "X$d_time" = X -o X"$timetype" = X; then
11671     if set time val -f d_time; eval $csym; $val; then
11672                 echo 'time() found.' >&4
11673                 val="$define"
11674                 rp="What is the type returned by time() on this system?"
11675                 set time_t timetype long stdio.h sys/types.h
11676                 eval $typedef_ask
11677     else
11678                 echo 'time() not found, hope that will do.' >&4
11679                 val="$undef"
11680                 timetype='int';
11681     fi
11682     set d_time
11683     eval $setvar
11684 fi
11685
11686 : see what type uids are declared as in the kernel
11687 echo " "
11688 echo "Looking for the type for user ids returned by getuid()."
11689 set uid_t uidtype xxx stdio.h sys/types.h
11690 eval $typedef
11691 case "$uidtype" in
11692 xxx)
11693         xxx=`./findhdr sys/user.h`
11694         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
11695         case $1 in
11696         unsigned) dflt="$1 $2" ;;
11697         *) dflt="$1" ;;
11698         esac
11699         ;;
11700 *) dflt="$uidtype";;
11701 esac
11702 case "$uidtype" in
11703 uid_t)  echo "uid_t found." ;;
11704 *)      rp="What is the type for user ids returned by getuid()?"
11705         . ./myread
11706         uidtype="$ans"
11707         ;;
11708 esac
11709
11710 : see if dbm.h is available
11711 : see if dbmclose exists
11712 set dbmclose d_dbmclose
11713 eval $inlibc
11714
11715 case "$d_dbmclose" in
11716 $define)
11717         set dbm.h i_dbm
11718         eval $inhdr
11719         case "$i_dbm" in
11720         $define)
11721                 val="$undef"
11722                 set i_rpcsvcdbm
11723                 eval $setvar
11724                 ;;
11725         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11726                 eval $inhdr
11727                 ;;
11728         esac
11729         ;;
11730 *)      echo "We won't be including <dbm.h>"
11731         val="$undef"
11732         set i_dbm
11733         eval $setvar
11734         val="$undef"
11735         set i_rpcsvcdbm
11736         eval $setvar
11737         ;;
11738 esac
11739
11740 : see if this is a sys/file.h system
11741 val=''
11742 set sys/file.h val
11743 eval $inhdr
11744
11745 : do we need to include sys/file.h ?
11746 case "$val" in
11747 "$define")
11748         echo " "
11749         if $h_sysfile; then
11750                 val="$define"
11751                 echo "We'll be including <sys/file.h>." >&4
11752         else
11753                 val="$undef"
11754                 echo "We won't be including <sys/file.h>." >&4
11755         fi
11756         ;;
11757 *)
11758         h_sysfile=false
11759         ;;
11760 esac
11761 set i_sysfile
11762 eval $setvar
11763
11764 : see if fcntl.h is there
11765 val=''
11766 set fcntl.h val
11767 eval $inhdr
11768
11769 : see if we can include fcntl.h
11770 case "$val" in
11771 "$define")
11772         echo " "
11773         if $h_fcntl; then
11774                 val="$define"
11775                 echo "We'll be including <fcntl.h>." >&4
11776         else
11777                 val="$undef"
11778                 if $h_sysfile; then
11779         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11780                 else
11781                         echo "We won't be including <fcntl.h>." >&4
11782                 fi
11783         fi
11784         ;;
11785 *)
11786         h_fcntl=false
11787         val="$undef"
11788         ;;
11789 esac
11790 set i_fcntl
11791 eval $setvar
11792
11793 : see if locale.h is available
11794 set locale.h i_locale
11795 eval $inhdr
11796
11797 : see if mach cthreads are available
11798 if test "X$usethreads" = "X$define"; then
11799         set mach/cthreads.h i_machcthr
11800         eval $inhdr
11801 else
11802         i_machcthr="$undef"
11803 fi
11804
11805
11806
11807 : see if this is a math.h system
11808 set math.h i_math
11809 eval $inhdr
11810
11811 : see if this is a mntent.h system
11812 set mntent.h i_mntent
11813 eval $inhdr
11814
11815 : see if ndbm.h is available
11816 set ndbm.h t_ndbm
11817 eval $inhdr
11818 case "$t_ndbm" in
11819 $define)
11820         : see if dbm_open exists
11821         set dbm_open d_dbm_open
11822         eval $inlibc
11823         case "$d_dbm_open" in
11824         $undef)
11825                 t_ndbm="$undef"
11826                 echo "We won't be including <ndbm.h>"
11827                 ;;
11828         esac
11829         ;;
11830 esac
11831 val="$t_ndbm"
11832 set i_ndbm
11833 eval $setvar
11834
11835 : see if net/errno.h is available
11836 val=''
11837 set net/errno.h val
11838 eval $inhdr
11839
11840 : Unfortunately, it causes problems on some systems.  Arrgh.
11841 case "$val" in
11842 $define)
11843         cat > try.c <<'EOM'
11844 #include <stdio.h>
11845 #include <errno.h>
11846 #include <net/errno.h>
11847 int func()
11848 {
11849         return ENOTSOCK;
11850 }
11851 EOM
11852         if $cc $ccflags -c try.c >/dev/null 2>&1; then
11853                 echo "We'll be including <net/errno.h>." >&4
11854         else
11855                 echo "We won't be including <net/errno.h>." >&4
11856                 val="$undef"
11857         fi
11858         $rm -f try.* try
11859         ;;
11860 esac
11861 set i_neterrno
11862 eval $setvar
11863
11864 : see if this is a poll.h system
11865 set poll.h i_poll
11866 eval $inhdr
11867
11868 : get C preprocessor symbols handy
11869 echo " "
11870 $echo $n "Hmm... $c"
11871 echo $al | $tr ' ' $trnl >Cppsym.know
11872 $cat <<EOSS >Cppsym
11873 $startsh
11874 case "\$1" in
11875 -l) list=true
11876         shift
11877         ;;
11878 esac
11879 unknown=''
11880 case "\$list\$#" in
11881 1|2)
11882         for sym do
11883                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
11884                         exit 0
11885                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
11886                         :
11887                 else
11888                         unknown="\$unknown \$sym"
11889                 fi
11890         done
11891         set X \$unknown
11892         shift
11893         ;;
11894 esac
11895 case \$# in
11896 0) exit 1;;
11897 esac
11898 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
11899 #ifdef \1\\
11900 exit 0; _ _ _ _\1\\      \1\\
11901 #endif\\
11902 /' >Cppsym\$\$
11903 echo "exit 1; _ _ _" >>Cppsym\$\$
11904 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
11905 case "\$list" in
11906 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
11907 *)
11908         sh Cppsym2\$\$
11909         status=\$?
11910         ;;
11911 esac
11912 $rm -f Cppsym\$\$ Cppsym2\$\$
11913 exit \$status
11914 EOSS
11915 chmod +x Cppsym
11916 $eunicefix Cppsym
11917 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
11918
11919 : now check the C compiler for additional symbols
11920 $cat >ccsym <<EOS
11921 $startsh
11922 $cat >tmp.c <<EOF
11923 extern int foo;
11924 EOF
11925 for i in \`$cc -v -c tmp.c 2>&1\`
11926 do
11927         case "\$i" in
11928         -D*) echo "\$i" | $sed 's/^-D//';;
11929         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
11930         esac
11931 done
11932 $rm -f try.c
11933 EOS
11934 chmod +x ccsym
11935 $eunicefix ccsym
11936 ./ccsym > ccsym1.raw
11937 if $test -s ccsym1.raw; then
11938        $sort ccsym1.raw | $uniq >ccsym.raw
11939 else
11940        mv ccsym1.raw ccsym.raw
11941 fi
11942
11943 $awk '/\=/ { print $0; next }
11944         { print $0"=1" }' ccsym.raw >ccsym.list
11945 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
11946 $comm -13 ccsym.true ccsym.list >ccsym.own
11947 $comm -12 ccsym.true ccsym.list >ccsym.com
11948 $comm -23 ccsym.true ccsym.list >ccsym.cpp
11949 also=''
11950 if $test -z ccsym.raw; then
11951         echo "Your C compiler doesn't seem to define any symbols!" >&4
11952         echo " "
11953         echo "However, your C preprocessor defines the following symbols:"
11954         $cat Cppsym.true
11955         ccsymbols=''
11956         cppsymbols=`$cat Cppsym.true`
11957         cppsymbols=`echo $cppsymbols`
11958         cppccsymbols="$cppsymbols"
11959 else
11960         if $test -s ccsym.com; then
11961                 echo "Your C compiler and pre-processor define these symbols:"
11962                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
11963                 also='also '
11964                 symbols='ones'
11965                 cppccsymbols=`$cat ccsym.com`
11966                 cppccsymbols=`echo $cppccsymbols`
11967                 $test "$silent" || sleep 1
11968         fi
11969         if $test -s ccsym.cpp; then
11970                 $test "$also" && echo " "
11971                 echo "Your C pre-processor ${also}defines the following symbols:"
11972                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
11973                 also='further '
11974                 cppsymbols=`$cat ccsym.cpp`
11975                 cppsymbols=`echo $cppsymbols`
11976                 $test "$silent" || sleep 1
11977         fi
11978         if $test -s ccsym.own; then
11979                 $test "$also" && echo " "
11980                 echo "Your C compiler ${also}defines the following cpp symbols:"
11981                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
11982                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
11983                 ccsymbols=`$cat ccsym.own`
11984                 ccsymbols=`echo $ccsymbols`
11985                 $test "$silent" || sleep 1
11986         fi
11987 fi
11988 $rm -f ccsym*
11989
11990 : see if this is a termio system
11991 val="$undef"
11992 val2="$undef"
11993 val3="$undef"
11994 if $test `./findhdr termios.h`; then
11995         set tcsetattr i_termios
11996         eval $inlibc
11997         val3="$i_termios"
11998 fi
11999 echo " "
12000 case "$val3" in
12001 "$define") echo "You have POSIX termios.h... good!" >&4;;
12002 *) if ./Cppsym pyr; then
12003                 case "`/bin/universe`" in
12004                 ucb) if $test `./findhdr sgtty.h`; then
12005                                 val2="$define"
12006                                 echo "<sgtty.h> found." >&4
12007                         else
12008                                 echo "System is pyramid with BSD universe."
12009                                 echo "<sgtty.h> not found--you could have problems." >&4
12010                         fi;;
12011                 *) if $test `./findhdr termio.h`; then
12012                                 val="$define"
12013                                 echo "<termio.h> found." >&4
12014                         else
12015                                 echo "System is pyramid with USG universe."
12016                                 echo "<termio.h> not found--you could have problems." >&4
12017                         fi;;
12018                 esac
12019         elif ./usg; then
12020                 if $test `./findhdr termio.h`; then
12021                         echo "<termio.h> found." >&4
12022                         val="$define"
12023                 elif $test `./findhdr sgtty.h`; then
12024                         echo "<sgtty.h> found." >&4
12025                         val2="$define"
12026                 else
12027 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12028                 fi
12029         else
12030                 if $test `./findhdr sgtty.h`; then
12031                         echo "<sgtty.h> found." >&4
12032                         val2="$define"
12033                 elif $test `./findhdr termio.h`; then
12034                         echo "<termio.h> found." >&4
12035                         val="$define"
12036                 else
12037 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12038                 fi
12039         fi;;
12040 esac
12041 set i_termio; eval $setvar
12042 val=$val2; set i_sgtty; eval $setvar
12043 val=$val3; set i_termios; eval $setvar
12044
12045 : see if stdarg is available
12046 echo " "
12047 if $test `./findhdr stdarg.h`; then
12048         echo "<stdarg.h> found." >&4
12049         valstd="$define"
12050 else
12051         echo "<stdarg.h> NOT found." >&4
12052         valstd="$undef"
12053 fi
12054
12055 : see if varags is available
12056 echo " "
12057 if $test `./findhdr varargs.h`; then
12058         echo "<varargs.h> found." >&4
12059 else
12060         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12061 fi
12062
12063 : set up the varargs testing programs
12064 $cat > varargs.c <<EOP
12065 #ifdef I_STDARG
12066 #include <stdarg.h>
12067 #endif
12068 #ifdef I_VARARGS
12069 #include <varargs.h>
12070 #endif
12071
12072 #ifdef I_STDARG
12073 int f(char *p, ...)
12074 #else
12075 int f(va_alist)
12076 va_dcl
12077 #endif
12078 {
12079         va_list ap;
12080 #ifndef I_STDARG
12081         char *p;
12082 #endif
12083 #ifdef I_STDARG
12084         va_start(ap,p);
12085 #else
12086         va_start(ap);
12087         p = va_arg(ap, char *);
12088 #endif
12089         va_end(ap);
12090 }
12091 EOP
12092 $cat > varargs <<EOP
12093 $startsh
12094 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12095         echo "true"
12096 else
12097         echo "false"
12098 fi
12099 $rm -f varargs$_o
12100 EOP
12101 chmod +x varargs
12102
12103 : now check which varargs header should be included
12104 echo " "
12105 i_varhdr=''
12106 case "$valstd" in
12107 "$define")
12108         if `./varargs I_STDARG`; then
12109                 val='stdarg.h'
12110         elif `./varargs I_VARARGS`; then
12111                 val='varargs.h'
12112         fi
12113         ;;
12114 *)
12115         if `./varargs I_VARARGS`; then
12116                 val='varargs.h'
12117         fi
12118         ;;
12119 esac
12120 case "$val" in
12121 '')
12122 echo "I could not find the definition for va_dcl... You have problems..." >&4
12123         val="$undef"; set i_stdarg; eval $setvar
12124         val="$undef"; set i_varargs; eval $setvar
12125         ;;
12126 *) 
12127         set i_varhdr
12128         eval $setvar
12129         case "$i_varhdr" in
12130         stdarg.h)
12131                 val="$define"; set i_stdarg; eval $setvar
12132                 val="$undef"; set i_varargs; eval $setvar
12133                 ;;
12134         varargs.h)
12135                 val="$undef"; set i_stdarg; eval $setvar
12136                 val="$define"; set i_varargs; eval $setvar
12137                 ;;
12138         esac
12139         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12140 esac
12141 $rm -f varargs*
12142
12143 : see if stddef is available
12144 set stddef.h i_stddef
12145 eval $inhdr
12146
12147 : see if sys/access.h is available
12148 set sys/access.h i_sysaccess
12149 eval $inhdr
12150
12151 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12152 set sys/filio.h i_sysfilio
12153 eval $inhdr
12154 echo " "
12155 if $test `./findhdr sys/ioctl.h`; then
12156         val="$define"
12157         echo '<sys/ioctl.h> found.' >&4
12158 else
12159         val="$undef"
12160         if $test $i_sysfilio = "$define"; then
12161             echo '<sys/ioctl.h> NOT found.' >&4
12162         else
12163                 $test $i_sgtty = "$define" && xxx="sgtty.h"
12164                 $test $i_termio = "$define" && xxx="termio.h"
12165                 $test $i_termios = "$define" && xxx="termios.h"
12166 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12167         fi
12168 fi
12169 set i_sysioctl
12170 eval $setvar
12171
12172 : see if sys/resource.h has to be included
12173 set sys/resource.h i_sysresrc
12174 eval $inhdr
12175
12176 : see if sys/security.h is available
12177 set sys/security.h i_syssecrt
12178 eval $inhdr
12179
12180 : see if this is a sys/statvfs.h system
12181 set sys/statvfs.h i_sysstatvfs
12182 eval $inhdr
12183
12184 : see if this is a sys/un.h system
12185 set sys/un.h i_sysun
12186 eval $inhdr
12187
12188 : see if this is a syswait system
12189 set sys/wait.h i_syswait
12190 eval $inhdr
12191
12192 : see if this is an utime system
12193 set utime.h i_utime
12194 eval $inhdr
12195
12196 : see if this is a values.h system
12197 set values.h i_values
12198 eval $inhdr
12199
12200 : see if this is a vfork system
12201 case "$d_vfork" in
12202 "$define")
12203         set vfork.h i_vfork
12204         eval $inhdr
12205         ;;
12206 *)
12207         i_vfork="$undef"
12208         ;;
12209 esac
12210
12211 : see if gdbm.h is available
12212 set gdbm.h t_gdbm
12213 eval $inhdr
12214 case "$t_gdbm" in
12215 $define)
12216         : see if gdbm_open exists
12217         set gdbm_open d_gdbm_open
12218         eval $inlibc
12219         case "$d_gdbm_open" in
12220         $undef)
12221                 t_gdbm="$undef"
12222                 echo "We won't be including <gdbm.h>"
12223                 ;;
12224         esac
12225         ;;
12226 esac
12227 val="$t_gdbm"
12228 set i_gdbm
12229 eval $setvar
12230
12231 echo " "
12232 echo "Looking for extensions..." >&4
12233 tdir=`pwd`
12234 cd $rsrc/ext
12235 : If we are using the old config.sh, known_extensions may contain
12236 : old or inaccurate or duplicate values.
12237 known_extensions=''
12238 nonxs_extensions=''
12239 : We do not use find because it might not be available.
12240 : We do not just use MANIFEST because the user may have dropped
12241 : some additional extensions into the source tree and expect them
12242 : to be built.
12243 for xxx in * ; do
12244         case "$xxx" in
12245         DynaLoader|dynaload) ;;
12246         *)      if $test -f $xxx/$xxx.xs; then
12247                         known_extensions="$known_extensions $xxx"
12248                 elif $test -f $xxx/Makefile.PL; then
12249                         nonxs_extensions="$nonxs_extensions $xxx"
12250                 else
12251                         if $test -d $xxx; then
12252                                 # Look for nested extensions, eg. Devel/Dprof.
12253                                 cd $xxx
12254                                 for yyy in * ; do
12255                                 if $test -f $yyy/$yyy.xs; then
12256                                         known_extensions="$known_extensions $xxx/$yyy"
12257                                 elif $test -f $yyy/Makefile.PL; then
12258                                         nonxs_extensions="$nonxs_extensions $xxx/$yyy"
12259                                 fi
12260                                 done
12261                                 cd ..
12262                         fi
12263                 fi 
12264                 ;;
12265         esac
12266 done
12267 set X $nonxs_extensions
12268 shift
12269 nonxs_extensions="$*"
12270 set X $known_extensions
12271 shift
12272 known_extensions="$*"
12273 cd $tdir
12274
12275 : Now see which are supported on this system.
12276 avail_ext=''
12277 for xxx in $known_extensions ; do
12278         case "$xxx" in
12279         DB_File|db_file)
12280                 case "$i_db" in
12281                 $define) avail_ext="$avail_ext $xxx" ;;
12282                 esac
12283                 ;;
12284         GDBM_File|gdbm_fil)
12285                 case "$i_gdbm" in 
12286                 $define) avail_ext="$avail_ext $xxx" ;;
12287                 esac
12288                 ;;
12289         NDBM_File|ndbm_fil)
12290                 case "$i_ndbm" in
12291                 $define) avail_ext="$avail_ext $xxx" ;;
12292                 esac
12293                 ;;
12294         ODBM_File|odbm_fil) 
12295                 case "${i_dbm}${i_rpcsvcdbm}" in
12296                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
12297                 esac
12298                 ;;
12299         POSIX|posix)
12300                 case "$useposix" in
12301                 true|define|y) avail_ext="$avail_ext $xxx" ;;
12302                 esac
12303                 ;;
12304         Opcode|opcode)
12305                 case "$useopcode" in
12306                 true|define|y) avail_ext="$avail_ext $xxx" ;;
12307                 esac
12308                 ;;
12309         Socket|socket)
12310                 case "$d_socket" in 
12311                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
12312                 esac
12313                 ;;
12314         Thread|thread)
12315                 case "$usethreads" in 
12316                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
12317                 esac
12318                 ;;
12319         IPC/SysV|ipc/sysv)
12320                 : XXX Do we need a useipcsysv variable here
12321                 case "${d_msg}${d_sem}${d_shm}" in 
12322                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
12323                 esac
12324                 ;;
12325         *)      avail_ext="$avail_ext $xxx"
12326                 ;;
12327         esac
12328 done
12329
12330 set X $avail_ext
12331 shift
12332 avail_ext="$*"
12333
12334 : Now see which nonxs extensions are supported on this system.
12335 : For now assume all are.
12336 nonxs_ext=''
12337 for xxx in $nonxs_extensions ; do
12338         case "$xxx" in
12339         *)      nonxs_ext="$nonxs_ext $xxx"
12340                 ;;
12341         esac
12342 done
12343
12344 set X $nonxs_ext
12345 shift
12346 nonxs_ext="$*"
12347
12348 case $usedl in
12349 $define)
12350         $cat <<EOM
12351 A number of extensions are supplied with $package.  You may choose to
12352 compile these extensions for dynamic loading (the default), compile
12353 them into the $package executable (static loading), or not include
12354 them at all.  Answer "none" to include no extensions.
12355 Note that DynaLoader is always built and need not be mentioned here.
12356
12357 EOM
12358         case "$dynamic_ext" in
12359         '') dflt="$avail_ext" ;;
12360         *)      dflt="$dynamic_ext"
12361                 # Perhaps we are reusing an old out-of-date config.sh.
12362                 case "$hint" in
12363                 previous)
12364                         if test X"$dynamic_ext" != X"$avail_ext"; then
12365                                 $cat <<EOM
12366 NOTICE:  Your previous config.sh list may be incorrect. 
12367 The extensions now available to you are 
12368         ${avail_ext}
12369 but the default list from your previous config.sh is
12370         ${dynamic_ext} 
12371
12372 EOM
12373                         fi
12374                         ;;
12375                 esac
12376                 ;;
12377         esac
12378         case "$dflt" in
12379         '')     dflt=none;;
12380         esac
12381         rp="What extensions do you wish to load dynamically?"
12382         . ./myread
12383         case "$ans" in
12384         none) dynamic_ext=' ' ;;
12385         *) dynamic_ext="$ans" ;;
12386         esac
12387
12388         case "$static_ext" in
12389         '')
12390                 : Exclude those already listed in dynamic linking
12391                 dflt=''
12392                 for xxx in $avail_ext; do
12393                         case " $dynamic_ext " in
12394                         *" $xxx "*) ;;
12395                         *) dflt="$dflt $xxx" ;;
12396                         esac
12397                 done
12398                 set X $dflt
12399                 shift
12400                 dflt="$*"
12401                 ;;
12402         *)  dflt="$static_ext" 
12403                 ;;
12404         esac
12405
12406         case "$dflt" in
12407         '')     dflt=none;;
12408         esac
12409         rp="What extensions do you wish to load statically?"
12410         . ./myread
12411         case "$ans" in
12412         none) static_ext=' ' ;;
12413         *) static_ext="$ans" ;;
12414         esac
12415         ;;
12416 *)
12417         $cat <<EOM
12418 A number of extensions are supplied with $package.  Answer "none" 
12419 to include no extensions. 
12420 Note that DynaLoader is always built and need not be mentioned here.
12421
12422 EOM
12423         case "$static_ext" in
12424         '') dflt="$avail_ext" ;;
12425         *)      dflt="$static_ext"
12426                 # Perhaps we are reusing an old out-of-date config.sh.
12427                 case "$hint" in
12428                 previous)
12429                         if test X"$static_ext" != X"$avail_ext"; then
12430                                 $cat <<EOM
12431 NOTICE:  Your previous config.sh list may be incorrect. 
12432 The extensions now available to you are 
12433         ${avail_ext}
12434 but the default list from your previous config.sh is
12435         ${static_ext} 
12436
12437 EOM
12438                         fi
12439                         ;;
12440                 esac
12441                 ;;
12442         esac
12443         : Exclude those that are not xs extensions
12444         case "$dflt" in
12445         '')     dflt=none;;
12446         esac
12447         rp="What extensions do you wish to include?"
12448         . ./myread
12449         case "$ans" in
12450         none) static_ext=' ' ;;
12451         *) static_ext="$ans" ;;
12452         esac
12453         ;;
12454 esac
12455
12456 set X $dynamic_ext $static_ext $nonxs_ext
12457 shift
12458 extensions="$*"
12459
12460 : Remove build directory name from cppstdin so it can be used from
12461 : either the present location or the final installed location.
12462 echo " "
12463 : Get out of the UU directory to get correct path name.
12464 cd ..
12465 case "$cppstdin" in
12466 `pwd`/cppstdin)
12467         echo "Stripping down cppstdin path name"
12468         cppstdin=cppstdin
12469         ;;
12470 esac
12471 cd UU
12472
12473 : end of configuration questions
12474 echo " "
12475 echo "End of configuration questions."
12476 echo " "
12477
12478 : back to where it started
12479 if test -d ../UU; then
12480         cd ..
12481 fi
12482
12483 : configuration may be patched via a 'config.over' file
12484 if $test -f config.over; then
12485         echo " "
12486         dflt=y
12487         rp='I see a config.over file.  Do you wish to load it?'
12488         . UU/myread
12489         case "$ans" in
12490         n*) echo "OK, I'll ignore it.";;
12491         *)      . ./config.over
12492                 echo "Configuration override changes have been loaded."
12493                 ;;
12494         esac
12495 fi
12496
12497 : in case they want portability, strip down executable paths
12498 case "$d_portable" in
12499 "$define")
12500         echo " "
12501         echo "Stripping down executable paths..." >&4
12502         for file in $loclist $trylist; do
12503                 if test X$file != Xln -a X$file != Xar -o X$osname != Xos2; then
12504                         eval $file="\$file"
12505                 fi
12506         done
12507         ;;
12508 esac
12509
12510 : create config.sh file
12511 echo " "
12512 echo "Creating config.sh..." >&4
12513 $spitshell <<EOT >config.sh
12514 $startsh
12515 #
12516 # This file was produced by running the Configure script. It holds all the
12517 # definitions figured out by Configure. Should you modify one of these values,
12518 # do not forget to propagate your changes by running "Configure -der". You may
12519 # instead choose to run each of the .SH files by yourself, or "Configure -S".
12520 #
12521
12522 # Package name      : $package
12523 # Source directory  : $src
12524 # Configuration time: $cf_time
12525 # Configured by     : $cf_by
12526 # Target system     : $myuname
12527
12528 Author='$Author'
12529 Date='$Date'
12530 Header='$Header'
12531 Id='$Id'
12532 Locker='$Locker'
12533 Log='$Log'
12534 Mcc='$Mcc'
12535 RCSfile='$RCSfile'
12536 Revision='$Revision'
12537 Source='$Source'
12538 State='$State'
12539 _a='$_a'
12540 _exe='$_exe'
12541 _o='$_o'
12542 afs='$afs'
12543 alignbytes='$alignbytes'
12544 ansi2knr='$ansi2knr'
12545 aphostname='$aphostname'
12546 apiversion='$apiversion'
12547 ar='$ar'
12548 archlib='$archlib'
12549 archlibexp='$archlibexp'
12550 archname64='$archname64'
12551 archname='$archname'
12552 archobjs='$archobjs'
12553 awk='$awk'
12554 baserev='$baserev'
12555 bash='$bash'
12556 bin='$bin'
12557 binexp='$binexp'
12558 bison='$bison'
12559 byacc='$byacc'
12560 byteorder='$byteorder'
12561 c='$c'
12562 castflags='$castflags'
12563 cat='$cat'
12564 cc='$cc'
12565 cccdlflags='$cccdlflags'
12566 ccdlflags='$ccdlflags'
12567 ccflags='$ccflags'
12568 ccsymbols='$ccsymbols'
12569 cf_by='$cf_by'
12570 cf_email='$cf_email'
12571 cf_time='$cf_time'
12572 chgrp='$chgrp'
12573 chmod='$chmod'
12574 chown='$chown'
12575 clocktype='$clocktype'
12576 comm='$comm'
12577 compress='$compress'
12578 contains='$contains'
12579 cp='$cp'
12580 cpio='$cpio'
12581 cpp='$cpp'
12582 cpp_stuff='$cpp_stuff'
12583 cppccsymbols='$cppccsymbols'
12584 cppflags='$cppflags'
12585 cpplast='$cpplast'
12586 cppminus='$cppminus'
12587 cpprun='$cpprun'
12588 cppstdin='$cppstdin'
12589 cppsymbols='$cppsymbols'
12590 cryptlib='$cryptlib'
12591 csh='$csh'
12592 d_Gconvert='$d_Gconvert'
12593 d_access='$d_access'
12594 d_accessx='$d_accessx'
12595 d_alarm='$d_alarm'
12596 d_archlib='$d_archlib'
12597 d_attribut='$d_attribut'
12598 d_bcmp='$d_bcmp'
12599 d_bcopy='$d_bcopy'
12600 d_bsd='$d_bsd'
12601 d_bsdgetpgrp='$d_bsdgetpgrp'
12602 d_bsdsetpgrp='$d_bsdsetpgrp'
12603 d_bzero='$d_bzero'
12604 d_casti32='$d_casti32'
12605 d_castneg='$d_castneg'
12606 d_charvspr='$d_charvspr'
12607 d_chown='$d_chown'
12608 d_chroot='$d_chroot'
12609 d_chsize='$d_chsize'
12610 d_closedir='$d_closedir'
12611 d_cmsghdr_s='$d_cmsghdr_s'
12612 d_const='$d_const'
12613 d_crypt='$d_crypt'
12614 d_csh='$d_csh'
12615 d_cuserid='$d_cuserid'
12616 d_dbl_dig='$d_dbl_dig'
12617 d_dbmclose64='$d_dbmclose64'
12618 d_dbminit64='$d_dbminit64'
12619 d_delete64='$d_delete64'
12620 d_difftime='$d_difftime'
12621 d_dirent64_s='$d_dirent64_s'
12622 d_dirnamlen='$d_dirnamlen'
12623 d_dlerror='$d_dlerror'
12624 d_dlopen='$d_dlopen'
12625 d_dlsymun='$d_dlsymun'
12626 d_dosuid='$d_dosuid'
12627 d_drand48proto='$d_drand48proto'
12628 d_dup2='$d_dup2'
12629 d_eaccess='$d_eaccess'
12630 d_endgrent='$d_endgrent'
12631 d_endhent='$d_endhent'
12632 d_endnent='$d_endnent'
12633 d_endpent='$d_endpent'
12634 d_endpwent='$d_endpwent'
12635 d_endsent='$d_endsent'
12636 d_eofnblk='$d_eofnblk'
12637 d_eunice='$d_eunice'
12638 d_fchmod='$d_fchmod'
12639 d_fchown='$d_fchown'
12640 d_fcntl='$d_fcntl'
12641 d_fd_macros='$d_fd_macros'
12642 d_fd_set='$d_fd_set'
12643 d_fds_bits='$d_fds_bits'
12644 d_fetch64='$d_fetch64'
12645 d_fgetpos64='$d_fgetpos64'
12646 d_fgetpos='$d_fgetpos'
12647 d_firstkey64='$d_firstkey64'
12648 d_flexfnam='$d_flexfnam'
12649 d_flock64_s='$d_flock64_s'
12650 d_flock='$d_flock'
12651 d_fopen64='$d_fopen64'
12652 d_fork='$d_fork'
12653 d_fpathconf='$d_fpathconf'
12654 d_freopen64='$d_freopen64'
12655 d_fseek64='$d_fseek64'
12656 d_fseeko64='$d_fseeko64'
12657 d_fseeko='$d_fseeko'
12658 d_fsetpos64='$d_fsetpos64'
12659 d_fsetpos='$d_fsetpos'
12660 d_fstat64='$d_fstat64'
12661 d_fstatfs='$d_fstatfs'
12662 d_fstatvfs='$d_fstatvfs'
12663 d_ftell64='$d_ftell64'
12664 d_ftello64='$d_ftello64'
12665 d_ftello='$d_ftello'
12666 d_ftime='$d_ftime'
12667 d_ftruncate64='$d_ftruncate64'
12668 d_getgrent='$d_getgrent'
12669 d_getgrps='$d_getgrps'
12670 d_gethbyaddr='$d_gethbyaddr'
12671 d_gethbyname='$d_gethbyname'
12672 d_gethent='$d_gethent'
12673 d_gethname='$d_gethname'
12674 d_gethostprotos='$d_gethostprotos'
12675 d_getlogin='$d_getlogin'
12676 d_getmntent='$d_getmntent'
12677 d_getnbyaddr='$d_getnbyaddr'
12678 d_getnbyname='$d_getnbyname'
12679 d_getnent='$d_getnent'
12680 d_getnetprotos='$d_getnetprotos'
12681 d_getpbyname='$d_getpbyname'
12682 d_getpbynumber='$d_getpbynumber'
12683 d_getpent='$d_getpent'
12684 d_getpgid='$d_getpgid'
12685 d_getpgrp2='$d_getpgrp2'
12686 d_getpgrp='$d_getpgrp'
12687 d_getppid='$d_getppid'
12688 d_getprior='$d_getprior'
12689 d_getprotoprotos='$d_getprotoprotos'
12690 d_getpwent='$d_getpwent'
12691 d_getsbyname='$d_getsbyname'
12692 d_getsbyport='$d_getsbyport'
12693 d_getsent='$d_getsent'
12694 d_getservprotos='$d_getservprotos'
12695 d_gettimeod='$d_gettimeod'
12696 d_gnulibc='$d_gnulibc'
12697 d_grpasswd='$d_grpasswd'
12698 d_hasmntopt='$d_hasmntopt'
12699 d_htonl='$d_htonl'
12700 d_index='$d_index'
12701 d_inetaton='$d_inetaton'
12702 d_ino64t='$d_ino64t'
12703 d_int64t='$d_int64t'
12704 d_iovec_s='$d_iovec_s'
12705 d_isascii='$d_isascii'
12706 d_killpg='$d_killpg'
12707 d_lchown='$d_lchown'
12708 d_link='$d_link'
12709 d_locconv='$d_locconv'
12710 d_lockf64='$d_lockf64'
12711 d_lockf='$d_lockf'
12712 d_longdbl='$d_longdbl'
12713 d_longlong='$d_longlong'
12714 d_lseek64='$d_lseek64'
12715 d_lstat64='$d_lstat64'
12716 d_lstat='$d_lstat'
12717 d_madvise='$d_madvise'
12718 d_mblen='$d_mblen'
12719 d_mbstowcs='$d_mbstowcs'
12720 d_mbtowc='$d_mbtowc'
12721 d_memcmp='$d_memcmp'
12722 d_memcpy='$d_memcpy'
12723 d_memmove='$d_memmove'
12724 d_memset='$d_memset'
12725 d_mkdir='$d_mkdir'
12726 d_mkfifo='$d_mkfifo'
12727 d_mktime='$d_mktime'
12728 d_mmap='$d_mmap'
12729 d_mprotect='$d_mprotect'
12730 d_msg='$d_msg'
12731 d_msg_ctrunc='$d_msg_ctrunc'
12732 d_msg_dontroute='$d_msg_dontroute'
12733 d_msg_oob='$d_msg_oob'
12734 d_msg_peek='$d_msg_peek'
12735 d_msg_proxy='$d_msg_proxy'
12736 d_msgctl='$d_msgctl'
12737 d_msgget='$d_msgget'
12738 d_msghdr_s='$d_msghdr_s'
12739 d_msgrcv='$d_msgrcv'
12740 d_msgsnd='$d_msgsnd'
12741 d_msync='$d_msync'
12742 d_munmap='$d_munmap'
12743 d_mymalloc='$d_mymalloc'
12744 d_nextkey64='$d_nextkey64'
12745 d_nice='$d_nice'
12746 d_off64t='$d_off64t'
12747 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
12748 d_oldpthreads='$d_oldpthreads'
12749 d_oldsock='$d_oldsock'
12750 d_open3='$d_open3'
12751 d_open64='$d_open64'
12752 d_opendir64='$d_opendir64'
12753 d_pathconf='$d_pathconf'
12754 d_pause='$d_pause'
12755 d_phostname='$d_phostname'
12756 d_pipe='$d_pipe'
12757 d_poll='$d_poll'
12758 d_portable='$d_portable'
12759 d_pthread_yield='$d_pthread_yield'
12760 d_pwage='$d_pwage'
12761 d_pwchange='$d_pwchange'
12762 d_pwclass='$d_pwclass'
12763 d_pwcomment='$d_pwcomment'
12764 d_pwexpire='$d_pwexpire'
12765 d_pwgecos='$d_pwgecos'
12766 d_pwpasswd='$d_pwpasswd'
12767 d_pwquota='$d_pwquota'
12768 d_readdir64='$d_readdir64'
12769 d_readdir='$d_readdir'
12770 d_readlink='$d_readlink'
12771 d_readv='$d_readv'
12772 d_recvmsg='$d_recvmsg'
12773 d_rename='$d_rename'
12774 d_rewinddir='$d_rewinddir'
12775 d_rmdir='$d_rmdir'
12776 d_safebcpy='$d_safebcpy'
12777 d_safemcpy='$d_safemcpy'
12778 d_sanemcmp='$d_sanemcmp'
12779 d_sched_yield='$d_sched_yield'
12780 d_scm_rights='$d_scm_rights'
12781 d_seekdir64='$d_seekdir64'
12782 d_seekdir='$d_seekdir'
12783 d_select='$d_select'
12784 d_sem='$d_sem'
12785 d_semctl='$d_semctl'
12786 d_semctl_semid_ds='$d_semctl_semid_ds'
12787 d_semctl_semun='$d_semctl_semun'
12788 d_semget='$d_semget'
12789 d_semop='$d_semop'
12790 d_sendmsg='$d_sendmsg'
12791 d_setegid='$d_setegid'
12792 d_seteuid='$d_seteuid'
12793 d_setgrent='$d_setgrent'
12794 d_setgrps='$d_setgrps'
12795 d_sethent='$d_sethent'
12796 d_setlinebuf='$d_setlinebuf'
12797 d_setlocale='$d_setlocale'
12798 d_setnent='$d_setnent'
12799 d_setpent='$d_setpent'
12800 d_setpgid='$d_setpgid'
12801 d_setpgrp2='$d_setpgrp2'
12802 d_setpgrp='$d_setpgrp'
12803 d_setprior='$d_setprior'
12804 d_setpwent='$d_setpwent'
12805 d_setregid='$d_setregid'
12806 d_setresgid='$d_setresgid'
12807 d_setresuid='$d_setresuid'
12808 d_setreuid='$d_setreuid'
12809 d_setrgid='$d_setrgid'
12810 d_setruid='$d_setruid'
12811 d_setsent='$d_setsent'
12812 d_setsid='$d_setsid'
12813 d_setvbuf='$d_setvbuf'
12814 d_sfio='$d_sfio'
12815 d_shm='$d_shm'
12816 d_shmat='$d_shmat'
12817 d_shmatprototype='$d_shmatprototype'
12818 d_shmctl='$d_shmctl'
12819 d_shmdt='$d_shmdt'
12820 d_shmget='$d_shmget'
12821 d_sigaction='$d_sigaction'
12822 d_sigsetjmp='$d_sigsetjmp'
12823 d_socket='$d_socket'
12824 d_sockpair='$d_sockpair'
12825 d_stat64='$d_stat64'
12826 d_statblks='$d_statblks'
12827 d_statfs='$d_statfs'
12828 d_statfsflags='$d_statfsflags'
12829 d_statvfs='$d_statvfs'
12830 d_stdio_cnt_lval='$d_stdio_cnt_lval'
12831 d_stdio_ptr_lval='$d_stdio_ptr_lval'
12832 d_stdiobase='$d_stdiobase'
12833 d_stdstdio='$d_stdstdio'
12834 d_store64='$d_store64'
12835 d_strchr='$d_strchr'
12836 d_strcoll='$d_strcoll'
12837 d_strctcpy='$d_strctcpy'
12838 d_strerrm='$d_strerrm'
12839 d_strerror='$d_strerror'
12840 d_strtod='$d_strtod'
12841 d_strtol='$d_strtol'
12842 d_strtoul='$d_strtoul'
12843 d_strxfrm='$d_strxfrm'
12844 d_suidsafe='$d_suidsafe'
12845 d_symlink='$d_symlink'
12846 d_syscall='$d_syscall'
12847 d_sysconf='$d_sysconf'
12848 d_sysernlst='$d_sysernlst'
12849 d_syserrlst='$d_syserrlst'
12850 d_system='$d_system'
12851 d_tcgetpgrp='$d_tcgetpgrp'
12852 d_tcsetpgrp='$d_tcsetpgrp'
12853 d_telldir64='$d_telldir64'
12854 d_telldir='$d_telldir'
12855 d_telldirproto='$d_telldirproto'
12856 d_time='$d_time'
12857 d_times='$d_times'
12858 d_tmpfile64='$d_tmpfile64'
12859 d_truncate64='$d_truncate64'
12860 d_truncate='$d_truncate'
12861 d_tzname='$d_tzname'
12862 d_umask='$d_umask'
12863 d_uname='$d_uname'
12864 d_union_semun='$d_union_semun'
12865 d_vfork='$d_vfork'
12866 d_void_closedir='$d_void_closedir'
12867 d_voidsig='$d_voidsig'
12868 d_voidtty='$d_voidtty'
12869 d_volatile='$d_volatile'
12870 d_vprintf='$d_vprintf'
12871 d_wait4='$d_wait4'
12872 d_waitpid='$d_waitpid'
12873 d_wcstombs='$d_wcstombs'
12874 d_wctomb='$d_wctomb'
12875 d_writev='$d_writev'
12876 d_xenix='$d_xenix'
12877 date='$date'
12878 db_hashtype='$db_hashtype'
12879 db_prefixtype='$db_prefixtype'
12880 defvoidused='$defvoidused'
12881 direntrytype='$direntrytype'
12882 dlext='$dlext'
12883 dlsrc='$dlsrc'
12884 doublesize='$doublesize'
12885 drand01='$drand01'
12886 dynamic_ext='$dynamic_ext'
12887 eagain='$eagain'
12888 ebcdic='$ebcdic'
12889 echo='$echo'
12890 egrep='$egrep'
12891 emacs='$emacs'
12892 eunicefix='$eunicefix'
12893 exe_ext='$exe_ext'
12894 expr='$expr'
12895 extensions='$extensions'
12896 find='$find'
12897 firstmakefile='$firstmakefile'
12898 flex='$flex'
12899 fpostype='$fpostype'
12900 freetype='$freetype'
12901 full_ar='$full_ar'
12902 full_csh='$full_csh'
12903 full_sed='$full_sed'
12904 gccversion='$gccversion'
12905 gidtype='$gidtype'
12906 glibpth='$glibpth'
12907 grep='$grep'
12908 groupcat='$groupcat'
12909 groupstype='$groupstype'
12910 gzip='$gzip'
12911 h_fcntl='$h_fcntl'
12912 h_sysfile='$h_sysfile'
12913 hint='$hint'
12914 hostcat='$hostcat'
12915 huge='$huge'
12916 i_arpainet='$i_arpainet'
12917 i_bsdioctl='$i_bsdioctl'
12918 i_db='$i_db'
12919 i_dbm='$i_dbm'
12920 i_dirent='$i_dirent'
12921 i_dld='$i_dld'
12922 i_dlfcn='$i_dlfcn'
12923 i_fcntl='$i_fcntl'
12924 i_float='$i_float'
12925 i_gdbm='$i_gdbm'
12926 i_grp='$i_grp'
12927 i_inttypes='$i_inttypes'
12928 i_limits='$i_limits'
12929 i_locale='$i_locale'
12930 i_machcthr='$i_machcthr'
12931 i_malloc='$i_malloc'
12932 i_math='$i_math'
12933 i_memory='$i_memory'
12934 i_mntent='$i_mntent'
12935 i_ndbm='$i_ndbm'
12936 i_netdb='$i_netdb'
12937 i_neterrno='$i_neterrno'
12938 i_niin='$i_niin'
12939 i_poll='$i_poll'
12940 i_pwd='$i_pwd'
12941 i_rpcsvcdbm='$i_rpcsvcdbm'
12942 i_sfio='$i_sfio'
12943 i_sgtty='$i_sgtty'
12944 i_stdarg='$i_stdarg'
12945 i_stddef='$i_stddef'
12946 i_stdlib='$i_stdlib'
12947 i_string='$i_string'
12948 i_sysaccess='$i_sysaccess'
12949 i_sysdir='$i_sysdir'
12950 i_sysfile='$i_sysfile'
12951 i_sysfilio='$i_sysfilio'
12952 i_sysin='$i_sysin'
12953 i_sysioctl='$i_sysioctl'
12954 i_sysmman='$i_sysmman'
12955 i_sysmount='$i_sysmount'
12956 i_sysndir='$i_sysndir'
12957 i_sysparam='$i_sysparam'
12958 i_sysresrc='$i_sysresrc'
12959 i_syssecrt='$i_syssecrt'
12960 i_sysselct='$i_sysselct'
12961 i_syssockio='$i_syssockio'
12962 i_sysstat='$i_sysstat'
12963 i_sysstatvfs='$i_sysstatvfs'
12964 i_systime='$i_systime'
12965 i_systimek='$i_systimek'
12966 i_systimes='$i_systimes'
12967 i_systypes='$i_systypes'
12968 i_sysuio='$i_sysuio'
12969 i_sysun='$i_sysun'
12970 i_syswait='$i_syswait'
12971 i_termio='$i_termio'
12972 i_termios='$i_termios'
12973 i_time='$i_time'
12974 i_unistd='$i_unistd'
12975 i_utime='$i_utime'
12976 i_values='$i_values'
12977 i_varargs='$i_varargs'
12978 i_varhdr='$i_varhdr'
12979 i_vfork='$i_vfork'
12980 ignore_versioned_solibs='$ignore_versioned_solibs'
12981 incpath='$incpath'
12982 inews='$inews'
12983 installarchlib='$installarchlib'
12984 installbin='$installbin'
12985 installman1dir='$installman1dir'
12986 installman3dir='$installman3dir'
12987 installprivlib='$installprivlib'
12988 installscript='$installscript'
12989 installsitearch='$installsitearch'
12990 installsitelib='$installsitelib'
12991 installusrbinperl='$installusrbinperl'
12992 intsize='$intsize'
12993 known_extensions='$known_extensions'
12994 ksh='$ksh'
12995 large='$large'
12996 ld='$ld'
12997 lddlflags='$lddlflags'
12998 ldflags='$ldflags'
12999 less='$less'
13000 lib_ext='$lib_ext'
13001 libc='$libc'
13002 libperl='$libperl'
13003 libpth='$libpth'
13004 libs='$libs'
13005 libswanted='$libswanted'
13006 line='$line'
13007 lint='$lint'
13008 lkflags='$lkflags'
13009 ln='$ln'
13010 lns='$lns'
13011 locincpth='$locincpth'
13012 loclibpth='$loclibpth'
13013 longdblsize='$longdblsize'
13014 longlongsize='$longlongsize'
13015 longsize='$longsize'
13016 lp='$lp'
13017 lpr='$lpr'
13018 ls='$ls'
13019 lseeksize='$lseeksize'
13020 lseektype='$lseektype'
13021 mail='$mail'
13022 mailx='$mailx'
13023 make='$make'
13024 make_set_make='$make_set_make'
13025 mallocobj='$mallocobj'
13026 mallocsrc='$mallocsrc'
13027 malloctype='$malloctype'
13028 man1dir='$man1dir'
13029 man1direxp='$man1direxp'
13030 man1ext='$man1ext'
13031 man3dir='$man3dir'
13032 man3direxp='$man3direxp'
13033 man3ext='$man3ext'
13034 medium='$medium'
13035 mips='$mips'
13036 mips_type='$mips_type'
13037 mkdir='$mkdir'
13038 mmaptype='$mmaptype'
13039 models='$models'
13040 modetype='$modetype'
13041 more='$more'
13042 mv='$mv'
13043 myarchname='$myarchname'
13044 mydomain='$mydomain'
13045 myhostname='$myhostname'
13046 myuname='$myuname'
13047 n='$n'
13048 netdb_hlen_type='$netdb_hlen_type'
13049 netdb_host_type='$netdb_host_type'
13050 netdb_name_type='$netdb_name_type'
13051 netdb_net_type='$netdb_net_type'
13052 nm='$nm'
13053 nm_opt='$nm_opt'
13054 nm_so_opt='$nm_so_opt'
13055 nonxs_ext='$nonxs_ext'
13056 nroff='$nroff'
13057 o_nonblock='$o_nonblock'
13058 obj_ext='$obj_ext'
13059 old_pthread_create_joinable='$old_pthread_create_joinable'
13060 optimize='$optimize'
13061 orderlib='$orderlib'
13062 osname='$osname'
13063 osvers='$osvers'
13064 package='$package'
13065 pager='$pager'
13066 passcat='$passcat'
13067 patchlevel='$patchlevel'
13068 path_sep='$path_sep'
13069 perl='$perl'
13070 perladmin='$perladmin'
13071 perlpath='$perlpath'
13072 pg='$pg'
13073 phostname='$phostname'
13074 pidtype='$pidtype'
13075 plibpth='$plibpth'
13076 pmake='$pmake'
13077 pr='$pr'
13078 prefix='$prefix'
13079 prefixexp='$prefixexp'
13080 privlib='$privlib'
13081 privlibexp='$privlibexp'
13082 prototype='$prototype'
13083 ptrsize='$ptrsize'
13084 randbits='$randbits'
13085 randfunc='$randfunc'
13086 randseedtype='$randseedtype'
13087 ranlib='$ranlib'
13088 rd_nodata='$rd_nodata'
13089 rm='$rm'
13090 rmail='$rmail'
13091 runnm='$runnm'
13092 sched_yield='$sched_yield'
13093 scriptdir='$scriptdir'
13094 scriptdirexp='$scriptdirexp'
13095 sed='$sed'
13096 seedfunc='$seedfunc'
13097 selectminbits='$selectminbits'
13098 selecttype='$selecttype'
13099 sendmail='$sendmail'
13100 sh='$sh'
13101 shar='$shar'
13102 sharpbang='$sharpbang'
13103 shmattype='$shmattype'
13104 shortsize='$shortsize'
13105 shrpenv='$shrpenv'
13106 shsharp='$shsharp'
13107 sig_name='$sig_name'
13108 sig_name_init='$sig_name_init'
13109 sig_num='$sig_num'
13110 sig_num_init='$sig_num_init'
13111 signal_t='$signal_t'
13112 sitearch='$sitearch'
13113 sitearchexp='$sitearchexp'
13114 sitelib='$sitelib'
13115 sitelibexp='$sitelibexp'
13116 sizetype='$sizetype'
13117 sleep='$sleep'
13118 smail='$smail'
13119 small='$small'
13120 so='$so'
13121 sockethdr='$sockethdr'
13122 socketlib='$socketlib'
13123 sort='$sort'
13124 spackage='$spackage'
13125 spitshell='$spitshell'
13126 split='$split'
13127 src='$src'
13128 ssizetype='$ssizetype'
13129 startperl='$startperl'
13130 startsh='$startsh'
13131 static_ext='$static_ext'
13132 stdchar='$stdchar'
13133 stdio_base='$stdio_base'
13134 stdio_bufsiz='$stdio_bufsiz'
13135 stdio_cnt='$stdio_cnt'
13136 stdio_filbuf='$stdio_filbuf'
13137 stdio_ptr='$stdio_ptr'
13138 strings='$strings'
13139 submit='$submit'
13140 subversion='$subversion'
13141 sysman='$sysman'
13142 tail='$tail'
13143 tar='$tar'
13144 tbl='$tbl'
13145 tee='$tee'
13146 test='$test'
13147 timeincl='$timeincl'
13148 timetype='$timetype'
13149 touch='$touch'
13150 tr='$tr'
13151 trnl='$trnl'
13152 troff='$troff'
13153 uidtype='$uidtype'
13154 uname='$uname'
13155 uniq='$uniq'
13156 use64bits='$use64bits'
13157 usedl='$usedl'
13158 usemultiplicity='$usemultiplicity'
13159 usemymalloc='$usemymalloc'
13160 usenm='$usenm'
13161 useopcode='$useopcode'
13162 useperlio='$useperlio'
13163 useposix='$useposix'
13164 usesfio='$usesfio'
13165 useshrplib='$useshrplib'
13166 usethreads='$usethreads'
13167 usevfork='$usevfork'
13168 usrinc='$usrinc'
13169 uuname='$uuname'
13170 version='$version'
13171 vi='$vi'
13172 voidflags='$voidflags'
13173 xlibpth='$xlibpth'
13174 zcat='$zcat'
13175 zip='$zip'
13176 EOT
13177
13178 : Add in command line options if available
13179 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
13180
13181 : add special variables
13182 $test -f $src/patchlevel.h && \
13183 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
13184 echo "CONFIG=true" >>config.sh
13185
13186 : propagate old symbols
13187 if $test -f UU/config.sh; then
13188         <UU/config.sh sort | uniq >UU/oldconfig.sh
13189         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
13190         sort | uniq -u >UU/oldsyms
13191         set X `cat UU/oldsyms`
13192         shift
13193         case $# in
13194         0) ;;
13195         *)
13196                 cat <<EOM
13197 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
13198 EOM
13199                 echo "# Variables propagated from previous config.sh file." >>config.sh
13200                 for sym in `cat UU/oldsyms`; do
13201                         echo "    Propagating $hint variable "'$'"$sym..."
13202                         eval 'tmp="$'"${sym}"'"'
13203                         echo "$tmp" | \
13204                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
13205                 done
13206                 ;;
13207         esac
13208 fi
13209
13210 : Finish up by extracting the .SH files
13211 case "$alldone" in
13212 exit)
13213         $rm -rf UU
13214         echo "Done."
13215         exit 0
13216         ;;
13217 cont)
13218         ;;
13219 '')
13220         dflt=''
13221         nostick=true
13222         $cat <<EOM
13223
13224 If you'd like to make any changes to the config.sh file before I begin
13225 to configure things, do it as a shell escape now (e.g. !vi config.sh).
13226
13227 EOM
13228         rp="Press return or use a shell escape to edit config.sh:"
13229         . UU/myread
13230         nostick=''
13231         case "$ans" in
13232         '') ;;
13233         *) : in case they cannot read
13234                 sh 1>&4 -c "$ans";;
13235         esac
13236         ;;
13237 esac
13238
13239 : if this fails, just run all the .SH files by hand
13240 . ./config.sh
13241
13242 echo " "
13243 exec 1>&4
13244 . ./UU/extract
13245
13246 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
13247         dflt=y
13248         case "$silent" in
13249         true) ;;
13250         *)
13251                 $cat <<EOM
13252
13253 Now you need to generate make dependencies by running "$make depend".
13254 You might prefer to run it in background: "$make depend > makedepend.out &"
13255 It can take a while, so you might not want to run it right now.
13256
13257 EOM
13258                 ;;
13259         esac
13260         rp="Run $make depend now?"
13261         . UU/myread
13262         case "$ans" in
13263         y*)
13264                 $make depend && echo "Now you must run a $make."
13265                 ;;
13266         *)
13267                 echo "You must run '$make depend' then '$make'."
13268                 ;;
13269         esac
13270 elif test -f [Mm]akefile; then
13271         echo " "
13272         echo "Now you must run a $make."
13273 else
13274         echo "Done."
13275 fi
13276
13277 if $test -f Policy.sh; then
13278     $cat <<EOM
13279
13280 If you compile $package on a different machine or from a different object
13281 directory, copy the Policy.sh file from this object directory to the
13282 new one before you run Configure -- this will help you with most of
13283 the policy defaults.
13284
13285 EOM
13286 fi
13287 if $test -f config.msg; then
13288     echo "Hmm.  I also noted the following information while running:"
13289     echo " "
13290     $cat config.msg >&4
13291     $rm -f config.msg
13292 fi
13293 $rm -f kit*isdone ark*isdone
13294 $rm -rf UU
13295
13296 : End of Configure
13297