[REPATCH 5.005_61] Re: perldiag.pod omissions
[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 Mon Aug 30 22:33:03 EET DST 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 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 contains=''
302 cpp_stuff=''
303 cpplast=''
304 cppminus=''
305 cpprun=''
306 cppstdin=''
307 crosscompile=''
308 d_access=''
309 d_accessx=''
310 d_alarm=''
311 d_attribut=''
312 d_bcmp=''
313 d_bcopy=''
314 d_bzero=''
315 d_casti32=''
316 castflags=''
317 d_castneg=''
318 d_chown=''
319 d_chroot=''
320 d_chsize=''
321 d_closedir=''
322 d_void_closedir=''
323 d_const=''
324 cryptlib=''
325 d_crypt=''
326 d_csh=''
327 full_csh=''
328 d_cuserid=''
329 d_dbl_dig=''
330 d_difftime=''
331 d_dlerror=''
332 d_dlopen=''
333 d_dlsymun=''
334 d_dosuid=''
335 d_suidsafe=''
336 d_drand48proto=''
337 d_dup2=''
338 d_eaccess=''
339 d_endgrent=''
340 d_endhent=''
341 d_endnent=''
342 d_endpent=''
343 d_endpwent=''
344 d_endsent=''
345 d_endspent=''
346 d_fchmod=''
347 d_fchown=''
348 d_fcntl=''
349 d_fd_macros=''
350 d_fd_set=''
351 d_fds_bits=''
352 d_fgetpos=''
353 d_flexfnam=''
354 d_flock=''
355 d_fork=''
356 d_fseeko=''
357 d_fsetpos=''
358 d_ftello=''
359 d_ftime=''
360 d_gettimeod=''
361 d_Gconvert=''
362 d_getgrent=''
363 d_getgrps=''
364 d_gethbyaddr=''
365 d_gethbyname=''
366 d_gethent=''
367 aphostname=''
368 d_gethname=''
369 d_phostname=''
370 d_uname=''
371 d_gethostprotos=''
372 d_getlogin=''
373 d_getmntent=''
374 d_getnbyaddr=''
375 d_getnbyname=''
376 d_getnent=''
377 d_getnetprotos=''
378 d_getpent=''
379 d_getpgid=''
380 d_getpgrp2=''
381 d_bsdgetpgrp=''
382 d_getpgrp=''
383 d_getppid=''
384 d_getprior=''
385 d_getpbyname=''
386 d_getpbynumber=''
387 d_getprotoprotos=''
388 d_getpwent=''
389 d_getsent=''
390 d_getservprotos=''
391 d_getspent=''
392 d_getspnam=''
393 d_getsbyname=''
394 d_getsbyport=''
395 d_gnulibc=''
396 d_hasmntopt=''
397 d_htonl=''
398 d_inetaton=''
399 d_isascii=''
400 d_killpg=''
401 d_lchown=''
402 d_ldbl_dig=''
403 d_link=''
404 d_locconv=''
405 d_lockf=''
406 d_longdbl=''
407 longdblsize=''
408 d_longlong=''
409 longlongsize=''
410 d_lstat=''
411 d_madvise=''
412 d_mblen=''
413 d_mbstowcs=''
414 d_mbtowc=''
415 d_memchr=''
416 d_memcmp=''
417 d_memcpy=''
418 d_memmove=''
419 d_memset=''
420 d_mkdir=''
421 d_mkfifo=''
422 d_mktime=''
423 d_mmap=''
424 mmaptype=''
425 d_mprotect=''
426 d_msg=''
427 d_msgctl=''
428 d_msgget=''
429 d_msgrcv=''
430 d_msgsnd=''
431 d_msync=''
432 d_munmap=''
433 d_nice=''
434 d_open3=''
435 d_fpathconf=''
436 d_pathconf=''
437 d_pause=''
438 d_pipe=''
439 d_poll=''
440 d_portable=''
441 d_old_pthread_create_joinable=''
442 old_pthread_create_joinable=''
443 d_pthread_yield=''
444 d_sched_yield=''
445 sched_yield=''
446 d_readdir=''
447 d_rewinddir=''
448 d_seekdir=''
449 d_telldir=''
450 d_readlink=''
451 d_readv=''
452 d_rename=''
453 d_rmdir=''
454 d_safebcpy=''
455 d_safemcpy=''
456 d_sanemcmp=''
457 d_select=''
458 d_sem=''
459 d_semctl=''
460 d_semget=''
461 d_semop=''
462 d_setegid=''
463 d_seteuid=''
464 d_setgrent=''
465 d_setgrps=''
466 d_sethent=''
467 d_setlinebuf=''
468 d_setlocale=''
469 d_setnent=''
470 d_setpent=''
471 d_setpgid=''
472 d_setpgrp2=''
473 d_bsdsetpgrp=''
474 d_setpgrp=''
475 d_setprior=''
476 d_setpwent=''
477 d_setregid=''
478 d_setresgid=''
479 d_setresuid=''
480 d_setreuid=''
481 d_setrgid=''
482 d_setruid=''
483 d_setsent=''
484 d_setsid=''
485 d_setspent=''
486 d_setvbuf=''
487 d_sfio=''
488 usesfio=''
489 d_shm=''
490 d_shmat=''
491 d_shmatprototype=''
492 shmattype=''
493 d_shmctl=''
494 d_shmdt=''
495 d_shmget=''
496 d_sigaction=''
497 d_sigsetjmp=''
498 d_cmsghdr_s=''
499 d_msg_ctrunc=''
500 d_msg_dontroute=''
501 d_msg_oob=''
502 d_msg_peek=''
503 d_msg_proxy=''
504 d_msghdr_s=''
505 d_oldsock=''
506 d_recvmsg=''
507 d_scm_rights=''
508 d_sendmsg=''
509 d_socket=''
510 d_sockpair=''
511 sockethdr=''
512 socketlib=''
513 d_statblks=''
514 d_fstatfs=''
515 d_statfs=''
516 d_statfsflags=''
517 d_fstatvfs=''
518 d_statvfs=''
519 d_stdio_cnt_lval=''
520 d_stdio_ptr_lval=''
521 d_stdiobase=''
522 d_stdstdio=''
523 stdio_base=''
524 stdio_bufsiz=''
525 stdio_cnt=''
526 stdio_filbuf=''
527 stdio_ptr=''
528 d_index=''
529 d_strchr=''
530 d_strcoll=''
531 d_strctcpy=''
532 d_strerrm=''
533 d_strerror=''
534 d_sysernlst=''
535 d_syserrlst=''
536 d_strtod=''
537 d_strtol=''
538 d_strtoul=''
539 d_strxfrm=''
540 d_symlink=''
541 d_syscall=''
542 d_sysconf=''
543 d_system=''
544 d_tcgetpgrp=''
545 d_tcsetpgrp=''
546 d_telldirproto=''
547 d_time=''
548 timetype=''
549 clocktype=''
550 d_times=''
551 d_truncate=''
552 d_tzname=''
553 d_umask=''
554 d_semctl_semid_ds=''
555 d_semctl_semun=''
556 d_union_semun=''
557 d_vfork=''
558 usevfork=''
559 d_voidsig=''
560 signal_t=''
561 d_volatile=''
562 d_charvspr=''
563 d_vprintf=''
564 d_wait4=''
565 d_waitpid=''
566 d_wcstombs=''
567 d_wctomb=''
568 d_writev=''
569 dlext=''
570 cccdlflags=''
571 ccdlflags=''
572 dlsrc=''
573 ld=''
574 lddlflags=''
575 usedl=''
576 doublesize=''
577 ebcdic=''
578 fflushNULL=''
579 fflushall=''
580 fpostype=''
581 gidtype=''
582 groupstype=''
583 h_fcntl=''
584 h_sysfile=''
585 i_arpainet=''
586 db_hashtype=''
587 db_prefixtype=''
588 i_db=''
589 i_dbm=''
590 i_rpcsvcdbm=''
591 d_dirnamlen=''
592 direntrytype=''
593 i_dirent=''
594 i_dld=''
595 i_dlfcn=''
596 i_fcntl=''
597 i_float=''
598 i_gdbm=''
599 d_grpasswd=''
600 i_grp=''
601 d_int64t=''
602 i_inttypes=''
603 i_limits=''
604 i_locale=''
605 i_machcthr=''
606 i_malloc=''
607 i_math=''
608 i_memory=''
609 i_mntent=''
610 i_ndbm=''
611 i_netdb=''
612 i_neterrno=''
613 i_netinettcp=''
614 i_niin=''
615 i_sysin=''
616 i_poll=''
617 i_pthread=''
618 d_pwage=''
619 d_pwchange=''
620 d_pwclass=''
621 d_pwcomment=''
622 d_pwexpire=''
623 d_pwgecos=''
624 d_pwpasswd=''
625 d_pwquota=''
626 i_pwd=''
627 i_sfio=''
628 i_shadow=''
629 i_socks=''
630 i_stddef=''
631 i_stdlib=''
632 i_string=''
633 strings=''
634 i_sysaccess=''
635 i_sysdir=''
636 i_sysfile=''
637 d_voidtty=''
638 i_bsdioctl=''
639 i_sysfilio=''
640 i_sysioctl=''
641 i_syssockio=''
642 i_sysmman=''
643 i_sysmount=''
644 i_sysndir=''
645 i_sysparam=''
646 i_sysresrc=''
647 i_syssecrt=''
648 i_sysselct=''
649 i_sysstat=''
650 i_sysstatvfs=''
651 i_systimes=''
652 i_systypes=''
653 d_iovec_s=''
654 i_sysuio=''
655 i_sysun=''
656 i_syswait=''
657 i_sgtty=''
658 i_termio=''
659 i_termios=''
660 i_systime=''
661 i_systimek=''
662 i_time=''
663 timeincl=''
664 i_unistd=''
665 i_utime=''
666 i_values=''
667 i_stdarg=''
668 i_varargs=''
669 i_varhdr=''
670 i_vfork=''
671 installprefix=''
672 installprefixexp=''
673 installstyle=''
674 installusrbinperl=''
675 intsize=''
676 longsize=''
677 shortsize=''
678 d_fpos64_t=''
679 d_llseek=''
680 d_off64_t=''
681 libc=''
682 ldlibpthname=''
683 libperl=''
684 shrpenv=''
685 useshrplib=''
686 glibpth=''
687 libpth=''
688 loclibpth=''
689 plibpth=''
690 xlibpth=''
691 ignore_versioned_solibs=''
692 libs=''
693 lns=''
694 d_PRIEldbl=''
695 d_PRIFldbl=''
696 d_PRIGldbl=''
697 d_PRIeldbl=''
698 d_PRIfldbl=''
699 d_PRIgldbl=''
700 sPRIEldbl=''
701 sPRIFldbl=''
702 sPRIGldbl=''
703 sPRIeldbl=''
704 sPRIfldbl=''
705 sPRIgldbl=''
706 lseeksize=''
707 lseektype=''
708 make_set_make=''
709 d_mymalloc=''
710 freetype=''
711 mallocobj=''
712 mallocsrc=''
713 malloctype=''
714 usemymalloc=''
715 installman1dir=''
716 man1dir=''
717 man1direxp=''
718 man1ext=''
719 installman3dir=''
720 man3dir=''
721 man3direxp=''
722 man3ext=''
723 huge=''
724 large=''
725 medium=''
726 models=''
727 small=''
728 split=''
729 modetype=''
730 multiarch=''
731 mydomain=''
732 myhostname=''
733 phostname=''
734 c=''
735 n=''
736 d_eofnblk=''
737 eagain=''
738 o_nonblock=''
739 rd_nodata=''
740 netdb_hlen_type=''
741 netdb_host_type=''
742 netdb_name_type=''
743 netdb_net_type=''
744 groupcat=''
745 hostcat=''
746 passcat=''
747 orderlib=''
748 ranlib=''
749 package=''
750 spackage=''
751 pager=''
752 apiversion=''
753 patchlevel=''
754 subversion=''
755 version=''
756 perladmin=''
757 perlpath=''
758 pidtype=''
759 prefix=''
760 prefixexp=''
761 installprivlib=''
762 privlib=''
763 privlibexp=''
764 prototype=''
765 ptrsize=''
766 d_PRIX64=''
767 d_PRId64=''
768 d_PRIi64=''
769 d_PRIo64=''
770 d_PRIu64=''
771 d_PRIx64=''
772 sPRIX64=''
773 sPRId64=''
774 sPRIi64=''
775 sPRIo64=''
776 sPRIu64=''
777 sPRIx64=''
778 drand01=''
779 randbits=''
780 randfunc=''
781 randseedtype=''
782 seedfunc=''
783 installscript=''
784 scriptdir=''
785 scriptdirexp=''
786 selectminbits=''
787 selecttype=''
788 sh=''
789 sig_count=''
790 sig_name=''
791 sig_name_init=''
792 sig_num=''
793 sig_num_init=''
794 installsitearch=''
795 sitearch=''
796 sitearchexp=''
797 installsitelib=''
798 sitelib=''
799 sitelibexp=''
800 siteprefix=''
801 siteprefixexp=''
802 sizetype=''
803 so=''
804 sharpbang=''
805 shsharp=''
806 spitshell=''
807 src=''
808 ssizetype=''
809 startperl=''
810 startsh=''
811 stdchar=''
812 d_stdio_stream_array=''
813 stdio_stream_array=''
814 d_strtoull=''
815 sysman=''
816 trnl=''
817 uidtype=''
818 archname64=''
819 use64bits=''
820 uselongdouble=''
821 usemultiplicity=''
822 nm_opt=''
823 nm_so_opt=''
824 runnm=''
825 usenm=''
826 useperlio=''
827 usesocks=''
828 d_oldpthreads=''
829 usethreads=''
830 incpath=''
831 mips=''
832 mips_type=''
833 usrinc=''
834 d_vendorlib=''
835 installvendorlib=''
836 vendorlib=''
837 vendorlibexp=''
838 usevendorprefix=''
839 vendorprefix=''
840 vendorprefixexp=''
841 defvoidused=''
842 voidflags=''
843 CONFIG=''
844
845 define='define'
846 undef='undef'
847 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
848 rmlist=''
849
850 : We must find out about Eunice early
851 eunicefix=':'
852 if test -f /etc/unixtovms; then
853         eunicefix=/etc/unixtovms
854 fi
855 if test -f /etc/unixtovms.exe; then
856         eunicefix=/etc/unixtovms.exe
857 fi
858
859 i_whoami=''
860 : Possible local include directories to search.
861 : Set locincpth to "" in a hint file to defeat local include searches.
862 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
863 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
864 :
865 : no include file wanted by default
866 inclwanted=''
867
868 : list of known cpp symbols, sorted alphabetically
869 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
870 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
871 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
872 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
873 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
874 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
875 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
876 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
877 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
878 al="$al VMS Xenix286"
879 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
880 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
881 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
882 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
883 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
884 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
885 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
886 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
887 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
888 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
889 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
890 al="$al __SVR4_2__ __UMAXV__"
891 al="$al ____386BSD____ __alpha __alpha__ __amiga"
892 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
893 al="$al __host_mips__"
894 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
895 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
896 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
897 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
898 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
899 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
900 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
901 al="$al __mc88100 __mc88100__ __mips __mips__"
902 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
903 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
904 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
905 al="$al _host_mips _mips _unix"
906 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
907 al="$al apollo ardent att386 att3b"
908 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
909 al="$al cadmus clipper concurrent convex cray ctix"
910 al="$al dmert encore gcos gcx gimpel gould"
911 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
912 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
913 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
914 al="$al i186 i286 i386 i486 i8086"
915 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
916 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
917 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
918 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
919 al="$al mc88000 mc88100 merlin mert mips mvs n16"
920 al="$al ncl_el ncl_mr"
921 al="$al news1500 news1700 news1800 news1900 news3700"
922 al="$al news700 news800 news900 ns16000 ns32000"
923 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
924 al="$al parisc pc532 pdp11 plexus posix pyr"
925 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
926 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
927 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
928 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
929 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
930 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
931 al="$al xenix z8000"
932
933 : Trailing extension.  Override this in a hint file, if needed.
934 _exe=''
935 : Extra object files, if any, needed on this platform.
936 archobjs=''
937 groupstype=''
938 : change the next line if compiling for Xenix/286 on Xenix/386
939 xlibpth='/usr/lib/386 /lib/386'
940
941 : Possible local library directories to search.
942 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
943 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
944
945 : general looking path for locating libraries
946 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
947 glibpth="$glibpth /lib /usr/lib $xlibpth"
948 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
949 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
950
951 : Private path used by Configure to find libraries.  Its value
952 : is prepended to libpth. This variable takes care of special
953 : machines, like the mips.  Usually, it should be empty.
954 plibpth=''
955
956 : default library list
957 libswanted=''
958 : some systems want to use only the non-versioned libso:s
959 ignore_versioned_solibs=''
960 : full support for void wanted by default
961 defvoidused=15
962
963 : set useposix=false in your hint file to disable the POSIX extension.
964 useposix=true
965 : set useopcode=false in your hint file to disable the Opcode extension.
966 useopcode=true
967 : set usemultiplicity on the Configure command line to enable multiplicity.
968 : set usesocks on the Configure command line to enable socks.
969 : set usethreads on the Configure command line to enable threads.
970 : List of libraries we want.
971 : If anyone needs -lnet, put it in a hint file.
972 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
973 libswanted="$libswanted dld ld sun m c cposix posix"
974 libswanted="$libswanted ndir dir crypt sec"
975 libswanted="$libswanted ucb bsd BSD PW x"
976 : We probably want to search /usr/shlib before most other libraries.
977 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
978 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
979 glibpth="/usr/shlib $glibpth"
980 : Do not use vfork unless overridden by a hint file.
981 usevfork=false
982
983 : Find the basic shell for Bourne shell scripts
984 case "$sh" in
985 '')
986         case "$SYSTYPE" in
987         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
988         *) xxx='/bin/sh';;
989         esac
990         if test -f "$xxx"; then
991                 sh="$xxx"
992         else
993                 : Build up a list and do a single loop so we can 'break' out.
994                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
995                 for xxx in sh bash ksh pdksh ash; do
996                         for p in $pth; do
997                                 try="$try ${p}/${xxx}"
998                         done
999                 done
1000                 for xxx in $try; do
1001                         if test -f "$xxx"; then
1002                                 sh="$xxx";
1003                                 break
1004                         elif test -f "$xxx.exe"; then
1005                                 sh="$xxx";
1006                                 break
1007                         fi
1008                 done
1009         fi
1010         ;;
1011 esac
1012
1013 case "$sh" in
1014 '')     cat <<EOM >&2
1015 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1016
1017 Usually it's in /bin/sh.  How did you even get this far?
1018 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1019 we'll try to straighten this all out.
1020 EOM
1021         exit 1
1022         ;;
1023 esac
1024
1025 : see if sh knows # comments
1026 if `$sh -c '#' >/dev/null 2>&1`; then
1027         shsharp=true
1028         spitshell=cat
1029         xcat=/bin/cat
1030         test -f $xcat || xcat=/usr/bin/cat
1031         echo "#!$xcat" >try
1032         $eunicefix try
1033         chmod +x try
1034         ./try > today
1035         if test -s today; then
1036                 sharpbang='#!'
1037         else
1038                 echo "#! $xcat" > try
1039                 $eunicefix try
1040                 chmod +x try
1041                 ./try > today
1042                 if test -s today; then
1043                         sharpbang='#! '
1044                 else
1045                         sharpbang=': use '
1046                 fi
1047         fi
1048 else
1049         echo " "
1050         echo "Your $sh doesn't grok # comments--I will strip them later on."
1051         shsharp=false
1052         cd ..
1053         echo "exec grep -v '^[  ]*#'" >spitshell
1054         chmod +x spitshell
1055         $eunicefix spitshell
1056         spitshell=`pwd`/spitshell
1057         cd UU
1058         echo "I presume that if # doesn't work, #! won't work either!"
1059         sharpbang=': use '
1060 fi
1061 rm -f try today
1062
1063 : figure out how to guarantee sh startup
1064 case "$startsh" in
1065 '') startsh=${sharpbang}${sh} ;;
1066 *)
1067 esac
1068 cat >try <<EOSS
1069 $startsh
1070 set abc
1071 test "$?abc" != 1
1072 EOSS
1073
1074 chmod +x try
1075 $eunicefix try
1076 if ./try; then
1077         : echo "Yup, it does."
1078 else
1079         echo "Hmm... '$startsh' does not guarantee sh startup..."
1080         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1081 fi
1082 rm -f try
1083
1084
1085 : Save command line options in file UU/cmdline.opt for later use in
1086 : generating config.sh.
1087 cat > cmdline.opt <<EOSH
1088 # Configure command line arguments.
1089 config_arg0='$0'
1090 config_args='$*'
1091 config_argc=$#
1092 EOSH
1093 argn=1
1094 for arg in "$@"; do
1095         cat >>cmdline.opt <<EOSH
1096 config_arg$argn='$arg'
1097 EOSH
1098         argn=`expr $argn + 1`
1099 done
1100
1101 : produce awk script to parse command line options
1102 cat >options.awk <<'EOF'
1103 BEGIN {
1104         optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
1105
1106         len = length(optstr);
1107         for (i = 1; i <= len; i++) {
1108                 c = substr(optstr, i, 1);
1109                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1110                 if (a == ":") {
1111                         arg[c] = 1;
1112                         i++;
1113                 }
1114                 opt[c] = 1;
1115         }
1116 }
1117 {
1118         expect = 0;
1119         str = $0;
1120         if (substr(str, 1, 1) != "-") {
1121                 printf("'%s'\n", str);
1122                 next;
1123         }
1124         len = length($0);
1125         for (i = 2; i <= len; i++) {
1126                 c = substr(str, i, 1);
1127                 if (!opt[c]) {
1128                         printf("-%s\n", substr(str, i));
1129                         next;
1130                 }
1131                 printf("-%s\n", c);
1132                 if (arg[c]) {
1133                         if (i < len)
1134                                 printf("'%s'\n", substr(str, i + 1));
1135                         else
1136                                 expect = 1;
1137                         next;
1138                 }
1139         }
1140 }
1141 END {
1142         if (expect)
1143                 print "?";
1144 }
1145 EOF
1146
1147 : process the command line options
1148 set X `for arg in "$@"; do echo "X$arg"; done |
1149         sed -e s/X// | awk -f options.awk`
1150 eval "set $*"
1151 shift
1152 rm -f options.awk
1153
1154 : set up default values
1155 fastread=''
1156 reuseval=false
1157 config_sh=''
1158 alldone=''
1159 error=''
1160 silent=''
1161 extractsh=''
1162 override=''
1163 knowitall=''
1164 rm -f optdef.sh
1165 cat >optdef.sh <<EOS
1166 $startsh
1167 EOS
1168
1169
1170 : option parsing
1171 while test $# -gt 0; do
1172         case "$1" in
1173         -d) shift; fastread=yes;;
1174         -e) shift; alldone=cont;;
1175         -f)
1176                 shift
1177                 cd ..
1178                 if test -r "$1"; then
1179                         config_sh="$1"
1180                 else
1181                         echo "$me: cannot read config file $1." >&2
1182                         error=true
1183                 fi
1184                 cd UU
1185                 shift;;
1186         -h) shift; error=true;;
1187         -r) shift; reuseval=true;;
1188         -s) shift; silent=true; realsilent=true;;
1189         -E) shift; alldone=exit;;
1190         -K) shift; knowitall=true;;
1191         -O) shift; override=true;;
1192         -S) shift; silent=true; extractsh=true;;
1193         -D)
1194                 shift
1195                 case "$1" in
1196                 *=)
1197                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1198                         echo "$me: ignoring -D $1" >&2
1199                         ;;
1200                 *=*) echo "$1" | \
1201                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1202                 *) echo "$1='define'" >> optdef.sh;;
1203                 esac
1204                 shift
1205                 ;;
1206         -U)
1207                 shift
1208                 case "$1" in
1209                 *=) echo "$1" >> optdef.sh;;
1210                 *=*)
1211                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1212                         echo "$me: ignoring -U $1" >&2
1213                         ;;
1214                 *) echo "$1='undef'" >> optdef.sh;;
1215                 esac
1216                 shift
1217                 ;;
1218         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1219                 exit 0;;
1220         --) break;;
1221         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1222         *) break;;
1223         esac
1224 done
1225
1226 case "$error" in
1227 true)
1228         cat >&2 <<EOM
1229 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1230                  [-U symbol] [-U symbol=]
1231   -d : use defaults for all answers.
1232   -e : go on without questioning past the production of config.sh.
1233   -f : specify an alternate default configuration file.
1234   -h : print this help message and exit (with an error status).
1235   -r : reuse C symbols value if possible (skips costly nm extraction).
1236   -s : silent mode, only echoes questions and essential information.
1237   -D : define symbol to have some value:
1238          -D symbol         symbol gets the value 'define'
1239          -D symbol=value   symbol gets the value 'value'
1240   -E : stop at the end of questions, after having produced config.sh.
1241   -K : do not use unless you know what you are doing.
1242   -O : let -D and -U override definitions from loaded configuration file.
1243   -S : perform variable substitutions on all .SH files (can mix with -f)
1244   -U : undefine symbol:
1245          -U symbol    symbol gets the value 'undef'
1246          -U symbol=   symbol gets completely empty
1247   -V : print version number and exit (with a zero status).
1248 EOM
1249         exit 1
1250         ;;
1251 esac
1252
1253 : Sanity checks
1254 case "$fastread$alldone" in
1255 yescont|yesexit) ;;
1256 *)
1257         if test ! -t 0; then
1258                 echo "Say 'sh Configure', not 'sh <Configure'"
1259                 exit 1
1260         fi
1261         ;;
1262 esac
1263
1264 exec 4>&1
1265 case "$silent" in
1266 true) exec 1>/dev/null;;
1267 esac
1268
1269 : run the defines and the undefines, if any, but leave the file out there...
1270 touch optdef.sh
1271 . ./optdef.sh
1272
1273 : set package name
1274 package=perl5
1275 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1276 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1277 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1278 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1279 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1280 esac
1281
1282 : Some greps do not return status, grrr.
1283 echo "grimblepritz" >grimble
1284 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1285         contains=contains
1286 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1287         contains=grep
1288 else
1289         contains=contains
1290 fi
1291 rm -f grimble
1292 : the following should work in any shell
1293 case "$contains" in
1294 contains*)
1295         echo " "
1296         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1297         cat >contains <<'EOSS'
1298 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1299 EOSS
1300 chmod +x contains
1301 esac
1302
1303 : Find the path to the source tree
1304 case "$src" in
1305 '') case "$0" in
1306     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1307          case "$src" in
1308          /*)    ;;
1309          *)     src=`cd ../$src && pwd` ;;
1310          esac
1311          ;;
1312     *)   src='.';;
1313     esac;;
1314 esac
1315 case "$src" in
1316 '')     src=/
1317         rsrc=/
1318         ;;
1319 /*) rsrc="$src";;
1320 *) rsrc="../$src";;
1321 esac
1322 if test -f $rsrc/Configure && \
1323         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1324 then
1325    : found it, so we are ok.
1326 else
1327         rsrc=''
1328         for src in . .. ../.. ../../.. ../../../..; do
1329                 if test -f ../$src/Configure && \
1330                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1331                 then
1332                         rsrc=../$src
1333                         break
1334                 fi
1335         done
1336 fi
1337 case "$rsrc" in
1338 '')
1339         cat <<EOM >&4
1340
1341 Sorry, I can't seem to locate the source dir for $package.  Please start
1342 Configure with an explicit path -- i.e. /some/path/Configure.
1343
1344 EOM
1345         exit 1
1346         ;;
1347 ../.)   rsrc='..';;
1348 *)
1349         echo " "
1350         echo "Sources for $package found in \"$src\"." >&4
1351         ;;
1352 esac
1353
1354 : script used to extract .SH files with variable substitutions
1355 cat >extract <<'EOS'
1356 CONFIGDOTSH=true
1357 echo "Doing variable substitutions on .SH files..."
1358 if test -f $src/MANIFEST; then
1359         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1360 else
1361         echo "(Looking for .SH files under the source directory.)"
1362         set x `(cd $src; find . -name "*.SH" -print)`
1363 fi
1364 shift
1365 case $# in
1366 0) set x `(cd $src; echo *.SH)`; shift;;
1367 esac
1368 if test ! -f $src/$1; then
1369         shift
1370 fi
1371 mkdir_p='
1372 name=$1;
1373 create="";
1374 while test $name; do
1375         if test ! -d "$name"; then
1376                 create="$name $create";
1377                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1378                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1379         else
1380                 name="";
1381         fi;
1382 done;
1383 for file in $create; do
1384         mkdir $file;
1385 done
1386 '
1387 for file in $*; do
1388         case "$src" in
1389         ".")
1390                 case "$file" in
1391                 */*)
1392                         dir=`expr X$file : 'X\(.*\)/'`
1393                         file=`expr X$file : 'X.*/\(.*\)'`
1394                         (cd $dir && . ./$file)
1395                         ;;
1396                 *)
1397                         . ./$file
1398                         ;;
1399                 esac
1400                 ;;
1401         *)
1402                 case "$file" in
1403                 */*)
1404                         dir=`expr X$file : 'X\(.*\)/'`
1405                         file=`expr X$file : 'X.*/\(.*\)'`
1406                         (set x $dir; shift; eval $mkdir_p)
1407                         sh <$src/$dir/$file
1408                         ;;
1409                 *)
1410                         sh <$src/$file
1411                         ;;
1412                 esac
1413                 ;;
1414         esac
1415 done
1416 if test -f $src/config_h.SH; then
1417         if test ! -f config.h; then
1418         : oops, they left it out of MANIFEST, probably, so do it anyway.
1419         . $src/config_h.SH
1420         fi
1421 fi
1422 EOS
1423
1424 : extract files and exit if asked to do so
1425 case "$extractsh" in
1426 true)
1427         case "$realsilent" in
1428         true) ;;
1429         *) exec 1>&4;;
1430         esac
1431         case "$config_sh" in
1432         '') config_sh='config.sh';;
1433         esac
1434         echo " "
1435         echo "Fetching answers from $config_sh..."
1436         cd ..
1437         . $config_sh
1438         test "$override" && . ./optdef.sh
1439         echo " "
1440         . UU/extract
1441         rm -rf UU
1442         echo "Done."
1443         exit 0
1444         ;;
1445 esac
1446
1447 : Eunice requires " " instead of "", can you believe it
1448 echo " "
1449 : Here we go...
1450 echo "Beginning of configuration questions for $package."
1451
1452 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1453
1454 : first determine how to suppress newline on echo command
1455 echo " "
1456 echo "Checking echo to see how to suppress newlines..."
1457 (echo "hi there\c" ; echo " ") >.echotmp
1458 if $contains c .echotmp >/dev/null 2>&1 ; then
1459         echo "...using -n."
1460         n='-n'
1461         c=''
1462 else
1463         cat <<'EOM'
1464 ...using \c
1465 EOM
1466         n=''
1467         c='\c'
1468 fi
1469 echo $n "The star should be here-->$c"
1470 echo '*'
1471 rm -f .echotmp
1472
1473 : Now test for existence of everything in MANIFEST
1474 echo " "
1475 if test -f $rsrc/MANIFEST; then
1476         echo "First let's make sure your kit is complete.  Checking..." >&4
1477         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1478         rm -f missing
1479         tmppwd=`pwd`
1480         for filelist in x??; do
1481                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1482         done
1483         if test -s missing; then
1484                 cat missing >&4
1485                 cat >&4 <<'EOM'
1486
1487 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1488
1489 You have the option of continuing the configuration process, despite the
1490 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1491 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1492 and contact the author (perlbug@perl.com).
1493
1494 EOM
1495                 echo $n "Continue? [n] $c" >&4
1496                 read ans
1497                 case "$ans" in
1498                 y*)
1499                         echo "Continuing..." >&4
1500                         rm -f missing
1501                         ;;
1502                 *)
1503                         echo "ABORTING..." >&4
1504                         kill $$
1505                         ;;
1506                 esac
1507         else
1508                 echo "Looks good..."
1509         fi
1510 else
1511         echo "There is no MANIFEST file.  I hope your kit is complete !"
1512 fi
1513 rm -f missing x??
1514
1515 echo " "
1516 : Find the appropriate value for a newline for tr
1517 if test -n "$DJGPP"; then
1518        trnl='\012'
1519 fi
1520 if test X"$trnl" = X; then
1521         case "`echo foo|tr '\n' x 2>/dev/null`" in
1522         foox) trnl='\n' ;;
1523         esac
1524 fi
1525 if test X"$trnl" = X; then
1526         case "`echo foo|tr '\012' x 2>/dev/null`" in
1527         foox) trnl='\012' ;;
1528         esac
1529 fi
1530 if test X"$trnl" = X; then
1531         cat <<EOM >&2
1532
1533 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1534
1535 EOM
1536         exit 1
1537 fi
1538
1539 : compute the number of columns on the terminal for proper question formatting
1540 case "$COLUMNS" in
1541 '') COLUMNS='80';;
1542 esac
1543
1544 : set up the echo used in my read
1545 myecho="case \"\$xxxm\" in
1546 '') echo $n \"\$rp $c\" >&4;;
1547 *) case \"\$rp\" in
1548         '') echo $n \"[\$xxxm] $c\";;
1549         *)
1550                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1551                         echo \"\$rp\" >&4
1552                         echo $n \"[\$xxxm] $c\" >&4
1553                 else
1554                         echo $n \"\$rp [\$xxxm] $c\" >&4
1555                 fi
1556                 ;;
1557         esac;;
1558 esac"
1559
1560 : now set up to do reads with possible shell escape and default assignment
1561 cat <<EOSC >myread
1562 $startsh
1563 xxxm=\$dflt
1564 $myecho
1565 ans='!'
1566 case "\$fastread" in
1567 yes) case "\$dflt" in
1568         '') ;;
1569         *) ans='';
1570                 case "\$silent-\$rp" in
1571                 true-) ;;
1572                 *) echo " " >&4;;
1573                 esac;;
1574         esac;;
1575 *) case "\$silent" in
1576         true) case "\$rp" in
1577                 '') ans='';;
1578                 esac;;
1579         esac;;
1580 esac
1581 while expr "X\$ans" : "X!" >/dev/null; do
1582         read answ
1583         set x \$xxxm
1584         shift
1585         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1586         case  "\$answ" in
1587         "!")
1588                 sh 1>&4
1589                 echo " "
1590                 $myecho
1591                 ;;
1592         !*)
1593                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1594                 shift
1595                 sh 1>&4 -c "\$*"
1596                 echo " "
1597                 $myecho
1598                 ;;
1599         "\$ans")
1600                 case "\$ans" in
1601                 \\&*)
1602                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1603                         shift
1604                         case "\$1" in
1605                         -d)
1606                                 fastread=yes
1607                                 echo "(OK, I'll run with -d after this question.)" >&4
1608                                 ;;
1609                         -*)
1610                                 echo "*** Sorry, \$1 not supported yet." >&4
1611                                 ;;
1612                         esac
1613                         $myecho
1614                         ans=!
1615                         ;;
1616                 esac;;
1617         *)
1618                 case "\$aok" in
1619                 y)
1620                         echo "*** Substitution done -- please confirm."
1621                         xxxm="\$ans"
1622                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1623                         xxxm="\$ans"
1624                         ans=!
1625                         ;;
1626                 *)
1627                         echo "*** Error -- try again."
1628                         ans=!
1629                         ;;
1630                 esac
1631                 $myecho
1632                 ;;
1633         esac
1634         case "\$ans\$xxxm\$nostick" in
1635         '')
1636                 ans=!
1637                 $myecho
1638                 ;;
1639         esac
1640 done
1641 case "\$ans" in
1642 '') ans="\$xxxm";;
1643 esac
1644 EOSC
1645
1646 : create .config dir to save info across Configure sessions
1647 test -d ../.config || mkdir ../.config
1648 cat >../.config/README <<EOF
1649 This directory created by Configure to save information that should
1650 persist across sessions for $package.
1651
1652 You may safely delete it if you wish.
1653 EOF
1654
1655 : general instructions
1656 needman=true
1657 firsttime=true
1658 user=`(logname) 2>/dev/null`
1659 case "$user" in
1660 '') user=`whoami 2>&1`;;
1661 esac
1662 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1663         firsttime=false
1664         echo " "
1665         rp='Would you like to see the instructions?'
1666         dflt=n
1667         . ./myread
1668         case "$ans" in
1669         [yY]*) ;;
1670         *) needman=false;;
1671         esac
1672 fi
1673 if $needman; then
1674         cat <<EOH
1675
1676 This installation shell script will examine your system and ask you questions
1677 to determine how the perl5 package should be installed. If you get
1678 stuck on a question, you may use a ! shell escape to start a subshell or
1679 execute a command.  Many of the questions will have default answers in square
1680 brackets; typing carriage return will give you the default.
1681
1682 On some of the questions which ask for file or directory names you are allowed
1683 to use the ~name construct to specify the login directory belonging to "name",
1684 even if you don't have a shell which knows about that.  Questions where this is
1685 allowed will be marked "(~name ok)".
1686
1687 EOH
1688         rp=''
1689         dflt='Type carriage return to continue'
1690         . ./myread
1691         cat <<'EOH'
1692
1693 The prompter used in this script allows you to use shell variables and
1694 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1695 in the default answer, as if the default line was a set of arguments given to a
1696 script shell.  This means you may also use $* to repeat the whole default line,
1697 so you do not have to re-type everything to add something to the default.
1698
1699 Everytime there is a substitution, you will have to confirm.  If there is an
1700 error (e.g. an unmatched backtick), the default answer will remain unchanged
1701 and you will be prompted again.
1702
1703 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1704 the questions and use the computed defaults (or the previous answers if there
1705 was already a config.sh file). Type 'Configure -h' for a list of options.
1706 You may also start interactively and then answer '& -d' at any prompt to turn
1707 on the non-interactive behaviour for the remainder of the execution.
1708
1709 EOH
1710         . ./myread
1711         cat <<EOH
1712
1713 Much effort has been expended to ensure that this shell script will run on any
1714 Unix system.  If despite that it blows up on yours, your best bet is to edit
1715 Configure and run it again.  If you can't run Configure for some reason,
1716 you'll have to generate a config.sh file by hand.  Whatever problems you
1717 have, let me (perlbug@perl.com) know how I blew it.
1718
1719 This installation script affects things in two ways:
1720
1721 1) it may do direct variable substitutions on some of the files included
1722    in this kit.
1723 2) it builds a config.h file for inclusion in C programs.  You may edit
1724    any of these files as the need arises after running this script.
1725
1726 If you make a mistake on a question, there is no easy way to back up to it
1727 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1728 files.  Configure will offer to let you do this before it runs the SH files.
1729
1730 EOH
1731         dflt='Type carriage return to continue'
1732         . ./myread
1733         case "$firsttime" in
1734         true) echo $user >>../.config/instruct;;
1735         esac
1736 fi
1737
1738 : find out where common programs are
1739 echo " "
1740 echo "Locating common programs..." >&4
1741 cat <<EOSC >loc
1742 $startsh
1743 case \$# in
1744 0) exit 1;;
1745 esac
1746 thing=\$1
1747 shift
1748 dflt=\$1
1749 shift
1750 for dir in \$*; do
1751         case "\$thing" in
1752         .)
1753         if test -d \$dir/\$thing; then
1754                 echo \$dir
1755                 exit 0
1756         fi
1757         ;;
1758         *)
1759         for thisthing in \$dir/\$thing; do
1760                 : just loop through to pick last item
1761         done
1762         if test -f \$thisthing; then
1763                 echo \$thisthing
1764                 exit 0
1765         elif test -f \$dir/\$thing.exe; then
1766                 if test -n "$DJGPP"; then
1767                         echo \$dir/\$thing.exe
1768                 else
1769                         : on Eunice apparently
1770                         echo \$dir/\$thing
1771                 fi
1772                 exit 0
1773         fi
1774         ;;
1775         esac
1776 done
1777 echo \$dflt
1778 exit 1
1779 EOSC
1780 chmod +x loc
1781 $eunicefix loc
1782 loclist="
1783 awk
1784 cat
1785 comm
1786 cp
1787 echo
1788 expr
1789 grep
1790 ls
1791 make
1792 mkdir
1793 rm
1794 sed
1795 sort
1796 touch
1797 tr
1798 uniq
1799 "
1800 trylist="
1801 Mcc
1802 ar
1803 byacc
1804 cpp
1805 csh
1806 date
1807 egrep
1808 gzip
1809 less
1810 ln
1811 more
1812 nm
1813 nroff
1814 pg
1815 test
1816 uname
1817 zip
1818 "
1819 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1820 pth="$pth /lib /usr/lib"
1821 for file in $loclist; do
1822         eval xxx=\$$file
1823         case "$xxx" in
1824         /*|?:[\\/]*)
1825                 if test -f "$xxx"; then
1826                         : ok
1827                 else
1828                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1829                         xxx=`./loc $file $file $pth`
1830                 fi
1831                 ;;
1832         '') xxx=`./loc $file $file $pth`;;
1833         *) xxx=`./loc $xxx $xxx $pth`;;
1834         esac
1835         eval $file=$xxx
1836         eval _$file=$xxx
1837         case "$xxx" in
1838         /*)
1839                 echo $file is in $xxx.
1840                 ;;
1841         ?:[\\/]*)
1842                 echo $file is in $xxx.
1843                 ;;
1844         *)
1845                 echo "I don't know where '$file' is, and my life depends on it." >&4
1846                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1847                 exit 1
1848                 ;;
1849         esac
1850 done
1851 echo " "
1852 echo "Don't worry if any of the following aren't found..."
1853 say=offhand
1854 for file in $trylist; do
1855         eval xxx=\$$file
1856         case "$xxx" in
1857         /*|?:[\\/]*)
1858                 if test -f "$xxx"; then
1859                         : ok
1860                 else
1861                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1862                         xxx=`./loc $file $file $pth`
1863                 fi
1864                 ;;
1865         '') xxx=`./loc $file $file $pth`;;
1866         *) xxx=`./loc $xxx $xxx $pth`;;
1867         esac
1868         eval $file=$xxx
1869         eval _$file=$xxx
1870         case "$xxx" in
1871         /*)
1872                 echo $file is in $xxx.
1873                 ;;
1874         ?:[\\/]*)
1875                 echo $file is in $xxx.
1876                 ;;
1877         *)
1878                 echo "I don't see $file out there, $say."
1879                 say=either
1880                 ;;
1881         esac
1882 done
1883 case "$egrep" in
1884 egrep)
1885         echo "Substituting grep for egrep."
1886         egrep=$grep
1887         ;;
1888 esac
1889 case "$ln" in
1890 ln)
1891         echo "Substituting cp for ln."
1892         ln=$cp
1893         ;;
1894 esac
1895 case "$test" in
1896 test)
1897         echo "Hopefully test is built into your sh."
1898         ;;
1899 *)
1900         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1901                 echo "Using the test built into your sh."
1902                 test=test
1903                 _test=test
1904         fi
1905         ;;
1906 esac
1907 case "$echo" in
1908 echo)
1909         echo "Hopefully echo is built into your sh."
1910         ;;
1911 '') ;;
1912 *)
1913         echo " "
1914 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1915         $echo $n "hi there$c" >foo1
1916         echo $n "hi there$c" >foo2
1917         if cmp foo1 foo2 >/dev/null 2>&1; then
1918                 echo "They are compatible.  In fact, they may be identical."
1919         else
1920                 case "$n" in
1921                 '-n') n='' c='\c';;
1922                 *) n='-n' c='';;
1923                 esac
1924                 cat <<FOO
1925 They are not compatible!  You are probably running ksh on a non-USG system.
1926 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1927 have echo built in and we may have to run some Bourne shell scripts.  That
1928 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1929
1930 FOO
1931                 $echo $n "The star should be here-->$c"
1932                 $echo "*"
1933         fi
1934         $rm -f foo1 foo2
1935         ;;
1936 esac
1937
1938 : determine whether symbolic links are supported
1939 echo " "
1940 $touch blurfl
1941 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1942         echo "Symbolic links are supported." >&4
1943         lns="$ln -s"
1944 else
1945         echo "Symbolic links are NOT supported." >&4
1946         lns="$ln"
1947 fi
1948 $rm -f blurfl sym
1949
1950 : see whether [:lower:] and [:upper:] are supported character classes
1951 echo " "
1952 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1953 ABYZ)
1954         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1955         up='[:upper:]'
1956         low='[:lower:]'
1957         ;;
1958 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
1959         # (0xc9 and 0xd1), therefore that is a nice testing point.
1960         if test "X$up" = X -o "X$low" = X; then
1961             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
1962             ij) up='[A-Z]'
1963                 low='[a-z]'
1964                 ;;
1965             esac
1966         fi
1967         if test "X$up" = X -o "X$low" = X; then
1968             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
1969             ij) up='A-Z'
1970                 low='a-z'
1971                 ;;
1972             esac
1973         fi
1974         if test "X$up" = X -o "X$low" = X; then
1975             case "`echo IJ | od -x 2>/dev/null`" in
1976             *C9D1*|*c9d1*)
1977                 echo "Hey, this might be EBCDIC." >&4
1978                 if test "X$up" = X -o "X$low" = X; then
1979                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
1980                     ij) up='[A-IJ-RS-Z]'
1981                         low='[a-ij-rs-z]'
1982                         ;;
1983                     esac
1984                 fi
1985                 if test "X$up" = X -o "X$low" = X; then
1986                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
1987                     ij) up='A-IJ-RS-Z'
1988                         low='a-ij-rs-z'
1989                         ;;
1990                     esac
1991                 fi
1992                 ;;
1993             esac
1994         fi
1995 esac
1996 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
1997 ij)
1998     echo "Using $up and $low to convert case." >&4
1999     ;;
2000 *)
2001     echo "I don't know how to translate letters from upper to lower case." >&4
2002     echo "Your tr is not acting any way I know of." >&4
2003     exit 1
2004     ;;
2005 esac
2006 : set up the translation script tr, must be called with ./tr of course
2007 cat >tr <<EOSC
2008 $startsh
2009 case "\$1\$2" in
2010 '[A-Z][a-z]') exec $tr '$up' '$low';;
2011 '[a-z][A-Z]') exec $tr '$low' '$up';;
2012 esac
2013 exec $tr "\$@"
2014 EOSC
2015 chmod +x tr
2016 $eunicefix tr
2017
2018 : Try to determine whether config.sh was made on this system
2019 case "$config_sh" in
2020 '')
2021 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2022 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2023 # because the A-Z/a-z are not consecutive.
2024 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2025         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2026 newmyuname="$myuname"
2027 dflt=n
2028 case "$knowitall" in
2029 '')
2030         if test -f ../config.sh; then
2031                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2032                         eval "`grep myuname= ../config.sh`"
2033                 fi
2034                 if test "X$myuname" = "X$newmyuname"; then
2035                         dflt=y
2036                 fi
2037         fi
2038         ;;
2039 *) dflt=y;;
2040 esac
2041
2042 : Get old answers from old config file if Configure was run on the
2043 : same system, otherwise use the hints.
2044 hint=default
2045 cd ..
2046 if test -f config.sh; then
2047         echo " "
2048         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2049         . UU/myread
2050         case "$ans" in
2051         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2052         *)  echo "Fetching default answers from your old config.sh file..." >&4
2053                 tmp_n="$n"
2054                 tmp_c="$c"
2055                 tmp_sh="$sh"
2056                 . ./config.sh
2057                 cp config.sh UU
2058                 n="$tmp_n"
2059                 c="$tmp_c"
2060                 : Older versions did not always set $sh.  Catch re-use of such
2061                 : an old config.sh.
2062                 case "$sh" in
2063                 '') sh="$tmp_sh" ;;
2064                 esac
2065                 hint=previous
2066                 ;;
2067         esac
2068 fi
2069 if test ! -f config.sh; then
2070         $cat <<EOM
2071
2072 First time through, eh?  I have some defaults handy for some systems
2073 that need some extra help getting the Configure answers right:
2074
2075 EOM
2076         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2077         dflt=''
2078         : Half the following guesses are probably wrong... If you have better
2079         : tests or hints, please send them to perlbug@perl.com
2080         : The metaconfig authors would also appreciate a copy...
2081         $test -f /irix && osname=irix
2082         $test -f /xenix && osname=sco_xenix
2083         $test -f /dynix && osname=dynix
2084         $test -f /dnix && osname=dnix
2085         $test -f /lynx.os && osname=lynxos
2086         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2087         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2088         $test -f /bin/mips && /bin/mips && osname=mips
2089         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2090                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2091         $test -d /usr/apollo/bin && osname=apollo
2092         $test -f /etc/saf/_sactab && osname=svr4
2093         $test -d /usr/include/minix && osname=minix
2094         if $test -d /MachTen -o -d /MachTen_Folder; then
2095                 osname=machten
2096                 if $test -x /sbin/version; then
2097                         osvers=`/sbin/version | $awk '{print $2}' |
2098                         $sed -e 's/[A-Za-z]$//'`
2099                 elif $test -x /usr/etc/version; then
2100                         osvers=`/usr/etc/version | $awk '{print $2}' |
2101                         $sed -e 's/[A-Za-z]$//'`
2102                 else
2103                         osvers="$2.$3"
2104                 fi
2105         fi
2106        $test -f /sys/posix.dll &&
2107                $test -f /usr/bin/what &&
2108                set X `/usr/bin/what /sys/posix.dll` &&
2109                $test "$3" = UWIN &&
2110                osname=uwin &&
2111                osvers="$5"
2112         if $test -f $uname; then
2113                 set X $myuname
2114                 shift
2115
2116                 case "$5" in
2117                 fps*) osname=fps ;;
2118                 mips*)
2119                         case "$4" in
2120                         umips) osname=umips ;;
2121                         *) osname=mips ;;
2122                         esac;;
2123                 [23]100) osname=mips ;;
2124                 next*) osname=next ;;
2125                 i386*)
2126                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2127                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2128                                 osname='sco'
2129                                 osvers=$tmp
2130                         elif $test -f /etc/kconfig; then
2131                                 osname=isc
2132                                 if test "$lns" = "$ln -s"; then
2133                                         osvers=4
2134                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2135                                         osvers=3
2136                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2137                                         osvers=2
2138                                 fi
2139                         fi
2140                         tmp=''
2141                         ;;
2142                 pc*)
2143                         if test -n "$DJGPP"; then
2144                                 osname=dos
2145                                 osvers=djgpp
2146                         fi
2147                         ;;
2148                 esac
2149
2150                 case "$1" in
2151                 aix) osname=aix
2152                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2153                         case "$tmp" in
2154                         'not found') osvers="$4"."$3" ;;
2155                         '<3240'|'<>3240') osvers=3.2.0 ;;
2156                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2157                         '=3250'|'>3250') osvers=3.2.5 ;;
2158                         *) osvers=$tmp;;
2159                         esac
2160                         ;;
2161                 *dc.osx) osname=dcosx
2162                         osvers="$3"
2163                         ;;
2164                 dnix) osname=dnix
2165                         osvers="$3"
2166                         ;;
2167                 domainos) osname=apollo
2168                         osvers="$3"
2169                         ;;
2170                 dgux) osname=dgux 
2171                         osvers="$3"
2172                         ;;
2173                 dynixptx*) osname=dynixptx
2174                         osvers=`echo "$4"|sed 's/^v//'`
2175                         ;;
2176                 freebsd) osname=freebsd 
2177                         osvers="$3" ;;
2178                 genix) osname=genix ;;
2179                 hp*) osname=hpux 
2180                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2181                         ;;
2182                 irix*) osname=irix
2183                         case "$3" in
2184                         4*) osvers=4 ;;
2185                         5*) osvers=5 ;;
2186                         *)      osvers="$3" ;;
2187                         esac
2188                         ;;
2189                 linux) osname=linux
2190                         case "$3" in
2191                         *)      osvers="$3" ;;
2192                         esac
2193                         ;;
2194                 MiNT) osname=mint
2195                         ;;
2196                 netbsd*) osname=netbsd
2197                         osvers="$3"
2198                         ;;
2199                 news-os) osvers="$3"
2200                         case "$3" in
2201                         4*) osname=newsos4 ;;
2202                         *) osname=newsos ;;
2203                         esac
2204                         ;;
2205                 bsd386) osname=bsd386
2206                         osvers=`$uname -r`
2207                         ;;
2208                 POSIX-BC | posix-bc ) osname=posix-bc
2209                         osvers="$3"
2210                         ;;
2211                 powerux | power_ux | powermax_os | powermaxos | \
2212                 powerunix | power_unix) osname=powerux
2213                         osvers="$3"
2214                         ;;
2215                 next*) osname=next ;;
2216                 solaris) osname=solaris
2217                         case "$3" in
2218                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2219                         *)      osvers="$3" ;;
2220                         esac
2221                         ;;
2222                 sunos) osname=sunos
2223                         case "$3" in
2224                         5*) osname=solaris
2225                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2226                         *)      osvers="$3" ;;
2227                         esac
2228                         ;;
2229                 titanos) osname=titanos
2230                         case "$3" in
2231                         1*) osvers=1 ;;
2232                         2*) osvers=2 ;;
2233                         3*) osvers=3 ;;
2234                         4*) osvers=4 ;;
2235                         *)      osvers="$3" ;;
2236                         esac
2237                         ;;
2238                 ultrix) osname=ultrix
2239                         osvers="$3"
2240                         ;;
2241                 osf1|mls+)      case "$5" in
2242                                 alpha)
2243                                         osname=dec_osf
2244                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2245                                         ;;
2246                         hp*)    osname=hp_osf1  ;;
2247                         mips)   osname=mips_osf1 ;;
2248                         esac
2249                         ;;
2250                 uts) osname=uts 
2251                         osvers="$3"
2252                         ;;
2253                 qnx) osname=qnx
2254                         osvers="$4"
2255                         ;;
2256                 $2) case "$osname" in
2257                         *isc*) ;;
2258                         *freebsd*) ;;
2259                         svr*)
2260                                 : svr4.x or possibly later
2261                                 case "svr$3" in 
2262                                 ${osname}*)
2263                                         osname=svr$3
2264                                         osvers=$4
2265                                         ;;
2266                                 esac
2267                                 case "$osname" in
2268                                 svr4.0)
2269                                         : Check for ESIX
2270                                         if test -f /stand/boot ; then
2271                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2272                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2273                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2274                                                         if test -n "$isesix"; then
2275                                                                 osname=esix4
2276                                                         fi
2277                                                 fi
2278                                         fi
2279                                         ;;
2280                                 esac
2281                                 ;;
2282                         *)      if test -f /etc/systemid; then
2283                                         osname=sco
2284                                         set `echo $3 | $sed 's/\./ /g'` $4
2285                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2286                                                 osvers=$1.$2.$3
2287                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2288                                                 osvers=$1.$2
2289                                         elif $test -f $src/hints/sco_$1.sh; then
2290                                                 osvers=$1
2291                                         fi
2292                                 else
2293                                         case "$osname" in
2294                                         '') : Still unknown.  Probably a generic Sys V.
2295                                                 osname="sysv"
2296                                                 osvers="$3"
2297                                                 ;;
2298                                         esac
2299                                 fi
2300                                 ;;
2301                         esac
2302                         ;;
2303                 *)      case "$osname" in
2304                         '') : Still unknown.  Probably a generic BSD.
2305                                 osname="$1"
2306                                 osvers="$3"
2307                                 ;;
2308                         esac
2309                         ;;
2310                 esac
2311         else
2312                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2313                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2314                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2315                                 osname=news_os
2316                         fi
2317                         $rm -f UU/kernel.what
2318                 elif test -d c:/.; then
2319                         set X $myuname
2320                         osname=os2
2321                         osvers="$5"
2322                 fi
2323         fi
2324         
2325         : Now look for a hint file osname_osvers, unless one has been
2326         : specified already.
2327         case "$hintfile" in
2328         ''|' ')
2329                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2330                 : Also try without trailing minor version numbers.
2331                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2332                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2333                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2334                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2335                 case "$file" in
2336                 '') dflt=none ;;
2337                 *)  case "$osvers" in
2338                         '') dflt=$file
2339                                 ;;
2340                         *)  if $test -f $src/hints/$file.sh ; then
2341                                         dflt=$file
2342                                 elif $test -f $src/hints/$xfile.sh ; then
2343                                         dflt=$xfile
2344                                 elif $test -f $src/hints/$xxfile.sh ; then
2345                                         dflt=$xxfile
2346                                 elif $test -f $src/hints/$xxxfile.sh ; then
2347                                         dflt=$xxxfile
2348                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2349                                         dflt=$xxxxfile
2350                                 elif $test -f "$src/hints/${osname}.sh" ; then
2351                                         dflt="${osname}"
2352                                 else
2353                                         dflt=none
2354                                 fi
2355                                 ;;
2356                         esac
2357                         ;;
2358                 esac
2359                 if $test -f Policy.sh ; then
2360                         case "$dflt" in
2361                         *Policy*) ;;
2362                         none) dflt="Policy" ;;
2363                         *) dflt="Policy $dflt" ;;
2364                         esac
2365                 fi
2366                 ;;
2367         *)
2368                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2369                 ;;
2370         esac
2371
2372         if $test -f Policy.sh ; then
2373                 $cat <<EOM
2374
2375 There's also a Policy hint file available, which should make the
2376 site-specific (policy) questions easier to answer.
2377 EOM
2378
2379         fi
2380
2381         $cat <<EOM
2382
2383 You may give one or more space-separated answers, or "none" if appropriate.
2384 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2385 is a good thing.  DO NOT give a wrong version or a wrong OS.
2386
2387 EOM
2388
2389         rp="Which of these apply, if any?"
2390         . UU/myread
2391         tans=$ans
2392         for file in $tans; do
2393                 if $test X$file = XPolicy -a -f Policy.sh; then
2394                         . Policy.sh
2395                         $cat Policy.sh >> UU/config.sh
2396                 elif $test -f $src/hints/$file.sh; then
2397                         . $src/hints/$file.sh
2398                         $cat $src/hints/$file.sh >> UU/config.sh
2399                 elif $test X$tans = X -o X$tans = Xnone ; then
2400                         : nothing
2401                 else
2402                         : Give one chance to correct a possible typo.
2403                         echo "$file.sh does not exist"
2404                         dflt=$file
2405                         rp="hint to use instead?"
2406                         . UU/myread
2407                         for file in $ans; do
2408                                 if $test -f "$src/hints/$file.sh"; then
2409                                         . $src/hints/$file.sh
2410                                         $cat $src/hints/$file.sh >> UU/config.sh
2411                                 elif $test X$ans = X -o X$ans = Xnone ; then
2412                                         : nothing
2413                                 else
2414                                         echo "$file.sh does not exist -- ignored."
2415                                 fi
2416                         done
2417                 fi
2418         done
2419
2420         hint=recommended
2421         : Remember our hint file for later.
2422         if $test -f "$src/hints/$file.sh" ; then
2423                 hintfile="$file"
2424         else
2425                 hintfile=''
2426         fi
2427 fi
2428 cd UU
2429 ;;
2430 *)
2431         echo " "
2432         echo "Fetching default answers from $config_sh..." >&4
2433         tmp_n="$n"
2434         tmp_c="$c"
2435         cd ..
2436         cp $config_sh config.sh 2>/dev/null
2437         chmod +w config.sh
2438         . ./config.sh
2439         cd UU
2440         cp ../config.sh .
2441         n="$tmp_n"
2442         c="$tmp_c"
2443         hint=previous
2444         ;;
2445 esac
2446 test "$override" && . ./optdef.sh
2447 myuname="$newmyuname"
2448
2449 : Restore computed paths
2450 for file in $loclist $trylist; do
2451         eval $file="\$_$file"
2452 done
2453
2454 cat << EOM
2455
2456 Configure uses the operating system name and version to set some defaults.
2457 The default value is probably right if the name rings a bell. Otherwise,
2458 since spelling matters for me, either accept the default or answer "none"
2459 to leave it blank.
2460
2461 EOM
2462 case "$osname" in
2463         ''|' ')
2464                 case "$hintfile" in
2465                 ''|' '|none) dflt=none ;;
2466                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2467                 esac
2468                 ;;
2469         *) dflt="$osname" ;;
2470 esac
2471 rp="Operating system name?"
2472 . ./myread
2473 case "$ans" in
2474 none)  osname='' ;;
2475 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2476 esac
2477 echo " "
2478 case "$osvers" in
2479         ''|' ')
2480                 case "$hintfile" in
2481                 ''|' '|none) dflt=none ;;
2482                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2483                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2484                         case "$dflt" in
2485                         ''|' ') dflt=none ;;
2486                         esac
2487                         ;;
2488                 esac
2489                 ;;
2490         *) dflt="$osvers" ;;
2491 esac
2492 rp="Operating system version?"
2493 . ./myread
2494 case "$ans" in
2495 none)  osvers='' ;;
2496 *) osvers="$ans" ;;
2497 esac
2498
2499 : who configured the system
2500 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2501 cf_by=`(logname) 2>/dev/null`
2502 case "$cf_by" in
2503 "")
2504         cf_by=`(whoami) 2>/dev/null`
2505         case "$cf_by" in
2506         "") cf_by=unknown ;;
2507         esac ;;
2508 esac
2509
2510 : set up the script used to warn in case of inconsistency
2511 cat <<EOS >whoa
2512 $startsh
2513 EOS
2514 cat <<'EOSC' >>whoa
2515 dflt=y
2516 echo " "
2517 echo "*** WHOA THERE!!! ***" >&4
2518 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2519 rp="    Keep the $hint value?"
2520 . ./myread
2521 case "$ans" in
2522 y) td=$was; tu=$was;;
2523 esac
2524 EOSC
2525
2526 : function used to set $1 to $val
2527 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2528 case "$val$was" in
2529 $define$undef) . ./whoa; eval "$var=\$td";;
2530 $undef$define) . ./whoa; eval "$var=\$tu";;
2531 *) eval "$var=$val";;
2532 esac'
2533
2534 cat <<EOM
2535
2536 Perl can be built to take advantage of threads, on some systems.
2537 To do so, Configure must be run with -Dusethreads.
2538
2539 Note that threading is a highly experimental feature, and
2540 some known race conditions still remain.  If you choose to try
2541 it, be very sure to not actually deploy it for production
2542 purposes.  README.threads has more details, and is required
2543 reading if you enable threads.
2544 EOM
2545 case "$usethreads" in
2546 $define|true|[yY]*)     dflt='y';;
2547 *) dflt='n';;
2548 esac
2549 rp='Build a threading Perl?'
2550 . ./myread
2551 case "$ans" in
2552 y|Y)    val="$define" ;;     
2553 *)      val="$undef" ;;
2554 esac
2555 set usethreads
2556 eval $setvar 
2557
2558 case "$d_oldpthreads" in
2559 '')     : Configure tests would be welcome here.  For now, assume undef.
2560         val="$undef" ;;
2561 *)      val="$d_oldpthreads" ;;
2562 esac
2563 set d_oldpthreads
2564 eval $setvar
2565
2566
2567 case "$usethreads" in
2568 "$define"|true|[yY]*)
2569 : Look for a hint-file generated 'call-back-unit'.  If the
2570 : user has specified that a threading perl is to be built,
2571 : we may need to set or change some other defaults.
2572         if $test -f usethreads.cbu; then
2573                 echo "Your platform has some specific hints for threaded builds, using them..."
2574                 . ./usethreads.cbu
2575         else
2576                 $cat <<EOM
2577 (Your platform doesn't have any specific hints for threaded builds.
2578  Assuming POSIX threads, then.)
2579 EOM
2580         fi
2581     ;;
2582 esac
2583
2584 cat <<EOM
2585
2586 Perl can be built so that multiple Perl interpreters can coexist
2587 within the same Perl executable.  To do so, Configure must be run with
2588 -Dusemultiplicity.
2589
2590 Normally you do not need this and you should answer no.
2591
2592 EOM
2593 case "$usemultiplicity" in
2594 $define|true|[yY]*)     dflt='y';;
2595 *) dflt='n';;
2596 esac
2597 rp='Build Perl for multiplicity?'
2598 . ./myread
2599 case "$ans" in
2600 y|Y)    val="$define" ;;     
2601 *)      val="$undef" ;;
2602 esac
2603 set usemultiplicity
2604 eval $setvar 
2605
2606 : determine where manual pages are on this system
2607 echo " "
2608 case "$sysman" in
2609 '') 
2610         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2611         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2612         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2613         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2614         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2615         sysman=`./loc . /usr/man/man1 $syspath`
2616         ;;
2617 esac
2618 if $test -d "$sysman"; then
2619         echo "System manual is in $sysman." >&4
2620 else
2621         echo "Could not find manual pages in source form." >&4
2622 fi
2623
2624 : see what memory models we can support
2625 case "$models" in
2626 '')
2627         $cat >pdp11.c <<'EOP'
2628 int main() {
2629 #ifdef pdp11
2630         exit(0);
2631 #else
2632         exit(1);
2633 #endif
2634 }
2635 EOP
2636         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2637         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2638                 dflt='unsplit split'
2639         else
2640                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2641                 case "$tans" in
2642                 X) dflt='none';;
2643                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2644                                 dflt='small'
2645                         else
2646                                 dflt=''
2647                         fi
2648                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2649                                 dflt="$dflt medium"
2650                         fi
2651                         if $test -d /lib/large || $test -d /usr/lib/large; then
2652                                 dflt="$dflt large"
2653                         fi
2654                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2655                                 dflt="$dflt huge"
2656                         fi
2657                 esac
2658         fi;;
2659 *) dflt="$models";;
2660 esac
2661 $cat <<EOM
2662  
2663 Some systems have different model sizes.  On most systems they are called
2664 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2665 split.  If your system doesn't support different memory models, say "none".
2666 If you wish to force everything to one memory model, say "none" here and
2667 put the appropriate flags later when it asks you for other cc and ld flags.
2668 Venix systems may wish to put "none" and let the compiler figure things out.
2669 (In the following question multiple model names should be space separated.)
2670
2671 The default for most systems is "none".
2672
2673 EOM
2674 rp="Which memory models are supported?"
2675 . ./myread
2676 models="$ans"
2677
2678 case "$models" in
2679 none)
2680         small=''
2681         medium=''
2682         large=''
2683         huge=''
2684         unsplit=''
2685         split=''
2686         ;;
2687 *split)
2688         case "$split" in
2689         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2690                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2691                         dflt='-i'
2692                 else
2693                         dflt='none'
2694                 fi;;
2695         *) dflt="$split";;
2696         esac
2697         rp="What flag indicates separate I and D space?"
2698         . ./myread
2699         tans="$ans"
2700         case "$tans" in
2701         none) tans='';;
2702         esac
2703         split="$tans"
2704         unsplit='';;
2705 *large*|*small*|*medium*|*huge*)
2706         case "$models" in
2707         *large*)
2708                 case "$large" in
2709                 '') dflt='-Ml';;
2710                 *) dflt="$large";;
2711                 esac
2712         rp="What flag indicates large model?"
2713         . ./myread
2714         tans="$ans"
2715         case "$tans" in
2716         none) tans='';
2717         esac
2718         large="$tans";;
2719         *) large='';;
2720         esac
2721         case "$models" in
2722         *huge*) case "$huge" in
2723                 '') dflt='-Mh';;
2724                 *) dflt="$huge";;
2725                 esac
2726                 rp="What flag indicates huge model?"
2727                 . ./myread
2728                 tans="$ans"
2729                 case "$tans" in
2730                 none) tans='';
2731                 esac
2732                 huge="$tans";;
2733         *) huge="$large";;
2734         esac
2735         case "$models" in
2736         *medium*) case "$medium" in
2737                 '') dflt='-Mm';;
2738                 *) dflt="$medium";;
2739                 esac
2740                 rp="What flag indicates medium model?"
2741                 . ./myread
2742                 tans="$ans"
2743                 case "$tans" in
2744                 none) tans='';
2745                 esac
2746                 medium="$tans";;
2747         *) medium="$large";;
2748         esac
2749         case "$models" in
2750         *small*) case "$small" in
2751                 '') dflt='none';;
2752                 *) dflt="$small";;
2753                 esac
2754                 rp="What flag indicates small model?"
2755                 . ./myread
2756                 tans="$ans"
2757                 case "$tans" in
2758                 none) tans='';
2759                 esac
2760                 small="$tans";;
2761         *) small='';;
2762         esac
2763         ;;
2764 *)
2765         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2766         ;;
2767 esac
2768 $rm -f pdp11.* pdp11
2769
2770 : make some quick guesses about what we are up against
2771 echo " "
2772 $echo $n "Hmm...  $c"
2773 echo exit 1 >bsd
2774 echo exit 1 >usg
2775 echo exit 1 >v7
2776 echo exit 1 >osf1
2777 echo exit 1 >eunice
2778 echo exit 1 >xenix
2779 echo exit 1 >venix
2780 echo exit 1 >os2
2781 d_bsd="$undef"
2782 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2783 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2784 then
2785         echo "Looks kind of like an OSF/1 system, but we'll see..."
2786         echo exit 0 >osf1
2787 elif test `echo abc | tr a-z A-Z` = Abc ; then
2788         xxx=`./loc addbib blurfl $pth`
2789         if $test -f $xxx; then
2790         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2791                 echo exit 0 >bsd
2792                 echo exit 0 >usg
2793         else
2794                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2795                         echo "Looks kind of like an extended USG system, but we'll see..."
2796                 else
2797                         echo "Looks kind of like a USG system, but we'll see..."
2798                 fi
2799                 echo exit 0 >usg
2800         fi
2801 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2802         echo "Looks kind of like a BSD system, but we'll see..."
2803         d_bsd="$define"
2804         echo exit 0 >bsd
2805 else
2806         echo "Looks kind of like a Version 7 system, but we'll see..."
2807         echo exit 0 >v7
2808 fi
2809 case "$eunicefix" in
2810 *unixtovms*)
2811         $cat <<'EOI'
2812 There is, however, a strange, musty smell in the air that reminds me of
2813 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2814 EOI
2815         echo exit 0 >eunice
2816         d_eunice="$define"
2817 : it so happens the Eunice I know will not run shell scripts in Unix format
2818         ;;
2819 *)
2820         echo " "
2821         echo "Congratulations.  You aren't running Eunice."
2822         d_eunice="$undef"
2823         ;;
2824 esac
2825 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2826 case "$p_" in
2827 :) ;;
2828 *)
2829         $cat <<'EOI'
2830 I have the feeling something is not exactly right, however...don't tell me...
2831 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2832 EOI
2833         echo exit 0 >os2
2834         ;;
2835 esac
2836 if test -f /xenix; then
2837         echo "Actually, this looks more like a XENIX system..."
2838         echo exit 0 >xenix
2839         d_xenix="$define"
2840 else
2841         echo " "
2842         echo "It's not Xenix..."
2843         d_xenix="$undef"
2844 fi
2845 chmod +x xenix
2846 $eunicefix xenix
2847 if test -f /venix; then
2848         echo "Actually, this looks more like a VENIX system..."
2849         echo exit 0 >venix
2850 else
2851         echo " "
2852         if ./xenix; then
2853                 : null
2854         else
2855                 echo "Nor is it Venix..."
2856         fi
2857 fi
2858 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2859 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2860 $rm -f foo
2861
2862 : see if we need a special compiler
2863 echo " "
2864 if ./usg; then
2865         case "$cc" in
2866         '') case "$Mcc" in
2867                 /*) dflt='Mcc';;
2868                 *) case "$large" in
2869                         -M*) dflt='cc';;
2870                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2871                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2872                                                 dflt='cc'
2873                                         else
2874                                                 dflt='cc -M'
2875                                         fi
2876                                 else
2877                                         dflt='cc'
2878                                 fi;;
2879                         esac;;
2880                 esac;;
2881         *)  dflt="$cc";;
2882         esac
2883         case "$dflt" in
2884         *M*)    $cat <<'EOM'
2885 On some older systems the default C compiler will not resolve multiple global
2886 references that happen to have the same name.  On some such systems the "Mcc"
2887 command may be used to force these to be resolved.  On other systems a "cc -M"
2888 command is required.  (Note that the -M flag on other systems indicates a
2889 memory model to use!) If you have the Gnu C compiler, you might wish to use
2890 that instead.
2891
2892 EOM
2893         ;;
2894         esac
2895         rp="Use which C compiler?"
2896         . ./myread
2897         cc="$ans"
2898 else
2899         case "$cc" in
2900         '') dflt=cc;;
2901         *) dflt="$cc";;
2902         esac
2903         rp="Use which C compiler?"
2904         . ./myread
2905         cc="$ans"
2906 fi
2907 : Look for a hint-file generated 'call-back-unit'.  Now that the
2908 : user has specified the compiler, we may need to set or change some
2909 : other defaults.
2910 if $test -f cc.cbu; then
2911     . ./cc.cbu
2912 fi
2913 echo " "
2914 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2915 $cat >gccvers.c <<EOM
2916 #include <stdio.h>
2917 int main() {
2918 #ifdef __GNUC__
2919 #ifdef __VERSION__
2920         printf("%s\n", __VERSION__);
2921 #else
2922         printf("%s\n", "1");
2923 #endif
2924 #endif
2925         exit(0);
2926 }
2927 EOM
2928 if $cc -o gccvers gccvers.c; then
2929         gccversion=`./gccvers`
2930         case "$gccversion" in
2931         '') echo "You are not using GNU cc." ;;
2932         *)  echo "You are using GNU cc $gccversion." ;;
2933         esac
2934 else
2935         echo " "
2936         echo "*** WHOA THERE!!! ***" >&4
2937         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
2938         case "$knowitall" in
2939         '')
2940         echo "    You'd better start hunting for one and let me know about it." >&4
2941                 exit 1
2942                 ;;
2943         esac
2944 fi
2945 $rm -f gccvers*
2946 case "$gccversion" in
2947 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2948 esac
2949
2950 cat <<EOM
2951
2952 Perl can be built to take advantage of explicit 64-bit interfaces,
2953 on some systems.  To do so, Configure must be run with -Duse64bits.
2954
2955 If this doesn't make any sense to you, just accept the default 'n'.
2956 EOM
2957 case "$use64bits" in
2958 $define|true|[yY]*)     dflt='y';;
2959 *) dflt='n';;
2960 esac
2961 rp='Try to use explicit 64-bit interfaces, if available?'
2962 . ./myread
2963 case "$ans" in
2964 y|Y) 
2965         val="$define"
2966         ;;     
2967 *)      
2968         val="$undef"
2969         ;;
2970 esac
2971 set use64bits
2972 eval $setvar
2973
2974 case "$archname64" in
2975 '') archname64='' ;;    # not a typo
2976 esac
2977
2978 case "$use64bits" in
2979 "$define"|true|[yY]*)
2980 : Look for a hint-file generated 'call-back-unit'.  If the
2981 : user has specified that a 64 bit perl is to be built,
2982 : we may need to set or change some other defaults.
2983         if $test -f use64bits.cbu; then
2984                 echo "Your platform has some specific hints for 64-bit builds, using them..."
2985                 . ./use64bits.cbu
2986         else
2987                 $cat <<EOM
2988 (Your platform doesn't have any specific hints for 64-bit builds.
2989  This is probably okay, especially if your system is a true 64-bit system.)
2990 EOM
2991                 case "$gccversion" in
2992                 '')     ;;
2993                 *)      $cat <<EOM
2994 But since you seem to be using gcc,
2995 I will now add -DUSE_LONG_LONG to the compilation flags.
2996 EOM
2997                         ccflags="$ccflags -DUSE_LONG_LONG"
2998                         ;;
2999                 esac
3000         fi
3001         ;;
3002 esac
3003
3004 : determine the architecture name
3005 echo " "
3006 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3007         tarch=`arch`"-$osname"
3008 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3009         if uname -m > tmparch 2>&1 ; then
3010                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3011                         -e 's/$/'"-$osname/" tmparch`
3012         else
3013                 tarch="$osname"
3014         fi
3015         $rm -f tmparch
3016 else
3017         tarch="$osname"
3018 fi
3019 case "$myarchname" in
3020 ''|"$tarch") ;;
3021 *)
3022         echo "(Your architecture name used to be $myarchname.)"
3023         archname=''
3024         ;;
3025 esac
3026 myarchname="$tarch"
3027 case "$archname" in
3028 '') dflt="$tarch";;
3029 *) dflt="$archname";;
3030 esac
3031 rp='What is your architecture name'
3032 . ./myread
3033 archname="$ans"
3034 case "$usethreads" in
3035 $define)
3036         echo "Threads selected." >&4
3037         case "$archname" in
3038         *-thread*) echo "...and architecture name already has -thread." >&4
3039                 ;;
3040         *)      archname="$archname-thread"
3041                 echo "...setting architecture name to $archname." >&4
3042                 ;;
3043         esac
3044         ;;
3045 esac
3046 case "$usemultiplicity" in
3047 $define)
3048         echo "Multiplicity selected." >&4
3049         case "$archname" in
3050         *-multi*) echo "...and architecture name already has -multi." >&4
3051                 ;;
3052         *)      archname="$archname-multi"
3053                 echo "...setting architecture name to $archname." >&4
3054                 ;;
3055         esac
3056         ;;
3057 esac
3058 case "$use64bits" in
3059 $define)
3060         echo "Explicit 64-bitness selected." >&4
3061         case "$archname64" in
3062         '')
3063                 ;;
3064         *)
3065                 case "$archname" in
3066                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3067                         ;;
3068                 *)      archname="$archname-$archname64"
3069                         echo "...setting architecture name to $archname." >&4
3070                         ;;
3071                 esac
3072                 ;;
3073         esac
3074 esac
3075
3076 : decide how portable to be.  Allow command line overrides.
3077 case "$d_portable" in
3078 "$undef") ;;
3079 *)      d_portable="$define" ;;
3080 esac
3081
3082 : set up shell script to do ~ expansion
3083 cat >filexp <<EOSS
3084 $startsh
3085 : expand filename
3086 case "\$1" in
3087  ~/*|~)
3088         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3089         ;;
3090  ~*)
3091         if $test -f /bin/csh; then
3092                 /bin/csh -f -c "glob \$1"
3093                 failed=\$?
3094                 echo ""
3095                 exit \$failed
3096         else
3097                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3098                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3099                 if $test ! -d "\$dir"; then
3100                         me=\`basename \$0\`
3101                         echo "\$me: can't locate home directory for: \$name" >&2
3102                         exit 1
3103                 fi
3104                 case "\$1" in
3105                 */*)
3106                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3107                         ;;
3108                 *)
3109                         echo \$dir
3110                         ;;
3111                 esac
3112         fi
3113         ;;
3114 *)
3115         echo \$1
3116         ;;
3117 esac
3118 EOSS
3119 chmod +x filexp
3120 $eunicefix filexp
3121
3122 : now set up to get a file name
3123 cat <<EOS >getfile
3124 $startsh
3125 EOS
3126 cat <<'EOSC' >>getfile
3127 tilde=''
3128 fullpath=''
3129 already=''
3130 skip=''
3131 none_ok=''
3132 exp_file=''
3133 nopath_ok=''
3134 orig_rp="$rp"
3135 orig_dflt="$dflt"
3136 case "$gfpth" in
3137 '') gfpth='.' ;;
3138 esac
3139
3140 case "$fn" in
3141 *\(*)
3142         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3143         fn=`echo $fn | sed 's/(.*)//'`
3144         ;;
3145 esac
3146
3147 case "$fn" in
3148 *:*)
3149         loc_file=`expr $fn : '.*:\(.*\)'`
3150         fn=`expr $fn : '\(.*\):.*'`
3151         ;;
3152 esac
3153
3154 case "$fn" in
3155 *~*) tilde=true;;
3156 esac
3157 case "$fn" in
3158 */*) fullpath=true;;
3159 esac
3160 case "$fn" in
3161 *+*) skip=true;;
3162 esac
3163 case "$fn" in
3164 *n*) none_ok=true;;
3165 esac
3166 case "$fn" in
3167 *e*) exp_file=true;;
3168 esac
3169 case "$fn" in
3170 *p*) nopath_ok=true;;
3171 esac
3172
3173 case "$fn" in
3174 *f*) type='File';;
3175 *d*) type='Directory';;
3176 *l*) type='Locate';;
3177 esac
3178
3179 what="$type"
3180 case "$what" in
3181 Locate) what='File';;
3182 esac
3183
3184 case "$exp_file" in
3185 '')
3186         case "$d_portable" in
3187         "$define") ;;
3188         *) exp_file=true;;
3189         esac
3190         ;;
3191 esac
3192
3193 cd ..
3194 while test "$type"; do
3195         redo=''
3196         rp="$orig_rp"
3197         dflt="$orig_dflt"
3198         case "$tilde" in
3199         true) rp="$rp (~name ok)";;
3200         esac
3201         . UU/myread
3202         if test -f UU/getfile.ok && \
3203                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3204         then
3205                 value="$ans"
3206                 ansexp="$ans"
3207                 break
3208         fi
3209         case "$ans" in
3210         none)
3211                 value=''
3212                 ansexp=''
3213                 case "$none_ok" in
3214                 true) type='';;
3215                 esac
3216                 ;;
3217         *)
3218                 case "$tilde" in
3219                 '') value="$ans"
3220                         ansexp="$ans";;
3221                 *)
3222                         value=`UU/filexp $ans`
3223                         case $? in
3224                         0)
3225                                 if test "$ans" != "$value"; then
3226                                         echo "(That expands to $value on this system.)"
3227                                 fi
3228                                 ;;
3229                         *) value="$ans";;
3230                         esac
3231                         ansexp="$value"
3232                         case "$exp_file" in
3233                         '') value="$ans";;
3234                         esac
3235                         ;;
3236                 esac
3237                 case "$fullpath" in
3238                 true)
3239                         case "$ansexp" in
3240                         /*) value="$ansexp" ;;
3241                         *)
3242                                 redo=true
3243                                 case "$already" in
3244                                 true)
3245                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3246                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3247                                         ;;
3248                                 *)
3249                                 echo "Please give a full path name, starting with slash." >&4
3250                                         case "$tilde" in
3251                                         true)
3252                                 echo "Note that using ~name is ok provided it expands well." >&4
3253                                                 already=true
3254                                                 ;;
3255                                         esac
3256                                 esac
3257                                 ;;
3258                         esac
3259                         ;;
3260                 esac
3261                 case "$redo" in
3262                 '')
3263                         case "$type" in
3264                         File)
3265                                 for fp in $gfpth; do
3266                                         if test "X$fp" = X.; then
3267                                             pf="$ansexp"
3268                                         else    
3269                                             pf="$fp/$ansexp"
3270                                         fi
3271                                         if test -f "$pf"; then
3272                                                 type=''
3273                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3274                                         then
3275                                                 echo "($value is not a plain file, but that's ok.)"
3276                                                 type=''
3277                                         fi
3278                                         if test X"$type" = X; then
3279                                             value="$pf"
3280                                             break
3281                                         fi
3282                                 done
3283                                 ;;
3284                         Directory)
3285                                 for fp in $gfpth; do
3286                                         if test "X$fp" = X.; then
3287                                             pf="$ansexp"
3288                                         else    
3289                                             pf="$fp/$ansexp"
3290                                         fi
3291                                         if test -d "$pf"; then
3292                                                 type=''
3293                                                 value="$pf"
3294                                                 break
3295                                         fi
3296                                 done
3297                                 ;;
3298                         Locate)
3299                                 if test -d "$ansexp"; then
3300                                         echo "(Looking for $loc_file in directory $value.)"
3301                                         value="$value/$loc_file"
3302                                         ansexp="$ansexp/$loc_file"
3303                                 fi
3304                                 if test -f "$ansexp"; then
3305                                         type=''
3306                                 fi
3307                                 case "$nopath_ok" in
3308                                 true)   case "$value" in
3309                                         */*) ;;
3310                                         *)      echo "Assuming $value will be in people's path."
3311                                                 type=''
3312                                                 ;;
3313                                         esac
3314                                         ;;
3315                                 esac
3316                                 ;;
3317                         esac
3318
3319                         case "$skip" in
3320                         true) type='';
3321                         esac
3322
3323                         case "$type" in
3324                         '') ;;
3325                         *)
3326                                 if test "$fastread" = yes; then
3327                                         dflt=y
3328                                 else
3329                                         dflt=n
3330                                 fi
3331                                 rp="$what $value doesn't exist.  Use that name anyway?"
3332                                 . UU/myread
3333                                 dflt=''
3334                                 case "$ans" in
3335                                 y*) type='';;
3336                                 *) echo " ";;
3337                                 esac
3338                                 ;;
3339                         esac
3340                         ;;
3341                 esac
3342                 ;;
3343         esac
3344 done
3345 cd UU
3346 ans="$value"
3347 rp="$orig_rp"
3348 dflt="$orig_dflt"
3349 rm -f getfile.ok
3350 test "X$gfpthkeep" != Xy && gfpth=""
3351 EOSC
3352
3353 : determine root of directory hierarchy where package will be installed.
3354 case "$prefix" in
3355 '')
3356         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3357         ;;
3358 *)
3359         dflt="$prefix"
3360         ;;
3361 esac
3362 $cat <<EOM
3363
3364 By default, $package will be installed in $dflt/bin, manual pages
3365 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3366 installation directories. Typically this is something like /usr/local.
3367 If you wish to have binaries under /usr/bin but other parts of the
3368 installation under /usr/local, that's ok: you will be prompted
3369 separately for each of the installation directories, the prefix being
3370 only used to set the defaults.
3371
3372 EOM
3373 fn=d~
3374 rp='Installation prefix to use?'
3375 . ./getfile
3376 oldprefix=''
3377 case "$prefix" in
3378 '') ;;
3379 *)
3380         case "$ans" in
3381         "$prefix") ;;
3382         *) oldprefix="$prefix";;
3383         esac
3384         ;;
3385 esac
3386 prefix="$ans"
3387 prefixexp="$ansexp"
3388
3389 : is AFS running?
3390 echo " "
3391 case "$afs" in
3392 $define|true)   afs=true ;;
3393 $undef|false)   afs=false ;;
3394 *)      if test -d /afs; then
3395                 afs=true
3396         else
3397                 afs=false
3398         fi
3399         ;;
3400 esac
3401 if $afs; then
3402         echo "AFS may be running... I'll be extra cautious then..." >&4
3403 else
3404         echo "AFS does not seem to be running..." >&4
3405 fi
3406
3407 : determine installation prefix for where package is to be installed.
3408 if $afs; then 
3409 $cat <<EOM
3410
3411 Since you are running AFS, I need to distinguish the directory in which
3412 files will reside from the directory in which they are installed (and from
3413 which they are presumably copied to the former directory by occult means).
3414
3415 EOM
3416         case "$installprefix" in
3417         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3418         *) dflt="$installprefix";;
3419         esac
3420 else
3421 $cat <<EOM
3422
3423 In some special cases, particularly when building $package for distribution,
3424 it is convenient to distinguish between the directory in which files should 
3425 be installed from the directory ($prefix) in which they 
3426 will eventually reside.  For most users, these two directories are the same.
3427
3428 EOM
3429         case "$installprefix" in
3430         '') dflt=$prefix ;;
3431         *) dflt=$installprefix;;
3432         esac
3433 fi
3434 fn=d~
3435 rp='What installation prefix should I use for installing files?'
3436 . ./getfile
3437 installprefix="$ans"
3438 installprefixexp="$ansexp"
3439
3440 : set the prefixit variable, to compute a suitable default value
3441 prefixit='case "$3" in
3442 ""|none)
3443         case "$oldprefix" in
3444         "") eval "$1=\"\$$2\"";;
3445         *)
3446                 case "$3" in
3447                 "") eval "$1=";;
3448                 none)
3449                         eval "tp=\"\$$2\"";
3450                         case "$tp" in
3451                         ""|" ") eval "$1=\"\$$2\"";;
3452                         *) eval "$1=";;
3453                         esac;;
3454                 esac;;
3455         esac;;
3456 *)
3457         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3458         case "$tp" in
3459         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3460         /*-$oldprefix/*|\~*-$oldprefix/*)
3461                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3462         *) eval "$1=\"\$$2\"";;
3463         esac;;
3464 esac'
3465
3466 : set the base revision
3467 baserev=5.0
3468
3469 : get the patchlevel
3470 echo " "
3471 echo "Getting the current patchlevel..." >&4
3472 if $test -r $rsrc/patchlevel.h;then
3473         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3474         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3475 else
3476         patchlevel=0
3477         subversion=0
3478 fi
3479 $echo $n "(You have $package" $c
3480 case "$package" in
3481 "*$baserev")    ;;
3482 *)              $echo $n " $baserev" $c ;;
3483 esac
3484 $echo $n " patchlevel $patchlevel" $c
3485 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3486 echo ".)"
3487
3488 if test 0 -eq "$subversion"; then
3489         version=`LC_ALL=C; export LC_ALL; \
3490                  echo $baserev $patchlevel | \
3491                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3492 else
3493         version=`LC_ALL=C; export LC_ALL; \
3494                  echo $baserev $patchlevel $subversion | \
3495                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3496 fi
3497 : Figure out perl API version.  Perhaps this should be in patchlevel.h
3498 if test "$subversion" -lt 50; then
3499         apiversion=`LC_ALL=C; export LC_ALL; \
3500                  LANGUAGE=C; export LANGUAGE; \
3501                  echo $baserev $patchlevel | \
3502                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3503 else
3504         apiversion="$version"
3505 fi
3506
3507 : determine installation style
3508 : For now, try to deduce it from prefix unless it is already set.
3509 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3510 case "$installstyle" in
3511 '')     case "$prefix" in
3512                 *perl*) dflt='lib';;
3513                 *) dflt='lib/perl5' ;;
3514         esac
3515         ;;
3516 *)      dflt='lib/perl5' ;;
3517 esac
3518 : Probably not worth prompting for this since we prompt for all
3519 : the directories individually, and the prompt would be too long and
3520 : confusing anyway.
3521 installstyle=$dflt
3522
3523 : determine where private library files go
3524 : Usual default is /usr/local/lib/perl5/$version.
3525 : Also allow things like /opt/perl/lib/$version, since 
3526 : /opt/perl/lib/perl5... would be redundant.
3527 : The default "style" setting is made in installstyle.U
3528 case "$installstyle" in
3529 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3530 *)       set dflt privlib lib/$version ;;
3531 esac
3532 eval $prefixit
3533 $cat <<EOM
3534
3535 There are some auxiliary files for $package that need to be put into a
3536 private library directory that is accessible by everyone.
3537
3538 EOM
3539 fn=d~+
3540 rp='Pathname where the private library files will reside?'
3541 . ./getfile
3542 privlib="$ans"
3543 privlibexp="$ansexp"
3544 : Change installation prefix, if necessary.
3545 if $test X"$prefix" != X"$installprefix"; then
3546         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
3547 else
3548         installprivlib="$privlibexp"
3549 fi
3550
3551 : set the prefixup variable, to restore leading tilda escape
3552 prefixup='case "$prefixexp" in
3553 "$prefix") ;;
3554 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3555 esac'
3556
3557 : determine where public architecture dependent libraries go
3558 set archlib archlib
3559 eval $prefixit
3560 : privlib default is /usr/local/lib/$package/$version
3561 : archlib default is /usr/local/lib/$package/$version/$archname
3562 : privlib may have an optional trailing /share.
3563 tdflt=`echo $privlib | $sed 's,/share$,,'`
3564 tdflt=$tdflt/$archname
3565 case "$archlib" in
3566 '')     dflt=$tdflt
3567         ;;
3568 *)      dflt="$archlib"
3569     ;;
3570 esac
3571 $cat <<EOM
3572
3573 $spackage contains architecture-dependent library files.  If you are
3574 sharing libraries in a heterogeneous environment, you might store
3575 these files in a separate location.  Otherwise, you can just include
3576 them with the rest of the public library files.
3577
3578 EOM
3579 fn=d+~
3580 rp='Where do you want to put the public architecture-dependent libraries?'
3581 . ./getfile
3582 archlib="$ans"
3583 archlibexp="$ansexp"
3584 if $test X"$archlib" = X"$privlib"; then
3585         d_archlib="$undef"
3586 else
3587         d_archlib="$define"
3588 fi
3589 : Change installation prefix, if necessary.
3590 if $test X"$prefix" != X"$installprefix"; then
3591         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
3592 else
3593         installarchlib="$archlibexp"
3594 fi
3595
3596
3597 : Binary compatibility with 5.005 is not possible for builds
3598 : with advanced features
3599 case "$usethreads$usemultiplicity" in
3600 *define*)
3601         bincompat5005="$undef"
3602         d_bincompat5005="$undef"
3603         ;;
3604 *)      $cat <<EOM
3605
3606 Perl 5.006 can be compiled for binary compatibility with 5.005.
3607 If you decide to do so, you will be able to continue using most
3608 of the extensions that were compiled for Perl 5.005.
3609
3610 EOM
3611         case "$bincompat5005$d_bincompat5005" in
3612         *"$undef"*) dflt=n ;;
3613         *) dflt=y ;;
3614         esac
3615         rp='Binary compatibility with Perl 5.005?'
3616         . ./myread
3617         case "$ans" in
3618         y*) val="$define" ;;
3619         *)  val="$undef" ;;
3620         esac
3621         set d_bincompat5005
3622         eval $setvar
3623         case "$d_bincompat5005" in
3624         "$define")
3625                 bincompat5005="$define"
3626                 ;;
3627         *)      bincompat5005="$undef"
3628                 d_bincompat5005="$undef"
3629                 ;;
3630         esac
3631         ;;
3632 esac
3633
3634
3635 : see if setuid scripts can be secure
3636 $cat <<EOM
3637
3638 Some kernels have a bug that prevents setuid #! scripts from being
3639 secure.  Some sites have disabled setuid #! scripts because of this.
3640
3641 First let's decide if your kernel supports secure setuid #! scripts.
3642 (If setuid #! scripts would be secure but have been disabled anyway,
3643 don't say that they are secure if asked.)
3644
3645 EOM
3646
3647 val="$undef"
3648 if $test -d /dev/fd; then
3649         echo "#!$ls" >reflect
3650         chmod +x,u+s reflect
3651         ./reflect >flect 2>&1
3652         if $contains "/dev/fd" flect >/dev/null; then
3653                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3654                 val="$define"
3655         else
3656                 $cat <<EOM
3657 If you are not sure if they are secure, I can check but I'll need a
3658 username and password different from the one you are using right now.
3659 If you don't have such a username or don't want me to test, simply
3660 enter 'none'.
3661
3662 EOM
3663                 rp='Other username to test security of setuid scripts with?'
3664                 dflt='none'
3665                 . ./myread
3666                 case "$ans" in
3667                 n|none)
3668                         case "$d_suidsafe" in
3669                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3670                                 dflt=n;;
3671                         "$undef")
3672                                 echo "Well, the $hint value is *not* secure." >&4
3673                                 dflt=n;;
3674                         *)      echo "Well, the $hint value *is* secure." >&4
3675                                 dflt=y;;
3676                         esac
3677                         ;;
3678                 *)
3679                         $rm -f reflect flect
3680                         echo "#!$ls" >reflect
3681                         chmod +x,u+s reflect
3682                         echo >flect
3683                         chmod a+w flect
3684                         echo '"su" will (probably) prompt you for '"$ans's password."
3685                         su $ans -c './reflect >flect'
3686                         if $contains "/dev/fd" flect >/dev/null; then
3687                                 echo "Okay, it looks like setuid scripts are secure." >&4
3688                                 dflt=y
3689                         else
3690                                 echo "I don't think setuid scripts are secure." >&4
3691                                 dflt=n
3692                         fi
3693                         ;;
3694                 esac
3695                 rp='Does your kernel have *secure* setuid scripts?'
3696                 . ./myread
3697                 case "$ans" in
3698                 [yY]*)  val="$define";;
3699                 *)      val="$undef";;
3700                 esac
3701         fi
3702 else
3703         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3704         echo "(That's for file descriptors, not floppy disks.)"
3705         val="$undef"
3706 fi
3707 set d_suidsafe
3708 eval $setvar
3709
3710 $rm -f reflect flect
3711
3712 : now see if they want to do setuid emulation
3713 echo " "
3714 val="$undef"
3715 case "$d_suidsafe" in
3716 "$define")
3717         val="$undef"
3718         echo "No need to emulate SUID scripts since they are secure here." >& 4
3719         ;;
3720 *)
3721         $cat <<EOM
3722 Some systems have disabled setuid scripts, especially systems where
3723 setuid scripts cannot be secure.  On systems where setuid scripts have
3724 been disabled, the setuid/setgid bits on scripts are currently
3725 useless.  It is possible for $package to detect those bits and emulate
3726 setuid/setgid in a secure fashion.  This emulation will only work if
3727 setuid scripts have been disabled in your kernel.
3728
3729 EOM
3730         case "$d_dosuid" in
3731         "$define") dflt=y ;;
3732         *) dflt=n ;;
3733         esac
3734         rp="Do you want to do setuid/setgid emulation?"
3735         . ./myread
3736         case "$ans" in
3737         [yY]*)  val="$define";;
3738         *)      val="$undef";;
3739         esac
3740         ;;
3741 esac
3742 set d_dosuid
3743 eval $setvar
3744
3745 : What should the include directory be ?
3746 echo " "
3747 $echo $n "Hmm...  $c"
3748 dflt='/usr/include'
3749 incpath=''
3750 mips_type=''
3751 if $test -f /bin/mips && /bin/mips; then
3752         echo "Looks like a MIPS system..."
3753         $cat >usr.c <<'EOCP'
3754 #ifdef SYSTYPE_BSD43
3755 /bsd43
3756 #endif
3757 EOCP
3758         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3759                 dflt='/bsd43/usr/include'
3760                 incpath='/bsd43'
3761                 mips_type='BSD 4.3'
3762         else
3763                 mips_type='System V'
3764         fi
3765         $rm -f usr.c usr.out
3766         echo "and you're compiling with the $mips_type compiler and libraries."
3767         xxx_prompt=y
3768         echo "exit 0" >mips
3769 else
3770         echo "Doesn't look like a MIPS system."
3771         xxx_prompt=n
3772         echo "exit 1" >mips
3773 fi
3774 chmod +x mips
3775 $eunicefix mips
3776 case "$usrinc" in
3777 '') ;;
3778 *) dflt="$usrinc";;
3779 esac
3780 case "$xxx_prompt" in
3781 y)      fn=d/
3782         echo " "
3783         rp='Where are the include files you want to use?'
3784         . ./getfile
3785         usrinc="$ans"
3786         ;;
3787 *)      usrinc="$dflt"
3788         ;;
3789 esac
3790
3791 : see how we invoke the C preprocessor
3792 echo " "
3793 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3794 cat <<'EOT' >testcpp.c
3795 #define ABC abc
3796 #define XYZ xyz
3797 ABC.XYZ
3798 EOT
3799 cd ..
3800 if test ! -f cppstdin; then
3801         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3802                 # AIX cc -E doesn't show the absolute headerfile
3803                 # locations but we'll cheat by using the -M flag.
3804                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
3805         else
3806                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3807         fi
3808 else
3809         echo "Keeping your $hint cppstdin wrapper."
3810 fi
3811 chmod 755 cppstdin
3812 wrapper=`pwd`/cppstdin
3813 ok='false'
3814 cd UU
3815
3816 if $test "X$cppstdin" != "X" && \
3817         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3818         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3819 then
3820         echo "You used to use $cppstdin $cppminus so we'll use that again."
3821         case "$cpprun" in
3822         '') echo "But let's see if we can live without a wrapper..." ;;
3823         *)
3824                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3825                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3826                 then
3827                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3828                         ok='true'
3829                 else
3830                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3831                 fi
3832                 ;;
3833         esac
3834 else
3835         case "$cppstdin" in
3836         '') ;;
3837         *)
3838                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3839                 ;;
3840         esac
3841 fi
3842
3843 if $ok; then
3844         : nothing
3845 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3846         $cc -E <testcpp.c >testcpp.out 2>&1; \
3847         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3848         echo "Yup, it does."
3849         x_cpp="$cc -E"
3850         x_minus='';
3851 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3852         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3853         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3854         echo "Yup, it does."
3855         x_cpp="$cc -E"
3856         x_minus='-';
3857 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3858         $cc -P <testcpp.c >testcpp.out 2>&1; \
3859         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3860         echo "Yipee, that works!"
3861         x_cpp="$cc -P"
3862         x_minus='';
3863 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3864         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3865         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3866         echo "At long last!"
3867         x_cpp="$cc -P"
3868         x_minus='-';
3869 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3870         $cpp <testcpp.c >testcpp.out 2>&1; \
3871         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3872         echo "It works!"
3873         x_cpp="$cpp"
3874         x_minus='';
3875 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3876         $cpp - <testcpp.c >testcpp.out 2>&1; \
3877         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3878         echo "Hooray, it works!  I was beginning to wonder."
3879         x_cpp="$cpp"
3880         x_minus='-';
3881 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3882         $wrapper <testcpp.c >testcpp.out 2>&1; \
3883         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3884         x_cpp="$wrapper"
3885         x_minus=''
3886         echo "Eureka!"
3887 else
3888         dflt=''
3889         rp="No dice.  I can't find a C preprocessor.  Name one:"
3890         . ./myread
3891         x_cpp="$ans"
3892         x_minus=''
3893         $x_cpp <testcpp.c >testcpp.out 2>&1
3894         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3895                 echo "OK, that will do." >&4
3896         else
3897 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3898                 exit 1
3899         fi
3900 fi
3901
3902 case "$ok" in
3903 false)
3904         cppstdin="$x_cpp"
3905         cppminus="$x_minus"
3906         cpprun="$x_cpp"
3907         cpplast="$x_minus"
3908         set X $x_cpp
3909         shift
3910         case "$1" in
3911         "$cpp")
3912                 echo "Perhaps can we force $cc -E using a wrapper..."
3913                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3914                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3915                 then
3916                         echo "Yup, we can."
3917                         cppstdin="$wrapper"
3918                         cppminus='';
3919                 else
3920                         echo "Nope, we'll have to live without it..."
3921                 fi
3922                 ;;
3923         esac
3924         case "$cpprun" in
3925         "$wrapper")
3926                 cpprun=''
3927                 cpplast=''
3928                 ;;
3929         esac
3930         ;;
3931 esac
3932
3933 case "$cppstdin" in
3934 "$wrapper"|'cppstdin') ;;
3935 *) $rm -f $wrapper;;
3936 esac
3937 $rm -f testcpp.c testcpp.out
3938
3939 : Set private lib path
3940 case "$plibpth" in
3941 '') if ./mips; then
3942                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3943         fi;;
3944 esac
3945 case "$libpth" in
3946 ' ') dlist='';;
3947 '') dlist="$loclibpth $plibpth $glibpth";;
3948 *) dlist="$libpth";;
3949 esac
3950
3951 : Now check and see which directories actually exist, avoiding duplicates
3952 libpth=''
3953 for xxx in $dlist
3954 do
3955     if $test -d $xxx; then
3956                 case " $libpth " in
3957                 *" $xxx "*) ;;
3958                 *) libpth="$libpth $xxx";;
3959                 esac
3960     fi
3961 done
3962 $cat <<'EOM'
3963
3964 Some systems have incompatible or broken versions of libraries.  Among
3965 the directories listed in the question below, please remove any you
3966 know not to be holding relevant libraries, and add any that are needed.
3967 Say "none" for none.
3968
3969 EOM
3970 case "$libpth" in
3971 '') dflt='none';;
3972 *)
3973         set X $libpth
3974         shift
3975         dflt=${1+"$@"}
3976         ;;
3977 esac
3978 rp="Directories to use for library searches?"
3979 . ./myread
3980 case "$ans" in
3981 none) libpth=' ';;
3982 *) libpth="$ans";;
3983 esac
3984
3985 : compute shared library extension
3986 case "$so" in
3987 '')
3988         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
3989                 dflt='sl'
3990         else
3991                 dflt='so'
3992         fi
3993         ;;
3994 *) dflt="$so";;
3995 esac
3996 $cat <<EOM
3997
3998 On some systems, shared libraries may be available.  Answer 'none' if
3999 you want to suppress searching of shared libraries for the remaining
4000 of this configuration.
4001
4002 EOM
4003 rp='What is the file extension used for shared libraries?'
4004 . ./myread
4005 so="$ans"
4006
4007 : Define several unixisms.
4008 : Hints files or command line option can be used to override them.
4009 : The convoluted testing is in case hints files set either the old
4010 : or the new name.
4011 case "$_exe" in
4012 '')     case "$exe_ext" in
4013     '') ;;
4014         *)      _exe="$exe_ext" ;;
4015         esac
4016         ;;
4017 esac
4018 case "$_a" in
4019 '')     case "$lib_ext" in
4020     '') _a='.a';;
4021         *)      _a="$lib_ext" ;;
4022         esac
4023         ;;
4024 esac
4025 case "$_o" in
4026 '') case "$obj_ext" in
4027         '')     _o='.o';;
4028         *)      _o="$obj_ext";;
4029         esac
4030         ;;
4031 esac
4032 case "$p_" in
4033 '') case "$path_sep" in
4034         '')     p_=':';;
4035         *)      p_="$path_sep";;
4036         esac
4037         ;;
4038 esac
4039 exe_ext=$_exe
4040 lib_ext=$_a
4041 obj_ext=$_o
4042 path_sep=$p_
4043
4044 : Which makefile gets called first.  This is used by make depend.
4045 case "$firstmakefile" in
4046 '') firstmakefile='makefile';;
4047 esac
4048
4049 cat <<EOM
4050
4051 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4052 Configure must be run with -Dusesocks.
4053
4054 Normally you do not need this and you should answer no.
4055
4056 EOM
4057 case "$usesocks" in
4058 $define|true|[yY]*)     dflt='y';;
4059 *) dflt='n';;
4060 esac
4061 rp='Build Perl for SOCKS?'
4062 . ./myread
4063 case "$ans" in
4064 y|Y)    val="$define" ;;     
4065 *)      val="$undef" ;;
4066 esac
4067 set usesocks
4068 eval $setvar
4069
4070 : Looking for optional libraries
4071 echo " "
4072 echo "Checking for optional libraries..." >&4
4073 case "$libs" in
4074 ' '|'') dflt='';;
4075 *) dflt="$libs";;
4076 esac
4077 case "$libswanted" in
4078 '') libswanted='c_s';;
4079 esac
4080 case "$usesocks" in
4081 $define)
4082         libswanted="$libswanted socks5 socks5_sh"
4083         ;;
4084 esac
4085 for thislib in $libswanted; do
4086         
4087         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4088                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4089                 echo "Found -l$thislib (shared)."
4090                 case " $dflt " in
4091                 *"-l$thislib "*);;
4092                 *) dflt="$dflt -l$thislib";;
4093                 esac
4094         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4095                 echo "Found -l$thislib (shared)."
4096                 case " $dflt " in
4097                 *"-l$thislib "*);;
4098                 *) dflt="$dflt -l$thislib";;
4099                 esac
4100         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4101                 echo "Found -l$thislib."
4102                 case " $dflt " in
4103                 *"-l$thislib "*);;
4104                 *) dflt="$dflt -l$thislib";;
4105                 esac
4106         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4107                 echo "Found -l$thislib."
4108                 case " $dflt " in
4109                 *"-l$thislib "*);;
4110                 *) dflt="$dflt -l$thislib";;
4111                 esac
4112         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4113                 echo "Found -l${thislib}_s."
4114                 case " $dflt " in
4115                 *"-l$thislib "*);;
4116                 *) dflt="$dflt -l${thislib}_s";;
4117                 esac
4118         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4119                 echo "Found -l$thislib."
4120                 case " $dflt " in
4121                 *"-l$thislib "*);;
4122                 *) dflt="$dflt -l$thislib";;
4123                 esac
4124         else
4125                 echo "No -l$thislib."
4126         fi
4127 done
4128 set X $dflt
4129 shift
4130 dflt="$*"
4131 case "$libs" in
4132 '') dflt="$dflt";;
4133 *) dflt="$libs";;
4134 esac
4135 case "$dflt" in
4136 ' '|'') dflt='none';;
4137 esac
4138
4139 $cat <<EOM
4140
4141 In order to compile $package on your machine, a number of libraries
4142 are usually needed.  Include any other special libraries here as well.
4143 Say "none" for none.  The default list is almost always right.
4144 EOM
4145
4146 echo " "
4147 rp="What libraries to use?"
4148 . ./myread
4149 case "$ans" in
4150 none) libs=' ';;
4151 *) libs="$ans";;
4152 esac
4153
4154 : determine optimization, if desired, or use for debug flag also
4155 case "$optimize" in
4156 ' '|$undef) dflt='none';;
4157 '') dflt='-O';;
4158 *) dflt="$optimize";;
4159 esac
4160 $cat <<EOH
4161
4162 By default, $package compiles with the -O flag to use the optimizer.
4163 Alternately, you might want to use the symbolic debugger, which uses
4164 the -g flag (on traditional Unix systems).  Either flag can be
4165 specified here.  To use neither flag, specify the word "none".
4166
4167 EOH
4168 rp="What optimizer/debugger flag should be used?"
4169 . ./myread
4170 optimize="$ans"
4171 case "$optimize" in
4172 'none') optimize=" ";;
4173 esac
4174
4175 dflt=''
4176 : We will not override a previous value, but we might want to
4177 : augment a hint file
4178 case "$hint" in
4179 default|recommended)
4180         case "$gccversion" in
4181         1*) dflt='-fpcc-struct-return' ;;
4182         esac
4183         case "$optimize" in
4184         *-g*) dflt="$dflt -DDEBUGGING";;
4185         esac
4186         case "$gccversion" in
4187         2*) if test -d /etc/conf/kconfig.d &&
4188                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4189                 then
4190                         dflt="$dflt -posix"
4191                 fi
4192                 ;;
4193         esac
4194         case "$gccversion" in
4195         1*) ;;
4196         2.[0-8]*) ;;
4197         *)      echo " "
4198                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4199                 echo 'int main(void) { return 0; }' > gcctest.c
4200                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4201                         echo "Yes, it does." 2>&1
4202                         case "$ccflags" in
4203                         *strict-aliasing*) 
4204                                 echo "Leaving current flags $ccflags alone." 2>&1
4205                                 ;;
4206                         *) dflt="$dflt -fno-strict-aliasing" ;;
4207                         esac
4208                 else
4209                         echo "Nope, it doesn't, but that's ok." 2>&1
4210                 fi
4211                 ;;
4212         esac
4213         ;;
4214 esac
4215
4216 case "$mips_type" in
4217 *BSD*|'') inclwanted="$locincpth $usrinc";;
4218 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4219 esac
4220 for thisincl in $inclwanted; do
4221         if $test -d $thisincl; then
4222                 if $test x$thisincl != x$usrinc; then
4223                         case "$dflt" in
4224                         *$thisincl*);;
4225                         *) dflt="$dflt -I$thisincl";;
4226                         esac
4227                 fi
4228         fi
4229 done
4230
4231 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4232         xxx=true;
4233 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4234         xxx=true;
4235 else
4236         xxx=false;
4237 fi;
4238 if $xxx; then
4239         case "$dflt" in
4240         *$2*);;
4241         *) dflt="$dflt -D$2";;
4242         esac;
4243 fi'
4244
4245 set signal.h LANGUAGE_C; eval $inctest
4246
4247 case "$usesocks" in
4248 $define)
4249         ccflags="$ccflags -DSOCKS"
4250         ;;
4251 esac
4252
4253 case "$hint" in
4254 default|recommended) dflt="$ccflags $dflt" ;;
4255 *) dflt="$ccflags";;
4256 esac
4257
4258 case "$dflt" in
4259 ''|' ') dflt=none;;
4260 esac
4261 $cat <<EOH
4262
4263 Your C compiler may want other flags.  For this question you should include
4264 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4265 but you should NOT include libraries or ld flags like -lwhatever.  If you
4266 want $package to honor its debug switch, you should include -DDEBUGGING here.
4267 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4268
4269 To use no flags, specify the word "none".
4270
4271 EOH
4272 set X $dflt
4273 shift
4274 dflt=${1+"$@"}
4275 rp="Any additional cc flags?"
4276 . ./myread
4277 case "$ans" in
4278 none) ccflags='';;
4279 *) ccflags="$ans";;
4280 esac
4281
4282 : the following weeds options from ccflags that are of no interest to cpp
4283 cppflags="$ccflags"
4284 case "$gccversion" in
4285 1*) cppflags="$cppflags -D__GNUC__"
4286 esac
4287 case "$mips_type" in
4288 '');;
4289 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4290 esac
4291 case "$cppflags" in
4292 '');;
4293 *)
4294         echo " "
4295         echo "Let me guess what the preprocessor flags are..." >&4
4296         set X $cppflags
4297         shift
4298         cppflags=''
4299         $cat >cpp.c <<'EOM'
4300 #define BLURFL foo
4301
4302 BLURFL xx LFRULB
4303 EOM
4304         previous=''
4305         for flag in $*
4306         do
4307                 case "$flag" in
4308                 -*) ftry="$flag";;
4309                 *) ftry="$previous $flag";;
4310                 esac
4311                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4312                         >cpp1.out 2>/dev/null && \
4313                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4314                         >cpp2.out 2>/dev/null && \
4315                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4316                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4317                 then
4318                         cppflags="$cppflags $ftry"
4319                         previous=''
4320                 else
4321                         previous="$flag"
4322                 fi
4323         done
4324         set X $cppflags
4325         shift
4326         cppflags=${1+"$@"}
4327         case "$cppflags" in
4328         *-*)  echo "They appear to be: $cppflags";;
4329         esac
4330         $rm -f cpp.c cpp?.out
4331         ;;
4332 esac
4333
4334 : flags used in final linking phase
4335 case "$ldflags" in
4336 '') if ./venix; then
4337                 dflt='-i -z'
4338         else
4339                 dflt=''
4340         fi
4341         case "$ccflags" in
4342         *-posix*) dflt="$dflt -posix" ;;
4343         esac
4344         ;;
4345 *) dflt="$ldflags";;
4346 esac
4347
4348 : Try to guess additional flags to pick up local libraries.
4349 for thislibdir in $libpth; do
4350         case " $loclibpth " in
4351         *" $thislibdir "*)
4352                 case "$dflt " in 
4353                 *"-L$thislibdir "*) ;;
4354                 *)  dflt="$dflt -L$thislibdir" ;;
4355                 esac
4356                 ;;
4357         esac
4358 done
4359
4360 case "$dflt" in
4361 '') dflt='none' ;;
4362 esac
4363
4364 $cat <<EOH
4365
4366 Your C linker may need flags.  For this question you should
4367 include -L/whatever and any other flags used by the C linker, but you
4368 should NOT include libraries like -lwhatever.
4369
4370 Make sure you include the appropriate -L/path flags if your C linker
4371 does not normally search all of the directories you specified above,
4372 namely
4373         $libpth
4374 To use no flags, specify the word "none".
4375
4376 EOH
4377
4378 rp="Any additional ld flags (NOT including libraries)?"
4379 . ./myread
4380 case "$ans" in
4381 none) ldflags='';;
4382 *) ldflags="$ans";;
4383 esac
4384 rmlist="$rmlist pdp11"
4385
4386 : coherency check
4387 echo " "
4388 echo "Checking your choice of C compiler and flags for coherency..." >&4
4389 $cat > try.c <<'EOF'
4390 #include <stdio.h>
4391 int main() { printf("Ok\n"); exit(0); }
4392 EOF
4393 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4394 shift
4395 $cat >try.msg <<'EOM'
4396 I've tried to compile and run the following simple program:
4397
4398 EOM
4399 $cat try.c >> try.msg
4400
4401 $cat >> try.msg <<EOM
4402
4403 I used the command:
4404
4405         $*
4406         ./try
4407
4408 and I got the following output:
4409
4410 EOM
4411 dflt=y
4412 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4413         if sh -c './try' >>try.msg 2>&1; then
4414                 xxx=`./try`
4415                 case "$xxx" in
4416                 "Ok") dflt=n ;;
4417                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4418                         case " $libs " in
4419                         *" -lsfio "*)
4420                                 cat >> try.msg <<'EOQS'
4421 If $libs contains -lsfio, and sfio is mis-configured, then it
4422 sometimes (apparently) runs and exits with a 0 status, but with no
4423 output!  It may have to do with sfio's use of _exit vs. exit.
4424
4425 EOQS
4426                                 rp="You have a big problem.  Shall I abort Configure"
4427                                 dflt=y
4428                                 ;;
4429                         esac
4430                         ;;
4431                 esac
4432         else
4433                 echo "The program compiled OK, but exited with status $?." >>try.msg
4434                 rp="You have a problem.  Shall I abort Configure"
4435                 dflt=y
4436         fi
4437 else
4438         echo "I can't compile the test program." >>try.msg
4439         rp="You have a BIG problem.  Shall I abort Configure"
4440         dflt=y
4441 fi
4442 case "$dflt" in
4443 y)
4444         $cat try.msg >&4
4445         case "$knowitall" in
4446         '')
4447                 echo "(The supplied flags or libraries might be incorrect.)"
4448                 ;;
4449         *) dflt=n;;
4450         esac
4451         echo " "
4452         . ./myread
4453         case "$ans" in
4454         n*|N*) ;;
4455         *)      echo "Ok.  Stopping Configure." >&4
4456                 exit 1
4457                 ;;
4458         esac
4459         ;;
4460 n) echo "OK, that should do.";;
4461 esac
4462 $rm -f try try.* core
4463
4464 : determine filename position in cpp output
4465 echo " "
4466 echo "Computing filename position in cpp output for #include directives..." >&4
4467 echo '#include <stdio.h>' > foo.c
4468 $cat >fieldn <<EOF
4469 $startsh
4470 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4471 $grep '^[       ]*#.*stdio\.h' | \
4472 while read cline; do
4473         pos=1
4474         set \$cline
4475         while $test \$# -gt 0; do
4476                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4477                         echo "\$pos"
4478                         exit 0
4479                 fi
4480                 shift
4481                 pos=\`expr \$pos + 1\`
4482         done
4483 done
4484 EOF
4485 chmod +x fieldn
4486 fieldn=`./fieldn`
4487 $rm -f foo.c fieldn
4488 case $fieldn in
4489 '') pos='???';;
4490 1) pos=first;;
4491 2) pos=second;;
4492 3) pos=third;;
4493 *) pos="${fieldn}th";;
4494 esac
4495 echo "Your cpp writes the filename in the $pos field of the line."
4496
4497 : locate header file
4498 $cat >findhdr <<EOF
4499 $startsh
4500 wanted=\$1
4501 name=''
4502 for usrincdir in $usrinc
4503 do
4504         if test -f \$usrincdir/\$wanted; then
4505                 echo "\$usrincdir/\$wanted"
4506                 exit 0
4507         fi
4508 done
4509 awkprg='{ print \$$fieldn }'
4510 echo "#include <\$wanted>" > foo\$\$.c
4511 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4512 $grep "^[       ]*#.*\$wanted" | \
4513 while read cline; do
4514         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4515         case "\$name" in
4516         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4517         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4518         *) exit 2;;
4519         esac;
4520 done;
4521 #
4522 # status = 0: grep returned 0 lines, case statement not executed
4523 # status = 1: headerfile found
4524 # status = 2: while loop executed, no headerfile found
4525 #
4526 status=\$?
4527 $rm -f foo\$\$.c;
4528 if test \$status -eq 1; then
4529         exit 0;
4530 fi
4531 exit 1
4532 EOF
4533 chmod +x findhdr
4534
4535 : define an alternate in-header-list? function
4536 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4537 cont=true; xxf="echo \"<\$1> found.\" >&4";
4538 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4539 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4540 esac;
4541 case $# in 4) instead=instead;; *) instead="at last";; esac;
4542 while $test "$cont"; do
4543         xxx=`./findhdr $1`
4544         var=$2; eval "was=\$$2";
4545         if $test "$xxx" && $test -r "$xxx";
4546         then eval $xxf;
4547         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4548                 cont="";
4549         else eval $xxnf;
4550         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4551         set $yyy; shift; shift; yyy=$@;
4552         case $# in 0) cont="";;
4553         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4554                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4555         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4556                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4557         esac;
4558 done;
4559 while $test "$yyy";
4560 do set $yyy; var=$2; eval "was=\$$2";
4561         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4562         set $yyy; shift; shift; yyy=$@;
4563 done'
4564
4565 : see if this is a malloc.h system
4566 set malloc.h i_malloc
4567 eval $inhdr
4568
4569 : see if stdlib is available
4570 set stdlib.h i_stdlib
4571 eval $inhdr
4572
4573 : determine which malloc to compile in
4574 echo " "
4575 case "$usemymalloc" in
4576 ''|[yY]*|true|$define)  dflt='y' ;;
4577 *)      dflt='n' ;;
4578 esac
4579 rp="Do you wish to attempt to use the malloc that comes with $package?"
4580 . ./myread
4581 usemymalloc="$ans"
4582 case "$ans" in
4583 y*|true)
4584         usemymalloc='y'
4585         mallocsrc='malloc.c'
4586         mallocobj="malloc$_o"
4587         d_mymalloc="$define"
4588         case "$libs" in
4589         *-lmalloc*)
4590                 : Remove malloc from list of libraries to use
4591                 echo "Removing unneeded -lmalloc from library list" >&4
4592                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4593                 shift
4594                 libs="$*"
4595                 echo "libs = $libs" >&4
4596                 ;;
4597         esac
4598         ;;
4599 *)
4600         usemymalloc='n'
4601         mallocsrc=''
4602         mallocobj=''
4603         d_mymalloc="$undef"
4604         ;;
4605 esac
4606
4607 : compute the return types of malloc and free
4608 echo " "
4609 $cat >malloc.c <<END
4610 #$i_malloc I_MALLOC
4611 #$i_stdlib I_STDLIB
4612 #include <stdio.h>
4613 #include <sys/types.h>
4614 #ifdef I_MALLOC
4615 #include <malloc.h>
4616 #endif
4617 #ifdef I_STDLIB
4618 #include <stdlib.h>
4619 #endif
4620 #ifdef TRY_MALLOC
4621 void *malloc();
4622 #endif
4623 #ifdef TRY_FREE
4624 void free();
4625 #endif
4626 END
4627 case "$malloctype" in
4628 '')
4629         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4630                 malloctype='void *'
4631         else
4632                 malloctype='char *'
4633         fi
4634         ;;
4635 esac
4636 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4637
4638 case "$freetype" in
4639 '')
4640         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4641                 freetype='void'
4642         else
4643                 freetype='int'
4644         fi
4645         ;;
4646 esac
4647 echo "Your system uses $freetype free(), it would seem." >&4
4648 $rm -f malloc.[co]
4649 $cat <<EOM
4650
4651 The installation process will also create a directory for
4652 vendor-supplied add-ons.  Vendors who supply perl with their system
4653 may find it convenient to place all vendor-supplied files in this
4654 directory rather than in the main distribution directory.  This will
4655 ease upgrades between binary-compatible maintenance versions of perl.
4656
4657 Of course you may also use these directories in whatever way you see
4658 fit.  For example, you might use them to access modules shared over a
4659 company-wide network.
4660
4661 The default answer should be fine for most people.
4662 This causes further questions about vendor add-ons to be skipped
4663 and no vendor-specific directories will be configured for perl.
4664
4665 EOM
4666 rp='Do you want to configure vendor-specific add-on directories?'
4667 case "$usevendorprefix" in
4668 define|true|[yY]*) dflt=y ;;
4669 *) dflt=n ;;
4670 esac
4671 . ./myread
4672 case "$ans" in
4673 [yY]*)  fn=d~+
4674         rp='Installation prefix to use for vendor-supplied add-ons?'
4675         case "$vendorprefix" in
4676         '') dflt='' ;;
4677         *)  dflt=$vendorprefix ;;
4678         esac
4679         . ./getfile
4680         oldvendorprefix=''
4681         case "$vendorprefix" in
4682         '') ;;
4683         *)      case "$ans" in
4684                 "$prefix") ;;
4685                 *) oldvendorprefix="$prefix";;
4686                 esac
4687                 ;;
4688         esac
4689         usevendorprefix="$define"
4690         vendorprefix="$ans"
4691         vendorprefixexp="$ansexp"
4692         ;;
4693 *)      usevendorprefix="$undef"
4694         vendorprefix=''
4695         vendorprefixexp=''
4696         ;;
4697 esac
4698
4699 case "$vendorprefix" in
4700 '')     d_vendorlib="$undef"
4701         vendorlib=''
4702         vendorlibexp=''
4703         ;;
4704 *)      d_vendorlib="$define"
4705         : determine where vendor-supplied modules go.
4706         : Usual default is /usr/local/lib/perl5/vendor_perl
4707         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4708         case "$installstyle" in
4709         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4710         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4711         esac
4712         fn=d~+
4713         rp='Pathname for the vendor-supplied library files?'
4714         . ./getfile
4715         vendorlib="$ans"
4716         vendorlibexp="$ansexp"
4717         : Change installation prefix, if necessary.
4718         if $test X"$prefix" != X"$installprefix"; then
4719                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
4720         else
4721                 installvendorlib="$vendorlibexp"
4722         fi
4723         ;;
4724 esac
4725
4726 : Cruising for prototypes
4727 echo " "
4728 echo "Checking out function prototypes..." >&4
4729 $cat >prototype.c <<'EOCP'
4730 int main(int argc, char *argv[]) {
4731         exit(0);}
4732 EOCP
4733 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4734         echo "Your C compiler appears to support function prototypes."
4735         val="$define"
4736 else
4737         echo "Your C compiler doesn't seem to understand function prototypes."
4738         val="$undef"
4739 fi
4740 set prototype
4741 eval $setvar
4742 $rm -f prototype*
4743
4744 case "$prototype" in
4745 "$define") ;;
4746 *)      ansi2knr='ansi2knr'
4747         echo " "
4748         cat <<EOM >&4
4749
4750 $me:  FATAL ERROR:
4751 This version of $package can only be compiled by a compiler that 
4752 understands function prototypes.  Unfortunately, your C compiler 
4753         $cc $ccflags
4754 doesn't seem to understand them.  Sorry about that.
4755
4756 If GNU cc is available for your system, perhaps you could try that instead.  
4757
4758 Eventually, we hope to support building Perl with pre-ANSI compilers.
4759 If you would like to help in that effort, please contact <perlbug@perl.org>.
4760
4761 Aborting Configure now.
4762 EOM
4763         exit 2
4764         ;;
4765 esac
4766
4767 : determine where public executables go
4768 echo " "
4769 set dflt bin bin
4770 eval $prefixit
4771 fn=d~
4772 rp='Pathname where the public executables will reside?'
4773 . ./getfile
4774 if $test "X$ansexp" != "X$binexp"; then
4775         installbin=''
4776 fi
4777 bin="$ans"
4778 binexp="$ansexp"
4779 : Change installation prefix, if necessary.
4780 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4781 if $test X"$prefix" != X"$installprefix"; then
4782         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
4783 else
4784         installbin="$binexp"
4785 fi
4786
4787 : determine whether to install perl also as /usr/bin/perl
4788
4789 echo " "
4790 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4791         $cat <<EOM
4792 Many scripts expect to perl to be installed as /usr/bin/perl.
4793 I can install the perl you are about to compile also as /usr/bin/perl
4794 (in addition to $installbin/perl).
4795 EOM
4796         case "$installusrbinperl" in
4797         "$undef"|[nN]*) dflt='n';;
4798         *)              dflt='y';;
4799         esac
4800         rp="Do you want to install perl as /usr/bin/perl?"
4801         . ./myread
4802         case "$ans" in
4803         [yY]*)  val="$define";;
4804         *)      val="$undef" ;;
4805         esac
4806 else
4807         val="$undef"
4808 fi
4809 set installusrbinperl
4810 eval $setvar
4811
4812 : define a shorthand compile call
4813 compile='
4814 mc_file=$1;
4815 shift;
4816 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4817 : define a shorthand compile call for compilations that should be ok.
4818 compile_ok='
4819 mc_file=$1;
4820 shift;
4821 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4822
4823 echo " "
4824 echo "Checking for GNU C Library..." >&4
4825 cat >gnulibc.c <<EOM
4826 #include <stdio.h>
4827 int main()
4828 {
4829 #ifdef __GLIBC__
4830     exit(0);
4831 #else
4832     exit(1);
4833 #endif
4834 }
4835 EOM
4836 set gnulibc
4837 if eval $compile_ok && ./gnulibc; then
4838         val="$define"
4839         echo "You are using the GNU C Library"
4840 else
4841         val="$undef"
4842         echo "You are not using the GNU C Library"
4843 fi
4844 $rm -f gnulibc*
4845 set d_gnulibc
4846 eval $setvar
4847
4848 : see if nm is to be used to determine whether a symbol is defined or not
4849 case "$usenm" in
4850 '')
4851         dflt=''
4852         case "$d_gnulibc" in
4853         "$define")
4854                 echo " "
4855                 echo "nm probably won't work on the GNU C Library." >&4
4856                 dflt=n
4857                 ;;
4858         esac
4859         case "$dflt" in
4860         '') 
4861                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4862                         echo " "
4863                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4864                         echo "'nm' won't be sufficient on this sytem." >&4
4865                         dflt=n
4866                 fi
4867                 ;;
4868         esac
4869         case "$dflt" in
4870         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4871                 if $test $dflt -gt 20; then
4872                         dflt=y
4873                 else
4874                         dflt=n
4875                 fi
4876                 ;;
4877         esac
4878         ;;
4879 *)
4880         case "$usenm" in
4881         true|$define) dflt=y;;
4882         *) dflt=n;;
4883         esac
4884         ;;
4885 esac
4886 $cat <<EOM
4887
4888 I can use $nm to extract the symbols from your C libraries. This
4889 is a time consuming task which may generate huge output on the disk (up
4890 to 3 megabytes) but that should make the symbols extraction faster. The
4891 alternative is to skip the 'nm' extraction part and to compile a small
4892 test program instead to determine whether each symbol is present. If
4893 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4894 this may be the best solution.
4895
4896 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4897
4898 EOM
4899 rp="Shall I use $nm to extract C symbols from the libraries?"
4900 . ./myread
4901 case "$ans" in
4902 [Nn]*) usenm=false;;
4903 *) usenm=true;;
4904 esac
4905
4906 runnm=$usenm
4907 case "$reuseval" in
4908 true) runnm=false;;
4909 esac
4910
4911 : nm options which may be necessary
4912 case "$nm_opt" in
4913 '') if $test -f /mach_boot; then
4914                 nm_opt=''       # Mach
4915         elif $test -d /usr/ccs/lib; then
4916                 nm_opt='-p'     # Solaris (and SunOS?)
4917         elif $test -f /dgux; then
4918                 nm_opt='-p'     # DG-UX
4919         elif $test -f /lib64/rld; then
4920                 nm_opt='-p'     # 64-bit Irix
4921         else
4922                 nm_opt=''
4923         fi;;
4924 esac
4925
4926 : nm options which may be necessary for shared libraries but illegal
4927 : for archive libraries.  Thank you, Linux.
4928 case "$nm_so_opt" in
4929 '')     case "$myuname" in
4930         *linux*)
4931                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4932                         nm_so_opt='--dynamic'
4933                 fi
4934                 ;;
4935         esac
4936         ;;
4937 esac
4938
4939 case "$runnm" in
4940 true)
4941 : get list of predefined functions in a handy place
4942 echo " "
4943 case "$libc" in
4944 '') libc=unknown
4945         case "$libs" in
4946         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4947         esac
4948         ;;
4949 esac
4950 libnames='';
4951 case "$libs" in
4952 '') ;;
4953 *)  for thislib in $libs; do
4954         case "$thislib" in
4955         -lc|-lc_s)
4956                 : Handle C library specially below.
4957                 ;;
4958         -l*)
4959                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4960                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4961                         :
4962                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4963                         :
4964                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4965                         :
4966                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4967                         :
4968                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4969                         :
4970                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4971                         :
4972                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4973                         :
4974                 else
4975                         try=''
4976                 fi
4977                 libnames="$libnames $try"
4978                 ;;
4979         *) libnames="$libnames $thislib" ;;
4980         esac
4981         done
4982         ;;
4983 esac
4984 xxx=normal
4985 case "$libc" in
4986 unknown)
4987         set /lib/libc.$so
4988         for xxx in $libpth; do
4989                 $test -r $1 || set $xxx/libc.$so
4990                 : The messy sed command sorts on library version numbers.
4991                 $test -r $1 || \
4992                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4993                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4994                                 h
4995                                 s/[0-9][0-9]*/0000&/g
4996                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4997                                 G
4998                                 s/\n/ /' | \
4999                          sort | $sed -e 's/^.* //'`
5000                 eval set \$$#
5001         done
5002         $test -r $1 || set /usr/ccs/lib/libc.$so
5003         $test -r $1 || set /lib/libsys_s$_a
5004         ;;
5005 *)
5006         set blurfl
5007         ;;
5008 esac
5009 if $test -r "$1"; then
5010         echo "Your (shared) C library seems to be in $1."
5011         libc="$1"
5012 elif $test -r /lib/libc && $test -r /lib/clib; then
5013         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5014         xxx=apollo
5015         libc='/lib/clib /lib/libc'
5016         if $test -r /lib/syslib; then
5017                 echo "(Your math library is in /lib/syslib.)"
5018                 libc="$libc /lib/syslib"
5019         fi
5020 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5021         echo "Your C library seems to be in $libc, as you said before."
5022 elif $test -r $incpath/usr/lib/libc$_a; then
5023         libc=$incpath/usr/lib/libc$_a;
5024         echo "Your C library seems to be in $libc.  That's fine."
5025 elif $test -r /lib/libc$_a; then
5026         libc=/lib/libc$_a;
5027         echo "Your C library seems to be in $libc.  You're normal."
5028 else
5029         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5030                 :
5031         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5032                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5033         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5034                 :
5035         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5036                 :
5037         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5038                 :
5039         else
5040                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5041         fi
5042         if $test -r "$tans"; then
5043                 echo "Your C library seems to be in $tans, of all places."
5044                 libc=$tans
5045         else
5046                 libc='blurfl'
5047         fi
5048 fi
5049 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5050         dflt="$libc"
5051         cat <<EOM
5052
5053 If the guess above is wrong (which it might be if you're using a strange
5054 compiler, or your machine supports multiple models), you can override it here.
5055
5056 EOM
5057 else
5058         dflt=''
5059         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5060         cat >&4 <<EOM
5061 I can't seem to find your C library.  I've looked in the following places:
5062
5063 EOM
5064         $sed 's/^/      /' libpath
5065         cat <<EOM
5066
5067 None of these seems to contain your C library. I need to get its name...
5068
5069 EOM
5070 fi
5071 fn=f
5072 rp='Where is your C library?'
5073 . ./getfile
5074 libc="$ans"
5075
5076 echo " "
5077 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5078 set X `cat libnames`
5079 shift
5080 xxx=files
5081 case $# in 1) xxx=file; esac
5082 echo "Extracting names from the following $xxx for later perusal:" >&4
5083 echo " "
5084 $sed 's/^/      /' libnames >&4
5085 echo " "
5086 $echo $n "This may take a while...$c" >&4
5087
5088 for file in $*; do
5089         case $file in
5090         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5091         *) $nm $nm_opt $file 2>/dev/null;;
5092         esac
5093 done >libc.tmp
5094
5095 $echo $n ".$c"
5096 $grep fprintf libc.tmp > libc.ptf
5097 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5098 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5099 xxx='[ADTSIW]'
5100 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5101         eval $xscan;\
5102         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5103                 eval $xrun
5104 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5105         eval $xscan;\
5106         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5107                 eval $xrun
5108 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5109         eval $xscan;\
5110         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5111                 eval $xrun
5112 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5113         eval $xscan;\
5114         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5115                 eval $xrun
5116 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5117         eval $xscan;\
5118         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5119                 eval $xrun
5120 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5121         eval $xscan;\
5122         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5123                 eval $xrun
5124 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5125                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5126         eval $xscan;\
5127         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5128                 eval $xrun
5129 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5130         eval $xscan;\
5131         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5132                 eval $xrun
5133 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5134         eval $xscan;\
5135         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5136                 eval $xrun
5137 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5138         eval $xscan;\
5139         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5140                 eval $xrun
5141 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5142         eval $xscan;\
5143         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5144                 eval $xrun
5145 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5146         eval $xscan;\
5147         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5148                 eval $xrun
5149 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5150         eval $xscan;\
5151         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5152                 eval $xrun
5153 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5154         eval $xscan;\
5155         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5156                 eval $xrun
5157 else
5158         $nm -p $* 2>/dev/null >libc.tmp
5159         $grep fprintf libc.tmp > libc.ptf
5160         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5161                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5162         then
5163                 nm_opt='-p'
5164                 eval $xrun
5165         else
5166                 echo " "
5167                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5168                 com=''
5169                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5170                         for thisname in $libnames $libc; do
5171                                 $ar t $thisname >>libc.tmp
5172                         done
5173                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5174                         echo "Ok." >&4
5175                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5176                         # Repeat libc to extract forwarders to DLL entries too
5177                         for thisname in $libnames $libc; do
5178                                 $ar tv $thisname >>libc.tmp
5179                                 # Revision 50 of EMX has bug in $ar.
5180                                 # it will not extract forwarders to DLL entries
5181                                 # Use emximp which will extract exactly them.
5182                                 emximp -o tmp.imp $thisname \
5183                                     2>/dev/null && \
5184                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5185                                     < tmp.imp >>libc.tmp
5186                                 $rm tmp.imp
5187                         done
5188                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5189                         echo "Ok." >&4
5190                 else
5191                         echo "$ar didn't seem to work right." >&4
5192                         echo "Maybe this is a Cray...trying bld instead..." >&4
5193                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5194                         then
5195                                 for thisname in $libnames; do
5196                                         bld t $libnames | \
5197                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5198                                         $ar t $thisname >>libc.tmp
5199                                 done
5200                                 echo "Ok." >&4
5201                         else
5202                                 echo "That didn't work either.  Giving up." >&4
5203                                 exit 1
5204                         fi
5205                 fi
5206         fi
5207 fi
5208 nm_extract="$com"
5209 if $test -f /lib/syscalls.exp; then
5210         echo " "
5211         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5212         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5213 fi
5214 ;;
5215 esac
5216 $rm -f libnames libpath
5217
5218 : see if dld is available
5219 set dld.h i_dld
5220 eval $inhdr
5221
5222 : is a C symbol defined?
5223 csym='tlook=$1;
5224 case "$3" in
5225 -v) tf=libc.tmp; tc=""; tdc="";;
5226 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5227 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5228 esac;
5229 tx=yes;
5230 case "$reuseval-$4" in
5231 true-) ;;
5232 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5233 esac;
5234 case "$tx" in
5235 yes)
5236         case "$runnm" in
5237         true)
5238                 if $contains $tlook $tf >/dev/null 2>&1;
5239                 then tval=true;
5240                 else tval=false;
5241                 fi;;
5242         *)
5243                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5244                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5245                 then tval=true;
5246                 else tval=false;
5247                 fi;
5248                 $rm -f t t.c;;
5249         esac;;
5250 *)
5251         case "$tval" in
5252         $define) tval=true;;
5253         *) tval=false;;
5254         esac;;
5255 esac;
5256 eval "$2=$tval"'
5257
5258 : define an is-in-libc? function
5259 inlibc='echo " "; td=$define; tu=$undef;
5260 sym=$1; var=$2; eval "was=\$$2";
5261 tx=yes;
5262 case "$reuseval$was" in
5263 true) ;;
5264 true*) tx=no;;
5265 esac;
5266 case "$tx" in
5267 yes)
5268         set $sym tres -f;
5269         eval $csym;
5270         case "$tres" in
5271         true)
5272                 echo "$sym() found." >&4;
5273                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5274         *)
5275                 echo "$sym() NOT found." >&4;
5276                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5277         esac;;
5278 *)
5279         case "$was" in
5280         $define) echo "$sym() found." >&4;;
5281         *) echo "$sym() NOT found." >&4;;
5282         esac;;
5283 esac'
5284
5285 : see if dlopen exists
5286 xxx_runnm="$runnm"
5287 runnm=false
5288 set dlopen d_dlopen
5289 eval $inlibc
5290 runnm="$xxx_runnm"
5291
5292 : determine which dynamic loading, if any, to compile in
5293 echo " "
5294 dldir="ext/DynaLoader"
5295 case "$usedl" in
5296 $define|y|true)
5297         dflt='y'
5298         usedl="$define"
5299         ;;
5300 $undef|n|false)
5301         dflt='n'
5302         usedl="$undef"
5303         ;;
5304 *) 
5305         dflt='n'
5306         case "$d_dlopen" in
5307             $define) dflt='y' ;;
5308         esac
5309         case "$i_dld" in
5310             $define) dflt='y' ;;
5311         esac
5312         : Does a dl_xxx.xs file exist for this operating system
5313         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5314         ;;
5315 esac
5316 rp="Do you wish to use dynamic loading?"
5317 . ./myread
5318 usedl="$ans"
5319 case "$ans" in
5320 y*) usedl="$define"
5321         case "$dlsrc" in
5322         '')
5323                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5324                         dflt="$dldir/dl_${osname}.xs"
5325                 elif $test "$d_dlopen" = "$define" ; then
5326                         dflt="$dldir/dl_dlopen.xs"
5327                 elif $test "$i_dld" = "$define" ; then
5328                         dflt="$dldir/dl_dld.xs"
5329                 else
5330                         dflt=''
5331                 fi
5332                 ;;
5333         *)      dflt="$dldir/$dlsrc"
5334                 ;;
5335         esac
5336     echo "The following dynamic loading files are available:"
5337         : Can not go over to $dldir because getfile has path hard-coded in.
5338         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5339         rp="Source file to use for dynamic loading"
5340         fn="fne"
5341         gfpth="$src"
5342         . ./getfile
5343         usedl="$define"
5344         : emulate basename
5345         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5346
5347         $cat << EOM
5348
5349 Some systems may require passing special flags to $cc -c to
5350 compile modules that will be used to create a shared library.
5351 To use no flags, say "none".
5352
5353 EOM
5354     case "$cccdlflags" in
5355     '') case "$gccversion" in
5356                 '') case "$osname" in
5357                         hpux)   dflt='+z' ;;
5358                         next)   dflt='none' ;;
5359                         irix*)  dflt='-KPIC' ;;
5360                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5361                         sunos)  dflt='-pic' ;;
5362                         *)      dflt='none' ;;
5363                     esac
5364                         ;;
5365                 *)  case "$osname" in
5366                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5367                         *)      dflt='-fpic' ;;
5368                     esac ;;
5369             esac ;;
5370         ' ') dflt='none' ;;
5371     *)  dflt="$cccdlflags" ;;
5372     esac
5373     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5374     . ./myread
5375     case "$ans" in
5376     none) cccdlflags=' ' ;;
5377     *) cccdlflags="$ans" ;;
5378     esac
5379
5380     cat << EOM
5381
5382 Some systems use ld to create libraries that can be dynamically loaded,
5383 while other systems (such as those using ELF) use $cc.
5384
5385 EOM
5386         case "$ld" in
5387         '')     $cat >try.c <<'EOM'
5388 /* Test for whether ELF binaries are produced */
5389 #include <fcntl.h>
5390 #include <stdlib.h>
5391 int main() {
5392         char b[4];
5393         int i = open("a.out",O_RDONLY);
5394         if(i == -1) 
5395                 exit(1); /* fail */
5396         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5397                 exit(0); /* succeed (yes, it's ELF) */
5398         else
5399                 exit(1); /* fail */
5400 }
5401 EOM
5402                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5403                         cat <<EOM
5404 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5405 EOM
5406                         dflt="$cc"
5407                 else
5408                         echo "I'll use ld to build dynamic libraries."
5409                         dflt='ld'
5410                 fi
5411                 rm -f try.c a.out
5412                 ;;
5413         *)      dflt="$ld"
5414                 ;;
5415         esac
5416
5417     rp="What command should be used to create dynamic libraries?"
5418     . ./myread
5419         ld="$ans"
5420
5421     cat << EOM
5422
5423 Some systems may require passing special flags to $ld to create a
5424 library that can be dynamically loaded.  If your ld flags include
5425 -L/other/path options to locate libraries outside your loader's normal
5426 search path, you may need to specify those -L options here as well.  To
5427 use no flags, say "none".
5428
5429 EOM
5430     case "$lddlflags" in
5431     '') case "$osname" in
5432                         beos) dflt='-nostart' ;;
5433                         hpux)  dflt='-b' ;;
5434                         linux|irix*)    dflt='-shared' ;;
5435                         next)  dflt='none' ;;
5436                         solaris) dflt='-G' ;;
5437                         sunos) dflt='-assert nodefinitions' ;;
5438                         svr4*|esix*) dflt="-G $ldflags" ;;
5439                 *)     dflt='none' ;;
5440                         esac
5441                         ;;
5442     *) dflt="$lddlflags" ;;
5443     esac
5444
5445         : Try to guess additional flags to pick up local libraries.
5446         : Be careful not to append to a plain 'none'
5447         case "$dflt" in
5448         none) dflt='' ;;
5449         esac
5450         for thisflag in $ldflags; do
5451                 case "$thisflag" in
5452                 -L*)
5453                         case " $dflt " in
5454                         *" $thisflag "*) ;;
5455                         *) dflt="$dflt $thisflag" ;;
5456                         esac
5457                         ;;
5458                 esac
5459         done
5460
5461         case "$dflt" in
5462         ''|' ') dflt='none' ;;
5463         esac
5464
5465     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5466     . ./myread
5467     case "$ans" in
5468     none) lddlflags=' ' ;;
5469     *) lddlflags="$ans" ;;
5470     esac
5471
5472         cat <<EOM
5473
5474 Some systems may require passing special flags to $cc to indicate that
5475 the resulting executable will use dynamic linking.  To use no flags,
5476 say "none".
5477
5478 EOM
5479     case "$ccdlflags" in
5480     '') case "$osname" in
5481                 hpux)   dflt='-Wl,-E' ;;
5482                 linux)  dflt='-rdynamic' ;;
5483                 next)   dflt='none' ;;
5484                 sunos)  dflt='none' ;;
5485                 *)      dflt='none' ;;
5486             esac ;;
5487     ' ')  dflt='none' ;;
5488     *)  dflt="$ccdlflags" ;;
5489     esac
5490     rp="Any special flags to pass to $cc to use dynamic loading?"
5491     . ./myread
5492     case "$ans" in
5493     none) ccdlflags=' ' ;;
5494     *) ccdlflags="$ans" ;;
5495     esac
5496     ;;
5497 *)  usedl="$undef"
5498         ld='ld'
5499     dlsrc='dl_none.xs'
5500     lddlflags=''
5501     ccdlflags=''
5502     ;;
5503 esac
5504
5505 also=''
5506 case "$usedl" in
5507 $undef)
5508         # No dynamic loading being used, so don't bother even to prompt.
5509         useshrplib='false'
5510         ;;
5511 *)      case "$useshrplib" in
5512         '')     case "$osname" in
5513                 svr4*|dgux|dynixptx|esix|powerux|beos)
5514                         dflt=y
5515                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5516                         ;;
5517                 next*)
5518                         case "$osvers" in
5519                         4*)     dflt=y
5520                                 also='Building a shared libperl is needed for MAB support.'
5521                                 ;;
5522                         *)      dflt=n
5523                                 ;;
5524                         esac
5525                         ;;
5526                 *)      dflt=n
5527                         ;;
5528                 esac
5529                 ;;
5530         $define|true|[Yy]*)
5531                 dflt=y
5532                 ;;
5533         *)      dflt=n
5534                 ;;
5535         esac
5536         $cat << EOM
5537
5538 The perl executable is normally obtained by linking perlmain.c with
5539 libperl${_a}, any static extensions (usually just DynaLoader), and
5540 any other libraries needed on this system (such as -lm, etc.).  Since
5541 your system supports dynamic loading, it is probably possible to build
5542 a shared libperl.$so.  If you will have more than one executable linked
5543 to libperl.$so, this will significantly reduce the size of each
5544 executable, but it may have a noticeable affect on performance.  The
5545 default is probably sensible for your system.
5546 $also
5547
5548 EOM
5549         rp="Build a shared libperl.$so (y/n)"
5550         . ./myread
5551         case "$ans" in
5552         true|$define|[Yy]*)
5553                 useshrplib='true'  ;;
5554         *)      useshrplib='false' ;;
5555         esac
5556         ;;
5557 esac
5558
5559 case "$useshrplib" in
5560 true)
5561         case "$libperl" in
5562         '')
5563                 # Figure out a good name for libperl.so.  Since it gets stored in
5564                 # a version-specific architecture-dependent library, the version
5565                 # number isn't really that important, except for making cc/ld happy.
5566                 #
5567                 # A name such as libperl.so.3.1
5568                 majmin="libperl.$so.$patchlevel.$subversion"
5569                 # A name such as libperl.so.301
5570                 majonly=`echo $patchlevel $subversion |
5571                         $awk '{printf "%d%02d", $1, $2}'`
5572                 majonly=libperl.$so.$majonly
5573                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5574                 # rely on figuring it out from the naming of libc.
5575                 case "${osname}${osvers}" in
5576                 next4*)
5577                         dflt=libperl.5.$so
5578                         # XXX How handle the --version stuff for MAB?
5579                         ;;
5580                 linux*)  # ld won't link with a bare -lperl otherwise.
5581                         dflt=libperl.$so
5582                         ;;
5583                 *)      # Try to guess based on whether libc has major.minor.
5584                         case "$libc" in
5585                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5586                         *libc.$so.[0-9]*) dflt=$majonly ;;
5587                         *)      dflt=libperl.$so ;;
5588                         esac
5589                         ;;
5590                 esac
5591                 ;;
5592         *)      dflt=$libperl
5593                 ;;
5594         esac
5595         cat << EOM
5596
5597 I need to select a good name for the shared libperl.  If your system uses
5598 library names with major and minor numbers, then you might want something
5599 like $majmin.  Alternatively, if your system uses a single version
5600 number for shared libraries, then you might want to use $majonly.
5601 Or, your system might be quite happy with a simple libperl.$so.
5602
5603 Since the shared libperl will get installed into a version-specific
5604 architecture-dependent directory, the version number of the shared perl
5605 library probably isn't important, so the default should be o.k.
5606
5607 EOM
5608         rp='What name do you want to give to the shared libperl?'
5609         . ./myread
5610         libperl=$ans
5611         echo "Ok, I'll use $libperl"
5612         ;;
5613 *)
5614         libperl="libperl${_a}"
5615         ;;
5616 esac
5617
5618 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5619 case "$shrpdir" in
5620 '') ;;
5621 *)      $cat >&4 <<EOM
5622 WARNING:  Use of the shrpdir variable for the installation location of
5623 the shared $libperl is not supported.  It was never documented and
5624 will not work in this version.  Let me (perlbug@perl.com)
5625 know of any problems this may cause.
5626
5627 EOM
5628         case "$shrpdir" in
5629         "$archlibexp/CORE")
5630                 $cat >&4 <<EOM
5631 But your current setting of $shrpdir is
5632 the default anyway, so it's harmless.
5633 EOM
5634                 ;;
5635         *)
5636                 $cat >&4 <<EOM
5637 Further, your current attempted setting of $shrpdir
5638 conflicts with the value of $archlibexp/CORE
5639 that installperl will use.
5640 EOM
5641                 ;;
5642         esac
5643         ;;
5644 esac
5645
5646 # How will the perl executable find the installed shared $libperl?
5647 # Add $xxx to ccdlflags.
5648 # If we can't figure out a command-line option, use $shrpenv to
5649 # set env LD_RUN_PATH.  The main perl makefile uses this.
5650 shrpdir=$archlibexp/CORE
5651 xxx=''
5652 tmp_shrpenv=''
5653 if "$useshrplib"; then
5654     case "$osname" in 
5655         aix)
5656                 # We'll set it in Makefile.SH...
5657                 ;;
5658         solaris|netbsd)
5659                 xxx="-R $shrpdir"
5660                 ;;
5661         freebsd)
5662                 xxx="-Wl,-R$shrpdir"
5663                 ;;
5664         linux|irix*|dec_osf)
5665                 xxx="-Wl,-rpath,$shrpdir"
5666                 ;;
5667         next)
5668                 # next doesn't like the default...
5669                 ;;
5670         beos)
5671                 # beos doesn't like the default, either.
5672                 ;;
5673         hpux*)
5674                 # hpux doesn't like the default, either.
5675                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5676                 ;;
5677         *)
5678                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5679                 ;;
5680         esac
5681         case "$xxx" in
5682         '') ;;
5683         *)      
5684                 # Only add $xxx if it isn't already in ccdlflags.
5685                 case " $ccdlflags " in
5686                 *" $xxx "*)     ;;
5687                 *)      ccdlflags="$ccdlflags $xxx"
5688                         cat <<EOM >&4
5689
5690 Adding $xxx to the flags
5691 passed to $ld so that the perl executable will find the 
5692 installed shared $libperl.
5693
5694 EOM
5695                         ;;
5696                 esac
5697                 ;;
5698         esac
5699 fi
5700 # Fix ccdlflags in AIX for building external extensions.
5701 # (For building Perl itself bare -bE:perl.exp is needed,
5702 #  Makefile.SH takes care of this.)
5703 case "$osname" in
5704 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5705 esac
5706 # Respect a hint or command-line value.
5707 case "$shrpenv" in
5708 '') shrpenv="$tmp_shrpenv" ;;
5709 esac
5710 case "$ldlibpthname" in
5711 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5712 none)   ldlibpthname='' ;;
5713 esac
5714
5715 : determine where manual pages go
5716 set man1dir man1dir none
5717 eval $prefixit
5718 $cat <<EOM
5719
5720 $spackage has manual pages available in source form.
5721 EOM
5722 case "$nroff" in
5723 nroff)
5724         echo "However, you don't have nroff, so they're probably useless to you."
5725         case "$man1dir" in
5726         '') man1dir="none";;
5727         esac;;
5728 esac
5729 echo "If you don't want the manual sources installed, answer 'none'."
5730 case "$man1dir" in
5731 ' ') dflt=none
5732         ;;
5733 '')
5734         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5735         lookpath="$lookpath $prefixexp/man/p_man/man1"
5736         lookpath="$lookpath $prefixexp/man/u_man/man1"
5737         lookpath="$lookpath $prefixexp/man/man.1"
5738         case "$sysman" in
5739         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5740         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5741         esac
5742         set dflt
5743         eval $prefixup
5744         ;;
5745 *)  dflt="$man1dir"
5746         ;;
5747 esac
5748 echo " "
5749 fn=dn+~
5750 rp="Where do the main $spackage manual pages (source) go?"
5751 . ./getfile
5752 if $test "X$man1direxp" != "X$ansexp"; then
5753         installman1dir=''
5754 fi
5755 man1dir="$ans"
5756 man1direxp="$ansexp"
5757 case "$man1dir" in
5758 '')     man1dir=' '
5759         installman1dir='';;
5760 esac
5761
5762 : Change installation prefix, if necessary.
5763 if $test X"$prefix" != X"$installprefix"; then
5764         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
5765 else
5766         installman1dir="$man1direxp"
5767 fi
5768
5769 : What suffix to use on installed man pages
5770
5771 case "$man1dir" in
5772 ' ')
5773         man1ext='0'
5774         ;;
5775 *)
5776         rp="What suffix should be used for the main $spackage man pages?"
5777         case "$man1ext" in
5778         '')     case "$man1dir" in
5779                 *1)  dflt=1 ;;
5780                 *1p) dflt=1p ;;
5781                 *1pm) dflt=1pm ;;
5782                 *l) dflt=l;;
5783                 *n) dflt=n;;
5784                 *o) dflt=o;;
5785                 *p) dflt=p;;
5786                 *C) dflt=C;;
5787                 *L) dflt=L;;
5788                 *L1) dflt=L1;;
5789                 *) dflt=1;;
5790                 esac
5791                 ;;
5792         *)      dflt="$man1ext";;
5793         esac
5794         . ./myread
5795         man1ext="$ans"
5796         ;;
5797 esac
5798
5799 : see if we can have long filenames
5800 echo " "
5801 rmlist="$rmlist /tmp/cf$$"
5802 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5803 first=123456789abcdef
5804 second=/tmp/cf$$/$first
5805 $rm -f $first $second
5806 if (echo hi >$first) 2>/dev/null; then
5807         if $test -f 123456789abcde; then
5808                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5809                 val="$undef"
5810         else
5811                 if (echo hi >$second) 2>/dev/null; then
5812                         if $test -f /tmp/cf$$/123456789abcde; then
5813                                 $cat <<'EOM'
5814 That's peculiar... You can have filenames longer than 14 characters, but only
5815 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5816 I shall consider your system cannot support long filenames at all.
5817 EOM
5818                                 val="$undef"
5819                         else
5820                                 echo 'You can have filenames longer than 14 characters.' >&4
5821                                 val="$define"
5822                         fi
5823                 else
5824                         $cat <<'EOM'
5825 How confusing! Some of your filesystems are sane enough to allow filenames
5826 longer than 14 characters but some others like /tmp can't even think about them.
5827 So, for now on, I shall assume your kernel does not allow them at all.
5828 EOM
5829                         val="$undef"
5830                 fi
5831         fi
5832 else
5833         $cat <<'EOM'
5834 You can't have filenames longer than 14 chars.  You can't even think about them!
5835 EOM
5836         val="$undef"
5837 fi 
5838 set d_flexfnam
5839 eval $setvar
5840 $rm -rf /tmp/cf$$ 123456789abcde*
5841
5842 : determine where library module manual pages go
5843 set man3dir man3dir none
5844 eval $prefixit
5845 $cat <<EOM
5846
5847 $spackage has manual pages for many of the library modules.
5848 EOM
5849
5850 case "$nroff" in
5851 nroff)
5852         $cat <<'EOM'
5853 However, you don't have nroff, so they're probably useless to you.
5854 EOM
5855         case "$man3dir" in
5856         '') man3dir="none";;
5857         esac;;
5858 esac
5859
5860 case "$d_flexfnam" in
5861 undef)
5862         $cat <<'EOM'
5863 However, your system can't handle the long file names like File::Basename.3. 
5864 EOM
5865         case "$man3dir" in
5866         '') man3dir="none";;
5867         esac;;
5868 esac
5869
5870 echo "If you don't want the manual sources installed, answer 'none'."
5871 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5872 case "$man3dir" in
5873 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5874         if $test -d "$privlib/man/man3"; then
5875                 cat <<EOM >&4
5876
5877 WARNING:  Previous versions of perl installed man3 pages into
5878 $privlib/man/man3.  This version will suggest a 
5879 new default of $dflt.  
5880 EOM
5881                 tdflt=$dflt
5882                 dflt='n'
5883                 rp='Do you wish to preserve the old behavior?(y/n)'
5884                 . ./myread
5885                 case "$ans" in
5886                 y*) dflt="$privlib/man/man3" ;;
5887                 *)  dflt=$tdflt ;;
5888                 esac
5889     fi
5890         ;;
5891 ' ') dflt=none;;
5892 *)      dflt="$man3dir" ;;
5893 esac
5894 echo " "
5895 fn=dn+~
5896 rp="Where do the $package library man pages (source) go?"
5897 . ./getfile
5898 man3dir="$ans"
5899 man3direxp="$ansexp"
5900 case "$man1dir" in
5901 '')     man3dir=' '
5902         installman3dir='';;
5903 esac
5904
5905 : Change installation prefix, if necessary.
5906 if $test X"$prefix" != X"$installprefix"; then
5907         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
5908 else
5909         installman3dir="$man3direxp"
5910 fi
5911
5912 : What suffix to use on installed man pages
5913 case "$man3dir" in
5914 ' ')
5915         man3ext='0'
5916         ;;
5917 *)
5918         rp="What suffix should be used for the $package library man pages?"
5919         case "$man3ext" in
5920         '')     case "$man3dir" in
5921                 *3)  dflt=3 ;;
5922                 *3p) dflt=3p ;;
5923                 *3pm) dflt=3pm ;;
5924                 *l) dflt=l;;
5925                 *n) dflt=n;;
5926                 *o) dflt=o;;
5927                 *p) dflt=p;;
5928                 *C) dflt=C;;
5929                 *L) dflt=L;;
5930                 *L3) dflt=L3;;
5931                 *) dflt=3;;
5932                 esac
5933                 ;;
5934         *)      dflt="$man3ext";;
5935         esac
5936         . ./myread
5937         man3ext="$ans"
5938         ;;
5939 esac
5940
5941 : see if we have to deal with yellow pages, now NIS.
5942 if $test -d /usr/etc/yp || $test -d /etc/yp; then
5943         if $test -f /usr/etc/nibindd; then
5944                 echo " "
5945                 echo "I'm fairly confident you're on a NeXT."
5946                 echo " "
5947                 rp='Do you get the hosts file via NetInfo?'
5948                 dflt=y
5949                 case "$hostcat" in
5950                 nidump*) ;;
5951                 '') ;;
5952                 *) dflt=n;;
5953                 esac
5954                 . ./myread
5955                 case "$ans" in
5956                 y*) hostcat='nidump hosts .';;
5957                 *)      case "$hostcat" in
5958                         nidump*) hostcat='';;
5959                         esac
5960                         ;;
5961                 esac
5962         fi
5963         case "$hostcat" in
5964         nidump*) ;;
5965         *)
5966                 case "$hostcat" in
5967                 *ypcat*) dflt=y;;
5968                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5969                                 dflt=y
5970                         else
5971                                 dflt=n
5972                         fi;;
5973                 *) dflt=n;;
5974                 esac
5975                 echo " "
5976                 rp='Are you getting the hosts file via yellow pages?'
5977                 . ./myread
5978                 case "$ans" in
5979                 y*) hostcat='ypcat hosts';;
5980                 *) hostcat='cat /etc/hosts';;
5981                 esac
5982                 ;;
5983         esac
5984 fi
5985 case "$hostcat" in
5986 '') hostcat='cat /etc/hosts';;
5987 esac
5988 case "$groupcat" in
5989 '') groupcat='cat /etc/group';;
5990 esac
5991 case "$passcat" in
5992 '') passcat='cat /etc/passwd';;
5993 esac
5994
5995 : now get the host name
5996 echo " "
5997 echo "Figuring out host name..." >&4
5998 case "$myhostname" in
5999 '') cont=true
6000         echo 'Maybe "hostname" will work...'
6001         if tans=`sh -c hostname 2>&1` ; then
6002                 myhostname=$tans
6003                 phostname=hostname
6004                 cont=''
6005         fi
6006         ;;
6007 *) cont='';;
6008 esac
6009 if $test "$cont"; then
6010         if ./xenix; then
6011                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6012                 if tans=`cat /etc/systemid 2>&1` ; then
6013                         myhostname=$tans
6014                         phostname='cat /etc/systemid'
6015                         echo "Whadyaknow.  Xenix always was a bit strange..."
6016                         cont=''
6017                 fi
6018         elif $test -r /etc/systemid; then
6019                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6020         fi
6021 fi
6022 if $test "$cont"; then
6023         echo 'No, maybe "uuname -l" will work...'
6024         if tans=`sh -c 'uuname -l' 2>&1` ; then
6025                 myhostname=$tans
6026                 phostname='uuname -l'
6027         else
6028                 echo 'Strange.  Maybe "uname -n" will work...'
6029                 if tans=`sh -c 'uname -n' 2>&1` ; then
6030                         myhostname=$tans
6031                         phostname='uname -n'
6032                 else
6033                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6034                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6035                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6036                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6037                         else
6038                                 case "$myhostname" in
6039                                 '') echo "Does this machine have an identity crisis or something?"
6040                                         phostname='';;
6041                                 *)
6042                                         echo "Well, you said $myhostname before..."
6043                                         phostname='echo $myhostname';;
6044                                 esac
6045                         fi
6046                 fi
6047         fi
6048 fi
6049 : you do not want to know about this
6050 set $myhostname
6051 myhostname=$1
6052
6053 : verify guess
6054 if $test "$myhostname" ; then
6055         dflt=y
6056         rp='Your host name appears to be "'$myhostname'".'" Right?"
6057         . ./myread
6058         case "$ans" in
6059         y*) ;;
6060         *) myhostname='';;
6061         esac
6062 fi
6063
6064 : bad guess or no guess
6065 while $test "X$myhostname" = X ; do
6066         dflt=''
6067         rp="Please type the (one word) name of your host:"
6068         . ./myread
6069         myhostname="$ans"
6070 done
6071
6072 : translate upper to lower if necessary
6073 case "$myhostname" in
6074 *[A-Z]*)
6075         echo "(Normalizing case in your host name)"
6076         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6077         ;;
6078 esac
6079
6080 case "$myhostname" in
6081 *.*)
6082         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6083         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6084         echo "(Trimming domain name from host name--host name is now $myhostname)"
6085         ;;
6086 *) case "$mydomain" in
6087         '')
6088                 {
6089                         test "X$hostcat" = "Xypcat hosts" &&
6090                         ypmatch "$myhostname" hosts 2>/dev/null |\
6091                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6092                         $test -s hosts
6093                 } || {
6094                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6095                                         /[       ]$myhostname[  . ]/p" > hosts
6096                 }
6097                 tmp_re="[       . ]"
6098                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6099                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6100                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6101                         hosts | $sort | $uniq | \
6102                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6103                 case `$echo X$dflt` in
6104                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6105                         dflt=.
6106                         ;;
6107                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6108                         ;;
6109                 esac
6110                 case "$dflt" in
6111                 .)
6112                         tans=`./loc resolv.conf X /etc /usr/etc`
6113                         if $test -f "$tans"; then
6114                                 echo "(Attempting domain name extraction from $tans)"
6115                                 dflt=.`$sed -n -e 's/   / /g' \
6116                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6117                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6118                                 case "$dflt" in
6119                                 .) dflt=.`$sed -n -e 's/        / /g' \
6120                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6121                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6122                                         ;;
6123                                 esac
6124                         fi
6125                         ;;
6126                 esac
6127                 case "$dflt" in
6128                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6129                         dflt=.`sh -c domainname 2>/dev/null`
6130                         case "$dflt" in
6131                         '') dflt='.';;
6132                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6133                         esac
6134                         ;;
6135                 esac
6136                 case "$dflt" in
6137                 .) echo "(Lost all hope -- silly guess then)"
6138                         dflt='.uucp'
6139                         ;;
6140                 esac
6141                 $rm -f hosts
6142                 ;;
6143         *) dflt="$mydomain";;
6144         esac;;
6145 esac
6146 echo " "
6147 rp="What is your domain name?"
6148 . ./myread
6149 tans="$ans"
6150 case "$ans" in
6151 '') ;;
6152 .*) ;;
6153 *) tans=".$tans";;
6154 esac
6155 mydomain="$tans"
6156
6157 : translate upper to lower if necessary
6158 case "$mydomain" in
6159 *[A-Z]*)
6160         echo "(Normalizing case in your domain name)"
6161         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6162         ;;
6163 esac
6164
6165 : a little sanity check here
6166 case "$phostname" in
6167 '') ;;
6168 *)
6169         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6170         $myhostname$mydomain|$myhostname) ;;
6171         *)
6172                 case "$phostname" in
6173                 sed*)
6174                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6175                         ;;
6176                 *)
6177                         echo "(That doesn't agree with your $phostname command, by the way.)"
6178                         ;;
6179                 esac
6180         ;;
6181         esac
6182         ;;
6183 esac
6184
6185 $cat <<EOM
6186
6187 I need to get your e-mail address in Internet format if possible, i.e.
6188 something like user@host.domain. Please answer accurately since I have
6189 no easy means to double check it. The default value provided below
6190 is most probably close to the reality but may not be valid from outside
6191 your organization...
6192
6193 EOM
6194 cont=x
6195 while test "$cont"; do
6196         case "$cf_email" in
6197         '') dflt="$cf_by@$myhostname$mydomain";;
6198         *) dflt="$cf_email";;
6199         esac
6200         rp='What is your e-mail address?'
6201         . ./myread
6202         cf_email="$ans"
6203         case "$cf_email" in
6204         *@*.*) cont='' ;;
6205         *)
6206                 rp='Address does not look like an Internet one.  Use it anyway?'
6207                 case "$fastread" in
6208                 yes) dflt=y ;;
6209                 *) dflt=n ;;
6210                 esac
6211                 . ./myread
6212                 case "$ans" in
6213                 y*) cont='' ;;
6214                 *) echo " " ;;
6215                 esac
6216                 ;;
6217         esac
6218 done
6219
6220 $cat <<EOM
6221
6222 If you or somebody else will be maintaining perl at your site, please
6223 fill in the correct e-mail address here so that they may be contacted
6224 if necessary. Currently, the "perlbug" program included with perl
6225 will send mail to this address in addition to perlbug@perl.com. You may
6226 enter "none" for no administrator.
6227
6228 EOM
6229 case "$perladmin" in
6230 '') dflt="$cf_email";;
6231 *) dflt="$perladmin";;
6232 esac
6233 rp='Perl administrator e-mail address'
6234 . ./myread
6235 perladmin="$ans"
6236
6237 : figure out how to guarantee perl startup
6238 case "$startperl" in
6239 '')
6240         case "$sharpbang" in
6241         *!)
6242                 $cat <<EOH
6243
6244 I can use the #! construct to start perl on your system. This will
6245 make startup of perl scripts faster, but may cause problems if you
6246 want to share those scripts and perl is not in a standard place
6247 ($binexp/perl) on all your platforms. The alternative is to force
6248 a shell by starting the script with a single ':' character.
6249
6250 EOH
6251                 dflt="$binexp/perl"
6252                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6253                 . ./myread
6254                 case "$ans" in
6255                 none)   startperl=": # use perl";;
6256                 *)      startperl="#!$ans"
6257                         if $test 30 -lt `echo "$ans" | wc -c`; then
6258                                 $cat >&4 <<EOM
6259
6260 WARNING:  Some systems limit the #! command to 32 characters.
6261 If you experience difficulty running Perl scripts with #!, try
6262 installing Perl in a directory with a shorter pathname.
6263
6264 EOM
6265                         fi ;;
6266                 esac
6267                 ;;
6268         *) startperl=": # use perl"
6269                 ;;
6270         esac
6271         ;;
6272 esac
6273 echo "I'll use $startperl to start perl scripts."
6274
6275 : figure best path for perl in scripts
6276 case "$perlpath" in
6277 '')
6278         perlpath="$binexp/perl"
6279         case "$startperl" in
6280         *!*) ;;
6281         *)
6282                 $cat <<EOH
6283
6284 I will use the "eval 'exec'" idiom to start Perl on your system.
6285 I can use the full path of your Perl binary for this purpose, but
6286 doing so may cause problems if you want to share those scripts and
6287 Perl is not always in a standard place ($binexp/perl).
6288
6289 EOH
6290                 dflt="$binexp/perl"
6291                 rp="What path shall I use in \"eval 'exec'\"?"
6292                 . ./myread
6293                 perlpath="$ans"
6294                 ;;
6295         esac
6296         ;;
6297 esac
6298 case "$startperl" in
6299 *!*)    ;;
6300 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6301 esac
6302
6303 : determine where public executable scripts go
6304 set scriptdir scriptdir
6305 eval $prefixit
6306 case "$scriptdir" in
6307 '')
6308         dflt="$bin"
6309         : guess some guesses
6310         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6311         $test -d /usr/share/bin     && dflt=/usr/share/bin
6312         $test -d /usr/local/script  && dflt=/usr/local/script
6313         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6314         $test -d $prefixexp/script  && dflt=$prefixexp/script
6315         set dflt
6316         eval $prefixup
6317         ;;
6318 *)  dflt="$scriptdir"
6319         ;;
6320 esac
6321 $cat <<EOM
6322  
6323 Some installations have a separate directory just for executable scripts so
6324 that they can mount it across multiple architectures but keep the scripts in
6325 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6326 Or you might just lump your scripts in with all your other executables.
6327  
6328 EOM
6329 fn=d~
6330 rp='Where do you keep publicly executable scripts?'
6331 . ./getfile
6332 if $test "X$ansexp" != "X$scriptdirexp"; then
6333         installscript=''
6334 fi
6335 scriptdir="$ans"
6336 scriptdirexp="$ansexp"
6337 : Change installation prefix, if necessary.
6338 if $test X"$prefix" != X"$installprefix"; then
6339         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6340 else
6341         installscript="$scriptdirexp"
6342 fi
6343
6344 $cat <<EOM
6345
6346 After $package is installed, you may wish to install various
6347 add-on modules and utilities.  Typically, these add-ons will
6348 be installed under $prefix with the rest
6349 of this package.  However, you may wish to install such add-ons
6350 elsewhere under a different prefix.
6351
6352 If you do not wish to put everything under a single prefix, that's
6353 ok.  You will be prompted for the individual locations; this siteprefix
6354 is only used to suggest the defaults.
6355
6356 The default should be fine for most people.
6357
6358 EOM
6359 fn=d~+
6360 rp='Installation prefix to use for add-on modules and utilities?'
6361 : XXX Here might be another good place for an installstyle setting.
6362 case "$siteprefix" in
6363 '') dflt=$prefix ;;
6364 *)  dflt=$siteprefix ;;
6365 esac
6366 . ./getfile
6367 oldsiteprefix=''
6368 case "$siteprefix" in
6369 '') ;;
6370 *)
6371         case "$ans" in
6372         "$prefix") ;;
6373         *) oldsiteprefix="$prefix";;
6374         esac
6375         ;;
6376 esac
6377 siteprefix="$ans"
6378 siteprefixexp="$ansexp"
6379
6380 : determine where site specific libraries go.
6381 : Usual default is /usr/local/lib/perl5/site_perl
6382 : The default "style" setting is made in installstyle.U
6383 : XXX No longer works with Prefixit stuff.
6384 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6385 case "$installstyle" in
6386 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6387 *)       dflt=$siteprefix/lib/site_$prog ;;
6388 esac
6389 $cat <<EOM
6390
6391 The installation process will create a directory for
6392 site-specific extensions and modules.  Most users find it convenient
6393 to place all site-specific files in this directory rather than in the
6394 main distribution directory.
6395
6396 EOM
6397 fn=d~+
6398 rp='Pathname for the site-specific library files?'
6399 . ./getfile
6400 sitelib="$ans"
6401 sitelibexp="$ansexp"
6402 : Change installation prefix, if necessary.
6403 if $test X"$prefix" != X"$installprefix"; then
6404         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6405 else
6406         installsitelib="$sitelibexp"
6407 fi
6408
6409 : determine where site specific architecture-dependent libraries go.
6410 : sitelib  default is /usr/local/lib/perl5/site_perl/
6411 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6412 : sitelib may have an optional trailing /share.
6413 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6414 tdflt="$tdflt/$apiversion/$archname"
6415 set sitearch sitearch none
6416 eval $prefixit
6417 case "$sitearch" in
6418 '')     dflt="$tdflt" ;;
6419 *)      dflt="$sitearch" ;;
6420 esac
6421 $cat <<EOM
6422
6423 The installation process will also create a directory for
6424 architecture-dependent site-specific extensions and modules.
6425
6426 EOM
6427 fn=nd~+
6428 rp='Pathname for the site-specific architecture-dependent library files?'
6429 . ./getfile
6430 sitearch="$ans"
6431 sitearchexp="$ansexp"
6432 : Change installation prefix, if necessary.
6433 if $test X"$prefix" != X"$installprefix"; then
6434         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6435 else
6436         installsitearch="$sitearchexp"
6437 fi
6438
6439 cat <<EOM
6440
6441 Perl can be built to take advantage of long doubles which
6442 (if available) may give more accuracy and range for floating point
6443 numbers.  To do so, Configure must be run with -Duselongdouble.
6444
6445 If this doesn't make any sense to you, just accept the default 'n'.
6446 EOM
6447 case "$uselongdouble" in
6448 $define|true|[yY]*)     dflt='y';;
6449 *) dflt='n';;
6450 esac
6451 rp='Try to use long doubles if available?'
6452 . ./myread
6453 case "$ans" in
6454 y|Y)    val="$define"   ;;
6455 *)      val="$undef"    ;;
6456 esac
6457 set uselongdouble
6458 eval $setvar
6459
6460 case "$uselongdouble" in
6461 "$define"|true|[yY]*)
6462 : Look for a hint-file generated 'call-back-unit'.  If the
6463 : user has specified that long doubles should be used,
6464 : we may need to set or change some other defaults.
6465         if $test -f uselongdouble.cbu; then
6466                 echo "Your platform has some specific hints for long doubles, using them..."
6467                 . ./uselongdouble.cbu
6468         else
6469                 $cat <<EOM
6470 (Your platform doesn't have any specific hints for long doubles.)
6471 EOM
6472         fi
6473         ;;
6474 esac
6475
6476 cat <<EOM
6477
6478 Previous version of $package used the standard IO mechanisms as defined
6479 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6480 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6481 the default.  This abstraction layer can use AT&T's sfio (if you already
6482 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6483 problems with some extension modules.  Using PerlIO with stdio is safe,
6484 but it is slower than plain stdio and therefore is not the default.
6485
6486 If this doesn't make any sense to you, just accept the default 'n'.
6487 EOM
6488 case "$useperlio" in
6489 $define|true|[yY]*)     dflt='y';;
6490 *) dflt='n';;
6491 esac
6492 rp='Use the experimental PerlIO abstraction layer?'
6493 . ./myread
6494 case "$ans" in
6495 y|Y) 
6496         val="$define"
6497         ;;     
6498 *)      
6499         echo "Ok, doing things the stdio way"
6500         val="$undef"
6501         ;;
6502 esac
6503 set useperlio
6504 eval $setvar 
6505
6506 : Check how to convert floats to strings.
6507 if test "X$d_Gconvert" = X; then
6508         echo " "
6509         echo "Checking for an efficient way to convert floats to strings."
6510         $cat >try.c <<'EOP'
6511 #ifdef TRY_gconvert
6512 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6513 char *myname = "gconvert";
6514 #endif
6515 #ifdef TRY_gcvt
6516 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6517 char *myname = "gcvt";
6518 #endif
6519 #ifdef TRY_sprintf
6520 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6521 char *myname = "sprintf";
6522 #endif
6523
6524 #include <stdio.h>
6525
6526 int
6527 checkit(expect, got)
6528 char *expect;
6529 char *got;
6530 {
6531     if (strcmp(expect, got)) {
6532                 printf("%s oddity:  Expected %s, got %s\n",
6533                         myname, expect, got);
6534                 exit(1);
6535         }
6536 }
6537
6538 int main()
6539
6540         char buf[64]; 
6541         buf[63] = '\0';
6542
6543         /* This must be 1st test on (which?) platform */
6544         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6545         Gconvert(0.1, 8, 0, buf);
6546         checkit("0.1", buf);
6547
6548         Gconvert(1.0, 8, 0, buf); 
6549         checkit("1", buf);
6550
6551         Gconvert(0.0, 8, 0, buf); 
6552         checkit("0", buf);
6553
6554         Gconvert(-1.0, 8, 0, buf); 
6555         checkit("-1", buf);
6556
6557         /* Some Linux gcvt's give 1.e+5 here. */
6558         Gconvert(100000.0, 8, 0, buf); 
6559         checkit("100000", buf);
6560         
6561         /* Some Linux gcvt's give -1.e+5 here. */
6562         Gconvert(-100000.0, 8, 0, buf); 
6563         checkit("-100000", buf);
6564
6565         exit(0);
6566 }
6567 EOP
6568         case "$d_Gconvert" in
6569         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6570         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6571         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6572         *) xxx_list='gconvert gcvt sprintf' ;;
6573         esac
6574
6575         for xxx_convert in $xxx_list; do
6576                 echo "Trying $xxx_convert"
6577                 $rm -f try try$_o
6578                 set try -DTRY_$xxx_convert
6579                 if eval $compile; then
6580                         echo "$xxx_convert" found. >&4
6581                         if ./try; then
6582                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6583                                 break;
6584                         else
6585                                 echo "...But $xxx_convert didn't work as I expected."
6586                         fi
6587                 else
6588                         echo "$xxx_convert NOT found." >&4
6589                 fi
6590         done
6591                 
6592         case "$xxx_convert" in
6593         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6594         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6595         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6596         esac
6597 fi
6598
6599 : see if inttypes.h is available
6600 : we want a real compile instead of Inhdr because some systems
6601 : have an inttypes.h which includes non-existent headers
6602 echo " "
6603 $cat >try.c <<EOCP
6604 #include <inttypes.h>
6605 int main() {
6606         static int32_t foo32 = 0x12345678;
6607 }
6608 EOCP
6609 set try
6610 if eval $compile; then
6611         echo "<inttypes.h> found." >&4
6612         val="$define"
6613 else
6614         echo "<inttypes.h> NOT found." >&4
6615         val="$undef"
6616 fi
6617 $rm -f try.c try
6618 set i_inttypes
6619 eval $setvar
6620
6621 : check for int64_t
6622 case "$use64bits" in
6623 "$define" )
6624         echo " "
6625         echo $n "Checking to see if your system supports int64_t...$c" >&4
6626         $cat >try.c <<EOCP
6627 #include <sys/types.h>
6628 #$i_inttypes I_INTTYPES
6629 #ifdef I_INTTYPES
6630 #include <inttypes.h>
6631 #endif
6632 int64_t foo() { int64_t x; x = 7; return x; }
6633 EOCP
6634         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6635                 val="$define"
6636                 echo " Yup, it does." >&4
6637         else
6638                 val="$undef"
6639                 echo " Nope, it doesn't." >&4
6640         fi
6641         $rm -f try.*
6642         ;;
6643 *)      val="$undef"
6644         ;;
6645 esac
6646 set d_int64t
6647 eval $setvar
6648
6649
6650 : check for lengths of integral types
6651 echo " "
6652 case "$intsize" in
6653 '')
6654         echo "Checking to see how big your integers are..." >&4
6655         $cat >intsize.c <<'EOCP'
6656 #include <stdio.h>
6657 int main()
6658 {
6659         printf("intsize=%d;\n", sizeof(int));
6660         printf("longsize=%d;\n", sizeof(long));
6661         printf("shortsize=%d;\n", sizeof(short));
6662         exit(0);
6663 }
6664 EOCP
6665         set intsize
6666         if eval $compile_ok && ./intsize > /dev/null; then
6667                 eval `./intsize`
6668                 echo "Your integers are $intsize bytes long."
6669                 echo "Your long integers are $longsize bytes long."
6670                 echo "Your short integers are $shortsize bytes long."
6671         else
6672                 $cat >&4 <<EOM
6673 !
6674 Help! I can't compile and run the intsize test program: please enlighten me!
6675 (This is probably a misconfiguration in your system or libraries, and
6676 you really ought to fix it.  Still, I'll try anyway.)
6677 !
6678 EOM
6679                 dflt=4
6680                 rp="What is the size of an integer (in bytes)?"
6681                 . ./myread
6682                 intsize="$ans"
6683                 dflt=$intsize
6684                 rp="What is the size of a long integer (in bytes)?"
6685                 . ./myread
6686                 longsize="$ans"
6687                 dflt=2
6688                 rp="What is the size of a short integer (in bytes)?"
6689                 . ./myread
6690                 shortsize="$ans"
6691         fi
6692         ;;
6693 esac
6694 $rm -f intsize intsize.*
6695
6696 : check for long long
6697 echo " "
6698 echo $n "Checking to see if your system supports long long...$c" >&4
6699 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6700 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6701         val="$define"
6702         echo " Yup, it does." >&4
6703 else
6704         val="$undef"
6705         echo " Nope, it doesn't." >&4
6706 fi
6707 $rm try.*
6708 set d_longlong
6709 eval $setvar
6710
6711 : check for length of long long
6712 case "${d_longlong}${longlongsize}" in
6713 $define)
6714         echo " "
6715         $echo $n "Checking to see how big your long longs are...$c" >&4
6716         $cat >try.c <<'EOCP'
6717 #include <stdio.h>
6718 int main()
6719 {
6720         printf("%d\n", sizeof(long long));
6721 }
6722 EOCP
6723         set try
6724         if eval $compile_ok; then
6725                 longlongsize=`./try`
6726                 $echo " $longlongsize bytes." >&4
6727         else
6728                 dflt='8'
6729                 echo " "
6730                 echo "(I can't seem to compile the test program.  Guessing...)"
6731                 rp="What is the size of a long long (in bytes)?"
6732                 . ./myread
6733                 longlongsize="$ans"
6734         fi
6735         if $test "X$longsize" = "X$longlongsize"; then
6736                 echo "(That isn't any different from an ordinary long.)"
6737         fi      
6738         ;;
6739 esac
6740 $rm -f try.c try
6741
6742 echo " "
6743
6744 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6745
6746 echo "Checking how to print 64-bit integers..." >&4
6747
6748 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6749         quad=int
6750         $cat >try.c <<'EOCP'
6751 #include <sys/types.h>
6752 #include <stdio.h>
6753 int main() {
6754   int q = 12345678901;
6755   printf("%ld\n", q);
6756 }
6757 EOCP
6758         set try
6759         if eval $compile; then
6760                 yyy=`./try$exe_ext`
6761                 case "$yyy" in
6762                 12345678901)
6763                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6764                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6765                         echo "We will use %d."
6766                         ;;
6767                 esac
6768         fi
6769 fi
6770
6771 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6772         quad=long
6773         $cat >try.c <<'EOCP'
6774 #include <sys/types.h>
6775 #include <stdio.h>
6776 int main() {
6777   long q = 12345678901;
6778   printf("%ld\n", q);
6779 }
6780 EOCP
6781         set try
6782         if eval $compile; then
6783                 yyy=`./try$exe_ext`
6784                 case "$yyy" in
6785                 12345678901)
6786                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6787                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6788                         echo "We will use %ld."
6789                         ;;
6790                 esac
6791         fi
6792 fi
6793
6794 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6795         quad=int64_t
6796         $cat >try.c <<'EOCP'
6797 #include <sys/types.h>
6798 #include <inttypes.h>
6799 #include <stdio.h>
6800 int main() {
6801   int64_t q = 12345678901;
6802   printf("%" PRId64 "\n", q);
6803 }
6804 EOCP
6805         set try
6806         if eval $compile; then
6807                 yyy=`./try$exe_ext`
6808                 case "$yyy" in
6809                 12345678901)
6810                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6811                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6812                         echo "We will use the C9X style."
6813                         ;;
6814                 esac
6815         fi
6816 fi
6817
6818 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6819         quad="long long"
6820         $cat >try.c <<'EOCP'
6821 #include <sys/types.h>
6822 #include <stdio.h>
6823 int main() {
6824   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6825   printf("%lld\n", q);
6826 }
6827 EOCP
6828         set try
6829         if eval $compile; then
6830                 yyy=`./try$exe_ext`
6831                 case "$yyy" in
6832                 12345678901)
6833                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6834                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6835                         echo "We will use the %lld style."
6836                         ;;
6837                 esac
6838         fi
6839 fi
6840
6841 if $test X"$sPRId64" = X -a X"$quad" != X; then
6842         $cat >try.c <<EOCP
6843 #include <sys/types.h>
6844 #include <stdio.h>
6845 int main() {
6846   $quad q = 12345678901;
6847   printf("%Ld\n", q);
6848 }
6849 EOCP
6850         set try
6851         if eval $compile; then
6852                 yyy=`./try$exe_ext`
6853                 case "$yyy" in
6854                 12345678901)
6855                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6856                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6857                         echo "We will use %lld."
6858                         ;;
6859                 esac
6860         fi
6861 fi
6862
6863 if $test X"$sPRId64" = X -a X"$quad" != X; then
6864         $cat >try.c <<EOCP
6865 #include <sys/types.h>
6866 #include <stdio.h>
6867 int main() {
6868   $quad q = 12345678901;
6869   printf("%qd\n", q);
6870 }
6871 EOCP
6872         set try
6873         if eval $compile; then
6874                 yyy=`./try$exe_ext`
6875                 case "$yyy" in
6876                 12345678901)
6877                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
6878                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
6879                         echo "We will use %qd."
6880                         ;;
6881                 esac
6882         fi
6883 fi
6884
6885 if $test X"$sPRId64" = X; then
6886         echo "Cannot figure out how to print 64-bit integers." >&4
6887 fi
6888
6889 $rm -f try try.*
6890
6891 fi # intsize -o longsize -o d_int64t -o d_longlong
6892
6893 case "$sPRId64" in
6894 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
6895         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
6896         ;;
6897 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
6898         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
6899         ;;
6900 esac
6901
6902 : check for length of double
6903 echo " "
6904 case "$doublesize" in
6905 '')
6906         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
6907         $cat >try.c <<'EOCP'
6908 #include <stdio.h>
6909 int main()
6910 {
6911         printf("%d\n", sizeof(double));
6912 }
6913 EOCP
6914         set try
6915         if eval $compile_ok; then
6916                 doublesize=`./try`
6917                 $echo " $doublesize bytes." >&4
6918         else
6919                 dflt='8'
6920                 echo "(I can't seem to compile the test program.  Guessing...)"
6921                 rp="What is the size of a double precision number (in bytes)?"
6922                 . ./myread
6923                 doublesize="$ans"
6924         fi
6925         ;;
6926 esac
6927 $rm -f try.c try
6928
6929 : check for long doubles
6930 echo " "
6931 echo $n "Checking to see if your system supports long double...$c" >&4
6932 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
6933 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6934         val="$define"
6935         echo " Yup, it does." >&4
6936 else
6937         val="$undef"
6938         echo " Nope, it doesn't." >&4
6939 fi
6940 $rm try.*
6941 set d_longdbl
6942 eval $setvar
6943
6944 : check for length of long double
6945 case "${d_longdbl}${longdblsize}" in
6946 $define)
6947         echo " "
6948         $echo $n "Checking to see how big your long doubles are...$c" >&4
6949         $cat >try.c <<'EOCP'
6950 #include <stdio.h>
6951 int main()
6952 {
6953         printf("%d\n", sizeof(long double));
6954 }
6955 EOCP
6956         set try
6957         if eval $compile; then
6958                 longdblsize=`./try`
6959                 $echo " $longdblsize bytes." >&4
6960         else
6961                 dflt='8'
6962                 echo " "
6963                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6964                 rp="What is the size of a long double (in bytes)?"
6965                 . ./myread
6966                 longdblsize="$ans"
6967         fi
6968         if $test "X$doublesize" = "X$longdblsize"; then
6969                 echo "(That isn't any different from an ordinary double.)"
6970         fi      
6971         ;;
6972 esac
6973 $rm -f try.c try
6974
6975 echo " "
6976
6977 if $test X"$d_longdbl" = X"$define"; then
6978
6979 echo "Checking how to print long doubles..." >&4
6980
6981 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6982         $cat >try.c <<'EOCP'
6983 #include <sys/types.h>
6984 #include <stdio.h>
6985 int main() {
6986   double d = 123.456;
6987   printf("%.3f\n", d);
6988 }
6989 EOCP
6990         set try
6991         if eval $compile; then
6992                 yyy=`./try$exe_ext`
6993                 case "$yyy" in
6994                 123.456)
6995                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6996                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
6997                         echo "We will use %f."
6998                         ;;
6999                 esac
7000         fi
7001 fi
7002
7003 if $test X"$sPRIfldbl" = X; then
7004         $cat >try.c <<'EOCP'
7005 #include <sys/types.h>
7006 #include <stdio.h>
7007 int main() {
7008   long double d = 123.456;
7009   printf("%.3llf\n", d);
7010 }
7011 EOCP
7012         set try
7013         if eval $compile; then
7014                 yyy=`./try$exe_ext`
7015                 case "$yyy" in
7016                 123.456)
7017                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7018                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7019                         echo "We will use %llf."
7020                         ;;
7021                 esac
7022         fi
7023 fi
7024
7025 if $test X"$sPRIfldbl" = X; then
7026         $cat >try.c <<'EOCP'
7027 #include <sys/types.h>
7028 #include <stdio.h>
7029 int main() {
7030   long double d = 123.456;
7031   printf("%.3Lf\n", d);
7032 }
7033 EOCP
7034         set try
7035         if eval $compile; then
7036                 yyy=`./try$exe_ext`
7037                 case "$yyy" in
7038                 123.456)
7039                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7040                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7041                         echo "We will use %Lf."
7042                         ;;
7043                 esac
7044         fi
7045 fi
7046
7047 if $test X"$sPRIfldbl" = X; then
7048         $cat >try.c <<'EOCP'
7049 #include <sys/types.h>
7050 #include <stdio.h>
7051 int main() {
7052   long double d = 123.456;
7053   printf("%.3lf\n", d);
7054 }
7055 EOCP
7056         set try
7057         if eval $compile; then
7058                 yyy=`./try$exe_ext`
7059                 case "$yyy" in
7060                 123.456)
7061                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7062                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7063                         echo "We will use %lf."
7064                         ;;
7065                 esac
7066         fi
7067 fi
7068
7069 if $test X"$sPRIfldbl" = X; then
7070         echo "Cannot figure out how to print long doubles." >&4
7071 fi
7072
7073 $rm -f try try.*
7074
7075 fi # d_longdbl
7076
7077 case "$sPRIfldbl" in
7078 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7079         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7080         ;;
7081 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7082         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7083         ;;
7084 esac
7085
7086 : Initialize h_fcntl
7087 h_fcntl=false
7088
7089 : Initialize h_sysfile
7090 h_sysfile=false
7091
7092 : access call always available on UNIX
7093 set access d_access
7094 eval $inlibc
7095
7096 : locate the flags for 'access()'
7097 case "$d_access" in
7098 "$define")
7099         echo " "
7100         $cat >access.c <<'EOCP'
7101 #include <sys/types.h>
7102 #ifdef I_FCNTL
7103 #include <fcntl.h>
7104 #endif
7105 #ifdef I_SYS_FILE
7106 #include <sys/file.h>
7107 #endif
7108 #ifdef I_UNISTD
7109 #include <unistd.h>
7110 #endif
7111 int main() {
7112         exit(R_OK);
7113 }
7114 EOCP
7115         : check sys/file.h first, no particular reason here
7116         if $test `./findhdr sys/file.h` && \
7117                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7118                 h_sysfile=true;
7119                 echo "<sys/file.h> defines the *_OK access constants." >&4
7120         elif $test `./findhdr fcntl.h` && \
7121                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7122                 h_fcntl=true;
7123                 echo "<fcntl.h> defines the *_OK access constants." >&4
7124         elif $test `./findhdr unistd.h` && \
7125                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7126                 echo "<unistd.h> defines the *_OK access constants." >&4
7127         else
7128                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7129         fi
7130         ;;
7131 esac
7132 $rm -f access*
7133
7134 : see if accessx exists
7135 set accessx d_accessx
7136 eval $inlibc
7137
7138 : see if alarm exists
7139 set alarm d_alarm
7140 eval $inlibc
7141
7142 : see if atolf exists
7143 set atolf d_atolf
7144 eval $inlibc
7145
7146 : see if atoll exists
7147 set atoll d_atoll
7148 eval $inlibc
7149
7150 : Look for GNU-cc style attribute checking
7151 echo " "
7152 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7153 $cat >attrib.c <<'EOCP'
7154 #include <stdio.h>
7155 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7156 EOCP
7157 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7158         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7159                 echo "Your C compiler doesn't fully support __attribute__."
7160                 val="$undef"
7161         else
7162                 echo "Your C compiler supports __attribute__."
7163                 val="$define"
7164         fi
7165 else
7166         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7167         val="$undef"
7168 fi
7169 set d_attribut
7170 eval $setvar
7171 $rm -f attrib*
7172
7173 : see if bcmp exists
7174 set bcmp d_bcmp
7175 eval $inlibc
7176
7177 : see if bcopy exists
7178 set bcopy d_bcopy
7179 eval $inlibc
7180
7181 : see if this is a unistd.h system
7182 set unistd.h i_unistd
7183 eval $inhdr
7184
7185 : see if getpgrp exists
7186 set getpgrp d_getpgrp
7187 eval $inlibc
7188
7189 case "$d_getpgrp" in
7190 "$define")
7191         echo " "
7192         echo "Checking to see which flavor of getpgrp is in use..."
7193         $cat >set.c <<EOP
7194 #$i_unistd I_UNISTD
7195 #include <sys/types.h>
7196 #ifdef I_UNISTD
7197 #  include <unistd.h>
7198 #endif
7199 int main()
7200 {
7201         if (getuid() == 0) {
7202                 printf("(I see you are running Configure as super-user...)\n");
7203                 setuid(1);
7204         }
7205 #ifdef TRY_BSD_PGRP
7206         if (getpgrp(1) == 0)
7207                 exit(0);
7208 #else
7209         if (getpgrp() > 0)
7210                 exit(0);
7211 #endif
7212         exit(1);
7213 }
7214 EOP
7215         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7216                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7217                 val="$define"
7218         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7219                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7220                 val="$undef"
7221         else
7222                 echo "I can't seem to compile and run the test program."
7223                 if ./usg; then
7224                         xxx="a USG one, i.e. you use getpgrp()."
7225                 else
7226                         # SVR4 systems can appear rather BSD-ish.
7227                         case "$i_unistd" in
7228                         $undef)
7229                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7230                                 val="$define"
7231                                 ;;
7232                         $define)
7233                                 xxx="probably a USG one, i.e. you use getpgrp()."
7234                                 val="$undef"
7235                                 ;;
7236                         esac
7237                 fi
7238                 echo "Assuming your getpgrp is $xxx" >&4
7239         fi
7240         ;;
7241 *) val="$undef";;
7242 esac
7243 set d_bsdgetpgrp
7244 eval $setvar
7245 $rm -f set set.c
7246
7247 : see if setpgrp exists
7248 set setpgrp d_setpgrp
7249 eval $inlibc
7250
7251 case "$d_setpgrp" in
7252 "$define")
7253         echo " "
7254         echo "Checking to see which flavor of setpgrp is in use..."
7255         $cat >set.c <<EOP
7256 #$i_unistd I_UNISTD
7257 #include <sys/types.h>
7258 #ifdef I_UNISTD
7259 #  include <unistd.h>
7260 #endif
7261 int main()
7262 {
7263         if (getuid() == 0) {
7264                 printf("(I see you are running Configure as super-user...)\n");
7265                 setuid(1);
7266         }
7267 #ifdef TRY_BSD_PGRP
7268         if (-1 == setpgrp(1, 1))
7269                 exit(0);
7270 #else
7271         if (setpgrp() != -1)
7272                 exit(0);
7273 #endif
7274         exit(1);
7275 }
7276 EOP
7277         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7278                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7279                 val="$define"
7280         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7281                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7282                 val="$undef"
7283         else
7284                 echo "(I can't seem to compile and run the test program.)"
7285                 if ./usg; then
7286                         xxx="a USG one, i.e. you use setpgrp()."
7287                 else
7288                         # SVR4 systems can appear rather BSD-ish.
7289                         case "$i_unistd" in
7290                         $undef)
7291                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7292                                 val="$define"
7293                                 ;;
7294                         $define)
7295                                 xxx="probably a USG one, i.e. you use setpgrp()."
7296                                 val="$undef"
7297                                 ;;
7298                         esac
7299                 fi
7300                 echo "Assuming your setpgrp is $xxx" >&4
7301         fi
7302         ;;
7303 *) val="$undef";;
7304 esac
7305 set d_bsdsetpgrp
7306 eval $setvar
7307 $rm -f set set.c
7308 : see if bzero exists
7309 set bzero d_bzero
7310 eval $inlibc
7311
7312 : see if signal is declared as pointer to function returning int or void
7313 echo " "
7314 xxx=`./findhdr signal.h`
7315 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7316 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7317         echo "You have int (*signal())() instead of void." >&4
7318         val="$undef"
7319 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7320         echo "You have void (*signal())()." >&4
7321         val="$define"
7322 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7323         echo "You have int (*signal())() instead of void." >&4
7324         val="$undef"
7325 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7326         echo "You have void (*signal())()." >&4
7327         val="$define"
7328 else
7329         case "$d_voidsig" in
7330         '')
7331         echo "I can't determine whether signal handler returns void or int..." >&4
7332                 dflt=void
7333                 rp="What type does your signal handler return?"
7334                 . ./myread
7335                 case "$ans" in
7336                 v*) val="$define";;
7337                 *) val="$undef";;
7338                 esac;;
7339         "$define")
7340                 echo "As you already told me, signal handler returns void." >&4
7341                 val="$define"
7342                 ;;
7343         *)      echo "As you already told me, signal handler returns int." >&4
7344                 val="$undef"
7345                 ;;
7346         esac
7347 fi
7348 set d_voidsig
7349 eval $setvar
7350 case "$d_voidsig" in
7351 "$define") signal_t="void";;
7352 *) signal_t="int";;
7353 esac
7354 $rm -f $$.tmp
7355
7356 : check for ability to cast large floats to 32-bit ints.
7357 echo " "
7358 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7359 if $test "$intsize" -ge 4; then
7360         xxx=int
7361 else
7362         xxx=long
7363 fi
7364 $cat >try.c <<EOCP
7365 #include <stdio.h>
7366 #include <sys/types.h>
7367 #include <signal.h>
7368 $signal_t blech(s) int s; { exit(3); }
7369 int main()
7370 {
7371         $xxx i32;
7372         double f, g;
7373         int result = 0;
7374         char str[16];
7375         signal(SIGFPE, blech);
7376
7377         /* Don't let compiler optimize the test away.  Store the number 
7378            in a writable string for gcc to pass to sscanf under HP/UX.
7379         */
7380         sprintf(str, "2147483647");
7381         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7382         g = 10 * f;
7383         i32  = ($xxx) g;
7384
7385         /* x86 processors will probably give 0x8000 0000, which is a
7386        sign change.  We don't want that.  We want to mimic SPARC
7387            behavior here, which is to preserve the sign and give
7388            back 0x7fff ffff.
7389         */
7390         if (i32 != ($xxx) f)
7391                 result |= 1;
7392         exit(result);
7393 }
7394 EOCP
7395 set try
7396 if eval $compile_ok; then
7397         ./try
7398         yyy=$?
7399 else
7400         echo "(I can't seem to compile the test program--assuming it can't)"
7401         yyy=1
7402 fi
7403 case "$yyy" in
7404 0)      val="$define"
7405         echo "Yup, it can."
7406         ;;
7407 *)      val="$undef"
7408         echo "Nope, it can't."
7409         ;;
7410 esac
7411 set d_casti32
7412 eval $setvar
7413 $rm -f try try.*
7414
7415 : check for ability to cast negative floats to unsigned
7416 echo " "
7417 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7418 $cat >try.c <<EOCP
7419 #include <stdio.h>
7420 #include <sys/types.h>
7421 #include <signal.h>
7422 $signal_t blech(s) int s; { exit(7); }
7423 $signal_t blech_in_list(s) int s; { exit(4); }
7424 unsigned long dummy_long(p) unsigned long p; { return p; }
7425 unsigned int dummy_int(p) unsigned int p; { return p; }
7426 unsigned short dummy_short(p) unsigned short p; { return p; }
7427 int main()
7428 {
7429         double f;
7430         unsigned long along;
7431         unsigned int aint;
7432         unsigned short ashort;
7433         int result = 0;
7434         char str[16];
7435         
7436         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7437            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7438            optimized the whole file away
7439         */
7440         /* Store the number in a writable string for gcc to pass to 
7441            sscanf under HP/UX.
7442         */
7443         sprintf(str, "-123");
7444         sscanf(str, "%lf", &f);  /* f = -123.; */
7445
7446         signal(SIGFPE, blech);
7447         along = (unsigned long)f;
7448         aint = (unsigned int)f;
7449         ashort = (unsigned short)f;
7450         if (along != (unsigned long)-123)
7451                 result |= 1;
7452         if (aint != (unsigned int)-123)
7453                 result |= 1;
7454         if (ashort != (unsigned short)-123)
7455                 result |= 1;
7456         sprintf(str, "1073741824.");
7457         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7458         f = f + f;
7459         along = 0;
7460         along = (unsigned long)f;
7461         if (along != 0x80000000)
7462                 result |= 2;
7463         f -= 1.;
7464         along = 0;
7465         along = (unsigned long)f;
7466         if (along != 0x7fffffff)
7467                 result |= 1;
7468         f += 2.;
7469         along = 0;
7470         along = (unsigned long)f;
7471         if (along != 0x80000001)
7472                 result |= 2;
7473         if (result)
7474                 exit(result);
7475         signal(SIGFPE, blech_in_list);
7476         sprintf(str, "123.");
7477         sscanf(str, "%lf", &f);  /* f = 123.; */
7478         along = dummy_long((unsigned long)f);
7479         aint = dummy_int((unsigned int)f);
7480         ashort = dummy_short((unsigned short)f);
7481         if (along != (unsigned long)123)
7482                 result |= 4;
7483         if (aint != (unsigned int)123)
7484                 result |= 4;
7485         if (ashort != (unsigned short)123)
7486                 result |= 4;
7487         exit(result);
7488
7489 }
7490 EOCP
7491 set try
7492 if eval $compile_ok; then
7493         ./try
7494         castflags=$?
7495 else
7496         echo "(I can't seem to compile the test program--assuming it can't)"
7497         castflags=7
7498 fi
7499 case "$castflags" in
7500 0)      val="$define"
7501         echo "Yup, it can."
7502         ;;
7503 *)      val="$undef"
7504         echo "Nope, it can't."
7505         ;;
7506 esac
7507 set d_castneg
7508 eval $setvar
7509 $rm -f try.*
7510
7511 : see if vprintf exists
7512 echo " "
7513 if set vprintf val -f d_vprintf; eval $csym; $val; then
7514         echo 'vprintf() found.' >&4
7515         val="$define"
7516         $cat >vprintf.c <<'EOF'
7517 #include <varargs.h>
7518
7519 int main() { xxx("foo"); }
7520
7521 xxx(va_alist)
7522 va_dcl
7523 {
7524         va_list args;
7525         char buf[10];
7526
7527         va_start(args);
7528         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7529 }
7530 EOF
7531         set vprintf
7532         if eval $compile && ./vprintf; then
7533                 echo "Your vsprintf() returns (int)." >&4
7534                 val2="$undef"
7535         else
7536                 echo "Your vsprintf() returns (char*)." >&4
7537                 val2="$define"
7538         fi
7539 else
7540         echo 'vprintf() NOT found.' >&4
7541                 val="$undef"
7542                 val2="$undef"
7543 fi
7544 set d_vprintf
7545 eval $setvar
7546 val=$val2
7547 set d_charvspr
7548 eval $setvar
7549
7550 : see if chown exists
7551 set chown d_chown
7552 eval $inlibc
7553
7554 : see if chroot exists
7555 set chroot d_chroot
7556 eval $inlibc
7557
7558 : see if chsize exists
7559 set chsize d_chsize
7560 eval $inlibc
7561
7562 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7563 while $test $# -ge 2; do
7564         case "$1" in
7565         $define) echo "#include <$2>";;
7566         esac ;
7567     shift 2;
7568 done > try.c;
7569 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
7570 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7571         val="$define";
7572 else
7573         val="$undef";
7574 fi;
7575 set $varname;
7576 eval $setvar;
7577 $rm -f try.c try.o'
7578
7579 : see if this is a sys/uio.h system
7580 set sys/uio.h i_sysuio
7581 eval $inhdr
7582
7583 echo "Checking to see if your system supports struct iovec..." >&4
7584 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7585 eval $hasfield
7586 case "$d_iovec_s" in
7587 "$define")      echo "Yup, it does." >&4
7588                 ;;
7589 *)              echo "Nope, it doesn't." >&4
7590                 ;;
7591 esac
7592
7593 socketlib=''
7594 sockethdr=''
7595 : see whether socket exists
7596 echo " "
7597 $echo $n "Hmm... $c" >&4
7598 if set socket val -f d_socket; eval $csym; $val; then
7599         echo "Looks like you have Berkeley networking support." >&4
7600         d_socket="$define"
7601         if set setsockopt val -f; eval $csym; $val; then
7602                 d_oldsock="$undef"
7603         else
7604                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7605                 d_oldsock="$define"
7606         fi
7607 else
7608         if $contains socklib libc.list >/dev/null 2>&1; then
7609                 echo "Looks like you have Berkeley networking support." >&4
7610                 d_socket="$define"
7611                 : we will have to assume that it supports the 4.2 BSD interface
7612                 d_oldsock="$undef"
7613         else
7614                 echo "You don't have Berkeley networking in libc$_a..." >&4
7615                 if test "X$d_socket" = "X$define"; then
7616                    echo "...but you seem to believe that you have sockets." >&4
7617                 else
7618                         for net in net socket
7619                         do
7620                                 if test -f /usr/lib/lib$net$_a; then
7621                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7622                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7623                                         if $contains socket libc.list >/dev/null 2>&1; then
7624                                                 d_socket="$define"
7625                                                 socketlib="-l$net"
7626                                                 case "$net" in
7627                                                 net)
7628                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7629                                                         sockethdr="-I/usr/netinclude"
7630                                                         ;;
7631                                                 esac
7632                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7633                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7634                                                         d_oldsock="$undef"
7635                                                 else
7636                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7637                                                         d_oldsock="$define"
7638                                                 fi
7639                                                 break
7640                                         fi
7641                                 fi
7642                         done
7643                         if test "X$d_socket" != "X$define"; then
7644                            echo "or anywhere else I see." >&4
7645                            d_socket="$undef"
7646                            d_oldsock="$undef"
7647                         fi
7648                 fi
7649         fi
7650 fi
7651
7652 : see if socketpair exists
7653 set socketpair d_sockpair
7654 eval $inlibc
7655
7656
7657 echo " "
7658 echo "Checking the availability of certain socket constants..." >& 4
7659 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7660         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7661         $cat >try.c <<EOF
7662 #include <sys/types.h>
7663 #include <sys/socket.h>
7664 int main() {
7665     int i = $ENUM;
7666 }
7667 EOF
7668         val="$undef"
7669         set try; if eval $compile; then
7670                 val="$define"
7671         fi
7672         set d_${enum}; eval $setvar
7673         $rm -f try.c try
7674 done
7675
7676 set sendmsg d_sendmsg
7677 eval $inlibc
7678
7679 set recvmsg d_recvmsg
7680 eval $inlibc
7681
7682 echo " "
7683 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7684 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7685 eval $hasfield
7686 case "$d_msghdr_s" in
7687 "$define")      echo "Yup, it does." >&4
7688                 ;;
7689 *)              echo "Nope, it doesn't." >&4
7690                 ;;
7691 esac
7692
7693 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7694 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7695 eval $hasfield
7696 case "$d_cmsghdr_s" in
7697 "$define")      echo "Yup, it does." >&4
7698                 ;;
7699 *)              echo "Nope, it doesn't." >&4
7700                 ;;
7701 esac
7702
7703 : check for const keyword
7704 echo " "
7705 echo 'Checking to see if your C compiler knows about "const"...' >&4
7706 $cat >const.c <<'EOCP'
7707 typedef struct spug { int drokk; } spug;
7708 int main()
7709 {
7710         const char *foo;
7711         const spug y;
7712 }
7713 EOCP
7714 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7715         val="$define"
7716         echo "Yup, it does."
7717 else
7718         val="$undef"
7719         echo "Nope, it doesn't."
7720 fi
7721 set d_const
7722 eval $setvar
7723
7724 : see if crypt exists
7725 echo " "
7726 if set crypt val -f d_crypt; eval $csym; $val; then
7727         echo 'crypt() found.' >&4
7728         val="$define"
7729         cryptlib=''
7730 else
7731         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7732         if $test -z "$cryptlib"; then
7733                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7734         else
7735                 cryptlib=-lcrypt
7736         fi
7737         if $test -z "$cryptlib"; then
7738                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7739         else
7740                 cryptlib=-lcrypt
7741         fi
7742         if $test -z "$cryptlib"; then
7743                 cryptlib=`./loc libcrypt$_a "" $libpth`
7744         else
7745                 cryptlib=-lcrypt
7746         fi
7747         if $test -z "$cryptlib"; then
7748                 echo 'crypt() NOT found.' >&4
7749                 val="$undef"
7750         else
7751                 val="$define"
7752         fi
7753 fi
7754 set d_crypt
7755 eval $setvar
7756
7757 : get csh whereabouts
7758 case "$csh" in
7759 'csh') val="$undef" ;;
7760 *) val="$define" ;;
7761 esac
7762 set d_csh
7763 eval $setvar
7764 : Respect a hint or command line value for full_csh.
7765 case "$full_csh" in
7766 '') full_csh=$csh ;;
7767 esac
7768
7769 : see if cuserid exists
7770 set cuserid d_cuserid
7771 eval $inlibc
7772
7773 : see if this is a limits.h system
7774 set limits.h i_limits
7775 eval $inhdr
7776
7777 : see if this is a float.h system
7778 set float.h i_float
7779 eval $inhdr
7780
7781 : See if number of significant digits in a double precision number is known
7782 echo " "
7783 $cat >dbl_dig.c <<EOM
7784 #$i_limits I_LIMITS
7785 #$i_float I_FLOAT
7786 #ifdef I_LIMITS
7787 #include <limits.h>
7788 #endif
7789 #ifdef I_FLOAT
7790 #include <float.h>
7791 #endif
7792 #ifdef DBL_DIG
7793 printf("Contains DBL_DIG");
7794 #endif
7795 EOM
7796 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7797 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7798         echo "DBL_DIG found." >&4
7799         val="$define"
7800 else
7801         echo "DBL_DIG NOT found." >&4
7802         val="$undef"
7803 fi
7804 $rm -f dbl_dig.?
7805 set d_dbl_dig
7806 eval $setvar
7807
7808 : see if difftime exists
7809 set difftime d_difftime
7810 eval $inlibc
7811
7812 : see if this is a dirent system
7813 echo " "
7814 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7815         val="$define"
7816         echo "<dirent.h> found." >&4
7817 else
7818         val="$undef"
7819         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7820                 echo "<sys/dir.h> found." >&4
7821                 echo " "
7822         else
7823                 xinc=`./findhdr sys/ndir.h`
7824         fi
7825         echo "<dirent.h> NOT found." >&4
7826 fi
7827 set i_dirent
7828 eval $setvar
7829
7830 : Look for type of directory structure.
7831 echo " "
7832 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7833
7834 case "$direntrytype" in
7835 ''|' ')
7836         case "$i_dirent" in
7837         $define) guess1='struct dirent' ;;
7838         *) guess1='struct direct'  ;;
7839         esac
7840         ;;
7841 *)      guess1="$direntrytype"
7842         ;;
7843 esac
7844
7845 case "$guess1" in
7846 'struct dirent') guess2='struct direct' ;;
7847 *) guess2='struct dirent' ;;
7848 esac
7849                 
7850 if $contains "$guess1" try.c >/dev/null 2>&1; then
7851         direntrytype="$guess1"
7852         echo "Your directory entries are $direntrytype." >&4
7853 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7854         direntrytype="$guess2"
7855         echo "Your directory entries seem to be $direntrytype." >&4
7856 else
7857         echo "I don't recognize your system's directory entries." >&4
7858         rp="What type is used for directory entries on this system?"
7859         dflt="$guess1"
7860         . ./myread
7861         direntrytype="$ans"
7862 fi
7863 $rm -f try.c
7864
7865
7866 : see if the directory entry stores field length
7867 echo " "
7868 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7869 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7870         echo "Good, your directory entry keeps length information in d_namlen." >&4
7871         val="$define"
7872 else
7873         echo "Your directory entry does not know about the d_namlen field." >&4
7874         val="$undef"
7875 fi
7876 set d_dirnamlen
7877 eval $setvar
7878 $rm -f try.c
7879
7880 : see if dlerror exists
7881 xxx_runnm="$runnm"
7882 runnm=false
7883 set dlerror d_dlerror
7884 eval $inlibc
7885 runnm="$xxx_runnm"
7886
7887 : see if dlfcn is available
7888 set dlfcn.h i_dlfcn
7889 eval $inhdr
7890
7891 case "$usedl" in
7892 $define|y|true)
7893         $cat << EOM
7894
7895 On a few systems, the dynamically loaded modules that perl generates and uses
7896 will need a different extension than shared libs. The default will probably
7897 be appropriate.
7898
7899 EOM
7900         case "$dlext" in
7901         '')     dflt="$so" ;;
7902         *)      dflt="$dlext" ;;
7903         esac
7904         rp='What is the extension of dynamically loaded modules'
7905         . ./myread
7906         dlext="$ans"
7907         ;;
7908 *)
7909         dlext="none"
7910         ;;
7911 esac
7912
7913 : Check if dlsym need a leading underscore
7914 echo " "
7915 val="$undef"
7916
7917 case "$dlsrc" in
7918 dl_dlopen.xs)
7919         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7920         $cat >dyna.c <<'EOM'
7921 fred () { }
7922 EOM
7923
7924 $cat >fred.c<<EOM
7925
7926 #include <stdio.h>
7927 #$i_dlfcn I_DLFCN
7928 #ifdef I_DLFCN
7929 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
7930 #else
7931 #include <sys/types.h>
7932 #include <nlist.h>
7933 #include <link.h>
7934 #endif
7935
7936 extern int fred() ;
7937
7938 int main()
7939 {
7940     void * handle ;
7941     void * symbol ;
7942 #ifndef RTLD_LAZY
7943     int mode = 1 ;
7944 #else
7945     int mode = RTLD_LAZY ;
7946 #endif
7947     handle = dlopen("./dyna.$dlext", mode) ;
7948     if (handle == NULL) {
7949         printf ("1\n") ;
7950         fflush (stdout) ;
7951         exit(0);
7952     }
7953     symbol = dlsym(handle, "fred") ;
7954     if (symbol == NULL) {
7955         /* try putting a leading underscore */
7956         symbol = dlsym(handle, "_fred") ;
7957         if (symbol == NULL) {
7958             printf ("2\n") ;
7959             fflush (stdout) ;
7960             exit(0);
7961         }
7962         printf ("3\n") ;
7963     }
7964     else
7965         printf ("4\n") ;
7966     fflush (stdout) ;
7967     exit(0);
7968 }
7969 EOM
7970         : Call the object file tmp-dyna.o in case dlext=o.
7971         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
7972                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
7973                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
7974                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
7975                 xxx=`./fred`
7976                 case $xxx in
7977                 1)      echo "Test program failed using dlopen." >&4
7978                         echo "Perhaps you should not use dynamic loading." >&4;;
7979                 2)      echo "Test program failed using dlsym." >&4
7980                         echo "Perhaps you should not use dynamic loading." >&4;;
7981                 3)      echo "dlsym needs a leading underscore" >&4
7982                         val="$define" ;;
7983                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
7984                 esac
7985         else
7986                 echo "I can't compile and run the test program." >&4
7987                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
7988         fi
7989         ;;
7990 esac
7991                 
7992 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
7993
7994 set d_dlsymun
7995 eval $setvar
7996
7997 hasproto='varname=$1; func=$2; shift; shift;
7998 while $test $# -ge 2; do
7999         case "$1" in
8000         $define) echo "#include <$2>";;
8001         esac ;
8002     shift 2;
8003 done > try.c;
8004 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8005 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8006         echo "$func() prototype found.";
8007         val="$define";
8008 else
8009         echo "$func() prototype NOT found.";
8010         val="$undef";
8011 fi;
8012 set $varname;
8013 eval $setvar;
8014 $rm -f try.c tryout.c'
8015
8016 : see if prototype for drand48 is available
8017 echo " "
8018 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8019 eval $hasproto
8020
8021 : see if dup2 exists
8022 set dup2 d_dup2
8023 eval $inlibc
8024
8025 : see if eaccess exists
8026 set eaccess d_eaccess
8027 eval $inlibc
8028
8029 : see if endgrent exists
8030 set endgrent d_endgrent
8031 eval $inlibc
8032
8033 : see if endhostent exists
8034 set endhostent d_endhent
8035 eval $inlibc
8036
8037 : see if endnetent exists
8038 set endnetent d_endnent
8039 eval $inlibc
8040
8041 : see if endprotoent exists
8042 set endprotoent d_endpent
8043 eval $inlibc
8044
8045 : see if endpwent exists
8046 set endpwent d_endpwent
8047 eval $inlibc
8048
8049 : see if endservent exists
8050 set endservent d_endsent
8051 eval $inlibc
8052
8053 : see if endspent exists
8054 set endspent d_endspent
8055 eval $inlibc
8056
8057 : Locate the flags for 'open()'
8058 echo " "
8059 $cat >open3.c <<'EOCP'
8060 #include <sys/types.h>
8061 #ifdef I_FCNTL
8062 #include <fcntl.h>
8063 #endif
8064 #ifdef I_SYS_FILE
8065 #include <sys/file.h>
8066 #endif
8067 int main() {
8068         if(O_RDONLY);
8069 #ifdef O_TRUNC
8070         exit(0);
8071 #else
8072         exit(1);
8073 #endif
8074 }
8075 EOCP
8076 : check sys/file.h first to get FREAD on Sun
8077 if $test `./findhdr sys/file.h` && \
8078                 set open3 -DI_SYS_FILE && eval $compile; then
8079         h_sysfile=true;
8080         echo "<sys/file.h> defines the O_* constants..." >&4
8081         if ./open3; then
8082                 echo "and you have the 3 argument form of open()." >&4
8083                 val="$define"
8084         else
8085                 echo "but not the 3 argument form of open().  Oh, well." >&4
8086                 val="$undef"
8087         fi
8088 elif $test `./findhdr fcntl.h` && \
8089                 set open3 -DI_FCNTL && eval $compile; then
8090         h_fcntl=true;
8091         echo "<fcntl.h> defines the O_* constants..." >&4
8092         if ./open3; then
8093                 echo "and you have the 3 argument form of open()." >&4
8094                 val="$define"
8095         else
8096                 echo "but not the 3 argument form of open().  Oh, well." >&4
8097                 val="$undef"
8098         fi
8099 else
8100         val="$undef"
8101         echo "I can't find the O_* constant definitions!  You got problems." >&4
8102 fi
8103 set d_open3
8104 eval $setvar
8105 $rm -f open3*
8106
8107 : check for non-blocking I/O stuff
8108 case "$h_sysfile" in
8109 true) echo "#include <sys/file.h>" > head.c;;
8110 *)
8111         case "$h_fcntl" in
8112         true) echo "#include <fcntl.h>" > head.c;;
8113         *) echo "#include <sys/fcntl.h>" > head.c;;
8114         esac
8115         ;;
8116 esac
8117 echo " "
8118 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8119 case "$o_nonblock" in
8120 '')
8121         $cat head.c > try.c
8122         $cat >>try.c <<'EOCP'
8123 int main() {
8124 #ifdef O_NONBLOCK
8125         printf("O_NONBLOCK\n");
8126         exit(0);
8127 #endif
8128 #ifdef O_NDELAY
8129         printf("O_NDELAY\n");
8130         exit(0);
8131 #endif
8132 #ifdef FNDELAY
8133         printf("FNDELAY\n");
8134         exit(0);
8135 #endif
8136         exit(0);
8137 }
8138 EOCP
8139         set try
8140         if eval $compile_ok; then
8141                 o_nonblock=`./try`
8142                 case "$o_nonblock" in
8143                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8144                 *) echo "Seems like we can use $o_nonblock.";;
8145                 esac
8146         else
8147                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8148         fi
8149         ;;
8150 *) echo "Using $hint value $o_nonblock.";;
8151 esac
8152 $rm -f try try.* .out core
8153
8154 echo " "
8155 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8156 case "$eagain" in
8157 '')
8158         $cat head.c > try.c
8159         $cat >>try.c <<EOCP
8160 #include <errno.h>
8161 #include <sys/types.h>
8162 #include <signal.h>
8163 #define MY_O_NONBLOCK $o_nonblock
8164 #ifndef errno  /* XXX need better Configure test */
8165 extern int errno;
8166 #endif
8167 $signal_t blech(x) int x; { exit(3); }
8168 EOCP
8169         $cat >> try.c <<'EOCP'
8170 int main()
8171 {
8172         int pd[2];
8173         int pu[2];
8174         char buf[1];
8175         char string[100];
8176
8177         pipe(pd);       /* Down: child -> parent */
8178         pipe(pu);       /* Up: parent -> child */
8179         if (0 != fork()) {
8180                 int ret;
8181                 close(pd[1]);   /* Parent reads from pd[0] */
8182                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8183                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8184                         exit(1);
8185                 signal(SIGALRM, blech);
8186                 alarm(5);
8187                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8188                         exit(2);
8189                 sprintf(string, "%d\n", ret);
8190                 write(2, string, strlen(string));
8191                 alarm(0);
8192 #ifdef EAGAIN
8193                 if (errno == EAGAIN) {
8194                         printf("EAGAIN\n");
8195                         goto ok;
8196                 }
8197 #endif
8198 #ifdef EWOULDBLOCK
8199                 if (errno == EWOULDBLOCK)
8200                         printf("EWOULDBLOCK\n");
8201 #endif
8202         ok:
8203                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8204                 sleep(2);                               /* Give it time to close our pipe */
8205                 alarm(5);
8206                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8207                 alarm(0);
8208                 sprintf(string, "%d\n", ret);
8209                 write(3, string, strlen(string));
8210                 exit(0);
8211         }
8212
8213         close(pd[0]);                   /* We write to pd[1] */
8214         close(pu[1]);                   /* We read from pu[0] */
8215         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8216         close(pd[1]);                   /* Pipe pd is now fully closed! */
8217         exit(0);                                /* Bye bye, thank you for playing! */
8218 }
8219 EOCP
8220         set try
8221         if eval $compile_ok; then
8222                 echo "$startsh" >mtry
8223                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8224                 chmod +x mtry
8225                 ./mtry >/dev/null 2>&1
8226                 case $? in
8227                 0) eagain=`$cat try.out`;;
8228                 1) echo "Could not perform non-blocking setting!";;
8229                 2) echo "I did a successful read() for something that was not there!";;
8230                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8231                 *) echo "Something terribly wrong happened during testing.";;
8232                 esac
8233                 rd_nodata=`$cat try.ret`
8234                 echo "A read() system call with no data present returns $rd_nodata."
8235                 case "$rd_nodata" in
8236                 0|-1) ;;
8237                 *)
8238                         echo "(That's peculiar, fixing that to be -1.)"
8239                         rd_nodata=-1
8240                         ;;
8241                 esac
8242                 case "$eagain" in
8243                 '')
8244                         echo "Forcing errno EAGAIN on read() with no data available."
8245                         eagain=EAGAIN
8246                         ;;
8247                 *)
8248                         echo "Your read() sets errno to $eagain when no data is available."
8249                         ;;
8250                 esac
8251                 status=`$cat try.err`
8252                 case "$status" in
8253                 0) echo "And it correctly returns 0 to signal EOF.";;
8254                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8255                 *) echo "However, your read() returns '$status' on EOF??";;
8256                 esac
8257                 val="$define"
8258                 if test "$status" = "$rd_nodata"; then
8259                         echo "WARNING: you can't distinguish between EOF and no data!"
8260                         val="$undef"
8261                 fi
8262         else
8263                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8264                 eagain=EAGAIN
8265         fi
8266         set d_eofnblk
8267         eval $setvar
8268         ;;
8269 *)
8270         echo "Using $hint value $eagain."
8271         echo "Your read() returns $rd_nodata when no data is present."
8272         case "$d_eofnblk" in
8273         "$define") echo "And you can see EOF because read() returns 0.";;
8274         "$undef") echo "But you can't see EOF status from read() returned value.";;
8275         *)
8276                 echo "(Assuming you can't see EOF status from read anyway.)"
8277                 d_eofnblk=$undef
8278                 ;;
8279         esac
8280         ;;
8281 esac
8282 $rm -f try try.* .out core head.c mtry
8283
8284 : see if fchmod exists
8285 set fchmod d_fchmod
8286 eval $inlibc
8287
8288 : see if fchown exists
8289 set fchown d_fchown
8290 eval $inlibc
8291
8292 : see if this is an fcntl system
8293 set fcntl d_fcntl
8294 eval $inlibc
8295
8296 : see if sys/select.h has to be included
8297 set sys/select.h i_sysselct
8298 eval $inhdr
8299
8300 : see if we should include time.h, sys/time.h, or both
8301 echo " "
8302 if test "X$timeincl" = X; then
8303         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8304         $echo $n "I'm now running the test program...$c"
8305         $cat >try.c <<'EOCP'
8306 #include <sys/types.h>
8307 #ifdef I_TIME
8308 #include <time.h>
8309 #endif
8310 #ifdef I_SYSTIME
8311 #ifdef SYSTIMEKERNEL
8312 #define KERNEL
8313 #endif
8314 #include <sys/time.h>
8315 #endif
8316 #ifdef I_SYSSELECT
8317 #include <sys/select.h>
8318 #endif
8319 int main()
8320 {
8321         struct tm foo;
8322 #ifdef S_TIMEVAL
8323         struct timeval bar;
8324 #endif
8325 #ifdef S_TIMEZONE
8326         struct timezone tzp;
8327 #endif
8328         if (foo.tm_sec == foo.tm_sec)
8329                 exit(0);
8330 #ifdef S_TIMEVAL
8331         if (bar.tv_sec == bar.tv_sec)
8332                 exit(0);
8333 #endif
8334         exit(1);
8335 }
8336 EOCP
8337         flags=''
8338         for s_timezone in '-DS_TIMEZONE' ''; do
8339         sysselect=''
8340         for s_timeval in '-DS_TIMEVAL' ''; do
8341         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8342         for i_time in '' '-DI_TIME'; do
8343         for i_systime in '-DI_SYSTIME' ''; do
8344                 case "$flags" in
8345                 '') $echo $n ".$c"
8346                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8347                         if eval $compile; then
8348                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8349                                 shift
8350                                 flags="$*"
8351                                 echo " "
8352                                 $echo $n "Succeeded with $flags$c"
8353                         fi
8354                         ;;
8355                 esac
8356         done
8357         done
8358         done
8359         done
8360         done
8361         timeincl=''
8362         echo " "
8363         case "$flags" in
8364         *SYSTIMEKERNEL*) i_systimek="$define"
8365                 timeincl=`./findhdr sys/time.h`
8366                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8367         *) i_systimek="$undef";;
8368         esac
8369         case "$flags" in
8370         *I_TIME*) i_time="$define"
8371                 timeincl=`./findhdr time.h`" $timeincl"
8372                 echo "We'll include <time.h>." >&4;;
8373         *) i_time="$undef";;
8374         esac
8375         case "$flags" in
8376         *I_SYSTIME*) i_systime="$define"
8377                 timeincl=`./findhdr sys/time.h`" $timeincl"
8378                 echo "We'll include <sys/time.h>." >&4;;
8379         *) i_systime="$undef";;
8380         esac
8381         $rm -f try.c try
8382 fi
8383
8384 : check for fd_set items
8385 $cat <<EOM
8386
8387 Checking to see how well your C compiler handles fd_set and friends ...
8388 EOM
8389 $cat >fd_set.c <<EOCP
8390 #$i_systime I_SYS_TIME
8391 #$i_sysselct I_SYS_SELECT
8392 #$d_socket HAS_SOCKET
8393 #include <sys/types.h>
8394 #ifdef HAS_SOCKET
8395 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8396 #endif
8397 #ifdef I_SYS_TIME
8398 #include <sys/time.h>
8399 #endif
8400 #ifdef I_SYS_SELECT
8401 #include <sys/select.h>
8402 #endif
8403 int main() {
8404         fd_set fds;
8405
8406 #ifdef TRYBITS
8407         if(fds.fds_bits);
8408 #endif
8409
8410 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8411         exit(0);
8412 #else
8413         exit(1);
8414 #endif
8415 }
8416 EOCP
8417 set fd_set -DTRYBITS
8418 if eval $compile; then
8419         d_fds_bits="$define"
8420         d_fd_set="$define"
8421         echo "Well, your system knows about the normal fd_set typedef..." >&4
8422         if ./fd_set; then
8423                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8424                 d_fd_macros="$define"
8425         else
8426                 $cat >&4 <<'EOM'
8427 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8428 EOM
8429                 d_fd_macros="$undef"
8430         fi
8431 else
8432         $cat <<'EOM'
8433 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8434 EOM
8435         set fd_set
8436         if eval $compile; then
8437                 d_fds_bits="$undef"
8438                 d_fd_set="$define"
8439                 echo "Well, your system has some sort of fd_set available..." >&4
8440                 if ./fd_set; then
8441                         echo "and you have the normal fd_set macros." >&4
8442                         d_fd_macros="$define"
8443                 else
8444                         $cat <<'EOM'
8445 but not the normal fd_set macros!  Gross!  More work for me...
8446 EOM
8447                         d_fd_macros="$undef"
8448                 fi
8449         else
8450         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8451                 d_fd_set="$undef"
8452                 d_fds_bits="$undef"
8453                 d_fd_macros="$undef"
8454         fi
8455 fi
8456 $rm -f fd_set*
8457
8458 : see if fgetpos exists
8459 set fgetpos d_fgetpos
8460 eval $inlibc
8461
8462 : see if flock exists
8463 set flock d_flock
8464 eval $inlibc
8465
8466 : see if fork exists
8467 set fork d_fork
8468 eval $inlibc
8469
8470 : see if pathconf exists
8471 set pathconf d_pathconf
8472 eval $inlibc
8473
8474 : see if fpathconf exists
8475 set fpathconf d_fpathconf
8476 eval $inlibc
8477
8478
8479 : see if llseek exists
8480 set llseek d_llseek
8481 eval $inlibc
8482
8483 : check for off64_t
8484 echo " "
8485 echo $n "Checking to see if your system supports off64_t...$c" >&4
8486 $cat >try.c <<EOCP
8487 #include <sys/types.h>
8488 #include <unistd.h>
8489 off64_t foo() { off64_t x; x = 7; return x; }'
8490 EOCP
8491 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8492         val="$define"
8493         echo " Yup, it does." >&4
8494 else
8495         val="$undef"
8496         echo " Nope, it doesn't." >&4
8497 fi
8498 $rm -f try.*
8499 set d_off64_t
8500 eval $setvar
8501
8502 : check for fpos64_t
8503 echo " "
8504 echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8505 $cat >try.c <<EOCP
8506 #include <sys/stdio.h>
8507 fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8508 EOCP
8509 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8510         val="$define"
8511         echo " Yup, it does." >&4
8512 else
8513         val="$undef"
8514         echo " Nope, it doesn't." >&4
8515 fi
8516 $rm -f try.*
8517 set d_fpos64_t
8518 eval $setvar
8519
8520 : see if fseeko exists
8521 set fseeko d_fseeko
8522 eval $inlibc
8523
8524 : see if fsetpos exists
8525 set fsetpos d_fsetpos
8526 eval $inlibc
8527
8528 : see if this is a sys/param system
8529 set sys/param.h i_sysparam
8530 eval $inhdr
8531
8532 : see if this is a sys/mount.h system
8533 set sys/mount.h i_sysmount
8534 eval $inhdr
8535
8536
8537 : see if statfs exists
8538 set statfs d_statfs
8539 eval $inlibc
8540
8541 : see if fstatfs exists
8542 set fstatfs d_fstatfs
8543 eval $inlibc
8544
8545 : see if statfs knows about mount flags
8546 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8547 eval $hasfield
8548
8549
8550 : see if statvfs exists
8551 set statvfs d_statvfs
8552 eval $inlibc
8553
8554 : see if fstatvfs exists
8555 set fstatvfs d_fstatvfs
8556 eval $inlibc
8557
8558
8559 : see if ftello exists
8560 set ftello d_ftello
8561 eval $inlibc
8562
8563 : see if getgrent exists
8564 set getgrent d_getgrent
8565 eval $inlibc
8566
8567 : see if gethostbyaddr exists
8568 set gethostbyaddr d_gethbyaddr
8569 eval $inlibc
8570
8571 : see if gethostbyname exists
8572 set gethostbyname d_gethbyname
8573 eval $inlibc
8574
8575 : see if gethostent exists
8576 set gethostent d_gethent
8577 eval $inlibc
8578
8579 : see how we will look up host name
8580 echo " "
8581 call=''
8582 if set gethostname val -f d_gethname; eval $csym; $val; then
8583         echo 'gethostname() found.' >&4
8584         d_gethname="$define"
8585         call=gethostname
8586 fi
8587 if set uname val -f d_uname; eval $csym; $val; then
8588         if ./xenix; then
8589                 $cat <<'EOM'
8590 uname() was found, but you're running xenix, and older versions of xenix
8591 have a broken uname(). If you don't really know whether your xenix is old
8592 enough to have a broken system call, use the default answer.
8593
8594 EOM
8595                 dflt=y
8596                 case "$d_uname" in
8597                 "$define") dflt=n;;
8598                 esac
8599                 rp='Is your uname() broken?'
8600                 . ./myread
8601                 case "$ans" in
8602                 n*) d_uname="$define"; call=uname;;
8603                 esac
8604         else
8605                 echo 'uname() found.' >&4
8606                 d_uname="$define"
8607                 case "$call" in
8608                 '') call=uname ;;
8609                 esac
8610         fi
8611 fi
8612 case "$d_gethname" in
8613 '') d_gethname="$undef";;
8614 esac
8615 case "$d_uname" in
8616 '') d_uname="$undef";;
8617 esac
8618 case "$d_uname$d_gethname" in
8619 *define*)
8620         dflt=n
8621         cat <<EOM
8622  
8623 Every now and then someone has a $call() that lies about the hostname
8624 but can't be fixed for political or economic reasons.  If you wish, I can
8625 pretend $call() isn't there and maybe compute hostname at run-time
8626 thanks to the '$phostname' command.
8627
8628 EOM
8629         rp="Shall I ignore $call() from now on?"
8630         . ./myread
8631         case "$ans" in
8632         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8633         esac;;
8634 esac
8635 case "$phostname" in
8636 '') aphostname='';;
8637 *) case "$aphostname" in
8638         /*) ;;
8639         *) set X $phostname
8640                 shift
8641                 file=$1
8642                 shift
8643                 file=`./loc $file $file $pth`
8644                 aphostname=`echo $file $*`
8645                 ;;
8646         esac
8647         ;;
8648 esac
8649 case "$d_uname$d_gethname" in
8650 *define*) ;;
8651 *)
8652         case "$phostname" in
8653         '')
8654                 echo "There will be no way for $package to get your hostname." >&4;;
8655         *)
8656         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8657                 ;;
8658         esac;;
8659 esac
8660 case "$d_phostname" in
8661 '') d_phostname="$undef";;
8662 esac
8663
8664 : see if this is a netdb.h system
8665 set netdb.h i_netdb
8666 eval $inhdr
8667
8668 : see if prototypes for various gethostxxx netdb.h functions are available
8669 echo " "
8670 set d_gethostprotos gethostent $i_netdb netdb.h
8671 eval $hasproto
8672
8673 : see if getlogin exists
8674 set getlogin d_getlogin
8675 eval $inlibc
8676
8677 : see if getmntent exists
8678 set getmntent d_getmntent
8679 eval $inlibc
8680
8681 : see if getnetbyaddr exists
8682 set getnetbyaddr d_getnbyaddr
8683 eval $inlibc
8684
8685 : see if getnetbyname exists
8686 set getnetbyname d_getnbyname
8687 eval $inlibc
8688
8689 : see if getnetent exists
8690 set getnetent d_getnent
8691 eval $inlibc
8692
8693 : see if prototypes for various getnetxxx netdb.h functions are available
8694 echo " "
8695 set d_getnetprotos getnetent $i_netdb netdb.h
8696 eval $hasproto
8697
8698
8699 : see if getprotobyname exists
8700 set getprotobyname d_getpbyname
8701 eval $inlibc
8702
8703 : see if getprotobynumber exists
8704 set getprotobynumber d_getpbynumber
8705 eval $inlibc
8706
8707 : see if getprotoent exists
8708 set getprotoent d_getpent
8709 eval $inlibc
8710
8711 : see if getpgid exists
8712 set getpgid d_getpgid
8713 eval $inlibc
8714
8715 : see if getpgrp2 exists
8716 set getpgrp2 d_getpgrp2
8717 eval $inlibc
8718
8719 : see if getppid exists
8720 set getppid d_getppid
8721 eval $inlibc
8722
8723 : see if getpriority exists
8724 set getpriority d_getprior
8725 eval $inlibc
8726
8727 : see if prototypes for various getprotoxxx netdb.h functions are available
8728 echo " "
8729 set d_getprotoprotos getprotoent $i_netdb netdb.h
8730 eval $hasproto
8731
8732 : see if getpwent exists
8733 set getpwent d_getpwent
8734 eval $inlibc
8735
8736
8737 : see if getservbyname exists
8738 set getservbyname d_getsbyname
8739 eval $inlibc
8740
8741 : see if getservbyport exists
8742 set getservbyport d_getsbyport
8743 eval $inlibc
8744
8745 : see if getservent exists
8746 set getservent d_getsent
8747 eval $inlibc
8748
8749 : see if prototypes for various getservxxx netdb.h functions are available
8750 echo " "
8751 set d_getservprotos getservent $i_netdb netdb.h
8752 eval $hasproto
8753
8754 : see if getspent exists
8755 set getspent d_getspent
8756 eval $inlibc
8757
8758 : see if getspnam exists
8759 set getspnam d_getspnam
8760 eval $inlibc
8761
8762 : see if gettimeofday or ftime exists
8763 set gettimeofday d_gettimeod
8764 eval $inlibc
8765 case "$d_gettimeod" in
8766 "$undef")
8767         set ftime d_ftime 
8768         eval $inlibc
8769         ;;
8770 *)
8771         val="$undef"; set d_ftime; eval $setvar
8772         ;;
8773 esac
8774 case "$d_gettimeod$d_ftime" in
8775 "$undef$undef")
8776         echo " "
8777         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8778         ;;
8779 esac
8780
8781 : see if this is an grp system
8782 set grp.h i_grp
8783 eval $inhdr
8784
8785 case "$i_grp" in
8786 $define)
8787         xxx=`./findhdr grp.h`
8788         $cppstdin $cppflags $cppminus < $xxx >$$.h
8789
8790         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8791                 val="$define"
8792         else
8793                 val="$undef"
8794         fi
8795         set d_grpasswd
8796         eval $setvar
8797
8798         $rm -f $$.h
8799         ;;
8800 *)
8801         val="$undef";
8802         set d_grpasswd; eval $setvar
8803         ;;
8804 esac
8805
8806 : see if hasmntopt exists
8807 set hasmntopt d_hasmntopt
8808 eval $inlibc
8809
8810 : see if this is a netinet/in.h or sys/in.h system
8811 set netinet/in.h i_niin sys/in.h i_sysin
8812 eval $inhdr
8813
8814 : see if arpa/inet.h has to be included
8815 set arpa/inet.h i_arpainet
8816 eval $inhdr
8817
8818 : see if htonl --and friends-- exists
8819 val=''
8820 set htonl val
8821 eval $inlibc
8822
8823 : Maybe they are macros.
8824 case "$val" in
8825 $undef)
8826         $cat >htonl.c <<EOM
8827 #include <stdio.h>
8828 #include <sys/types.h>
8829 #$i_niin I_NETINET_IN
8830 #$i_sysin I_SYS_IN
8831 #$i_arpainet I_ARPA_INET
8832 #ifdef I_NETINET_IN
8833 #include <netinet/in.h>
8834 #endif
8835 #ifdef I_SYS_IN
8836 #include <sys/in.h>
8837 #endif
8838 #ifdef I_ARPA_INET
8839 #include <arpa/inet.h>
8840 #endif
8841 #ifdef htonl
8842 printf("Defined as a macro.");
8843 #endif
8844 EOM
8845         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8846         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8847                 val="$define"
8848                 echo "But it seems to be defined as a macro." >&4
8849         fi
8850         $rm -f htonl.?
8851         ;;
8852 esac
8853 set d_htonl
8854 eval $setvar
8855
8856 : see which of string.h or strings.h is needed
8857 echo " "
8858 strings=`./findhdr string.h`
8859 if $test "$strings" && $test -r "$strings"; then
8860         echo "Using <string.h> instead of <strings.h>." >&4
8861         val="$define"
8862 else
8863         val="$undef"
8864         strings=`./findhdr strings.h`
8865         if $test "$strings" && $test -r "$strings"; then
8866                 echo "Using <strings.h> instead of <string.h>." >&4
8867         else
8868                 echo "No string header found -- You'll surely have problems." >&4
8869         fi
8870 fi
8871 set i_string
8872 eval $setvar
8873 case "$i_string" in
8874 "$undef") strings=`./findhdr strings.h`;;
8875 *)        strings=`./findhdr string.h`;;
8876 esac
8877
8878 : index or strchr
8879 echo " "
8880 if set index val -f; eval $csym; $val; then
8881         if set strchr val -f d_strchr; eval $csym; $val; then
8882                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8883                         val="$define"
8884                         vali="$undef"
8885                         echo "strchr() found." >&4
8886                 else
8887                         val="$undef"
8888                         vali="$define"
8889                         echo "index() found." >&4
8890                 fi
8891         else
8892                 val="$undef"
8893                 vali="$define"
8894                 echo "index() found." >&4
8895         fi
8896 else
8897         if set strchr val -f d_strchr; eval $csym; $val; then
8898                 val="$define"
8899                 vali="$undef"
8900                 echo "strchr() found." >&4
8901         else
8902                 echo "No index() or strchr() found!" >&4
8903                 val="$undef"
8904                 vali="$undef"
8905         fi
8906 fi
8907 set d_strchr; eval $setvar
8908 val="$vali"
8909 set d_index; eval $setvar
8910
8911 : check whether inet_aton exists
8912 set inet_aton d_inetaton
8913 eval $inlibc
8914
8915 : Look for isascii
8916 echo " "
8917 $cat >isascii.c <<'EOCP'
8918 #include <stdio.h>
8919 #include <ctype.h>
8920 int main() {
8921         int c = 'A';
8922         if (isascii(c))
8923                 exit(0);
8924         else
8925                 exit(1);
8926 }
8927 EOCP
8928 set isascii
8929 if eval $compile; then
8930         echo "isascii() found." >&4
8931         val="$define"
8932 else
8933         echo "isascii() NOT found." >&4
8934         val="$undef"
8935 fi
8936 set d_isascii
8937 eval $setvar
8938 $rm -f isascii*
8939
8940 : see if killpg exists
8941 set killpg d_killpg
8942 eval $inlibc
8943
8944 : see if lchown exists
8945 echo " "
8946 $cat > try.c <<'EOCP'
8947 /* System header to define __stub macros and hopefully few prototypes,
8948     which can conflict with char lchown(); below.  */
8949 #include <assert.h>
8950 /* Override any gcc2 internal prototype to avoid an error.  */
8951 /* We use char because int might match the return type of a gcc2
8952    builtin and then its argument prototype would still apply.  */
8953 char lchown();
8954 int main() {
8955     /*  The GNU C library defines this for functions which it implements
8956         to always fail with ENOSYS.  Some functions are actually named
8957         something starting with __ and the normal name is an alias.  */
8958 #if defined (__stub_lchown) || defined (__stub___lchown)
8959 choke me
8960 #else
8961 lchown();
8962 #endif
8963 ; return 0; }
8964 EOCP
8965 set try
8966 if eval $compile; then
8967     $echo "lchown() found." >&4
8968     val="$define"
8969 else
8970     $echo "lchown() NOT found." >&4
8971     val="$undef"
8972 fi
8973 set d_lchown
8974 eval $setvar
8975
8976 : See if number of significant digits in a double precision number is known
8977 echo " "
8978 $cat >ldbl_dig.c <<EOM
8979 #$i_limits I_LIMITS
8980 #$i_float I_FLOAT
8981 #ifdef I_LIMITS
8982 #include <limits.h>
8983 #endif
8984 #ifdef I_FLOAT
8985 #include <float.h>
8986 #endif
8987 #ifdef LDBL_DIG
8988 printf("Contains LDBL_DIG");
8989 #endif
8990 EOM
8991 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
8992 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
8993         echo "LDBL_DIG found." >&4
8994         val="$define"
8995 else
8996         echo "LDBL_DIG NOT found." >&4
8997         val="$undef"
8998 fi
8999 $rm -f ldbl_dig.?
9000 set d_ldbl_dig
9001 eval $setvar
9002
9003 : see if link exists
9004 set link d_link
9005 eval $inlibc
9006
9007 : see if localeconv exists
9008 set localeconv d_locconv
9009 eval $inlibc
9010
9011 : see if lockf exists
9012 set lockf d_lockf
9013 eval $inlibc
9014
9015 : see if lstat exists
9016 set lstat d_lstat
9017 eval $inlibc
9018
9019 : see if madvise exists
9020 set madvise d_madvise
9021 eval $inlibc
9022
9023 : see if mblen exists
9024 set mblen d_mblen
9025 eval $inlibc
9026
9027 : see if mbstowcs exists
9028 set mbstowcs d_mbstowcs
9029 eval $inlibc
9030
9031 : see if mbtowc exists
9032 set mbtowc d_mbtowc
9033 eval $inlibc
9034
9035 : see if memchr exists
9036 set memchr d_memchr
9037 eval $inlibc
9038
9039 : see if memcmp exists
9040 set memcmp d_memcmp
9041 eval $inlibc
9042
9043 : see if memcpy exists
9044 set memcpy d_memcpy
9045 eval $inlibc
9046
9047 : see if memmove exists
9048 set memmove d_memmove
9049 eval $inlibc
9050
9051 : see if memset exists
9052 set memset d_memset
9053 eval $inlibc
9054
9055 : see if mkdir exists
9056 set mkdir d_mkdir
9057 eval $inlibc
9058
9059 : see if mkfifo exists
9060 set mkfifo d_mkfifo
9061 eval $inlibc
9062
9063 : see if mktime exists
9064 set mktime d_mktime
9065 eval $inlibc
9066
9067 : see if this is a sys/mman.h system
9068 set sys/mman.h i_sysmman
9069 eval $inhdr
9070
9071 : see if mmap exists
9072 set mmap d_mmap
9073 eval $inlibc
9074 : see what shmat returns
9075 : default to something harmless
9076 mmaptype='void *'
9077 case "$i_sysmman$d_mmap" in
9078 "$define$define")
9079         $cat >mmap.c <<'END'
9080 #include <sys/mman.h>
9081 void *mmap();
9082 END
9083         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9084                 mmaptype='void *'
9085         else
9086                 mmaptype='caddr_t'
9087         fi
9088         echo "and it returns ($mmaptype)." >&4
9089         ;;
9090 esac
9091
9092
9093
9094 : see if mprotect exists
9095 set mprotect d_mprotect
9096 eval $inlibc
9097
9098 : see if msgctl exists
9099 set msgctl d_msgctl
9100 eval $inlibc
9101
9102 : see if msgget exists
9103 set msgget d_msgget
9104 eval $inlibc
9105
9106 : see if msgsnd exists
9107 set msgsnd d_msgsnd
9108 eval $inlibc
9109
9110 : see if msgrcv exists
9111 set msgrcv d_msgrcv
9112 eval $inlibc
9113
9114 : see how much of the 'msg*(2)' library is present.
9115 h_msg=true
9116 echo " "
9117 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9118 *"$undef"*) h_msg=false;;
9119 esac
9120 case "$osname" in
9121 freebsd)
9122     case "`ipcs 2>&1`" in
9123     "SVID messages"*"not configured"*)
9124         echo "Your $osname does not have the msg*(2) configured." >&4
9125         h_msg=false
9126         val="$undef"
9127         set msgctl d_msgctl
9128         eval $setvar
9129         set msgget d_msgget
9130         eval $setvar
9131         set msgsnd d_msgsnd
9132         eval $setvar
9133         set msgrcv d_msgrcv
9134         eval $setvar
9135         ;;
9136     esac
9137     ;;
9138 esac
9139 : we could also check for sys/ipc.h ...
9140 if $h_msg && $test `./findhdr sys/msg.h`; then
9141         echo "You have the full msg*(2) library." >&4
9142         val="$define"
9143 else
9144         echo "You don't have the full msg*(2) library." >&4
9145         val="$undef"
9146 fi
9147 set d_msg
9148 eval $setvar
9149
9150 : see if msync exists
9151 set msync d_msync
9152 eval $inlibc
9153
9154 : see if munmap exists
9155 set munmap d_munmap
9156 eval $inlibc
9157
9158 : see if nice exists
9159 set nice d_nice
9160 eval $inlibc
9161
9162 : see if POSIX threads are available
9163 if test "X$usethreads" = "X$define"; then
9164         set pthread.h i_pthread
9165         eval $inhdr
9166 else
9167         i_pthread="$undef"
9168 fi
9169
9170
9171
9172 : how to create joinable pthreads
9173 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9174         echo " "
9175         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9176         $cat >try.c <<'EOCP'
9177 #include <pthread.h>
9178 int main() {
9179     int detachstate = JOINABLE;
9180 }
9181 EOCP
9182         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9183         if eval $compile; then
9184                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9185                 val="$undef" # Yes, undef.
9186                 set d_old_pthread_create_joinable
9187                 eval $setvar
9188                 val=""
9189                 set old_pthread_create_joinable
9190                 eval $setvar
9191         else
9192                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9193                 if eval $compile; then
9194                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9195                         val="$define"
9196                         set d_old_pthread_create_joinable
9197                         eval $setvar
9198                         val=PTHREAD_CREATE_UNDETACHED
9199                         set old_pthread_create_joinable
9200                         eval $setvar
9201                 else            
9202                         set try -DJOINABLE=__UNDETACHED
9203                         if eval $compile; then
9204                                 echo "You seem to use __UNDETACHED." >&4
9205                                 val="$define"
9206                                 set d_old_pthread_create_joinable
9207                                 eval $setvar
9208                                 val=__UNDETACHED
9209                                 set old_pthread_create_joinable
9210                                 eval $setvar
9211                         else
9212                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9213                                 val="$define"
9214                                 set d_old_pthread_create_joinable
9215                                 eval $setvar
9216                                 val=0
9217                                 set old_pthread_create_joinable
9218                                 eval $setvar
9219                         fi
9220                 fi
9221         fi
9222         $rm -f try try.*
9223 else
9224     d_old_pthread_create_joinable="$undef"
9225     old_pthread_create_joinable=""
9226 fi
9227
9228 : see if pause exists
9229 set pause d_pause
9230 eval $inlibc
9231
9232 : see if pipe exists
9233 set pipe d_pipe
9234 eval $inlibc
9235
9236 : see if poll exists
9237 set poll d_poll
9238 eval $inlibc
9239
9240
9241 : see whether the various POSIXish _yields exist
9242 $cat >try.c <<EOP
9243 #include <pthread.h>
9244 #include <stdio.h>
9245 int main() {
9246 #ifdef SCHED_YIELD
9247         sched_yield();
9248 #else
9249 #ifdef PTHREAD_YIELD
9250         pthread_yield();
9251 #else
9252 #ifdef PTHREAD_YIELD_NULL
9253         pthread_yield(NULL);
9254 #endif
9255 #endif
9256 #endif
9257 }
9258 EOP
9259 : see if sched_yield exists
9260 set try -DSCHED_YIELD
9261 if eval $compile; then
9262     val="$define"
9263     sched_yield='sched_yield()'
9264 else
9265     val="$undef"
9266 fi
9267 case "$usethreads" in
9268 $define)
9269         case "$val" in
9270         $define) echo 'sched_yield() found.' >&4        ;;
9271         *)       echo 'sched_yield() NOT found.' >&4    ;;
9272         esac
9273 esac
9274 set d_sched_yield
9275 eval $setvar
9276
9277 : see if pthread_yield exists
9278 set try -DPTHREAD_YIELD
9279 if eval $compile; then
9280     val="$define"
9281     case "$sched_yield" in
9282     '') sched_yield='pthread_yield()' ;;
9283     esac
9284 else
9285     set try -DPTHREAD_YIELD_NULL
9286     if eval $compile; then
9287         val="$define"
9288         case "$sched_yield" in
9289         '') sched_yield='pthread_yield(NULL)' ;;
9290         esac
9291     else
9292         val="$undef"
9293     fi
9294 fi
9295 case "$usethreads" in
9296 $define)
9297         case "$val" in
9298         $define) echo 'pthread_yield() found.' >&4      ;;
9299         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9300         esac
9301         ;;
9302 esac
9303 set d_pthread_yield
9304 eval $setvar
9305
9306 case "$sched_yield" in
9307 '') sched_yield=undef ;;
9308 esac
9309
9310 $rm -f try try.*
9311
9312 : see if this is a pwd.h system
9313 set pwd.h i_pwd
9314 eval $inhdr
9315
9316 case "$i_pwd" in
9317 $define)
9318         xxx=`./findhdr pwd.h`
9319         $cppstdin $cppflags $cppminus < $xxx >$$.h
9320
9321         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9322                 val="$define"
9323         else
9324                 val="$undef"
9325         fi
9326         set d_pwquota
9327         eval $setvar
9328
9329         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9330                 val="$define"
9331         else
9332                 val="$undef"
9333         fi
9334         set d_pwage
9335         eval $setvar
9336
9337         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9338                 val="$define"
9339         else
9340                 val="$undef"
9341         fi
9342         set d_pwchange
9343         eval $setvar
9344
9345         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9346                 val="$define"
9347         else
9348                 val="$undef"
9349         fi
9350         set d_pwclass
9351         eval $setvar
9352
9353         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9354                 val="$define"
9355         else
9356                 val="$undef"
9357         fi
9358         set d_pwexpire
9359         eval $setvar
9360
9361         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9362                 val="$define"
9363         else
9364                 val="$undef"
9365         fi
9366         set d_pwcomment
9367         eval $setvar
9368
9369         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9370                 val="$define"
9371         else
9372                 val="$undef"
9373         fi
9374         set d_pwgecos
9375         eval $setvar
9376
9377         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9378                 val="$define"
9379         else
9380                 val="$undef"
9381         fi
9382         set d_pwpasswd
9383         eval $setvar
9384
9385         $rm -f $$.h
9386         ;;
9387 *)
9388         val="$undef"; 
9389         set d_pwquota; eval $setvar
9390         set d_pwage; eval $setvar
9391         set d_pwchange; eval $setvar
9392         set d_pwclass; eval $setvar
9393         set d_pwexpire; eval $setvar
9394         set d_pwcomment; eval $setvar
9395         set d_pwgecos; eval $setvar
9396         set d_pwpasswd; eval $setvar
9397         ;;
9398 esac
9399
9400 : see if readdir and friends exist
9401 set readdir d_readdir
9402 eval $inlibc
9403 set seekdir d_seekdir
9404 eval $inlibc
9405 set telldir d_telldir
9406 eval $inlibc
9407 set rewinddir d_rewinddir
9408 eval $inlibc
9409
9410 : see if readlink exists
9411 set readlink d_readlink
9412 eval $inlibc
9413
9414 : see if readv exists
9415 set readv d_readv
9416 eval $inlibc
9417
9418 : see if rename exists
9419 set rename d_rename
9420 eval $inlibc
9421
9422 : see if rmdir exists
9423 set rmdir d_rmdir
9424 eval $inlibc
9425
9426 : see if memory.h is available.
9427 val=''
9428 set memory.h val
9429 eval $inhdr
9430
9431 : See if it conflicts with string.h
9432 case "$val" in
9433 $define)
9434         case "$strings" in
9435         '') ;;
9436         *)
9437                 $cppstdin $cppflags $cppminus < $strings > mem.h
9438                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9439                         echo " "
9440                         echo "We won't be including <memory.h>."
9441                         val="$undef"
9442                 fi
9443                 $rm -f mem.h
9444                 ;;
9445         esac
9446 esac
9447 set i_memory
9448 eval $setvar
9449
9450 : can bcopy handle overlapping blocks?
9451 val="$undef"
9452 case "$d_bcopy" in
9453 "$define")
9454         echo " "
9455         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9456         $cat >try.c <<EOCP
9457 #$i_memory I_MEMORY
9458 #$i_stdlib I_STDLIB
9459 #$i_string I_STRING
9460 #$i_unistd I_UNISTD
9461 EOCP
9462         $cat >>try.c <<'EOCP'
9463 #include <stdio.h>
9464 #ifdef I_MEMORY
9465 #  include <memory.h>
9466 #endif
9467 #ifdef I_STDLIB
9468 #  include <stdlib.h>
9469 #endif
9470 #ifdef I_STRING
9471 #  include <string.h>
9472 #else
9473 #  include <strings.h>
9474 #endif
9475 #ifdef I_UNISTD
9476 #  include <unistd.h>  /* Needed for NetBSD */
9477 #endif
9478 int main()
9479 {
9480 char buf[128], abc[128];
9481 char *b;
9482 int len;
9483 int off;
9484 int align;
9485
9486 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9487
9488 for (align = 7; align >= 0; align--) {
9489         for (len = 36; len; len--) {
9490                 b = buf+align;
9491                 bcopy(abc, b, len);
9492                 for (off = 1; off <= len; off++) {
9493                         bcopy(b, b+off, len);
9494                         bcopy(b+off, b, len);
9495                         if (bcmp(b, abc, len))
9496                                 exit(1);
9497                 }
9498         }
9499 }
9500 exit(0);
9501 }
9502 EOCP
9503         set try
9504         if eval $compile_ok; then
9505                 if ./try 2>/dev/null; then
9506                         echo "Yes, it can."
9507                         val="$define"
9508                 else
9509                         echo "It can't, sorry."
9510                         case "$d_memmove" in
9511                         "$define") echo "But that's Ok since you have memmove()." ;;
9512                         esac
9513                 fi
9514         else
9515                 echo "(I can't compile the test program, so we'll assume not...)"
9516                 case "$d_memmove" in
9517                 "$define") echo "But that's Ok since you have memmove()." ;;
9518                 esac
9519         fi
9520         ;;
9521 esac
9522 $rm -f try.* try core
9523 set d_safebcpy
9524 eval $setvar
9525
9526 : can memcpy handle overlapping blocks?
9527 val="$undef"
9528 case "$d_memcpy" in
9529 "$define")
9530         echo " "
9531         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9532         $cat >try.c <<EOCP
9533 #$i_memory I_MEMORY
9534 #$i_stdlib I_STDLIB
9535 #$i_string I_STRING
9536 #$i_unistd I_UNISTD
9537 EOCP
9538         $cat >>try.c <<'EOCP'
9539 #include <stdio.h>
9540 #ifdef I_MEMORY
9541 #  include <memory.h>
9542 #endif
9543 #ifdef I_STDLIB
9544 #  include <stdlib.h>
9545 #endif
9546 #ifdef I_STRING
9547 #  include <string.h>
9548 #else
9549 #  include <strings.h>
9550 #endif
9551 #ifdef I_UNISTD
9552 #  include <unistd.h>  /* Needed for NetBSD */
9553 #endif
9554 int main()
9555 {
9556 char buf[128], abc[128];
9557 char *b;
9558 int len;
9559 int off;
9560 int align;
9561
9562 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9563    try to store the string in read-only memory. */
9564 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9565
9566 for (align = 7; align >= 0; align--) {
9567         for (len = 36; len; len--) {
9568                 b = buf+align;
9569                 memcpy(b, abc, len);
9570                 for (off = 1; off <= len; off++) {
9571                         memcpy(b+off, b, len);
9572                         memcpy(b, b+off, len);
9573                         if (memcmp(b, abc, len))
9574                                 exit(1);
9575                 }
9576         }
9577 }
9578 exit(0);
9579 }
9580 EOCP
9581         set try
9582         if eval $compile_ok; then
9583                 if ./try 2>/dev/null; then
9584                         echo "Yes, it can."
9585                         val="$define"
9586                 else
9587                         echo "It can't, sorry."
9588                         case "$d_memmove" in
9589                         "$define") echo "But that's Ok since you have memmove()." ;;
9590                         esac
9591                 fi
9592         else
9593                 echo "(I can't compile the test program, so we'll assume not...)"
9594                 case "$d_memmove" in
9595                 "$define") echo "But that's Ok since you have memmove()." ;;
9596                 esac
9597         fi
9598         ;;
9599 esac
9600 $rm -f try.* try core
9601 set d_safemcpy
9602 eval $setvar
9603
9604 : can memcmp be trusted to compare relative magnitude?
9605 val="$undef"
9606 case "$d_memcmp" in
9607 "$define")
9608         echo " "
9609         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9610         $cat >try.c <<EOCP
9611 #$i_memory I_MEMORY
9612 #$i_stdlib I_STDLIB
9613 #$i_string I_STRING
9614 #$i_unistd I_UNISTD
9615 EOCP
9616         $cat >>try.c <<'EOCP'
9617 #include <stdio.h>
9618 #ifdef I_MEMORY
9619 #  include <memory.h>
9620 #endif
9621 #ifdef I_STDLIB
9622 #  include <stdlib.h>
9623 #endif
9624 #ifdef I_STRING
9625 #  include <string.h>
9626 #else
9627 #  include <strings.h>
9628 #endif
9629 #ifdef I_UNISTD
9630 #  include <unistd.h>  /* Needed for NetBSD */
9631 #endif
9632 int main()
9633 {
9634 char a = -1;
9635 char b = 0;
9636 if ((a < b) && memcmp(&a, &b, 1) < 0)
9637         exit(1);
9638 exit(0);
9639 }
9640 EOCP
9641         set try
9642         if eval $compile_ok; then
9643                 if ./try 2>/dev/null; then
9644                         echo "Yes, it can."
9645                         val="$define"
9646                 else
9647                         echo "No, it can't (it uses signed chars)."
9648                 fi
9649         else
9650                 echo "(I can't compile the test program, so we'll assume not...)"
9651         fi
9652         ;;
9653 esac
9654 $rm -f try.* try core
9655 set d_sanemcmp
9656 eval $setvar
9657
9658 : see if select exists
9659 set select d_select
9660 eval $inlibc
9661
9662 : see if semctl exists
9663 set semctl d_semctl
9664 eval $inlibc
9665
9666 : see if semget exists
9667 set semget d_semget
9668 eval $inlibc
9669
9670 : see if semop exists
9671 set semop d_semop
9672 eval $inlibc
9673
9674 : see how much of the 'sem*(2)' library is present.
9675 h_sem=true
9676 echo " "
9677 case "$d_semctl$d_semget$d_semop" in
9678 *"$undef"*) h_sem=false;;
9679 esac
9680 case "$osname" in
9681 freebsd)
9682     case "`ipcs 2>&1`" in
9683     "SVID messages"*"not configured"*)
9684         echo "Your $osname does not have the sem*(2) configured." >&4
9685         h_sem=false
9686         val="$undef"
9687         set semctl d_semctl
9688         eval $setvar
9689         set semget d_semget
9690         eval $setvar
9691         set semop d_semop
9692         eval $setvar
9693         ;;
9694     esac
9695     ;;
9696 esac
9697 : we could also check for sys/ipc.h ...
9698 if $h_sem && $test `./findhdr sys/sem.h`; then
9699         echo "You have the full sem*(2) library." >&4
9700         val="$define"
9701 else
9702         echo "You don't have the full sem*(2) library." >&4
9703         val="$undef"
9704 fi
9705 set d_sem
9706 eval $setvar
9707
9708 : see whether sys/sem.h defines union semun
9709 echo " "
9710 $cat > try.c <<'END'
9711 #include <sys/types.h>
9712 #include <sys/ipc.h>
9713 #include <sys/sem.h>
9714 int main () { union semun semun; semun.buf = 0; }
9715 END
9716 set try
9717 if eval $compile; then
9718     echo "You have union semun in <sys/sem.h>." >&4
9719     val="$define"
9720 else
9721     echo "You do not have union semun in <sys/sem.h>." >&4
9722     val="$undef"
9723 fi
9724 $rm -f try try.c try.h
9725 set d_union_semun
9726 eval $setvar
9727
9728 : see how to do semctl IPC_STAT
9729 case "$d_sem" in
9730 $define)
9731     : see whether semctl IPC_STAT can use union semun
9732     echo " "
9733     $cat > try.h <<END
9734 #ifndef S_IRUSR
9735 #   ifdef S_IREAD
9736 #       define S_IRUSR S_IREAD
9737 #       define S_IWUSR S_IWRITE
9738 #       define S_IXUSR S_IEXEC
9739 #   else
9740 #       define S_IRUSR 0400
9741 #       define S_IWUSR 0200
9742 #       define S_IXUSR 0100
9743 #   endif
9744 #   define S_IRGRP (S_IRUSR>>3)
9745 #   define S_IWGRP (S_IWUSR>>3)
9746 #   define S_IXGRP (S_IXUSR>>3)
9747 #   define S_IROTH (S_IRUSR>>6)
9748 #   define S_IWOTH (S_IWUSR>>6)
9749 #   define S_IXOTH (S_IXUSR>>6)
9750 #endif
9751 #ifndef S_IRWXU
9752 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9753 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9754 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9755 #endif
9756 END
9757
9758     $cat > try.c <<END
9759 #include <sys/types.h>
9760 #include <sys/ipc.h>
9761 #include <sys/sem.h>
9762 #include <sys/stat.h>
9763 #include <stdio.h>
9764 #include <errno.h>
9765 #include "try.h"
9766 #ifndef errno
9767 extern int errno;
9768 #endif
9769 #$d_union_semun HAS_UNION_SEMUN
9770 int main() {
9771     union semun
9772 #ifndef HAS_UNION_SEMUN
9773     {
9774         int val;
9775         struct semid_ds *buf;
9776         unsigned short *array;
9777     }
9778 #endif
9779     arg;
9780     int sem, st;
9781
9782 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9783     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9784     if (sem > -1) {
9785         struct semid_ds argbuf;
9786         arg.buf = &argbuf;
9787 #       ifdef IPC_STAT
9788         st = semctl(sem, 0, IPC_STAT, arg);
9789         if (st == 0)
9790             printf("semun\n");
9791         else
9792 #       endif /* IPC_STAT */
9793             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9794 #       ifdef IPC_RMID
9795         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9796 #       endif /* IPC_RMID */
9797             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9798     } else
9799 #endif /* IPC_PRIVATE && ... */
9800         printf("semget failed: errno = %d\n", errno);
9801   return 0;
9802 }
9803 END
9804     val="$undef"
9805     set try
9806     if eval $compile; then
9807         xxx=`./try`
9808         case "$xxx" in
9809         semun) val="$define" ;;
9810         esac
9811     fi
9812     $rm -f try try.c
9813     set d_semctl_semun
9814     eval $setvar
9815     case "$d_semctl_semun" in
9816     $define)
9817         echo "You can use union semun for semctl IPC_STAT." >&4
9818         also='also'
9819         ;;
9820     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9821         also=''
9822         ;;
9823     esac
9824
9825     : see whether semctl IPC_STAT can use struct semid_ds pointer
9826     $cat > try.c <<'END'
9827 #include <sys/types.h>
9828 #include <sys/ipc.h>
9829 #include <sys/sem.h>
9830 #include <sys/stat.h>
9831 #include "try.h"
9832 #include <stdio.h>
9833 #include <errno.h>
9834 #ifndef errno
9835 extern int errno;
9836 #endif
9837 int main() {
9838     struct semid_ds arg;
9839     int sem, st;
9840
9841 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9842     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9843     if (sem > -1) {
9844 #       ifdef IPC_STAT
9845         st = semctl(sem, 0, IPC_STAT, &arg);
9846         if (st == 0)
9847             printf("semid_ds\n");
9848         else
9849 #       endif /* IPC_STAT */
9850             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9851 #       ifdef IPC_RMID
9852         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9853 #       endif /* IPC_RMID */
9854             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9855     } else
9856 #endif /* IPC_PRIVATE && ... */
9857         printf("semget failed: errno = %d\n", errno);
9858
9859     return 0;
9860 }
9861 END
9862     val="$undef"
9863     set try
9864     if eval $compile; then
9865         xxx=`./try`
9866         case "$xxx" in
9867         semid_ds) val="$define" ;;
9868         esac
9869     fi
9870     $rm -f try try.c
9871     set d_semctl_semid_ds
9872     eval $setvar
9873     case "$d_semctl_semid_ds" in
9874     $define)
9875         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
9876         ;;
9877     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
9878         ;;
9879     esac
9880     $rm -f try.h
9881     ;;
9882 *)  val="$undef"
9883
9884     # We do not have the full sem*(2) library, so assume we can not
9885     # use either.
9886
9887     set d_semctl_semun
9888     eval $setvar
9889
9890     set d_semctl_semid_ds
9891     eval $setvar
9892     ;;
9893 esac
9894
9895 : see if setegid exists
9896 set setegid d_setegid
9897 eval $inlibc
9898
9899 : see if seteuid exists
9900 set seteuid d_seteuid
9901 eval $inlibc
9902
9903 : see if setgrent exists
9904 set setgrent d_setgrent
9905 eval $inlibc
9906
9907 : see if sethostent exists
9908 set sethostent d_sethent
9909 eval $inlibc
9910
9911 : see if setlinebuf exists
9912 set setlinebuf d_setlinebuf
9913 eval $inlibc
9914
9915 : see if setlocale exists
9916 set setlocale d_setlocale
9917 eval $inlibc
9918
9919 : see if setnetent exists
9920 set setnetent d_setnent
9921 eval $inlibc
9922
9923 : see if setprotoent exists
9924 set setprotoent d_setpent
9925 eval $inlibc
9926
9927 : see if setpgid exists
9928 set setpgid d_setpgid
9929 eval $inlibc
9930
9931 : see if setpgrp2 exists
9932 set setpgrp2 d_setpgrp2
9933 eval $inlibc
9934
9935 : see if setpriority exists
9936 set setpriority d_setprior
9937 eval $inlibc
9938
9939 : see if setpwent exists
9940 set setpwent d_setpwent
9941 eval $inlibc
9942
9943 : see if setregid exists
9944 set setregid d_setregid
9945 eval $inlibc
9946 set setresgid d_setresgid
9947 eval $inlibc
9948
9949 : see if setreuid exists
9950 set setreuid d_setreuid
9951 eval $inlibc
9952 set setresuid d_setresuid
9953 eval $inlibc
9954
9955 : see if setrgid exists
9956 set setrgid d_setrgid
9957 eval $inlibc
9958
9959 : see if setruid exists
9960 set setruid d_setruid
9961 eval $inlibc
9962
9963 : see if setservent exists
9964 set setservent d_setsent
9965 eval $inlibc
9966
9967 : see if setsid exists
9968 set setsid d_setsid
9969 eval $inlibc
9970
9971 : see if setspent exists
9972 set setspent d_setspent
9973 eval $inlibc
9974
9975 : see if setvbuf exists
9976 set setvbuf d_setvbuf
9977 eval $inlibc
9978
9979 : see if sfio.h is available
9980 set sfio.h i_sfio
9981 eval $inhdr
9982
9983
9984 : see if sfio library is available
9985 case "$i_sfio" in
9986 $define)
9987         val=''
9988         set sfreserve val
9989         eval $inlibc
9990         ;;
9991 *)
9992         val="$undef"
9993         ;;
9994 esac
9995 : Ok, but do we want to use it.
9996 case "$val" in
9997 $define)
9998         case "$usesfio" in
9999         true|$define|[yY]*) dflt='y';;
10000         *) dflt='n';;
10001         esac
10002         echo "$package can use the sfio library, but it is experimental."
10003         rp="You seem to have sfio available, do you want to try using it?"
10004         . ./myread
10005         case "$ans" in
10006         y|Y) ;;
10007         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10008                 val="$undef"
10009                 : Remove sfio from list of libraries to use
10010                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10011                 shift
10012                 libs="$*"
10013                 echo "libs = $libs" >&4
10014                 ;;
10015         esac
10016         ;;
10017 *)      case "$usesfio" in
10018         true|$define|[yY]*)
10019                 echo "Sorry, cannot find sfio on this machine" >&4
10020                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10021                 ;;
10022         esac
10023         ;;
10024 esac
10025 set d_sfio
10026 eval $setvar
10027 case "$d_sfio" in
10028 $define) usesfio='true';;
10029 *) usesfio='false';;
10030 esac
10031
10032 : see if shmctl exists
10033 set shmctl d_shmctl
10034 eval $inlibc
10035
10036 : see if shmget exists
10037 set shmget d_shmget
10038 eval $inlibc
10039
10040 : see if shmat exists
10041 set shmat d_shmat
10042 eval $inlibc
10043 : see what shmat returns
10044 case "$d_shmat" in
10045 "$define")
10046         $cat >shmat.c <<'END'
10047 #include <sys/shm.h>
10048 void *shmat();
10049 END
10050         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10051                 shmattype='void *'
10052         else
10053                 shmattype='char *'
10054         fi
10055         echo "and it returns ($shmattype)." >&4
10056         : see if a prototype for shmat is available
10057         xxx=`./findhdr sys/shm.h`
10058         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10059         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10060                 val="$define"
10061         else
10062                 val="$undef"
10063         fi
10064         $rm -f shmat.[co]
10065         ;;
10066 *)
10067         val="$undef"
10068         ;;
10069 esac
10070 set d_shmatprototype
10071 eval $setvar
10072
10073 : see if shmdt exists
10074 set shmdt d_shmdt
10075 eval $inlibc
10076
10077 : see how much of the 'shm*(2)' library is present.
10078 h_shm=true
10079 echo " "
10080 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10081 *"$undef"*) h_shm=false;;
10082 esac
10083 case "$osname" in
10084 freebsd)
10085     case "`ipcs 2>&1`" in
10086     "SVID shared memory"*"not configured"*)
10087         echo "Your $osname does not have the shm*(2) configured." >&4
10088         h_shm=false
10089         val="$undef"
10090         set shmctl d_shmctl
10091         evat $setvar
10092         set shmget d_shmget
10093         evat $setvar
10094         set shmat d_shmat
10095         evat $setvar
10096         set shmdt d_shmdt
10097         evat $setvar
10098         ;;
10099     esac
10100     ;;
10101 esac
10102 : we could also check for sys/ipc.h ...
10103 if $h_shm && $test `./findhdr sys/shm.h`; then
10104         echo "You have the full shm*(2) library." >&4
10105         val="$define"
10106 else
10107         echo "You don't have the full shm*(2) library." >&4
10108         val="$undef"
10109 fi
10110 set d_shm
10111 eval $setvar
10112
10113 echo " "
10114 : see if we have sigaction
10115 if set sigaction val -f d_sigaction; eval $csym; $val; then
10116         echo 'sigaction() found.' >&4
10117         $cat > try.c <<'EOP'
10118 #include <stdio.h>
10119 #include <sys/types.h>
10120 #include <signal.h>
10121 int main()
10122 {
10123     struct sigaction act, oact;
10124 }
10125 EOP
10126         set try
10127         if eval $compile_ok; then
10128                 val="$define"
10129         else
10130                 echo "But you don't seem to have a useable struct sigaction." >&4
10131                 val="$undef"
10132         fi
10133 else
10134         echo 'sigaction NOT found.' >&4
10135         val="$undef"
10136 fi
10137 set d_sigaction; eval $setvar
10138 $rm -f try try$_o try.c
10139
10140 : see if sigsetjmp exists
10141 echo " "
10142 case "$d_sigsetjmp" in
10143 '')
10144         $cat >try.c <<'EOP'
10145 #include <setjmp.h>
10146 sigjmp_buf env;
10147 int set = 1;
10148 int main()
10149 {
10150         if (sigsetjmp(env,1))
10151                 exit(set);
10152         set = 0;
10153         siglongjmp(env, 1);
10154         exit(1);
10155 }
10156 EOP
10157         set try
10158         if eval $compile; then
10159                 if ./try >/dev/null 2>&1; then
10160                         echo "POSIX sigsetjmp found." >&4
10161                         val="$define"
10162                 else
10163                         $cat >&4 <<EOM
10164 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10165 I'll ignore them.
10166 EOM
10167                         val="$undef"
10168                 fi
10169         else
10170                 echo "sigsetjmp not found." >&4
10171                 val="$undef"
10172         fi
10173         ;;
10174 *) val="$d_sigsetjmp"
10175         case "$d_sigsetjmp" in
10176         $define) echo "POSIX sigsetjmp found." >&4;;
10177         $undef) echo "sigsetjmp not found." >&4;;
10178         esac
10179         ;;
10180 esac
10181 set d_sigsetjmp
10182 eval $setvar
10183 $rm -f try.c try
10184
10185 : see if sys/stat.h is available
10186 set sys/stat.h i_sysstat
10187 eval $inhdr
10188
10189 : see if stat knows about block sizes
10190 echo " "
10191 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10192 eval $hasfield
10193
10194 : see if _ptr and _cnt from stdio act std
10195 echo " "
10196 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10197         echo "(Looks like you have stdio.h from Linux.)"
10198         case "$stdio_ptr" in
10199         '') stdio_ptr='((fp)->_IO_read_ptr)'
10200                 ptr_lval=$define
10201                 ;;
10202         *)      ptr_lval=$d_stdio_ptr_lval;;
10203         esac
10204         case "$stdio_cnt" in
10205         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10206                 cnt_lval=$undef
10207                 ;;
10208         *)      cnt_lval=$d_stdio_cnt_lval;;
10209         esac
10210         case "$stdio_base" in
10211         '') stdio_base='((fp)->_IO_read_base)';;
10212         esac
10213         case "$stdio_bufsiz" in
10214         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10215         esac
10216 else
10217         case "$stdio_ptr" in
10218         '') stdio_ptr='((fp)->_ptr)'
10219                 ptr_lval=$define
10220                 ;;
10221         *)      ptr_lval=$d_stdio_ptr_lval;;
10222         esac
10223         case "$stdio_cnt" in
10224         '') stdio_cnt='((fp)->_cnt)'
10225                 cnt_lval=$define
10226                 ;;
10227         *)      cnt_lval=$d_stdio_cnt_lval;;
10228         esac
10229         case "$stdio_base" in
10230         '') stdio_base='((fp)->_base)';;
10231         esac
10232         case "$stdio_bufsiz" in
10233         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10234         esac
10235 fi
10236 : test whether _ptr and _cnt really work
10237 echo "Checking how std your stdio is..." >&4
10238 $cat >try.c <<EOP
10239 #include <stdio.h>
10240 #define FILE_ptr(fp)    $stdio_ptr
10241 #define FILE_cnt(fp)    $stdio_cnt
10242 int main() {
10243         FILE *fp = fopen("try.c", "r");
10244         char c = getc(fp);
10245         if (
10246                 18 <= FILE_cnt(fp) &&
10247                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10248         )
10249                 exit(0);
10250         exit(1);
10251 }
10252 EOP
10253 val="$undef"
10254 set try
10255 if eval $compile; then
10256         if ./try; then
10257                 echo "Your stdio acts pretty std."
10258                 val="$define"
10259         else
10260                 echo "Your stdio isn't very std."
10261         fi
10262 else
10263         echo "Your stdio doesn't appear very std."
10264 fi
10265 $rm -f try.c try
10266 set d_stdstdio
10267 eval $setvar
10268
10269 : Can _ptr be used as an lvalue?
10270 case "$d_stdstdio$ptr_lval" in
10271 $define$define) val=$define ;;
10272 *) val=$undef ;;
10273 esac
10274 set d_stdio_ptr_lval
10275 eval $setvar
10276
10277 : Can _cnt be used as an lvalue?
10278 case "$d_stdstdio$cnt_lval" in
10279 $define$define) val=$define ;;
10280 *) val=$undef ;;
10281 esac
10282 set d_stdio_cnt_lval
10283 eval $setvar
10284
10285 : see if _base is also standard
10286 val="$undef"
10287 case "$d_stdstdio" in
10288 $define)
10289         $cat >try.c <<EOP
10290 #include <stdio.h>
10291 #define FILE_base(fp)   $stdio_base
10292 #define FILE_bufsiz(fp) $stdio_bufsiz
10293 int main() {
10294         FILE *fp = fopen("try.c", "r");
10295         char c = getc(fp);
10296         if (
10297                 19 <= FILE_bufsiz(fp) &&
10298                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10299         )
10300                 exit(0);
10301         exit(1);
10302 }
10303 EOP
10304         set try
10305         if eval $compile; then
10306                 if ./try; then
10307                         echo "And its _base field acts std."
10308                         val="$define"
10309                 else
10310                         echo "But its _base field isn't std."
10311                 fi
10312         else
10313                 echo "However, it seems to be lacking the _base field."
10314         fi
10315         $rm -f try.c try
10316         ;;
10317 esac
10318 set d_stdiobase
10319 eval $setvar
10320
10321 $cat >&4 <<EOM
10322 Checking how to access stdio streams by file descriptor number...
10323 EOM
10324 case "$stdio_stream_array" in
10325 '')     $cat >try.c <<EOCP
10326 #include <stdio.h>
10327 int main() {
10328   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10329     printf("yes\n");
10330 }
10331 EOCP
10332         for s in _iob __iob __sF
10333         do
10334                 set try -DSTDIO_STREAM_ARRAY=$s
10335                 if eval $compile; then
10336                         case "`./try$exe_ext`" in
10337                         yes)    stdio_stream_array=$s; break ;;
10338                         esac
10339                 fi
10340         done
10341         $rm -f try.* try$exe_ext
10342 esac
10343 case "$stdio_stream_array" in
10344 '')     $cat >&4 <<EOM
10345 I can't figure out how to access stdio streams by file descriptor number.
10346 EOM
10347         d_stdio_stream_array="$undef"
10348         ;;
10349 *)      $cat >&4 <<EOM
10350 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10351 EOM
10352         d_stdio_stream_array="$define"
10353         ;;
10354 esac
10355
10356 : see if strcoll exists
10357 set strcoll d_strcoll
10358 eval $inlibc
10359
10360 : check for structure copying
10361 echo " "
10362 echo "Checking to see if your C compiler can copy structs..." >&4
10363 $cat >try.c <<'EOCP'
10364 int main()
10365 {
10366         struct blurfl {
10367                 int dyick;
10368         } foo, bar;
10369
10370         foo = bar;
10371 }
10372 EOCP
10373 if $cc -c try.c >/dev/null 2>&1 ; then
10374         val="$define"
10375         echo "Yup, it can."
10376 else
10377         val="$undef"
10378         echo "Nope, it can't."
10379 fi
10380 set d_strctcpy
10381 eval $setvar
10382 $rm -f try.*
10383
10384 : see if strerror and/or sys_errlist[] exist
10385 echo " "
10386 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10387     if set strerror val -f d_strerror; eval $csym; $val; then
10388                 echo 'strerror() found.' >&4
10389                 d_strerror="$define"
10390                 d_strerrm='strerror(e)'
10391                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10392                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10393                         d_syserrlst="$define"
10394                 else
10395                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10396                         d_syserrlst="$undef"
10397                 fi
10398     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10399                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10400                 echo 'strerror() found in string header.' >&4
10401                 d_strerror="$define"
10402                 d_strerrm='strerror(e)'
10403                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10404                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10405                                 d_syserrlst="$define"
10406                 else
10407                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10408                         d_syserrlst="$undef"
10409                 fi
10410     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10411                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10412                 d_strerror="$undef"
10413                 d_syserrlst="$define"
10414                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10415     else
10416                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10417                 d_strerror="$undef"
10418                 d_syserrlst="$undef"
10419                 d_strerrm='"unknown"'
10420     fi
10421 fi
10422
10423 : see if strtod exists
10424 set strtod d_strtod
10425 eval $inlibc
10426
10427 : see if strtol exists
10428 set strtol d_strtol
10429 eval $inlibc
10430
10431 : see if strtoul exists
10432 set strtoul d_strtoul
10433 eval $inlibc
10434
10435 : see if strtoull exists
10436 set strtoull d_strtoull
10437 eval $inlibc
10438
10439 : see if strxfrm exists
10440 set strxfrm d_strxfrm
10441 eval $inlibc
10442
10443 : see if symlink exists
10444 set symlink d_symlink
10445 eval $inlibc
10446
10447 : see if syscall exists
10448 set syscall d_syscall
10449 eval $inlibc
10450
10451 : see if sysconf exists
10452 set sysconf d_sysconf
10453 eval $inlibc
10454
10455 : see if system exists
10456 set system d_system
10457 eval $inlibc
10458
10459 : see if tcgetpgrp exists
10460 set tcgetpgrp d_tcgetpgrp
10461 eval $inlibc
10462
10463 : see if tcsetpgrp exists
10464 set tcsetpgrp d_tcsetpgrp
10465 eval $inlibc
10466
10467 : see if sys/types.h has to be included
10468 set sys/types.h i_systypes
10469 eval $inhdr
10470
10471 : see if prototype for telldir is available
10472 echo " "
10473 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10474 eval $hasproto
10475
10476 : define an is-a-typedef? function
10477 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10478 case "$inclist" in
10479 "") inclist="sys/types.h";;
10480 esac;
10481 eval "varval=\$$var";
10482 case "$varval" in
10483 "")
10484         $rm -f temp.c;
10485         for inc in $inclist; do
10486                 echo "#include <$inc>" >>temp.c;
10487         done;
10488         echo "#ifdef $type" >> temp.c;
10489         echo "printf(\"We have $type\");" >> temp.c;
10490         echo "#endif" >> temp.c;
10491         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10492         if $contains $type temp.E >/dev/null 2>&1; then
10493                 eval "$var=\$type";
10494         else
10495                 eval "$var=\$def";
10496         fi;
10497         $rm -f temp.?;;
10498 *) eval "$var=\$varval";;
10499 esac'
10500
10501 : define an is-a-typedef? function that prompts if the type is not available.
10502 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10503 case "$inclist" in
10504 "") inclist="sys/types.h";;
10505 esac;
10506 eval "varval=\$$var";
10507 case "$varval" in
10508 "")
10509         $rm -f temp.c;
10510         for inc in $inclist; do
10511                 echo "#include <$inc>" >>temp.c;
10512         done;
10513         echo "#ifdef $type" >> temp.c;
10514         echo "printf(\"We have $type\");" >> temp.c;
10515         echo "#endif" >> temp.c;
10516         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10517         echo " " ;
10518         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10519         if $contains $type temp.E >/dev/null 2>&1; then
10520                 echo "$type found." >&4;
10521                 eval "$var=\$type";
10522         else
10523                 echo "$type NOT found." >&4;
10524                 dflt="$def";
10525                 . ./myread ;
10526                 eval "$var=\$ans";
10527         fi;
10528         $rm -f temp.?;;
10529 *) eval "$var=\$varval";;
10530 esac'
10531
10532 : see if this is a sys/times.h system
10533 set sys/times.h i_systimes
10534 eval $inhdr
10535
10536 : see if times exists
10537 echo " "
10538 if set times val -f d_times; eval $csym; $val; then
10539         echo 'times() found.' >&4
10540         d_times="$define"
10541         inc=''
10542         case "$i_systimes" in
10543         "$define") inc='sys/times.h';;
10544         esac
10545         rp="What is the type returned by times() on this system?"
10546         set clock_t clocktype long stdio.h sys/types.h $inc
10547         eval $typedef_ask
10548 else
10549         echo 'times() NOT found, hope that will do.' >&4
10550         d_times="$undef"
10551         clocktype='int'
10552 fi
10553
10554 : see if truncate exists
10555 set truncate d_truncate
10556 eval $inlibc
10557
10558 : see if tzname[] exists
10559 echo " "
10560 if set tzname val -a d_tzname; eval $csym; $val; then
10561         val="$define"
10562         echo 'tzname[] found.' >&4
10563 else
10564         val="$undef"
10565         echo 'tzname[] NOT found.' >&4
10566 fi
10567 set d_tzname
10568 eval $setvar
10569
10570 : see if umask exists
10571 set umask d_umask
10572 eval $inlibc
10573
10574 : backward compatibility for d_hvfork
10575 if test X$d_hvfork != X; then
10576         d_vfork="$d_hvfork"
10577         d_hvfork=''
10578 fi
10579 : see if there is a vfork
10580 val=''
10581 set vfork val
10582 eval $inlibc
10583
10584 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10585 : perl on Solaris 2.x, and probably elsewhere.
10586 case "$val" in
10587 $define)
10588         echo " "
10589         case "$usevfork" in
10590         false) dflt='n';;
10591         *) dflt='y';;
10592         esac
10593         cat <<'EOM'
10594  
10595 Perl can only use a vfork() that doesn't suffer from strict
10596 restrictions on calling functions or modifying global data in
10597 the child.  For example, glibc-2.1 contains such a vfork()
10598 that is unsuitable.  If your system provides a proper fork()
10599 call, chances are that you do NOT want perl to use vfork().
10600
10601 EOM
10602         rp="Do you still want to use vfork()?"
10603         . ./myread
10604         case "$ans" in
10605         y|Y) ;;
10606         *)
10607                 echo "Ok, we won't use vfork()."
10608                 val="$undef"
10609                 ;;
10610         esac
10611         ;;
10612 esac
10613 set d_vfork
10614 eval $setvar
10615 case "$d_vfork" in
10616 $define) usevfork='true';;
10617 *) usevfork='false';;
10618 esac
10619
10620 : see if this is an sysdir system
10621 set sys/dir.h i_sysdir
10622 eval $inhdr
10623
10624 : see if this is an sysndir system
10625 set sys/ndir.h i_sysndir
10626 eval $inhdr
10627
10628 : see if closedir exists
10629 set closedir d_closedir
10630 eval $inlibc
10631
10632 case "$d_closedir" in
10633 "$define")
10634         echo " "
10635         echo "Checking whether closedir() returns a status..." >&4
10636         cat > closedir.c <<EOM
10637 #$i_dirent I_DIRENT             /**/
10638 #$i_sysdir I_SYS_DIR            /**/
10639 #$i_sysndir I_SYS_NDIR          /**/
10640 #$i_systypes I_SYS_TYPES        /**/
10641
10642 #if defined(I_SYS_TYPES)
10643 #include <sys/types.h>
10644 #endif
10645 #if defined(I_DIRENT)
10646 #include <dirent.h>
10647 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10648 #include <sys/dir.h>
10649 #endif
10650 #else
10651 #ifdef I_SYS_NDIR
10652 #include <sys/ndir.h>
10653 #else
10654 #ifdef I_SYS_DIR
10655 #ifdef hp9000s500
10656 #include <ndir.h>       /* may be wrong in the future */
10657 #else
10658 #include <sys/dir.h>
10659 #endif
10660 #endif
10661 #endif
10662 #endif 
10663 int main() { return closedir(opendir(".")); }
10664 EOM
10665         set closedir
10666         if eval $compile_ok; then
10667                 if ./closedir > /dev/null 2>&1 ; then
10668                         echo "Yes, it does."
10669                         val="$undef"
10670                 else
10671                         echo "No, it doesn't."
10672                         val="$define"
10673                 fi
10674         else
10675                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10676                 val="$define"
10677         fi
10678         ;;
10679 *)
10680         val="$undef";
10681         ;;
10682 esac
10683 set d_void_closedir
10684 eval $setvar
10685 $rm -f closedir*
10686 : check for volatile keyword
10687 echo " "
10688 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10689 $cat >try.c <<'EOCP'
10690 int main()
10691 {
10692         typedef struct _goo_struct goo_struct;
10693         goo_struct * volatile goo = ((goo_struct *)0);
10694         struct _goo_struct {
10695                 long long_int;
10696                 int reg_int;
10697                 char char_var;
10698         };
10699         typedef unsigned short foo_t;
10700         char *volatile foo;
10701         volatile int bar;
10702         volatile foo_t blech;
10703         foo = foo;
10704 }
10705 EOCP
10706 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10707         val="$define"
10708         echo "Yup, it does."
10709 else
10710         val="$undef"
10711         echo "Nope, it doesn't."
10712 fi
10713 set d_volatile
10714 eval $setvar
10715 $rm -f try.*
10716
10717 : see if there is a wait4
10718 set wait4 d_wait4
10719 eval $inlibc
10720
10721 : see if waitpid exists
10722 set waitpid d_waitpid
10723 eval $inlibc
10724
10725 : see if wcstombs exists
10726 set wcstombs d_wcstombs
10727 eval $inlibc
10728
10729 : see if wctomb exists
10730 set wctomb d_wctomb
10731 eval $inlibc
10732
10733 : see if writev exists
10734 set writev d_writev
10735 eval $inlibc
10736
10737 : preserve RCS keywords in files with variable substitution, grrr
10738 Date='$Date'
10739 Id='$Id'
10740 Log='$Log'
10741 RCSfile='$RCSfile'
10742 Revision='$Revision'
10743
10744 case "$crosscompile" in
10745 ''|[nN]*) crosscompile="$undef" ;;
10746 esac
10747
10748 case "$osname" in
10749 next|rhapsody) multiarch="$define" ;;
10750 esac
10751 case "$multiarch" in
10752 ''|[nN]*) multiarch="$undef" ;;
10753 esac
10754
10755 : check for alignment requirements
10756 echo " "
10757 case "$crosscompile$multiarch" in
10758 *$define*)
10759         $cat <<EOM
10760 You seem to be either cross-compiling or doing a multiarchitecture build,
10761 skipping the memory alignment check.
10762
10763 EOM
10764         case "$alignbytes" in
10765         '') alignbytes=8 ;;
10766         esac
10767         ;;
10768 *)
10769         case "$alignbytes" in
10770         '') echo "Checking alignment constraints..." >&4
10771                 $cat >try.c <<'EOCP'
10772 struct foobar {
10773         char foo;
10774         double bar;
10775 } try_algn;
10776 int main()
10777 {
10778         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10779 }
10780 EOCP
10781                 set try
10782                 if eval $compile_ok; then
10783                         dflt=`./try`
10784                 else
10785                         dflt='8'
10786                         echo "(I can't seem to compile the test program...)"
10787                 fi
10788                 ;;
10789         *) dflt="$alignbytes"
10790                 ;;
10791         esac
10792         rp="Doubles must be aligned on a how-many-byte boundary?"
10793         . ./myread
10794         alignbytes="$ans"
10795         $rm -f try.c try
10796         ;;
10797 esac
10798
10799
10800 : check for ordering of bytes in a long
10801 echo " "
10802 case "$crosscompile$multiarch" in
10803 *$define*)
10804         $cat <<EOM
10805 You seem to be either cross-compiling or doing a multiarchitecture build,
10806 skipping the byteorder check.
10807
10808 EOM
10809         byteorder='0xffff'
10810         ;;
10811 *)
10812         case "$byteorder" in
10813         '')
10814                 $cat <<'EOM'
10815 In the following, larger digits indicate more significance.  A big-endian
10816 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10817 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10818 machines may have weird orders like 3412.  A Cray will report 87654321,
10819 an Alpha will report 12345678. If the test program works the default is
10820 probably right.
10821 I'm now running the test program...
10822 EOM
10823                 $cat >try.c <<'EOCP'
10824 #include <stdio.h>
10825 int main()
10826 {
10827         int i;
10828         union {
10829                 unsigned long l;
10830                 char c[sizeof(long)];
10831         } u;
10832
10833         if (sizeof(long) > 4)
10834                 u.l = (0x08070605L << 32) | 0x04030201L;
10835         else
10836                 u.l = 0x04030201L;
10837         for (i = 0; i < sizeof(long); i++)
10838                 printf("%c", u.c[i]+'0');
10839         printf("\n");
10840         exit(0);
10841 }
10842 EOCP
10843                 xxx_prompt=y
10844                 set try
10845                 if eval $compile && ./try > /dev/null; then
10846                         dflt=`./try`
10847                         case "$dflt" in
10848                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10849                                 echo "(The test program ran ok.)"
10850                                 echo "byteorder=$dflt"
10851                                 xxx_prompt=n
10852                         ;;
10853                         ????|????????) echo "(The test program ran ok.)" ;;
10854                         *) echo "(The test program didn't run right for some reason.)" ;;
10855                         esac
10856                 else
10857                         dflt='4321'
10858                         cat <<'EOM'
10859 (I can't seem to compile the test program.  Guessing big-endian...)
10860 EOM
10861                 fi
10862                 case "$xxx_prompt" in
10863                 y)
10864                         rp="What is the order of bytes in a long?"
10865                         . ./myread
10866                         byteorder="$ans"
10867                         ;;
10868                 *)      byteorder=$dflt
10869                         ;;
10870                 esac
10871                 ;;
10872         esac
10873         $rm -f try.c try
10874         ;;
10875 esac
10876
10877
10878 : how do we catenate cpp tokens here?
10879 echo " "
10880 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10881 $cat >cpp_stuff.c <<'EOCP'
10882 #define RCAT(a,b)a/**/b
10883 #define ACAT(a,b)a ## b
10884 RCAT(Rei,ser)
10885 ACAT(Cir,cus)
10886 EOCP
10887 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10888 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
10889         echo "Oh!  Smells like ANSI's been here." >&4
10890         echo "We can catify or stringify, separately or together!"
10891         cpp_stuff=42
10892 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
10893         echo "Ah, yes!  The good old days!" >&4
10894         echo "However, in the good old days we don't know how to stringify and"
10895         echo "catify at the same time."
10896         cpp_stuff=1
10897 else
10898         $cat >&4 <<EOM
10899 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
10900 to have to edit the values of CAT[2-5] in config.h...
10901 EOM
10902         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
10903 fi
10904 $rm -f cpp_stuff.*
10905
10906 : see if this is a db.h system
10907 set db.h i_db
10908 eval $inhdr
10909
10910 case "$i_db" in
10911 $define)
10912         : Check db version.
10913         echo " "
10914         echo "Checking Berkeley DB version ..." >&4
10915         $cat >try.c <<EOCP
10916 #$d_const HASCONST
10917 #ifndef HASCONST
10918 #define const
10919 #endif
10920 #include <sys/types.h>
10921 #include <stdio.h>
10922 #include <db.h>
10923 int main()
10924 {
10925 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
10926     int Major, Minor, Patch ;
10927     unsigned long Version ;
10928     (void)db_version(&Major, &Minor, &Patch) ;
10929     printf("You have Berkeley DB Version 2 or greater\n");
10930
10931     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
10932                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
10933     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
10934                 Major, Minor, Patch) ;
10935
10936     /* check that db.h & libdb are compatible */
10937     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
10938         printf("db.h and libdb are incompatible\n") ;
10939         exit(3);        
10940     }
10941
10942     printf("db.h and libdb are compatible\n") ;
10943
10944     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
10945                 + DB_VERSION_PATCH ;
10946
10947     /* needs to be >= 2.3.4 */
10948     if (Version < 2003004) {
10949     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
10950         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
10951         exit(2);        
10952     }
10953
10954     exit(0);
10955 #else
10956 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
10957     printf("You have Berkeley DB Version 1\n");
10958     exit(0);    /* DB version < 2: the coast is clear. */
10959 #else
10960     exit(1);    /* <db.h> not Berkeley DB? */
10961 #endif
10962 #endif
10963 }
10964 EOCP
10965         set try
10966         if eval $compile && ./try; then
10967                 echo 'Looks OK.' >&4
10968         else
10969                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
10970                 i_db=$undef
10971                 case " $libs " in
10972                 *"-ldb "*)
10973                         : Remove db from list of libraries to use
10974                         echo "Removing unusable -ldb from library list" >&4
10975                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
10976                         shift
10977                         libs="$*"
10978                         echo "libs = $libs" >&4
10979                         ;;
10980                 esac
10981         fi
10982         $rm -f try.*
10983         ;;
10984 esac
10985
10986 case "$i_db" in
10987 define)
10988         : Check the return type needed for hash 
10989         echo " "
10990         echo "Checking return type needed for hash for Berkeley DB ..." >&4
10991         $cat >try.c <<EOCP
10992 #$d_const HASCONST
10993 #ifndef HASCONST
10994 #define const
10995 #endif
10996 #include <sys/types.h>
10997 #include <db.h>
10998
10999 #ifndef DB_VERSION_MAJOR
11000 u_int32_t hash_cb (ptr, size)
11001 const void *ptr;
11002 size_t size;
11003 {
11004 }
11005 HASHINFO info;
11006 int main()
11007 {
11008         info.hash = hash_cb;
11009 }
11010 #endif
11011 EOCP
11012         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11013                 if $contains warning try.out >>/dev/null 2>&1 ; then
11014                         db_hashtype='int'
11015                 else
11016                         db_hashtype='u_int32_t'
11017                 fi
11018         else
11019                 : XXX Maybe we should just give up here.
11020                 db_hashtype=u_int32_t
11021                 $cat try.out >&4
11022                 echo "Help:  I can't seem to compile the db test program." >&4
11023                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11024         fi
11025         $rm -f try.*
11026         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11027         ;;
11028 *)      db_hashtype=u_int32_t
11029         ;;
11030 esac
11031 case "$i_db" in
11032 define)
11033         : Check the return type needed for prefix 
11034         echo " "
11035         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11036         cat >try.c <<EOCP
11037 #$d_const HASCONST
11038 #ifndef HASCONST
11039 #define const
11040 #endif
11041 #include <sys/types.h>
11042 #include <db.h>
11043
11044 #ifndef DB_VERSION_MAJOR
11045 size_t prefix_cb (key1, key2)
11046 const DBT *key1;
11047 const DBT *key2;
11048 {
11049 }
11050 BTREEINFO info;
11051 int main()
11052 {
11053         info.prefix = prefix_cb;
11054 }
11055 #endif
11056 EOCP
11057         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11058                 if $contains warning try.out >>/dev/null 2>&1 ; then
11059                         db_prefixtype='int'
11060                 else
11061                         db_prefixtype='size_t'
11062                 fi
11063         else
11064                 db_prefixtype='size_t'
11065                 : XXX Maybe we should just give up here.
11066                 $cat try.out >&4
11067                 echo "Help:  I can't seem to compile the db test program." >&4
11068                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11069         fi
11070         $rm -f try.*
11071         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11072         ;;
11073 *)      db_prefixtype='size_t'
11074         ;;
11075 esac
11076
11077 : check for void type
11078 echo " "
11079 echo "Checking to see how well your C compiler groks the void type..." >&4
11080 case "$voidflags" in
11081 '')
11082         $cat >try.c <<'EOCP'
11083 #if TRY & 1
11084 void sub() {
11085 #else
11086 sub() {
11087 #endif
11088         extern void moo();      /* function returning void */
11089         void (*goo)();          /* ptr to func returning void */
11090 #if TRY & 8
11091         void *hue;              /* generic ptr */
11092 #endif
11093 #if TRY & 2
11094         void (*foo[10])();
11095 #endif
11096
11097 #if TRY & 4
11098         if(goo == moo) {
11099                 exit(0);
11100         }
11101 #endif
11102         exit(0);
11103 }
11104 int main() { sub(); }
11105 EOCP
11106         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11107                 voidflags=$defvoidused
11108         echo "Good.  It appears to support void to the level $package wants.">&4
11109                 if $contains warning .out >/dev/null 2>&1; then
11110                         echo "However, you might get some warnings that look like this:"
11111                         $cat .out
11112                 fi
11113         else
11114 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11115                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11116                         echo "It supports 1..."
11117                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11118                                 echo "It also supports 2..."
11119                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11120                                         voidflags=7
11121                                         echo "And it supports 4 but not 8 definitely."
11122                                 else
11123                                         echo "It doesn't support 4..."
11124                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11125                                                 voidflags=11
11126                                                 echo "But it supports 8."
11127                                         else
11128                                                 voidflags=3
11129                                                 echo "Neither does it support 8."
11130                                         fi
11131                                 fi
11132                         else
11133                                 echo "It does not support 2..."
11134                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11135                                         voidflags=13
11136                                         echo "But it supports 4 and 8."
11137                                 else
11138                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11139                                                 voidflags=5
11140                                                 echo "And it supports 4 but has not heard about 8."
11141                                         else
11142                                                 echo "However it supports 8 but not 4."
11143                                         fi
11144                                 fi
11145                         fi
11146                 else
11147                         echo "There is no support at all for void."
11148                         voidflags=0
11149                 fi
11150         fi
11151 esac
11152 case "$voidflags" in
11153 "$defvoidused") ;;
11154 *)      $cat >&4 <<'EOM'
11155   Support flag bits are:
11156     1: basic void declarations.
11157     2: arrays of pointers to functions returning void.
11158     4: operations between pointers to and addresses of void functions.
11159     8: generic void pointers.
11160 EOM
11161         dflt="$voidflags";
11162         rp="Your void support flags add up to what?"
11163         . ./myread
11164         voidflags="$ans"
11165         ;;
11166 esac
11167 $rm -f try.* .out
11168
11169
11170 : How can we generate normalized random numbers ?
11171 echo " "
11172 echo "Looking for a random number function..." >&4
11173 case "$randfunc" in
11174 '')
11175         if set drand48 val -f; eval $csym; $val; then
11176                 dflt="drand48"
11177                 echo "Good, found drand48()." >&4
11178         elif set random val -f; eval $csym; $val; then
11179                 dflt="random"
11180                 echo "OK, found random()." >&4
11181         else
11182                 dflt="rand"
11183                 echo "Yick, looks like I have to use rand()." >&4
11184         fi
11185         echo " "
11186         ;;
11187 *)
11188         dflt="$randfunc"
11189         ;;
11190 esac
11191 cont=true
11192
11193 case "$ccflags" in
11194 *-Dmy_rand=*|*-Dmy_srand=*)
11195         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11196         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11197         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11198         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11199         ;;
11200 esac
11201
11202 while $test "$cont"; do
11203         rp="Use which function to generate random numbers?"
11204         . ./myread
11205         if $test "$ans" = "$dflt"; then
11206                 : null
11207         else
11208                 randbits=''
11209         fi
11210         randfunc="$ans"
11211         if set $ans val -f; eval $csym; $val; then
11212                 cont=''
11213         else
11214                 dflt=y
11215                 rp="I cannot find function $ans. Use that name anyway?"
11216                 . ./myread
11217                 dflt=rand
11218                 case "$ans" in
11219                         [yY]*) cont='';;
11220                 esac
11221         fi
11222         case "$cont" in
11223         '')
11224                 case "$randfunc" in
11225                 drand48)
11226                         drand01="drand48()"
11227                         seedfunc="srand48"
11228                         randbits=48
11229                         randseedtype=long
11230                         ;;
11231                 rand|random)
11232                         case "$randbits" in
11233                         '')
11234 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11235                                 $cat >try.c <<EOCP
11236 #$i_unistd I_UNISTD
11237 #$i_stdlib I_STDLIB
11238 #include <stdio.h>
11239 #ifdef I_UNISTD
11240 #  include <unistd.h>
11241 #endif
11242 #ifdef I_STDLIB
11243 #  include <stdlib.h>
11244 #endif
11245 int main()
11246 {
11247         register int i;
11248         register unsigned long tmp;
11249         register unsigned long max = 0L;
11250
11251         for (i = 1000; i; i--) {
11252                 tmp = (unsigned long) $randfunc();
11253                 if (tmp > max) max = tmp;
11254         }
11255         for (i = 0; max; i++)
11256                 max /= 2;
11257         printf("%d\n",i);
11258 }
11259 EOCP
11260                                 set try
11261                                 if eval $compile_ok; then
11262                                         dflt=`try`
11263                                 else
11264                                         dflt='?'
11265                                         echo "(I can't seem to compile the test program...)"
11266                                 fi
11267                                 ;;
11268                         *)
11269                                 dflt="$randbits"
11270                                 ;;
11271                         esac
11272                         rp="How many bits does your $randfunc() function produce?"
11273                         . ./myread
11274                         randbits="$ans"
11275                         $rm -f try.c try
11276                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11277                         seedfunc="s$randfunc"
11278                         randseedtype=unsigned
11279                         ;;
11280                 *)
11281                         dflt="31"
11282                         rp="How many bits does your $randfunc() function produce?"
11283                         . ./myread
11284                         randbits="$ans"
11285                         seedfunc="s$randfunc"
11286                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11287                         if set $seedfunc val -f; eval $csym; $val; then
11288                                 echo "(Using $seedfunc() to seed random generator)"
11289                         else
11290                                 echo "(Warning: no $seedfunc() to seed random generator)"
11291                                 seedfunc=rand
11292                         fi
11293                         randseedtype=unsigned
11294                         ;;
11295                 esac
11296                 ;;
11297         esac
11298 done
11299
11300 echo " "
11301 echo "Determining whether or not we are on an EBCDIC system..." >&4
11302 $cat >tebcdic.c <<'EOM'
11303 int main()
11304 {
11305   if ('M'==0xd4) return 0;
11306   return 1;
11307 }
11308 EOM
11309
11310 val=$undef
11311 set tebcdic
11312 if eval $compile_ok; then
11313         if ./tebcdic; then
11314                 echo "You have EBCDIC." >&4
11315                 val="$define"
11316         else
11317                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin, or UTF." >&4
11318         fi
11319 else
11320         echo "I'm unable to compile the test program." >&4
11321         echo "I'll assume ASCII or some ISO Latin." >&4
11322 fi
11323 $rm -f tebcdic.c tebcdic
11324 set ebcdic
11325 eval $setvar
11326
11327 echo " "
11328 $cat >&4 <<EOM
11329 Checking how to flush all pending stdio output...
11330 EOM
11331 # I only know how to find the first 32 possibly open files on SunOS.
11332 # See also hints/sunos_4_1.sh and util.c  --AD
11333 case "$osname" in
11334 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11335 esac
11336 $cat >>try.c <<EOCP
11337 #include <stdio.h>
11338 #$i_unistd I_UNISTD
11339 #ifdef I_UNISTD
11340 # include <unistd.h>
11341 #endif
11342 #$d_sysconf HAS_SYSCONF
11343 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11344 #ifdef HAS_STDIO_STREAM_ARRAY
11345 # define STDIO_STREAM_ARRAY $stdio_stream_array
11346 #endif
11347 int main() {
11348   FILE* p = fopen("try.out", "w");
11349 #ifdef TRY_FPUTC
11350   fputc('x', p);
11351 #else
11352 # ifdef TRY_FPRINTF
11353   fprintf(p, "x");
11354 # endif
11355 #endif
11356 #ifdef TRY_FFLUSH_NULL
11357   fflush(NULL);
11358 #endif
11359 #ifdef TRY_FFLUSH_ALL
11360   {
11361     long open_max = -1;
11362 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11363     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11364 # else
11365 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11366     open_max = sysconf(_SC_OPEN_MAX);
11367 #  else
11368 #   ifdef FOPEN_MAX
11369     open_max = FOPEN_MAX;
11370 #   else
11371 #    ifdef OPEN_MAX
11372     open_max = OPEN_MAX;
11373 #    else
11374 #     ifdef _NFILE
11375     open_max = _NFILE;
11376 #     endif
11377 #    endif
11378 #   endif
11379 #  endif
11380 # endif 
11381 # ifdef HAS_STDIO_STREAM_ARRAY
11382     if (open_max > 0) {
11383       long i;
11384       for (i = 0; i < open_max; i++)
11385             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11386                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11387                 STDIO_STREAM_ARRAY[i]._flag)
11388                 fflush(&STDIO_STREAM_ARRAY[i]);
11389     }   
11390   }
11391 # endif
11392 #endif
11393   _exit(42);
11394 }
11395 EOCP
11396 : first we have to find out how _not_ to flush
11397 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11398     output=''
11399     set try -DTRY_FPUTC
11400     if eval $compile; then
11401             $rm -f try.out
11402             ./try$exe_ext 2>/dev/null
11403             if $test ! -s try.out -a "X$?" = X42; then
11404                 output=-DTRY_FPUTC
11405             fi
11406     fi
11407     case "$output" in
11408     '')
11409             set try -DTRY_FPRINTF
11410             $rm -f try.out
11411             if eval $compile; then
11412                     $rm -f try.out
11413                     ./try$exe_ext 2>/dev/null
11414                     if $test ! -s try.out -a "X$?" = X42; then
11415                         output=-DTRY_FPRINTF
11416                     fi
11417             fi
11418         ;;
11419     esac
11420 fi
11421 : check for fflush NULL behaviour
11422 case "$fflushNULL" in
11423 '')     set try -DTRY_FFLUSH_NULL $output
11424         if eval $compile; then
11425                 $rm -f try.out
11426                 ./try$exe_ext 2>/dev/null
11427                 code="$?"
11428                 if $test -s try.out -a "X$code" = X42; then
11429                         fflushNULL="`$cat try.out`"
11430                 else
11431                         if $test "X$code" != X42; then
11432                                 $cat >&4 <<EOM
11433 (If this test failed, don't worry, we'll try another method shortly.)
11434 EOM
11435                         fi
11436                 fi
11437         fi
11438         $rm -f core try.core core.try.*
11439         case "$fflushNULL" in
11440         x)      $cat >&4 <<EOM
11441 Your fflush(NULL) works okay.
11442 EOM
11443                 fflushNULL="$define"
11444                 ;;
11445         '')     $cat >&4 <<EOM
11446 Your fflush(NULL) isn't working (contrary to ANSI C).
11447 EOM
11448                 fflushNULL="$undef"
11449                 ;;
11450         *)      $cat >&4 <<EOM
11451 Cannot figure out whether your fflush(NULL) works or not.
11452 I'm assuming it doesn't (contrary to ANSI C).
11453 EOM
11454                 fflushNULL="$undef"
11455                 ;;
11456         esac
11457         ;;
11458 $define|true|[yY]*)
11459         fflushNULL="$define"
11460         ;;
11461 *)
11462         fflushNULL="$undef"
11463         ;;
11464 esac
11465 : check explicit looping only if NULL did not work
11466 case "$fflushNULL" in
11467 "$undef")
11468         : check for fflush all behaviour
11469         case "$fflushall" in
11470         '')     set try -DTRY_FFLUSH_ALL $output
11471                 if eval $compile; then
11472                         $cat >&4 <<EOM
11473 (Now testing the other method--but note that also this may fail.)
11474 EOM
11475                         $rm -f try.out
11476                         ./try$exe_ext 2>/dev/null
11477                         if $test -s try.out -a "X$?" = X42; then
11478                                 fflushall="`$cat try.out`"
11479                         fi
11480                 fi
11481                 $rm -f core try.core core.try.*
11482                 case "$fflushall" in
11483                 x)      $cat >&4 <<EOM
11484 Whew. Flushing explicitly all the stdio streams works.
11485 EOM
11486                         fflushall="$define"
11487                         ;;
11488                 '')     $cat >&4 <<EOM
11489 Sigh. Flushing explicitly all the stdio streams doesn't work.
11490 EOM
11491                         fflushall="$undef"
11492                         ;;
11493                 *)      $cat >&4 <<EOM
11494 Cannot figure out whether flushing stdio streams explicitly works or not.
11495 I'm assuming it doesn't.
11496 EOM
11497                         fflushall="$undef"
11498                         ;;
11499                 esac
11500                 ;;
11501         "$define"|true|[yY]*)
11502                 fflushall="$define"
11503                 ;;
11504         *)
11505                 fflushall="$undef"
11506                 ;;
11507         esac
11508         ;;
11509 *)      fflushall="$undef"      
11510         ;;
11511 esac
11512 case "$fflushNULL$fflushall" in
11513 undefundef)
11514         $cat <<EOM
11515 I cannot figure out how to flush pending stdio output.
11516 EOM
11517         ;;
11518 esac
11519 $rm -f try.* try$exe_ext
11520
11521 : see what type file positions are declared as in the library
11522 rp="What is the type for file position used by fsetpos()?"
11523 set fpos_t fpostype long stdio.h sys/types.h
11524 eval $typedef_ask
11525
11526 : Store the full pathname to the ar program for use in the C program
11527 : Respect a hint or command line value for full_ar.
11528 case "$full_ar" in
11529 '') full_ar=$ar ;;
11530 esac
11531
11532 : Store the full pathname to the sed program for use in the C program
11533 full_sed=$sed
11534
11535 : see what type gids are declared as in the kernel
11536 echo " "
11537 echo "Looking for the type for group ids returned by getgid()."
11538 set gid_t gidtype xxx stdio.h sys/types.h
11539 eval $typedef
11540 case "$gidtype" in
11541 xxx)
11542         xxx=`./findhdr sys/user.h`
11543         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11544         case $1 in
11545         unsigned) dflt="$1 $2" ;;
11546         *) dflt="$1" ;;
11547         esac
11548         ;;
11549 *) dflt="$gidtype";;
11550 esac
11551 case "$gidtype" in
11552 gid_t) echo "gid_t found." ;;
11553 *)      rp="What is the type for group ids returned by getgid()?"
11554         . ./myread
11555         gidtype="$ans"
11556         ;;
11557 esac
11558
11559 : see if getgroups exists
11560 set getgroups d_getgrps
11561 eval $inlibc
11562
11563 : see if setgroups exists
11564 set setgroups d_setgrps
11565 eval $inlibc
11566
11567
11568 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11569 echo " "
11570 case "$d_getgrps$d_setgrps" in
11571 *define*)
11572         case "$groupstype" in
11573         '') dflt="$gidtype" ;;
11574         *)  dflt="$groupstype" ;;
11575         esac
11576         $cat <<EOM
11577 What type of pointer is the second argument to getgroups() and setgroups()?
11578 Usually this is the same as group ids, $gidtype, but not always.
11579
11580 EOM
11581         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11582         . ./myread
11583         groupstype="$ans"
11584         ;;
11585 *)  groupstype="$gidtype";;
11586 esac
11587
11588 : see what type lseek is declared as in the kernel
11589 rp="What is the type used for lseek's offset on this system?"
11590 set off_t lseektype long stdio.h sys/types.h
11591 eval $typedef_ask
11592
11593 echo " "
11594 $echo $n "Checking to see how big your file offsets are...$c" >&4
11595 $cat >try.c <<EOCP
11596 #include <sys/types.h>
11597 #include <stdio.h>
11598 int main()
11599 {
11600         printf("%d\n", sizeof($lseektype));
11601 }
11602 EOCP
11603 set try
11604 if eval $compile_ok; then
11605         lseeksize=`./try`
11606         $echo " $lseeksize bytes." >&4
11607 else
11608         dflt='4'
11609         echo " "
11610         echo "(I can't seem to compile the test program.  Guessing...)"
11611         rp="What is the size of your file offsets (in bytes)?"
11612         . ./myread
11613         lseeksize="$ans"
11614 fi
11615 $rm -f try.c try
11616
11617 echo " "
11618 echo "Checking if your $make program sets \$(MAKE)..." >&4
11619 case "$make_set_make" in
11620 '')
11621         $sed 's/^X //' > testmake.mak << 'EOF'
11622 Xall:
11623 X       @echo 'maketemp="$(MAKE)"'
11624 EOF
11625         case "`$make -f testmake.mak 2>/dev/null`" in
11626         *maketemp=*) make_set_make='#' ;;
11627         *)      make_set_make="MAKE=$make" ;;
11628         esac
11629         $rm -f testmake.mak
11630         ;;
11631 esac
11632 case "$make_set_make" in
11633 '#') echo "Yup, it does.";;
11634 *) echo "Nope, it doesn't.";;
11635 esac
11636
11637 : see what type is used for mode_t
11638 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11639 set mode_t modetype int stdio.h sys/types.h
11640 eval $typedef_ask
11641
11642 : define a fucntion to check prototypes
11643 $cat > protochk <<EOSH
11644 $startsh
11645 cc="$cc"
11646 optimize="$optimize"
11647 ccflags="$ccflags"
11648 prototype="$prototype"
11649 define="$define"
11650 rm=$rm
11651 EOSH
11652
11653 $cat >> protochk <<'EOSH'
11654
11655 $rm -f try.c
11656 foo="$1"
11657 shift
11658 while test $# -ge 2; do
11659         case "$1" in
11660                 $define) echo "#include <$2>" >> try.c ;;
11661                 literal) echo "$2" >> try.c ;;
11662         esac
11663     shift 2
11664 done
11665 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11666 cat >> try.c <<'EOCP'
11667 #ifdef CAN_PROTOTYPE
11668 #define _(args) args
11669 #else
11670 #define _(args) ()
11671 #endif
11672 EOCP
11673 echo "$foo" >> try.c
11674 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11675 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11676 status=$?
11677 $rm -f try.[co]
11678 exit $status
11679 EOSH
11680 chmod +x protochk
11681 $eunicefix protochk
11682
11683 : see what type is used for size_t
11684 rp="What is the type used for the length parameter for string functions?"
11685 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11686 eval $typedef_ask
11687
11688 : check for type of arguments to gethostbyaddr. 
11689 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11690         case "$d_gethbyaddr" in
11691         $define)
11692                 $cat <<EOM
11693
11694 Checking to see what type of arguments are accepted by gethostbyaddr().
11695 EOM
11696                 hdrs="$define sys/types.h
11697                         $d_socket sys/socket.h 
11698                         $i_niin netinet/in.h 
11699                         $i_netdb netdb.h
11700                         $i_unistd unistd.h"
11701                 : The first arg can 'char *' or 'void *'
11702                 : The second arg is some of integral type
11703                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11704                         for yyy in size_t long int; do
11705                                 case "$netdb_host_type" in
11706                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11707                                         if ./protochk "$try" $hdrs; then
11708                                                 echo "Your system accepts $xxx for the first arg."
11709                                                 echo "...and $yyy for the second arg."
11710                                                 netdb_host_type="$xxx"
11711                                                 netdb_hlen_type="$yyy"
11712                                         fi
11713                                         ;;
11714                                 esac
11715                         done
11716                 done
11717                 : In case none of those worked, prompt the user.
11718                 case "$netdb_host_type" in
11719                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11720                         dflt='char *'
11721                         . ./myread
11722                         netdb_host_type=$ans
11723                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11724                         dflt="$sizetype"
11725                         . ./myread
11726                         netdb_hlen_type=$ans
11727                         ;;
11728                 esac
11729                 ;;
11730         *)      : no gethostbyaddr, so pick harmless defaults
11731                 netdb_host_type='char *'
11732                 netdb_hlen_type="$sizetype"
11733                 ;;
11734         esac
11735         # Remove the "const" if needed. -- but then we'll have a 
11736         # prototype clash!
11737         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11738 fi
11739
11740 : check for type of argument to gethostbyname. 
11741 if test "X$netdb_name_type" = X ; then
11742         case "$d_gethbyname" in
11743         $define)
11744                 $cat <<EOM
11745
11746 Checking to see what type of argument is accepted by gethostbyname().
11747 EOM
11748                 hdrs="$define sys/types.h
11749                         $d_socket sys/socket.h 
11750                         $i_niin netinet/in.h 
11751                         $i_netdb netdb.h
11752                         $i_unistd unistd.h"
11753                 for xxx in "const char *" "char *"; do
11754                         case "$netdb_name_type" in
11755                         '')     try="extern struct hostent *gethostbyname($xxx);"
11756                                 if ./protochk "$try" $hdrs; then
11757                                         echo "Your system accepts $xxx."
11758                                         netdb_name_type="$xxx"
11759                                 fi
11760                                 ;;
11761                         esac
11762                 done
11763                 : In case none of those worked, prompt the user.
11764                 case "$netdb_name_type" in
11765                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11766                         dflt='char *'
11767                         . ./myread
11768                         netdb_name_type=$ans
11769                         ;;
11770                 esac
11771                 ;;
11772         *)      : no gethostbyname, so pick harmless default
11773                 netdb_name_type='char *'
11774                 ;;
11775         esac
11776 fi
11777
11778 : check for type of 1st argument to getnetbyaddr. 
11779 if test "X$netdb_net_type" = X ; then
11780         case "$d_getnbyaddr" in
11781         $define)
11782                 $cat <<EOM
11783
11784 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11785 EOM
11786                 hdrs="$define sys/types.h
11787                         $d_socket sys/socket.h 
11788                         $i_niin netinet/in.h 
11789                         $i_netdb netdb.h
11790                         $i_unistd unistd.h"
11791                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11792                         case "$netdb_net_type" in
11793                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11794                                 if ./protochk "$try" $hdrs; then
11795                                         echo "Your system accepts $xxx."
11796                                         netdb_net_type="$xxx"
11797                                 fi
11798                                 ;;
11799                         esac
11800                 done
11801                 : In case none of those worked, prompt the user.
11802                 case "$netdb_net_type" in
11803                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11804                         dflt='long'
11805                         . ./myread
11806                         netdb_net_type=$ans
11807                         ;;
11808                 esac
11809                 ;;
11810         *)      : no getnetbyaddr, so pick harmless default
11811                 netdb_net_type='long'
11812                 ;;
11813         esac
11814 fi
11815 : locate the preferred pager for this system
11816 case "$pager" in
11817 '')
11818         dflt=''
11819         case "$pg" in
11820         /*) dflt=$pg;;
11821         esac
11822         case "$more" in
11823         /*) dflt=$more;;
11824         esac
11825         case "$less" in
11826         /*) dflt=$less;;
11827         esac
11828         case "$dflt" in
11829         '') dflt=/usr/ucb/more;;
11830         esac
11831         ;;
11832 *) dflt="$pager";;
11833 esac
11834 echo " "
11835 fn=f/
11836 rp='What pager is used on your system?'
11837 . ./getfile
11838 pager="$ans"
11839
11840 : see what type pids are declared as in the kernel
11841 rp="What is the type of process ids on this system?"
11842 set pid_t pidtype int stdio.h sys/types.h
11843 eval $typedef_ask
11844
11845 : check for length of pointer
11846 echo " "
11847 case "$ptrsize" in
11848 '')
11849         $echo $n "Checking to see how big your pointers are...$c" >&4
11850         if test "$voidflags" -gt 7; then
11851                 echo '#define VOID_PTR char *' > try.c
11852         else
11853                 echo '#define VOID_PTR void *' > try.c
11854         fi
11855         $cat >>try.c <<'EOCP'
11856 #include <stdio.h>
11857 int main()
11858 {
11859         printf("%d\n", sizeof(VOID_PTR));
11860         exit(0);
11861 }
11862 EOCP
11863         set try
11864         if eval $compile_ok; then
11865                 ptrsize=`./try`
11866                 $echo " $ptrsize bytes." >&4
11867         else
11868                 dflt='4'
11869                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
11870                 rp="What is the size of a pointer (in bytes)?"
11871                 . ./myread
11872                 ptrsize="$ans"
11873         fi
11874         ;;
11875 esac
11876 $rm -f try.c try
11877
11878 : see if ar generates random libraries by itself
11879 echo " "
11880 echo "Checking how to generate random libraries on your machine..." >&4
11881 echo 'int bar1() { return bar2(); }' > bar1.c
11882 echo 'int bar2() { return 2; }' > bar2.c
11883 $cat > foo.c <<'EOP'
11884 int main() { printf("%d\n", bar1()); exit(0); }
11885 EOP
11886 $cc $ccflags -c bar1.c >/dev/null 2>&1
11887 $cc $ccflags -c bar2.c >/dev/null 2>&1
11888 $cc $ccflags -c foo.c >/dev/null 2>&1
11889 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11890 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11891         ./foobar >/dev/null 2>&1; then
11892         echo "$ar appears to generate random libraries itself."
11893         orderlib=false
11894         ranlib=":"
11895 elif $ar ts bar$_a >/dev/null 2>&1 &&
11896         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11897         ./foobar >/dev/null 2>&1; then
11898                 echo "a table of contents needs to be added with '$ar ts'."
11899                 orderlib=false
11900                 ranlib="$ar ts"
11901 else
11902         case "$ranlib" in
11903         :) ranlib='';;
11904         '')
11905                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
11906                 $test -f $ranlib || ranlib=''
11907                 ;;
11908         esac
11909         if $test -n "$ranlib"; then
11910                 echo "your system has '$ranlib'; we'll use that."
11911                 orderlib=false
11912         else
11913                 echo "your system doesn't seem to support random libraries"
11914                 echo "so we'll use lorder and tsort to order the libraries."
11915                 orderlib=true
11916                 ranlib=":"
11917         fi
11918 fi
11919 $rm -f foo* bar* 
11920
11921 : check for type of arguments to select. 
11922 case "$selecttype" in
11923 '') case "$d_select" in
11924         $define)
11925                 $cat <<EOM
11926 Checking to see what type of arguments are accepted by select().
11927 EOM
11928                 hdrs="$define sys/types.h
11929                         $i_systime sys/time.h 
11930                         $i_sysselct sys/select.h
11931                         $d_socket sys/socket.h"
11932                 : The first arg can be int, unsigned, or size_t
11933                 : The last arg may or may not be 'const'
11934                 val=''
11935                 : void pointer has been seen but using that
11936                 : breaks the selectminbits test
11937                 for xxx in 'fd_set *' 'int *'; do
11938                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
11939                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
11940                                         case "$val" in
11941                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
11942                                                 if ./protochk "$try" $hdrs; then
11943                                                         echo "Your system accepts $xxx."
11944                                                         val="$xxx"
11945                                                 fi
11946                                                 ;;
11947                                         esac
11948                                 done
11949                         done
11950                 done
11951                 case "$val" in
11952                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
11953                         case "$d_fd_set" in
11954                                 $define) dflt="fd_set *" ;;
11955                                 *)              dflt="int *" ;;
11956                         esac
11957                         . ./myread
11958                         val=$ans
11959                         ;;
11960                 esac
11961                 selecttype="$val"
11962                 ;;
11963         *)      : no select, so pick a harmless default
11964                 selecttype='int *'
11965                 ;;
11966         esac
11967         ;;
11968 esac
11969
11970 : check for the select 'width'
11971 case "$selectminbits" in
11972 '') case "$d_select" in
11973         $define)
11974                 $cat <<EOM
11975
11976 Checking to see on how many bits at a time your select() operates...
11977 EOM
11978                 $cat >try.c <<EOCP
11979 #include <sys/types.h>
11980 #$i_time I_TIME
11981 #$i_systime I_SYS_TIME
11982 #$i_systimek I_SYS_TIME_KERNEL
11983 #ifdef I_TIME
11984 #   include <time.h>
11985 #endif
11986 #ifdef I_SYS_TIME
11987 #   ifdef I_SYS_TIME_KERNEL
11988 #       define KERNEL
11989 #   endif
11990 #   include <sys/time.h>
11991 #   ifdef I_SYS_TIME_KERNEL
11992 #       undef KERNEL
11993 #   endif
11994 #endif
11995 #$i_sysselct I_SYS_SELECT
11996 #ifdef I_SYS_SELECT
11997 #include <sys/select.h>
11998 #endif
11999 #$d_socket HAS_SOCKET
12000 #ifdef HAS_SOCKET
12001 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12002 #endif
12003 #include <stdio.h>
12004 $selecttype b;
12005 #define S sizeof(*(b))
12006 #define MINBITS 64
12007 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12008 #define NBITS  (NBYTES * 8)
12009 int main() {
12010     char s[NBYTES];
12011     struct timeval t;
12012     int i;
12013     FILE* fp;
12014     int fd;
12015
12016     fclose(stdin);
12017     fp = fopen("try.c", "r");
12018     if (fp == 0)
12019       exit(1);
12020     fd = fileno(fp);
12021     if (fd < 0)
12022       exit(2);
12023     b = ($selecttype)s;
12024     for (i = 0; i < NBITS; i++)
12025         FD_SET(i, b);
12026     t.tv_sec  = 0;
12027     t.tv_usec = 0;
12028     select(fd + 1, b, 0, 0, &t);
12029     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12030     printf("%d\n", i + 1);
12031     return 0;
12032 }
12033 EOCP
12034                 set try
12035                 if eval $compile_ok; then
12036                         selectminbits=`./try`
12037                         case "$selectminbits" in
12038                         '')     cat >&4 <<EOM
12039 Cannot figure out on how many bits at a time your select() operates.
12040 I'll play safe and guess it is 32 bits.
12041 EOM
12042                                 selectminbits=32
12043                                 bits="32 bits"
12044                                 ;;
12045                         1)      bits="1 bit" ;;
12046                         *)      bits="$selectminbits bits" ;;
12047                         esac
12048                         echo "Your select() operates on $bits at a time." >&4
12049                 else
12050                         rp='What is the minimum number of bits your select() operates on?'
12051                         case "$byteorder" in
12052                         1234|12345678)  dflt=32 ;;
12053                         *)              dflt=1  ;;
12054                         esac
12055                         . ./myread
12056                         val=$ans
12057                         selectminbits="$val"
12058                 fi
12059                 $rm -f try.* try
12060                 ;;
12061         *)      : no select, so pick a harmless default
12062                 selectminbits='32'
12063                 ;;
12064         esac
12065         ;;
12066 esac
12067
12068 : Trace out the files included by signal.h, then look for SIGxxx names.
12069 : Remove SIGARRAYSIZE used by HPUX.
12070 : Remove SIGSTKSIZE used by Linux.
12071 : Remove SIGSTKSZ used by Posix.
12072 : Remove SIGTYP void lines used by OS2.
12073 xxx=`echo '#include <signal.h>' |
12074         $cppstdin $cppminus $cppflags 2>/dev/null |
12075         $grep '^[       ]*#.*include' | 
12076         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12077 : Check this list of files to be sure we have parsed the cpp output ok.
12078 : This will also avoid potentially non-existent files, such 
12079 : as ../foo/bar.h
12080 xxxfiles=''
12081 for xx in $xxx /dev/null ; do
12082         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12083 done
12084 : If we have found no files, at least try signal.h
12085 case "$xxxfiles" in
12086 '')     xxxfiles=`./findhdr signal.h` ;;
12087 esac
12088 xxx=`awk '
12089 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12090         print substr($2, 4, 20)
12091 }
12092 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12093         print substr($3, 4, 20)
12094 }' $xxxfiles`
12095 : Append some common names just in case the awk scan failed.
12096 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12097 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12098 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12099 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12100 : generate a few handy files for later
12101 $cat > signal.c <<'EOCP'
12102 #include <sys/types.h>
12103 #include <signal.h>
12104 #include <stdio.h>
12105 int main() {
12106
12107 /* Strange style to avoid deeply-nested #if/#else/#endif */
12108 #ifndef NSIG
12109 #  ifdef _NSIG
12110 #    define NSIG (_NSIG)
12111 #  endif
12112 #endif
12113
12114 #ifndef NSIG
12115 #  ifdef SIGMAX
12116 #    define NSIG (SIGMAX+1)
12117 #  endif
12118 #endif
12119
12120 #ifndef NSIG
12121 #  ifdef SIG_MAX
12122 #    define NSIG (SIG_MAX+1)
12123 #  endif
12124 #endif
12125
12126 #ifndef NSIG
12127 #  ifdef MAXSIG
12128 #    define NSIG (MAXSIG+1)
12129 #  endif
12130 #endif
12131
12132 #ifndef NSIG
12133 #  ifdef MAX_SIG
12134 #    define NSIG (MAX_SIG+1)
12135 #  endif
12136 #endif
12137
12138 #ifndef NSIG
12139 #  ifdef SIGARRAYSIZE
12140 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12141 #  endif
12142 #endif
12143
12144 #ifndef NSIG
12145 #  ifdef _sys_nsig
12146 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12147 #  endif
12148 #endif
12149
12150 /* Default to some arbitrary number that's big enough to get most
12151    of the common signals.
12152 */
12153 #ifndef NSIG
12154 #    define NSIG 50
12155 #endif
12156
12157 printf("NSIG %d\n", NSIG);
12158
12159 #ifndef JUST_NSIG
12160
12161 EOCP
12162
12163 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12164 {
12165         printf "#ifdef SIG"; printf $1; printf "\n"
12166         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12167         printf $1; printf ");\n"
12168         printf "#endif\n"
12169 }
12170 END {
12171         printf "#endif /* JUST_NSIG */\n";
12172         printf "}\n";
12173 }
12174 ' >>signal.c
12175 $cat >signal.awk <<'EOP'
12176 BEGIN { ndups = 0 }
12177 $1 ~ /^NSIG$/ { nsig = $2 }
12178 ($1 !~ /^NSIG$/) && (NF == 2) {
12179     if ($2 > maxsig) { maxsig = $2 }
12180     if (sig_name[$2]) {
12181         dup_name[ndups] = $1
12182         dup_num[ndups] = $2
12183         ndups++ 
12184     }
12185     else {
12186         sig_name[$2] = $1
12187         sig_num[$2] = $2
12188     }
12189 }
12190 END { 
12191     if (nsig == 0) {
12192         nsig = maxsig + 1
12193     }
12194     printf("NSIG %d\n", nsig);
12195     for (n = 1; n < nsig; n++) {
12196         if (sig_name[n]) {
12197             printf("%s %d\n", sig_name[n], sig_num[n])
12198         }
12199         else {
12200             printf("NUM%d %d\n", n, n) 
12201         }
12202     }
12203     for (n = 0; n < ndups; n++) {
12204         printf("%s %d\n", dup_name[n], dup_num[n])
12205     }
12206 }
12207 EOP
12208 $cat >signal_cmd <<EOS
12209 $startsh
12210 if $test -s signal.lst; then
12211     echo "Using your existing signal.lst file"
12212         exit 0
12213 fi
12214 xxx="$xxx"
12215 EOS
12216 $cat >>signal_cmd <<'EOS'
12217
12218 set signal
12219 if eval $compile_ok; then
12220         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12221 else
12222         echo "(I can't seem be able to compile the whole test program)" >&4
12223         echo "(I'll try it in little pieces.)" >&4
12224         set signal -DJUST_NSIG
12225         if eval $compile_ok; then
12226                 ./signal$_exe > signal.nsg
12227                 $cat signal.nsg
12228         else
12229                 echo "I can't seem to figure out how many signals you have." >&4
12230                 echo "Guessing 50." >&4
12231                 echo 'NSIG 50' > signal.nsg
12232         fi
12233         : Now look at all the signal names, one at a time.
12234         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12235                 $cat > signal.c <<EOCP
12236 #include <sys/types.h>
12237 #include <signal.h>
12238 #include <stdio.h>
12239 int main() {
12240 printf("$xx %d\n", SIG${xx});
12241 return 0;
12242 }
12243 EOCP
12244                 set signal
12245                 if eval $compile; then
12246                         echo "SIG${xx} found."
12247                         ./signal$_exe  >> signal.ls1
12248                 else
12249                         echo "SIG${xx} NOT found."
12250                 fi
12251         done
12252         if $test -s signal.ls1; then
12253                 $cat signal.nsg signal.ls1 |
12254                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12255         fi
12256
12257 fi
12258 if $test -s signal.lst; then
12259         :
12260 else
12261         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12262         echo 'kill -l' >signal
12263         set X `csh -f <signal`
12264         $rm -f signal
12265         shift
12266         case $# in
12267         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12268         esac
12269         echo $@ | $tr ' ' $trnl | \
12270             $awk '{ printf "%s %d\n", $1, ++s; }
12271                   END { printf "NSIG %d\n", ++s }' >signal.lst
12272 fi
12273 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12274 EOS
12275 chmod a+x signal_cmd
12276 $eunicefix signal_cmd
12277
12278 : generate list of signal names
12279 echo " "
12280 case "$sig_name_init" in
12281 '') doinit=yes ;;
12282 *)  case "$sig_num_init" in
12283     ''|*,*) doinit=yes ;;
12284     esac ;;
12285 esac
12286 case "$doinit" in
12287 yes)
12288         echo "Generating a list of signal names and numbers..." >&4
12289         . ./signal_cmd
12290         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12291         sig_name=`$awk 'BEGIN { printf "ZERO " }
12292                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12293         sig_num=`$awk  'BEGIN { printf "0 " }
12294                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12295         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12296                              !/^NSIG/   { printf "\"%s\", ", $1 }
12297                              END        { printf "0\n" }' signal.lst`
12298         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12299                              !/^NSIG/   { printf "%d, ", $2}
12300                              END        { printf "0\n"}' signal.lst`
12301         ;;
12302 esac
12303 echo "The following $sig_count signals are available:"
12304 echo " "
12305 echo $sig_name | $awk \
12306 'BEGIN { linelen = 0 }
12307 {
12308         for (i = 1; i <= NF; i++) {
12309                 name = "SIG" $i " "
12310                 linelen = linelen + length(name)
12311                 if (linelen > 70) {
12312                         printf "\n"
12313                         linelen = length(name)
12314                 }
12315                 printf "%s", name
12316         }
12317         printf "\n"
12318 }'
12319 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12320
12321 : see what type is used for signed size_t
12322 set ssize_t ssizetype int stdio.h sys/types.h
12323 eval $typedef
12324 dflt="$ssizetype"
12325 $cat > ssize.c <<EOM
12326 #include <stdio.h>
12327 #include <sys/types.h>
12328 #define Size_t $sizetype
12329 #define SSize_t $dflt
12330 int main()
12331 {
12332         if (sizeof(Size_t) == sizeof(SSize_t))
12333                 printf("$dflt\n");
12334         else if (sizeof(Size_t) == sizeof(int))
12335                 printf("int\n");
12336         else 
12337                 printf("long\n");
12338         exit(0);
12339 }
12340 EOM
12341 echo " "
12342 set ssize
12343 if eval $compile_ok && ./ssize > /dev/null; then
12344         ssizetype=`./ssize`
12345         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12346 else
12347         $cat >&4 <<EOM
12348 Help! I can't compile and run the ssize_t test program: please enlighten me!
12349 (This is probably a misconfiguration in your system or libraries, and
12350 you really ought to fix it.  Still, I'll try anyway.)
12351
12352 I need a type that is the same size as $sizetype, but is guaranteed to
12353 be signed.  Common values are ssize_t, int and long.
12354
12355 EOM
12356         rp="What signed type is the same size as $sizetype?"
12357         . ./myread
12358         ssizetype="$ans"
12359 fi
12360 $rm -f ssize ssize.*
12361
12362 : see what type of char stdio uses.
12363 echo " "
12364 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12365         echo "Your stdio uses unsigned chars." >&4
12366         stdchar="unsigned char"
12367 else
12368         echo "Your stdio uses signed chars." >&4
12369         stdchar="char"
12370 fi
12371
12372 : see if time exists
12373 echo " "
12374 if test "X$d_time" = X -o X"$timetype" = X; then
12375     if set time val -f d_time; eval $csym; $val; then
12376                 echo 'time() found.' >&4
12377                 val="$define"
12378                 rp="What is the type returned by time() on this system?"
12379                 set time_t timetype long stdio.h sys/types.h
12380                 eval $typedef_ask
12381     else
12382                 echo 'time() not found, hope that will do.' >&4
12383                 val="$undef"
12384                 timetype='int';
12385     fi
12386     set d_time
12387     eval $setvar
12388 fi
12389
12390 : see what type uids are declared as in the kernel
12391 echo " "
12392 echo "Looking for the type for user ids returned by getuid()."
12393 set uid_t uidtype xxx stdio.h sys/types.h
12394 eval $typedef
12395 case "$uidtype" in
12396 xxx)
12397         xxx=`./findhdr sys/user.h`
12398         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12399         case $1 in
12400         unsigned) dflt="$1 $2" ;;
12401         *) dflt="$1" ;;
12402         esac
12403         ;;
12404 *) dflt="$uidtype";;
12405 esac
12406 case "$uidtype" in
12407 uid_t)  echo "uid_t found." ;;
12408 *)      rp="What is the type for user ids returned by getuid()?"
12409         . ./myread
12410         uidtype="$ans"
12411         ;;
12412 esac
12413
12414 : see if dbm.h is available
12415 : see if dbmclose exists
12416 set dbmclose d_dbmclose
12417 eval $inlibc
12418
12419 case "$d_dbmclose" in
12420 $define)
12421         set dbm.h i_dbm
12422         eval $inhdr
12423         case "$i_dbm" in
12424         $define)
12425                 val="$undef"
12426                 set i_rpcsvcdbm
12427                 eval $setvar
12428                 ;;
12429         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12430                 eval $inhdr
12431                 ;;
12432         esac
12433         ;;
12434 *)      echo "We won't be including <dbm.h>"
12435         val="$undef"
12436         set i_dbm
12437         eval $setvar
12438         val="$undef"
12439         set i_rpcsvcdbm
12440         eval $setvar
12441         ;;
12442 esac
12443
12444 : see if this is a sys/file.h system
12445 val=''
12446 set sys/file.h val
12447 eval $inhdr
12448
12449 : do we need to include sys/file.h ?
12450 case "$val" in
12451 "$define")
12452         echo " "
12453         if $h_sysfile; then
12454                 val="$define"
12455                 echo "We'll be including <sys/file.h>." >&4
12456         else
12457                 val="$undef"
12458                 echo "We won't be including <sys/file.h>." >&4
12459         fi
12460         ;;
12461 *)
12462         h_sysfile=false
12463         ;;
12464 esac
12465 set i_sysfile
12466 eval $setvar
12467
12468 : see if fcntl.h is there
12469 val=''
12470 set fcntl.h val
12471 eval $inhdr
12472
12473 : see if we can include fcntl.h
12474 case "$val" in
12475 "$define")
12476         echo " "
12477         if $h_fcntl; then
12478                 val="$define"
12479                 echo "We'll be including <fcntl.h>." >&4
12480         else
12481                 val="$undef"
12482                 if $h_sysfile; then
12483         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12484                 else
12485                         echo "We won't be including <fcntl.h>." >&4
12486                 fi
12487         fi
12488         ;;
12489 *)
12490         h_fcntl=false
12491         val="$undef"
12492         ;;
12493 esac
12494 set i_fcntl
12495 eval $setvar
12496
12497 : see if locale.h is available
12498 set locale.h i_locale
12499 eval $inhdr
12500
12501 : see if mach cthreads are available
12502 if test "X$usethreads" = "X$define"; then
12503         set mach/cthreads.h i_machcthr
12504         eval $inhdr
12505 else
12506         i_machcthr="$undef"
12507 fi
12508
12509
12510
12511 : see if this is a math.h system
12512 set math.h i_math
12513 eval $inhdr
12514
12515 : see if this is a mntent.h system
12516 set mntent.h i_mntent
12517 eval $inhdr
12518
12519 : see if ndbm.h is available
12520 set ndbm.h t_ndbm
12521 eval $inhdr
12522 case "$t_ndbm" in
12523 $define)
12524         : see if dbm_open exists
12525         set dbm_open d_dbm_open
12526         eval $inlibc
12527         case "$d_dbm_open" in
12528         $undef)
12529                 t_ndbm="$undef"
12530                 echo "We won't be including <ndbm.h>"
12531                 ;;
12532         esac
12533         ;;
12534 esac
12535 val="$t_ndbm"
12536 set i_ndbm
12537 eval $setvar
12538
12539 : see if net/errno.h is available
12540 val=''
12541 set net/errno.h val
12542 eval $inhdr
12543
12544 : Unfortunately, it causes problems on some systems.  Arrgh.
12545 case "$val" in
12546 $define)
12547         cat > try.c <<'EOM'
12548 #include <stdio.h>
12549 #include <errno.h>
12550 #include <net/errno.h>
12551 int func()
12552 {
12553         return ENOTSOCK;
12554 }
12555 EOM
12556         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12557                 echo "We'll be including <net/errno.h>." >&4
12558         else
12559                 echo "We won't be including <net/errno.h>." >&4
12560                 val="$undef"
12561         fi
12562         $rm -f try.* try
12563         ;;
12564 esac
12565 set i_neterrno
12566 eval $setvar
12567
12568 : see if netinet/tcp.h is available
12569 set netinet/tcp.h i_netinettcp
12570 eval $inhdr
12571
12572 : see if this is a poll.h system
12573 set poll.h i_poll
12574 eval $inhdr
12575
12576 : get C preprocessor symbols handy
12577 echo " "
12578 $echo $n "Hmm... $c"
12579 echo $al | $tr ' ' $trnl >Cppsym.know
12580 $cat <<EOSS >Cppsym
12581 $startsh
12582 case "\$1" in
12583 -l) list=true
12584         shift
12585         ;;
12586 esac
12587 unknown=''
12588 case "\$list\$#" in
12589 1|2)
12590         for sym do
12591                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12592                         exit 0
12593                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12594                         :
12595                 else
12596                         unknown="\$unknown \$sym"
12597                 fi
12598         done
12599         set X \$unknown
12600         shift
12601         ;;
12602 esac
12603 case \$# in
12604 0) exit 1;;
12605 esac
12606 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12607 #ifdef \1\\
12608 exit 0; _ _ _ _\1\\      \1\\
12609 #endif\\
12610 /' >Cppsym\$\$
12611 echo "exit 1; _ _ _" >>Cppsym\$\$
12612 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12613 case "\$list" in
12614 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12615 *)
12616         sh Cppsym2\$\$
12617         status=\$?
12618         ;;
12619 esac
12620 $rm -f Cppsym\$\$ Cppsym2\$\$
12621 exit \$status
12622 EOSS
12623 chmod +x Cppsym
12624 $eunicefix Cppsym
12625 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12626
12627 : now check the C compiler for additional symbols
12628 postprocess_cc_v=''
12629 case "$osname" in
12630 aix) postprocess_cc_v="|$tr , ' '" ;;
12631 esac
12632 $cat >ccsym <<EOS
12633 $startsh
12634 $cat >tmp.c <<EOF
12635 extern int foo;
12636 EOF
12637 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12638 do
12639         case "\$i" in
12640         -D*) echo "\$i" | $sed 's/^-D//';;
12641         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12642         esac
12643 done
12644 $rm -f try.c
12645 EOS
12646 postprocess_cc_v=''
12647 chmod +x ccsym
12648 $eunicefix ccsym
12649 ./ccsym > ccsym1.raw
12650 if $test -s ccsym1.raw; then
12651        $sort ccsym1.raw | $uniq >ccsym.raw
12652 else
12653        mv ccsym1.raw ccsym.raw
12654 fi
12655
12656 $awk '/\=/ { print $0; next }
12657         { print $0"=1" }' ccsym.raw >ccsym.list
12658 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12659 $comm -13 ccsym.true ccsym.list >ccsym.own
12660 $comm -12 ccsym.true ccsym.list >ccsym.com
12661 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12662 also=''
12663 if $test -z ccsym.raw; then
12664         echo "Your C compiler doesn't seem to define any symbols!" >&4
12665         echo " "
12666         echo "However, your C preprocessor defines the following symbols:"
12667         $cat Cppsym.true
12668         ccsymbols=''
12669         cppsymbols=`$cat Cppsym.true`
12670         cppsymbols=`echo $cppsymbols`
12671         cppccsymbols="$cppsymbols"
12672 else
12673         if $test -s ccsym.com; then
12674                 echo "Your C compiler and pre-processor define these symbols:"
12675                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12676                 also='also '
12677                 symbols='ones'
12678                 cppccsymbols=`$cat ccsym.com`
12679                 cppccsymbols=`echo $cppccsymbols`
12680                 $test "$silent" || sleep 1
12681         fi
12682         if $test -s ccsym.cpp; then
12683                 $test "$also" && echo " "
12684                 echo "Your C pre-processor ${also}defines the following symbols:"
12685                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12686                 also='further '
12687                 cppsymbols=`$cat ccsym.cpp`
12688                 cppsymbols=`echo $cppsymbols`
12689                 $test "$silent" || sleep 1
12690         fi
12691         if $test -s ccsym.own; then
12692                 $test "$also" && echo " "
12693                 echo "Your C compiler ${also}defines the following cpp symbols:"
12694                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12695                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12696                 ccsymbols=`$cat ccsym.own`
12697                 ccsymbols=`echo $ccsymbols`
12698                 $test "$silent" || sleep 1
12699         fi
12700 fi
12701 $rm -f ccsym*
12702
12703 : see if this is a termio system
12704 val="$undef"
12705 val2="$undef"
12706 val3="$undef"
12707 if $test `./findhdr termios.h`; then
12708         set tcsetattr i_termios
12709         eval $inlibc
12710         val3="$i_termios"
12711 fi
12712 echo " "
12713 case "$val3" in
12714 "$define") echo "You have POSIX termios.h... good!" >&4;;
12715 *) if ./Cppsym pyr; then
12716                 case "`/bin/universe`" in
12717                 ucb) if $test `./findhdr sgtty.h`; then
12718                                 val2="$define"
12719                                 echo "<sgtty.h> found." >&4
12720                         else
12721                                 echo "System is pyramid with BSD universe."
12722                                 echo "<sgtty.h> not found--you could have problems." >&4
12723                         fi;;
12724                 *) if $test `./findhdr termio.h`; then
12725                                 val="$define"
12726                                 echo "<termio.h> found." >&4
12727                         else
12728                                 echo "System is pyramid with USG universe."
12729                                 echo "<termio.h> not found--you could have problems." >&4
12730                         fi;;
12731                 esac
12732         elif ./usg; then
12733                 if $test `./findhdr termio.h`; then
12734                         echo "<termio.h> found." >&4
12735                         val="$define"
12736                 elif $test `./findhdr sgtty.h`; then
12737                         echo "<sgtty.h> found." >&4
12738                         val2="$define"
12739                 else
12740 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12741                 fi
12742         else
12743                 if $test `./findhdr sgtty.h`; then
12744                         echo "<sgtty.h> found." >&4
12745                         val2="$define"
12746                 elif $test `./findhdr termio.h`; then
12747                         echo "<termio.h> found." >&4
12748                         val="$define"
12749                 else
12750 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12751                 fi
12752         fi;;
12753 esac
12754 set i_termio; eval $setvar
12755 val=$val2; set i_sgtty; eval $setvar
12756 val=$val3; set i_termios; eval $setvar
12757
12758 : see if this is a shadow.h system
12759 set shadow.h i_shadow
12760 eval $inhdr
12761
12762 : see if this is a socks.h system
12763 set socks.h i_socks
12764 eval $inhdr
12765
12766 : see if stdarg is available
12767 echo " "
12768 if $test `./findhdr stdarg.h`; then
12769         echo "<stdarg.h> found." >&4
12770         valstd="$define"
12771 else
12772         echo "<stdarg.h> NOT found." >&4
12773         valstd="$undef"
12774 fi
12775
12776 : see if varags is available
12777 echo " "
12778 if $test `./findhdr varargs.h`; then
12779         echo "<varargs.h> found." >&4
12780 else
12781         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12782 fi
12783
12784 : set up the varargs testing programs
12785 $cat > varargs.c <<EOP
12786 #ifdef I_STDARG
12787 #include <stdarg.h>
12788 #endif
12789 #ifdef I_VARARGS
12790 #include <varargs.h>
12791 #endif
12792
12793 #ifdef I_STDARG
12794 int f(char *p, ...)
12795 #else
12796 int f(va_alist)
12797 va_dcl
12798 #endif
12799 {
12800         va_list ap;
12801 #ifndef I_STDARG
12802         char *p;
12803 #endif
12804 #ifdef I_STDARG
12805         va_start(ap,p);
12806 #else
12807         va_start(ap);
12808         p = va_arg(ap, char *);
12809 #endif
12810         va_end(ap);
12811 }
12812 EOP
12813 $cat > varargs <<EOP
12814 $startsh
12815 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12816         echo "true"
12817 else
12818         echo "false"
12819 fi
12820 $rm -f varargs$_o
12821 EOP
12822 chmod +x varargs
12823
12824 : now check which varargs header should be included
12825 echo " "
12826 i_varhdr=''
12827 case "$valstd" in
12828 "$define")
12829         if `./varargs I_STDARG`; then
12830                 val='stdarg.h'
12831         elif `./varargs I_VARARGS`; then
12832                 val='varargs.h'
12833         fi
12834         ;;
12835 *)
12836         if `./varargs I_VARARGS`; then
12837                 val='varargs.h'
12838         fi
12839         ;;
12840 esac
12841 case "$val" in
12842 '')
12843 echo "I could not find the definition for va_dcl... You have problems..." >&4
12844         val="$undef"; set i_stdarg; eval $setvar
12845         val="$undef"; set i_varargs; eval $setvar
12846         ;;
12847 *) 
12848         set i_varhdr
12849         eval $setvar
12850         case "$i_varhdr" in
12851         stdarg.h)
12852                 val="$define"; set i_stdarg; eval $setvar
12853                 val="$undef"; set i_varargs; eval $setvar
12854                 ;;
12855         varargs.h)
12856                 val="$undef"; set i_stdarg; eval $setvar
12857                 val="$define"; set i_varargs; eval $setvar
12858                 ;;
12859         esac
12860         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12861 esac
12862 $rm -f varargs*
12863
12864 : see if stddef is available
12865 set stddef.h i_stddef
12866 eval $inhdr
12867
12868 : see if sys/access.h is available
12869 set sys/access.h i_sysaccess
12870 eval $inhdr
12871
12872 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12873 set sys/filio.h i_sysfilio
12874 eval $inhdr
12875 echo " "
12876 if $test `./findhdr sys/ioctl.h`; then
12877         val="$define"
12878         echo '<sys/ioctl.h> found.' >&4
12879 else
12880         val="$undef"
12881         if $test $i_sysfilio = "$define"; then
12882             echo '<sys/ioctl.h> NOT found.' >&4
12883         else
12884                 $test $i_sgtty = "$define" && xxx="sgtty.h"
12885                 $test $i_termio = "$define" && xxx="termio.h"
12886                 $test $i_termios = "$define" && xxx="termios.h"
12887 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12888         fi
12889 fi
12890 set i_sysioctl
12891 eval $setvar
12892
12893 : see if sys/resource.h has to be included
12894 set sys/resource.h i_sysresrc
12895 eval $inhdr
12896
12897 : see if sys/security.h is available
12898 set sys/security.h i_syssecrt
12899 eval $inhdr
12900
12901 : see if this is a sys/statvfs.h system
12902 set sys/statvfs.h i_sysstatvfs
12903 eval $inhdr
12904
12905 : see if this is a sys/un.h system
12906 set sys/un.h i_sysun
12907 eval $inhdr
12908
12909 : see if this is a syswait system
12910 set sys/wait.h i_syswait
12911 eval $inhdr
12912
12913 : see if this is an utime system
12914 set utime.h i_utime
12915 eval $inhdr
12916
12917 : see if this is a values.h system
12918 set values.h i_values
12919 eval $inhdr
12920
12921 : see if this is a vfork system
12922 case "$d_vfork" in
12923 "$define")
12924         set vfork.h i_vfork
12925         eval $inhdr
12926         ;;
12927 *)
12928         i_vfork="$undef"
12929         ;;
12930 esac
12931
12932 : see if gdbm.h is available
12933 set gdbm.h t_gdbm
12934 eval $inhdr
12935 case "$t_gdbm" in
12936 $define)
12937         : see if gdbm_open exists
12938         set gdbm_open d_gdbm_open
12939         eval $inlibc
12940         case "$d_gdbm_open" in
12941         $undef)
12942                 t_gdbm="$undef"
12943                 echo "We won't be including <gdbm.h>"
12944                 ;;
12945         esac
12946         ;;
12947 esac
12948 val="$t_gdbm"
12949 set i_gdbm
12950 eval $setvar
12951
12952 echo " "
12953 echo "Looking for extensions..." >&4
12954 : If we are using the old config.sh, known_extensions may contain
12955 : old or inaccurate or duplicate values.
12956 known_extensions=''
12957 nonxs_extensions=''
12958 : We do not use find because it might not be available.
12959 : We do not just use MANIFEST because the user may have dropped
12960 : some additional extensions into the source tree and expect them
12961 : to be built.
12962
12963 : Function to recursively find available extensions, ignoring DynaLoader
12964 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
12965 find_extensions='
12966     for xxx in *; do
12967        case "$xxx" in
12968            DynaLoader|dynaload) ;;
12969            *)
12970            if $test -f $xxx/$xxx.xs; then
12971                known_extensions="$known_extensions $1$xxx";
12972            elif $test -f $xxx/Makefile.PL; then
12973                nonxs_extensions="$nonxs_extensions $1$xxx";
12974            else
12975                if $test -d $xxx -a $# -lt 10; then
12976                    set $1$xxx/ $*;
12977                    cd $xxx;
12978                    eval $find_extensions;
12979                    cd ..;
12980                    shift;
12981                fi;
12982            fi
12983            ;;
12984        esac;
12985     done'
12986 tdir=`pwd`
12987 cd $rsrc/ext
12988 set X
12989 shift
12990 eval $find_extensions
12991 set X $nonxs_extensions
12992 shift
12993 nonxs_extensions="$*"
12994 set X $known_extensions
12995 shift
12996 known_extensions="$*"
12997 cd $tdir
12998
12999 : Now see which are supported on this system.
13000 avail_ext=''
13001 for xxx in $known_extensions ; do
13002         case "$xxx" in
13003         DB_File|db_file)
13004                 case "$i_db" in
13005                 $define) avail_ext="$avail_ext $xxx" ;;
13006                 esac
13007                 ;;
13008         GDBM_File|gdbm_fil)
13009                 case "$i_gdbm" in 
13010                 $define) avail_ext="$avail_ext $xxx" ;;
13011                 esac
13012                 ;;
13013         NDBM_File|ndbm_fil)
13014                 case "$i_ndbm" in
13015                 $define) avail_ext="$avail_ext $xxx" ;;
13016                 esac
13017                 ;;
13018         ODBM_File|odbm_fil) 
13019                 case "${i_dbm}${i_rpcsvcdbm}" in
13020                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13021                 esac
13022                 ;;
13023         POSIX|posix)
13024                 case "$useposix" in
13025                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13026                 esac
13027                 ;;
13028         Opcode|opcode)
13029                 case "$useopcode" in
13030                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13031                 esac
13032                 ;;
13033         Socket|socket)
13034                 case "$d_socket" in 
13035                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13036                 esac
13037                 ;;
13038         Thread|thread)
13039                 case "$usethreads" in 
13040                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13041                 esac
13042                 ;;
13043         IPC/SysV|ipc/sysv)
13044                 : XXX Do we need a useipcsysv variable here
13045                 case "${d_msg}${d_sem}${d_shm}" in 
13046                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13047                 esac
13048                 ;;
13049         *)      avail_ext="$avail_ext $xxx"
13050                 ;;
13051         esac
13052 done
13053
13054 set X $avail_ext
13055 shift
13056 avail_ext="$*"
13057
13058 : Now see which nonxs extensions are supported on this system.
13059 : For now assume all are.
13060 nonxs_ext=''
13061 for xxx in $nonxs_extensions ; do
13062         case "$xxx" in
13063         *)      nonxs_ext="$nonxs_ext $xxx"
13064                 ;;
13065         esac
13066 done
13067
13068 set X $nonxs_ext
13069 shift
13070 nonxs_ext="$*"
13071
13072 case $usedl in
13073 $define)
13074         $cat <<EOM
13075 A number of extensions are supplied with $package.  You may choose to
13076 compile these extensions for dynamic loading (the default), compile
13077 them into the $package executable (static loading), or not include
13078 them at all.  Answer "none" to include no extensions.
13079 Note that DynaLoader is always built and need not be mentioned here.
13080
13081 EOM
13082         case "$dynamic_ext" in
13083         '') dflt="$avail_ext" ;;
13084         *)      dflt="$dynamic_ext"
13085                 # Perhaps we are reusing an old out-of-date config.sh.
13086                 case "$hint" in
13087                 previous)
13088                         if test X"$dynamic_ext" != X"$avail_ext"; then
13089                                 $cat <<EOM
13090 NOTICE:  Your previous config.sh list may be incorrect. 
13091 The extensions now available to you are 
13092         ${avail_ext}
13093 but the default list from your previous config.sh is
13094         ${dynamic_ext} 
13095
13096 EOM
13097                         fi
13098                         ;;
13099                 esac
13100                 ;;
13101         esac
13102         case "$dflt" in
13103         '')     dflt=none;;
13104         esac
13105         rp="What extensions do you wish to load dynamically?"
13106         . ./myread
13107         case "$ans" in
13108         none) dynamic_ext=' ' ;;
13109         *) dynamic_ext="$ans" ;;
13110         esac
13111
13112         case "$static_ext" in
13113         '')
13114                 : Exclude those already listed in dynamic linking
13115                 dflt=''
13116                 for xxx in $avail_ext; do
13117                         case " $dynamic_ext " in
13118                         *" $xxx "*) ;;
13119                         *) dflt="$dflt $xxx" ;;
13120                         esac
13121                 done
13122                 set X $dflt
13123                 shift
13124                 dflt="$*"
13125                 ;;
13126         *)  dflt="$static_ext" 
13127                 ;;
13128         esac
13129
13130         case "$dflt" in
13131         '')     dflt=none;;
13132         esac
13133         rp="What extensions do you wish to load statically?"
13134         . ./myread
13135         case "$ans" in
13136         none) static_ext=' ' ;;
13137         *) static_ext="$ans" ;;
13138         esac
13139         ;;
13140 *)
13141         $cat <<EOM
13142 A number of extensions are supplied with $package.  Answer "none" 
13143 to include no extensions. 
13144 Note that DynaLoader is always built and need not be mentioned here.
13145
13146 EOM
13147         case "$static_ext" in
13148         '') dflt="$avail_ext" ;;
13149         *)      dflt="$static_ext"
13150                 # Perhaps we are reusing an old out-of-date config.sh.
13151                 case "$hint" in
13152                 previous)
13153                         if test X"$static_ext" != X"$avail_ext"; then
13154                                 $cat <<EOM
13155 NOTICE:  Your previous config.sh list may be incorrect. 
13156 The extensions now available to you are 
13157         ${avail_ext}
13158 but the default list from your previous config.sh is
13159         ${static_ext} 
13160
13161 EOM
13162                         fi
13163                         ;;
13164                 esac
13165                 ;;
13166         esac
13167         : Exclude those that are not xs extensions
13168         case "$dflt" in
13169         '')     dflt=none;;
13170         esac
13171         rp="What extensions do you wish to include?"
13172         . ./myread
13173         case "$ans" in
13174         none) static_ext=' ' ;;
13175         *) static_ext="$ans" ;;
13176         esac
13177         ;;
13178 esac
13179
13180 set X $dynamic_ext $static_ext $nonxs_ext
13181 shift
13182 extensions="$*"
13183
13184 : Remove build directory name from cppstdin so it can be used from
13185 : either the present location or the final installed location.
13186 echo " "
13187 : Get out of the UU directory to get correct path name.
13188 cd ..
13189 case "$cppstdin" in
13190 `pwd`/cppstdin)
13191         echo "Stripping down cppstdin path name"
13192         cppstdin=cppstdin
13193         ;;
13194 esac
13195 cd UU
13196
13197 : end of configuration questions
13198 echo " "
13199 echo "End of configuration questions."
13200 echo " "
13201
13202 : back to where it started
13203 if test -d ../UU; then
13204         cd ..
13205 fi
13206
13207 : configuration may be patched via a 'config.over' file
13208 if $test -f config.over; then
13209         echo " "
13210         dflt=y
13211         rp='I see a config.over file.  Do you wish to load it?'
13212         . UU/myread
13213         case "$ans" in
13214         n*) echo "OK, I'll ignore it.";;
13215         *)      . ./config.over
13216                 echo "Configuration override changes have been loaded."
13217                 ;;
13218         esac
13219 fi
13220
13221 : in case they want portability, strip down executable paths
13222 case "$d_portable" in
13223 "$define")
13224         echo " "
13225         echo "Stripping down executable paths..." >&4
13226         for file in $loclist $trylist; do
13227                 eval temp=\$$file
13228                 eval $file=`basename $temp`
13229         done
13230         ;;
13231 esac
13232
13233 : create config.sh file
13234 echo " "
13235 echo "Creating config.sh..." >&4
13236 $spitshell <<EOT >config.sh
13237 $startsh
13238 #
13239 # This file was produced by running the Configure script. It holds all the
13240 # definitions figured out by Configure. Should you modify one of these values,
13241 # do not forget to propagate your changes by running "Configure -der". You may
13242 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13243 #
13244
13245 # Package name      : $package
13246 # Source directory  : $src
13247 # Configuration time: $cf_time
13248 # Configured by     : $cf_by
13249 # Target system     : $myuname
13250
13251 Author='$Author'
13252 Date='$Date'
13253 Header='$Header'
13254 Id='$Id'
13255 Locker='$Locker'
13256 Log='$Log'
13257 Mcc='$Mcc'
13258 RCSfile='$RCSfile'
13259 Revision='$Revision'
13260 Source='$Source'
13261 State='$State'
13262 _a='$_a'
13263 _exe='$_exe'
13264 _o='$_o'
13265 afs='$afs'
13266 alignbytes='$alignbytes'
13267 ansi2knr='$ansi2knr'
13268 aphostname='$aphostname'
13269 apiversion='$apiversion'
13270 ar='$ar'
13271 archlib='$archlib'
13272 archlibexp='$archlibexp'
13273 archname64='$archname64'
13274 archname='$archname'
13275 archobjs='$archobjs'
13276 awk='$awk'
13277 baserev='$baserev'
13278 bash='$bash'
13279 bin='$bin'
13280 bincompat5005='$bincompat5005'
13281 binexp='$binexp'
13282 bison='$bison'
13283 byacc='$byacc'
13284 byteorder='$byteorder'
13285 c='$c'
13286 castflags='$castflags'
13287 cat='$cat'
13288 cc='$cc'
13289 cccdlflags='$cccdlflags'
13290 ccdlflags='$ccdlflags'
13291 ccflags='$ccflags'
13292 ccsymbols='$ccsymbols'
13293 cf_by='$cf_by'
13294 cf_email='$cf_email'
13295 cf_time='$cf_time'
13296 chgrp='$chgrp'
13297 chmod='$chmod'
13298 chown='$chown'
13299 clocktype='$clocktype'
13300 comm='$comm'
13301 compress='$compress'
13302 contains='$contains'
13303 cp='$cp'
13304 cpio='$cpio'
13305 cpp='$cpp'
13306 cpp_stuff='$cpp_stuff'
13307 cppccsymbols='$cppccsymbols'
13308 cppflags='$cppflags'
13309 cpplast='$cpplast'
13310 cppminus='$cppminus'
13311 cpprun='$cpprun'
13312 cppstdin='$cppstdin'
13313 cppsymbols='$cppsymbols'
13314 crosscompile='$crosscompile'
13315 cryptlib='$cryptlib'
13316 csh='$csh'
13317 d_Gconvert='$d_Gconvert'
13318 d_PRIEldbl='$d_PRIEldbl'
13319 d_PRIFldbl='$d_PRIFldbl'
13320 d_PRIGldbl='$d_PRIGldbl'
13321 d_PRIX64='$d_PRIX64'
13322 d_PRId64='$d_PRId64'
13323 d_PRIeldbl='$d_PRIeldbl'
13324 d_PRIfldbl='$d_PRIfldbl'
13325 d_PRIgldbl='$d_PRIgldbl'
13326 d_PRIi64='$d_PRIi64'
13327 d_PRIo64='$d_PRIo64'
13328 d_PRIu64='$d_PRIu64'
13329 d_PRIx64='$d_PRIx64'
13330 d_access='$d_access'
13331 d_accessx='$d_accessx'
13332 d_alarm='$d_alarm'
13333 d_archlib='$d_archlib'
13334 d_atolf='$d_atolf'
13335 d_atoll='$d_atoll'
13336 d_attribut='$d_attribut'
13337 d_bcmp='$d_bcmp'
13338 d_bcopy='$d_bcopy'
13339 d_bincompat5005='$d_bincompat5005'
13340 d_bsd='$d_bsd'
13341 d_bsdgetpgrp='$d_bsdgetpgrp'
13342 d_bsdsetpgrp='$d_bsdsetpgrp'
13343 d_bzero='$d_bzero'
13344 d_casti32='$d_casti32'
13345 d_castneg='$d_castneg'
13346 d_charvspr='$d_charvspr'
13347 d_chown='$d_chown'
13348 d_chroot='$d_chroot'
13349 d_chsize='$d_chsize'
13350 d_closedir='$d_closedir'
13351 d_cmsghdr_s='$d_cmsghdr_s'
13352 d_const='$d_const'
13353 d_crypt='$d_crypt'
13354 d_csh='$d_csh'
13355 d_cuserid='$d_cuserid'
13356 d_dbl_dig='$d_dbl_dig'
13357 d_difftime='$d_difftime'
13358 d_dirnamlen='$d_dirnamlen'
13359 d_dlerror='$d_dlerror'
13360 d_dlopen='$d_dlopen'
13361 d_dlsymun='$d_dlsymun'
13362 d_dosuid='$d_dosuid'
13363 d_drand48proto='$d_drand48proto'
13364 d_dup2='$d_dup2'
13365 d_eaccess='$d_eaccess'
13366 d_endgrent='$d_endgrent'
13367 d_endhent='$d_endhent'
13368 d_endnent='$d_endnent'
13369 d_endpent='$d_endpent'
13370 d_endpwent='$d_endpwent'
13371 d_endsent='$d_endsent'
13372 d_endspent='$d_endspent'
13373 d_eofnblk='$d_eofnblk'
13374 d_eunice='$d_eunice'
13375 d_fchmod='$d_fchmod'
13376 d_fchown='$d_fchown'
13377 d_fcntl='$d_fcntl'
13378 d_fd_macros='$d_fd_macros'
13379 d_fd_set='$d_fd_set'
13380 d_fds_bits='$d_fds_bits'
13381 d_fgetpos='$d_fgetpos'
13382 d_flexfnam='$d_flexfnam'
13383 d_flock='$d_flock'
13384 d_fork='$d_fork'
13385 d_fpathconf='$d_fpathconf'
13386 d_fpos64_t='$d_fpos64_t'
13387 d_fseeko='$d_fseeko'
13388 d_fsetpos='$d_fsetpos'
13389 d_fstatfs='$d_fstatfs'
13390 d_fstatvfs='$d_fstatvfs'
13391 d_ftello='$d_ftello'
13392 d_ftime='$d_ftime'
13393 d_getgrent='$d_getgrent'
13394 d_getgrps='$d_getgrps'
13395 d_gethbyaddr='$d_gethbyaddr'
13396 d_gethbyname='$d_gethbyname'
13397 d_gethent='$d_gethent'
13398 d_gethname='$d_gethname'
13399 d_gethostprotos='$d_gethostprotos'
13400 d_getlogin='$d_getlogin'
13401 d_getmntent='$d_getmntent'
13402 d_getnbyaddr='$d_getnbyaddr'
13403 d_getnbyname='$d_getnbyname'
13404 d_getnent='$d_getnent'
13405 d_getnetprotos='$d_getnetprotos'
13406 d_getpbyname='$d_getpbyname'
13407 d_getpbynumber='$d_getpbynumber'
13408 d_getpent='$d_getpent'
13409 d_getpgid='$d_getpgid'
13410 d_getpgrp2='$d_getpgrp2'
13411 d_getpgrp='$d_getpgrp'
13412 d_getppid='$d_getppid'
13413 d_getprior='$d_getprior'
13414 d_getprotoprotos='$d_getprotoprotos'
13415 d_getpwent='$d_getpwent'
13416 d_getsbyname='$d_getsbyname'
13417 d_getsbyport='$d_getsbyport'
13418 d_getsent='$d_getsent'
13419 d_getservprotos='$d_getservprotos'
13420 d_getspent='$d_getspent'
13421 d_getspnam='$d_getspnam'
13422 d_gettimeod='$d_gettimeod'
13423 d_gnulibc='$d_gnulibc'
13424 d_grpasswd='$d_grpasswd'
13425 d_hasmntopt='$d_hasmntopt'
13426 d_htonl='$d_htonl'
13427 d_index='$d_index'
13428 d_inetaton='$d_inetaton'
13429 d_int64t='$d_int64t'
13430 d_iovec_s='$d_iovec_s'
13431 d_isascii='$d_isascii'
13432 d_killpg='$d_killpg'
13433 d_lchown='$d_lchown'
13434 d_ldbl_dig='$d_ldbl_dig'
13435 d_link='$d_link'
13436 d_llseek='$d_llseek'
13437 d_locconv='$d_locconv'
13438 d_lockf='$d_lockf'
13439 d_longdbl='$d_longdbl'
13440 d_longlong='$d_longlong'
13441 d_lstat='$d_lstat'
13442 d_madvise='$d_madvise'
13443 d_mblen='$d_mblen'
13444 d_mbstowcs='$d_mbstowcs'
13445 d_mbtowc='$d_mbtowc'
13446 d_memchr='$d_memchr'
13447 d_memcmp='$d_memcmp'
13448 d_memcpy='$d_memcpy'
13449 d_memmove='$d_memmove'
13450 d_memset='$d_memset'
13451 d_mkdir='$d_mkdir'
13452 d_mkfifo='$d_mkfifo'
13453 d_mktime='$d_mktime'
13454 d_mmap='$d_mmap'
13455 d_mprotect='$d_mprotect'
13456 d_msg='$d_msg'
13457 d_msg_ctrunc='$d_msg_ctrunc'
13458 d_msg_dontroute='$d_msg_dontroute'
13459 d_msg_oob='$d_msg_oob'
13460 d_msg_peek='$d_msg_peek'
13461 d_msg_proxy='$d_msg_proxy'
13462 d_msgctl='$d_msgctl'
13463 d_msgget='$d_msgget'
13464 d_msghdr_s='$d_msghdr_s'
13465 d_msgrcv='$d_msgrcv'
13466 d_msgsnd='$d_msgsnd'
13467 d_msync='$d_msync'
13468 d_munmap='$d_munmap'
13469 d_mymalloc='$d_mymalloc'
13470 d_nice='$d_nice'
13471 d_off64_t='$d_off64_t'
13472 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13473 d_oldpthreads='$d_oldpthreads'
13474 d_oldsock='$d_oldsock'
13475 d_open3='$d_open3'
13476 d_pathconf='$d_pathconf'
13477 d_pause='$d_pause'
13478 d_phostname='$d_phostname'
13479 d_pipe='$d_pipe'
13480 d_poll='$d_poll'
13481 d_portable='$d_portable'
13482 d_pthread_yield='$d_pthread_yield'
13483 d_pwage='$d_pwage'
13484 d_pwchange='$d_pwchange'
13485 d_pwclass='$d_pwclass'
13486 d_pwcomment='$d_pwcomment'
13487 d_pwexpire='$d_pwexpire'
13488 d_pwgecos='$d_pwgecos'
13489 d_pwpasswd='$d_pwpasswd'
13490 d_pwquota='$d_pwquota'
13491 d_readdir='$d_readdir'
13492 d_readlink='$d_readlink'
13493 d_readv='$d_readv'
13494 d_recvmsg='$d_recvmsg'
13495 d_rename='$d_rename'
13496 d_rewinddir='$d_rewinddir'
13497 d_rmdir='$d_rmdir'
13498 d_safebcpy='$d_safebcpy'
13499 d_safemcpy='$d_safemcpy'
13500 d_sanemcmp='$d_sanemcmp'
13501 d_sched_yield='$d_sched_yield'
13502 d_scm_rights='$d_scm_rights'
13503 d_seekdir='$d_seekdir'
13504 d_select='$d_select'
13505 d_sem='$d_sem'
13506 d_semctl='$d_semctl'
13507 d_semctl_semid_ds='$d_semctl_semid_ds'
13508 d_semctl_semun='$d_semctl_semun'
13509 d_semget='$d_semget'
13510 d_semop='$d_semop'
13511 d_sendmsg='$d_sendmsg'
13512 d_setegid='$d_setegid'
13513 d_seteuid='$d_seteuid'
13514 d_setgrent='$d_setgrent'
13515 d_setgrps='$d_setgrps'
13516 d_sethent='$d_sethent'
13517 d_setlinebuf='$d_setlinebuf'
13518 d_setlocale='$d_setlocale'
13519 d_setnent='$d_setnent'
13520 d_setpent='$d_setpent'
13521 d_setpgid='$d_setpgid'
13522 d_setpgrp2='$d_setpgrp2'
13523 d_setpgrp='$d_setpgrp'
13524 d_setprior='$d_setprior'
13525 d_setpwent='$d_setpwent'
13526 d_setregid='$d_setregid'
13527 d_setresgid='$d_setresgid'
13528 d_setresuid='$d_setresuid'
13529 d_setreuid='$d_setreuid'
13530 d_setrgid='$d_setrgid'
13531 d_setruid='$d_setruid'
13532 d_setsent='$d_setsent'
13533 d_setsid='$d_setsid'
13534 d_setspent='$d_setspent'
13535 d_setvbuf='$d_setvbuf'
13536 d_sfio='$d_sfio'
13537 d_shm='$d_shm'
13538 d_shmat='$d_shmat'
13539 d_shmatprototype='$d_shmatprototype'
13540 d_shmctl='$d_shmctl'
13541 d_shmdt='$d_shmdt'
13542 d_shmget='$d_shmget'
13543 d_sigaction='$d_sigaction'
13544 d_sigsetjmp='$d_sigsetjmp'
13545 d_socket='$d_socket'
13546 d_sockpair='$d_sockpair'
13547 d_statblks='$d_statblks'
13548 d_statfs='$d_statfs'
13549 d_statfsflags='$d_statfsflags'
13550 d_statvfs='$d_statvfs'
13551 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13552 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13553 d_stdio_stream_array='$d_stdio_stream_array'
13554 d_stdiobase='$d_stdiobase'
13555 d_stdstdio='$d_stdstdio'
13556 d_strchr='$d_strchr'
13557 d_strcoll='$d_strcoll'
13558 d_strctcpy='$d_strctcpy'
13559 d_strerrm='$d_strerrm'
13560 d_strerror='$d_strerror'
13561 d_strtod='$d_strtod'
13562 d_strtol='$d_strtol'
13563 d_strtoul='$d_strtoul'
13564 d_strtoull='$d_strtoull'
13565 d_strxfrm='$d_strxfrm'
13566 d_suidsafe='$d_suidsafe'
13567 d_symlink='$d_symlink'
13568 d_syscall='$d_syscall'
13569 d_sysconf='$d_sysconf'
13570 d_sysernlst='$d_sysernlst'
13571 d_syserrlst='$d_syserrlst'
13572 d_system='$d_system'
13573 d_tcgetpgrp='$d_tcgetpgrp'
13574 d_tcsetpgrp='$d_tcsetpgrp'
13575 d_telldir='$d_telldir'
13576 d_telldirproto='$d_telldirproto'
13577 d_time='$d_time'
13578 d_times='$d_times'
13579 d_truncate='$d_truncate'
13580 d_tzname='$d_tzname'
13581 d_umask='$d_umask'
13582 d_uname='$d_uname'
13583 d_union_semun='$d_union_semun'
13584 d_vendorlib='$d_vendorlib'
13585 d_vfork='$d_vfork'
13586 d_void_closedir='$d_void_closedir'
13587 d_voidsig='$d_voidsig'
13588 d_voidtty='$d_voidtty'
13589 d_volatile='$d_volatile'
13590 d_vprintf='$d_vprintf'
13591 d_wait4='$d_wait4'
13592 d_waitpid='$d_waitpid'
13593 d_wcstombs='$d_wcstombs'
13594 d_wctomb='$d_wctomb'
13595 d_writev='$d_writev'
13596 d_xenix='$d_xenix'
13597 date='$date'
13598 db_hashtype='$db_hashtype'
13599 db_prefixtype='$db_prefixtype'
13600 defvoidused='$defvoidused'
13601 direntrytype='$direntrytype'
13602 dlext='$dlext'
13603 dlsrc='$dlsrc'
13604 doublesize='$doublesize'
13605 drand01='$drand01'
13606 dynamic_ext='$dynamic_ext'
13607 eagain='$eagain'
13608 ebcdic='$ebcdic'
13609 echo='$echo'
13610 egrep='$egrep'
13611 emacs='$emacs'
13612 eunicefix='$eunicefix'
13613 exe_ext='$exe_ext'
13614 expr='$expr'
13615 extensions='$extensions'
13616 fflushNULL='$fflushNULL'
13617 fflushall='$fflushall'
13618 find='$find'
13619 firstmakefile='$firstmakefile'
13620 flex='$flex'
13621 fpostype='$fpostype'
13622 freetype='$freetype'
13623 full_ar='$full_ar'
13624 full_csh='$full_csh'
13625 full_sed='$full_sed'
13626 gccversion='$gccversion'
13627 gidtype='$gidtype'
13628 glibpth='$glibpth'
13629 grep='$grep'
13630 groupcat='$groupcat'
13631 groupstype='$groupstype'
13632 gzip='$gzip'
13633 h_fcntl='$h_fcntl'
13634 h_sysfile='$h_sysfile'
13635 hint='$hint'
13636 hostcat='$hostcat'
13637 huge='$huge'
13638 i_arpainet='$i_arpainet'
13639 i_bsdioctl='$i_bsdioctl'
13640 i_db='$i_db'
13641 i_dbm='$i_dbm'
13642 i_dirent='$i_dirent'
13643 i_dld='$i_dld'
13644 i_dlfcn='$i_dlfcn'
13645 i_fcntl='$i_fcntl'
13646 i_float='$i_float'
13647 i_gdbm='$i_gdbm'
13648 i_grp='$i_grp'
13649 i_inttypes='$i_inttypes'
13650 i_limits='$i_limits'
13651 i_locale='$i_locale'
13652 i_machcthr='$i_machcthr'
13653 i_malloc='$i_malloc'
13654 i_math='$i_math'
13655 i_memory='$i_memory'
13656 i_mntent='$i_mntent'
13657 i_ndbm='$i_ndbm'
13658 i_netdb='$i_netdb'
13659 i_neterrno='$i_neterrno'
13660 i_netinettcp='$i_netinettcp'
13661 i_niin='$i_niin'
13662 i_poll='$i_poll'
13663 i_pthread='$i_pthread'
13664 i_pwd='$i_pwd'
13665 i_rpcsvcdbm='$i_rpcsvcdbm'
13666 i_sfio='$i_sfio'
13667 i_sgtty='$i_sgtty'
13668 i_shadow='$i_shadow'
13669 i_socks='$i_socks'
13670 i_stdarg='$i_stdarg'
13671 i_stddef='$i_stddef'
13672 i_stdlib='$i_stdlib'
13673 i_string='$i_string'
13674 i_sysaccess='$i_sysaccess'
13675 i_sysdir='$i_sysdir'
13676 i_sysfile='$i_sysfile'
13677 i_sysfilio='$i_sysfilio'
13678 i_sysin='$i_sysin'
13679 i_sysioctl='$i_sysioctl'
13680 i_sysmman='$i_sysmman'
13681 i_sysmount='$i_sysmount'
13682 i_sysndir='$i_sysndir'
13683 i_sysparam='$i_sysparam'
13684 i_sysresrc='$i_sysresrc'
13685 i_syssecrt='$i_syssecrt'
13686 i_sysselct='$i_sysselct'
13687 i_syssockio='$i_syssockio'
13688 i_sysstat='$i_sysstat'
13689 i_sysstatvfs='$i_sysstatvfs'
13690 i_systime='$i_systime'
13691 i_systimek='$i_systimek'
13692 i_systimes='$i_systimes'
13693 i_systypes='$i_systypes'
13694 i_sysuio='$i_sysuio'
13695 i_sysun='$i_sysun'
13696 i_syswait='$i_syswait'
13697 i_termio='$i_termio'
13698 i_termios='$i_termios'
13699 i_time='$i_time'
13700 i_unistd='$i_unistd'
13701 i_utime='$i_utime'
13702 i_values='$i_values'
13703 i_varargs='$i_varargs'
13704 i_varhdr='$i_varhdr'
13705 i_vfork='$i_vfork'
13706 ignore_versioned_solibs='$ignore_versioned_solibs'
13707 incpath='$incpath'
13708 inews='$inews'
13709 installarchlib='$installarchlib'
13710 installbin='$installbin'
13711 installman1dir='$installman1dir'
13712 installman3dir='$installman3dir'
13713 installprefix='$installprefix'
13714 installprefixexp='$installprefixexp'
13715 installprivlib='$installprivlib'
13716 installscript='$installscript'
13717 installsitearch='$installsitearch'
13718 installsitelib='$installsitelib'
13719 installstyle='$installstyle'
13720 installusrbinperl='$installusrbinperl'
13721 installvendorlib='$installvendorlib'
13722 intsize='$intsize'
13723 known_extensions='$known_extensions'
13724 ksh='$ksh'
13725 large='$large'
13726 ld='$ld'
13727 lddlflags='$lddlflags'
13728 ldflags='$ldflags'
13729 ldlibpthname='$ldlibpthname'
13730 less='$less'
13731 lib_ext='$lib_ext'
13732 libc='$libc'
13733 libperl='$libperl'
13734 libpth='$libpth'
13735 libs='$libs'
13736 libswanted='$libswanted'
13737 line='$line'
13738 lint='$lint'
13739 lkflags='$lkflags'
13740 ln='$ln'
13741 lns='$lns'
13742 locincpth='$locincpth'
13743 loclibpth='$loclibpth'
13744 longdblsize='$longdblsize'
13745 longlongsize='$longlongsize'
13746 longsize='$longsize'
13747 lp='$lp'
13748 lpr='$lpr'
13749 ls='$ls'
13750 lseeksize='$lseeksize'
13751 lseektype='$lseektype'
13752 mail='$mail'
13753 mailx='$mailx'
13754 make='$make'
13755 make_set_make='$make_set_make'
13756 mallocobj='$mallocobj'
13757 mallocsrc='$mallocsrc'
13758 malloctype='$malloctype'
13759 man1dir='$man1dir'
13760 man1direxp='$man1direxp'
13761 man1ext='$man1ext'
13762 man3dir='$man3dir'
13763 man3direxp='$man3direxp'
13764 man3ext='$man3ext'
13765 medium='$medium'
13766 mips='$mips'
13767 mips_type='$mips_type'
13768 mkdir='$mkdir'
13769 mmaptype='$mmaptype'
13770 models='$models'
13771 modetype='$modetype'
13772 more='$more'
13773 multiarch='$multiarch'
13774 mv='$mv'
13775 myarchname='$myarchname'
13776 mydomain='$mydomain'
13777 myhostname='$myhostname'
13778 myuname='$myuname'
13779 n='$n'
13780 netdb_hlen_type='$netdb_hlen_type'
13781 netdb_host_type='$netdb_host_type'
13782 netdb_name_type='$netdb_name_type'
13783 netdb_net_type='$netdb_net_type'
13784 nm='$nm'
13785 nm_opt='$nm_opt'
13786 nm_so_opt='$nm_so_opt'
13787 nonxs_ext='$nonxs_ext'
13788 nroff='$nroff'
13789 o_nonblock='$o_nonblock'
13790 obj_ext='$obj_ext'
13791 old_pthread_create_joinable='$old_pthread_create_joinable'
13792 optimize='$optimize'
13793 orderlib='$orderlib'
13794 osname='$osname'
13795 osvers='$osvers'
13796 package='$package'
13797 pager='$pager'
13798 passcat='$passcat'
13799 patchlevel='$patchlevel'
13800 path_sep='$path_sep'
13801 perl='$perl'
13802 perladmin='$perladmin'
13803 perlpath='$perlpath'
13804 pg='$pg'
13805 phostname='$phostname'
13806 pidtype='$pidtype'
13807 plibpth='$plibpth'
13808 pmake='$pmake'
13809 pr='$pr'
13810 prefix='$prefix'
13811 prefixexp='$prefixexp'
13812 privlib='$privlib'
13813 privlibexp='$privlibexp'
13814 prototype='$prototype'
13815 ptrsize='$ptrsize'
13816 randbits='$randbits'
13817 randfunc='$randfunc'
13818 randseedtype='$randseedtype'
13819 ranlib='$ranlib'
13820 rd_nodata='$rd_nodata'
13821 rm='$rm'
13822 rmail='$rmail'
13823 runnm='$runnm'
13824 sPRIEldbl='$sPRIEldbl'
13825 sPRIFldbl='$sPRIFldbl'
13826 sPRIGldbl='$sPRIGldbl'
13827 sPRIX64='$sPRIX64'
13828 sPRId64='$sPRId64'
13829 sPRIeldbl='$sPRIeldbl'
13830 sPRIfldbl='$sPRIfldbl'
13831 sPRIgldbl='$sPRIgldbl'
13832 sPRIi64='$sPRIi64'
13833 sPRIo64='$sPRIo64'
13834 sPRIu64='$sPRIu64'
13835 sPRIx64='$sPRIx64'
13836 sched_yield='$sched_yield'
13837 scriptdir='$scriptdir'
13838 scriptdirexp='$scriptdirexp'
13839 sed='$sed'
13840 seedfunc='$seedfunc'
13841 selectminbits='$selectminbits'
13842 selecttype='$selecttype'
13843 sendmail='$sendmail'
13844 sh='$sh'
13845 shar='$shar'
13846 sharpbang='$sharpbang'
13847 shmattype='$shmattype'
13848 shortsize='$shortsize'
13849 shrpenv='$shrpenv'
13850 shsharp='$shsharp'
13851 sig_count='$sig_count'
13852 sig_name='$sig_name'
13853 sig_name_init='$sig_name_init'
13854 sig_num='$sig_num'
13855 sig_num_init='$sig_num_init'
13856 signal_t='$signal_t'
13857 sitearch='$sitearch'
13858 sitearchexp='$sitearchexp'
13859 sitelib='$sitelib'
13860 sitelibexp='$sitelibexp'
13861 siteprefix='$siteprefix'
13862 siteprefixexp='$siteprefixexp'
13863 sizetype='$sizetype'
13864 sleep='$sleep'
13865 smail='$smail'
13866 small='$small'
13867 so='$so'
13868 sockethdr='$sockethdr'
13869 socketlib='$socketlib'
13870 sort='$sort'
13871 spackage='$spackage'
13872 spitshell='$spitshell'
13873 split='$split'
13874 src='$src'
13875 ssizetype='$ssizetype'
13876 startperl='$startperl'
13877 startsh='$startsh'
13878 static_ext='$static_ext'
13879 stdchar='$stdchar'
13880 stdio_base='$stdio_base'
13881 stdio_bufsiz='$stdio_bufsiz'
13882 stdio_cnt='$stdio_cnt'
13883 stdio_filbuf='$stdio_filbuf'
13884 stdio_ptr='$stdio_ptr'
13885 stdio_stream_array='$stdio_stream_array'
13886 strings='$strings'
13887 submit='$submit'
13888 subversion='$subversion'
13889 sysman='$sysman'
13890 tail='$tail'
13891 tar='$tar'
13892 tbl='$tbl'
13893 tee='$tee'
13894 test='$test'
13895 timeincl='$timeincl'
13896 timetype='$timetype'
13897 touch='$touch'
13898 tr='$tr'
13899 trnl='$trnl'
13900 troff='$troff'
13901 uidtype='$uidtype'
13902 uname='$uname'
13903 uniq='$uniq'
13904 use64bits='$use64bits'
13905 usedl='$usedl'
13906 uselongdouble='$uselongdouble'
13907 usemultiplicity='$usemultiplicity'
13908 usemymalloc='$usemymalloc'
13909 usenm='$usenm'
13910 useopcode='$useopcode'
13911 useperlio='$useperlio'
13912 useposix='$useposix'
13913 usesfio='$usesfio'
13914 useshrplib='$useshrplib'
13915 usesocks='$usesocks'
13916 usethreads='$usethreads'
13917 usevendorprefix='$usevendorprefix'
13918 usevfork='$usevfork'
13919 usrinc='$usrinc'
13920 uuname='$uuname'
13921 vendorlib='$vendorlib'
13922 vendorlibexp='$vendorlibexp'
13923 vendorprefix='$vendorprefix'
13924 vendorprefixexp='$vendorprefixexp'
13925 version='$version'
13926 vi='$vi'
13927 voidflags='$voidflags'
13928 xlibpth='$xlibpth'
13929 zcat='$zcat'
13930 zip='$zip'
13931 EOT
13932
13933 : Add in command line options if available
13934 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
13935
13936 : add special variables
13937 $test -f $src/patchlevel.h && \
13938 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
13939 echo "CONFIGDOTSH=true" >>config.sh
13940
13941 : propagate old symbols
13942 if $test -f UU/config.sh; then
13943         <UU/config.sh sort | uniq >UU/oldconfig.sh
13944         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
13945         sort | uniq -u >UU/oldsyms
13946         set X `cat UU/oldsyms`
13947         shift
13948         case $# in
13949         0) ;;
13950         *)
13951                 cat <<EOM
13952 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
13953 EOM
13954                 echo "# Variables propagated from previous config.sh file." >>config.sh
13955                 for sym in `cat UU/oldsyms`; do
13956                         echo "    Propagating $hint variable "'$'"$sym..."
13957                         eval 'tmp="$'"${sym}"'"'
13958                         echo "$tmp" | \
13959                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
13960                 done
13961                 ;;
13962         esac
13963 fi
13964
13965 : Finish up by extracting the .SH files
13966 case "$alldone" in
13967 exit)
13968         $rm -rf UU
13969         echo "Done."
13970         exit 0
13971         ;;
13972 cont)
13973         ;;
13974 '')
13975         dflt=''
13976         nostick=true
13977         $cat <<EOM
13978
13979 If you'd like to make any changes to the config.sh file before I begin
13980 to configure things, do it as a shell escape now (e.g. !vi config.sh).
13981
13982 EOM
13983         rp="Press return or use a shell escape to edit config.sh:"
13984         . UU/myread
13985         nostick=''
13986         case "$ans" in
13987         '') ;;
13988         *) : in case they cannot read
13989                 sh 1>&4 -c "$ans";;
13990         esac
13991         ;;
13992 esac
13993
13994 : if this fails, just run all the .SH files by hand
13995 . ./config.sh
13996
13997 echo " "
13998 exec 1>&4
13999 . ./UU/extract
14000
14001 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14002         dflt=y
14003         case "$silent" in
14004         true) ;;
14005         *)
14006                 $cat <<EOM
14007
14008 Now you need to generate make dependencies by running "$make depend".
14009 You might prefer to run it in background: "$make depend > makedepend.out &"
14010 It can take a while, so you might not want to run it right now.
14011
14012 EOM
14013                 ;;
14014         esac
14015         rp="Run $make depend now?"
14016         . UU/myread
14017         case "$ans" in
14018         y*)
14019                 $make depend && echo "Now you must run a $make."
14020                 ;;
14021         *)
14022                 echo "You must run '$make depend' then '$make'."
14023                 ;;
14024         esac
14025 elif test -f [Mm]akefile; then
14026         echo " "
14027         echo "Now you must run a $make."
14028 else
14029         echo "Done."
14030 fi
14031
14032 if $test -f Policy.sh; then
14033     $cat <<EOM
14034
14035 If you compile $package on a different machine or from a different object
14036 directory, copy the Policy.sh file from this object directory to the
14037 new one before you run Configure -- this will help you with most of
14038 the policy defaults.
14039
14040 EOM
14041 fi
14042 if $test -f config.msg; then
14043     echo "Hmm.  I also noted the following information while running:"
14044     echo " "
14045     $cat config.msg >&4
14046     $rm -f config.msg
14047 fi
14048 $rm -f kit*isdone ark*isdone
14049 $rm -rf UU
14050
14051 : End of Configure
14052