Fix most of the pod2man moanings reported in
[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 16 22:35:18 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 optimize, 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 Some C compilers have problems with their optimizers.  By default, $package
4163 compiles with the -O flag to use the optimizer.  Alternately, you might want
4164 to use the symbolic debugger, which uses the -g flag (on traditional Unix
4165 systems).  Either flag can be specified here.  To use neither flag, specify
4166 the word "none".
4167
4168 EOH
4169 rp="What optimizer/debugger flag should be used?"
4170 . ./myread
4171 optimize="$ans"
4172 case "$optimize" in
4173 'none') optimize=" ";;
4174 esac
4175
4176 dflt=''
4177 : We will not override a previous value, but we might want to
4178 : augment a hint file
4179 case "$hint" in
4180 none|recommended)
4181         case "$gccversion" in
4182         1*) dflt='-fpcc-struct-return' ;;
4183         esac
4184         case "$optimize" in
4185         *-g*) dflt="$dflt -DDEBUGGING";;
4186         esac
4187         case "$gccversion" in
4188         2*) if test -d /etc/conf/kconfig.d &&
4189                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4190                 then
4191                         dflt="$dflt -posix"
4192                 fi
4193                 ;;
4194         esac
4195         ;;
4196 esac
4197
4198 case "$mips_type" in
4199 *BSD*|'') inclwanted="$locincpth $usrinc";;
4200 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4201 esac
4202 for thisincl in $inclwanted; do
4203         if $test -d $thisincl; then
4204                 if $test x$thisincl != x$usrinc; then
4205                         case "$dflt" in
4206                         *$thisincl*);;
4207                         *) dflt="$dflt -I$thisincl";;
4208                         esac
4209                 fi
4210         fi
4211 done
4212
4213 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4214         xxx=true;
4215 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4216         xxx=true;
4217 else
4218         xxx=false;
4219 fi;
4220 if $xxx; then
4221         case "$dflt" in
4222         *$2*);;
4223         *) dflt="$dflt -D$2";;
4224         esac;
4225 fi'
4226
4227 set signal.h LANGUAGE_C; eval $inctest
4228
4229 case "$usesocks" in
4230 $define)
4231         ccflags="$ccflags -DSOCKS"
4232         ;;
4233 esac
4234
4235 case "$hint" in
4236 none|recommended) dflt="$ccflags $dflt" ;;
4237 *) dflt="$ccflags";;
4238 esac
4239
4240 case "$dflt" in
4241 ''|' ') dflt=none;;
4242 esac
4243 $cat <<EOH
4244
4245 Your C compiler may want other flags.  For this question you should include
4246 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4247 but you should NOT include libraries or ld flags like -lwhatever.  If you
4248 want $package to honor its debug switch, you should include -DDEBUGGING here.
4249 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4250
4251 To use no flags, specify the word "none".
4252
4253 EOH
4254 set X $dflt
4255 shift
4256 dflt=${1+"$@"}
4257 rp="Any additional cc flags?"
4258 . ./myread
4259 case "$ans" in
4260 none) ccflags='';;
4261 *) ccflags="$ans";;
4262 esac
4263
4264 : the following weeds options from ccflags that are of no interest to cpp
4265 cppflags="$ccflags"
4266 case "$gccversion" in
4267 1*) cppflags="$cppflags -D__GNUC__"
4268 esac
4269 case "$mips_type" in
4270 '');;
4271 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4272 esac
4273 case "$cppflags" in
4274 '');;
4275 *)
4276         echo " "
4277         echo "Let me guess what the preprocessor flags are..." >&4
4278         set X $cppflags
4279         shift
4280         cppflags=''
4281         $cat >cpp.c <<'EOM'
4282 #define BLURFL foo
4283
4284 BLURFL xx LFRULB
4285 EOM
4286         previous=''
4287         for flag in $*
4288         do
4289                 case "$flag" in
4290                 -*) ftry="$flag";;
4291                 *) ftry="$previous $flag";;
4292                 esac
4293                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4294                         >cpp1.out 2>/dev/null && \
4295                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4296                         >cpp2.out 2>/dev/null && \
4297                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4298                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4299                 then
4300                         cppflags="$cppflags $ftry"
4301                         previous=''
4302                 else
4303                         previous="$flag"
4304                 fi
4305         done
4306         set X $cppflags
4307         shift
4308         cppflags=${1+"$@"}
4309         case "$cppflags" in
4310         *-*)  echo "They appear to be: $cppflags";;
4311         esac
4312         $rm -f cpp.c cpp?.out
4313         ;;
4314 esac
4315
4316 : flags used in final linking phase
4317 case "$ldflags" in
4318 '') if ./venix; then
4319                 dflt='-i -z'
4320         else
4321                 dflt=''
4322         fi
4323         case "$ccflags" in
4324         *-posix*) dflt="$dflt -posix" ;;
4325         esac
4326         ;;
4327 *) dflt="$ldflags";;
4328 esac
4329
4330 : Try to guess additional flags to pick up local libraries.
4331 for thislibdir in $libpth; do
4332         case " $loclibpth " in
4333         *" $thislibdir "*)
4334                 case "$dflt " in 
4335                 *"-L$thislibdir "*) ;;
4336                 *)  dflt="$dflt -L$thislibdir" ;;
4337                 esac
4338                 ;;
4339         esac
4340 done
4341
4342 case "$dflt" in
4343 '') dflt='none' ;;
4344 esac
4345
4346 $cat <<EOH
4347
4348 Your C linker may need flags.  For this question you should
4349 include -L/whatever and any other flags used by the C linker, but you
4350 should NOT include libraries like -lwhatever.
4351
4352 Make sure you include the appropriate -L/path flags if your C linker
4353 does not normally search all of the directories you specified above,
4354 namely
4355         $libpth
4356 To use no flags, specify the word "none".
4357
4358 EOH
4359
4360 rp="Any additional ld flags (NOT including libraries)?"
4361 . ./myread
4362 case "$ans" in
4363 none) ldflags='';;
4364 *) ldflags="$ans";;
4365 esac
4366 rmlist="$rmlist pdp11"
4367
4368 : coherency check
4369 echo " "
4370 echo "Checking your choice of C compiler and flags for coherency..." >&4
4371 $cat > try.c <<'EOF'
4372 #include <stdio.h>
4373 int main() { printf("Ok\n"); exit(0); }
4374 EOF
4375 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4376 shift
4377 $cat >try.msg <<'EOM'
4378 I've tried to compile and run the following simple program:
4379
4380 EOM
4381 $cat try.c >> try.msg
4382
4383 $cat >> try.msg <<EOM
4384
4385 I used the command:
4386
4387         $*
4388         ./try
4389
4390 and I got the following output:
4391
4392 EOM
4393 dflt=y
4394 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4395         if sh -c './try' >>try.msg 2>&1; then
4396                 xxx=`./try`
4397                 case "$xxx" in
4398                 "Ok") dflt=n ;;
4399                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4400                         case " $libs " in
4401                         *" -lsfio "*)
4402                                 cat >> try.msg <<'EOQS'
4403 If $libs contains -lsfio, and sfio is mis-configured, then it
4404 sometimes (apparently) runs and exits with a 0 status, but with no
4405 output!  It may have to do with sfio's use of _exit vs. exit.
4406
4407 EOQS
4408                                 rp="You have a big problem.  Shall I abort Configure"
4409                                 dflt=y
4410                                 ;;
4411                         esac
4412                         ;;
4413                 esac
4414         else
4415                 echo "The program compiled OK, but exited with status $?." >>try.msg
4416                 rp="You have a problem.  Shall I abort Configure"
4417                 dflt=y
4418         fi
4419 else
4420         echo "I can't compile the test program." >>try.msg
4421         rp="You have a BIG problem.  Shall I abort Configure"
4422         dflt=y
4423 fi
4424 case "$dflt" in
4425 y)
4426         $cat try.msg >&4
4427         case "$knowitall" in
4428         '')
4429                 echo "(The supplied flags or libraries might be incorrect.)"
4430                 ;;
4431         *) dflt=n;;
4432         esac
4433         echo " "
4434         . ./myread
4435         case "$ans" in
4436         n*|N*) ;;
4437         *)      echo "Ok.  Stopping Configure." >&4
4438                 exit 1
4439                 ;;
4440         esac
4441         ;;
4442 n) echo "OK, that should do.";;
4443 esac
4444 $rm -f try try.* core
4445
4446 : determine filename position in cpp output
4447 echo " "
4448 echo "Computing filename position in cpp output for #include directives..." >&4
4449 echo '#include <stdio.h>' > foo.c
4450 $cat >fieldn <<EOF
4451 $startsh
4452 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4453 $grep '^[       ]*#.*stdio\.h' | \
4454 while read cline; do
4455         pos=1
4456         set \$cline
4457         while $test \$# -gt 0; do
4458                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4459                         echo "\$pos"
4460                         exit 0
4461                 fi
4462                 shift
4463                 pos=\`expr \$pos + 1\`
4464         done
4465 done
4466 EOF
4467 chmod +x fieldn
4468 fieldn=`./fieldn`
4469 $rm -f foo.c fieldn
4470 case $fieldn in
4471 '') pos='???';;
4472 1) pos=first;;
4473 2) pos=second;;
4474 3) pos=third;;
4475 *) pos="${fieldn}th";;
4476 esac
4477 echo "Your cpp writes the filename in the $pos field of the line."
4478
4479 : locate header file
4480 $cat >findhdr <<EOF
4481 $startsh
4482 wanted=\$1
4483 name=''
4484 for usrincdir in $usrinc
4485 do
4486         if test -f \$usrincdir/\$wanted; then
4487                 echo "\$usrincdir/\$wanted"
4488                 exit 0
4489         fi
4490 done
4491 awkprg='{ print \$$fieldn }'
4492 echo "#include <\$wanted>" > foo\$\$.c
4493 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4494 $grep "^[       ]*#.*\$wanted" | \
4495 while read cline; do
4496         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4497         case "\$name" in
4498         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4499         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4500         *) exit 2;;
4501         esac;
4502 done;
4503 #
4504 # status = 0: grep returned 0 lines, case statement not executed
4505 # status = 1: headerfile found
4506 # status = 2: while loop executed, no headerfile found
4507 #
4508 status=\$?
4509 $rm -f foo\$\$.c;
4510 if test \$status -eq 1; then
4511         exit 0;
4512 fi
4513 exit 1
4514 EOF
4515 chmod +x findhdr
4516
4517 : define an alternate in-header-list? function
4518 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4519 cont=true; xxf="echo \"<\$1> found.\" >&4";
4520 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4521 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4522 esac;
4523 case $# in 4) instead=instead;; *) instead="at last";; esac;
4524 while $test "$cont"; do
4525         xxx=`./findhdr $1`
4526         var=$2; eval "was=\$$2";
4527         if $test "$xxx" && $test -r "$xxx";
4528         then eval $xxf;
4529         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4530                 cont="";
4531         else eval $xxnf;
4532         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4533         set $yyy; shift; shift; yyy=$@;
4534         case $# in 0) cont="";;
4535         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4536                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4537         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4538                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4539         esac;
4540 done;
4541 while $test "$yyy";
4542 do set $yyy; var=$2; eval "was=\$$2";
4543         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4544         set $yyy; shift; shift; yyy=$@;
4545 done'
4546
4547 : see if this is a malloc.h system
4548 set malloc.h i_malloc
4549 eval $inhdr
4550
4551 : see if stdlib is available
4552 set stdlib.h i_stdlib
4553 eval $inhdr
4554
4555 : determine which malloc to compile in
4556 echo " "
4557 case "$usemymalloc" in
4558 ''|[yY]*|true|$define)  dflt='y' ;;
4559 *)      dflt='n' ;;
4560 esac
4561 rp="Do you wish to attempt to use the malloc that comes with $package?"
4562 . ./myread
4563 usemymalloc="$ans"
4564 case "$ans" in
4565 y*|true)
4566         usemymalloc='y'
4567         mallocsrc='malloc.c'
4568         mallocobj="malloc$_o"
4569         d_mymalloc="$define"
4570         case "$libs" in
4571         *-lmalloc*)
4572                 : Remove malloc from list of libraries to use
4573                 echo "Removing unneeded -lmalloc from library list" >&4
4574                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4575                 shift
4576                 libs="$*"
4577                 echo "libs = $libs" >&4
4578                 ;;
4579         esac
4580         ;;
4581 *)
4582         usemymalloc='n'
4583         mallocsrc=''
4584         mallocobj=''
4585         d_mymalloc="$undef"
4586         ;;
4587 esac
4588
4589 : compute the return types of malloc and free
4590 echo " "
4591 $cat >malloc.c <<END
4592 #$i_malloc I_MALLOC
4593 #$i_stdlib I_STDLIB
4594 #include <stdio.h>
4595 #include <sys/types.h>
4596 #ifdef I_MALLOC
4597 #include <malloc.h>
4598 #endif
4599 #ifdef I_STDLIB
4600 #include <stdlib.h>
4601 #endif
4602 #ifdef TRY_MALLOC
4603 void *malloc();
4604 #endif
4605 #ifdef TRY_FREE
4606 void free();
4607 #endif
4608 END
4609 case "$malloctype" in
4610 '')
4611         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4612                 malloctype='void *'
4613         else
4614                 malloctype='char *'
4615         fi
4616         ;;
4617 esac
4618 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4619
4620 case "$freetype" in
4621 '')
4622         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4623                 freetype='void'
4624         else
4625                 freetype='int'
4626         fi
4627         ;;
4628 esac
4629 echo "Your system uses $freetype free(), it would seem." >&4
4630 $rm -f malloc.[co]
4631 $cat <<EOM
4632
4633 The installation process will also create a directory for
4634 vendor-supplied add-ons.  Vendors who supply perl with their system
4635 may find it convenient to place all vendor-supplied files in this
4636 directory rather than in the main distribution directory.  This will
4637 ease upgrades between binary-compatible maintenance versions of perl.
4638
4639 Of course you may also use these directories in whatever way you see
4640 fit.  For example, you might use them to access modules shared over a
4641 company-wide network.
4642
4643 The default answer should be fine for most people.
4644 This causes further questions about vendor add-ons to be skipped
4645 and no vendor-specific directories will be configured for perl.
4646
4647 EOM
4648 rp='Do you want to configure vendor-specific add-on directories?'
4649 case "$usevendorprefix" in
4650 define|true|[yY]*) dflt=y ;;
4651 *) dflt=n ;;
4652 esac
4653 . ./myread
4654 case "$ans" in
4655 [yY]*)  fn=d~+
4656         rp='Installation prefix to use for vendor-supplied add-ons?'
4657         case "$vendorprefix" in
4658         '') dflt='' ;;
4659         *)  dflt=$vendorprefix ;;
4660         esac
4661         . ./getfile
4662         oldvendorprefix=''
4663         case "$vendorprefix" in
4664         '') ;;
4665         *)      case "$ans" in
4666                 "$prefix") ;;
4667                 *) oldvendorprefix="$prefix";;
4668                 esac
4669                 ;;
4670         esac
4671         usevendorprefix="$define"
4672         vendorprefix="$ans"
4673         vendorprefixexp="$ansexp"
4674         ;;
4675 *)      usevendorprefix="$undef"
4676         vendorprefix=''
4677         vendorprefixexp=''
4678         ;;
4679 esac
4680
4681 case "$vendorprefix" in
4682 '')     d_vendorlib="$undef"
4683         vendorlib=''
4684         vendorlibexp=''
4685         ;;
4686 *)      d_vendorlib="$define"
4687         : determine where vendor-supplied modules go.
4688         : Usual default is /usr/local/lib/perl5/vendor_perl
4689         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4690         case "$installstyle" in
4691         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4692         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4693         esac
4694         fn=d~+
4695         rp='Pathname for the vendor-supplied library files?'
4696         . ./getfile
4697         vendorlib="$ans"
4698         vendorlibexp="$ansexp"
4699         : Change installation prefix, if necessary.
4700         if $test X"$prefix" != X"$installprefix"; then
4701                 installvendorlib=`echo $vendorlibexp | $sed 's#^$prefix#$installprefix#'`
4702         else
4703                 installvendorlib="$vendorlibexp"
4704         fi
4705         ;;
4706 esac
4707
4708 : Cruising for prototypes
4709 echo " "
4710 echo "Checking out function prototypes..." >&4
4711 $cat >prototype.c <<'EOCP'
4712 int main(int argc, char *argv[]) {
4713         exit(0);}
4714 EOCP
4715 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4716         echo "Your C compiler appears to support function prototypes."
4717         val="$define"
4718 else
4719         echo "Your C compiler doesn't seem to understand function prototypes."
4720         val="$undef"
4721 fi
4722 set prototype
4723 eval $setvar
4724 $rm -f prototype*
4725
4726 case "$prototype" in
4727 "$define") ;;
4728 *)      ansi2knr='ansi2knr'
4729         echo " "
4730         cat <<EOM >&4
4731
4732 $me:  FATAL ERROR:
4733 This version of $package can only be compiled by a compiler that 
4734 understands function prototypes.  Unfortunately, your C compiler 
4735         $cc $ccflags
4736 doesn't seem to understand them.  Sorry about that.
4737
4738 If GNU cc is available for your system, perhaps you could try that instead.  
4739
4740 Eventually, we hope to support building Perl with pre-ANSI compilers.
4741 If you would like to help in that effort, please contact <perlbug@perl.org>.
4742
4743 Aborting Configure now.
4744 EOM
4745         exit 2
4746         ;;
4747 esac
4748
4749 : determine where public executables go
4750 echo " "
4751 set dflt bin bin
4752 eval $prefixit
4753 fn=d~
4754 rp='Pathname where the public executables will reside?'
4755 . ./getfile
4756 if $test "X$ansexp" != "X$binexp"; then
4757         installbin=''
4758 fi
4759 bin="$ans"
4760 binexp="$ansexp"
4761 : Change installation prefix, if necessary.
4762 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4763 if $test X"$prefix" != X"$installprefix"; then
4764         installbin=`echo $binexp | sed 's#^$prefix#$installprefix#'`
4765 else
4766         installbin="$binexp"
4767 fi
4768
4769 : determine whether to install perl also as /usr/bin/perl
4770
4771 echo " "
4772 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4773         $cat <<EOM
4774 Many scripts expect to perl to be installed as /usr/bin/perl.
4775 I can install the perl you are about to compile also as /usr/bin/perl
4776 (in addition to $installbin/perl).
4777 EOM
4778         case "$installusrbinperl" in
4779         "$undef"|[nN]*) dflt='n';;
4780         *)              dflt='y';;
4781         esac
4782         rp="Do you want to install perl as /usr/bin/perl?"
4783         . ./myread
4784         case "$ans" in
4785         [yY]*)  val="$define";;
4786         *)      val="$undef" ;;
4787         esac
4788 else
4789         val="$undef"
4790 fi
4791 set installusrbinperl
4792 eval $setvar
4793
4794 : define a shorthand compile call
4795 compile='
4796 mc_file=$1;
4797 shift;
4798 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4799 : define a shorthand compile call for compilations that should be ok.
4800 compile_ok='
4801 mc_file=$1;
4802 shift;
4803 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4804
4805 echo " "
4806 echo "Checking for GNU C Library..." >&4
4807 cat >gnulibc.c <<EOM
4808 #include <stdio.h>
4809 int main()
4810 {
4811 #ifdef __GLIBC__
4812     exit(0);
4813 #else
4814     exit(1);
4815 #endif
4816 }
4817 EOM
4818 set gnulibc
4819 if eval $compile_ok && ./gnulibc; then
4820         val="$define"
4821         echo "You are using the GNU C Library"
4822 else
4823         val="$undef"
4824         echo "You are not using the GNU C Library"
4825 fi
4826 $rm -f gnulibc*
4827 set d_gnulibc
4828 eval $setvar
4829
4830 : see if nm is to be used to determine whether a symbol is defined or not
4831 case "$usenm" in
4832 '')
4833         dflt=''
4834         case "$d_gnulibc" in
4835         "$define")
4836                 echo " "
4837                 echo "nm probably won't work on the GNU C Library." >&4
4838                 dflt=n
4839                 ;;
4840         esac
4841         case "$dflt" in
4842         '') 
4843                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4844                         echo " "
4845                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4846                         echo "'nm' won't be sufficient on this sytem." >&4
4847                         dflt=n
4848                 fi
4849                 ;;
4850         esac
4851         case "$dflt" in
4852         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4853                 if $test $dflt -gt 20; then
4854                         dflt=y
4855                 else
4856                         dflt=n
4857                 fi
4858                 ;;
4859         esac
4860         ;;
4861 *)
4862         case "$usenm" in
4863         true|$define) dflt=y;;
4864         *) dflt=n;;
4865         esac
4866         ;;
4867 esac
4868 $cat <<EOM
4869
4870 I can use $nm to extract the symbols from your C libraries. This
4871 is a time consuming task which may generate huge output on the disk (up
4872 to 3 megabytes) but that should make the symbols extraction faster. The
4873 alternative is to skip the 'nm' extraction part and to compile a small
4874 test program instead to determine whether each symbol is present. If
4875 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4876 this may be the best solution.
4877
4878 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4879
4880 EOM
4881 rp="Shall I use $nm to extract C symbols from the libraries?"
4882 . ./myread
4883 case "$ans" in
4884 [Nn]*) usenm=false;;
4885 *) usenm=true;;
4886 esac
4887
4888 runnm=$usenm
4889 case "$reuseval" in
4890 true) runnm=false;;
4891 esac
4892
4893 : nm options which may be necessary
4894 case "$nm_opt" in
4895 '') if $test -f /mach_boot; then
4896                 nm_opt=''       # Mach
4897         elif $test -d /usr/ccs/lib; then
4898                 nm_opt='-p'     # Solaris (and SunOS?)
4899         elif $test -f /dgux; then
4900                 nm_opt='-p'     # DG-UX
4901         elif $test -f /lib64/rld; then
4902                 nm_opt='-p'     # 64-bit Irix
4903         else
4904                 nm_opt=''
4905         fi;;
4906 esac
4907
4908 : nm options which may be necessary for shared libraries but illegal
4909 : for archive libraries.  Thank you, Linux.
4910 case "$nm_so_opt" in
4911 '')     case "$myuname" in
4912         *linux*)
4913                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4914                         nm_so_opt='--dynamic'
4915                 fi
4916                 ;;
4917         esac
4918         ;;
4919 esac
4920
4921 case "$runnm" in
4922 true)
4923 : get list of predefined functions in a handy place
4924 echo " "
4925 case "$libc" in
4926 '') libc=unknown
4927         case "$libs" in
4928         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4929         esac
4930         ;;
4931 esac
4932 libnames='';
4933 case "$libs" in
4934 '') ;;
4935 *)  for thislib in $libs; do
4936         case "$thislib" in
4937         -lc|-lc_s)
4938                 : Handle C library specially below.
4939                 ;;
4940         -l*)
4941                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4942                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4943                         :
4944                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4945                         :
4946                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4947                         :
4948                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4949                         :
4950                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4951                         :
4952                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4953                         :
4954                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4955                         :
4956                 else
4957                         try=''
4958                 fi
4959                 libnames="$libnames $try"
4960                 ;;
4961         *) libnames="$libnames $thislib" ;;
4962         esac
4963         done
4964         ;;
4965 esac
4966 xxx=normal
4967 case "$libc" in
4968 unknown)
4969         set /lib/libc.$so
4970         for xxx in $libpth; do
4971                 $test -r $1 || set $xxx/libc.$so
4972                 : The messy sed command sorts on library version numbers.
4973                 $test -r $1 || \
4974                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4975                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4976                                 h
4977                                 s/[0-9][0-9]*/0000&/g
4978                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4979                                 G
4980                                 s/\n/ /' | \
4981                          sort | $sed -e 's/^.* //'`
4982                 eval set \$$#
4983         done
4984         $test -r $1 || set /usr/ccs/lib/libc.$so
4985         $test -r $1 || set /lib/libsys_s$_a
4986         ;;
4987 *)
4988         set blurfl
4989         ;;
4990 esac
4991 if $test -r "$1"; then
4992         echo "Your (shared) C library seems to be in $1."
4993         libc="$1"
4994 elif $test -r /lib/libc && $test -r /lib/clib; then
4995         echo "Your C library seems to be in both /lib/clib and /lib/libc."
4996         xxx=apollo
4997         libc='/lib/clib /lib/libc'
4998         if $test -r /lib/syslib; then
4999                 echo "(Your math library is in /lib/syslib.)"
5000                 libc="$libc /lib/syslib"
5001         fi
5002 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5003         echo "Your C library seems to be in $libc, as you said before."
5004 elif $test -r $incpath/usr/lib/libc$_a; then
5005         libc=$incpath/usr/lib/libc$_a;
5006         echo "Your C library seems to be in $libc.  That's fine."
5007 elif $test -r /lib/libc$_a; then
5008         libc=/lib/libc$_a;
5009         echo "Your C library seems to be in $libc.  You're normal."
5010 else
5011         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5012                 :
5013         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5014                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5015         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5016                 :
5017         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5018                 :
5019         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5020                 :
5021         else
5022                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5023         fi
5024         if $test -r "$tans"; then
5025                 echo "Your C library seems to be in $tans, of all places."
5026                 libc=$tans
5027         else
5028                 libc='blurfl'
5029         fi
5030 fi
5031 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5032         dflt="$libc"
5033         cat <<EOM
5034
5035 If the guess above is wrong (which it might be if you're using a strange
5036 compiler, or your machine supports multiple models), you can override it here.
5037
5038 EOM
5039 else
5040         dflt=''
5041         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5042         cat >&4 <<EOM
5043 I can't seem to find your C library.  I've looked in the following places:
5044
5045 EOM
5046         $sed 's/^/      /' libpath
5047         cat <<EOM
5048
5049 None of these seems to contain your C library. I need to get its name...
5050
5051 EOM
5052 fi
5053 fn=f
5054 rp='Where is your C library?'
5055 . ./getfile
5056 libc="$ans"
5057
5058 echo " "
5059 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5060 set X `cat libnames`
5061 shift
5062 xxx=files
5063 case $# in 1) xxx=file; esac
5064 echo "Extracting names from the following $xxx for later perusal:" >&4
5065 echo " "
5066 $sed 's/^/      /' libnames >&4
5067 echo " "
5068 $echo $n "This may take a while...$c" >&4
5069
5070 for file in $*; do
5071         case $file in
5072         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5073         *) $nm $nm_opt $file 2>/dev/null;;
5074         esac
5075 done >libc.tmp
5076
5077 $echo $n ".$c"
5078 $grep fprintf libc.tmp > libc.ptf
5079 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5080 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5081 xxx='[ADTSIW]'
5082 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5083         eval $xscan;\
5084         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5085                 eval $xrun
5086 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5087         eval $xscan;\
5088         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5089                 eval $xrun
5090 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5091         eval $xscan;\
5092         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5093                 eval $xrun
5094 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5095         eval $xscan;\
5096         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5097                 eval $xrun
5098 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5099         eval $xscan;\
5100         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5101                 eval $xrun
5102 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5103         eval $xscan;\
5104         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5105                 eval $xrun
5106 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5107                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5108         eval $xscan;\
5109         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5110                 eval $xrun
5111 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5112         eval $xscan;\
5113         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5114                 eval $xrun
5115 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5116         eval $xscan;\
5117         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5118                 eval $xrun
5119 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5120         eval $xscan;\
5121         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5122                 eval $xrun
5123 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5124         eval $xscan;\
5125         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5126                 eval $xrun
5127 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5128         eval $xscan;\
5129         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5130                 eval $xrun
5131 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5132         eval $xscan;\
5133         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5134                 eval $xrun
5135 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5136         eval $xscan;\
5137         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5138                 eval $xrun
5139 else
5140         $nm -p $* 2>/dev/null >libc.tmp
5141         $grep fprintf libc.tmp > libc.ptf
5142         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5143                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5144         then
5145                 nm_opt='-p'
5146                 eval $xrun
5147         else
5148                 echo " "
5149                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5150                 com=''
5151                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5152                         for thisname in $libnames $libc; do
5153                                 $ar t $thisname >>libc.tmp
5154                         done
5155                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5156                         echo "Ok." >&4
5157                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5158                         # Repeat libc to extract forwarders to DLL entries too
5159                         for thisname in $libnames $libc; do
5160                                 $ar tv $thisname >>libc.tmp
5161                                 # Revision 50 of EMX has bug in $ar.
5162                                 # it will not extract forwarders to DLL entries
5163                                 # Use emximp which will extract exactly them.
5164                                 emximp -o tmp.imp $thisname \
5165                                     2>/dev/null && \
5166                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5167                                     < tmp.imp >>libc.tmp
5168                                 $rm tmp.imp
5169                         done
5170                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5171                         echo "Ok." >&4
5172                 else
5173                         echo "$ar didn't seem to work right." >&4
5174                         echo "Maybe this is a Cray...trying bld instead..." >&4
5175                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5176                         then
5177                                 for thisname in $libnames; do
5178                                         bld t $libnames | \
5179                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5180                                         $ar t $thisname >>libc.tmp
5181                                 done
5182                                 echo "Ok." >&4
5183                         else
5184                                 echo "That didn't work either.  Giving up." >&4
5185                                 exit 1
5186                         fi
5187                 fi
5188         fi
5189 fi
5190 nm_extract="$com"
5191 if $test -f /lib/syscalls.exp; then
5192         echo " "
5193         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5194         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5195 fi
5196 ;;
5197 esac
5198 $rm -f libnames libpath
5199
5200 : see if dld is available
5201 set dld.h i_dld
5202 eval $inhdr
5203
5204 : is a C symbol defined?
5205 csym='tlook=$1;
5206 case "$3" in
5207 -v) tf=libc.tmp; tc=""; tdc="";;
5208 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5209 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5210 esac;
5211 tx=yes;
5212 case "$reuseval-$4" in
5213 true-) ;;
5214 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5215 esac;
5216 case "$tx" in
5217 yes)
5218         case "$runnm" in
5219         true)
5220                 if $contains $tlook $tf >/dev/null 2>&1;
5221                 then tval=true;
5222                 else tval=false;
5223                 fi;;
5224         *)
5225                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5226                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5227                 then tval=true;
5228                 else tval=false;
5229                 fi;
5230                 $rm -f t t.c;;
5231         esac;;
5232 *)
5233         case "$tval" in
5234         $define) tval=true;;
5235         *) tval=false;;
5236         esac;;
5237 esac;
5238 eval "$2=$tval"'
5239
5240 : define an is-in-libc? function
5241 inlibc='echo " "; td=$define; tu=$undef;
5242 sym=$1; var=$2; eval "was=\$$2";
5243 tx=yes;
5244 case "$reuseval$was" in
5245 true) ;;
5246 true*) tx=no;;
5247 esac;
5248 case "$tx" in
5249 yes)
5250         set $sym tres -f;
5251         eval $csym;
5252         case "$tres" in
5253         true)
5254                 echo "$sym() found." >&4;
5255                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5256         *)
5257                 echo "$sym() NOT found." >&4;
5258                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5259         esac;;
5260 *)
5261         case "$was" in
5262         $define) echo "$sym() found." >&4;;
5263         *) echo "$sym() NOT found." >&4;;
5264         esac;;
5265 esac'
5266
5267 : see if dlopen exists
5268 xxx_runnm="$runnm"
5269 runnm=false
5270 set dlopen d_dlopen
5271 eval $inlibc
5272 runnm="$xxx_runnm"
5273
5274 : determine which dynamic loading, if any, to compile in
5275 echo " "
5276 dldir="ext/DynaLoader"
5277 case "$usedl" in
5278 $define|y|true)
5279         dflt='y'
5280         usedl="$define"
5281         ;;
5282 $undef|n|false)
5283         dflt='n'
5284         usedl="$undef"
5285         ;;
5286 *) 
5287         dflt='n'
5288         case "$d_dlopen" in
5289             $define) dflt='y' ;;
5290         esac
5291         case "$i_dld" in
5292             $define) dflt='y' ;;
5293         esac
5294         : Does a dl_xxx.xs file exist for this operating system
5295         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5296         ;;
5297 esac
5298 rp="Do you wish to use dynamic loading?"
5299 . ./myread
5300 usedl="$ans"
5301 case "$ans" in
5302 y*) usedl="$define"
5303         case "$dlsrc" in
5304         '')
5305                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5306                         dflt="$dldir/dl_${osname}.xs"
5307                 elif $test "$d_dlopen" = "$define" ; then
5308                         dflt="$dldir/dl_dlopen.xs"
5309                 elif $test "$i_dld" = "$define" ; then
5310                         dflt="$dldir/dl_dld.xs"
5311                 else
5312                         dflt=''
5313                 fi
5314                 ;;
5315         *)      dflt="$dldir/$dlsrc"
5316                 ;;
5317         esac
5318     echo "The following dynamic loading files are available:"
5319         : Can not go over to $dldir because getfile has path hard-coded in.
5320         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5321         rp="Source file to use for dynamic loading"
5322         fn="fne"
5323         gfpth="$src"
5324         . ./getfile
5325         usedl="$define"
5326         : emulate basename
5327         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5328
5329         $cat << EOM
5330
5331 Some systems may require passing special flags to $cc -c to
5332 compile modules that will be used to create a shared library.
5333 To use no flags, say "none".
5334
5335 EOM
5336     case "$cccdlflags" in
5337     '') case "$gccversion" in
5338                 '') case "$osname" in
5339                         hpux)   dflt='+z' ;;
5340                         next)   dflt='none' ;;
5341                         irix*)  dflt='-KPIC' ;;
5342                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5343                         sunos)  dflt='-pic' ;;
5344                         *)      dflt='none' ;;
5345                     esac
5346                         ;;
5347                 *)  case "$osname" in
5348                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5349                         *)      dflt='-fpic' ;;
5350                     esac ;;
5351             esac ;;
5352         ' ') dflt='none' ;;
5353     *)  dflt="$cccdlflags" ;;
5354     esac
5355     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5356     . ./myread
5357     case "$ans" in
5358     none) cccdlflags=' ' ;;
5359     *) cccdlflags="$ans" ;;
5360     esac
5361
5362     cat << EOM
5363
5364 Some systems use ld to create libraries that can be dynamically loaded,
5365 while other systems (such as those using ELF) use $cc.
5366
5367 EOM
5368         case "$ld" in
5369         '')     $cat >try.c <<'EOM'
5370 /* Test for whether ELF binaries are produced */
5371 #include <fcntl.h>
5372 #include <stdlib.h>
5373 int main() {
5374         char b[4];
5375         int i = open("a.out",O_RDONLY);
5376         if(i == -1) 
5377                 exit(1); /* fail */
5378         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5379                 exit(0); /* succeed (yes, it's ELF) */
5380         else
5381                 exit(1); /* fail */
5382 }
5383 EOM
5384                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5385                         cat <<EOM
5386 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5387 EOM
5388                         dflt="$cc"
5389                 else
5390                         echo "I'll use ld to build dynamic libraries."
5391                         dflt='ld'
5392                 fi
5393                 rm -f try.c a.out
5394                 ;;
5395         *)      dflt="$ld"
5396                 ;;
5397         esac
5398
5399     rp="What command should be used to create dynamic libraries?"
5400     . ./myread
5401         ld="$ans"
5402
5403     cat << EOM
5404
5405 Some systems may require passing special flags to $ld to create a
5406 library that can be dynamically loaded.  If your ld flags include
5407 -L/other/path options to locate libraries outside your loader's normal
5408 search path, you may need to specify those -L options here as well.  To
5409 use no flags, say "none".
5410
5411 EOM
5412     case "$lddlflags" in
5413     '') case "$osname" in
5414                         beos) dflt='-nostart' ;;
5415                         hpux)  dflt='-b' ;;
5416                         linux|irix*)    dflt='-shared' ;;
5417                         next)  dflt='none' ;;
5418                         solaris) dflt='-G' ;;
5419                         sunos) dflt='-assert nodefinitions' ;;
5420                         svr4*|esix*) dflt="-G $ldflags" ;;
5421                 *)     dflt='none' ;;
5422                         esac
5423                         ;;
5424     *) dflt="$lddlflags" ;;
5425     esac
5426
5427         : Try to guess additional flags to pick up local libraries.
5428         : Be careful not to append to a plain 'none'
5429         case "$dflt" in
5430         none) dflt='' ;;
5431         esac
5432         for thisflag in $ldflags; do
5433                 case "$thisflag" in
5434                 -L*)
5435                         case " $dflt " in
5436                         *" $thisflag "*) ;;
5437                         *) dflt="$dflt $thisflag" ;;
5438                         esac
5439                         ;;
5440                 esac
5441         done
5442
5443         case "$dflt" in
5444         ''|' ') dflt='none' ;;
5445         esac
5446
5447     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5448     . ./myread
5449     case "$ans" in
5450     none) lddlflags=' ' ;;
5451     *) lddlflags="$ans" ;;
5452     esac
5453
5454         cat <<EOM
5455
5456 Some systems may require passing special flags to $cc to indicate that
5457 the resulting executable will use dynamic linking.  To use no flags,
5458 say "none".
5459
5460 EOM
5461     case "$ccdlflags" in
5462     '') case "$osname" in
5463                 hpux)   dflt='-Wl,-E' ;;
5464                 linux)  dflt='-rdynamic' ;;
5465                 next)   dflt='none' ;;
5466                 sunos)  dflt='none' ;;
5467                 *)      dflt='none' ;;
5468             esac ;;
5469     ' ')  dflt='none' ;;
5470     *)  dflt="$ccdlflags" ;;
5471     esac
5472     rp="Any special flags to pass to $cc to use dynamic loading?"
5473     . ./myread
5474     case "$ans" in
5475     none) ccdlflags=' ' ;;
5476     *) ccdlflags="$ans" ;;
5477     esac
5478     ;;
5479 *)  usedl="$undef"
5480         ld='ld'
5481     dlsrc='dl_none.xs'
5482     lddlflags=''
5483     ccdlflags=''
5484     ;;
5485 esac
5486
5487 also=''
5488 case "$usedl" in
5489 $undef)
5490         # No dynamic loading being used, so don't bother even to prompt.
5491         useshrplib='false'
5492         ;;
5493 *)      case "$useshrplib" in
5494         '')     case "$osname" in
5495                 svr4*|dgux|dynixptx|esix|powerux|beos)
5496                         dflt=y
5497                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5498                         ;;
5499                 next*)
5500                         case "$osvers" in
5501                         4*)     dflt=y
5502                                 also='Building a shared libperl is needed for MAB support.'
5503                                 ;;
5504                         *)      dflt=n
5505                                 ;;
5506                         esac
5507                         ;;
5508                 *)      dflt=n
5509                         ;;
5510                 esac
5511                 ;;
5512         $define|true|[Yy]*)
5513                 dflt=y
5514                 ;;
5515         *)      dflt=n
5516                 ;;
5517         esac
5518         $cat << EOM
5519
5520 The perl executable is normally obtained by linking perlmain.c with
5521 libperl${_a}, any static extensions (usually just DynaLoader), and
5522 any other libraries needed on this system (such as -lm, etc.).  Since
5523 your system supports dynamic loading, it is probably possible to build
5524 a shared libperl.$so.  If you will have more than one executable linked
5525 to libperl.$so, this will significantly reduce the size of each
5526 executable, but it may have a noticeable affect on performance.  The
5527 default is probably sensible for your system.
5528 $also
5529
5530 EOM
5531         rp="Build a shared libperl.$so (y/n)"
5532         . ./myread
5533         case "$ans" in
5534         true|$define|[Yy]*)
5535                 useshrplib='true'  ;;
5536         *)      useshrplib='false' ;;
5537         esac
5538         ;;
5539 esac
5540
5541 case "$useshrplib" in
5542 true)
5543         case "$libperl" in
5544         '')
5545                 # Figure out a good name for libperl.so.  Since it gets stored in
5546                 # a version-specific architecture-dependent library, the version
5547                 # number isn't really that important, except for making cc/ld happy.
5548                 #
5549                 # A name such as libperl.so.3.1
5550                 majmin="libperl.$so.$patchlevel.$subversion"
5551                 # A name such as libperl.so.301
5552                 majonly=`echo $patchlevel $subversion |
5553                         $awk '{printf "%d%02d", $1, $2}'`
5554                 majonly=libperl.$so.$majonly
5555                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5556                 # rely on figuring it out from the naming of libc.
5557                 case "${osname}${osvers}" in
5558                 next4*)
5559                         dflt=libperl.5.$so
5560                         # XXX How handle the --version stuff for MAB?
5561                         ;;
5562                 linux*)  # ld won't link with a bare -lperl otherwise.
5563                         dflt=libperl.$so
5564                         ;;
5565                 *)      # Try to guess based on whether libc has major.minor.
5566                         case "$libc" in
5567                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5568                         *libc.$so.[0-9]*) dflt=$majonly ;;
5569                         *)      dflt=libperl.$so ;;
5570                         esac
5571                         ;;
5572                 esac
5573                 ;;
5574         *)      dflt=$libperl
5575                 ;;
5576         esac
5577         cat << EOM
5578
5579 I need to select a good name for the shared libperl.  If your system uses
5580 library names with major and minor numbers, then you might want something
5581 like $majmin.  Alternatively, if your system uses a single version
5582 number for shared libraries, then you might want to use $majonly.
5583 Or, your system might be quite happy with a simple libperl.$so.
5584
5585 Since the shared libperl will get installed into a version-specific
5586 architecture-dependent directory, the version number of the shared perl
5587 library probably isn't important, so the default should be o.k.
5588
5589 EOM
5590         rp='What name do you want to give to the shared libperl?'
5591         . ./myread
5592         libperl=$ans
5593         echo "Ok, I'll use $libperl"
5594         ;;
5595 *)
5596         libperl="libperl${_a}"
5597         ;;
5598 esac
5599
5600 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5601 case "$shrpdir" in
5602 '') ;;
5603 *)      $cat >&4 <<EOM
5604 WARNING:  Use of the shrpdir variable for the installation location of
5605 the shared $libperl is not supported.  It was never documented and
5606 will not work in this version.  Let me (perlbug@perl.com)
5607 know of any problems this may cause.
5608
5609 EOM
5610         case "$shrpdir" in
5611         "$archlibexp/CORE")
5612                 $cat >&4 <<EOM
5613 But your current setting of $shrpdir is
5614 the default anyway, so it's harmless.
5615 EOM
5616                 ;;
5617         *)
5618                 $cat >&4 <<EOM
5619 Further, your current attempted setting of $shrpdir
5620 conflicts with the value of $archlibexp/CORE
5621 that installperl will use.
5622 EOM
5623                 ;;
5624         esac
5625         ;;
5626 esac
5627
5628 # How will the perl executable find the installed shared $libperl?
5629 # Add $xxx to ccdlflags.
5630 # If we can't figure out a command-line option, use $shrpenv to
5631 # set env LD_RUN_PATH.  The main perl makefile uses this.
5632 shrpdir=$archlibexp/CORE
5633 xxx=''
5634 tmp_shrpenv=''
5635 if "$useshrplib"; then
5636     case "$osname" in 
5637         aix)
5638                 # We'll set it in Makefile.SH...
5639                 ;;
5640         solaris|netbsd)
5641                 xxx="-R $shrpdir"
5642                 ;;
5643         freebsd)
5644                 xxx="-Wl,-R$shrpdir"
5645                 ;;
5646         linux|irix*|dec_osf)
5647                 xxx="-Wl,-rpath,$shrpdir"
5648                 ;;
5649         next)
5650                 # next doesn't like the default...
5651                 ;;
5652         beos)
5653                 # beos doesn't like the default, either.
5654                 ;;
5655         hpux*)
5656                 # hpux doesn't like the default, either.
5657                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5658                 ;;
5659         *)
5660                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5661                 ;;
5662         esac
5663         case "$xxx" in
5664         '') ;;
5665         *)      
5666                 # Only add $xxx if it isn't already in ccdlflags.
5667                 case " $ccdlflags " in
5668                 *" $xxx "*)     ;;
5669                 *)      ccdlflags="$ccdlflags $xxx"
5670                         cat <<EOM >&4
5671
5672 Adding $xxx to the flags
5673 passed to $ld so that the perl executable will find the 
5674 installed shared $libperl.
5675
5676 EOM
5677                         ;;
5678                 esac
5679                 ;;
5680         esac
5681 fi
5682 # Fix ccdlflags in AIX for building external extensions.
5683 # (For building Perl itself bare -bE:perl.exp is needed,
5684 #  Makefile.SH takes care of this.)
5685 case "$osname" in
5686 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5687 esac
5688 # Respect a hint or command-line value.
5689 case "$shrpenv" in
5690 '') shrpenv="$tmp_shrpenv" ;;
5691 esac
5692 case "$ldlibpthname" in
5693 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5694 none)   ldlibpthname='' ;;
5695 esac
5696
5697 : determine where manual pages go
5698 set man1dir man1dir none
5699 eval $prefixit
5700 $cat <<EOM
5701
5702 $spackage has manual pages available in source form.
5703 EOM
5704 case "$nroff" in
5705 nroff)
5706         echo "However, you don't have nroff, so they're probably useless to you."
5707         case "$man1dir" in
5708         '') man1dir="none";;
5709         esac;;
5710 esac
5711 echo "If you don't want the manual sources installed, answer 'none'."
5712 case "$man1dir" in
5713 ' ') dflt=none
5714         ;;
5715 '')
5716         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5717         lookpath="$lookpath $prefixexp/man/p_man/man1"
5718         lookpath="$lookpath $prefixexp/man/u_man/man1"
5719         lookpath="$lookpath $prefixexp/man/man.1"
5720         case "$sysman" in
5721         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5722         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5723         esac
5724         set dflt
5725         eval $prefixup
5726         ;;
5727 *)  dflt="$man1dir"
5728         ;;
5729 esac
5730 echo " "
5731 fn=dn+~
5732 rp="Where do the main $spackage manual pages (source) go?"
5733 . ./getfile
5734 if $test "X$man1direxp" != "X$ansexp"; then
5735         installman1dir=''
5736 fi
5737 man1dir="$ans"
5738 man1direxp="$ansexp"
5739 case "$man1dir" in
5740 '')     man1dir=' '
5741         installman1dir='';;
5742 esac
5743
5744 : Change installation prefix, if necessary.
5745 if $test X"$prefix" != X"$installprefix"; then
5746         installman1dir=`echo $man1direxp | $sed 's#^$prefix#$installprefix#'`
5747 else
5748         installman1dir="$man1direxp"
5749 fi
5750
5751 : What suffix to use on installed man pages
5752
5753 case "$man1dir" in
5754 ' ')
5755         man1ext='0'
5756         ;;
5757 *)
5758         rp="What suffix should be used for the main $spackage man pages?"
5759         case "$man1ext" in
5760         '')     case "$man1dir" in
5761                 *1)  dflt=1 ;;
5762                 *1p) dflt=1p ;;
5763                 *1pm) dflt=1pm ;;
5764                 *l) dflt=l;;
5765                 *n) dflt=n;;
5766                 *o) dflt=o;;
5767                 *p) dflt=p;;
5768                 *C) dflt=C;;
5769                 *L) dflt=L;;
5770                 *L1) dflt=L1;;
5771                 *) dflt=1;;
5772                 esac
5773                 ;;
5774         *)      dflt="$man1ext";;
5775         esac
5776         . ./myread
5777         man1ext="$ans"
5778         ;;
5779 esac
5780
5781 : see if we can have long filenames
5782 echo " "
5783 rmlist="$rmlist /tmp/cf$$"
5784 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5785 first=123456789abcdef
5786 second=/tmp/cf$$/$first
5787 $rm -f $first $second
5788 if (echo hi >$first) 2>/dev/null; then
5789         if $test -f 123456789abcde; then
5790                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5791                 val="$undef"
5792         else
5793                 if (echo hi >$second) 2>/dev/null; then
5794                         if $test -f /tmp/cf$$/123456789abcde; then
5795                                 $cat <<'EOM'
5796 That's peculiar... You can have filenames longer than 14 characters, but only
5797 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5798 I shall consider your system cannot support long filenames at all.
5799 EOM
5800                                 val="$undef"
5801                         else
5802                                 echo 'You can have filenames longer than 14 characters.' >&4
5803                                 val="$define"
5804                         fi
5805                 else
5806                         $cat <<'EOM'
5807 How confusing! Some of your filesystems are sane enough to allow filenames
5808 longer than 14 characters but some others like /tmp can't even think about them.
5809 So, for now on, I shall assume your kernel does not allow them at all.
5810 EOM
5811                         val="$undef"
5812                 fi
5813         fi
5814 else
5815         $cat <<'EOM'
5816 You can't have filenames longer than 14 chars.  You can't even think about them!
5817 EOM
5818         val="$undef"
5819 fi 
5820 set d_flexfnam
5821 eval $setvar
5822 $rm -rf /tmp/cf$$ 123456789abcde*
5823
5824 : determine where library module manual pages go
5825 set man3dir man3dir none
5826 eval $prefixit
5827 $cat <<EOM
5828
5829 $spackage has manual pages for many of the library modules.
5830 EOM
5831
5832 case "$nroff" in
5833 nroff)
5834         $cat <<'EOM'
5835 However, you don't have nroff, so they're probably useless to you.
5836 EOM
5837         case "$man3dir" in
5838         '') man3dir="none";;
5839         esac;;
5840 esac
5841
5842 case "$d_flexfnam" in
5843 undef)
5844         $cat <<'EOM'
5845 However, your system can't handle the long file names like File::Basename.3. 
5846 EOM
5847         case "$man3dir" in
5848         '') man3dir="none";;
5849         esac;;
5850 esac
5851
5852 echo "If you don't want the manual sources installed, answer 'none'."
5853 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5854 case "$man3dir" in
5855 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5856         if $test -d "$privlib/man/man3"; then
5857                 cat <<EOM >&4
5858
5859 WARNING:  Previous versions of perl installed man3 pages into
5860 $privlib/man/man3.  This version will suggest a 
5861 new default of $dflt.  
5862 EOM
5863                 tdflt=$dflt
5864                 dflt='n'
5865                 rp='Do you wish to preserve the old behavior?(y/n)'
5866                 . ./myread
5867                 case "$ans" in
5868                 y*) dflt="$privlib/man/man3" ;;
5869                 *)  dflt=$tdflt ;;
5870                 esac
5871     fi
5872         ;;
5873 ' ') dflt=none;;
5874 *)      dflt="$man3dir" ;;
5875 esac
5876 echo " "
5877 fn=dn+~
5878 rp="Where do the $package library man pages (source) go?"
5879 . ./getfile
5880 man3dir="$ans"
5881 man3direxp="$ansexp"
5882 case "$man1dir" in
5883 '')     man3dir=' '
5884         installman3dir='';;
5885 esac
5886
5887 : Change installation prefix, if necessary.
5888 if $test X"$prefix" != X"$installprefix"; then
5889         installman3dir=`echo $man3direxp | $sed 's#^$prefix#$installprefix#'`
5890 else
5891         installman3dir="$man3direxp"
5892 fi
5893
5894 : What suffix to use on installed man pages
5895 case "$man3dir" in
5896 ' ')
5897         man3ext='0'
5898         ;;
5899 *)
5900         rp="What suffix should be used for the $package library man pages?"
5901         case "$man3ext" in
5902         '')     case "$man3dir" in
5903                 *3)  dflt=3 ;;
5904                 *3p) dflt=3p ;;
5905                 *3pm) dflt=3pm ;;
5906                 *l) dflt=l;;
5907                 *n) dflt=n;;
5908                 *o) dflt=o;;
5909                 *p) dflt=p;;
5910                 *C) dflt=C;;
5911                 *L) dflt=L;;
5912                 *L3) dflt=L3;;
5913                 *) dflt=3;;
5914                 esac
5915                 ;;
5916         *)      dflt="$man3ext";;
5917         esac
5918         . ./myread
5919         man3ext="$ans"
5920         ;;
5921 esac
5922
5923 : see if we have to deal with yellow pages, now NIS.
5924 if $test -d /usr/etc/yp || $test -d /etc/yp; then
5925         if $test -f /usr/etc/nibindd; then
5926                 echo " "
5927                 echo "I'm fairly confident you're on a NeXT."
5928                 echo " "
5929                 rp='Do you get the hosts file via NetInfo?'
5930                 dflt=y
5931                 case "$hostcat" in
5932                 nidump*) ;;
5933                 '') ;;
5934                 *) dflt=n;;
5935                 esac
5936                 . ./myread
5937                 case "$ans" in
5938                 y*) hostcat='nidump hosts .';;
5939                 *)      case "$hostcat" in
5940                         nidump*) hostcat='';;
5941                         esac
5942                         ;;
5943                 esac
5944         fi
5945         case "$hostcat" in
5946         nidump*) ;;
5947         *)
5948                 case "$hostcat" in
5949                 *ypcat*) dflt=y;;
5950                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5951                                 dflt=y
5952                         else
5953                                 dflt=n
5954                         fi;;
5955                 *) dflt=n;;
5956                 esac
5957                 echo " "
5958                 rp='Are you getting the hosts file via yellow pages?'
5959                 . ./myread
5960                 case "$ans" in
5961                 y*) hostcat='ypcat hosts';;
5962                 *) hostcat='cat /etc/hosts';;
5963                 esac
5964                 ;;
5965         esac
5966 fi
5967 case "$hostcat" in
5968 '') hostcat='cat /etc/hosts';;
5969 esac
5970 case "$groupcat" in
5971 '') groupcat='cat /etc/group';;
5972 esac
5973 case "$passcat" in
5974 '') passcat='cat /etc/passwd';;
5975 esac
5976
5977 : now get the host name
5978 echo " "
5979 echo "Figuring out host name..." >&4
5980 case "$myhostname" in
5981 '') cont=true
5982         echo 'Maybe "hostname" will work...'
5983         if tans=`sh -c hostname 2>&1` ; then
5984                 myhostname=$tans
5985                 phostname=hostname
5986                 cont=''
5987         fi
5988         ;;
5989 *) cont='';;
5990 esac
5991 if $test "$cont"; then
5992         if ./xenix; then
5993                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
5994                 if tans=`cat /etc/systemid 2>&1` ; then
5995                         myhostname=$tans
5996                         phostname='cat /etc/systemid'
5997                         echo "Whadyaknow.  Xenix always was a bit strange..."
5998                         cont=''
5999                 fi
6000         elif $test -r /etc/systemid; then
6001                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6002         fi
6003 fi
6004 if $test "$cont"; then
6005         echo 'No, maybe "uuname -l" will work...'
6006         if tans=`sh -c 'uuname -l' 2>&1` ; then
6007                 myhostname=$tans
6008                 phostname='uuname -l'
6009         else
6010                 echo 'Strange.  Maybe "uname -n" will work...'
6011                 if tans=`sh -c 'uname -n' 2>&1` ; then
6012                         myhostname=$tans
6013                         phostname='uname -n'
6014                 else
6015                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6016                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6017                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6018                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6019                         else
6020                                 case "$myhostname" in
6021                                 '') echo "Does this machine have an identity crisis or something?"
6022                                         phostname='';;
6023                                 *)
6024                                         echo "Well, you said $myhostname before..."
6025                                         phostname='echo $myhostname';;
6026                                 esac
6027                         fi
6028                 fi
6029         fi
6030 fi
6031 : you do not want to know about this
6032 set $myhostname
6033 myhostname=$1
6034
6035 : verify guess
6036 if $test "$myhostname" ; then
6037         dflt=y
6038         rp='Your host name appears to be "'$myhostname'".'" Right?"
6039         . ./myread
6040         case "$ans" in
6041         y*) ;;
6042         *) myhostname='';;
6043         esac
6044 fi
6045
6046 : bad guess or no guess
6047 while $test "X$myhostname" = X ; do
6048         dflt=''
6049         rp="Please type the (one word) name of your host:"
6050         . ./myread
6051         myhostname="$ans"
6052 done
6053
6054 : translate upper to lower if necessary
6055 case "$myhostname" in
6056 *[A-Z]*)
6057         echo "(Normalizing case in your host name)"
6058         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6059         ;;
6060 esac
6061
6062 case "$myhostname" in
6063 *.*)
6064         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6065         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6066         echo "(Trimming domain name from host name--host name is now $myhostname)"
6067         ;;
6068 *) case "$mydomain" in
6069         '')
6070                 {
6071                         test "X$hostcat" = "Xypcat hosts" &&
6072                         ypmatch "$myhostname" hosts 2>/dev/null |\
6073                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6074                         $test -s hosts
6075                 } || {
6076                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6077                                         /[       ]$myhostname[  . ]/p" > hosts
6078                 }
6079                 tmp_re="[       . ]"
6080                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6081                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6082                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6083                         hosts | $sort | $uniq | \
6084                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6085                 case `$echo X$dflt` in
6086                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6087                         dflt=.
6088                         ;;
6089                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6090                         ;;
6091                 esac
6092                 case "$dflt" in
6093                 .)
6094                         tans=`./loc resolv.conf X /etc /usr/etc`
6095                         if $test -f "$tans"; then
6096                                 echo "(Attempting domain name extraction from $tans)"
6097                                 dflt=.`$sed -n -e 's/   / /g' \
6098                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6099                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6100                                 case "$dflt" in
6101                                 .) dflt=.`$sed -n -e 's/        / /g' \
6102                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6103                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6104                                         ;;
6105                                 esac
6106                         fi
6107                         ;;
6108                 esac
6109                 case "$dflt" in
6110                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6111                         dflt=.`sh -c domainname 2>/dev/null`
6112                         case "$dflt" in
6113                         '') dflt='.';;
6114                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6115                         esac
6116                         ;;
6117                 esac
6118                 case "$dflt" in
6119                 .) echo "(Lost all hope -- silly guess then)"
6120                         dflt='.uucp'
6121                         ;;
6122                 esac
6123                 $rm -f hosts
6124                 ;;
6125         *) dflt="$mydomain";;
6126         esac;;
6127 esac
6128 echo " "
6129 rp="What is your domain name?"
6130 . ./myread
6131 tans="$ans"
6132 case "$ans" in
6133 '') ;;
6134 .*) ;;
6135 *) tans=".$tans";;
6136 esac
6137 mydomain="$tans"
6138
6139 : translate upper to lower if necessary
6140 case "$mydomain" in
6141 *[A-Z]*)
6142         echo "(Normalizing case in your domain name)"
6143         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6144         ;;
6145 esac
6146
6147 : a little sanity check here
6148 case "$phostname" in
6149 '') ;;
6150 *)
6151         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6152         $myhostname$mydomain|$myhostname) ;;
6153         *)
6154                 case "$phostname" in
6155                 sed*)
6156                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6157                         ;;
6158                 *)
6159                         echo "(That doesn't agree with your $phostname command, by the way.)"
6160                         ;;
6161                 esac
6162         ;;
6163         esac
6164         ;;
6165 esac
6166
6167 $cat <<EOM
6168
6169 I need to get your e-mail address in Internet format if possible, i.e.
6170 something like user@host.domain. Please answer accurately since I have
6171 no easy means to double check it. The default value provided below
6172 is most probably close to the reality but may not be valid from outside
6173 your organization...
6174
6175 EOM
6176 cont=x
6177 while test "$cont"; do
6178         case "$cf_email" in
6179         '') dflt="$cf_by@$myhostname$mydomain";;
6180         *) dflt="$cf_email";;
6181         esac
6182         rp='What is your e-mail address?'
6183         . ./myread
6184         cf_email="$ans"
6185         case "$cf_email" in
6186         *@*.*) cont='' ;;
6187         *)
6188                 rp='Address does not look like an Internet one.  Use it anyway?'
6189                 case "$fastread" in
6190                 yes) dflt=y ;;
6191                 *) dflt=n ;;
6192                 esac
6193                 . ./myread
6194                 case "$ans" in
6195                 y*) cont='' ;;
6196                 *) echo " " ;;
6197                 esac
6198                 ;;
6199         esac
6200 done
6201
6202 $cat <<EOM
6203
6204 If you or somebody else will be maintaining perl at your site, please
6205 fill in the correct e-mail address here so that they may be contacted
6206 if necessary. Currently, the "perlbug" program included with perl
6207 will send mail to this address in addition to perlbug@perl.com. You may
6208 enter "none" for no administrator.
6209
6210 EOM
6211 case "$perladmin" in
6212 '') dflt="$cf_email";;
6213 *) dflt="$perladmin";;
6214 esac
6215 rp='Perl administrator e-mail address'
6216 . ./myread
6217 perladmin="$ans"
6218
6219 : figure out how to guarantee perl startup
6220 case "$startperl" in
6221 '')
6222         case "$sharpbang" in
6223         *!)
6224                 $cat <<EOH
6225
6226 I can use the #! construct to start perl on your system. This will
6227 make startup of perl scripts faster, but may cause problems if you
6228 want to share those scripts and perl is not in a standard place
6229 ($binexp/perl) on all your platforms. The alternative is to force
6230 a shell by starting the script with a single ':' character.
6231
6232 EOH
6233                 dflt="$binexp/perl"
6234                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6235                 . ./myread
6236                 case "$ans" in
6237                 none)   startperl=": # use perl";;
6238                 *)      startperl="#!$ans"
6239                         if $test 30 -lt `echo "$ans" | wc -c`; then
6240                                 $cat >&4 <<EOM
6241
6242 WARNING:  Some systems limit the #! command to 32 characters.
6243 If you experience difficulty running Perl scripts with #!, try
6244 installing Perl in a directory with a shorter pathname.
6245
6246 EOM
6247                         fi ;;
6248                 esac
6249                 ;;
6250         *) startperl=": # use perl"
6251                 ;;
6252         esac
6253         ;;
6254 esac
6255 echo "I'll use $startperl to start perl scripts."
6256
6257 : figure best path for perl in scripts
6258 case "$perlpath" in
6259 '')
6260         perlpath="$binexp/perl"
6261         case "$startperl" in
6262         *!*) ;;
6263         *)
6264                 $cat <<EOH
6265
6266 I will use the "eval 'exec'" idiom to start Perl on your system.
6267 I can use the full path of your Perl binary for this purpose, but
6268 doing so may cause problems if you want to share those scripts and
6269 Perl is not always in a standard place ($binexp/perl).
6270
6271 EOH
6272                 dflt="$binexp/perl"
6273                 rp="What path shall I use in \"eval 'exec'\"?"
6274                 . ./myread
6275                 perlpath="$ans"
6276                 ;;
6277         esac
6278         ;;
6279 esac
6280 case "$startperl" in
6281 *!*)    ;;
6282 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6283 esac
6284
6285 : determine where public executable scripts go
6286 set scriptdir scriptdir
6287 eval $prefixit
6288 case "$scriptdir" in
6289 '')
6290         dflt="$bin"
6291         : guess some guesses
6292         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6293         $test -d /usr/share/bin     && dflt=/usr/share/bin
6294         $test -d /usr/local/script  && dflt=/usr/local/script
6295         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6296         $test -d $prefixexp/script  && dflt=$prefixexp/script
6297         set dflt
6298         eval $prefixup
6299         ;;
6300 *)  dflt="$scriptdir"
6301         ;;
6302 esac
6303 $cat <<EOM
6304  
6305 Some installations have a separate directory just for executable scripts so
6306 that they can mount it across multiple architectures but keep the scripts in
6307 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6308 Or you might just lump your scripts in with all your other executables.
6309  
6310 EOM
6311 fn=d~
6312 rp='Where do you keep publicly executable scripts?'
6313 . ./getfile
6314 if $test "X$ansexp" != "X$scriptdirexp"; then
6315         installscript=''
6316 fi
6317 scriptdir="$ans"
6318 scriptdirexp="$ansexp"
6319 : Change installation prefix, if necessary.
6320 if $test X"$prefix" != X"$installprefix"; then
6321         installscript=`echo $scriptdirexp | sed 's#^$prefix#$installprefix#'`
6322 else
6323         installscript="$scriptdirexp"
6324 fi
6325
6326 $cat <<EOM
6327
6328 After $package is installed, you may wish to install various
6329 add-on modules and utilities.  Typically, these add-ons will
6330 be installed under $prefix with the rest
6331 of this package.  However, you may wish to install such add-ons
6332 elsewhere under a different prefix.
6333
6334 If you do not wish to put everything under a single prefix, that's
6335 ok.  You will be prompted for the individual locations; this siteprefix
6336 is only used to suggest the defaults.
6337
6338 The default should be fine for most people.
6339
6340 EOM
6341 fn=d~+
6342 rp='Installation prefix to use for add-on modules and utilities?'
6343 : XXX Here might be another good place for an installstyle setting.
6344 case "$siteprefix" in
6345 '') dflt=$prefix ;;
6346 *)  dflt=$siteprefix ;;
6347 esac
6348 . ./getfile
6349 oldsiteprefix=''
6350 case "$siteprefix" in
6351 '') ;;
6352 *)
6353         case "$ans" in
6354         "$prefix") ;;
6355         *) oldsiteprefix="$prefix";;
6356         esac
6357         ;;
6358 esac
6359 siteprefix="$ans"
6360 siteprefixexp="$ansexp"
6361
6362 : determine where site specific libraries go.
6363 : Usual default is /usr/local/lib/perl5/site_perl
6364 : The default "style" setting is made in installstyle.U
6365 : XXX No longer works with Prefixit stuff.
6366 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6367 case "$installstyle" in
6368 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6369 *)       dflt=$siteprefix/lib/site_$prog ;;
6370 esac
6371 $cat <<EOM
6372
6373 The installation process will create a directory for
6374 site-specific extensions and modules.  Most users find it convenient
6375 to place all site-specific files in this directory rather than in the
6376 main distribution directory.
6377
6378 EOM
6379 fn=d~+
6380 rp='Pathname for the site-specific library files?'
6381 . ./getfile
6382 sitelib="$ans"
6383 sitelibexp="$ansexp"
6384 : Change installation prefix, if necessary.
6385 if $test X"$prefix" != X"$installprefix"; then
6386         installsitelib=`echo $sitelibexp | sed 's#^$prefix#$installprefix#'`
6387 else
6388         installsitelib="$sitelibexp"
6389 fi
6390
6391 : determine where site specific architecture-dependent libraries go.
6392 : sitelib  default is /usr/local/lib/perl5/site_perl/
6393 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6394 : sitelib may have an optional trailing /share.
6395 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6396 tdflt="$tdflt/$apiversion/$archname"
6397 set sitearch sitearch none
6398 eval $prefixit
6399 case "$sitearch" in
6400 '')     dflt="$tdflt" ;;
6401 *)      dflt="$sitearch" ;;
6402 esac
6403 $cat <<EOM
6404
6405 The installation process will also create a directory for
6406 architecture-dependent site-specific extensions and modules.
6407
6408 EOM
6409 fn=nd~+
6410 rp='Pathname for the site-specific architecture-dependent library files?'
6411 . ./getfile
6412 sitearch="$ans"
6413 sitearchexp="$ansexp"
6414 : Change installation prefix, if necessary.
6415 if $test X"$prefix" != X"$installprefix"; then
6416         installsitearch=`echo $sitearchexp | sed 's#^$prefix#$installprefix#'`
6417 else
6418         installsitearch="$sitearchexp"
6419 fi
6420
6421 cat <<EOM
6422
6423 Perl can be built to take advantage of long doubles which
6424 (if available) may give more accuracy and range for floating point
6425 numbers.  To do so, Configure must be run with -Duselongdouble.
6426
6427 If this doesn't make any sense to you, just accept the default 'n'.
6428 EOM
6429 case "$uselongdouble" in
6430 $define|true|[yY]*)     dflt='y';;
6431 *) dflt='n';;
6432 esac
6433 rp='Try to use long doubles if available?'
6434 . ./myread
6435 case "$ans" in
6436 y|Y)    val="$define"   ;;
6437 *)      val="$undef"    ;;
6438 esac
6439 set uselongdouble
6440 eval $setvar
6441
6442 case "$uselongdouble" in
6443 "$define"|true|[yY]*)
6444 : Look for a hint-file generated 'call-back-unit'.  If the
6445 : user has specified that long doubles should be used,
6446 : we may need to set or change some other defaults.
6447         if $test -f uselongdouble.cbu; then
6448                 echo "Your platform has some specific hints for long doubles, using them..."
6449                 . ./uselongdouble.cbu
6450         else
6451                 $cat <<EOM
6452 (Your platform doesn't have any specific hints for long doubles.)
6453 EOM
6454         fi
6455         ;;
6456 esac
6457
6458 cat <<EOM
6459
6460 Previous version of $package used the standard IO mechanisms as defined
6461 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6462 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6463 the default.  This abstraction layer can use AT&T's sfio (if you already
6464 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6465 problems with some extension modules.  Using PerlIO with stdio is safe,
6466 but it is slower than plain stdio and therefore is not the default.
6467
6468 If this doesn't make any sense to you, just accept the default 'n'.
6469 EOM
6470 case "$useperlio" in
6471 $define|true|[yY]*)     dflt='y';;
6472 *) dflt='n';;
6473 esac
6474 rp='Use the experimental PerlIO abstraction layer?'
6475 . ./myread
6476 case "$ans" in
6477 y|Y) 
6478         val="$define"
6479         ;;     
6480 *)      
6481         echo "Ok, doing things the stdio way"
6482         val="$undef"
6483         ;;
6484 esac
6485 set useperlio
6486 eval $setvar 
6487
6488 : Check how to convert floats to strings.
6489 if test "X$d_Gconvert" = X; then
6490         echo " "
6491         echo "Checking for an efficient way to convert floats to strings."
6492         $cat >try.c <<'EOP'
6493 #ifdef TRY_gconvert
6494 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6495 char *myname = "gconvert";
6496 #endif
6497 #ifdef TRY_gcvt
6498 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6499 char *myname = "gcvt";
6500 #endif
6501 #ifdef TRY_sprintf
6502 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6503 char *myname = "sprintf";
6504 #endif
6505
6506 #include <stdio.h>
6507
6508 int
6509 checkit(expect, got)
6510 char *expect;
6511 char *got;
6512 {
6513     if (strcmp(expect, got)) {
6514                 printf("%s oddity:  Expected %s, got %s\n",
6515                         myname, expect, got);
6516                 exit(1);
6517         }
6518 }
6519
6520 int main()
6521
6522         char buf[64]; 
6523         buf[63] = '\0';
6524
6525         /* This must be 1st test on (which?) platform */
6526         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6527         Gconvert(0.1, 8, 0, buf);
6528         checkit("0.1", buf);
6529
6530         Gconvert(1.0, 8, 0, buf); 
6531         checkit("1", buf);
6532
6533         Gconvert(0.0, 8, 0, buf); 
6534         checkit("0", buf);
6535
6536         Gconvert(-1.0, 8, 0, buf); 
6537         checkit("-1", buf);
6538
6539         /* Some Linux gcvt's give 1.e+5 here. */
6540         Gconvert(100000.0, 8, 0, buf); 
6541         checkit("100000", buf);
6542         
6543         /* Some Linux gcvt's give -1.e+5 here. */
6544         Gconvert(-100000.0, 8, 0, buf); 
6545         checkit("-100000", buf);
6546
6547         exit(0);
6548 }
6549 EOP
6550         case "$d_Gconvert" in
6551         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6552         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6553         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6554         *) xxx_list='gconvert gcvt sprintf' ;;
6555         esac
6556
6557         for xxx_convert in $xxx_list; do
6558                 echo "Trying $xxx_convert"
6559                 $rm -f try try$_o
6560                 set try -DTRY_$xxx_convert
6561                 if eval $compile; then
6562                         echo "$xxx_convert" found. >&4
6563                         if ./try; then
6564                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6565                                 break;
6566                         else
6567                                 echo "...But $xxx_convert didn't work as I expected."
6568                         fi
6569                 else
6570                         echo "$xxx_convert NOT found." >&4
6571                 fi
6572         done
6573                 
6574         case "$xxx_convert" in
6575         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6576         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6577         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6578         esac
6579 fi
6580
6581 : see if inttypes.h is available
6582 : we want a real compile instead of Inhdr because some systems
6583 : have an inttypes.h which includes non-existent headers
6584 echo " "
6585 $cat >try.c <<EOCP
6586 #include <inttypes.h>
6587 int main() {
6588         static int32_t foo32 = 0x12345678;
6589 }
6590 EOCP
6591 set try
6592 if eval $compile; then
6593         echo "<inttypes.h> found." >&4
6594         val="$define"
6595 else
6596         echo "<inttypes.h> NOT found." >&4
6597         val="$undef"
6598 fi
6599 $rm -f try.c try
6600 set i_inttypes
6601 eval $setvar
6602
6603 : check for int64_t
6604 case "$use64bits" in
6605 "$define" )
6606         echo " "
6607         echo $n "Checking to see if your system supports int64_t...$c" >&4
6608         $cat >try.c <<EOCP
6609 #include <sys/types.h>
6610 #$i_inttypes I_INTTYPES
6611 #ifdef I_INTTYPES
6612 #include <inttypes.h>
6613 #endif
6614 int64_t foo() { int64_t x; x = 7; return x; }
6615 EOCP
6616         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6617                 val="$define"
6618                 echo " Yup, it does." >&4
6619         else
6620                 val="$undef"
6621                 echo " Nope, it doesn't." >&4
6622         fi
6623         $rm -f try.*
6624         ;;
6625 *)      val="$undef"
6626         ;;
6627 esac
6628 set d_int64t
6629 eval $setvar
6630
6631
6632 : check for lengths of integral types
6633 echo " "
6634 case "$intsize" in
6635 '')
6636         echo "Checking to see how big your integers are..." >&4
6637         $cat >intsize.c <<'EOCP'
6638 #include <stdio.h>
6639 int main()
6640 {
6641         printf("intsize=%d;\n", sizeof(int));
6642         printf("longsize=%d;\n", sizeof(long));
6643         printf("shortsize=%d;\n", sizeof(short));
6644         exit(0);
6645 }
6646 EOCP
6647         set intsize
6648         if eval $compile_ok && ./intsize > /dev/null; then
6649                 eval `./intsize`
6650                 echo "Your integers are $intsize bytes long."
6651                 echo "Your long integers are $longsize bytes long."
6652                 echo "Your short integers are $shortsize bytes long."
6653         else
6654                 $cat >&4 <<EOM
6655 !
6656 Help! I can't compile and run the intsize test program: please enlighten me!
6657 (This is probably a misconfiguration in your system or libraries, and
6658 you really ought to fix it.  Still, I'll try anyway.)
6659 !
6660 EOM
6661                 dflt=4
6662                 rp="What is the size of an integer (in bytes)?"
6663                 . ./myread
6664                 intsize="$ans"
6665                 dflt=$intsize
6666                 rp="What is the size of a long integer (in bytes)?"
6667                 . ./myread
6668                 longsize="$ans"
6669                 dflt=2
6670                 rp="What is the size of a short integer (in bytes)?"
6671                 . ./myread
6672                 shortsize="$ans"
6673         fi
6674         ;;
6675 esac
6676 $rm -f intsize intsize.*
6677
6678 : check for long long
6679 echo " "
6680 echo $n "Checking to see if your system supports long long...$c" >&4
6681 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6682 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6683         val="$define"
6684         echo " Yup, it does." >&4
6685 else
6686         val="$undef"
6687         echo " Nope, it doesn't." >&4
6688 fi
6689 $rm try.*
6690 set d_longlong
6691 eval $setvar
6692
6693 : check for length of long long
6694 case "${d_longlong}${longlongsize}" in
6695 $define)
6696         echo " "
6697         $echo $n "Checking to see how big your long longs are...$c" >&4
6698         $cat >try.c <<'EOCP'
6699 #include <stdio.h>
6700 int main()
6701 {
6702         printf("%d\n", sizeof(long long));
6703 }
6704 EOCP
6705         set try
6706         if eval $compile_ok; then
6707                 longlongsize=`./try`
6708                 $echo " $longlongsize bytes." >&4
6709         else
6710                 dflt='8'
6711                 echo " "
6712                 echo "(I can't seem to compile the test program.  Guessing...)"
6713                 rp="What is the size of a long long (in bytes)?"
6714                 . ./myread
6715                 longlongsize="$ans"
6716         fi
6717         if $test "X$longsize" = "X$longlongsize"; then
6718                 echo "(That isn't any different from an ordinary long.)"
6719         fi      
6720         ;;
6721 esac
6722 $rm -f try.c try
6723
6724 echo " "
6725
6726 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6727
6728 echo "Checking how to print 64-bit integers..." >&4
6729
6730 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6731         quad=int
6732         $cat >try.c <<'EOCP'
6733 #include <sys/types.h>
6734 #include <stdio.h>
6735 int main() {
6736   int q = 12345678901;
6737   printf("%ld\n", q);
6738 }
6739 EOCP
6740         set try
6741         if eval $compile; then
6742                 yyy=`./try$exe_ext`
6743                 case "$yyy" in
6744                 12345678901)
6745                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6746                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6747                         echo "We will use %d."
6748                         ;;
6749                 esac
6750         fi
6751 fi
6752
6753 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6754         quad=long
6755         $cat >try.c <<'EOCP'
6756 #include <sys/types.h>
6757 #include <stdio.h>
6758 int main() {
6759   long q = 12345678901;
6760   printf("%ld\n", q);
6761 }
6762 EOCP
6763         set try
6764         if eval $compile; then
6765                 yyy=`./try$exe_ext`
6766                 case "$yyy" in
6767                 12345678901)
6768                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6769                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6770                         echo "We will use %ld."
6771                         ;;
6772                 esac
6773         fi
6774 fi
6775
6776 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6777         quad=int64_t
6778         $cat >try.c <<'EOCP'
6779 #include <sys/types.h>
6780 #include <inttypes.h>
6781 #include <stdio.h>
6782 int main() {
6783   int64_t q = 12345678901;
6784   printf("%" PRId64 "\n", q);
6785 }
6786 EOCP
6787         set try
6788         if eval $compile; then
6789                 yyy=`./try$exe_ext`
6790                 case "$yyy" in
6791                 12345678901)
6792                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6793                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6794                         echo "We will use the C9X style."
6795                         ;;
6796                 esac
6797         fi
6798 fi
6799
6800 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6801         quad="long long"
6802         $cat >try.c <<'EOCP'
6803 #include <sys/types.h>
6804 #include <stdio.h>
6805 int main() {
6806   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6807   printf("%lld\n", q);
6808 }
6809 EOCP
6810         set try
6811         if eval $compile; then
6812                 yyy=`./try$exe_ext`
6813                 case "$yyy" in
6814                 12345678901)
6815                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6816                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6817                         echo "We will use the %lld style."
6818                         ;;
6819                 esac
6820         fi
6821 fi
6822
6823 if $test X"$sPRId64" = X -a X"$quad" != X; then
6824         $cat >try.c <<EOCP
6825 #include <sys/types.h>
6826 #include <stdio.h>
6827 int main() {
6828   $quad q = 12345678901;
6829   printf("%Ld\n", q);
6830 }
6831 EOCP
6832         set try
6833         if eval $compile; then
6834                 yyy=`./try$exe_ext`
6835                 case "$yyy" in
6836                 12345678901)
6837                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6838                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6839                         echo "We will use %lld."
6840                         ;;
6841                 esac
6842         fi
6843 fi
6844
6845 if $test X"$sPRId64" = X -a X"$quad" != X; then
6846         $cat >try.c <<EOCP
6847 #include <sys/types.h>
6848 #include <stdio.h>
6849 int main() {
6850   $quad q = 12345678901;
6851   printf("%qd\n", q);
6852 }
6853 EOCP
6854         set try
6855         if eval $compile; then
6856                 yyy=`./try$exe_ext`
6857                 case "$yyy" in
6858                 12345678901)
6859                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
6860                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
6861                         echo "We will use %qd."
6862                         ;;
6863                 esac
6864         fi
6865 fi
6866
6867 if $test X"$sPRId64" = X; then
6868         echo "Cannot figure out how to print 64-bit integers." >&4
6869 fi
6870
6871 $rm -f try try.*
6872
6873 fi # intsize -o longsize -o d_int64t -o d_longlong
6874
6875 case "$sPRId64" in
6876 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
6877         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
6878         ;;
6879 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
6880         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
6881         ;;
6882 esac
6883
6884 : check for length of double
6885 echo " "
6886 case "$doublesize" in
6887 '')
6888         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
6889         $cat >try.c <<'EOCP'
6890 #include <stdio.h>
6891 int main()
6892 {
6893         printf("%d\n", sizeof(double));
6894 }
6895 EOCP
6896         set try
6897         if eval $compile_ok; then
6898                 doublesize=`./try`
6899                 $echo " $doublesize bytes." >&4
6900         else
6901                 dflt='8'
6902                 echo "(I can't seem to compile the test program.  Guessing...)"
6903                 rp="What is the size of a double precision number (in bytes)?"
6904                 . ./myread
6905                 doublesize="$ans"
6906         fi
6907         ;;
6908 esac
6909 $rm -f try.c try
6910
6911 : check for long doubles
6912 echo " "
6913 echo $n "Checking to see if your system supports long double...$c" >&4
6914 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
6915 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6916         val="$define"
6917         echo " Yup, it does." >&4
6918 else
6919         val="$undef"
6920         echo " Nope, it doesn't." >&4
6921 fi
6922 $rm try.*
6923 set d_longdbl
6924 eval $setvar
6925
6926 : check for length of long double
6927 case "${d_longdbl}${longdblsize}" in
6928 $define)
6929         echo " "
6930         $echo $n "Checking to see how big your long doubles are...$c" >&4
6931         $cat >try.c <<'EOCP'
6932 #include <stdio.h>
6933 int main()
6934 {
6935         printf("%d\n", sizeof(long double));
6936 }
6937 EOCP
6938         set try
6939         if eval $compile; then
6940                 longdblsize=`./try`
6941                 $echo " $longdblsize bytes." >&4
6942         else
6943                 dflt='8'
6944                 echo " "
6945                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6946                 rp="What is the size of a long double (in bytes)?"
6947                 . ./myread
6948                 longdblsize="$ans"
6949         fi
6950         if $test "X$doublesize" = "X$longdblsize"; then
6951                 echo "(That isn't any different from an ordinary double.)"
6952         fi      
6953         ;;
6954 esac
6955 $rm -f try.c try
6956
6957 echo " "
6958
6959 if $test X"$d_longdbl" = X"$define"; then
6960
6961 echo "Checking how to print long doubles..." >&4
6962
6963 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6964         $cat >try.c <<'EOCP'
6965 #include <sys/types.h>
6966 #include <stdio.h>
6967 int main() {
6968   double d = 123.456;
6969   printf("%.3f\n", d);
6970 }
6971 EOCP
6972         set try
6973         if eval $compile; then
6974                 yyy=`./try$exe_ext`
6975                 case "$yyy" in
6976                 123.456)
6977                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6978                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
6979                         echo "We will use %f."
6980                         ;;
6981                 esac
6982         fi
6983 fi
6984
6985 if $test X"$sPRIfldbl" = X; then
6986         $cat >try.c <<'EOCP'
6987 #include <sys/types.h>
6988 #include <stdio.h>
6989 int main() {
6990   long double d = 123.456;
6991   printf("%.3llf\n", d);
6992 }
6993 EOCP
6994         set try
6995         if eval $compile; then
6996                 yyy=`./try$exe_ext`
6997                 case "$yyy" in
6998                 123.456)
6999                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7000                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7001                         echo "We will use %llf."
7002                         ;;
7003                 esac
7004         fi
7005 fi
7006
7007 if $test X"$sPRIfldbl" = X; then
7008         $cat >try.c <<'EOCP'
7009 #include <sys/types.h>
7010 #include <stdio.h>
7011 int main() {
7012   long double d = 123.456;
7013   printf("%.3Lf\n", d);
7014 }
7015 EOCP
7016         set try
7017         if eval $compile; then
7018                 yyy=`./try$exe_ext`
7019                 case "$yyy" in
7020                 123.456)
7021                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7022                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7023                         echo "We will use %Lf."
7024                         ;;
7025                 esac
7026         fi
7027 fi
7028
7029 if $test X"$sPRIfldbl" = X; then
7030         $cat >try.c <<'EOCP'
7031 #include <sys/types.h>
7032 #include <stdio.h>
7033 int main() {
7034   long double d = 123.456;
7035   printf("%.3lf\n", d);
7036 }
7037 EOCP
7038         set try
7039         if eval $compile; then
7040                 yyy=`./try$exe_ext`
7041                 case "$yyy" in
7042                 123.456)
7043                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7044                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7045                         echo "We will use %lf."
7046                         ;;
7047                 esac
7048         fi
7049 fi
7050
7051 if $test X"$sPRIfldbl" = X; then
7052         echo "Cannot figure out how to print long doubles." >&4
7053 fi
7054
7055 $rm -f try try.*
7056
7057 fi # d_longdbl
7058
7059 case "$sPRIfldbl" in
7060 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7061         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7062         ;;
7063 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7064         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7065         ;;
7066 esac
7067
7068 : Initialize h_fcntl
7069 h_fcntl=false
7070
7071 : Initialize h_sysfile
7072 h_sysfile=false
7073
7074 : access call always available on UNIX
7075 set access d_access
7076 eval $inlibc
7077
7078 : locate the flags for 'access()'
7079 case "$d_access" in
7080 "$define")
7081         echo " "
7082         $cat >access.c <<'EOCP'
7083 #include <sys/types.h>
7084 #ifdef I_FCNTL
7085 #include <fcntl.h>
7086 #endif
7087 #ifdef I_SYS_FILE
7088 #include <sys/file.h>
7089 #endif
7090 #ifdef I_UNISTD
7091 #include <unistd.h>
7092 #endif
7093 int main() {
7094         exit(R_OK);
7095 }
7096 EOCP
7097         : check sys/file.h first, no particular reason here
7098         if $test `./findhdr sys/file.h` && \
7099                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7100                 h_sysfile=true;
7101                 echo "<sys/file.h> defines the *_OK access constants." >&4
7102         elif $test `./findhdr fcntl.h` && \
7103                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7104                 h_fcntl=true;
7105                 echo "<fcntl.h> defines the *_OK access constants." >&4
7106         elif $test `./findhdr unistd.h` && \
7107                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7108                 echo "<unistd.h> defines the *_OK access constants." >&4
7109         else
7110                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7111         fi
7112         ;;
7113 esac
7114 $rm -f access*
7115
7116 : see if accessx exists
7117 set accessx d_accessx
7118 eval $inlibc
7119
7120 : see if alarm exists
7121 set alarm d_alarm
7122 eval $inlibc
7123
7124 : see if atolf exists
7125 set atolf d_atolf
7126 eval $inlibc
7127
7128 : see if atoll exists
7129 set atoll d_atoll
7130 eval $inlibc
7131
7132 : Look for GNU-cc style attribute checking
7133 echo " "
7134 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7135 $cat >attrib.c <<'EOCP'
7136 #include <stdio.h>
7137 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7138 EOCP
7139 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7140         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7141                 echo "Your C compiler doesn't fully support __attribute__."
7142                 val="$undef"
7143         else
7144                 echo "Your C compiler supports __attribute__."
7145                 val="$define"
7146         fi
7147 else
7148         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7149         val="$undef"
7150 fi
7151 set d_attribut
7152 eval $setvar
7153 $rm -f attrib*
7154
7155 : see if bcmp exists
7156 set bcmp d_bcmp
7157 eval $inlibc
7158
7159 : see if bcopy exists
7160 set bcopy d_bcopy
7161 eval $inlibc
7162
7163 : see if this is a unistd.h system
7164 set unistd.h i_unistd
7165 eval $inhdr
7166
7167 : see if getpgrp exists
7168 set getpgrp d_getpgrp
7169 eval $inlibc
7170
7171 case "$d_getpgrp" in
7172 "$define")
7173         echo " "
7174         echo "Checking to see which flavor of getpgrp is in use..."
7175         $cat >set.c <<EOP
7176 #$i_unistd I_UNISTD
7177 #include <sys/types.h>
7178 #ifdef I_UNISTD
7179 #  include <unistd.h>
7180 #endif
7181 int main()
7182 {
7183         if (getuid() == 0) {
7184                 printf("(I see you are running Configure as super-user...)\n");
7185                 setuid(1);
7186         }
7187 #ifdef TRY_BSD_PGRP
7188         if (getpgrp(1) == 0)
7189                 exit(0);
7190 #else
7191         if (getpgrp() > 0)
7192                 exit(0);
7193 #endif
7194         exit(1);
7195 }
7196 EOP
7197         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7198                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7199                 val="$define"
7200         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7201                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7202                 val="$undef"
7203         else
7204                 echo "I can't seem to compile and run the test program."
7205                 if ./usg; then
7206                         xxx="a USG one, i.e. you use getpgrp()."
7207                 else
7208                         # SVR4 systems can appear rather BSD-ish.
7209                         case "$i_unistd" in
7210                         $undef)
7211                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7212                                 val="$define"
7213                                 ;;
7214                         $define)
7215                                 xxx="probably a USG one, i.e. you use getpgrp()."
7216                                 val="$undef"
7217                                 ;;
7218                         esac
7219                 fi
7220                 echo "Assuming your getpgrp is $xxx" >&4
7221         fi
7222         ;;
7223 *) val="$undef";;
7224 esac
7225 set d_bsdgetpgrp
7226 eval $setvar
7227 $rm -f set set.c
7228
7229 : see if setpgrp exists
7230 set setpgrp d_setpgrp
7231 eval $inlibc
7232
7233 case "$d_setpgrp" in
7234 "$define")
7235         echo " "
7236         echo "Checking to see which flavor of setpgrp is in use..."
7237         $cat >set.c <<EOP
7238 #$i_unistd I_UNISTD
7239 #include <sys/types.h>
7240 #ifdef I_UNISTD
7241 #  include <unistd.h>
7242 #endif
7243 int main()
7244 {
7245         if (getuid() == 0) {
7246                 printf("(I see you are running Configure as super-user...)\n");
7247                 setuid(1);
7248         }
7249 #ifdef TRY_BSD_PGRP
7250         if (-1 == setpgrp(1, 1))
7251                 exit(0);
7252 #else
7253         if (setpgrp() != -1)
7254                 exit(0);
7255 #endif
7256         exit(1);
7257 }
7258 EOP
7259         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7260                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7261                 val="$define"
7262         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7263                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7264                 val="$undef"
7265         else
7266                 echo "(I can't seem to compile and run the test program.)"
7267                 if ./usg; then
7268                         xxx="a USG one, i.e. you use setpgrp()."
7269                 else
7270                         # SVR4 systems can appear rather BSD-ish.
7271                         case "$i_unistd" in
7272                         $undef)
7273                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7274                                 val="$define"
7275                                 ;;
7276                         $define)
7277                                 xxx="probably a USG one, i.e. you use setpgrp()."
7278                                 val="$undef"
7279                                 ;;
7280                         esac
7281                 fi
7282                 echo "Assuming your setpgrp is $xxx" >&4
7283         fi
7284         ;;
7285 *) val="$undef";;
7286 esac
7287 set d_bsdsetpgrp
7288 eval $setvar
7289 $rm -f set set.c
7290 : see if bzero exists
7291 set bzero d_bzero
7292 eval $inlibc
7293
7294 : see if signal is declared as pointer to function returning int or void
7295 echo " "
7296 xxx=`./findhdr signal.h`
7297 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7298 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7299         echo "You have int (*signal())() instead of void." >&4
7300         val="$undef"
7301 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7302         echo "You have void (*signal())()." >&4
7303         val="$define"
7304 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7305         echo "You have int (*signal())() instead of void." >&4
7306         val="$undef"
7307 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7308         echo "You have void (*signal())()." >&4
7309         val="$define"
7310 else
7311         case "$d_voidsig" in
7312         '')
7313         echo "I can't determine whether signal handler returns void or int..." >&4
7314                 dflt=void
7315                 rp="What type does your signal handler return?"
7316                 . ./myread
7317                 case "$ans" in
7318                 v*) val="$define";;
7319                 *) val="$undef";;
7320                 esac;;
7321         "$define")
7322                 echo "As you already told me, signal handler returns void." >&4
7323                 val="$define"
7324                 ;;
7325         *)      echo "As you already told me, signal handler returns int." >&4
7326                 val="$undef"
7327                 ;;
7328         esac
7329 fi
7330 set d_voidsig
7331 eval $setvar
7332 case "$d_voidsig" in
7333 "$define") signal_t="void";;
7334 *) signal_t="int";;
7335 esac
7336 $rm -f $$.tmp
7337
7338 : check for ability to cast large floats to 32-bit ints.
7339 echo " "
7340 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7341 if $test "$intsize" -ge 4; then
7342         xxx=int
7343 else
7344         xxx=long
7345 fi
7346 $cat >try.c <<EOCP
7347 #include <stdio.h>
7348 #include <sys/types.h>
7349 #include <signal.h>
7350 $signal_t blech(s) int s; { exit(3); }
7351 int main()
7352 {
7353         $xxx i32;
7354         double f, g;
7355         int result = 0;
7356         char str[16];
7357         signal(SIGFPE, blech);
7358
7359         /* Don't let compiler optimize the test away.  Store the number 
7360            in a writable string for gcc to pass to sscanf under HP/UX.
7361         */
7362         sprintf(str, "2147483647");
7363         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7364         g = 10 * f;
7365         i32  = ($xxx) g;
7366
7367         /* x86 processors will probably give 0x8000 0000, which is a
7368        sign change.  We don't want that.  We want to mimic SPARC
7369            behavior here, which is to preserve the sign and give
7370            back 0x7fff ffff.
7371         */
7372         if (i32 != ($xxx) f)
7373                 result |= 1;
7374         exit(result);
7375 }
7376 EOCP
7377 set try
7378 if eval $compile_ok; then
7379         ./try
7380         yyy=$?
7381 else
7382         echo "(I can't seem to compile the test program--assuming it can't)"
7383         yyy=1
7384 fi
7385 case "$yyy" in
7386 0)      val="$define"
7387         echo "Yup, it can."
7388         ;;
7389 *)      val="$undef"
7390         echo "Nope, it can't."
7391         ;;
7392 esac
7393 set d_casti32
7394 eval $setvar
7395 $rm -f try try.*
7396
7397 : check for ability to cast negative floats to unsigned
7398 echo " "
7399 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7400 $cat >try.c <<EOCP
7401 #include <stdio.h>
7402 #include <sys/types.h>
7403 #include <signal.h>
7404 $signal_t blech(s) int s; { exit(7); }
7405 $signal_t blech_in_list(s) int s; { exit(4); }
7406 unsigned long dummy_long(p) unsigned long p; { return p; }
7407 unsigned int dummy_int(p) unsigned int p; { return p; }
7408 unsigned short dummy_short(p) unsigned short p; { return p; }
7409 int main()
7410 {
7411         double f;
7412         unsigned long along;
7413         unsigned int aint;
7414         unsigned short ashort;
7415         int result = 0;
7416         char str[16];
7417         
7418         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7419            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7420            optimized the whole file away
7421         */
7422         /* Store the number in a writable string for gcc to pass to 
7423            sscanf under HP/UX.
7424         */
7425         sprintf(str, "-123");
7426         sscanf(str, "%lf", &f);  /* f = -123.; */
7427
7428         signal(SIGFPE, blech);
7429         along = (unsigned long)f;
7430         aint = (unsigned int)f;
7431         ashort = (unsigned short)f;
7432         if (along != (unsigned long)-123)
7433                 result |= 1;
7434         if (aint != (unsigned int)-123)
7435                 result |= 1;
7436         if (ashort != (unsigned short)-123)
7437                 result |= 1;
7438         sprintf(str, "1073741824.");
7439         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7440         f = f + f;
7441         along = 0;
7442         along = (unsigned long)f;
7443         if (along != 0x80000000)
7444                 result |= 2;
7445         f -= 1.;
7446         along = 0;
7447         along = (unsigned long)f;
7448         if (along != 0x7fffffff)
7449                 result |= 1;
7450         f += 2.;
7451         along = 0;
7452         along = (unsigned long)f;
7453         if (along != 0x80000001)
7454                 result |= 2;
7455         if (result)
7456                 exit(result);
7457         signal(SIGFPE, blech_in_list);
7458         sprintf(str, "123.");
7459         sscanf(str, "%lf", &f);  /* f = 123.; */
7460         along = dummy_long((unsigned long)f);
7461         aint = dummy_int((unsigned int)f);
7462         ashort = dummy_short((unsigned short)f);
7463         if (along != (unsigned long)123)
7464                 result |= 4;
7465         if (aint != (unsigned int)123)
7466                 result |= 4;
7467         if (ashort != (unsigned short)123)
7468                 result |= 4;
7469         exit(result);
7470
7471 }
7472 EOCP
7473 set try
7474 if eval $compile_ok; then
7475         ./try
7476         castflags=$?
7477 else
7478         echo "(I can't seem to compile the test program--assuming it can't)"
7479         castflags=7
7480 fi
7481 case "$castflags" in
7482 0)      val="$define"
7483         echo "Yup, it can."
7484         ;;
7485 *)      val="$undef"
7486         echo "Nope, it can't."
7487         ;;
7488 esac
7489 set d_castneg
7490 eval $setvar
7491 $rm -f try.*
7492
7493 : see if vprintf exists
7494 echo " "
7495 if set vprintf val -f d_vprintf; eval $csym; $val; then
7496         echo 'vprintf() found.' >&4
7497         val="$define"
7498         $cat >vprintf.c <<'EOF'
7499 #include <varargs.h>
7500
7501 int main() { xxx("foo"); }
7502
7503 xxx(va_alist)
7504 va_dcl
7505 {
7506         va_list args;
7507         char buf[10];
7508
7509         va_start(args);
7510         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7511 }
7512 EOF
7513         set vprintf
7514         if eval $compile && ./vprintf; then
7515                 echo "Your vsprintf() returns (int)." >&4
7516                 val2="$undef"
7517         else
7518                 echo "Your vsprintf() returns (char*)." >&4
7519                 val2="$define"
7520         fi
7521 else
7522         echo 'vprintf() NOT found.' >&4
7523                 val="$undef"
7524                 val2="$undef"
7525 fi
7526 set d_vprintf
7527 eval $setvar
7528 val=$val2
7529 set d_charvspr
7530 eval $setvar
7531
7532 : see if chown exists
7533 set chown d_chown
7534 eval $inlibc
7535
7536 : see if chroot exists
7537 set chroot d_chroot
7538 eval $inlibc
7539
7540 : see if chsize exists
7541 set chsize d_chsize
7542 eval $inlibc
7543
7544 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7545 while $test $# -ge 2; do
7546         case "$1" in
7547         $define) echo "#include <$2>";;
7548         esac ;
7549     shift 2;
7550 done > try.c;
7551 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
7552 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7553         val="$define";
7554 else
7555         val="$undef";
7556 fi;
7557 set $varname;
7558 eval $setvar;
7559 $rm -f try.c try.o'
7560
7561 : see if this is a sys/uio.h system
7562 set sys/uio.h i_sysuio
7563 eval $inhdr
7564
7565 echo "Checking to see if your system supports struct iovec..." >&4
7566 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7567 eval $hasfield
7568 case "$d_iovec_s" in
7569 "$define")      echo "Yup, it does." >&4
7570                 ;;
7571 *)              echo "Nope, it doesn't." >&4
7572                 ;;
7573 esac
7574
7575 socketlib=''
7576 sockethdr=''
7577 : see whether socket exists
7578 echo " "
7579 $echo $n "Hmm... $c" >&4
7580 if set socket val -f d_socket; eval $csym; $val; then
7581         echo "Looks like you have Berkeley networking support." >&4
7582         d_socket="$define"
7583         if set setsockopt val -f; eval $csym; $val; then
7584                 d_oldsock="$undef"
7585         else
7586                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7587                 d_oldsock="$define"
7588         fi
7589 else
7590         if $contains socklib libc.list >/dev/null 2>&1; then
7591                 echo "Looks like you have Berkeley networking support." >&4
7592                 d_socket="$define"
7593                 : we will have to assume that it supports the 4.2 BSD interface
7594                 d_oldsock="$undef"
7595         else
7596                 echo "You don't have Berkeley networking in libc$_a..." >&4
7597                 if test "X$d_socket" = "X$define"; then
7598                    echo "...but you seem to believe that you have sockets." >&4
7599                 else
7600                         for net in net socket
7601                         do
7602                                 if test -f /usr/lib/lib$net$_a; then
7603                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7604                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7605                                         if $contains socket libc.list >/dev/null 2>&1; then
7606                                                 d_socket="$define"
7607                                                 socketlib="-l$net"
7608                                                 case "$net" in
7609                                                 net)
7610                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7611                                                         sockethdr="-I/usr/netinclude"
7612                                                         ;;
7613                                                 esac
7614                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7615                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7616                                                         d_oldsock="$undef"
7617                                                 else
7618                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7619                                                         d_oldsock="$define"
7620                                                 fi
7621                                                 break
7622                                         fi
7623                                 fi
7624                         done
7625                         if test "X$d_socket" != "X$define"; then
7626                            echo "or anywhere else I see." >&4
7627                            d_socket="$undef"
7628                            d_oldsock="$undef"
7629                         fi
7630                 fi
7631         fi
7632 fi
7633
7634 : see if socketpair exists
7635 set socketpair d_sockpair
7636 eval $inlibc
7637
7638
7639 echo " "
7640 echo "Checking the availability of certain socket constants..." >& 4
7641 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7642         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7643         $cat >try.c <<EOF
7644 #include <sys/types.h>
7645 #include <sys/socket.h>
7646 int main() {
7647     int i = $ENUM;
7648 }
7649 EOF
7650         val="$undef"
7651         set try; if eval $compile; then
7652                 val="$define"
7653         fi
7654         set d_${enum}; eval $setvar
7655         $rm -f try.c try
7656 done
7657
7658 set sendmsg d_sendmsg
7659 eval $inlibc
7660
7661 set recvmsg d_recvmsg
7662 eval $inlibc
7663
7664 echo " "
7665 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7666 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7667 eval $hasfield
7668 case "$d_msghdr_s" in
7669 "$define")      echo "Yup, it does." >&4
7670                 ;;
7671 *)              echo "Nope, it doesn't." >&4
7672                 ;;
7673 esac
7674
7675 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7676 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7677 eval $hasfield
7678 case "$d_cmsghdr_s" in
7679 "$define")      echo "Yup, it does." >&4
7680                 ;;
7681 *)              echo "Nope, it doesn't." >&4
7682                 ;;
7683 esac
7684
7685 : check for const keyword
7686 echo " "
7687 echo 'Checking to see if your C compiler knows about "const"...' >&4
7688 $cat >const.c <<'EOCP'
7689 typedef struct spug { int drokk; } spug;
7690 int main()
7691 {
7692         const char *foo;
7693         const spug y;
7694 }
7695 EOCP
7696 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7697         val="$define"
7698         echo "Yup, it does."
7699 else
7700         val="$undef"
7701         echo "Nope, it doesn't."
7702 fi
7703 set d_const
7704 eval $setvar
7705
7706 : see if crypt exists
7707 echo " "
7708 if set crypt val -f d_crypt; eval $csym; $val; then
7709         echo 'crypt() found.' >&4
7710         val="$define"
7711         cryptlib=''
7712 else
7713         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7714         if $test -z "$cryptlib"; then
7715                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7716         else
7717                 cryptlib=-lcrypt
7718         fi
7719         if $test -z "$cryptlib"; then
7720                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7721         else
7722                 cryptlib=-lcrypt
7723         fi
7724         if $test -z "$cryptlib"; then
7725                 cryptlib=`./loc libcrypt$_a "" $libpth`
7726         else
7727                 cryptlib=-lcrypt
7728         fi
7729         if $test -z "$cryptlib"; then
7730                 echo 'crypt() NOT found.' >&4
7731                 val="$undef"
7732         else
7733                 val="$define"
7734         fi
7735 fi
7736 set d_crypt
7737 eval $setvar
7738
7739 : get csh whereabouts
7740 case "$csh" in
7741 'csh') val="$undef" ;;
7742 *) val="$define" ;;
7743 esac
7744 set d_csh
7745 eval $setvar
7746 : Respect a hint or command line value for full_csh.
7747 case "$full_csh" in
7748 '') full_csh=$csh ;;
7749 esac
7750
7751 : see if cuserid exists
7752 set cuserid d_cuserid
7753 eval $inlibc
7754
7755 : see if this is a limits.h system
7756 set limits.h i_limits
7757 eval $inhdr
7758
7759 : see if this is a float.h system
7760 set float.h i_float
7761 eval $inhdr
7762
7763 : See if number of significant digits in a double precision number is known
7764 echo " "
7765 $cat >dbl_dig.c <<EOM
7766 #$i_limits I_LIMITS
7767 #$i_float I_FLOAT
7768 #ifdef I_LIMITS
7769 #include <limits.h>
7770 #endif
7771 #ifdef I_FLOAT
7772 #include <float.h>
7773 #endif
7774 #ifdef DBL_DIG
7775 printf("Contains DBL_DIG");
7776 #endif
7777 EOM
7778 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7779 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7780         echo "DBL_DIG found." >&4
7781         val="$define"
7782 else
7783         echo "DBL_DIG NOT found." >&4
7784         val="$undef"
7785 fi
7786 $rm -f dbl_dig.?
7787 set d_dbl_dig
7788 eval $setvar
7789
7790 : see if difftime exists
7791 set difftime d_difftime
7792 eval $inlibc
7793
7794 : see if this is a dirent system
7795 echo " "
7796 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7797         val="$define"
7798         echo "<dirent.h> found." >&4
7799 else
7800         val="$undef"
7801         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7802                 echo "<sys/dir.h> found." >&4
7803                 echo " "
7804         else
7805                 xinc=`./findhdr sys/ndir.h`
7806         fi
7807         echo "<dirent.h> NOT found." >&4
7808 fi
7809 set i_dirent
7810 eval $setvar
7811
7812 : Look for type of directory structure.
7813 echo " "
7814 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7815
7816 case "$direntrytype" in
7817 ''|' ')
7818         case "$i_dirent" in
7819         $define) guess1='struct dirent' ;;
7820         *) guess1='struct direct'  ;;
7821         esac
7822         ;;
7823 *)      guess1="$direntrytype"
7824         ;;
7825 esac
7826
7827 case "$guess1" in
7828 'struct dirent') guess2='struct direct' ;;
7829 *) guess2='struct dirent' ;;
7830 esac
7831                 
7832 if $contains "$guess1" try.c >/dev/null 2>&1; then
7833         direntrytype="$guess1"
7834         echo "Your directory entries are $direntrytype." >&4
7835 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7836         direntrytype="$guess2"
7837         echo "Your directory entries seem to be $direntrytype." >&4
7838 else
7839         echo "I don't recognize your system's directory entries." >&4
7840         rp="What type is used for directory entries on this system?"
7841         dflt="$guess1"
7842         . ./myread
7843         direntrytype="$ans"
7844 fi
7845 $rm -f try.c
7846
7847
7848 : see if the directory entry stores field length
7849 echo " "
7850 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7851 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7852         echo "Good, your directory entry keeps length information in d_namlen." >&4
7853         val="$define"
7854 else
7855         echo "Your directory entry does not know about the d_namlen field." >&4
7856         val="$undef"
7857 fi
7858 set d_dirnamlen
7859 eval $setvar
7860 $rm -f try.c
7861
7862 : see if dlerror exists
7863 xxx_runnm="$runnm"
7864 runnm=false
7865 set dlerror d_dlerror
7866 eval $inlibc
7867 runnm="$xxx_runnm"
7868
7869 : see if dlfcn is available
7870 set dlfcn.h i_dlfcn
7871 eval $inhdr
7872
7873 case "$usedl" in
7874 $define|y|true)
7875         $cat << EOM
7876
7877 On a few systems, the dynamically loaded modules that perl generates and uses
7878 will need a different extension than shared libs. The default will probably
7879 be appropriate.
7880
7881 EOM
7882         case "$dlext" in
7883         '')     dflt="$so" ;;
7884         *)      dflt="$dlext" ;;
7885         esac
7886         rp='What is the extension of dynamically loaded modules'
7887         . ./myread
7888         dlext="$ans"
7889         ;;
7890 *)
7891         dlext="none"
7892         ;;
7893 esac
7894
7895 : Check if dlsym need a leading underscore
7896 echo " "
7897 val="$undef"
7898
7899 case "$dlsrc" in
7900 dl_dlopen.xs)
7901         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
7902         $cat >dyna.c <<'EOM'
7903 fred () { }
7904 EOM
7905
7906 $cat >fred.c<<EOM
7907
7908 #include <stdio.h>
7909 #$i_dlfcn I_DLFCN
7910 #ifdef I_DLFCN
7911 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
7912 #else
7913 #include <sys/types.h>
7914 #include <nlist.h>
7915 #include <link.h>
7916 #endif
7917
7918 extern int fred() ;
7919
7920 int main()
7921 {
7922     void * handle ;
7923     void * symbol ;
7924 #ifndef RTLD_LAZY
7925     int mode = 1 ;
7926 #else
7927     int mode = RTLD_LAZY ;
7928 #endif
7929     handle = dlopen("./dyna.$dlext", mode) ;
7930     if (handle == NULL) {
7931         printf ("1\n") ;
7932         fflush (stdout) ;
7933         exit(0);
7934     }
7935     symbol = dlsym(handle, "fred") ;
7936     if (symbol == NULL) {
7937         /* try putting a leading underscore */
7938         symbol = dlsym(handle, "_fred") ;
7939         if (symbol == NULL) {
7940             printf ("2\n") ;
7941             fflush (stdout) ;
7942             exit(0);
7943         }
7944         printf ("3\n") ;
7945     }
7946     else
7947         printf ("4\n") ;
7948     fflush (stdout) ;
7949     exit(0);
7950 }
7951 EOM
7952         : Call the object file tmp-dyna.o in case dlext=o.
7953         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
7954                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
7955                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
7956                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
7957                 xxx=`./fred`
7958                 case $xxx in
7959                 1)      echo "Test program failed using dlopen." >&4
7960                         echo "Perhaps you should not use dynamic loading." >&4;;
7961                 2)      echo "Test program failed using dlsym." >&4
7962                         echo "Perhaps you should not use dynamic loading." >&4;;
7963                 3)      echo "dlsym needs a leading underscore" >&4
7964                         val="$define" ;;
7965                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
7966                 esac
7967         else
7968                 echo "I can't compile and run the test program." >&4
7969                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
7970         fi
7971         ;;
7972 esac
7973                 
7974 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
7975
7976 set d_dlsymun
7977 eval $setvar
7978
7979 hasproto='varname=$1; func=$2; shift; shift;
7980 while $test $# -ge 2; do
7981         case "$1" in
7982         $define) echo "#include <$2>";;
7983         esac ;
7984     shift 2;
7985 done > try.c;
7986 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
7987 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
7988         echo "$func() prototype found.";
7989         val="$define";
7990 else
7991         echo "$func() prototype NOT found.";
7992         val="$undef";
7993 fi;
7994 set $varname;
7995 eval $setvar;
7996 $rm -f try.c tryout.c'
7997
7998 : see if prototype for drand48 is available
7999 echo " "
8000 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8001 eval $hasproto
8002
8003 : see if dup2 exists
8004 set dup2 d_dup2
8005 eval $inlibc
8006
8007 : see if eaccess exists
8008 set eaccess d_eaccess
8009 eval $inlibc
8010
8011 : see if endgrent exists
8012 set endgrent d_endgrent
8013 eval $inlibc
8014
8015 : see if endhostent exists
8016 set endhostent d_endhent
8017 eval $inlibc
8018
8019 : see if endnetent exists
8020 set endnetent d_endnent
8021 eval $inlibc
8022
8023 : see if endprotoent exists
8024 set endprotoent d_endpent
8025 eval $inlibc
8026
8027 : see if endpwent exists
8028 set endpwent d_endpwent
8029 eval $inlibc
8030
8031 : see if endservent exists
8032 set endservent d_endsent
8033 eval $inlibc
8034
8035 : see if endspent exists
8036 set endspent d_endspent
8037 eval $inlibc
8038
8039 : Locate the flags for 'open()'
8040 echo " "
8041 $cat >open3.c <<'EOCP'
8042 #include <sys/types.h>
8043 #ifdef I_FCNTL
8044 #include <fcntl.h>
8045 #endif
8046 #ifdef I_SYS_FILE
8047 #include <sys/file.h>
8048 #endif
8049 int main() {
8050         if(O_RDONLY);
8051 #ifdef O_TRUNC
8052         exit(0);
8053 #else
8054         exit(1);
8055 #endif
8056 }
8057 EOCP
8058 : check sys/file.h first to get FREAD on Sun
8059 if $test `./findhdr sys/file.h` && \
8060                 set open3 -DI_SYS_FILE && eval $compile; then
8061         h_sysfile=true;
8062         echo "<sys/file.h> defines the O_* constants..." >&4
8063         if ./open3; then
8064                 echo "and you have the 3 argument form of open()." >&4
8065                 val="$define"
8066         else
8067                 echo "but not the 3 argument form of open().  Oh, well." >&4
8068                 val="$undef"
8069         fi
8070 elif $test `./findhdr fcntl.h` && \
8071                 set open3 -DI_FCNTL && eval $compile; then
8072         h_fcntl=true;
8073         echo "<fcntl.h> defines the O_* constants..." >&4
8074         if ./open3; then
8075                 echo "and you have the 3 argument form of open()." >&4
8076                 val="$define"
8077         else
8078                 echo "but not the 3 argument form of open().  Oh, well." >&4
8079                 val="$undef"
8080         fi
8081 else
8082         val="$undef"
8083         echo "I can't find the O_* constant definitions!  You got problems." >&4
8084 fi
8085 set d_open3
8086 eval $setvar
8087 $rm -f open3*
8088
8089 : check for non-blocking I/O stuff
8090 case "$h_sysfile" in
8091 true) echo "#include <sys/file.h>" > head.c;;
8092 *)
8093         case "$h_fcntl" in
8094         true) echo "#include <fcntl.h>" > head.c;;
8095         *) echo "#include <sys/fcntl.h>" > head.c;;
8096         esac
8097         ;;
8098 esac
8099 echo " "
8100 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8101 case "$o_nonblock" in
8102 '')
8103         $cat head.c > try.c
8104         $cat >>try.c <<'EOCP'
8105 int main() {
8106 #ifdef O_NONBLOCK
8107         printf("O_NONBLOCK\n");
8108         exit(0);
8109 #endif
8110 #ifdef O_NDELAY
8111         printf("O_NDELAY\n");
8112         exit(0);
8113 #endif
8114 #ifdef FNDELAY
8115         printf("FNDELAY\n");
8116         exit(0);
8117 #endif
8118         exit(0);
8119 }
8120 EOCP
8121         set try
8122         if eval $compile_ok; then
8123                 o_nonblock=`./try`
8124                 case "$o_nonblock" in
8125                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8126                 *) echo "Seems like we can use $o_nonblock.";;
8127                 esac
8128         else
8129                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8130         fi
8131         ;;
8132 *) echo "Using $hint value $o_nonblock.";;
8133 esac
8134 $rm -f try try.* .out core
8135
8136 echo " "
8137 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8138 case "$eagain" in
8139 '')
8140         $cat head.c > try.c
8141         $cat >>try.c <<EOCP
8142 #include <errno.h>
8143 #include <sys/types.h>
8144 #include <signal.h>
8145 #define MY_O_NONBLOCK $o_nonblock
8146 #ifndef errno  /* XXX need better Configure test */
8147 extern int errno;
8148 #endif
8149 $signal_t blech(x) int x; { exit(3); }
8150 EOCP
8151         $cat >> try.c <<'EOCP'
8152 int main()
8153 {
8154         int pd[2];
8155         int pu[2];
8156         char buf[1];
8157         char string[100];
8158
8159         pipe(pd);       /* Down: child -> parent */
8160         pipe(pu);       /* Up: parent -> child */
8161         if (0 != fork()) {
8162                 int ret;
8163                 close(pd[1]);   /* Parent reads from pd[0] */
8164                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8165                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8166                         exit(1);
8167                 signal(SIGALRM, blech);
8168                 alarm(5);
8169                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8170                         exit(2);
8171                 sprintf(string, "%d\n", ret);
8172                 write(2, string, strlen(string));
8173                 alarm(0);
8174 #ifdef EAGAIN
8175                 if (errno == EAGAIN) {
8176                         printf("EAGAIN\n");
8177                         goto ok;
8178                 }
8179 #endif
8180 #ifdef EWOULDBLOCK
8181                 if (errno == EWOULDBLOCK)
8182                         printf("EWOULDBLOCK\n");
8183 #endif
8184         ok:
8185                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8186                 sleep(2);                               /* Give it time to close our pipe */
8187                 alarm(5);
8188                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8189                 alarm(0);
8190                 sprintf(string, "%d\n", ret);
8191                 write(3, string, strlen(string));
8192                 exit(0);
8193         }
8194
8195         close(pd[0]);                   /* We write to pd[1] */
8196         close(pu[1]);                   /* We read from pu[0] */
8197         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8198         close(pd[1]);                   /* Pipe pd is now fully closed! */
8199         exit(0);                                /* Bye bye, thank you for playing! */
8200 }
8201 EOCP
8202         set try
8203         if eval $compile_ok; then
8204                 echo "$startsh" >mtry
8205                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8206                 chmod +x mtry
8207                 ./mtry >/dev/null 2>&1
8208                 case $? in
8209                 0) eagain=`$cat try.out`;;
8210                 1) echo "Could not perform non-blocking setting!";;
8211                 2) echo "I did a successful read() for something that was not there!";;
8212                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8213                 *) echo "Something terribly wrong happened during testing.";;
8214                 esac
8215                 rd_nodata=`$cat try.ret`
8216                 echo "A read() system call with no data present returns $rd_nodata."
8217                 case "$rd_nodata" in
8218                 0|-1) ;;
8219                 *)
8220                         echo "(That's peculiar, fixing that to be -1.)"
8221                         rd_nodata=-1
8222                         ;;
8223                 esac
8224                 case "$eagain" in
8225                 '')
8226                         echo "Forcing errno EAGAIN on read() with no data available."
8227                         eagain=EAGAIN
8228                         ;;
8229                 *)
8230                         echo "Your read() sets errno to $eagain when no data is available."
8231                         ;;
8232                 esac
8233                 status=`$cat try.err`
8234                 case "$status" in
8235                 0) echo "And it correctly returns 0 to signal EOF.";;
8236                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8237                 *) echo "However, your read() returns '$status' on EOF??";;
8238                 esac
8239                 val="$define"
8240                 if test "$status" = "$rd_nodata"; then
8241                         echo "WARNING: you can't distinguish between EOF and no data!"
8242                         val="$undef"
8243                 fi
8244         else
8245                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8246                 eagain=EAGAIN
8247         fi
8248         set d_eofnblk
8249         eval $setvar
8250         ;;
8251 *)
8252         echo "Using $hint value $eagain."
8253         echo "Your read() returns $rd_nodata when no data is present."
8254         case "$d_eofnblk" in
8255         "$define") echo "And you can see EOF because read() returns 0.";;
8256         "$undef") echo "But you can't see EOF status from read() returned value.";;
8257         *)
8258                 echo "(Assuming you can't see EOF status from read anyway.)"
8259                 d_eofnblk=$undef
8260                 ;;
8261         esac
8262         ;;
8263 esac
8264 $rm -f try try.* .out core head.c mtry
8265
8266 : see if fchmod exists
8267 set fchmod d_fchmod
8268 eval $inlibc
8269
8270 : see if fchown exists
8271 set fchown d_fchown
8272 eval $inlibc
8273
8274 : see if this is an fcntl system
8275 set fcntl d_fcntl
8276 eval $inlibc
8277
8278 : see if sys/select.h has to be included
8279 set sys/select.h i_sysselct
8280 eval $inhdr
8281
8282 : see if we should include time.h, sys/time.h, or both
8283 echo " "
8284 if test "X$timeincl" = X; then
8285         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8286         $echo $n "I'm now running the test program...$c"
8287         $cat >try.c <<'EOCP'
8288 #include <sys/types.h>
8289 #ifdef I_TIME
8290 #include <time.h>
8291 #endif
8292 #ifdef I_SYSTIME
8293 #ifdef SYSTIMEKERNEL
8294 #define KERNEL
8295 #endif
8296 #include <sys/time.h>
8297 #endif
8298 #ifdef I_SYSSELECT
8299 #include <sys/select.h>
8300 #endif
8301 int main()
8302 {
8303         struct tm foo;
8304 #ifdef S_TIMEVAL
8305         struct timeval bar;
8306 #endif
8307 #ifdef S_TIMEZONE
8308         struct timezone tzp;
8309 #endif
8310         if (foo.tm_sec == foo.tm_sec)
8311                 exit(0);
8312 #ifdef S_TIMEVAL
8313         if (bar.tv_sec == bar.tv_sec)
8314                 exit(0);
8315 #endif
8316         exit(1);
8317 }
8318 EOCP
8319         flags=''
8320         for s_timezone in '-DS_TIMEZONE' ''; do
8321         sysselect=''
8322         for s_timeval in '-DS_TIMEVAL' ''; do
8323         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8324         for i_time in '' '-DI_TIME'; do
8325         for i_systime in '-DI_SYSTIME' ''; do
8326                 case "$flags" in
8327                 '') $echo $n ".$c"
8328                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8329                         if eval $compile; then
8330                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8331                                 shift
8332                                 flags="$*"
8333                                 echo " "
8334                                 $echo $n "Succeeded with $flags$c"
8335                         fi
8336                         ;;
8337                 esac
8338         done
8339         done
8340         done
8341         done
8342         done
8343         timeincl=''
8344         echo " "
8345         case "$flags" in
8346         *SYSTIMEKERNEL*) i_systimek="$define"
8347                 timeincl=`./findhdr sys/time.h`
8348                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8349         *) i_systimek="$undef";;
8350         esac
8351         case "$flags" in
8352         *I_TIME*) i_time="$define"
8353                 timeincl=`./findhdr time.h`" $timeincl"
8354                 echo "We'll include <time.h>." >&4;;
8355         *) i_time="$undef";;
8356         esac
8357         case "$flags" in
8358         *I_SYSTIME*) i_systime="$define"
8359                 timeincl=`./findhdr sys/time.h`" $timeincl"
8360                 echo "We'll include <sys/time.h>." >&4;;
8361         *) i_systime="$undef";;
8362         esac
8363         $rm -f try.c try
8364 fi
8365
8366 : check for fd_set items
8367 $cat <<EOM
8368
8369 Checking to see how well your C compiler handles fd_set and friends ...
8370 EOM
8371 $cat >fd_set.c <<EOCP
8372 #$i_systime I_SYS_TIME
8373 #$i_sysselct I_SYS_SELECT
8374 #$d_socket HAS_SOCKET
8375 #include <sys/types.h>
8376 #ifdef HAS_SOCKET
8377 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8378 #endif
8379 #ifdef I_SYS_TIME
8380 #include <sys/time.h>
8381 #endif
8382 #ifdef I_SYS_SELECT
8383 #include <sys/select.h>
8384 #endif
8385 int main() {
8386         fd_set fds;
8387
8388 #ifdef TRYBITS
8389         if(fds.fds_bits);
8390 #endif
8391
8392 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8393         exit(0);
8394 #else
8395         exit(1);
8396 #endif
8397 }
8398 EOCP
8399 set fd_set -DTRYBITS
8400 if eval $compile; then
8401         d_fds_bits="$define"
8402         d_fd_set="$define"
8403         echo "Well, your system knows about the normal fd_set typedef..." >&4
8404         if ./fd_set; then
8405                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8406                 d_fd_macros="$define"
8407         else
8408                 $cat >&4 <<'EOM'
8409 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8410 EOM
8411                 d_fd_macros="$undef"
8412         fi
8413 else
8414         $cat <<'EOM'
8415 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8416 EOM
8417         set fd_set
8418         if eval $compile; then
8419                 d_fds_bits="$undef"
8420                 d_fd_set="$define"
8421                 echo "Well, your system has some sort of fd_set available..." >&4
8422                 if ./fd_set; then
8423                         echo "and you have the normal fd_set macros." >&4
8424                         d_fd_macros="$define"
8425                 else
8426                         $cat <<'EOM'
8427 but not the normal fd_set macros!  Gross!  More work for me...
8428 EOM
8429                         d_fd_macros="$undef"
8430                 fi
8431         else
8432         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8433                 d_fd_set="$undef"
8434                 d_fds_bits="$undef"
8435                 d_fd_macros="$undef"
8436         fi
8437 fi
8438 $rm -f fd_set*
8439
8440 : see if fgetpos exists
8441 set fgetpos d_fgetpos
8442 eval $inlibc
8443
8444 : see if flock exists
8445 set flock d_flock
8446 eval $inlibc
8447
8448 : see if fork exists
8449 set fork d_fork
8450 eval $inlibc
8451
8452 : see if pathconf exists
8453 set pathconf d_pathconf
8454 eval $inlibc
8455
8456 : see if fpathconf exists
8457 set fpathconf d_fpathconf
8458 eval $inlibc
8459
8460
8461 : see if llseek exists
8462 set llseek d_llseek
8463 eval $inlibc
8464
8465 : check for off64_t
8466 echo " "
8467 echo $n "Checking to see if your system supports off64_t...$c" >&4
8468 $cat >try.c <<EOCP
8469 #include <sys/types.h>
8470 #include <unistd.h>
8471 off64_t foo() { off64_t x; x = 7; return x; }'
8472 EOCP
8473 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8474         val="$define"
8475         echo " Yup, it does." >&4
8476 else
8477         val="$undef"
8478         echo " Nope, it doesn't." >&4
8479 fi
8480 $rm -f try.*
8481 set d_off64_t
8482 eval $setvar
8483
8484 : check for fpos64_t
8485 echo " "
8486 echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8487 $cat >try.c <<EOCP
8488 #include <sys/stdio.h>
8489 fpos64_t foo() { fpos64_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_fpos64_t
8500 eval $setvar
8501
8502 : see if fseeko exists
8503 set fseeko d_fseeko
8504 eval $inlibc
8505
8506 : see if fsetpos exists
8507 set fsetpos d_fsetpos
8508 eval $inlibc
8509
8510 : see if this is a sys/param system
8511 set sys/param.h i_sysparam
8512 eval $inhdr
8513
8514 : see if this is a sys/mount.h system
8515 set sys/mount.h i_sysmount
8516 eval $inhdr
8517
8518
8519 : see if statfs exists
8520 set statfs d_statfs
8521 eval $inlibc
8522
8523 : see if fstatfs exists
8524 set fstatfs d_fstatfs
8525 eval $inlibc
8526
8527 : see if statfs knows about mount flags
8528 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8529 eval $hasfield
8530
8531
8532 : see if statvfs exists
8533 set statvfs d_statvfs
8534 eval $inlibc
8535
8536 : see if fstatvfs exists
8537 set fstatvfs d_fstatvfs
8538 eval $inlibc
8539
8540
8541 : see if ftello exists
8542 set ftello d_ftello
8543 eval $inlibc
8544
8545 : see if getgrent exists
8546 set getgrent d_getgrent
8547 eval $inlibc
8548
8549 : see if gethostbyaddr exists
8550 set gethostbyaddr d_gethbyaddr
8551 eval $inlibc
8552
8553 : see if gethostbyname exists
8554 set gethostbyname d_gethbyname
8555 eval $inlibc
8556
8557 : see if gethostent exists
8558 set gethostent d_gethent
8559 eval $inlibc
8560
8561 : see how we will look up host name
8562 echo " "
8563 call=''
8564 if set gethostname val -f d_gethname; eval $csym; $val; then
8565         echo 'gethostname() found.' >&4
8566         d_gethname="$define"
8567         call=gethostname
8568 fi
8569 if set uname val -f d_uname; eval $csym; $val; then
8570         if ./xenix; then
8571                 $cat <<'EOM'
8572 uname() was found, but you're running xenix, and older versions of xenix
8573 have a broken uname(). If you don't really know whether your xenix is old
8574 enough to have a broken system call, use the default answer.
8575
8576 EOM
8577                 dflt=y
8578                 case "$d_uname" in
8579                 "$define") dflt=n;;
8580                 esac
8581                 rp='Is your uname() broken?'
8582                 . ./myread
8583                 case "$ans" in
8584                 n*) d_uname="$define"; call=uname;;
8585                 esac
8586         else
8587                 echo 'uname() found.' >&4
8588                 d_uname="$define"
8589                 case "$call" in
8590                 '') call=uname ;;
8591                 esac
8592         fi
8593 fi
8594 case "$d_gethname" in
8595 '') d_gethname="$undef";;
8596 esac
8597 case "$d_uname" in
8598 '') d_uname="$undef";;
8599 esac
8600 case "$d_uname$d_gethname" in
8601 *define*)
8602         dflt=n
8603         cat <<EOM
8604  
8605 Every now and then someone has a $call() that lies about the hostname
8606 but can't be fixed for political or economic reasons.  If you wish, I can
8607 pretend $call() isn't there and maybe compute hostname at run-time
8608 thanks to the '$phostname' command.
8609
8610 EOM
8611         rp="Shall I ignore $call() from now on?"
8612         . ./myread
8613         case "$ans" in
8614         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8615         esac;;
8616 esac
8617 case "$phostname" in
8618 '') aphostname='';;
8619 *) case "$aphostname" in
8620         /*) ;;
8621         *) set X $phostname
8622                 shift
8623                 file=$1
8624                 shift
8625                 file=`./loc $file $file $pth`
8626                 aphostname=`echo $file $*`
8627                 ;;
8628         esac
8629         ;;
8630 esac
8631 case "$d_uname$d_gethname" in
8632 *define*) ;;
8633 *)
8634         case "$phostname" in
8635         '')
8636                 echo "There will be no way for $package to get your hostname." >&4;;
8637         *)
8638         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8639                 ;;
8640         esac;;
8641 esac
8642 case "$d_phostname" in
8643 '') d_phostname="$undef";;
8644 esac
8645
8646 : see if this is a netdb.h system
8647 set netdb.h i_netdb
8648 eval $inhdr
8649
8650 : see if prototypes for various gethostxxx netdb.h functions are available
8651 echo " "
8652 set d_gethostprotos gethostent $i_netdb netdb.h
8653 eval $hasproto
8654
8655 : see if getlogin exists
8656 set getlogin d_getlogin
8657 eval $inlibc
8658
8659 : see if getmntent exists
8660 set getmntent d_getmntent
8661 eval $inlibc
8662
8663 : see if getnetbyaddr exists
8664 set getnetbyaddr d_getnbyaddr
8665 eval $inlibc
8666
8667 : see if getnetbyname exists
8668 set getnetbyname d_getnbyname
8669 eval $inlibc
8670
8671 : see if getnetent exists
8672 set getnetent d_getnent
8673 eval $inlibc
8674
8675 : see if prototypes for various getnetxxx netdb.h functions are available
8676 echo " "
8677 set d_getnetprotos getnetent $i_netdb netdb.h
8678 eval $hasproto
8679
8680
8681 : see if getprotobyname exists
8682 set getprotobyname d_getpbyname
8683 eval $inlibc
8684
8685 : see if getprotobynumber exists
8686 set getprotobynumber d_getpbynumber
8687 eval $inlibc
8688
8689 : see if getprotoent exists
8690 set getprotoent d_getpent
8691 eval $inlibc
8692
8693 : see if getpgid exists
8694 set getpgid d_getpgid
8695 eval $inlibc
8696
8697 : see if getpgrp2 exists
8698 set getpgrp2 d_getpgrp2
8699 eval $inlibc
8700
8701 : see if getppid exists
8702 set getppid d_getppid
8703 eval $inlibc
8704
8705 : see if getpriority exists
8706 set getpriority d_getprior
8707 eval $inlibc
8708
8709 : see if prototypes for various getprotoxxx netdb.h functions are available
8710 echo " "
8711 set d_getprotoprotos getprotoent $i_netdb netdb.h
8712 eval $hasproto
8713
8714 : see if getpwent exists
8715 set getpwent d_getpwent
8716 eval $inlibc
8717
8718
8719 : see if getservbyname exists
8720 set getservbyname d_getsbyname
8721 eval $inlibc
8722
8723 : see if getservbyport exists
8724 set getservbyport d_getsbyport
8725 eval $inlibc
8726
8727 : see if getservent exists
8728 set getservent d_getsent
8729 eval $inlibc
8730
8731 : see if prototypes for various getservxxx netdb.h functions are available
8732 echo " "
8733 set d_getservprotos getservent $i_netdb netdb.h
8734 eval $hasproto
8735
8736 : see if getspent exists
8737 set getspent d_getspent
8738 eval $inlibc
8739
8740 : see if getspnam exists
8741 set getspnam d_getspnam
8742 eval $inlibc
8743
8744 : see if gettimeofday or ftime exists
8745 set gettimeofday d_gettimeod
8746 eval $inlibc
8747 case "$d_gettimeod" in
8748 "$undef")
8749         set ftime d_ftime 
8750         eval $inlibc
8751         ;;
8752 *)
8753         val="$undef"; set d_ftime; eval $setvar
8754         ;;
8755 esac
8756 case "$d_gettimeod$d_ftime" in
8757 "$undef$undef")
8758         echo " "
8759         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8760         ;;
8761 esac
8762
8763 : see if this is an grp system
8764 set grp.h i_grp
8765 eval $inhdr
8766
8767 case "$i_grp" in
8768 $define)
8769         xxx=`./findhdr grp.h`
8770         $cppstdin $cppflags $cppminus < $xxx >$$.h
8771
8772         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8773                 val="$define"
8774         else
8775                 val="$undef"
8776         fi
8777         set d_grpasswd
8778         eval $setvar
8779
8780         $rm -f $$.h
8781         ;;
8782 *)
8783         val="$undef";
8784         set d_grpasswd; eval $setvar
8785         ;;
8786 esac
8787
8788 : see if hasmntopt exists
8789 set hasmntopt d_hasmntopt
8790 eval $inlibc
8791
8792 : see if this is a netinet/in.h or sys/in.h system
8793 set netinet/in.h i_niin sys/in.h i_sysin
8794 eval $inhdr
8795
8796 : see if arpa/inet.h has to be included
8797 set arpa/inet.h i_arpainet
8798 eval $inhdr
8799
8800 : see if htonl --and friends-- exists
8801 val=''
8802 set htonl val
8803 eval $inlibc
8804
8805 : Maybe they are macros.
8806 case "$val" in
8807 $undef)
8808         $cat >htonl.c <<EOM
8809 #include <stdio.h>
8810 #include <sys/types.h>
8811 #$i_niin I_NETINET_IN
8812 #$i_sysin I_SYS_IN
8813 #$i_arpainet I_ARPA_INET
8814 #ifdef I_NETINET_IN
8815 #include <netinet/in.h>
8816 #endif
8817 #ifdef I_SYS_IN
8818 #include <sys/in.h>
8819 #endif
8820 #ifdef I_ARPA_INET
8821 #include <arpa/inet.h>
8822 #endif
8823 #ifdef htonl
8824 printf("Defined as a macro.");
8825 #endif
8826 EOM
8827         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8828         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8829                 val="$define"
8830                 echo "But it seems to be defined as a macro." >&4
8831         fi
8832         $rm -f htonl.?
8833         ;;
8834 esac
8835 set d_htonl
8836 eval $setvar
8837
8838 : see which of string.h or strings.h is needed
8839 echo " "
8840 strings=`./findhdr string.h`
8841 if $test "$strings" && $test -r "$strings"; then
8842         echo "Using <string.h> instead of <strings.h>." >&4
8843         val="$define"
8844 else
8845         val="$undef"
8846         strings=`./findhdr strings.h`
8847         if $test "$strings" && $test -r "$strings"; then
8848                 echo "Using <strings.h> instead of <string.h>." >&4
8849         else
8850                 echo "No string header found -- You'll surely have problems." >&4
8851         fi
8852 fi
8853 set i_string
8854 eval $setvar
8855 case "$i_string" in
8856 "$undef") strings=`./findhdr strings.h`;;
8857 *)        strings=`./findhdr string.h`;;
8858 esac
8859
8860 : index or strchr
8861 echo " "
8862 if set index val -f; eval $csym; $val; then
8863         if set strchr val -f d_strchr; eval $csym; $val; then
8864                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8865                         val="$define"
8866                         vali="$undef"
8867                         echo "strchr() found." >&4
8868                 else
8869                         val="$undef"
8870                         vali="$define"
8871                         echo "index() found." >&4
8872                 fi
8873         else
8874                 val="$undef"
8875                 vali="$define"
8876                 echo "index() found." >&4
8877         fi
8878 else
8879         if set strchr val -f d_strchr; eval $csym; $val; then
8880                 val="$define"
8881                 vali="$undef"
8882                 echo "strchr() found." >&4
8883         else
8884                 echo "No index() or strchr() found!" >&4
8885                 val="$undef"
8886                 vali="$undef"
8887         fi
8888 fi
8889 set d_strchr; eval $setvar
8890 val="$vali"
8891 set d_index; eval $setvar
8892
8893 : check whether inet_aton exists
8894 set inet_aton d_inetaton
8895 eval $inlibc
8896
8897 : Look for isascii
8898 echo " "
8899 $cat >isascii.c <<'EOCP'
8900 #include <stdio.h>
8901 #include <ctype.h>
8902 int main() {
8903         int c = 'A';
8904         if (isascii(c))
8905                 exit(0);
8906         else
8907                 exit(1);
8908 }
8909 EOCP
8910 set isascii
8911 if eval $compile; then
8912         echo "isascii() found." >&4
8913         val="$define"
8914 else
8915         echo "isascii() NOT found." >&4
8916         val="$undef"
8917 fi
8918 set d_isascii
8919 eval $setvar
8920 $rm -f isascii*
8921
8922 : see if killpg exists
8923 set killpg d_killpg
8924 eval $inlibc
8925
8926 : see if lchown exists
8927 echo " "
8928 $cat > try.c <<'EOCP'
8929 /* System header to define __stub macros and hopefully few prototypes,
8930     which can conflict with char lchown(); below.  */
8931 #include <assert.h>
8932 /* Override any gcc2 internal prototype to avoid an error.  */
8933 /* We use char because int might match the return type of a gcc2
8934    builtin and then its argument prototype would still apply.  */
8935 char lchown();
8936 int main() {
8937     /*  The GNU C library defines this for functions which it implements
8938         to always fail with ENOSYS.  Some functions are actually named
8939         something starting with __ and the normal name is an alias.  */
8940 #if defined (__stub_lchown) || defined (__stub___lchown)
8941 choke me
8942 #else
8943 lchown();
8944 #endif
8945 ; return 0; }
8946 EOCP
8947 set try
8948 if eval $compile; then
8949     $echo "lchown() found." >&4
8950     val="$define"
8951 else
8952     $echo "lchown() NOT found." >&4
8953     val="$undef"
8954 fi
8955 set d_lchown
8956 eval $setvar
8957
8958 : See if number of significant digits in a double precision number is known
8959 echo " "
8960 $cat >ldbl_dig.c <<EOM
8961 #$i_limits I_LIMITS
8962 #$i_float I_FLOAT
8963 #ifdef I_LIMITS
8964 #include <limits.h>
8965 #endif
8966 #ifdef I_FLOAT
8967 #include <float.h>
8968 #endif
8969 #ifdef LDBL_DIG
8970 printf("Contains LDBL_DIG");
8971 #endif
8972 EOM
8973 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
8974 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
8975         echo "LDBL_DIG found." >&4
8976         val="$define"
8977 else
8978         echo "LDBL_DIG NOT found." >&4
8979         val="$undef"
8980 fi
8981 $rm -f ldbl_dig.?
8982 set d_ldbl_dig
8983 eval $setvar
8984
8985 : see if link exists
8986 set link d_link
8987 eval $inlibc
8988
8989 : see if localeconv exists
8990 set localeconv d_locconv
8991 eval $inlibc
8992
8993 : see if lockf exists
8994 set lockf d_lockf
8995 eval $inlibc
8996
8997 : see if lstat exists
8998 set lstat d_lstat
8999 eval $inlibc
9000
9001 : see if madvise exists
9002 set madvise d_madvise
9003 eval $inlibc
9004
9005 : see if mblen exists
9006 set mblen d_mblen
9007 eval $inlibc
9008
9009 : see if mbstowcs exists
9010 set mbstowcs d_mbstowcs
9011 eval $inlibc
9012
9013 : see if mbtowc exists
9014 set mbtowc d_mbtowc
9015 eval $inlibc
9016
9017 : see if memchr exists
9018 set memchr d_memchr
9019 eval $inlibc
9020
9021 : see if memcmp exists
9022 set memcmp d_memcmp
9023 eval $inlibc
9024
9025 : see if memcpy exists
9026 set memcpy d_memcpy
9027 eval $inlibc
9028
9029 : see if memmove exists
9030 set memmove d_memmove
9031 eval $inlibc
9032
9033 : see if memset exists
9034 set memset d_memset
9035 eval $inlibc
9036
9037 : see if mkdir exists
9038 set mkdir d_mkdir
9039 eval $inlibc
9040
9041 : see if mkfifo exists
9042 set mkfifo d_mkfifo
9043 eval $inlibc
9044
9045 : see if mktime exists
9046 set mktime d_mktime
9047 eval $inlibc
9048
9049 : see if this is a sys/mman.h system
9050 set sys/mman.h i_sysmman
9051 eval $inhdr
9052
9053 : see if mmap exists
9054 set mmap d_mmap
9055 eval $inlibc
9056 : see what shmat returns
9057 : default to something harmless
9058 mmaptype='void *'
9059 case "$i_sysmman$d_mmap" in
9060 "$define$define")
9061         $cat >mmap.c <<'END'
9062 #include <sys/mman.h>
9063 void *mmap();
9064 END
9065         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9066                 mmaptype='void *'
9067         else
9068                 mmaptype='caddr_t'
9069         fi
9070         echo "and it returns ($mmaptype)." >&4
9071         ;;
9072 esac
9073
9074
9075
9076 : see if mprotect exists
9077 set mprotect d_mprotect
9078 eval $inlibc
9079
9080 : see if msgctl exists
9081 set msgctl d_msgctl
9082 eval $inlibc
9083
9084 : see if msgget exists
9085 set msgget d_msgget
9086 eval $inlibc
9087
9088 : see if msgsnd exists
9089 set msgsnd d_msgsnd
9090 eval $inlibc
9091
9092 : see if msgrcv exists
9093 set msgrcv d_msgrcv
9094 eval $inlibc
9095
9096 : see how much of the 'msg*(2)' library is present.
9097 h_msg=true
9098 echo " "
9099 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9100 *"$undef"*) h_msg=false;;
9101 esac
9102 case "$osname" in
9103 freebsd)
9104     case "`ipcs 2>&1`" in
9105     "SVID messages"*"not configured"*)
9106         echo "Your $osname does not have the msg*(2) configured." >&4
9107         h_msg=false
9108         val="$undef"
9109         set msgctl d_msgctl
9110         eval $setvar
9111         set msgget d_msgget
9112         eval $setvar
9113         set msgsnd d_msgsnd
9114         eval $setvar
9115         set msgrcv d_msgrcv
9116         eval $setvar
9117         ;;
9118     esac
9119     ;;
9120 esac
9121 : we could also check for sys/ipc.h ...
9122 if $h_msg && $test `./findhdr sys/msg.h`; then
9123         echo "You have the full msg*(2) library." >&4
9124         val="$define"
9125 else
9126         echo "You don't have the full msg*(2) library." >&4
9127         val="$undef"
9128 fi
9129 set d_msg
9130 eval $setvar
9131
9132 : see if msync exists
9133 set msync d_msync
9134 eval $inlibc
9135
9136 : see if munmap exists
9137 set munmap d_munmap
9138 eval $inlibc
9139
9140 : see if nice exists
9141 set nice d_nice
9142 eval $inlibc
9143
9144 : see if POSIX threads are available
9145 if test "X$usethreads" = "X$define"; then
9146         set pthread.h i_pthread
9147         eval $inhdr
9148 else
9149         i_pthread="$undef"
9150 fi
9151
9152
9153
9154 : how to create joinable pthreads
9155 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9156         echo " "
9157         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9158         $cat >try.c <<'EOCP'
9159 #include <pthread.h>
9160 int main() {
9161     int detachstate = JOINABLE;
9162 }
9163 EOCP
9164         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9165         if eval $compile; then
9166                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9167                 val="$undef" # Yes, undef.
9168                 set d_old_pthread_create_joinable
9169                 eval $setvar
9170                 val=""
9171                 set old_pthread_create_joinable
9172                 eval $setvar
9173         else
9174                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9175                 if eval $compile; then
9176                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9177                         val="$define"
9178                         set d_old_pthread_create_joinable
9179                         eval $setvar
9180                         val=PTHREAD_CREATE_UNDETACHED
9181                         set old_pthread_create_joinable
9182                         eval $setvar
9183                 else            
9184                         set try -DJOINABLE=__UNDETACHED
9185                         if eval $compile; then
9186                                 echo "You seem to use __UNDETACHED." >&4
9187                                 val="$define"
9188                                 set d_old_pthread_create_joinable
9189                                 eval $setvar
9190                                 val=__UNDETACHED
9191                                 set old_pthread_create_joinable
9192                                 eval $setvar
9193                         else
9194                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9195                                 val="$define"
9196                                 set d_old_pthread_create_joinable
9197                                 eval $setvar
9198                                 val=0
9199                                 set old_pthread_create_joinable
9200                                 eval $setvar
9201                         fi
9202                 fi
9203         fi
9204         $rm -f try try.*
9205 else
9206     d_old_pthread_create_joinable="$undef"
9207     old_pthread_create_joinable=""
9208 fi
9209
9210 : see if pause exists
9211 set pause d_pause
9212 eval $inlibc
9213
9214 : see if pipe exists
9215 set pipe d_pipe
9216 eval $inlibc
9217
9218 : see if poll exists
9219 set poll d_poll
9220 eval $inlibc
9221
9222
9223 : see whether the various POSIXish _yields exist
9224 $cat >try.c <<EOP
9225 #include <pthread.h>
9226 #include <stdio.h>
9227 int main() {
9228 #ifdef SCHED_YIELD
9229         sched_yield();
9230 #else
9231 #ifdef PTHREAD_YIELD
9232         pthread_yield();
9233 #else
9234 #ifdef PTHREAD_YIELD_NULL
9235         pthread_yield(NULL);
9236 #endif
9237 #endif
9238 #endif
9239 }
9240 EOP
9241 : see if sched_yield exists
9242 set try -DSCHED_YIELD
9243 if eval $compile; then
9244     val="$define"
9245     sched_yield='sched_yield()'
9246 else
9247     val="$undef"
9248 fi
9249 case "$usethreads" in
9250 $define)
9251         case "$val" in
9252         $define) echo 'sched_yield() found.' >&4        ;;
9253         *)       echo 'sched_yield() NOT found.' >&4    ;;
9254         esac
9255 esac
9256 set d_sched_yield
9257 eval $setvar
9258
9259 : see if pthread_yield exists
9260 set try -DPTHREAD_YIELD
9261 if eval $compile; then
9262     val="$define"
9263     case "$sched_yield" in
9264     '') sched_yield='pthread_yield()' ;;
9265     esac
9266 else
9267     set try -DPTHREAD_YIELD_NULL
9268     if eval $compile; then
9269         val="$define"
9270         case "$sched_yield" in
9271         '') sched_yield='pthread_yield(NULL)' ;;
9272         esac
9273     else
9274         val="$undef"
9275     fi
9276 fi
9277 case "$usethreads" in
9278 $define)
9279         case "$val" in
9280         $define) echo 'pthread_yield() found.' >&4      ;;
9281         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9282         esac
9283         ;;
9284 esac
9285 set d_pthread_yield
9286 eval $setvar
9287
9288 case "$sched_yield" in
9289 '') sched_yield=undef ;;
9290 esac
9291
9292 $rm -f try try.*
9293
9294 : see if this is a pwd.h system
9295 set pwd.h i_pwd
9296 eval $inhdr
9297
9298 case "$i_pwd" in
9299 $define)
9300         xxx=`./findhdr pwd.h`
9301         $cppstdin $cppflags $cppminus < $xxx >$$.h
9302
9303         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9304                 val="$define"
9305         else
9306                 val="$undef"
9307         fi
9308         set d_pwquota
9309         eval $setvar
9310
9311         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9312                 val="$define"
9313         else
9314                 val="$undef"
9315         fi
9316         set d_pwage
9317         eval $setvar
9318
9319         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9320                 val="$define"
9321         else
9322                 val="$undef"
9323         fi
9324         set d_pwchange
9325         eval $setvar
9326
9327         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9328                 val="$define"
9329         else
9330                 val="$undef"
9331         fi
9332         set d_pwclass
9333         eval $setvar
9334
9335         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9336                 val="$define"
9337         else
9338                 val="$undef"
9339         fi
9340         set d_pwexpire
9341         eval $setvar
9342
9343         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9344                 val="$define"
9345         else
9346                 val="$undef"
9347         fi
9348         set d_pwcomment
9349         eval $setvar
9350
9351         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9352                 val="$define"
9353         else
9354                 val="$undef"
9355         fi
9356         set d_pwgecos
9357         eval $setvar
9358
9359         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9360                 val="$define"
9361         else
9362                 val="$undef"
9363         fi
9364         set d_pwpasswd
9365         eval $setvar
9366
9367         $rm -f $$.h
9368         ;;
9369 *)
9370         val="$undef"; 
9371         set d_pwquota; eval $setvar
9372         set d_pwage; eval $setvar
9373         set d_pwchange; eval $setvar
9374         set d_pwclass; eval $setvar
9375         set d_pwexpire; eval $setvar
9376         set d_pwcomment; eval $setvar
9377         set d_pwgecos; eval $setvar
9378         set d_pwpasswd; eval $setvar
9379         ;;
9380 esac
9381
9382 : see if readdir and friends exist
9383 set readdir d_readdir
9384 eval $inlibc
9385 set seekdir d_seekdir
9386 eval $inlibc
9387 set telldir d_telldir
9388 eval $inlibc
9389 set rewinddir d_rewinddir
9390 eval $inlibc
9391
9392 : see if readlink exists
9393 set readlink d_readlink
9394 eval $inlibc
9395
9396 : see if readv exists
9397 set readv d_readv
9398 eval $inlibc
9399
9400 : see if rename exists
9401 set rename d_rename
9402 eval $inlibc
9403
9404 : see if rmdir exists
9405 set rmdir d_rmdir
9406 eval $inlibc
9407
9408 : see if memory.h is available.
9409 val=''
9410 set memory.h val
9411 eval $inhdr
9412
9413 : See if it conflicts with string.h
9414 case "$val" in
9415 $define)
9416         case "$strings" in
9417         '') ;;
9418         *)
9419                 $cppstdin $cppflags $cppminus < $strings > mem.h
9420                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9421                         echo " "
9422                         echo "We won't be including <memory.h>."
9423                         val="$undef"
9424                 fi
9425                 $rm -f mem.h
9426                 ;;
9427         esac
9428 esac
9429 set i_memory
9430 eval $setvar
9431
9432 : can bcopy handle overlapping blocks?
9433 val="$undef"
9434 case "$d_bcopy" in
9435 "$define")
9436         echo " "
9437         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9438         $cat >try.c <<EOCP
9439 #$i_memory I_MEMORY
9440 #$i_stdlib I_STDLIB
9441 #$i_string I_STRING
9442 #$i_unistd I_UNISTD
9443 EOCP
9444         $cat >>try.c <<'EOCP'
9445 #include <stdio.h>
9446 #ifdef I_MEMORY
9447 #  include <memory.h>
9448 #endif
9449 #ifdef I_STDLIB
9450 #  include <stdlib.h>
9451 #endif
9452 #ifdef I_STRING
9453 #  include <string.h>
9454 #else
9455 #  include <strings.h>
9456 #endif
9457 #ifdef I_UNISTD
9458 #  include <unistd.h>  /* Needed for NetBSD */
9459 #endif
9460 int main()
9461 {
9462 char buf[128], abc[128];
9463 char *b;
9464 int len;
9465 int off;
9466 int align;
9467
9468 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9469
9470 for (align = 7; align >= 0; align--) {
9471         for (len = 36; len; len--) {
9472                 b = buf+align;
9473                 bcopy(abc, b, len);
9474                 for (off = 1; off <= len; off++) {
9475                         bcopy(b, b+off, len);
9476                         bcopy(b+off, b, len);
9477                         if (bcmp(b, abc, len))
9478                                 exit(1);
9479                 }
9480         }
9481 }
9482 exit(0);
9483 }
9484 EOCP
9485         set try
9486         if eval $compile_ok; then
9487                 if ./try 2>/dev/null; then
9488                         echo "Yes, it can."
9489                         val="$define"
9490                 else
9491                         echo "It can't, sorry."
9492                         case "$d_memmove" in
9493                         "$define") echo "But that's Ok since you have memmove()." ;;
9494                         esac
9495                 fi
9496         else
9497                 echo "(I can't compile the test program, so we'll assume not...)"
9498                 case "$d_memmove" in
9499                 "$define") echo "But that's Ok since you have memmove()." ;;
9500                 esac
9501         fi
9502         ;;
9503 esac
9504 $rm -f try.* try core
9505 set d_safebcpy
9506 eval $setvar
9507
9508 : can memcpy handle overlapping blocks?
9509 val="$undef"
9510 case "$d_memcpy" in
9511 "$define")
9512         echo " "
9513         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9514         $cat >try.c <<EOCP
9515 #$i_memory I_MEMORY
9516 #$i_stdlib I_STDLIB
9517 #$i_string I_STRING
9518 #$i_unistd I_UNISTD
9519 EOCP
9520         $cat >>try.c <<'EOCP'
9521 #include <stdio.h>
9522 #ifdef I_MEMORY
9523 #  include <memory.h>
9524 #endif
9525 #ifdef I_STDLIB
9526 #  include <stdlib.h>
9527 #endif
9528 #ifdef I_STRING
9529 #  include <string.h>
9530 #else
9531 #  include <strings.h>
9532 #endif
9533 #ifdef I_UNISTD
9534 #  include <unistd.h>  /* Needed for NetBSD */
9535 #endif
9536 int main()
9537 {
9538 char buf[128], abc[128];
9539 char *b;
9540 int len;
9541 int off;
9542 int align;
9543
9544 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9545    try to store the string in read-only memory. */
9546 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9547
9548 for (align = 7; align >= 0; align--) {
9549         for (len = 36; len; len--) {
9550                 b = buf+align;
9551                 memcpy(b, abc, len);
9552                 for (off = 1; off <= len; off++) {
9553                         memcpy(b+off, b, len);
9554                         memcpy(b, b+off, len);
9555                         if (memcmp(b, abc, len))
9556                                 exit(1);
9557                 }
9558         }
9559 }
9560 exit(0);
9561 }
9562 EOCP
9563         set try
9564         if eval $compile_ok; then
9565                 if ./try 2>/dev/null; then
9566                         echo "Yes, it can."
9567                         val="$define"
9568                 else
9569                         echo "It can't, sorry."
9570                         case "$d_memmove" in
9571                         "$define") echo "But that's Ok since you have memmove()." ;;
9572                         esac
9573                 fi
9574         else
9575                 echo "(I can't compile the test program, so we'll assume not...)"
9576                 case "$d_memmove" in
9577                 "$define") echo "But that's Ok since you have memmove()." ;;
9578                 esac
9579         fi
9580         ;;
9581 esac
9582 $rm -f try.* try core
9583 set d_safemcpy
9584 eval $setvar
9585
9586 : can memcmp be trusted to compare relative magnitude?
9587 val="$undef"
9588 case "$d_memcmp" in
9589 "$define")
9590         echo " "
9591         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9592         $cat >try.c <<EOCP
9593 #$i_memory I_MEMORY
9594 #$i_stdlib I_STDLIB
9595 #$i_string I_STRING
9596 #$i_unistd I_UNISTD
9597 EOCP
9598         $cat >>try.c <<'EOCP'
9599 #include <stdio.h>
9600 #ifdef I_MEMORY
9601 #  include <memory.h>
9602 #endif
9603 #ifdef I_STDLIB
9604 #  include <stdlib.h>
9605 #endif
9606 #ifdef I_STRING
9607 #  include <string.h>
9608 #else
9609 #  include <strings.h>
9610 #endif
9611 #ifdef I_UNISTD
9612 #  include <unistd.h>  /* Needed for NetBSD */
9613 #endif
9614 int main()
9615 {
9616 char a = -1;
9617 char b = 0;
9618 if ((a < b) && memcmp(&a, &b, 1) < 0)
9619         exit(1);
9620 exit(0);
9621 }
9622 EOCP
9623         set try
9624         if eval $compile_ok; then
9625                 if ./try 2>/dev/null; then
9626                         echo "Yes, it can."
9627                         val="$define"
9628                 else
9629                         echo "No, it can't (it uses signed chars)."
9630                 fi
9631         else
9632                 echo "(I can't compile the test program, so we'll assume not...)"
9633         fi
9634         ;;
9635 esac
9636 $rm -f try.* try core
9637 set d_sanemcmp
9638 eval $setvar
9639
9640 : see if select exists
9641 set select d_select
9642 eval $inlibc
9643
9644 : see if semctl exists
9645 set semctl d_semctl
9646 eval $inlibc
9647
9648 : see if semget exists
9649 set semget d_semget
9650 eval $inlibc
9651
9652 : see if semop exists
9653 set semop d_semop
9654 eval $inlibc
9655
9656 : see how much of the 'sem*(2)' library is present.
9657 h_sem=true
9658 echo " "
9659 case "$d_semctl$d_semget$d_semop" in
9660 *"$undef"*) h_sem=false;;
9661 esac
9662 case "$osname" in
9663 freebsd)
9664     case "`ipcs 2>&1`" in
9665     "SVID messages"*"not configured"*)
9666         echo "Your $osname does not have the sem*(2) configured." >&4
9667         h_sem=false
9668         val="$undef"
9669         set semctl d_semctl
9670         eval $setvar
9671         set semget d_semget
9672         eval $setvar
9673         set semop d_semop
9674         eval $setvar
9675         ;;
9676     esac
9677     ;;
9678 esac
9679 : we could also check for sys/ipc.h ...
9680 if $h_sem && $test `./findhdr sys/sem.h`; then
9681         echo "You have the full sem*(2) library." >&4
9682         val="$define"
9683 else
9684         echo "You don't have the full sem*(2) library." >&4
9685         val="$undef"
9686 fi
9687 set d_sem
9688 eval $setvar
9689
9690 : see whether sys/sem.h defines union semun
9691 echo " "
9692 $cat > try.c <<'END'
9693 #include <sys/types.h>
9694 #include <sys/ipc.h>
9695 #include <sys/sem.h>
9696 int main () { union semun semun; semun.buf = 0; }
9697 END
9698 set try
9699 if eval $compile; then
9700     echo "You have union semun in <sys/sem.h>." >&4
9701     val="$define"
9702 else
9703     echo "You do not have union semun in <sys/sem.h>." >&4
9704     val="$undef"
9705 fi
9706 $rm -f try try.c try.h
9707 set d_union_semun
9708 eval $setvar
9709
9710 : see how to do semctl IPC_STAT
9711 case "$d_sem" in
9712 $define)
9713     : see whether semctl IPC_STAT can use union semun
9714     echo " "
9715     $cat > try.h <<END
9716 #ifndef S_IRUSR
9717 #   ifdef S_IREAD
9718 #       define S_IRUSR S_IREAD
9719 #       define S_IWUSR S_IWRITE
9720 #       define S_IXUSR S_IEXEC
9721 #   else
9722 #       define S_IRUSR 0400
9723 #       define S_IWUSR 0200
9724 #       define S_IXUSR 0100
9725 #   endif
9726 #   define S_IRGRP (S_IRUSR>>3)
9727 #   define S_IWGRP (S_IWUSR>>3)
9728 #   define S_IXGRP (S_IXUSR>>3)
9729 #   define S_IROTH (S_IRUSR>>6)
9730 #   define S_IWOTH (S_IWUSR>>6)
9731 #   define S_IXOTH (S_IXUSR>>6)
9732 #endif
9733 #ifndef S_IRWXU
9734 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9735 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9736 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9737 #endif
9738 END
9739
9740     $cat > try.c <<END
9741 #include <sys/types.h>
9742 #include <sys/ipc.h>
9743 #include <sys/sem.h>
9744 #include <sys/stat.h>
9745 #include <stdio.h>
9746 #include <errno.h>
9747 #include "try.h"
9748 #ifndef errno
9749 extern int errno;
9750 #endif
9751 #$d_union_semun HAS_UNION_SEMUN
9752 int main() {
9753     union semun
9754 #ifndef HAS_UNION_SEMUN
9755     {
9756         int val;
9757         struct semid_ds *buf;
9758         unsigned short *array;
9759     }
9760 #endif
9761     arg;
9762     int sem, st;
9763
9764 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9765     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9766     if (sem > -1) {
9767         struct semid_ds argbuf;
9768         arg.buf = &argbuf;
9769 #       ifdef IPC_STAT
9770         st = semctl(sem, 0, IPC_STAT, arg);
9771         if (st == 0)
9772             printf("semun\n");
9773         else
9774 #       endif /* IPC_STAT */
9775             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9776 #       ifdef IPC_RMID
9777         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9778 #       endif /* IPC_RMID */
9779             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9780     } else
9781 #endif /* IPC_PRIVATE && ... */
9782         printf("semget failed: errno = %d\n", errno);
9783   return 0;
9784 }
9785 END
9786     val="$undef"
9787     set try
9788     if eval $compile; then
9789         xxx=`./try`
9790         case "$xxx" in
9791         semun) val="$define" ;;
9792         esac
9793     fi
9794     $rm -f try try.c
9795     set d_semctl_semun
9796     eval $setvar
9797     case "$d_semctl_semun" in
9798     $define)
9799         echo "You can use union semun for semctl IPC_STAT." >&4
9800         also='also'
9801         ;;
9802     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9803         also=''
9804         ;;
9805     esac
9806
9807     : see whether semctl IPC_STAT can use struct semid_ds pointer
9808     $cat > try.c <<'END'
9809 #include <sys/types.h>
9810 #include <sys/ipc.h>
9811 #include <sys/sem.h>
9812 #include <sys/stat.h>
9813 #include "try.h"
9814 #include <stdio.h>
9815 #include <errno.h>
9816 #ifndef errno
9817 extern int errno;
9818 #endif
9819 int main() {
9820     struct semid_ds arg;
9821     int sem, st;
9822
9823 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9824     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9825     if (sem > -1) {
9826 #       ifdef IPC_STAT
9827         st = semctl(sem, 0, IPC_STAT, &arg);
9828         if (st == 0)
9829             printf("semid_ds\n");
9830         else
9831 #       endif /* IPC_STAT */
9832             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9833 #       ifdef IPC_RMID
9834         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9835 #       endif /* IPC_RMID */
9836             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9837     } else
9838 #endif /* IPC_PRIVATE && ... */
9839         printf("semget failed: errno = %d\n", errno);
9840
9841     return 0;
9842 }
9843 END
9844     val="$undef"
9845     set try
9846     if eval $compile; then
9847         xxx=`./try`
9848         case "$xxx" in
9849         semid_ds) val="$define" ;;
9850         esac
9851     fi
9852     $rm -f try try.c
9853     set d_semctl_semid_ds
9854     eval $setvar
9855     case "$d_semctl_semid_ds" in
9856     $define)
9857         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
9858         ;;
9859     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
9860         ;;
9861     esac
9862     $rm -f try.h
9863     ;;
9864 *)  val="$undef"
9865
9866     # We do not have the full sem*(2) library, so assume we can not
9867     # use either.
9868
9869     set d_semctl_semun
9870     eval $setvar
9871
9872     set d_semctl_semid_ds
9873     eval $setvar
9874     ;;
9875 esac
9876
9877 : see if setegid exists
9878 set setegid d_setegid
9879 eval $inlibc
9880
9881 : see if seteuid exists
9882 set seteuid d_seteuid
9883 eval $inlibc
9884
9885 : see if setgrent exists
9886 set setgrent d_setgrent
9887 eval $inlibc
9888
9889 : see if sethostent exists
9890 set sethostent d_sethent
9891 eval $inlibc
9892
9893 : see if setlinebuf exists
9894 set setlinebuf d_setlinebuf
9895 eval $inlibc
9896
9897 : see if setlocale exists
9898 set setlocale d_setlocale
9899 eval $inlibc
9900
9901 : see if setnetent exists
9902 set setnetent d_setnent
9903 eval $inlibc
9904
9905 : see if setprotoent exists
9906 set setprotoent d_setpent
9907 eval $inlibc
9908
9909 : see if setpgid exists
9910 set setpgid d_setpgid
9911 eval $inlibc
9912
9913 : see if setpgrp2 exists
9914 set setpgrp2 d_setpgrp2
9915 eval $inlibc
9916
9917 : see if setpriority exists
9918 set setpriority d_setprior
9919 eval $inlibc
9920
9921 : see if setpwent exists
9922 set setpwent d_setpwent
9923 eval $inlibc
9924
9925 : see if setregid exists
9926 set setregid d_setregid
9927 eval $inlibc
9928 set setresgid d_setresgid
9929 eval $inlibc
9930
9931 : see if setreuid exists
9932 set setreuid d_setreuid
9933 eval $inlibc
9934 set setresuid d_setresuid
9935 eval $inlibc
9936
9937 : see if setrgid exists
9938 set setrgid d_setrgid
9939 eval $inlibc
9940
9941 : see if setruid exists
9942 set setruid d_setruid
9943 eval $inlibc
9944
9945 : see if setservent exists
9946 set setservent d_setsent
9947 eval $inlibc
9948
9949 : see if setsid exists
9950 set setsid d_setsid
9951 eval $inlibc
9952
9953 : see if setspent exists
9954 set setspent d_setspent
9955 eval $inlibc
9956
9957 : see if setvbuf exists
9958 set setvbuf d_setvbuf
9959 eval $inlibc
9960
9961 : see if sfio.h is available
9962 set sfio.h i_sfio
9963 eval $inhdr
9964
9965
9966 : see if sfio library is available
9967 case "$i_sfio" in
9968 $define)
9969         val=''
9970         set sfreserve val
9971         eval $inlibc
9972         ;;
9973 *)
9974         val="$undef"
9975         ;;
9976 esac
9977 : Ok, but do we want to use it.
9978 case "$val" in
9979 $define)
9980         case "$usesfio" in
9981         true|$define|[yY]*) dflt='y';;
9982         *) dflt='n';;
9983         esac
9984         echo "$package can use the sfio library, but it is experimental."
9985         rp="You seem to have sfio available, do you want to try using it?"
9986         . ./myread
9987         case "$ans" in
9988         y|Y) ;;
9989         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
9990                 val="$undef"
9991                 : Remove sfio from list of libraries to use
9992                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
9993                 shift
9994                 libs="$*"
9995                 echo "libs = $libs" >&4
9996                 ;;
9997         esac
9998         ;;
9999 *)      case "$usesfio" in
10000         true|$define|[yY]*)
10001                 echo "Sorry, cannot find sfio on this machine" >&4
10002                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10003                 ;;
10004         esac
10005         ;;
10006 esac
10007 set d_sfio
10008 eval $setvar
10009 case "$d_sfio" in
10010 $define) usesfio='true';;
10011 *) usesfio='false';;
10012 esac
10013
10014 : see if shmctl exists
10015 set shmctl d_shmctl
10016 eval $inlibc
10017
10018 : see if shmget exists
10019 set shmget d_shmget
10020 eval $inlibc
10021
10022 : see if shmat exists
10023 set shmat d_shmat
10024 eval $inlibc
10025 : see what shmat returns
10026 case "$d_shmat" in
10027 "$define")
10028         $cat >shmat.c <<'END'
10029 #include <sys/shm.h>
10030 void *shmat();
10031 END
10032         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10033                 shmattype='void *'
10034         else
10035                 shmattype='char *'
10036         fi
10037         echo "and it returns ($shmattype)." >&4
10038         : see if a prototype for shmat is available
10039         xxx=`./findhdr sys/shm.h`
10040         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10041         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10042                 val="$define"
10043         else
10044                 val="$undef"
10045         fi
10046         $rm -f shmat.[co]
10047         ;;
10048 *)
10049         val="$undef"
10050         ;;
10051 esac
10052 set d_shmatprototype
10053 eval $setvar
10054
10055 : see if shmdt exists
10056 set shmdt d_shmdt
10057 eval $inlibc
10058
10059 : see how much of the 'shm*(2)' library is present.
10060 h_shm=true
10061 echo " "
10062 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10063 *"$undef"*) h_shm=false;;
10064 esac
10065 case "$osname" in
10066 freebsd)
10067     case "`ipcs 2>&1`" in
10068     "SVID shared memory"*"not configured"*)
10069         echo "Your $osname does not have the shm*(2) configured." >&4
10070         h_shm=false
10071         val="$undef"
10072         set shmctl d_shmctl
10073         evat $setvar
10074         set shmget d_shmget
10075         evat $setvar
10076         set shmat d_shmat
10077         evat $setvar
10078         set shmdt d_shmdt
10079         evat $setvar
10080         ;;
10081     esac
10082     ;;
10083 esac
10084 : we could also check for sys/ipc.h ...
10085 if $h_shm && $test `./findhdr sys/shm.h`; then
10086         echo "You have the full shm*(2) library." >&4
10087         val="$define"
10088 else
10089         echo "You don't have the full shm*(2) library." >&4
10090         val="$undef"
10091 fi
10092 set d_shm
10093 eval $setvar
10094
10095 echo " "
10096 : see if we have sigaction
10097 if set sigaction val -f d_sigaction; eval $csym; $val; then
10098         echo 'sigaction() found.' >&4
10099         $cat > try.c <<'EOP'
10100 #include <stdio.h>
10101 #include <sys/types.h>
10102 #include <signal.h>
10103 int main()
10104 {
10105     struct sigaction act, oact;
10106 }
10107 EOP
10108         set try
10109         if eval $compile_ok; then
10110                 val="$define"
10111         else
10112                 echo "But you don't seem to have a useable struct sigaction." >&4
10113                 val="$undef"
10114         fi
10115 else
10116         echo 'sigaction NOT found.' >&4
10117         val="$undef"
10118 fi
10119 set d_sigaction; eval $setvar
10120 $rm -f try try$_o try.c
10121
10122 : see if sigsetjmp exists
10123 echo " "
10124 case "$d_sigsetjmp" in
10125 '')
10126         $cat >try.c <<'EOP'
10127 #include <setjmp.h>
10128 sigjmp_buf env;
10129 int set = 1;
10130 int main()
10131 {
10132         if (sigsetjmp(env,1))
10133                 exit(set);
10134         set = 0;
10135         siglongjmp(env, 1);
10136         exit(1);
10137 }
10138 EOP
10139         set try
10140         if eval $compile; then
10141                 if ./try >/dev/null 2>&1; then
10142                         echo "POSIX sigsetjmp found." >&4
10143                         val="$define"
10144                 else
10145                         $cat >&4 <<EOM
10146 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10147 I'll ignore them.
10148 EOM
10149                         val="$undef"
10150                 fi
10151         else
10152                 echo "sigsetjmp not found." >&4
10153                 val="$undef"
10154         fi
10155         ;;
10156 *) val="$d_sigsetjmp"
10157         case "$d_sigsetjmp" in
10158         $define) echo "POSIX sigsetjmp found." >&4;;
10159         $undef) echo "sigsetjmp not found." >&4;;
10160         esac
10161         ;;
10162 esac
10163 set d_sigsetjmp
10164 eval $setvar
10165 $rm -f try.c try
10166
10167 : see if sys/stat.h is available
10168 set sys/stat.h i_sysstat
10169 eval $inhdr
10170
10171 : see if stat knows about block sizes
10172 echo " "
10173 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10174 eval $hasfield
10175
10176 : see if _ptr and _cnt from stdio act std
10177 echo " "
10178 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10179         echo "(Looks like you have stdio.h from Linux.)"
10180         case "$stdio_ptr" in
10181         '') stdio_ptr='((fp)->_IO_read_ptr)'
10182                 ptr_lval=$define
10183                 ;;
10184         *)      ptr_lval=$d_stdio_ptr_lval;;
10185         esac
10186         case "$stdio_cnt" in
10187         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10188                 cnt_lval=$undef
10189                 ;;
10190         *)      cnt_lval=$d_stdio_cnt_lval;;
10191         esac
10192         case "$stdio_base" in
10193         '') stdio_base='((fp)->_IO_read_base)';;
10194         esac
10195         case "$stdio_bufsiz" in
10196         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10197         esac
10198 else
10199         case "$stdio_ptr" in
10200         '') stdio_ptr='((fp)->_ptr)'
10201                 ptr_lval=$define
10202                 ;;
10203         *)      ptr_lval=$d_stdio_ptr_lval;;
10204         esac
10205         case "$stdio_cnt" in
10206         '') stdio_cnt='((fp)->_cnt)'
10207                 cnt_lval=$define
10208                 ;;
10209         *)      cnt_lval=$d_stdio_cnt_lval;;
10210         esac
10211         case "$stdio_base" in
10212         '') stdio_base='((fp)->_base)';;
10213         esac
10214         case "$stdio_bufsiz" in
10215         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10216         esac
10217 fi
10218 : test whether _ptr and _cnt really work
10219 echo "Checking how std your stdio is..." >&4
10220 $cat >try.c <<EOP
10221 #include <stdio.h>
10222 #define FILE_ptr(fp)    $stdio_ptr
10223 #define FILE_cnt(fp)    $stdio_cnt
10224 int main() {
10225         FILE *fp = fopen("try.c", "r");
10226         char c = getc(fp);
10227         if (
10228                 18 <= FILE_cnt(fp) &&
10229                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10230         )
10231                 exit(0);
10232         exit(1);
10233 }
10234 EOP
10235 val="$undef"
10236 set try
10237 if eval $compile; then
10238         if ./try; then
10239                 echo "Your stdio acts pretty std."
10240                 val="$define"
10241         else
10242                 echo "Your stdio isn't very std."
10243         fi
10244 else
10245         echo "Your stdio doesn't appear very std."
10246 fi
10247 $rm -f try.c try
10248 set d_stdstdio
10249 eval $setvar
10250
10251 : Can _ptr be used as an lvalue?
10252 case "$d_stdstdio$ptr_lval" in
10253 $define$define) val=$define ;;
10254 *) val=$undef ;;
10255 esac
10256 set d_stdio_ptr_lval
10257 eval $setvar
10258
10259 : Can _cnt be used as an lvalue?
10260 case "$d_stdstdio$cnt_lval" in
10261 $define$define) val=$define ;;
10262 *) val=$undef ;;
10263 esac
10264 set d_stdio_cnt_lval
10265 eval $setvar
10266
10267 : see if _base is also standard
10268 val="$undef"
10269 case "$d_stdstdio" in
10270 $define)
10271         $cat >try.c <<EOP
10272 #include <stdio.h>
10273 #define FILE_base(fp)   $stdio_base
10274 #define FILE_bufsiz(fp) $stdio_bufsiz
10275 int main() {
10276         FILE *fp = fopen("try.c", "r");
10277         char c = getc(fp);
10278         if (
10279                 19 <= FILE_bufsiz(fp) &&
10280                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10281         )
10282                 exit(0);
10283         exit(1);
10284 }
10285 EOP
10286         set try
10287         if eval $compile; then
10288                 if ./try; then
10289                         echo "And its _base field acts std."
10290                         val="$define"
10291                 else
10292                         echo "But its _base field isn't std."
10293                 fi
10294         else
10295                 echo "However, it seems to be lacking the _base field."
10296         fi
10297         $rm -f try.c try
10298         ;;
10299 esac
10300 set d_stdiobase
10301 eval $setvar
10302
10303 $cat >&4 <<EOM
10304 Checking how to access stdio streams by file descriptor number...
10305 EOM
10306 case "$stdio_stream_array" in
10307 '')     $cat >try.c <<EOCP
10308 #include <stdio.h>
10309 int main() {
10310   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10311     printf("yes\n");
10312 }
10313 EOCP
10314         for s in _iob __iob __sF
10315         do
10316                 set try -DSTDIO_STREAM_ARRAY=$s
10317                 if eval $compile; then
10318                         case "`./try$exe_ext`" in
10319                         yes)    stdio_stream_array=$s; break ;;
10320                         esac
10321                 fi
10322         done
10323         $rm -f try.* try$exe_ext
10324 esac
10325 case "$stdio_stream_array" in
10326 '')     $cat >&4 <<EOM
10327 I can't figure out how to access stdio streams by file descriptor number.
10328 EOM
10329         d_stdio_stream_array="$undef"
10330         ;;
10331 *)      $cat >&4 <<EOM
10332 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10333 EOM
10334         d_stdio_stream_array="$define"
10335         ;;
10336 esac
10337
10338 : see if strcoll exists
10339 set strcoll d_strcoll
10340 eval $inlibc
10341
10342 : check for structure copying
10343 echo " "
10344 echo "Checking to see if your C compiler can copy structs..." >&4
10345 $cat >try.c <<'EOCP'
10346 int main()
10347 {
10348         struct blurfl {
10349                 int dyick;
10350         } foo, bar;
10351
10352         foo = bar;
10353 }
10354 EOCP
10355 if $cc -c try.c >/dev/null 2>&1 ; then
10356         val="$define"
10357         echo "Yup, it can."
10358 else
10359         val="$undef"
10360         echo "Nope, it can't."
10361 fi
10362 set d_strctcpy
10363 eval $setvar
10364 $rm -f try.*
10365
10366 : see if strerror and/or sys_errlist[] exist
10367 echo " "
10368 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10369     if set strerror val -f d_strerror; eval $csym; $val; then
10370                 echo 'strerror() found.' >&4
10371                 d_strerror="$define"
10372                 d_strerrm='strerror(e)'
10373                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10374                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10375                         d_syserrlst="$define"
10376                 else
10377                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10378                         d_syserrlst="$undef"
10379                 fi
10380     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10381                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10382                 echo 'strerror() found in string header.' >&4
10383                 d_strerror="$define"
10384                 d_strerrm='strerror(e)'
10385                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10386                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10387                                 d_syserrlst="$define"
10388                 else
10389                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10390                         d_syserrlst="$undef"
10391                 fi
10392     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10393                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10394                 d_strerror="$undef"
10395                 d_syserrlst="$define"
10396                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10397     else
10398                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10399                 d_strerror="$undef"
10400                 d_syserrlst="$undef"
10401                 d_strerrm='"unknown"'
10402     fi
10403 fi
10404
10405 : see if strtod exists
10406 set strtod d_strtod
10407 eval $inlibc
10408
10409 : see if strtol exists
10410 set strtol d_strtol
10411 eval $inlibc
10412
10413 : see if strtoul exists
10414 set strtoul d_strtoul
10415 eval $inlibc
10416
10417 : see if strtoull exists
10418 set strtoull d_strtoull
10419 eval $inlibc
10420
10421 : see if strxfrm exists
10422 set strxfrm d_strxfrm
10423 eval $inlibc
10424
10425 : see if symlink exists
10426 set symlink d_symlink
10427 eval $inlibc
10428
10429 : see if syscall exists
10430 set syscall d_syscall
10431 eval $inlibc
10432
10433 : see if sysconf exists
10434 set sysconf d_sysconf
10435 eval $inlibc
10436
10437 : see if system exists
10438 set system d_system
10439 eval $inlibc
10440
10441 : see if tcgetpgrp exists
10442 set tcgetpgrp d_tcgetpgrp
10443 eval $inlibc
10444
10445 : see if tcsetpgrp exists
10446 set tcsetpgrp d_tcsetpgrp
10447 eval $inlibc
10448
10449 : see if sys/types.h has to be included
10450 set sys/types.h i_systypes
10451 eval $inhdr
10452
10453 : see if prototype for telldir is available
10454 echo " "
10455 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10456 eval $hasproto
10457
10458 : define an is-a-typedef? function
10459 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10460 case "$inclist" in
10461 "") inclist="sys/types.h";;
10462 esac;
10463 eval "varval=\$$var";
10464 case "$varval" in
10465 "")
10466         $rm -f temp.c;
10467         for inc in $inclist; do
10468                 echo "#include <$inc>" >>temp.c;
10469         done;
10470         echo "#ifdef $type" >> temp.c;
10471         echo "printf(\"We have $type\");" >> temp.c;
10472         echo "#endif" >> temp.c;
10473         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10474         if $contains $type temp.E >/dev/null 2>&1; then
10475                 eval "$var=\$type";
10476         else
10477                 eval "$var=\$def";
10478         fi;
10479         $rm -f temp.?;;
10480 *) eval "$var=\$varval";;
10481 esac'
10482
10483 : define an is-a-typedef? function that prompts if the type is not available.
10484 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10485 case "$inclist" in
10486 "") inclist="sys/types.h";;
10487 esac;
10488 eval "varval=\$$var";
10489 case "$varval" in
10490 "")
10491         $rm -f temp.c;
10492         for inc in $inclist; do
10493                 echo "#include <$inc>" >>temp.c;
10494         done;
10495         echo "#ifdef $type" >> temp.c;
10496         echo "printf(\"We have $type\");" >> temp.c;
10497         echo "#endif" >> temp.c;
10498         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10499         echo " " ;
10500         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10501         if $contains $type temp.E >/dev/null 2>&1; then
10502                 echo "$type found." >&4;
10503                 eval "$var=\$type";
10504         else
10505                 echo "$type NOT found." >&4;
10506                 dflt="$def";
10507                 . ./myread ;
10508                 eval "$var=\$ans";
10509         fi;
10510         $rm -f temp.?;;
10511 *) eval "$var=\$varval";;
10512 esac'
10513
10514 : see if this is a sys/times.h system
10515 set sys/times.h i_systimes
10516 eval $inhdr
10517
10518 : see if times exists
10519 echo " "
10520 if set times val -f d_times; eval $csym; $val; then
10521         echo 'times() found.' >&4
10522         d_times="$define"
10523         inc=''
10524         case "$i_systimes" in
10525         "$define") inc='sys/times.h';;
10526         esac
10527         rp="What is the type returned by times() on this system?"
10528         set clock_t clocktype long stdio.h sys/types.h $inc
10529         eval $typedef_ask
10530 else
10531         echo 'times() NOT found, hope that will do.' >&4
10532         d_times="$undef"
10533         clocktype='int'
10534 fi
10535
10536 : see if truncate exists
10537 set truncate d_truncate
10538 eval $inlibc
10539
10540 : see if tzname[] exists
10541 echo " "
10542 if set tzname val -a d_tzname; eval $csym; $val; then
10543         val="$define"
10544         echo 'tzname[] found.' >&4
10545 else
10546         val="$undef"
10547         echo 'tzname[] NOT found.' >&4
10548 fi
10549 set d_tzname
10550 eval $setvar
10551
10552 : see if umask exists
10553 set umask d_umask
10554 eval $inlibc
10555
10556 : backward compatibility for d_hvfork
10557 if test X$d_hvfork != X; then
10558         d_vfork="$d_hvfork"
10559         d_hvfork=''
10560 fi
10561 : see if there is a vfork
10562 val=''
10563 set vfork val
10564 eval $inlibc
10565
10566 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10567 : perl on Solaris 2.x, and probably elsewhere.
10568 case "$val" in
10569 $define)
10570         echo " "
10571         case "$usevfork" in
10572         false) dflt='n';;
10573         *) dflt='y';;
10574         esac
10575         cat <<'EOM'
10576  
10577 Perl can only use a vfork() that doesn't suffer from strict
10578 restrictions on calling functions or modifying global data in
10579 the child.  For example, glibc-2.1 contains such a vfork()
10580 that is unsuitable.  If your system provides a proper fork()
10581 call, chances are that you do NOT want perl to use vfork().
10582
10583 EOM
10584         rp="Do you still want to use vfork()?"
10585         . ./myread
10586         case "$ans" in
10587         y|Y) ;;
10588         *)
10589                 echo "Ok, we won't use vfork()."
10590                 val="$undef"
10591                 ;;
10592         esac
10593         ;;
10594 esac
10595 set d_vfork
10596 eval $setvar
10597 case "$d_vfork" in
10598 $define) usevfork='true';;
10599 *) usevfork='false';;
10600 esac
10601
10602 : see if this is an sysdir system
10603 set sys/dir.h i_sysdir
10604 eval $inhdr
10605
10606 : see if this is an sysndir system
10607 set sys/ndir.h i_sysndir
10608 eval $inhdr
10609
10610 : see if closedir exists
10611 set closedir d_closedir
10612 eval $inlibc
10613
10614 case "$d_closedir" in
10615 "$define")
10616         echo " "
10617         echo "Checking whether closedir() returns a status..." >&4
10618         cat > closedir.c <<EOM
10619 #$i_dirent I_DIRENT             /**/
10620 #$i_sysdir I_SYS_DIR            /**/
10621 #$i_sysndir I_SYS_NDIR          /**/
10622 #$i_systypes I_SYS_TYPES        /**/
10623
10624 #if defined(I_SYS_TYPES)
10625 #include <sys/types.h>
10626 #endif
10627 #if defined(I_DIRENT)
10628 #include <dirent.h>
10629 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10630 #include <sys/dir.h>
10631 #endif
10632 #else
10633 #ifdef I_SYS_NDIR
10634 #include <sys/ndir.h>
10635 #else
10636 #ifdef I_SYS_DIR
10637 #ifdef hp9000s500
10638 #include <ndir.h>       /* may be wrong in the future */
10639 #else
10640 #include <sys/dir.h>
10641 #endif
10642 #endif
10643 #endif
10644 #endif 
10645 int main() { return closedir(opendir(".")); }
10646 EOM
10647         set closedir
10648         if eval $compile_ok; then
10649                 if ./closedir > /dev/null 2>&1 ; then
10650                         echo "Yes, it does."
10651                         val="$undef"
10652                 else
10653                         echo "No, it doesn't."
10654                         val="$define"
10655                 fi
10656         else
10657                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10658                 val="$define"
10659         fi
10660         ;;
10661 *)
10662         val="$undef";
10663         ;;
10664 esac
10665 set d_void_closedir
10666 eval $setvar
10667 $rm -f closedir*
10668 : check for volatile keyword
10669 echo " "
10670 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10671 $cat >try.c <<'EOCP'
10672 int main()
10673 {
10674         typedef struct _goo_struct goo_struct;
10675         goo_struct * volatile goo = ((goo_struct *)0);
10676         struct _goo_struct {
10677                 long long_int;
10678                 int reg_int;
10679                 char char_var;
10680         };
10681         typedef unsigned short foo_t;
10682         char *volatile foo;
10683         volatile int bar;
10684         volatile foo_t blech;
10685         foo = foo;
10686 }
10687 EOCP
10688 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10689         val="$define"
10690         echo "Yup, it does."
10691 else
10692         val="$undef"
10693         echo "Nope, it doesn't."
10694 fi
10695 set d_volatile
10696 eval $setvar
10697 $rm -f try.*
10698
10699 : see if there is a wait4
10700 set wait4 d_wait4
10701 eval $inlibc
10702
10703 : see if waitpid exists
10704 set waitpid d_waitpid
10705 eval $inlibc
10706
10707 : see if wcstombs exists
10708 set wcstombs d_wcstombs
10709 eval $inlibc
10710
10711 : see if wctomb exists
10712 set wctomb d_wctomb
10713 eval $inlibc
10714
10715 : see if writev exists
10716 set writev d_writev
10717 eval $inlibc
10718
10719 : preserve RCS keywords in files with variable substitution, grrr
10720 Date='$Date'
10721 Id='$Id'
10722 Log='$Log'
10723 RCSfile='$RCSfile'
10724 Revision='$Revision'
10725
10726 case "$crosscompile" in
10727 ''|[nN]*) crosscompile="$undef" ;;
10728 esac
10729
10730 case "$osname" in
10731 next|rhapsody) multiarch="$define" ;;
10732 esac
10733 case "$multiarch" in
10734 ''|[nN]*) multiarch="$undef" ;;
10735 esac
10736
10737 : check for alignment requirements
10738 echo " "
10739 case "$crosscompile$multiarch" in
10740 *$define*)
10741         $cat <<EOM
10742 You seem to be either cross-compiling or doing a multiarchitecture build,
10743 skipping the memory alignment check.
10744
10745 EOM
10746         case "$alignbytes" in
10747         '') alignbytes=8 ;;
10748         esac
10749         ;;
10750 *)
10751         case "$alignbytes" in
10752         '') echo "Checking alignment constraints..." >&4
10753                 $cat >try.c <<'EOCP'
10754 struct foobar {
10755         char foo;
10756         double bar;
10757 } try_algn;
10758 int main()
10759 {
10760         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10761 }
10762 EOCP
10763                 set try
10764                 if eval $compile_ok; then
10765                         dflt=`./try`
10766                 else
10767                         dflt='8'
10768                         echo "(I can't seem to compile the test program...)"
10769                 fi
10770                 ;;
10771         *) dflt="$alignbytes"
10772                 ;;
10773         esac
10774         rp="Doubles must be aligned on a how-many-byte boundary?"
10775         . ./myread
10776         alignbytes="$ans"
10777         $rm -f try.c try
10778         ;;
10779 esac
10780
10781
10782 : check for ordering of bytes in a long
10783 echo " "
10784 case "$crosscompile$multiarch" in
10785 *$define*)
10786         $cat <<EOM
10787 You seem to be either cross-compiling or doing a multiarchitecture build,
10788 skipping the byteorder check.
10789
10790 EOM
10791         byteorder='0xffff'
10792         ;;
10793 *)
10794         case "$byteorder" in
10795         '')
10796                 $cat <<'EOM'
10797 In the following, larger digits indicate more significance.  A big-endian
10798 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10799 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10800 machines may have weird orders like 3412.  A Cray will report 87654321,
10801 an Alpha will report 12345678. If the test program works the default is
10802 probably right.
10803 I'm now running the test program...
10804 EOM
10805                 $cat >try.c <<'EOCP'
10806 #include <stdio.h>
10807 int main()
10808 {
10809         int i;
10810         union {
10811                 unsigned long l;
10812                 char c[sizeof(long)];
10813         } u;
10814
10815         if (sizeof(long) > 4)
10816                 u.l = (0x08070605L << 32) | 0x04030201L;
10817         else
10818                 u.l = 0x04030201L;
10819         for (i = 0; i < sizeof(long); i++)
10820                 printf("%c", u.c[i]+'0');
10821         printf("\n");
10822         exit(0);
10823 }
10824 EOCP
10825                 xxx_prompt=y
10826                 set try
10827                 if eval $compile && ./try > /dev/null; then
10828                         dflt=`./try`
10829                         case "$dflt" in
10830                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10831                                 echo "(The test program ran ok.)"
10832                                 echo "byteorder=$dflt"
10833                                 xxx_prompt=n
10834                         ;;
10835                         ????|????????) echo "(The test program ran ok.)" ;;
10836                         *) echo "(The test program didn't run right for some reason.)" ;;
10837                         esac
10838                 else
10839                         dflt='4321'
10840                         cat <<'EOM'
10841 (I can't seem to compile the test program.  Guessing big-endian...)
10842 EOM
10843                 fi
10844                 case "$xxx_prompt" in
10845                 y)
10846                         rp="What is the order of bytes in a long?"
10847                         . ./myread
10848                         byteorder="$ans"
10849                         ;;
10850                 *)      byteorder=$dflt
10851                         ;;
10852                 esac
10853                 ;;
10854         esac
10855         $rm -f try.c try
10856         ;;
10857 esac
10858
10859
10860 : how do we catenate cpp tokens here?
10861 echo " "
10862 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10863 $cat >cpp_stuff.c <<'EOCP'
10864 #define RCAT(a,b)a/**/b
10865 #define ACAT(a,b)a ## b
10866 RCAT(Rei,ser)
10867 ACAT(Cir,cus)
10868 EOCP
10869 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10870 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
10871         echo "Oh!  Smells like ANSI's been here." >&4
10872         echo "We can catify or stringify, separately or together!"
10873         cpp_stuff=42
10874 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
10875         echo "Ah, yes!  The good old days!" >&4
10876         echo "However, in the good old days we don't know how to stringify and"
10877         echo "catify at the same time."
10878         cpp_stuff=1
10879 else
10880         $cat >&4 <<EOM
10881 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
10882 to have to edit the values of CAT[2-5] in config.h...
10883 EOM
10884         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
10885 fi
10886 $rm -f cpp_stuff.*
10887
10888 : see if this is a db.h system
10889 set db.h i_db
10890 eval $inhdr
10891
10892 case "$i_db" in
10893 $define)
10894         : Check db version.
10895         echo " "
10896         echo "Checking Berkeley DB version ..." >&4
10897         $cat >try.c <<EOCP
10898 #$d_const HASCONST
10899 #ifndef HASCONST
10900 #define const
10901 #endif
10902 #include <sys/types.h>
10903 #include <stdio.h>
10904 #include <db.h>
10905 int main()
10906 {
10907 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
10908     int Major, Minor, Patch ;
10909     unsigned long Version ;
10910     (void)db_version(&Major, &Minor, &Patch) ;
10911     printf("You have Berkeley DB Version 2 or greater\n");
10912
10913     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
10914                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
10915     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
10916                 Major, Minor, Patch) ;
10917
10918     /* check that db.h & libdb are compatible */
10919     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
10920         printf("db.h and libdb are incompatible\n") ;
10921         exit(3);        
10922     }
10923
10924     printf("db.h and libdb are compatible\n") ;
10925
10926     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
10927                 + DB_VERSION_PATCH ;
10928
10929     /* needs to be >= 2.3.4 */
10930     if (Version < 2003004) {
10931     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
10932         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
10933         exit(2);        
10934     }
10935
10936     exit(0);
10937 #else
10938 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
10939     printf("You have Berkeley DB Version 1\n");
10940     exit(0);    /* DB version < 2: the coast is clear. */
10941 #else
10942     exit(1);    /* <db.h> not Berkeley DB? */
10943 #endif
10944 #endif
10945 }
10946 EOCP
10947         set try
10948         if eval $compile && ./try; then
10949                 echo 'Looks OK.' >&4
10950         else
10951                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
10952                 i_db=$undef
10953                 case " $libs " in
10954                 *"-ldb "*)
10955                         : Remove db from list of libraries to use
10956                         echo "Removing unusable -ldb from library list" >&4
10957                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
10958                         shift
10959                         libs="$*"
10960                         echo "libs = $libs" >&4
10961                         ;;
10962                 esac
10963         fi
10964         $rm -f try.*
10965         ;;
10966 esac
10967
10968 case "$i_db" in
10969 define)
10970         : Check the return type needed for hash 
10971         echo " "
10972         echo "Checking return type needed for hash for Berkeley DB ..." >&4
10973         $cat >try.c <<EOCP
10974 #$d_const HASCONST
10975 #ifndef HASCONST
10976 #define const
10977 #endif
10978 #include <sys/types.h>
10979 #include <db.h>
10980
10981 #ifndef DB_VERSION_MAJOR
10982 u_int32_t hash_cb (ptr, size)
10983 const void *ptr;
10984 size_t size;
10985 {
10986 }
10987 HASHINFO info;
10988 int main()
10989 {
10990         info.hash = hash_cb;
10991 }
10992 #endif
10993 EOCP
10994         if $cc $ccflags -c try.c >try.out 2>&1 ; then
10995                 if $contains warning try.out >>/dev/null 2>&1 ; then
10996                         db_hashtype='int'
10997                 else
10998                         db_hashtype='u_int32_t'
10999                 fi
11000         else
11001                 : XXX Maybe we should just give up here.
11002                 db_hashtype=u_int32_t
11003                 $cat try.out >&4
11004                 echo "Help:  I can't seem to compile the db test program." >&4
11005                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11006         fi
11007         $rm -f try.*
11008         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11009         ;;
11010 *)      db_hashtype=u_int32_t
11011         ;;
11012 esac
11013 case "$i_db" in
11014 define)
11015         : Check the return type needed for prefix 
11016         echo " "
11017         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11018         cat >try.c <<EOCP
11019 #$d_const HASCONST
11020 #ifndef HASCONST
11021 #define const
11022 #endif
11023 #include <sys/types.h>
11024 #include <db.h>
11025
11026 #ifndef DB_VERSION_MAJOR
11027 size_t prefix_cb (key1, key2)
11028 const DBT *key1;
11029 const DBT *key2;
11030 {
11031 }
11032 BTREEINFO info;
11033 int main()
11034 {
11035         info.prefix = prefix_cb;
11036 }
11037 #endif
11038 EOCP
11039         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11040                 if $contains warning try.out >>/dev/null 2>&1 ; then
11041                         db_prefixtype='int'
11042                 else
11043                         db_prefixtype='size_t'
11044                 fi
11045         else
11046                 db_prefixtype='size_t'
11047                 : XXX Maybe we should just give up here.
11048                 $cat try.out >&4
11049                 echo "Help:  I can't seem to compile the db test program." >&4
11050                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11051         fi
11052         $rm -f try.*
11053         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11054         ;;
11055 *)      db_prefixtype='size_t'
11056         ;;
11057 esac
11058
11059 : check for void type
11060 echo " "
11061 echo "Checking to see how well your C compiler groks the void type..." >&4
11062 case "$voidflags" in
11063 '')
11064         $cat >try.c <<'EOCP'
11065 #if TRY & 1
11066 void sub() {
11067 #else
11068 sub() {
11069 #endif
11070         extern void moo();      /* function returning void */
11071         void (*goo)();          /* ptr to func returning void */
11072 #if TRY & 8
11073         void *hue;              /* generic ptr */
11074 #endif
11075 #if TRY & 2
11076         void (*foo[10])();
11077 #endif
11078
11079 #if TRY & 4
11080         if(goo == moo) {
11081                 exit(0);
11082         }
11083 #endif
11084         exit(0);
11085 }
11086 int main() { sub(); }
11087 EOCP
11088         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11089                 voidflags=$defvoidused
11090         echo "Good.  It appears to support void to the level $package wants.">&4
11091                 if $contains warning .out >/dev/null 2>&1; then
11092                         echo "However, you might get some warnings that look like this:"
11093                         $cat .out
11094                 fi
11095         else
11096 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11097                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11098                         echo "It supports 1..."
11099                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11100                                 echo "It also supports 2..."
11101                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11102                                         voidflags=7
11103                                         echo "And it supports 4 but not 8 definitely."
11104                                 else
11105                                         echo "It doesn't support 4..."
11106                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11107                                                 voidflags=11
11108                                                 echo "But it supports 8."
11109                                         else
11110                                                 voidflags=3
11111                                                 echo "Neither does it support 8."
11112                                         fi
11113                                 fi
11114                         else
11115                                 echo "It does not support 2..."
11116                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11117                                         voidflags=13
11118                                         echo "But it supports 4 and 8."
11119                                 else
11120                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11121                                                 voidflags=5
11122                                                 echo "And it supports 4 but has not heard about 8."
11123                                         else
11124                                                 echo "However it supports 8 but not 4."
11125                                         fi
11126                                 fi
11127                         fi
11128                 else
11129                         echo "There is no support at all for void."
11130                         voidflags=0
11131                 fi
11132         fi
11133 esac
11134 case "$voidflags" in
11135 "$defvoidused") ;;
11136 *)      $cat >&4 <<'EOM'
11137   Support flag bits are:
11138     1: basic void declarations.
11139     2: arrays of pointers to functions returning void.
11140     4: operations between pointers to and addresses of void functions.
11141     8: generic void pointers.
11142 EOM
11143         dflt="$voidflags";
11144         rp="Your void support flags add up to what?"
11145         . ./myread
11146         voidflags="$ans"
11147         ;;
11148 esac
11149 $rm -f try.* .out
11150
11151
11152 : How can we generate normalized random numbers ?
11153 echo " "
11154 echo "Looking for a random number function..." >&4
11155 case "$randfunc" in
11156 '')
11157         if set drand48 val -f; eval $csym; $val; then
11158                 dflt="drand48"
11159                 echo "Good, found drand48()." >&4
11160         elif set random val -f; eval $csym; $val; then
11161                 dflt="random"
11162                 echo "OK, found random()." >&4
11163         else
11164                 dflt="rand"
11165                 echo "Yick, looks like I have to use rand()." >&4
11166         fi
11167         echo " "
11168         ;;
11169 *)
11170         dflt="$randfunc"
11171         ;;
11172 esac
11173 cont=true
11174
11175 case "$ccflags" in
11176 *-Dmy_rand=*|*-Dmy_srand=*)
11177         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11178         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11179         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11180         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11181         ;;
11182 esac
11183
11184 while $test "$cont"; do
11185         rp="Use which function to generate random numbers?"
11186         . ./myread
11187         if $test "$ans" = "$dflt"; then
11188                 : null
11189         else
11190                 randbits=''
11191         fi
11192         randfunc="$ans"
11193         if set $ans val -f; eval $csym; $val; then
11194                 cont=''
11195         else
11196                 dflt=y
11197                 rp="I cannot find function $ans. Use that name anyway?"
11198                 . ./myread
11199                 dflt=rand
11200                 case "$ans" in
11201                         [yY]*) cont='';;
11202                 esac
11203         fi
11204         case "$cont" in
11205         '')
11206                 case "$randfunc" in
11207                 drand48)
11208                         drand01="drand48()"
11209                         seedfunc="srand48"
11210                         randbits=48
11211                         randseedtype=long
11212                         ;;
11213                 rand|random)
11214                         case "$randbits" in
11215                         '')
11216 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11217                                 $cat >try.c <<EOCP
11218 #$i_unistd I_UNISTD
11219 #$i_stdlib I_STDLIB
11220 #include <stdio.h>
11221 #ifdef I_UNISTD
11222 #  include <unistd.h>
11223 #endif
11224 #ifdef I_STDLIB
11225 #  include <stdlib.h>
11226 #endif
11227 int main()
11228 {
11229         register int i;
11230         register unsigned long tmp;
11231         register unsigned long max = 0L;
11232
11233         for (i = 1000; i; i--) {
11234                 tmp = (unsigned long) $randfunc();
11235                 if (tmp > max) max = tmp;
11236         }
11237         for (i = 0; max; i++)
11238                 max /= 2;
11239         printf("%d\n",i);
11240 }
11241 EOCP
11242                                 set try
11243                                 if eval $compile_ok; then
11244                                         dflt=`try`
11245                                 else
11246                                         dflt='?'
11247                                         echo "(I can't seem to compile the test program...)"
11248                                 fi
11249                                 ;;
11250                         *)
11251                                 dflt="$randbits"
11252                                 ;;
11253                         esac
11254                         rp="How many bits does your $randfunc() function produce?"
11255                         . ./myread
11256                         randbits="$ans"
11257                         $rm -f try.c try
11258                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11259                         seedfunc="s$randfunc"
11260                         randseedtype=unsigned
11261                         ;;
11262                 *)
11263                         dflt="31"
11264                         rp="How many bits does your $randfunc() function produce?"
11265                         . ./myread
11266                         randbits="$ans"
11267                         seedfunc="s$randfunc"
11268                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11269                         if set $seedfunc val -f; eval $csym; $val; then
11270                                 echo "(Using $seedfunc() to seed random generator)"
11271                         else
11272                                 echo "(Warning: no $seedfunc() to seed random generator)"
11273                                 seedfunc=rand
11274                         fi
11275                         randseedtype=unsigned
11276                         ;;
11277                 esac
11278                 ;;
11279         esac
11280 done
11281
11282 echo " "
11283 echo "Determining whether or not we are on an EBCDIC system..." >&4
11284 $cat >tebcdic.c <<'EOM'
11285 int main()
11286 {
11287   if ('M'==0xd4) return 0;
11288   return 1;
11289 }
11290 EOM
11291
11292 val=$undef
11293 set tebcdic
11294 if eval $compile_ok; then
11295         if ./tebcdic; then
11296                 echo "You have EBCDIC." >&4
11297                 val="$define"
11298         else
11299                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin, or UTF." >&4
11300         fi
11301 else
11302         echo "I'm unable to compile the test program." >&4
11303         echo "I'll assume ASCII or some ISO Latin." >&4
11304 fi
11305 $rm -f tebcdic.c tebcdic
11306 set ebcdic
11307 eval $setvar
11308
11309 echo " "
11310 $cat >&4 <<EOM
11311 Checking how to flush all pending stdio output...
11312 EOM
11313 # I only know how to find the first 32 possibly open files on SunOS.
11314 # See also hints/sunos_4_1.sh and util.c  --AD
11315 case "$osname" in
11316 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11317 esac
11318 $cat >>try.c <<EOCP
11319 #include <stdio.h>
11320 #$i_unistd I_UNISTD
11321 #ifdef I_UNISTD
11322 # include <unistd.h>
11323 #endif
11324 #$d_sysconf HAS_SYSCONF
11325 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11326 #ifdef HAS_STDIO_STREAM_ARRAY
11327 # define STDIO_STREAM_ARRAY $stdio_stream_array
11328 #endif
11329 int main() {
11330   FILE* p = fopen("try.out", "w");
11331 #ifdef TRY_FPUTC
11332   fputc('x', p);
11333 #else
11334 # ifdef TRY_FPRINTF
11335   fprintf(p, "x");
11336 # endif
11337 #endif
11338 #ifdef TRY_FFLUSH_NULL
11339   fflush(NULL);
11340 #endif
11341 #ifdef TRY_FFLUSH_ALL
11342   {
11343     long open_max = -1;
11344 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11345     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11346 # else
11347 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11348     open_max = sysconf(_SC_OPEN_MAX);
11349 #  else
11350 #   ifdef FOPEN_MAX
11351     open_max = FOPEN_MAX;
11352 #   else
11353 #    ifdef OPEN_MAX
11354     open_max = OPEN_MAX;
11355 #    else
11356 #     ifdef _NFILE
11357     open_max = _NFILE;
11358 #     endif
11359 #    endif
11360 #   endif
11361 #  endif
11362 # endif 
11363 # ifdef HAS_STDIO_STREAM_ARRAY
11364     if (open_max > 0) {
11365       long i;
11366       for (i = 0; i < open_max; i++)
11367             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11368                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11369                 STDIO_STREAM_ARRAY[i]._flag)
11370                 fflush(&STDIO_STREAM_ARRAY[i]);
11371     }   
11372   }
11373 # endif
11374 #endif
11375   _exit(42);
11376 }
11377 EOCP
11378 : first we have to find out how _not_ to flush
11379 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11380     output=''
11381     set try -DTRY_FPUTC
11382     if eval $compile; then
11383             $rm -f try.out
11384             ./try$exe_ext 2>/dev/null
11385             if $test ! -s try.out -a "X$?" = X42; then
11386                 output=-DTRY_FPUTC
11387             fi
11388     fi
11389     case "$output" in
11390     '')
11391             set try -DTRY_FPRINTF
11392             $rm -f try.out
11393             if eval $compile; then
11394                     $rm -f try.out
11395                     ./try$exe_ext 2>/dev/null
11396                     if $test ! -s try.out -a "X$?" = X42; then
11397                         output=-DTRY_FPRINTF
11398                     fi
11399             fi
11400         ;;
11401     esac
11402 fi
11403 : check for fflush NULL behaviour
11404 case "$fflushNULL" in
11405 '')     set try -DTRY_FFLUSH_NULL $output
11406         if eval $compile; then
11407                 $rm -f try.out
11408                 ./try$exe_ext 2>/dev/null
11409                 code="$?"
11410                 if $test -s try.out -a "X$code" = X42; then
11411                         fflushNULL="`$cat try.out`"
11412                 else
11413                         if $test "X$code" != X42; then
11414                                 $cat >&4 <<EOM
11415 (If this test failed, don't worry, we'll try another method shortly.)
11416 EOM
11417                         fi
11418                 fi
11419         fi
11420         $rm -f core try.core core.try.*
11421         case "$fflushNULL" in
11422         x)      $cat >&4 <<EOM
11423 Your fflush(NULL) works okay.
11424 EOM
11425                 fflushNULL="$define"
11426                 ;;
11427         '')     $cat >&4 <<EOM
11428 Your fflush(NULL) isn't working (contrary to ANSI C).
11429 EOM
11430                 fflushNULL="$undef"
11431                 ;;
11432         *)      $cat >&4 <<EOM
11433 Cannot figure out whether your fflush(NULL) works or not.
11434 I'm assuming it doesn't (contrary to ANSI C).
11435 EOM
11436                 fflushNULL="$undef"
11437                 ;;
11438         esac
11439         ;;
11440 $define|true|[yY]*)
11441         fflushNULL="$define"
11442         ;;
11443 *)
11444         fflushNULL="$undef"
11445         ;;
11446 esac
11447 : check explicit looping only if NULL did not work
11448 case "$fflushNULL" in
11449 "$undef")
11450         : check for fflush all behaviour
11451         case "$fflushall" in
11452         '')     set try -DTRY_FFLUSH_ALL $output
11453                 if eval $compile; then
11454                         $cat >&4 <<EOM
11455 (Now testing the other method--but note that also this may fail.)
11456 EOM
11457                         $rm -f try.out
11458                         ./try$exe_ext 2>/dev/null
11459                         if $test -s try.out -a "X$?" = X42; then
11460                                 fflushall="`$cat try.out`"
11461                         fi
11462                 fi
11463                 $rm -f core try.core core.try.*
11464                 case "$fflushall" in
11465                 x)      $cat >&4 <<EOM
11466 Whew. Flushing explicitly all the stdio streams works.
11467 EOM
11468                         fflushall="$define"
11469                         ;;
11470                 '')     $cat >&4 <<EOM
11471 Sigh. Flushing explicitly all the stdio streams doesn't work.
11472 EOM
11473                         fflushall="$undef"
11474                         ;;
11475                 *)      $cat >&4 <<EOM
11476 Cannot figure out whether flushing stdio streams explicitly works or not.
11477 I'm assuming it doesn't.
11478 EOM
11479                         fflushall="$undef"
11480                         ;;
11481                 esac
11482                 ;;
11483         "$define"|true|[yY]*)
11484                 fflushall="$define"
11485                 ;;
11486         *)
11487                 fflushall="$undef"
11488                 ;;
11489         esac
11490         ;;
11491 *)      fflushall="$undef"      
11492         ;;
11493 esac
11494 case "$fflushNULL$fflushall" in
11495 undefundef)
11496         $cat <<EOM
11497 I cannot figure out how to flush pending stdio output.
11498 EOM
11499         ;;
11500 esac
11501 $rm -f try.* try$exe_ext
11502
11503 : see what type file positions are declared as in the library
11504 rp="What is the type for file position used by fsetpos()?"
11505 set fpos_t fpostype long stdio.h sys/types.h
11506 eval $typedef_ask
11507
11508 : Store the full pathname to the ar program for use in the C program
11509 : Respect a hint or command line value for full_ar.
11510 case "$full_ar" in
11511 '') full_ar=$ar ;;
11512 esac
11513
11514 : Store the full pathname to the sed program for use in the C program
11515 full_sed=$sed
11516
11517 : see what type gids are declared as in the kernel
11518 echo " "
11519 echo "Looking for the type for group ids returned by getgid()."
11520 set gid_t gidtype xxx stdio.h sys/types.h
11521 eval $typedef
11522 case "$gidtype" in
11523 xxx)
11524         xxx=`./findhdr sys/user.h`
11525         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11526         case $1 in
11527         unsigned) dflt="$1 $2" ;;
11528         *) dflt="$1" ;;
11529         esac
11530         ;;
11531 *) dflt="$gidtype";;
11532 esac
11533 case "$gidtype" in
11534 gid_t) echo "gid_t found." ;;
11535 *)      rp="What is the type for group ids returned by getgid()?"
11536         . ./myread
11537         gidtype="$ans"
11538         ;;
11539 esac
11540
11541 : see if getgroups exists
11542 set getgroups d_getgrps
11543 eval $inlibc
11544
11545 : see if setgroups exists
11546 set setgroups d_setgrps
11547 eval $inlibc
11548
11549
11550 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11551 echo " "
11552 case "$d_getgrps$d_setgrps" in
11553 *define*)
11554         case "$groupstype" in
11555         '') dflt="$gidtype" ;;
11556         *)  dflt="$groupstype" ;;
11557         esac
11558         $cat <<EOM
11559 What type of pointer is the second argument to getgroups() and setgroups()?
11560 Usually this is the same as group ids, $gidtype, but not always.
11561
11562 EOM
11563         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11564         . ./myread
11565         groupstype="$ans"
11566         ;;
11567 *)  groupstype="$gidtype";;
11568 esac
11569
11570 : see what type lseek is declared as in the kernel
11571 rp="What is the type used for lseek's offset on this system?"
11572 set off_t lseektype long stdio.h sys/types.h
11573 eval $typedef_ask
11574
11575 echo " "
11576 $echo $n "Checking to see how big your file offsets are...$c" >&4
11577 $cat >try.c <<EOCP
11578 #include <sys/types.h>
11579 #include <stdio.h>
11580 int main()
11581 {
11582         printf("%d\n", sizeof($lseektype));
11583 }
11584 EOCP
11585 set try
11586 if eval $compile_ok; then
11587         lseeksize=`./try`
11588         $echo " $lseeksize bytes." >&4
11589 else
11590         dflt='4'
11591         echo " "
11592         echo "(I can't seem to compile the test program.  Guessing...)"
11593         rp="What is the size of your file offsets (in bytes)?"
11594         . ./myread
11595         lseeksize="$ans"
11596 fi
11597 $rm -f try.c try
11598
11599 echo " "
11600 echo "Checking if your $make program sets \$(MAKE)..." >&4
11601 case "$make_set_make" in
11602 '')
11603         $sed 's/^X //' > testmake.mak << 'EOF'
11604 Xall:
11605 X       @echo 'maketemp="$(MAKE)"'
11606 EOF
11607         case "`$make -f testmake.mak 2>/dev/null`" in
11608         *maketemp=*) make_set_make='#' ;;
11609         *)      make_set_make="MAKE=$make" ;;
11610         esac
11611         $rm -f testmake.mak
11612         ;;
11613 esac
11614 case "$make_set_make" in
11615 '#') echo "Yup, it does.";;
11616 *) echo "Nope, it doesn't.";;
11617 esac
11618
11619 : see what type is used for mode_t
11620 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11621 set mode_t modetype int stdio.h sys/types.h
11622 eval $typedef_ask
11623
11624 : define a fucntion to check prototypes
11625 $cat > protochk <<EOSH
11626 $startsh
11627 cc="$cc"
11628 optimize="$optimize"
11629 ccflags="$ccflags"
11630 prototype="$prototype"
11631 define="$define"
11632 rm=$rm
11633 EOSH
11634
11635 $cat >> protochk <<'EOSH'
11636
11637 $rm -f try.c
11638 foo="$1"
11639 shift
11640 while test $# -ge 2; do
11641         case "$1" in
11642                 $define) echo "#include <$2>" >> try.c ;;
11643                 literal) echo "$2" >> try.c ;;
11644         esac
11645     shift 2
11646 done
11647 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11648 cat >> try.c <<'EOCP'
11649 #ifdef CAN_PROTOTYPE
11650 #define _(args) args
11651 #else
11652 #define _(args) ()
11653 #endif
11654 EOCP
11655 echo "$foo" >> try.c
11656 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11657 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11658 status=$?
11659 $rm -f try.[co]
11660 exit $status
11661 EOSH
11662 chmod +x protochk
11663 $eunicefix protochk
11664
11665 : see what type is used for size_t
11666 rp="What is the type used for the length parameter for string functions?"
11667 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11668 eval $typedef_ask
11669
11670 : check for type of arguments to gethostbyaddr. 
11671 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11672         case "$d_gethbyaddr" in
11673         $define)
11674                 $cat <<EOM
11675
11676 Checking to see what type of arguments are accepted by gethostbyaddr().
11677 EOM
11678                 hdrs="$define sys/types.h
11679                         $d_socket sys/socket.h 
11680                         $i_niin netinet/in.h 
11681                         $i_netdb netdb.h
11682                         $i_unistd unistd.h"
11683                 : The first arg can 'char *' or 'void *'
11684                 : The second arg is some of integral type
11685                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11686                         for yyy in size_t long int; do
11687                                 case "$netdb_host_type" in
11688                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11689                                         if ./protochk "$try" $hdrs; then
11690                                                 echo "Your system accepts $xxx for the first arg."
11691                                                 echo "...and $yyy for the second arg."
11692                                                 netdb_host_type="$xxx"
11693                                                 netdb_hlen_type="$yyy"
11694                                         fi
11695                                         ;;
11696                                 esac
11697                         done
11698                 done
11699                 : In case none of those worked, prompt the user.
11700                 case "$netdb_host_type" in
11701                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11702                         dflt='char *'
11703                         . ./myread
11704                         netdb_host_type=$ans
11705                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11706                         dflt="$sizetype"
11707                         . ./myread
11708                         netdb_hlen_type=$ans
11709                         ;;
11710                 esac
11711                 ;;
11712         *)      : no gethostbyaddr, so pick harmless defaults
11713                 netdb_host_type='char *'
11714                 netdb_hlen_type="$sizetype"
11715                 ;;
11716         esac
11717         # Remove the "const" if needed. -- but then we'll have a 
11718         # prototype clash!
11719         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11720 fi
11721
11722 : check for type of argument to gethostbyname. 
11723 if test "X$netdb_name_type" = X ; then
11724         case "$d_gethbyname" in
11725         $define)
11726                 $cat <<EOM
11727
11728 Checking to see what type of argument is accepted by gethostbyname().
11729 EOM
11730                 hdrs="$define sys/types.h
11731                         $d_socket sys/socket.h 
11732                         $i_niin netinet/in.h 
11733                         $i_netdb netdb.h
11734                         $i_unistd unistd.h"
11735                 for xxx in "const char *" "char *"; do
11736                         case "$netdb_name_type" in
11737                         '')     try="extern struct hostent *gethostbyname($xxx);"
11738                                 if ./protochk "$try" $hdrs; then
11739                                         echo "Your system accepts $xxx."
11740                                         netdb_name_type="$xxx"
11741                                 fi
11742                                 ;;
11743                         esac
11744                 done
11745                 : In case none of those worked, prompt the user.
11746                 case "$netdb_name_type" in
11747                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11748                         dflt='char *'
11749                         . ./myread
11750                         netdb_name_type=$ans
11751                         ;;
11752                 esac
11753                 ;;
11754         *)      : no gethostbyname, so pick harmless default
11755                 netdb_name_type='char *'
11756                 ;;
11757         esac
11758 fi
11759
11760 : check for type of 1st argument to getnetbyaddr. 
11761 if test "X$netdb_net_type" = X ; then
11762         case "$d_getnbyaddr" in
11763         $define)
11764                 $cat <<EOM
11765
11766 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11767 EOM
11768                 hdrs="$define sys/types.h
11769                         $d_socket sys/socket.h 
11770                         $i_niin netinet/in.h 
11771                         $i_netdb netdb.h
11772                         $i_unistd unistd.h"
11773                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11774                         case "$netdb_net_type" in
11775                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11776                                 if ./protochk "$try" $hdrs; then
11777                                         echo "Your system accepts $xxx."
11778                                         netdb_net_type="$xxx"
11779                                 fi
11780                                 ;;
11781                         esac
11782                 done
11783                 : In case none of those worked, prompt the user.
11784                 case "$netdb_net_type" in
11785                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11786                         dflt='long'
11787                         . ./myread
11788                         netdb_net_type=$ans
11789                         ;;
11790                 esac
11791                 ;;
11792         *)      : no getnetbyaddr, so pick harmless default
11793                 netdb_net_type='long'
11794                 ;;
11795         esac
11796 fi
11797 : locate the preferred pager for this system
11798 case "$pager" in
11799 '')
11800         dflt=''
11801         case "$pg" in
11802         /*) dflt=$pg;;
11803         esac
11804         case "$more" in
11805         /*) dflt=$more;;
11806         esac
11807         case "$less" in
11808         /*) dflt=$less;;
11809         esac
11810         case "$dflt" in
11811         '') dflt=/usr/ucb/more;;
11812         esac
11813         ;;
11814 *) dflt="$pager";;
11815 esac
11816 echo " "
11817 fn=f/
11818 rp='What pager is used on your system?'
11819 . ./getfile
11820 pager="$ans"
11821
11822 : see what type pids are declared as in the kernel
11823 rp="What is the type of process ids on this system?"
11824 set pid_t pidtype int stdio.h sys/types.h
11825 eval $typedef_ask
11826
11827 : check for length of pointer
11828 echo " "
11829 case "$ptrsize" in
11830 '')
11831         $echo $n "Checking to see how big your pointers are...$c" >&4
11832         if test "$voidflags" -gt 7; then
11833                 echo '#define VOID_PTR char *' > try.c
11834         else
11835                 echo '#define VOID_PTR void *' > try.c
11836         fi
11837         $cat >>try.c <<'EOCP'
11838 #include <stdio.h>
11839 int main()
11840 {
11841         printf("%d\n", sizeof(VOID_PTR));
11842         exit(0);
11843 }
11844 EOCP
11845         set try
11846         if eval $compile_ok; then
11847                 ptrsize=`./try`
11848                 $echo " $ptrsize bytes." >&4
11849         else
11850                 dflt='4'
11851                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
11852                 rp="What is the size of a pointer (in bytes)?"
11853                 . ./myread
11854                 ptrsize="$ans"
11855         fi
11856         ;;
11857 esac
11858 $rm -f try.c try
11859
11860 : see if ar generates random libraries by itself
11861 echo " "
11862 echo "Checking how to generate random libraries on your machine..." >&4
11863 echo 'int bar1() { return bar2(); }' > bar1.c
11864 echo 'int bar2() { return 2; }' > bar2.c
11865 $cat > foo.c <<'EOP'
11866 int main() { printf("%d\n", bar1()); exit(0); }
11867 EOP
11868 $cc $ccflags -c bar1.c >/dev/null 2>&1
11869 $cc $ccflags -c bar2.c >/dev/null 2>&1
11870 $cc $ccflags -c foo.c >/dev/null 2>&1
11871 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11872 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11873         ./foobar >/dev/null 2>&1; then
11874         echo "$ar appears to generate random libraries itself."
11875         orderlib=false
11876         ranlib=":"
11877 elif $ar ts bar$_a >/dev/null 2>&1 &&
11878         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11879         ./foobar >/dev/null 2>&1; then
11880                 echo "a table of contents needs to be added with '$ar ts'."
11881                 orderlib=false
11882                 ranlib="$ar ts"
11883 else
11884         case "$ranlib" in
11885         :) ranlib='';;
11886         '')
11887                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
11888                 $test -f $ranlib || ranlib=''
11889                 ;;
11890         esac
11891         if $test -n "$ranlib"; then
11892                 echo "your system has '$ranlib'; we'll use that."
11893                 orderlib=false
11894         else
11895                 echo "your system doesn't seem to support random libraries"
11896                 echo "so we'll use lorder and tsort to order the libraries."
11897                 orderlib=true
11898                 ranlib=":"
11899         fi
11900 fi
11901 $rm -f foo* bar* 
11902
11903 : check for type of arguments to select. 
11904 case "$selecttype" in
11905 '') case "$d_select" in
11906         $define)
11907                 $cat <<EOM
11908 Checking to see what type of arguments are accepted by select().
11909 EOM
11910                 hdrs="$define sys/types.h
11911                         $i_systime sys/time.h 
11912                         $i_sysselct sys/select.h
11913                         $d_socket sys/socket.h"
11914                 : The first arg can be int, unsigned, or size_t
11915                 : The last arg may or may not be 'const'
11916                 val=''
11917                 : void pointer has been seen but using that
11918                 : breaks the selectminbits test
11919                 for xxx in 'fd_set *' 'int *'; do
11920                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
11921                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
11922                                         case "$val" in
11923                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
11924                                                 if ./protochk "$try" $hdrs; then
11925                                                         echo "Your system accepts $xxx."
11926                                                         val="$xxx"
11927                                                 fi
11928                                                 ;;
11929                                         esac
11930                                 done
11931                         done
11932                 done
11933                 case "$val" in
11934                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
11935                         case "$d_fd_set" in
11936                                 $define) dflt="fd_set *" ;;
11937                                 *)              dflt="int *" ;;
11938                         esac
11939                         . ./myread
11940                         val=$ans
11941                         ;;
11942                 esac
11943                 selecttype="$val"
11944                 ;;
11945         *)      : no select, so pick a harmless default
11946                 selecttype='int *'
11947                 ;;
11948         esac
11949         ;;
11950 esac
11951
11952 : check for the select 'width'
11953 case "$selectminbits" in
11954 '') case "$d_select" in
11955         $define)
11956                 $cat <<EOM
11957
11958 Checking to see on how many bits at a time your select() operates...
11959 EOM
11960                 $cat >try.c <<EOCP
11961 #include <sys/types.h>
11962 #$i_time I_TIME
11963 #$i_systime I_SYS_TIME
11964 #$i_systimek I_SYS_TIME_KERNEL
11965 #ifdef I_TIME
11966 #   include <time.h>
11967 #endif
11968 #ifdef I_SYS_TIME
11969 #   ifdef I_SYS_TIME_KERNEL
11970 #       define KERNEL
11971 #   endif
11972 #   include <sys/time.h>
11973 #   ifdef I_SYS_TIME_KERNEL
11974 #       undef KERNEL
11975 #   endif
11976 #endif
11977 #$i_sysselct I_SYS_SELECT
11978 #ifdef I_SYS_SELECT
11979 #include <sys/select.h>
11980 #endif
11981 #$d_socket HAS_SOCKET
11982 #ifdef HAS_SOCKET
11983 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11984 #endif
11985 #include <stdio.h>
11986 $selecttype b;
11987 #define S sizeof(*(b))
11988 #define MINBITS 64
11989 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
11990 #define NBITS  (NBYTES * 8)
11991 int main() {
11992     char s[NBYTES];
11993     struct timeval t;
11994     int i;
11995     FILE* fp;
11996     int fd;
11997
11998     fclose(stdin);
11999     fp = fopen("try.c", "r");
12000     if (fp == 0)
12001       exit(1);
12002     fd = fileno(fp);
12003     if (fd < 0)
12004       exit(2);
12005     b = ($selecttype)s;
12006     for (i = 0; i < NBITS; i++)
12007         FD_SET(i, b);
12008     t.tv_sec  = 0;
12009     t.tv_usec = 0;
12010     select(fd + 1, b, 0, 0, &t);
12011     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12012     printf("%d\n", i + 1);
12013     return 0;
12014 }
12015 EOCP
12016                 set try
12017                 if eval $compile_ok; then
12018                         selectminbits=`./try`
12019                         case "$selectminbits" in
12020                         '')     cat >&4 <<EOM
12021 Cannot figure out on how many bits at a time your select() operates.
12022 I'll play safe and guess it is 32 bits.
12023 EOM
12024                                 selectminbits=32
12025                                 bits="32 bits"
12026                                 ;;
12027                         1)      bits="1 bit" ;;
12028                         *)      bits="$selectminbits bits" ;;
12029                         esac
12030                         echo "Your select() operates on $bits at a time." >&4
12031                 else
12032                         rp='What is the minimum number of bits your select() operates on?'
12033                         case "$byteorder" in
12034                         1234|12345678)  dflt=32 ;;
12035                         *)              dflt=1  ;;
12036                         esac
12037                         . ./myread
12038                         val=$ans
12039                         selectminbits="$val"
12040                 fi
12041                 $rm -f try.* try
12042                 ;;
12043         *)      : no select, so pick a harmless default
12044                 selectminbits='32'
12045                 ;;
12046         esac
12047         ;;
12048 esac
12049
12050 : Trace out the files included by signal.h, then look for SIGxxx names.
12051 : Remove SIGARRAYSIZE used by HPUX.
12052 : Remove SIGSTKSIZE used by Linux.
12053 : Remove SIGSTKSZ used by Posix.
12054 : Remove SIGTYP void lines used by OS2.
12055 xxx=`echo '#include <signal.h>' |
12056         $cppstdin $cppminus $cppflags 2>/dev/null |
12057         $grep '^[       ]*#.*include' | 
12058         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12059 : Check this list of files to be sure we have parsed the cpp output ok.
12060 : This will also avoid potentially non-existent files, such 
12061 : as ../foo/bar.h
12062 xxxfiles=''
12063 for xx in $xxx /dev/null ; do
12064         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12065 done
12066 : If we have found no files, at least try signal.h
12067 case "$xxxfiles" in
12068 '')     xxxfiles=`./findhdr signal.h` ;;
12069 esac
12070 xxx=`awk '
12071 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12072         print substr($2, 4, 20)
12073 }
12074 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12075         print substr($3, 4, 20)
12076 }' $xxxfiles`
12077 : Append some common names just in case the awk scan failed.
12078 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12079 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12080 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12081 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12082 : generate a few handy files for later
12083 $cat > signal.c <<'EOCP'
12084 #include <sys/types.h>
12085 #include <signal.h>
12086 #include <stdio.h>
12087 int main() {
12088
12089 /* Strange style to avoid deeply-nested #if/#else/#endif */
12090 #ifndef NSIG
12091 #  ifdef _NSIG
12092 #    define NSIG (_NSIG)
12093 #  endif
12094 #endif
12095
12096 #ifndef NSIG
12097 #  ifdef SIGMAX
12098 #    define NSIG (SIGMAX+1)
12099 #  endif
12100 #endif
12101
12102 #ifndef NSIG
12103 #  ifdef SIG_MAX
12104 #    define NSIG (SIG_MAX+1)
12105 #  endif
12106 #endif
12107
12108 #ifndef NSIG
12109 #  ifdef MAXSIG
12110 #    define NSIG (MAXSIG+1)
12111 #  endif
12112 #endif
12113
12114 #ifndef NSIG
12115 #  ifdef MAX_SIG
12116 #    define NSIG (MAX_SIG+1)
12117 #  endif
12118 #endif
12119
12120 #ifndef NSIG
12121 #  ifdef SIGARRAYSIZE
12122 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12123 #  endif
12124 #endif
12125
12126 #ifndef NSIG
12127 #  ifdef _sys_nsig
12128 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12129 #  endif
12130 #endif
12131
12132 /* Default to some arbitrary number that's big enough to get most
12133    of the common signals.
12134 */
12135 #ifndef NSIG
12136 #    define NSIG 50
12137 #endif
12138
12139 printf("NSIG %d\n", NSIG);
12140
12141 #ifndef JUST_NSIG
12142
12143 EOCP
12144
12145 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12146 {
12147         printf "#ifdef SIG"; printf $1; printf "\n"
12148         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12149         printf $1; printf ");\n"
12150         printf "#endif\n"
12151 }
12152 END {
12153         printf "#endif /* JUST_NSIG */\n";
12154         printf "}\n";
12155 }
12156 ' >>signal.c
12157 $cat >signal.awk <<'EOP'
12158 BEGIN { ndups = 0 }
12159 $1 ~ /^NSIG$/ { nsig = $2 }
12160 ($1 !~ /^NSIG$/) && (NF == 2) {
12161     if ($2 > maxsig) { maxsig = $2 }
12162     if (sig_name[$2]) {
12163         dup_name[ndups] = $1
12164         dup_num[ndups] = $2
12165         ndups++ 
12166     }
12167     else {
12168         sig_name[$2] = $1
12169         sig_num[$2] = $2
12170     }
12171 }
12172 END { 
12173     if (nsig == 0) {
12174         nsig = maxsig + 1
12175     }
12176     printf("NSIG %d\n", nsig);
12177     for (n = 1; n < nsig; n++) {
12178         if (sig_name[n]) {
12179             printf("%s %d\n", sig_name[n], sig_num[n])
12180         }
12181         else {
12182             printf("NUM%d %d\n", n, n) 
12183         }
12184     }
12185     for (n = 0; n < ndups; n++) {
12186         printf("%s %d\n", dup_name[n], dup_num[n])
12187     }
12188 }
12189 EOP
12190 $cat >signal_cmd <<EOS
12191 $startsh
12192 if $test -s signal.lst; then
12193     echo "Using your existing signal.lst file"
12194         exit 0
12195 fi
12196 xxx="$xxx"
12197 EOS
12198 $cat >>signal_cmd <<'EOS'
12199
12200 set signal
12201 if eval $compile_ok; then
12202         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12203 else
12204         echo "(I can't seem be able to compile the whole test program)" >&4
12205         echo "(I'll try it in little pieces.)" >&4
12206         set signal -DJUST_NSIG
12207         if eval $compile_ok; then
12208                 ./signal$_exe > signal.nsg
12209                 $cat signal.nsg
12210         else
12211                 echo "I can't seem to figure out how many signals you have." >&4
12212                 echo "Guessing 50." >&4
12213                 echo 'NSIG 50' > signal.nsg
12214         fi
12215         : Now look at all the signal names, one at a time.
12216         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12217                 $cat > signal.c <<EOCP
12218 #include <sys/types.h>
12219 #include <signal.h>
12220 #include <stdio.h>
12221 int main() {
12222 printf("$xx %d\n", SIG${xx});
12223 return 0;
12224 }
12225 EOCP
12226                 set signal
12227                 if eval $compile; then
12228                         echo "SIG${xx} found."
12229                         ./signal$_exe  >> signal.ls1
12230                 else
12231                         echo "SIG${xx} NOT found."
12232                 fi
12233         done
12234         if $test -s signal.ls1; then
12235                 $cat signal.nsg signal.ls1 |
12236                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12237         fi
12238
12239 fi
12240 if $test -s signal.lst; then
12241         :
12242 else
12243         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12244         echo 'kill -l' >signal
12245         set X `csh -f <signal`
12246         $rm -f signal
12247         shift
12248         case $# in
12249         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12250         esac
12251         echo $@ | $tr ' ' $trnl | \
12252             $awk '{ printf "%s %d\n", $1, ++s; }
12253                   END { printf "NSIG %d\n", ++s }' >signal.lst
12254 fi
12255 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12256 EOS
12257 chmod a+x signal_cmd
12258 $eunicefix signal_cmd
12259
12260 : generate list of signal names
12261 echo " "
12262 case "$sig_name_init" in
12263 '') doinit=yes ;;
12264 *)  case "$sig_num_init" in
12265     ''|*,*) doinit=yes ;;
12266     esac ;;
12267 esac
12268 case "$doinit" in
12269 yes)
12270         echo "Generating a list of signal names and numbers..." >&4
12271         . ./signal_cmd
12272         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12273         sig_name=`$awk 'BEGIN { printf "ZERO " }
12274                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12275         sig_num=`$awk  'BEGIN { printf "0 " }
12276                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12277         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12278                              !/^NSIG/   { printf "\"%s\", ", $1 }
12279                              END        { printf "0\n" }' signal.lst`
12280         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12281                              !/^NSIG/   { printf "%d, ", $2}
12282                              END        { printf "0\n"}' signal.lst`
12283         ;;
12284 esac
12285 echo "The following $sig_count signals are available:"
12286 echo " "
12287 echo $sig_name | $awk \
12288 'BEGIN { linelen = 0 }
12289 {
12290         for (i = 1; i <= NF; i++) {
12291                 name = "SIG" $i " "
12292                 linelen = linelen + length(name)
12293                 if (linelen > 70) {
12294                         printf "\n"
12295                         linelen = length(name)
12296                 }
12297                 printf "%s", name
12298         }
12299         printf "\n"
12300 }'
12301 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12302
12303 : see what type is used for signed size_t
12304 set ssize_t ssizetype int stdio.h sys/types.h
12305 eval $typedef
12306 dflt="$ssizetype"
12307 $cat > ssize.c <<EOM
12308 #include <stdio.h>
12309 #include <sys/types.h>
12310 #define Size_t $sizetype
12311 #define SSize_t $dflt
12312 int main()
12313 {
12314         if (sizeof(Size_t) == sizeof(SSize_t))
12315                 printf("$dflt\n");
12316         else if (sizeof(Size_t) == sizeof(int))
12317                 printf("int\n");
12318         else 
12319                 printf("long\n");
12320         exit(0);
12321 }
12322 EOM
12323 echo " "
12324 set ssize
12325 if eval $compile_ok && ./ssize > /dev/null; then
12326         ssizetype=`./ssize`
12327         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12328 else
12329         $cat >&4 <<EOM
12330 Help! I can't compile and run the ssize_t test program: please enlighten me!
12331 (This is probably a misconfiguration in your system or libraries, and
12332 you really ought to fix it.  Still, I'll try anyway.)
12333
12334 I need a type that is the same size as $sizetype, but is guaranteed to
12335 be signed.  Common values are ssize_t, int and long.
12336
12337 EOM
12338         rp="What signed type is the same size as $sizetype?"
12339         . ./myread
12340         ssizetype="$ans"
12341 fi
12342 $rm -f ssize ssize.*
12343
12344 : see what type of char stdio uses.
12345 echo " "
12346 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12347         echo "Your stdio uses unsigned chars." >&4
12348         stdchar="unsigned char"
12349 else
12350         echo "Your stdio uses signed chars." >&4
12351         stdchar="char"
12352 fi
12353
12354 : see if time exists
12355 echo " "
12356 if test "X$d_time" = X -o X"$timetype" = X; then
12357     if set time val -f d_time; eval $csym; $val; then
12358                 echo 'time() found.' >&4
12359                 val="$define"
12360                 rp="What is the type returned by time() on this system?"
12361                 set time_t timetype long stdio.h sys/types.h
12362                 eval $typedef_ask
12363     else
12364                 echo 'time() not found, hope that will do.' >&4
12365                 val="$undef"
12366                 timetype='int';
12367     fi
12368     set d_time
12369     eval $setvar
12370 fi
12371
12372 : see what type uids are declared as in the kernel
12373 echo " "
12374 echo "Looking for the type for user ids returned by getuid()."
12375 set uid_t uidtype xxx stdio.h sys/types.h
12376 eval $typedef
12377 case "$uidtype" in
12378 xxx)
12379         xxx=`./findhdr sys/user.h`
12380         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12381         case $1 in
12382         unsigned) dflt="$1 $2" ;;
12383         *) dflt="$1" ;;
12384         esac
12385         ;;
12386 *) dflt="$uidtype";;
12387 esac
12388 case "$uidtype" in
12389 uid_t)  echo "uid_t found." ;;
12390 *)      rp="What is the type for user ids returned by getuid()?"
12391         . ./myread
12392         uidtype="$ans"
12393         ;;
12394 esac
12395
12396 : see if dbm.h is available
12397 : see if dbmclose exists
12398 set dbmclose d_dbmclose
12399 eval $inlibc
12400
12401 case "$d_dbmclose" in
12402 $define)
12403         set dbm.h i_dbm
12404         eval $inhdr
12405         case "$i_dbm" in
12406         $define)
12407                 val="$undef"
12408                 set i_rpcsvcdbm
12409                 eval $setvar
12410                 ;;
12411         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12412                 eval $inhdr
12413                 ;;
12414         esac
12415         ;;
12416 *)      echo "We won't be including <dbm.h>"
12417         val="$undef"
12418         set i_dbm
12419         eval $setvar
12420         val="$undef"
12421         set i_rpcsvcdbm
12422         eval $setvar
12423         ;;
12424 esac
12425
12426 : see if this is a sys/file.h system
12427 val=''
12428 set sys/file.h val
12429 eval $inhdr
12430
12431 : do we need to include sys/file.h ?
12432 case "$val" in
12433 "$define")
12434         echo " "
12435         if $h_sysfile; then
12436                 val="$define"
12437                 echo "We'll be including <sys/file.h>." >&4
12438         else
12439                 val="$undef"
12440                 echo "We won't be including <sys/file.h>." >&4
12441         fi
12442         ;;
12443 *)
12444         h_sysfile=false
12445         ;;
12446 esac
12447 set i_sysfile
12448 eval $setvar
12449
12450 : see if fcntl.h is there
12451 val=''
12452 set fcntl.h val
12453 eval $inhdr
12454
12455 : see if we can include fcntl.h
12456 case "$val" in
12457 "$define")
12458         echo " "
12459         if $h_fcntl; then
12460                 val="$define"
12461                 echo "We'll be including <fcntl.h>." >&4
12462         else
12463                 val="$undef"
12464                 if $h_sysfile; then
12465         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12466                 else
12467                         echo "We won't be including <fcntl.h>." >&4
12468                 fi
12469         fi
12470         ;;
12471 *)
12472         h_fcntl=false
12473         val="$undef"
12474         ;;
12475 esac
12476 set i_fcntl
12477 eval $setvar
12478
12479 : see if locale.h is available
12480 set locale.h i_locale
12481 eval $inhdr
12482
12483 : see if mach cthreads are available
12484 if test "X$usethreads" = "X$define"; then
12485         set mach/cthreads.h i_machcthr
12486         eval $inhdr
12487 else
12488         i_machcthr="$undef"
12489 fi
12490
12491
12492
12493 : see if this is a math.h system
12494 set math.h i_math
12495 eval $inhdr
12496
12497 : see if this is a mntent.h system
12498 set mntent.h i_mntent
12499 eval $inhdr
12500
12501 : see if ndbm.h is available
12502 set ndbm.h t_ndbm
12503 eval $inhdr
12504 case "$t_ndbm" in
12505 $define)
12506         : see if dbm_open exists
12507         set dbm_open d_dbm_open
12508         eval $inlibc
12509         case "$d_dbm_open" in
12510         $undef)
12511                 t_ndbm="$undef"
12512                 echo "We won't be including <ndbm.h>"
12513                 ;;
12514         esac
12515         ;;
12516 esac
12517 val="$t_ndbm"
12518 set i_ndbm
12519 eval $setvar
12520
12521 : see if net/errno.h is available
12522 val=''
12523 set net/errno.h val
12524 eval $inhdr
12525
12526 : Unfortunately, it causes problems on some systems.  Arrgh.
12527 case "$val" in
12528 $define)
12529         cat > try.c <<'EOM'
12530 #include <stdio.h>
12531 #include <errno.h>
12532 #include <net/errno.h>
12533 int func()
12534 {
12535         return ENOTSOCK;
12536 }
12537 EOM
12538         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12539                 echo "We'll be including <net/errno.h>." >&4
12540         else
12541                 echo "We won't be including <net/errno.h>." >&4
12542                 val="$undef"
12543         fi
12544         $rm -f try.* try
12545         ;;
12546 esac
12547 set i_neterrno
12548 eval $setvar
12549
12550 : see if netinet/tcp.h is available
12551 set netinet/tcp.h i_netinettcp
12552 eval $inhdr
12553
12554 : see if this is a poll.h system
12555 set poll.h i_poll
12556 eval $inhdr
12557
12558 : get C preprocessor symbols handy
12559 echo " "
12560 $echo $n "Hmm... $c"
12561 echo $al | $tr ' ' $trnl >Cppsym.know
12562 $cat <<EOSS >Cppsym
12563 $startsh
12564 case "\$1" in
12565 -l) list=true
12566         shift
12567         ;;
12568 esac
12569 unknown=''
12570 case "\$list\$#" in
12571 1|2)
12572         for sym do
12573                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12574                         exit 0
12575                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12576                         :
12577                 else
12578                         unknown="\$unknown \$sym"
12579                 fi
12580         done
12581         set X \$unknown
12582         shift
12583         ;;
12584 esac
12585 case \$# in
12586 0) exit 1;;
12587 esac
12588 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12589 #ifdef \1\\
12590 exit 0; _ _ _ _\1\\      \1\\
12591 #endif\\
12592 /' >Cppsym\$\$
12593 echo "exit 1; _ _ _" >>Cppsym\$\$
12594 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12595 case "\$list" in
12596 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12597 *)
12598         sh Cppsym2\$\$
12599         status=\$?
12600         ;;
12601 esac
12602 $rm -f Cppsym\$\$ Cppsym2\$\$
12603 exit \$status
12604 EOSS
12605 chmod +x Cppsym
12606 $eunicefix Cppsym
12607 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12608
12609 : now check the C compiler for additional symbols
12610 postprocess_cc_v=''
12611 case "$osname" in
12612 aix) postprocess_cc_v="|$tr , ' '" ;;
12613 esac
12614 $cat >ccsym <<EOS
12615 $startsh
12616 $cat >tmp.c <<EOF
12617 extern int foo;
12618 EOF
12619 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12620 do
12621         case "\$i" in
12622         -D*) echo "\$i" | $sed 's/^-D//';;
12623         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12624         esac
12625 done
12626 $rm -f try.c
12627 EOS
12628 postprocess_cc_v=''
12629 chmod +x ccsym
12630 $eunicefix ccsym
12631 ./ccsym > ccsym1.raw
12632 if $test -s ccsym1.raw; then
12633        $sort ccsym1.raw | $uniq >ccsym.raw
12634 else
12635        mv ccsym1.raw ccsym.raw
12636 fi
12637
12638 $awk '/\=/ { print $0; next }
12639         { print $0"=1" }' ccsym.raw >ccsym.list
12640 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12641 $comm -13 ccsym.true ccsym.list >ccsym.own
12642 $comm -12 ccsym.true ccsym.list >ccsym.com
12643 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12644 also=''
12645 if $test -z ccsym.raw; then
12646         echo "Your C compiler doesn't seem to define any symbols!" >&4
12647         echo " "
12648         echo "However, your C preprocessor defines the following symbols:"
12649         $cat Cppsym.true
12650         ccsymbols=''
12651         cppsymbols=`$cat Cppsym.true`
12652         cppsymbols=`echo $cppsymbols`
12653         cppccsymbols="$cppsymbols"
12654 else
12655         if $test -s ccsym.com; then
12656                 echo "Your C compiler and pre-processor define these symbols:"
12657                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12658                 also='also '
12659                 symbols='ones'
12660                 cppccsymbols=`$cat ccsym.com`
12661                 cppccsymbols=`echo $cppccsymbols`
12662                 $test "$silent" || sleep 1
12663         fi
12664         if $test -s ccsym.cpp; then
12665                 $test "$also" && echo " "
12666                 echo "Your C pre-processor ${also}defines the following symbols:"
12667                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12668                 also='further '
12669                 cppsymbols=`$cat ccsym.cpp`
12670                 cppsymbols=`echo $cppsymbols`
12671                 $test "$silent" || sleep 1
12672         fi
12673         if $test -s ccsym.own; then
12674                 $test "$also" && echo " "
12675                 echo "Your C compiler ${also}defines the following cpp symbols:"
12676                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12677                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12678                 ccsymbols=`$cat ccsym.own`
12679                 ccsymbols=`echo $ccsymbols`
12680                 $test "$silent" || sleep 1
12681         fi
12682 fi
12683 $rm -f ccsym*
12684
12685 : see if this is a termio system
12686 val="$undef"
12687 val2="$undef"
12688 val3="$undef"
12689 if $test `./findhdr termios.h`; then
12690         set tcsetattr i_termios
12691         eval $inlibc
12692         val3="$i_termios"
12693 fi
12694 echo " "
12695 case "$val3" in
12696 "$define") echo "You have POSIX termios.h... good!" >&4;;
12697 *) if ./Cppsym pyr; then
12698                 case "`/bin/universe`" in
12699                 ucb) if $test `./findhdr sgtty.h`; then
12700                                 val2="$define"
12701                                 echo "<sgtty.h> found." >&4
12702                         else
12703                                 echo "System is pyramid with BSD universe."
12704                                 echo "<sgtty.h> not found--you could have problems." >&4
12705                         fi;;
12706                 *) if $test `./findhdr termio.h`; then
12707                                 val="$define"
12708                                 echo "<termio.h> found." >&4
12709                         else
12710                                 echo "System is pyramid with USG universe."
12711                                 echo "<termio.h> not found--you could have problems." >&4
12712                         fi;;
12713                 esac
12714         elif ./usg; then
12715                 if $test `./findhdr termio.h`; then
12716                         echo "<termio.h> found." >&4
12717                         val="$define"
12718                 elif $test `./findhdr sgtty.h`; then
12719                         echo "<sgtty.h> found." >&4
12720                         val2="$define"
12721                 else
12722 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12723                 fi
12724         else
12725                 if $test `./findhdr sgtty.h`; then
12726                         echo "<sgtty.h> found." >&4
12727                         val2="$define"
12728                 elif $test `./findhdr termio.h`; then
12729                         echo "<termio.h> found." >&4
12730                         val="$define"
12731                 else
12732 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12733                 fi
12734         fi;;
12735 esac
12736 set i_termio; eval $setvar
12737 val=$val2; set i_sgtty; eval $setvar
12738 val=$val3; set i_termios; eval $setvar
12739
12740 : see if this is a shadow.h system
12741 set shadow.h i_shadow
12742 eval $inhdr
12743
12744 : see if this is a socks.h system
12745 set socks.h i_socks
12746 eval $inhdr
12747
12748 : see if stdarg is available
12749 echo " "
12750 if $test `./findhdr stdarg.h`; then
12751         echo "<stdarg.h> found." >&4
12752         valstd="$define"
12753 else
12754         echo "<stdarg.h> NOT found." >&4
12755         valstd="$undef"
12756 fi
12757
12758 : see if varags is available
12759 echo " "
12760 if $test `./findhdr varargs.h`; then
12761         echo "<varargs.h> found." >&4
12762 else
12763         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12764 fi
12765
12766 : set up the varargs testing programs
12767 $cat > varargs.c <<EOP
12768 #ifdef I_STDARG
12769 #include <stdarg.h>
12770 #endif
12771 #ifdef I_VARARGS
12772 #include <varargs.h>
12773 #endif
12774
12775 #ifdef I_STDARG
12776 int f(char *p, ...)
12777 #else
12778 int f(va_alist)
12779 va_dcl
12780 #endif
12781 {
12782         va_list ap;
12783 #ifndef I_STDARG
12784         char *p;
12785 #endif
12786 #ifdef I_STDARG
12787         va_start(ap,p);
12788 #else
12789         va_start(ap);
12790         p = va_arg(ap, char *);
12791 #endif
12792         va_end(ap);
12793 }
12794 EOP
12795 $cat > varargs <<EOP
12796 $startsh
12797 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12798         echo "true"
12799 else
12800         echo "false"
12801 fi
12802 $rm -f varargs$_o
12803 EOP
12804 chmod +x varargs
12805
12806 : now check which varargs header should be included
12807 echo " "
12808 i_varhdr=''
12809 case "$valstd" in
12810 "$define")
12811         if `./varargs I_STDARG`; then
12812                 val='stdarg.h'
12813         elif `./varargs I_VARARGS`; then
12814                 val='varargs.h'
12815         fi
12816         ;;
12817 *)
12818         if `./varargs I_VARARGS`; then
12819                 val='varargs.h'
12820         fi
12821         ;;
12822 esac
12823 case "$val" in
12824 '')
12825 echo "I could not find the definition for va_dcl... You have problems..." >&4
12826         val="$undef"; set i_stdarg; eval $setvar
12827         val="$undef"; set i_varargs; eval $setvar
12828         ;;
12829 *) 
12830         set i_varhdr
12831         eval $setvar
12832         case "$i_varhdr" in
12833         stdarg.h)
12834                 val="$define"; set i_stdarg; eval $setvar
12835                 val="$undef"; set i_varargs; eval $setvar
12836                 ;;
12837         varargs.h)
12838                 val="$undef"; set i_stdarg; eval $setvar
12839                 val="$define"; set i_varargs; eval $setvar
12840                 ;;
12841         esac
12842         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12843 esac
12844 $rm -f varargs*
12845
12846 : see if stddef is available
12847 set stddef.h i_stddef
12848 eval $inhdr
12849
12850 : see if sys/access.h is available
12851 set sys/access.h i_sysaccess
12852 eval $inhdr
12853
12854 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12855 set sys/filio.h i_sysfilio
12856 eval $inhdr
12857 echo " "
12858 if $test `./findhdr sys/ioctl.h`; then
12859         val="$define"
12860         echo '<sys/ioctl.h> found.' >&4
12861 else
12862         val="$undef"
12863         if $test $i_sysfilio = "$define"; then
12864             echo '<sys/ioctl.h> NOT found.' >&4
12865         else
12866                 $test $i_sgtty = "$define" && xxx="sgtty.h"
12867                 $test $i_termio = "$define" && xxx="termio.h"
12868                 $test $i_termios = "$define" && xxx="termios.h"
12869 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12870         fi
12871 fi
12872 set i_sysioctl
12873 eval $setvar
12874
12875 : see if sys/resource.h has to be included
12876 set sys/resource.h i_sysresrc
12877 eval $inhdr
12878
12879 : see if sys/security.h is available
12880 set sys/security.h i_syssecrt
12881 eval $inhdr
12882
12883 : see if this is a sys/statvfs.h system
12884 set sys/statvfs.h i_sysstatvfs
12885 eval $inhdr
12886
12887 : see if this is a sys/un.h system
12888 set sys/un.h i_sysun
12889 eval $inhdr
12890
12891 : see if this is a syswait system
12892 set sys/wait.h i_syswait
12893 eval $inhdr
12894
12895 : see if this is an utime system
12896 set utime.h i_utime
12897 eval $inhdr
12898
12899 : see if this is a values.h system
12900 set values.h i_values
12901 eval $inhdr
12902
12903 : see if this is a vfork system
12904 case "$d_vfork" in
12905 "$define")
12906         set vfork.h i_vfork
12907         eval $inhdr
12908         ;;
12909 *)
12910         i_vfork="$undef"
12911         ;;
12912 esac
12913
12914 : see if gdbm.h is available
12915 set gdbm.h t_gdbm
12916 eval $inhdr
12917 case "$t_gdbm" in
12918 $define)
12919         : see if gdbm_open exists
12920         set gdbm_open d_gdbm_open
12921         eval $inlibc
12922         case "$d_gdbm_open" in
12923         $undef)
12924                 t_gdbm="$undef"
12925                 echo "We won't be including <gdbm.h>"
12926                 ;;
12927         esac
12928         ;;
12929 esac
12930 val="$t_gdbm"
12931 set i_gdbm
12932 eval $setvar
12933
12934 echo " "
12935 echo "Looking for extensions..." >&4
12936 : If we are using the old config.sh, known_extensions may contain
12937 : old or inaccurate or duplicate values.
12938 known_extensions=''
12939 nonxs_extensions=''
12940 : We do not use find because it might not be available.
12941 : We do not just use MANIFEST because the user may have dropped
12942 : some additional extensions into the source tree and expect them
12943 : to be built.
12944
12945 : Function to recursively find available extensions, ignoring DynaLoader
12946 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
12947 find_extensions='
12948     for xxx in *; do
12949        case "$xxx" in
12950            DynaLoader|dynaload) ;;
12951            *)
12952            if $test -f $xxx/$xxx.xs; then
12953                known_extensions="$known_extensions $1$xxx";
12954            elif $test -f $xxx/Makefile.PL; then
12955                nonxs_extensions="$nonxs_extensions $1$xxx";
12956            else
12957                if $test -d $xxx -a $# -lt 10; then
12958                    set $1$xxx/ $*;
12959                    cd $xxx;
12960                    eval $find_extensions;
12961                    cd ..;
12962                    shift;
12963                fi;
12964            fi
12965            ;;
12966        esac;
12967     done'
12968 tdir=`pwd`
12969 cd $rsrc/ext
12970 set X
12971 shift
12972 eval $find_extensions
12973 set X $nonxs_extensions
12974 shift
12975 nonxs_extensions="$*"
12976 set X $known_extensions
12977 shift
12978 known_extensions="$*"
12979 cd $tdir
12980
12981 : Now see which are supported on this system.
12982 avail_ext=''
12983 for xxx in $known_extensions ; do
12984         case "$xxx" in
12985         DB_File|db_file)
12986                 case "$i_db" in
12987                 $define) avail_ext="$avail_ext $xxx" ;;
12988                 esac
12989                 ;;
12990         GDBM_File|gdbm_fil)
12991                 case "$i_gdbm" in 
12992                 $define) avail_ext="$avail_ext $xxx" ;;
12993                 esac
12994                 ;;
12995         NDBM_File|ndbm_fil)
12996                 case "$i_ndbm" in
12997                 $define) avail_ext="$avail_ext $xxx" ;;
12998                 esac
12999                 ;;
13000         ODBM_File|odbm_fil) 
13001                 case "${i_dbm}${i_rpcsvcdbm}" in
13002                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13003                 esac
13004                 ;;
13005         POSIX|posix)
13006                 case "$useposix" in
13007                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13008                 esac
13009                 ;;
13010         Opcode|opcode)
13011                 case "$useopcode" in
13012                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13013                 esac
13014                 ;;
13015         Socket|socket)
13016                 case "$d_socket" in 
13017                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13018                 esac
13019                 ;;
13020         Thread|thread)
13021                 case "$usethreads" in 
13022                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13023                 esac
13024                 ;;
13025         IPC/SysV|ipc/sysv)
13026                 : XXX Do we need a useipcsysv variable here
13027                 case "${d_msg}${d_sem}${d_shm}" in 
13028                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13029                 esac
13030                 ;;
13031         *)      avail_ext="$avail_ext $xxx"
13032                 ;;
13033         esac
13034 done
13035
13036 set X $avail_ext
13037 shift
13038 avail_ext="$*"
13039
13040 : Now see which nonxs extensions are supported on this system.
13041 : For now assume all are.
13042 nonxs_ext=''
13043 for xxx in $nonxs_extensions ; do
13044         case "$xxx" in
13045         *)      nonxs_ext="$nonxs_ext $xxx"
13046                 ;;
13047         esac
13048 done
13049
13050 set X $nonxs_ext
13051 shift
13052 nonxs_ext="$*"
13053
13054 case $usedl in
13055 $define)
13056         $cat <<EOM
13057 A number of extensions are supplied with $package.  You may choose to
13058 compile these extensions for dynamic loading (the default), compile
13059 them into the $package executable (static loading), or not include
13060 them at all.  Answer "none" to include no extensions.
13061 Note that DynaLoader is always built and need not be mentioned here.
13062
13063 EOM
13064         case "$dynamic_ext" in
13065         '') dflt="$avail_ext" ;;
13066         *)      dflt="$dynamic_ext"
13067                 # Perhaps we are reusing an old out-of-date config.sh.
13068                 case "$hint" in
13069                 previous)
13070                         if test X"$dynamic_ext" != X"$avail_ext"; then
13071                                 $cat <<EOM
13072 NOTICE:  Your previous config.sh list may be incorrect. 
13073 The extensions now available to you are 
13074         ${avail_ext}
13075 but the default list from your previous config.sh is
13076         ${dynamic_ext} 
13077
13078 EOM
13079                         fi
13080                         ;;
13081                 esac
13082                 ;;
13083         esac
13084         case "$dflt" in
13085         '')     dflt=none;;
13086         esac
13087         rp="What extensions do you wish to load dynamically?"
13088         . ./myread
13089         case "$ans" in
13090         none) dynamic_ext=' ' ;;
13091         *) dynamic_ext="$ans" ;;
13092         esac
13093
13094         case "$static_ext" in
13095         '')
13096                 : Exclude those already listed in dynamic linking
13097                 dflt=''
13098                 for xxx in $avail_ext; do
13099                         case " $dynamic_ext " in
13100                         *" $xxx "*) ;;
13101                         *) dflt="$dflt $xxx" ;;
13102                         esac
13103                 done
13104                 set X $dflt
13105                 shift
13106                 dflt="$*"
13107                 ;;
13108         *)  dflt="$static_ext" 
13109                 ;;
13110         esac
13111
13112         case "$dflt" in
13113         '')     dflt=none;;
13114         esac
13115         rp="What extensions do you wish to load statically?"
13116         . ./myread
13117         case "$ans" in
13118         none) static_ext=' ' ;;
13119         *) static_ext="$ans" ;;
13120         esac
13121         ;;
13122 *)
13123         $cat <<EOM
13124 A number of extensions are supplied with $package.  Answer "none" 
13125 to include no extensions. 
13126 Note that DynaLoader is always built and need not be mentioned here.
13127
13128 EOM
13129         case "$static_ext" in
13130         '') dflt="$avail_ext" ;;
13131         *)      dflt="$static_ext"
13132                 # Perhaps we are reusing an old out-of-date config.sh.
13133                 case "$hint" in
13134                 previous)
13135                         if test X"$static_ext" != X"$avail_ext"; then
13136                                 $cat <<EOM
13137 NOTICE:  Your previous config.sh list may be incorrect. 
13138 The extensions now available to you are 
13139         ${avail_ext}
13140 but the default list from your previous config.sh is
13141         ${static_ext} 
13142
13143 EOM
13144                         fi
13145                         ;;
13146                 esac
13147                 ;;
13148         esac
13149         : Exclude those that are not xs extensions
13150         case "$dflt" in
13151         '')     dflt=none;;
13152         esac
13153         rp="What extensions do you wish to include?"
13154         . ./myread
13155         case "$ans" in
13156         none) static_ext=' ' ;;
13157         *) static_ext="$ans" ;;
13158         esac
13159         ;;
13160 esac
13161
13162 set X $dynamic_ext $static_ext $nonxs_ext
13163 shift
13164 extensions="$*"
13165
13166 : Remove build directory name from cppstdin so it can be used from
13167 : either the present location or the final installed location.
13168 echo " "
13169 : Get out of the UU directory to get correct path name.
13170 cd ..
13171 case "$cppstdin" in
13172 `pwd`/cppstdin)
13173         echo "Stripping down cppstdin path name"
13174         cppstdin=cppstdin
13175         ;;
13176 esac
13177 cd UU
13178
13179 : end of configuration questions
13180 echo " "
13181 echo "End of configuration questions."
13182 echo " "
13183
13184 : back to where it started
13185 if test -d ../UU; then
13186         cd ..
13187 fi
13188
13189 : configuration may be patched via a 'config.over' file
13190 if $test -f config.over; then
13191         echo " "
13192         dflt=y
13193         rp='I see a config.over file.  Do you wish to load it?'
13194         . UU/myread
13195         case "$ans" in
13196         n*) echo "OK, I'll ignore it.";;
13197         *)      . ./config.over
13198                 echo "Configuration override changes have been loaded."
13199                 ;;
13200         esac
13201 fi
13202
13203 : in case they want portability, strip down executable paths
13204 case "$d_portable" in
13205 "$define")
13206         echo " "
13207         echo "Stripping down executable paths..." >&4
13208         for file in $loclist $trylist; do
13209                 eval temp=\$$file
13210                 eval $file=`basename $temp`
13211         done
13212         ;;
13213 esac
13214
13215 : create config.sh file
13216 echo " "
13217 echo "Creating config.sh..." >&4
13218 $spitshell <<EOT >config.sh
13219 $startsh
13220 #
13221 # This file was produced by running the Configure script. It holds all the
13222 # definitions figured out by Configure. Should you modify one of these values,
13223 # do not forget to propagate your changes by running "Configure -der". You may
13224 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13225 #
13226
13227 # Package name      : $package
13228 # Source directory  : $src
13229 # Configuration time: $cf_time
13230 # Configured by     : $cf_by
13231 # Target system     : $myuname
13232
13233 Author='$Author'
13234 Date='$Date'
13235 Header='$Header'
13236 Id='$Id'
13237 Locker='$Locker'
13238 Log='$Log'
13239 Mcc='$Mcc'
13240 RCSfile='$RCSfile'
13241 Revision='$Revision'
13242 Source='$Source'
13243 State='$State'
13244 _a='$_a'
13245 _exe='$_exe'
13246 _o='$_o'
13247 afs='$afs'
13248 alignbytes='$alignbytes'
13249 ansi2knr='$ansi2knr'
13250 aphostname='$aphostname'
13251 apiversion='$apiversion'
13252 ar='$ar'
13253 archlib='$archlib'
13254 archlibexp='$archlibexp'
13255 archname64='$archname64'
13256 archname='$archname'
13257 archobjs='$archobjs'
13258 awk='$awk'
13259 baserev='$baserev'
13260 bash='$bash'
13261 bin='$bin'
13262 bincompat5005='$bincompat5005'
13263 binexp='$binexp'
13264 bison='$bison'
13265 byacc='$byacc'
13266 byteorder='$byteorder'
13267 c='$c'
13268 castflags='$castflags'
13269 cat='$cat'
13270 cc='$cc'
13271 cccdlflags='$cccdlflags'
13272 ccdlflags='$ccdlflags'
13273 ccflags='$ccflags'
13274 ccsymbols='$ccsymbols'
13275 cf_by='$cf_by'
13276 cf_email='$cf_email'
13277 cf_time='$cf_time'
13278 chgrp='$chgrp'
13279 chmod='$chmod'
13280 chown='$chown'
13281 clocktype='$clocktype'
13282 comm='$comm'
13283 compress='$compress'
13284 contains='$contains'
13285 cp='$cp'
13286 cpio='$cpio'
13287 cpp='$cpp'
13288 cpp_stuff='$cpp_stuff'
13289 cppccsymbols='$cppccsymbols'
13290 cppflags='$cppflags'
13291 cpplast='$cpplast'
13292 cppminus='$cppminus'
13293 cpprun='$cpprun'
13294 cppstdin='$cppstdin'
13295 cppsymbols='$cppsymbols'
13296 crosscompile='$crosscompile'
13297 cryptlib='$cryptlib'
13298 csh='$csh'
13299 d_Gconvert='$d_Gconvert'
13300 d_PRIEldbl='$d_PRIEldbl'
13301 d_PRIFldbl='$d_PRIFldbl'
13302 d_PRIGldbl='$d_PRIGldbl'
13303 d_PRIX64='$d_PRIX64'
13304 d_PRId64='$d_PRId64'
13305 d_PRIeldbl='$d_PRIeldbl'
13306 d_PRIfldbl='$d_PRIfldbl'
13307 d_PRIgldbl='$d_PRIgldbl'
13308 d_PRIi64='$d_PRIi64'
13309 d_PRIo64='$d_PRIo64'
13310 d_PRIu64='$d_PRIu64'
13311 d_PRIx64='$d_PRIx64'
13312 d_access='$d_access'
13313 d_accessx='$d_accessx'
13314 d_alarm='$d_alarm'
13315 d_archlib='$d_archlib'
13316 d_atolf='$d_atolf'
13317 d_atoll='$d_atoll'
13318 d_attribut='$d_attribut'
13319 d_bcmp='$d_bcmp'
13320 d_bcopy='$d_bcopy'
13321 d_bincompat5005='$d_bincompat5005'
13322 d_bsd='$d_bsd'
13323 d_bsdgetpgrp='$d_bsdgetpgrp'
13324 d_bsdsetpgrp='$d_bsdsetpgrp'
13325 d_bzero='$d_bzero'
13326 d_casti32='$d_casti32'
13327 d_castneg='$d_castneg'
13328 d_charvspr='$d_charvspr'
13329 d_chown='$d_chown'
13330 d_chroot='$d_chroot'
13331 d_chsize='$d_chsize'
13332 d_closedir='$d_closedir'
13333 d_cmsghdr_s='$d_cmsghdr_s'
13334 d_const='$d_const'
13335 d_crypt='$d_crypt'
13336 d_csh='$d_csh'
13337 d_cuserid='$d_cuserid'
13338 d_dbl_dig='$d_dbl_dig'
13339 d_difftime='$d_difftime'
13340 d_dirnamlen='$d_dirnamlen'
13341 d_dlerror='$d_dlerror'
13342 d_dlopen='$d_dlopen'
13343 d_dlsymun='$d_dlsymun'
13344 d_dosuid='$d_dosuid'
13345 d_drand48proto='$d_drand48proto'
13346 d_dup2='$d_dup2'
13347 d_eaccess='$d_eaccess'
13348 d_endgrent='$d_endgrent'
13349 d_endhent='$d_endhent'
13350 d_endnent='$d_endnent'
13351 d_endpent='$d_endpent'
13352 d_endpwent='$d_endpwent'
13353 d_endsent='$d_endsent'
13354 d_endspent='$d_endspent'
13355 d_eofnblk='$d_eofnblk'
13356 d_eunice='$d_eunice'
13357 d_fchmod='$d_fchmod'
13358 d_fchown='$d_fchown'
13359 d_fcntl='$d_fcntl'
13360 d_fd_macros='$d_fd_macros'
13361 d_fd_set='$d_fd_set'
13362 d_fds_bits='$d_fds_bits'
13363 d_fgetpos='$d_fgetpos'
13364 d_flexfnam='$d_flexfnam'
13365 d_flock='$d_flock'
13366 d_fork='$d_fork'
13367 d_fpathconf='$d_fpathconf'
13368 d_fpos64_t='$d_fpos64_t'
13369 d_fseeko='$d_fseeko'
13370 d_fsetpos='$d_fsetpos'
13371 d_fstatfs='$d_fstatfs'
13372 d_fstatvfs='$d_fstatvfs'
13373 d_ftello='$d_ftello'
13374 d_ftime='$d_ftime'
13375 d_getgrent='$d_getgrent'
13376 d_getgrps='$d_getgrps'
13377 d_gethbyaddr='$d_gethbyaddr'
13378 d_gethbyname='$d_gethbyname'
13379 d_gethent='$d_gethent'
13380 d_gethname='$d_gethname'
13381 d_gethostprotos='$d_gethostprotos'
13382 d_getlogin='$d_getlogin'
13383 d_getmntent='$d_getmntent'
13384 d_getnbyaddr='$d_getnbyaddr'
13385 d_getnbyname='$d_getnbyname'
13386 d_getnent='$d_getnent'
13387 d_getnetprotos='$d_getnetprotos'
13388 d_getpbyname='$d_getpbyname'
13389 d_getpbynumber='$d_getpbynumber'
13390 d_getpent='$d_getpent'
13391 d_getpgid='$d_getpgid'
13392 d_getpgrp2='$d_getpgrp2'
13393 d_getpgrp='$d_getpgrp'
13394 d_getppid='$d_getppid'
13395 d_getprior='$d_getprior'
13396 d_getprotoprotos='$d_getprotoprotos'
13397 d_getpwent='$d_getpwent'
13398 d_getsbyname='$d_getsbyname'
13399 d_getsbyport='$d_getsbyport'
13400 d_getsent='$d_getsent'
13401 d_getservprotos='$d_getservprotos'
13402 d_getspent='$d_getspent'
13403 d_getspnam='$d_getspnam'
13404 d_gettimeod='$d_gettimeod'
13405 d_gnulibc='$d_gnulibc'
13406 d_grpasswd='$d_grpasswd'
13407 d_hasmntopt='$d_hasmntopt'
13408 d_htonl='$d_htonl'
13409 d_index='$d_index'
13410 d_inetaton='$d_inetaton'
13411 d_int64t='$d_int64t'
13412 d_iovec_s='$d_iovec_s'
13413 d_isascii='$d_isascii'
13414 d_killpg='$d_killpg'
13415 d_lchown='$d_lchown'
13416 d_ldbl_dig='$d_ldbl_dig'
13417 d_link='$d_link'
13418 d_llseek='$d_llseek'
13419 d_locconv='$d_locconv'
13420 d_lockf='$d_lockf'
13421 d_longdbl='$d_longdbl'
13422 d_longlong='$d_longlong'
13423 d_lstat='$d_lstat'
13424 d_madvise='$d_madvise'
13425 d_mblen='$d_mblen'
13426 d_mbstowcs='$d_mbstowcs'
13427 d_mbtowc='$d_mbtowc'
13428 d_memchr='$d_memchr'
13429 d_memcmp='$d_memcmp'
13430 d_memcpy='$d_memcpy'
13431 d_memmove='$d_memmove'
13432 d_memset='$d_memset'
13433 d_mkdir='$d_mkdir'
13434 d_mkfifo='$d_mkfifo'
13435 d_mktime='$d_mktime'
13436 d_mmap='$d_mmap'
13437 d_mprotect='$d_mprotect'
13438 d_msg='$d_msg'
13439 d_msg_ctrunc='$d_msg_ctrunc'
13440 d_msg_dontroute='$d_msg_dontroute'
13441 d_msg_oob='$d_msg_oob'
13442 d_msg_peek='$d_msg_peek'
13443 d_msg_proxy='$d_msg_proxy'
13444 d_msgctl='$d_msgctl'
13445 d_msgget='$d_msgget'
13446 d_msghdr_s='$d_msghdr_s'
13447 d_msgrcv='$d_msgrcv'
13448 d_msgsnd='$d_msgsnd'
13449 d_msync='$d_msync'
13450 d_munmap='$d_munmap'
13451 d_mymalloc='$d_mymalloc'
13452 d_nice='$d_nice'
13453 d_off64_t='$d_off64_t'
13454 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13455 d_oldpthreads='$d_oldpthreads'
13456 d_oldsock='$d_oldsock'
13457 d_open3='$d_open3'
13458 d_pathconf='$d_pathconf'
13459 d_pause='$d_pause'
13460 d_phostname='$d_phostname'
13461 d_pipe='$d_pipe'
13462 d_poll='$d_poll'
13463 d_portable='$d_portable'
13464 d_pthread_yield='$d_pthread_yield'
13465 d_pwage='$d_pwage'
13466 d_pwchange='$d_pwchange'
13467 d_pwclass='$d_pwclass'
13468 d_pwcomment='$d_pwcomment'
13469 d_pwexpire='$d_pwexpire'
13470 d_pwgecos='$d_pwgecos'
13471 d_pwpasswd='$d_pwpasswd'
13472 d_pwquota='$d_pwquota'
13473 d_readdir='$d_readdir'
13474 d_readlink='$d_readlink'
13475 d_readv='$d_readv'
13476 d_recvmsg='$d_recvmsg'
13477 d_rename='$d_rename'
13478 d_rewinddir='$d_rewinddir'
13479 d_rmdir='$d_rmdir'
13480 d_safebcpy='$d_safebcpy'
13481 d_safemcpy='$d_safemcpy'
13482 d_sanemcmp='$d_sanemcmp'
13483 d_sched_yield='$d_sched_yield'
13484 d_scm_rights='$d_scm_rights'
13485 d_seekdir='$d_seekdir'
13486 d_select='$d_select'
13487 d_sem='$d_sem'
13488 d_semctl='$d_semctl'
13489 d_semctl_semid_ds='$d_semctl_semid_ds'
13490 d_semctl_semun='$d_semctl_semun'
13491 d_semget='$d_semget'
13492 d_semop='$d_semop'
13493 d_sendmsg='$d_sendmsg'
13494 d_setegid='$d_setegid'
13495 d_seteuid='$d_seteuid'
13496 d_setgrent='$d_setgrent'
13497 d_setgrps='$d_setgrps'
13498 d_sethent='$d_sethent'
13499 d_setlinebuf='$d_setlinebuf'
13500 d_setlocale='$d_setlocale'
13501 d_setnent='$d_setnent'
13502 d_setpent='$d_setpent'
13503 d_setpgid='$d_setpgid'
13504 d_setpgrp2='$d_setpgrp2'
13505 d_setpgrp='$d_setpgrp'
13506 d_setprior='$d_setprior'
13507 d_setpwent='$d_setpwent'
13508 d_setregid='$d_setregid'
13509 d_setresgid='$d_setresgid'
13510 d_setresuid='$d_setresuid'
13511 d_setreuid='$d_setreuid'
13512 d_setrgid='$d_setrgid'
13513 d_setruid='$d_setruid'
13514 d_setsent='$d_setsent'
13515 d_setsid='$d_setsid'
13516 d_setspent='$d_setspent'
13517 d_setvbuf='$d_setvbuf'
13518 d_sfio='$d_sfio'
13519 d_shm='$d_shm'
13520 d_shmat='$d_shmat'
13521 d_shmatprototype='$d_shmatprototype'
13522 d_shmctl='$d_shmctl'
13523 d_shmdt='$d_shmdt'
13524 d_shmget='$d_shmget'
13525 d_sigaction='$d_sigaction'
13526 d_sigsetjmp='$d_sigsetjmp'
13527 d_socket='$d_socket'
13528 d_sockpair='$d_sockpair'
13529 d_statblks='$d_statblks'
13530 d_statfs='$d_statfs'
13531 d_statfsflags='$d_statfsflags'
13532 d_statvfs='$d_statvfs'
13533 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13534 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13535 d_stdio_stream_array='$d_stdio_stream_array'
13536 d_stdiobase='$d_stdiobase'
13537 d_stdstdio='$d_stdstdio'
13538 d_strchr='$d_strchr'
13539 d_strcoll='$d_strcoll'
13540 d_strctcpy='$d_strctcpy'
13541 d_strerrm='$d_strerrm'
13542 d_strerror='$d_strerror'
13543 d_strtod='$d_strtod'
13544 d_strtol='$d_strtol'
13545 d_strtoul='$d_strtoul'
13546 d_strtoull='$d_strtoull'
13547 d_strxfrm='$d_strxfrm'
13548 d_suidsafe='$d_suidsafe'
13549 d_symlink='$d_symlink'
13550 d_syscall='$d_syscall'
13551 d_sysconf='$d_sysconf'
13552 d_sysernlst='$d_sysernlst'
13553 d_syserrlst='$d_syserrlst'
13554 d_system='$d_system'
13555 d_tcgetpgrp='$d_tcgetpgrp'
13556 d_tcsetpgrp='$d_tcsetpgrp'
13557 d_telldir='$d_telldir'
13558 d_telldirproto='$d_telldirproto'
13559 d_time='$d_time'
13560 d_times='$d_times'
13561 d_truncate='$d_truncate'
13562 d_tzname='$d_tzname'
13563 d_umask='$d_umask'
13564 d_uname='$d_uname'
13565 d_union_semun='$d_union_semun'
13566 d_vendorlib='$d_vendorlib'
13567 d_vfork='$d_vfork'
13568 d_void_closedir='$d_void_closedir'
13569 d_voidsig='$d_voidsig'
13570 d_voidtty='$d_voidtty'
13571 d_volatile='$d_volatile'
13572 d_vprintf='$d_vprintf'
13573 d_wait4='$d_wait4'
13574 d_waitpid='$d_waitpid'
13575 d_wcstombs='$d_wcstombs'
13576 d_wctomb='$d_wctomb'
13577 d_writev='$d_writev'
13578 d_xenix='$d_xenix'
13579 date='$date'
13580 db_hashtype='$db_hashtype'
13581 db_prefixtype='$db_prefixtype'
13582 defvoidused='$defvoidused'
13583 direntrytype='$direntrytype'
13584 dlext='$dlext'
13585 dlsrc='$dlsrc'
13586 doublesize='$doublesize'
13587 drand01='$drand01'
13588 dynamic_ext='$dynamic_ext'
13589 eagain='$eagain'
13590 ebcdic='$ebcdic'
13591 echo='$echo'
13592 egrep='$egrep'
13593 emacs='$emacs'
13594 eunicefix='$eunicefix'
13595 exe_ext='$exe_ext'
13596 expr='$expr'
13597 extensions='$extensions'
13598 fflushNULL='$fflushNULL'
13599 fflushall='$fflushall'
13600 find='$find'
13601 firstmakefile='$firstmakefile'
13602 flex='$flex'
13603 fpostype='$fpostype'
13604 freetype='$freetype'
13605 full_ar='$full_ar'
13606 full_csh='$full_csh'
13607 full_sed='$full_sed'
13608 gccversion='$gccversion'
13609 gidtype='$gidtype'
13610 glibpth='$glibpth'
13611 grep='$grep'
13612 groupcat='$groupcat'
13613 groupstype='$groupstype'
13614 gzip='$gzip'
13615 h_fcntl='$h_fcntl'
13616 h_sysfile='$h_sysfile'
13617 hint='$hint'
13618 hostcat='$hostcat'
13619 huge='$huge'
13620 i_arpainet='$i_arpainet'
13621 i_bsdioctl='$i_bsdioctl'
13622 i_db='$i_db'
13623 i_dbm='$i_dbm'
13624 i_dirent='$i_dirent'
13625 i_dld='$i_dld'
13626 i_dlfcn='$i_dlfcn'
13627 i_fcntl='$i_fcntl'
13628 i_float='$i_float'
13629 i_gdbm='$i_gdbm'
13630 i_grp='$i_grp'
13631 i_inttypes='$i_inttypes'
13632 i_limits='$i_limits'
13633 i_locale='$i_locale'
13634 i_machcthr='$i_machcthr'
13635 i_malloc='$i_malloc'
13636 i_math='$i_math'
13637 i_memory='$i_memory'
13638 i_mntent='$i_mntent'
13639 i_ndbm='$i_ndbm'
13640 i_netdb='$i_netdb'
13641 i_neterrno='$i_neterrno'
13642 i_netinettcp='$i_netinettcp'
13643 i_niin='$i_niin'
13644 i_poll='$i_poll'
13645 i_pthread='$i_pthread'
13646 i_pwd='$i_pwd'
13647 i_rpcsvcdbm='$i_rpcsvcdbm'
13648 i_sfio='$i_sfio'
13649 i_sgtty='$i_sgtty'
13650 i_shadow='$i_shadow'
13651 i_socks='$i_socks'
13652 i_stdarg='$i_stdarg'
13653 i_stddef='$i_stddef'
13654 i_stdlib='$i_stdlib'
13655 i_string='$i_string'
13656 i_sysaccess='$i_sysaccess'
13657 i_sysdir='$i_sysdir'
13658 i_sysfile='$i_sysfile'
13659 i_sysfilio='$i_sysfilio'
13660 i_sysin='$i_sysin'
13661 i_sysioctl='$i_sysioctl'
13662 i_sysmman='$i_sysmman'
13663 i_sysmount='$i_sysmount'
13664 i_sysndir='$i_sysndir'
13665 i_sysparam='$i_sysparam'
13666 i_sysresrc='$i_sysresrc'
13667 i_syssecrt='$i_syssecrt'
13668 i_sysselct='$i_sysselct'
13669 i_syssockio='$i_syssockio'
13670 i_sysstat='$i_sysstat'
13671 i_sysstatvfs='$i_sysstatvfs'
13672 i_systime='$i_systime'
13673 i_systimek='$i_systimek'
13674 i_systimes='$i_systimes'
13675 i_systypes='$i_systypes'
13676 i_sysuio='$i_sysuio'
13677 i_sysun='$i_sysun'
13678 i_syswait='$i_syswait'
13679 i_termio='$i_termio'
13680 i_termios='$i_termios'
13681 i_time='$i_time'
13682 i_unistd='$i_unistd'
13683 i_utime='$i_utime'
13684 i_values='$i_values'
13685 i_varargs='$i_varargs'
13686 i_varhdr='$i_varhdr'
13687 i_vfork='$i_vfork'
13688 ignore_versioned_solibs='$ignore_versioned_solibs'
13689 incpath='$incpath'
13690 inews='$inews'
13691 installarchlib='$installarchlib'
13692 installbin='$installbin'
13693 installman1dir='$installman1dir'
13694 installman3dir='$installman3dir'
13695 installprefix='$installprefix'
13696 installprefixexp='$installprefixexp'
13697 installprivlib='$installprivlib'
13698 installscript='$installscript'
13699 installsitearch='$installsitearch'
13700 installsitelib='$installsitelib'
13701 installstyle='$installstyle'
13702 installusrbinperl='$installusrbinperl'
13703 installvendorlib='$installvendorlib'
13704 intsize='$intsize'
13705 known_extensions='$known_extensions'
13706 ksh='$ksh'
13707 large='$large'
13708 ld='$ld'
13709 lddlflags='$lddlflags'
13710 ldflags='$ldflags'
13711 ldlibpthname='$ldlibpthname'
13712 less='$less'
13713 lib_ext='$lib_ext'
13714 libc='$libc'
13715 libperl='$libperl'
13716 libpth='$libpth'
13717 libs='$libs'
13718 libswanted='$libswanted'
13719 line='$line'
13720 lint='$lint'
13721 lkflags='$lkflags'
13722 ln='$ln'
13723 lns='$lns'
13724 locincpth='$locincpth'
13725 loclibpth='$loclibpth'
13726 longdblsize='$longdblsize'
13727 longlongsize='$longlongsize'
13728 longsize='$longsize'
13729 lp='$lp'
13730 lpr='$lpr'
13731 ls='$ls'
13732 lseeksize='$lseeksize'
13733 lseektype='$lseektype'
13734 mail='$mail'
13735 mailx='$mailx'
13736 make='$make'
13737 make_set_make='$make_set_make'
13738 mallocobj='$mallocobj'
13739 mallocsrc='$mallocsrc'
13740 malloctype='$malloctype'
13741 man1dir='$man1dir'
13742 man1direxp='$man1direxp'
13743 man1ext='$man1ext'
13744 man3dir='$man3dir'
13745 man3direxp='$man3direxp'
13746 man3ext='$man3ext'
13747 medium='$medium'
13748 mips='$mips'
13749 mips_type='$mips_type'
13750 mkdir='$mkdir'
13751 mmaptype='$mmaptype'
13752 models='$models'
13753 modetype='$modetype'
13754 more='$more'
13755 multiarch='$multiarch'
13756 mv='$mv'
13757 myarchname='$myarchname'
13758 mydomain='$mydomain'
13759 myhostname='$myhostname'
13760 myuname='$myuname'
13761 n='$n'
13762 netdb_hlen_type='$netdb_hlen_type'
13763 netdb_host_type='$netdb_host_type'
13764 netdb_name_type='$netdb_name_type'
13765 netdb_net_type='$netdb_net_type'
13766 nm='$nm'
13767 nm_opt='$nm_opt'
13768 nm_so_opt='$nm_so_opt'
13769 nonxs_ext='$nonxs_ext'
13770 nroff='$nroff'
13771 o_nonblock='$o_nonblock'
13772 obj_ext='$obj_ext'
13773 old_pthread_create_joinable='$old_pthread_create_joinable'
13774 optimize='$optimize'
13775 orderlib='$orderlib'
13776 osname='$osname'
13777 osvers='$osvers'
13778 package='$package'
13779 pager='$pager'
13780 passcat='$passcat'
13781 patchlevel='$patchlevel'
13782 path_sep='$path_sep'
13783 perl='$perl'
13784 perladmin='$perladmin'
13785 perlpath='$perlpath'
13786 pg='$pg'
13787 phostname='$phostname'
13788 pidtype='$pidtype'
13789 plibpth='$plibpth'
13790 pmake='$pmake'
13791 pr='$pr'
13792 prefix='$prefix'
13793 prefixexp='$prefixexp'
13794 privlib='$privlib'
13795 privlibexp='$privlibexp'
13796 prototype='$prototype'
13797 ptrsize='$ptrsize'
13798 randbits='$randbits'
13799 randfunc='$randfunc'
13800 randseedtype='$randseedtype'
13801 ranlib='$ranlib'
13802 rd_nodata='$rd_nodata'
13803 rm='$rm'
13804 rmail='$rmail'
13805 runnm='$runnm'
13806 sPRIEldbl='$sPRIEldbl'
13807 sPRIFldbl='$sPRIFldbl'
13808 sPRIGldbl='$sPRIGldbl'
13809 sPRIX64='$sPRIX64'
13810 sPRId64='$sPRId64'
13811 sPRIeldbl='$sPRIeldbl'
13812 sPRIfldbl='$sPRIfldbl'
13813 sPRIgldbl='$sPRIgldbl'
13814 sPRIi64='$sPRIi64'
13815 sPRIo64='$sPRIo64'
13816 sPRIu64='$sPRIu64'
13817 sPRIx64='$sPRIx64'
13818 sched_yield='$sched_yield'
13819 scriptdir='$scriptdir'
13820 scriptdirexp='$scriptdirexp'
13821 sed='$sed'
13822 seedfunc='$seedfunc'
13823 selectminbits='$selectminbits'
13824 selecttype='$selecttype'
13825 sendmail='$sendmail'
13826 sh='$sh'
13827 shar='$shar'
13828 sharpbang='$sharpbang'
13829 shmattype='$shmattype'
13830 shortsize='$shortsize'
13831 shrpenv='$shrpenv'
13832 shsharp='$shsharp'
13833 sig_count='$sig_count'
13834 sig_name='$sig_name'
13835 sig_name_init='$sig_name_init'
13836 sig_num='$sig_num'
13837 sig_num_init='$sig_num_init'
13838 signal_t='$signal_t'
13839 sitearch='$sitearch'
13840 sitearchexp='$sitearchexp'
13841 sitelib='$sitelib'
13842 sitelibexp='$sitelibexp'
13843 siteprefix='$siteprefix'
13844 siteprefixexp='$siteprefixexp'
13845 sizetype='$sizetype'
13846 sleep='$sleep'
13847 smail='$smail'
13848 small='$small'
13849 so='$so'
13850 sockethdr='$sockethdr'
13851 socketlib='$socketlib'
13852 sort='$sort'
13853 spackage='$spackage'
13854 spitshell='$spitshell'
13855 split='$split'
13856 src='$src'
13857 ssizetype='$ssizetype'
13858 startperl='$startperl'
13859 startsh='$startsh'
13860 static_ext='$static_ext'
13861 stdchar='$stdchar'
13862 stdio_base='$stdio_base'
13863 stdio_bufsiz='$stdio_bufsiz'
13864 stdio_cnt='$stdio_cnt'
13865 stdio_filbuf='$stdio_filbuf'
13866 stdio_ptr='$stdio_ptr'
13867 stdio_stream_array='$stdio_stream_array'
13868 strings='$strings'
13869 submit='$submit'
13870 subversion='$subversion'
13871 sysman='$sysman'
13872 tail='$tail'
13873 tar='$tar'
13874 tbl='$tbl'
13875 tee='$tee'
13876 test='$test'
13877 timeincl='$timeincl'
13878 timetype='$timetype'
13879 touch='$touch'
13880 tr='$tr'
13881 trnl='$trnl'
13882 troff='$troff'
13883 uidtype='$uidtype'
13884 uname='$uname'
13885 uniq='$uniq'
13886 use64bits='$use64bits'
13887 usedl='$usedl'
13888 uselongdouble='$uselongdouble'
13889 usemultiplicity='$usemultiplicity'
13890 usemymalloc='$usemymalloc'
13891 usenm='$usenm'
13892 useopcode='$useopcode'
13893 useperlio='$useperlio'
13894 useposix='$useposix'
13895 usesfio='$usesfio'
13896 useshrplib='$useshrplib'
13897 usesocks='$usesocks'
13898 usethreads='$usethreads'
13899 usevendorprefix='$usevendorprefix'
13900 usevfork='$usevfork'
13901 usrinc='$usrinc'
13902 uuname='$uuname'
13903 vendorlib='$vendorlib'
13904 vendorlibexp='$vendorlibexp'
13905 vendorprefix='$vendorprefix'
13906 vendorprefixexp='$vendorprefixexp'
13907 version='$version'
13908 vi='$vi'
13909 voidflags='$voidflags'
13910 xlibpth='$xlibpth'
13911 zcat='$zcat'
13912 zip='$zip'
13913 EOT
13914
13915 : Add in command line options if available
13916 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
13917
13918 : add special variables
13919 $test -f $src/patchlevel.h && \
13920 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
13921 echo "CONFIGDOTSH=true" >>config.sh
13922
13923 : propagate old symbols
13924 if $test -f UU/config.sh; then
13925         <UU/config.sh sort | uniq >UU/oldconfig.sh
13926         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
13927         sort | uniq -u >UU/oldsyms
13928         set X `cat UU/oldsyms`
13929         shift
13930         case $# in
13931         0) ;;
13932         *)
13933                 cat <<EOM
13934 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
13935 EOM
13936                 echo "# Variables propagated from previous config.sh file." >>config.sh
13937                 for sym in `cat UU/oldsyms`; do
13938                         echo "    Propagating $hint variable "'$'"$sym..."
13939                         eval 'tmp="$'"${sym}"'"'
13940                         echo "$tmp" | \
13941                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
13942                 done
13943                 ;;
13944         esac
13945 fi
13946
13947 : Finish up by extracting the .SH files
13948 case "$alldone" in
13949 exit)
13950         $rm -rf UU
13951         echo "Done."
13952         exit 0
13953         ;;
13954 cont)
13955         ;;
13956 '')
13957         dflt=''
13958         nostick=true
13959         $cat <<EOM
13960
13961 If you'd like to make any changes to the config.sh file before I begin
13962 to configure things, do it as a shell escape now (e.g. !vi config.sh).
13963
13964 EOM
13965         rp="Press return or use a shell escape to edit config.sh:"
13966         . UU/myread
13967         nostick=''
13968         case "$ans" in
13969         '') ;;
13970         *) : in case they cannot read
13971                 sh 1>&4 -c "$ans";;
13972         esac
13973         ;;
13974 esac
13975
13976 : if this fails, just run all the .SH files by hand
13977 . ./config.sh
13978
13979 echo " "
13980 exec 1>&4
13981 . ./UU/extract
13982
13983 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
13984         dflt=y
13985         case "$silent" in
13986         true) ;;
13987         *)
13988                 $cat <<EOM
13989
13990 Now you need to generate make dependencies by running "$make depend".
13991 You might prefer to run it in background: "$make depend > makedepend.out &"
13992 It can take a while, so you might not want to run it right now.
13993
13994 EOM
13995                 ;;
13996         esac
13997         rp="Run $make depend now?"
13998         . UU/myread
13999         case "$ans" in
14000         y*)
14001                 $make depend && echo "Now you must run a $make."
14002                 ;;
14003         *)
14004                 echo "You must run '$make depend' then '$make'."
14005                 ;;
14006         esac
14007 elif test -f [Mm]akefile; then
14008         echo " "
14009         echo "Now you must run a $make."
14010 else
14011         echo "Done."
14012 fi
14013
14014 if $test -f Policy.sh; then
14015     $cat <<EOM
14016
14017 If you compile $package on a different machine or from a different object
14018 directory, copy the Policy.sh file from this object directory to the
14019 new one before you run Configure -- this will help you with most of
14020 the policy defaults.
14021
14022 EOM
14023 fi
14024 if $test -f config.msg; then
14025     echo "Hmm.  I also noted the following information while running:"
14026     echo " "
14027     $cat config.msg >&4
14028     $rm -f config.msg
14029 fi
14030 $rm -f kit*isdone ark*isdone
14031 $rm -rf UU
14032
14033 : End of Configure
14034