0576866f27e4e6c7439097c952effc284aebb3ca
[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  2 01:31:40 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_link=''
403 d_locconv=''
404 d_lockf=''
405 d_longdbl=''
406 longdblsize=''
407 d_longlong=''
408 longlongsize=''
409 d_lstat=''
410 d_madvise=''
411 d_mblen=''
412 d_mbstowcs=''
413 d_mbtowc=''
414 d_memchr=''
415 d_memcmp=''
416 d_memcpy=''
417 d_memmove=''
418 d_memset=''
419 d_mkdir=''
420 d_mkfifo=''
421 d_mktime=''
422 d_mmap=''
423 mmaptype=''
424 d_mprotect=''
425 d_msg=''
426 d_msgctl=''
427 d_msgget=''
428 d_msgrcv=''
429 d_msgsnd=''
430 d_msync=''
431 d_munmap=''
432 d_nice=''
433 d_open3=''
434 d_fpathconf=''
435 d_pathconf=''
436 d_pause=''
437 d_pipe=''
438 d_poll=''
439 d_portable=''
440 d_old_pthread_create_joinable=''
441 old_pthread_create_joinable=''
442 d_pthread_yield=''
443 d_sched_yield=''
444 sched_yield=''
445 d_readdir=''
446 d_rewinddir=''
447 d_seekdir=''
448 d_telldir=''
449 d_readlink=''
450 d_readv=''
451 d_rename=''
452 d_rmdir=''
453 d_safebcpy=''
454 d_safemcpy=''
455 d_sanemcmp=''
456 d_select=''
457 d_sem=''
458 d_semctl=''
459 d_semget=''
460 d_semop=''
461 d_setegid=''
462 d_seteuid=''
463 d_setgrent=''
464 d_setgrps=''
465 d_sethent=''
466 d_setlinebuf=''
467 d_setlocale=''
468 d_setnent=''
469 d_setpent=''
470 d_setpgid=''
471 d_setpgrp2=''
472 d_bsdsetpgrp=''
473 d_setpgrp=''
474 d_setprior=''
475 d_setpwent=''
476 d_setregid=''
477 d_setresgid=''
478 d_setresuid=''
479 d_setreuid=''
480 d_setrgid=''
481 d_setruid=''
482 d_setsent=''
483 d_setsid=''
484 d_setspent=''
485 d_setvbuf=''
486 d_sfio=''
487 usesfio=''
488 d_shm=''
489 d_shmat=''
490 d_shmatprototype=''
491 shmattype=''
492 d_shmctl=''
493 d_shmdt=''
494 d_shmget=''
495 d_sigaction=''
496 d_sigsetjmp=''
497 d_cmsghdr_s=''
498 d_msg_ctrunc=''
499 d_msg_dontroute=''
500 d_msg_oob=''
501 d_msg_peek=''
502 d_msg_proxy=''
503 d_msghdr_s=''
504 d_oldsock=''
505 d_recvmsg=''
506 d_scm_rights=''
507 d_sendmsg=''
508 d_socket=''
509 d_sockpair=''
510 sockethdr=''
511 socketlib=''
512 d_statblks=''
513 d_fstatfs=''
514 d_statfs=''
515 d_statfsflags=''
516 d_fstatvfs=''
517 d_statvfs=''
518 d_stdio_cnt_lval=''
519 d_stdio_ptr_lval=''
520 d_stdiobase=''
521 d_stdstdio=''
522 stdio_base=''
523 stdio_bufsiz=''
524 stdio_cnt=''
525 stdio_filbuf=''
526 stdio_ptr=''
527 d_index=''
528 d_strchr=''
529 d_strcoll=''
530 d_strctcpy=''
531 d_strerrm=''
532 d_strerror=''
533 d_sysernlst=''
534 d_syserrlst=''
535 d_strtod=''
536 d_strtol=''
537 d_strtoul=''
538 d_strxfrm=''
539 d_symlink=''
540 d_syscall=''
541 d_sysconf=''
542 d_system=''
543 d_tcgetpgrp=''
544 d_tcsetpgrp=''
545 d_telldirproto=''
546 d_time=''
547 timetype=''
548 clocktype=''
549 d_times=''
550 d_truncate=''
551 d_tzname=''
552 d_umask=''
553 d_semctl_semid_ds=''
554 d_semctl_semun=''
555 d_union_semun=''
556 d_vfork=''
557 usevfork=''
558 d_voidsig=''
559 signal_t=''
560 d_volatile=''
561 d_charvspr=''
562 d_vprintf=''
563 d_wait4=''
564 d_waitpid=''
565 d_wcstombs=''
566 d_wctomb=''
567 d_writev=''
568 d_dbmclose64=''
569 d_dbminit64=''
570 d_delete64=''
571 d_fetch64=''
572 d_firstkey64=''
573 d_nextkey64=''
574 d_store64=''
575 dlext=''
576 cccdlflags=''
577 ccdlflags=''
578 dlsrc=''
579 ld=''
580 lddlflags=''
581 usedl=''
582 doublesize=''
583 ebcdic=''
584 fflushNULL=''
585 fflushall=''
586 fpostype=''
587 gidtype=''
588 groupstype=''
589 h_fcntl=''
590 h_sysfile=''
591 i_arpainet=''
592 db_hashtype=''
593 db_prefixtype=''
594 i_db=''
595 i_dbm=''
596 i_rpcsvcdbm=''
597 d_dirnamlen=''
598 direntrytype=''
599 i_dirent=''
600 i_dld=''
601 i_dlfcn=''
602 i_fcntl=''
603 i_float=''
604 i_gdbm=''
605 d_grpasswd=''
606 i_grp=''
607 d_int64t=''
608 i_inttypes=''
609 i_limits=''
610 i_locale=''
611 i_machcthr=''
612 i_malloc=''
613 i_math=''
614 i_memory=''
615 i_mntent=''
616 i_ndbm=''
617 i_netdb=''
618 i_neterrno=''
619 i_netinettcp=''
620 i_niin=''
621 i_sysin=''
622 i_poll=''
623 i_pthread=''
624 d_pwage=''
625 d_pwchange=''
626 d_pwclass=''
627 d_pwcomment=''
628 d_pwexpire=''
629 d_pwgecos=''
630 d_pwpasswd=''
631 d_pwquota=''
632 i_pwd=''
633 i_sfio=''
634 i_shadow=''
635 i_socks=''
636 i_stddef=''
637 i_stdlib=''
638 i_string=''
639 strings=''
640 i_sysaccess=''
641 i_sysdir=''
642 i_sysfile=''
643 d_voidtty=''
644 i_bsdioctl=''
645 i_sysfilio=''
646 i_sysioctl=''
647 i_syssockio=''
648 i_sysmman=''
649 i_sysmount=''
650 i_sysndir=''
651 i_sysparam=''
652 i_sysresrc=''
653 i_syssecrt=''
654 i_sysselct=''
655 i_sysstat=''
656 i_sysstatvfs=''
657 i_systimes=''
658 i_systypes=''
659 d_iovec_s=''
660 i_sysuio=''
661 i_sysun=''
662 i_syswait=''
663 i_sgtty=''
664 i_termio=''
665 i_termios=''
666 i_systime=''
667 i_systimek=''
668 i_time=''
669 timeincl=''
670 i_unistd=''
671 i_utime=''
672 i_values=''
673 i_stdarg=''
674 i_varargs=''
675 i_varhdr=''
676 i_vfork=''
677 installprefix=''
678 installprefixexp=''
679 installstyle=''
680 installusrbinperl=''
681 intsize=''
682 longsize=''
683 shortsize=''
684 d_dirent64_s=''
685 d_flock64_s=''
686 d_fstat64=''
687 d_ftruncate64=''
688 d_ino64_t=''
689 d_llseek=''
690 d_lockf64=''
691 d_lseek64=''
692 d_lstat64=''
693 d_off64_t=''
694 d_offset_t=''
695 d_open64=''
696 d_opendir64=''
697 d_readdir64=''
698 d_seekdir64=''
699 d_stat64=''
700 d_telldir64=''
701 d_truncate64=''
702 libc=''
703 ldlibpthname=''
704 libperl=''
705 shrpenv=''
706 useshrplib=''
707 glibpth=''
708 libpth=''
709 loclibpth=''
710 plibpth=''
711 xlibpth=''
712 ignore_versioned_solibs=''
713 libs=''
714 lns=''
715 d_PRIEldbl=''
716 d_PRIFldbl=''
717 d_PRIGldbl=''
718 d_PRIeldbl=''
719 d_PRIfldbl=''
720 d_PRIgldbl=''
721 sPRIEldbl=''
722 sPRIFldbl=''
723 sPRIGldbl=''
724 sPRIeldbl=''
725 sPRIfldbl=''
726 sPRIgldbl=''
727 lseeksize=''
728 lseektype=''
729 make_set_make=''
730 d_mymalloc=''
731 freetype=''
732 mallocobj=''
733 mallocsrc=''
734 malloctype=''
735 usemymalloc=''
736 installman1dir=''
737 man1dir=''
738 man1direxp=''
739 man1ext=''
740 installman3dir=''
741 man3dir=''
742 man3direxp=''
743 man3ext=''
744 huge=''
745 large=''
746 medium=''
747 models=''
748 small=''
749 split=''
750 modetype=''
751 multiarch=''
752 mydomain=''
753 myhostname=''
754 phostname=''
755 c=''
756 n=''
757 d_eofnblk=''
758 eagain=''
759 o_nonblock=''
760 rd_nodata=''
761 netdb_hlen_type=''
762 netdb_host_type=''
763 netdb_name_type=''
764 netdb_net_type=''
765 groupcat=''
766 hostcat=''
767 passcat=''
768 orderlib=''
769 ranlib=''
770 package=''
771 spackage=''
772 pager=''
773 apiversion=''
774 patchlevel=''
775 subversion=''
776 version=''
777 perladmin=''
778 perlpath=''
779 pidtype=''
780 prefix=''
781 prefixexp=''
782 installprivlib=''
783 privlib=''
784 privlibexp=''
785 prototype=''
786 ptrsize=''
787 d_PRIX64=''
788 d_PRId64=''
789 d_PRIi64=''
790 d_PRIo64=''
791 d_PRIu64=''
792 d_PRIx64=''
793 sPRIX64=''
794 sPRId64=''
795 sPRIi64=''
796 sPRIo64=''
797 sPRIu64=''
798 sPRIx64=''
799 drand01=''
800 randbits=''
801 randfunc=''
802 randseedtype=''
803 seedfunc=''
804 installscript=''
805 scriptdir=''
806 scriptdirexp=''
807 selectminbits=''
808 selecttype=''
809 sh=''
810 sig_count=''
811 sig_name=''
812 sig_name_init=''
813 sig_num=''
814 sig_num_init=''
815 installsitearch=''
816 sitearch=''
817 sitearchexp=''
818 installsitelib=''
819 sitelib=''
820 sitelibexp=''
821 siteprefix=''
822 siteprefixexp=''
823 sizetype=''
824 so=''
825 sharpbang=''
826 shsharp=''
827 spitshell=''
828 src=''
829 ssizetype=''
830 startperl=''
831 startsh=''
832 stdchar=''
833 d_fgetpos64=''
834 d_fopen64=''
835 d_freopen64=''
836 d_fseek64=''
837 d_fseeko64=''
838 d_fsetpos64=''
839 d_ftell64=''
840 d_ftello64=''
841 d_tmpfile64=''
842 d_stdio_stream_array=''
843 stdio_stream_array=''
844 d_strtoull=''
845 sysman=''
846 trnl=''
847 uidtype=''
848 archname64=''
849 use64bits=''
850 usemultiplicity=''
851 nm_opt=''
852 nm_so_opt=''
853 runnm=''
854 usenm=''
855 useperlio=''
856 usesocks=''
857 d_oldpthreads=''
858 usethreads=''
859 incpath=''
860 mips=''
861 mips_type=''
862 usrinc=''
863 d_vendorlib=''
864 installvendorlib=''
865 vendorlib=''
866 vendorlibexp=''
867 usevendorprefix=''
868 vendorprefix=''
869 vendorprefixexp=''
870 defvoidused=''
871 voidflags=''
872 CONFIG=''
873
874 define='define'
875 undef='undef'
876 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
877 rmlist=''
878
879 : We must find out about Eunice early
880 eunicefix=':'
881 if test -f /etc/unixtovms; then
882         eunicefix=/etc/unixtovms
883 fi
884 if test -f /etc/unixtovms.exe; then
885         eunicefix=/etc/unixtovms.exe
886 fi
887
888 i_whoami=''
889 : Possible local include directories to search.
890 : Set locincpth to "" in a hint file to defeat local include searches.
891 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
892 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
893 :
894 : no include file wanted by default
895 inclwanted=''
896
897 : list of known cpp symbols, sorted alphabetically
898 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
899 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
900 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
901 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
902 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
903 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
904 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
905 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
906 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
907 al="$al VMS Xenix286"
908 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
909 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
910 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
911 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
912 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
913 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
914 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
915 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
916 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
917 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
918 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
919 al="$al __SVR4_2__ __UMAXV__"
920 al="$al ____386BSD____ __alpha __alpha__ __amiga"
921 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
922 al="$al __host_mips__"
923 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
924 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
925 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
926 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
927 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
928 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
929 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
930 al="$al __mc88100 __mc88100__ __mips __mips__"
931 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
932 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
933 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
934 al="$al _host_mips _mips _unix"
935 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
936 al="$al apollo ardent att386 att3b"
937 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
938 al="$al cadmus clipper concurrent convex cray ctix"
939 al="$al dmert encore gcos gcx gimpel gould"
940 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
941 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
942 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
943 al="$al i186 i286 i386 i486 i8086"
944 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
945 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
946 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
947 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
948 al="$al mc88000 mc88100 merlin mert mips mvs n16"
949 al="$al ncl_el ncl_mr"
950 al="$al news1500 news1700 news1800 news1900 news3700"
951 al="$al news700 news800 news900 ns16000 ns32000"
952 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
953 al="$al parisc pc532 pdp11 plexus posix pyr"
954 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
955 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
956 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
957 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
958 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
959 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
960 al="$al xenix z8000"
961
962 : Trailing extension.  Override this in a hint file, if needed.
963 _exe=''
964 : Extra object files, if any, needed on this platform.
965 archobjs=''
966 groupstype=''
967 : change the next line if compiling for Xenix/286 on Xenix/386
968 xlibpth='/usr/lib/386 /lib/386'
969
970 : Possible local library directories to search.
971 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
972 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
973
974 : general looking path for locating libraries
975 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
976 glibpth="$glibpth /lib /usr/lib $xlibpth"
977 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
978 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
979
980 : Private path used by Configure to find libraries.  Its value
981 : is prepended to libpth. This variable takes care of special
982 : machines, like the mips.  Usually, it should be empty.
983 plibpth=''
984
985 : default library list
986 libswanted=''
987 : some systems want to use only the non-versioned libso:s
988 ignore_versioned_solibs=''
989 : full support for void wanted by default
990 defvoidused=15
991
992 : set useposix=false in your hint file to disable the POSIX extension.
993 useposix=true
994 : set useopcode=false in your hint file to disable the Opcode extension.
995 useopcode=true
996 : set usemultiplicity on the Configure command line to enable multiplicity.
997 : set usesocks on the Configure command line to enable socks.
998 : set usethreads on the Configure command line to enable threads.
999 : List of libraries we want.
1000 : If anyone needs -lnet, put it in a hint file.
1001 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
1002 libswanted="$libswanted dld ld sun m rt c cposix posix"
1003 libswanted="$libswanted ndir dir crypt sec"
1004 libswanted="$libswanted ucb bsd BSD PW x"
1005 : We probably want to search /usr/shlib before most other libraries.
1006 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1007 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1008 glibpth="/usr/shlib $glibpth"
1009 : Do not use vfork unless overridden by a hint file.
1010 usevfork=false
1011
1012 : Find the basic shell for Bourne shell scripts
1013 case "$sh" in
1014 '')
1015         case "$SYSTYPE" in
1016         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1017         *) xxx='/bin/sh';;
1018         esac
1019         if test -f "$xxx"; then
1020                 sh="$xxx"
1021         else
1022                 : Build up a list and do a single loop so we can 'break' out.
1023                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1024                 for xxx in sh bash ksh pdksh ash; do
1025                         for p in $pth; do
1026                                 try="$try ${p}/${xxx}"
1027                         done
1028                 done
1029                 for xxx in $try; do
1030                         if test -f "$xxx"; then
1031                                 sh="$xxx";
1032                                 break
1033                         elif test -f "$xxx.exe"; then
1034                                 sh="$xxx";
1035                                 break
1036                         fi
1037                 done
1038         fi
1039         ;;
1040 esac
1041
1042 case "$sh" in
1043 '')     cat <<EOM >&2
1044 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1045
1046 Usually it's in /bin/sh.  How did you even get this far?
1047 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1048 we'll try to straighten this all out.
1049 EOM
1050         exit 1
1051         ;;
1052 esac
1053
1054 : see if sh knows # comments
1055 if `$sh -c '#' >/dev/null 2>&1`; then
1056         shsharp=true
1057         spitshell=cat
1058         xcat=/bin/cat
1059         test -f $xcat || xcat=/usr/bin/cat
1060         echo "#!$xcat" >try
1061         $eunicefix try
1062         chmod +x try
1063         ./try > today
1064         if test -s today; then
1065                 sharpbang='#!'
1066         else
1067                 echo "#! $xcat" > try
1068                 $eunicefix try
1069                 chmod +x try
1070                 ./try > today
1071                 if test -s today; then
1072                         sharpbang='#! '
1073                 else
1074                         sharpbang=': use '
1075                 fi
1076         fi
1077 else
1078         echo " "
1079         echo "Your $sh doesn't grok # comments--I will strip them later on."
1080         shsharp=false
1081         cd ..
1082         echo "exec grep -v '^[  ]*#'" >spitshell
1083         chmod +x spitshell
1084         $eunicefix spitshell
1085         spitshell=`pwd`/spitshell
1086         cd UU
1087         echo "I presume that if # doesn't work, #! won't work either!"
1088         sharpbang=': use '
1089 fi
1090 rm -f try today
1091
1092 : figure out how to guarantee sh startup
1093 case "$startsh" in
1094 '') startsh=${sharpbang}${sh} ;;
1095 *)
1096 esac
1097 cat >try <<EOSS
1098 $startsh
1099 set abc
1100 test "$?abc" != 1
1101 EOSS
1102
1103 chmod +x try
1104 $eunicefix try
1105 if ./try; then
1106         : echo "Yup, it does."
1107 else
1108         echo "Hmm... '$startsh' does not guarantee sh startup..."
1109         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1110 fi
1111 rm -f try
1112
1113
1114 : Save command line options in file UU/cmdline.opt for later use in
1115 : generating config.sh.
1116 cat > cmdline.opt <<EOSH
1117 # Configure command line arguments.
1118 config_arg0='$0'
1119 config_args='$*'
1120 config_argc=$#
1121 EOSH
1122 argn=1
1123 for arg in "$@"; do
1124         cat >>cmdline.opt <<EOSH
1125 config_arg$argn='$arg'
1126 EOSH
1127         argn=`expr $argn + 1`
1128 done
1129
1130 : produce awk script to parse command line options
1131 cat >options.awk <<'EOF'
1132 BEGIN {
1133         optstr = "dD:eEf:hKOrsSU:V";    # getopt-style specification
1134
1135         len = length(optstr);
1136         for (i = 1; i <= len; i++) {
1137                 c = substr(optstr, i, 1);
1138                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1139                 if (a == ":") {
1140                         arg[c] = 1;
1141                         i++;
1142                 }
1143                 opt[c] = 1;
1144         }
1145 }
1146 {
1147         expect = 0;
1148         str = $0;
1149         if (substr(str, 1, 1) != "-") {
1150                 printf("'%s'\n", str);
1151                 next;
1152         }
1153         len = length($0);
1154         for (i = 2; i <= len; i++) {
1155                 c = substr(str, i, 1);
1156                 if (!opt[c]) {
1157                         printf("-%s\n", substr(str, i));
1158                         next;
1159                 }
1160                 printf("-%s\n", c);
1161                 if (arg[c]) {
1162                         if (i < len)
1163                                 printf("'%s'\n", substr(str, i + 1));
1164                         else
1165                                 expect = 1;
1166                         next;
1167                 }
1168         }
1169 }
1170 END {
1171         if (expect)
1172                 print "?";
1173 }
1174 EOF
1175
1176 : process the command line options
1177 set X `for arg in "$@"; do echo "X$arg"; done |
1178         sed -e s/X// | awk -f options.awk`
1179 eval "set $*"
1180 shift
1181 rm -f options.awk
1182
1183 : set up default values
1184 fastread=''
1185 reuseval=false
1186 config_sh=''
1187 alldone=''
1188 error=''
1189 silent=''
1190 extractsh=''
1191 override=''
1192 knowitall=''
1193 rm -f optdef.sh
1194 cat >optdef.sh <<EOS
1195 $startsh
1196 EOS
1197
1198
1199 : option parsing
1200 while test $# -gt 0; do
1201         case "$1" in
1202         -d) shift; fastread=yes;;
1203         -e) shift; alldone=cont;;
1204         -f)
1205                 shift
1206                 cd ..
1207                 if test -r "$1"; then
1208                         config_sh="$1"
1209                 else
1210                         echo "$me: cannot read config file $1." >&2
1211                         error=true
1212                 fi
1213                 cd UU
1214                 shift;;
1215         -h) shift; error=true;;
1216         -r) shift; reuseval=true;;
1217         -s) shift; silent=true; realsilent=true;;
1218         -E) shift; alldone=exit;;
1219         -K) shift; knowitall=true;;
1220         -O) shift; override=true;;
1221         -S) shift; silent=true; extractsh=true;;
1222         -D)
1223                 shift
1224                 case "$1" in
1225                 *=)
1226                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1227                         echo "$me: ignoring -D $1" >&2
1228                         ;;
1229                 *=*) echo "$1" | \
1230                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1231                 *) echo "$1='define'" >> optdef.sh;;
1232                 esac
1233                 shift
1234                 ;;
1235         -U)
1236                 shift
1237                 case "$1" in
1238                 *=) echo "$1" >> optdef.sh;;
1239                 *=*)
1240                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1241                         echo "$me: ignoring -U $1" >&2
1242                         ;;
1243                 *) echo "$1='undef'" >> optdef.sh;;
1244                 esac
1245                 shift
1246                 ;;
1247         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1248                 exit 0;;
1249         --) break;;
1250         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1251         *) break;;
1252         esac
1253 done
1254
1255 case "$error" in
1256 true)
1257         cat >&2 <<EOM
1258 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1259                  [-U symbol] [-U symbol=]
1260   -d : use defaults for all answers.
1261   -e : go on without questioning past the production of config.sh.
1262   -f : specify an alternate default configuration file.
1263   -h : print this help message and exit (with an error status).
1264   -r : reuse C symbols value if possible (skips costly nm extraction).
1265   -s : silent mode, only echoes questions and essential information.
1266   -D : define symbol to have some value:
1267          -D symbol         symbol gets the value 'define'
1268          -D symbol=value   symbol gets the value 'value'
1269   -E : stop at the end of questions, after having produced config.sh.
1270   -K : do not use unless you know what you are doing.
1271   -O : let -D and -U override definitions from loaded configuration file.
1272   -S : perform variable substitutions on all .SH files (can mix with -f)
1273   -U : undefine symbol:
1274          -U symbol    symbol gets the value 'undef'
1275          -U symbol=   symbol gets completely empty
1276   -V : print version number and exit (with a zero status).
1277 EOM
1278         exit 1
1279         ;;
1280 esac
1281
1282 : Sanity checks
1283 case "$fastread$alldone" in
1284 yescont|yesexit) ;;
1285 *)
1286         if test ! -t 0; then
1287                 echo "Say 'sh Configure', not 'sh <Configure'"
1288                 exit 1
1289         fi
1290         ;;
1291 esac
1292
1293 exec 4>&1
1294 case "$silent" in
1295 true) exec 1>/dev/null;;
1296 esac
1297
1298 : run the defines and the undefines, if any, but leave the file out there...
1299 touch optdef.sh
1300 . ./optdef.sh
1301
1302 : set package name
1303 package=perl5
1304 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1305 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1306 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1307 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1308 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1309 esac
1310
1311 : Some greps do not return status, grrr.
1312 echo "grimblepritz" >grimble
1313 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1314         contains=contains
1315 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1316         contains=grep
1317 else
1318         contains=contains
1319 fi
1320 rm -f grimble
1321 : the following should work in any shell
1322 case "$contains" in
1323 contains*)
1324         echo " "
1325         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1326         cat >contains <<'EOSS'
1327 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1328 EOSS
1329 chmod +x contains
1330 esac
1331
1332 : Find the path to the source tree
1333 case "$src" in
1334 '') case "$0" in
1335     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1336          case "$src" in
1337          /*)    ;;
1338          *)     src=`cd ../$src && pwd` ;;
1339          esac
1340          ;;
1341     *)   src='.';;
1342     esac;;
1343 esac
1344 case "$src" in
1345 '')     src=/
1346         rsrc=/
1347         ;;
1348 /*) rsrc="$src";;
1349 *) rsrc="../$src";;
1350 esac
1351 if test -f $rsrc/Configure && \
1352         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1353 then
1354    : found it, so we are ok.
1355 else
1356         rsrc=''
1357         for src in . .. ../.. ../../.. ../../../..; do
1358                 if test -f ../$src/Configure && \
1359                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1360                 then
1361                         rsrc=../$src
1362                         break
1363                 fi
1364         done
1365 fi
1366 case "$rsrc" in
1367 '')
1368         cat <<EOM >&4
1369
1370 Sorry, I can't seem to locate the source dir for $package.  Please start
1371 Configure with an explicit path -- i.e. /some/path/Configure.
1372
1373 EOM
1374         exit 1
1375         ;;
1376 ../.)   rsrc='..';;
1377 *)
1378         echo " "
1379         echo "Sources for $package found in \"$src\"." >&4
1380         ;;
1381 esac
1382
1383 : script used to extract .SH files with variable substitutions
1384 cat >extract <<'EOS'
1385 CONFIGDOTSH=true
1386 echo "Doing variable substitutions on .SH files..."
1387 if test -f $src/MANIFEST; then
1388         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1389 else
1390         echo "(Looking for .SH files under the source directory.)"
1391         set x `(cd $src; find . -name "*.SH" -print)`
1392 fi
1393 shift
1394 case $# in
1395 0) set x `(cd $src; echo *.SH)`; shift;;
1396 esac
1397 if test ! -f $src/$1; then
1398         shift
1399 fi
1400 mkdir_p='
1401 name=$1;
1402 create="";
1403 while test $name; do
1404         if test ! -d "$name"; then
1405                 create="$name $create";
1406                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1407                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1408         else
1409                 name="";
1410         fi;
1411 done;
1412 for file in $create; do
1413         mkdir $file;
1414 done
1415 '
1416 for file in $*; do
1417         case "$src" in
1418         ".")
1419                 case "$file" in
1420                 */*)
1421                         dir=`expr X$file : 'X\(.*\)/'`
1422                         file=`expr X$file : 'X.*/\(.*\)'`
1423                         (cd $dir && . ./$file)
1424                         ;;
1425                 *)
1426                         . ./$file
1427                         ;;
1428                 esac
1429                 ;;
1430         *)
1431                 case "$file" in
1432                 */*)
1433                         dir=`expr X$file : 'X\(.*\)/'`
1434                         file=`expr X$file : 'X.*/\(.*\)'`
1435                         (set x $dir; shift; eval $mkdir_p)
1436                         sh <$src/$dir/$file
1437                         ;;
1438                 *)
1439                         sh <$src/$file
1440                         ;;
1441                 esac
1442                 ;;
1443         esac
1444 done
1445 if test -f $src/config_h.SH; then
1446         if test ! -f config.h; then
1447         : oops, they left it out of MANIFEST, probably, so do it anyway.
1448         . $src/config_h.SH
1449         fi
1450 fi
1451 EOS
1452
1453 : extract files and exit if asked to do so
1454 case "$extractsh" in
1455 true)
1456         case "$realsilent" in
1457         true) ;;
1458         *) exec 1>&4;;
1459         esac
1460         case "$config_sh" in
1461         '') config_sh='config.sh';;
1462         esac
1463         echo " "
1464         echo "Fetching answers from $config_sh..."
1465         cd ..
1466         . $config_sh
1467         test "$override" && . ./optdef.sh
1468         echo " "
1469         . UU/extract
1470         rm -rf UU
1471         echo "Done."
1472         exit 0
1473         ;;
1474 esac
1475
1476 : Eunice requires " " instead of "", can you believe it
1477 echo " "
1478 : Here we go...
1479 echo "Beginning of configuration questions for $package."
1480
1481 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1482
1483 : first determine how to suppress newline on echo command
1484 echo " "
1485 echo "Checking echo to see how to suppress newlines..."
1486 (echo "hi there\c" ; echo " ") >.echotmp
1487 if $contains c .echotmp >/dev/null 2>&1 ; then
1488         echo "...using -n."
1489         n='-n'
1490         c=''
1491 else
1492         cat <<'EOM'
1493 ...using \c
1494 EOM
1495         n=''
1496         c='\c'
1497 fi
1498 echo $n "The star should be here-->$c"
1499 echo '*'
1500 rm -f .echotmp
1501
1502 : Now test for existence of everything in MANIFEST
1503 echo " "
1504 if test -f $rsrc/MANIFEST; then
1505         echo "First let's make sure your kit is complete.  Checking..." >&4
1506         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1507         rm -f missing
1508         tmppwd=`pwd`
1509         for filelist in x??; do
1510                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1511         done
1512         if test -s missing; then
1513                 cat missing >&4
1514                 cat >&4 <<'EOM'
1515
1516 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1517
1518 You have the option of continuing the configuration process, despite the
1519 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1520 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1521 and contact the author (perlbug@perl.com).
1522
1523 EOM
1524                 echo $n "Continue? [n] $c" >&4
1525                 read ans
1526                 case "$ans" in
1527                 y*)
1528                         echo "Continuing..." >&4
1529                         rm -f missing
1530                         ;;
1531                 *)
1532                         echo "ABORTING..." >&4
1533                         kill $$
1534                         ;;
1535                 esac
1536         else
1537                 echo "Looks good..."
1538         fi
1539 else
1540         echo "There is no MANIFEST file.  I hope your kit is complete !"
1541 fi
1542 rm -f missing x??
1543
1544 echo " "
1545 : Find the appropriate value for a newline for tr
1546 if test -n "$DJGPP"; then
1547        trnl='\012'
1548 fi
1549 if test X"$trnl" = X; then
1550         case "`echo foo|tr '\n' x 2>/dev/null`" in
1551         foox) trnl='\n' ;;
1552         esac
1553 fi
1554 if test X"$trnl" = X; then
1555         case "`echo foo|tr '\012' x 2>/dev/null`" in
1556         foox) trnl='\012' ;;
1557         esac
1558 fi
1559 if test X"$trnl" = X; then
1560         cat <<EOM >&2
1561
1562 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1563
1564 EOM
1565         exit 1
1566 fi
1567
1568 : compute the number of columns on the terminal for proper question formatting
1569 case "$COLUMNS" in
1570 '') COLUMNS='80';;
1571 esac
1572
1573 : set up the echo used in my read
1574 myecho="case \"\$xxxm\" in
1575 '') echo $n \"\$rp $c\" >&4;;
1576 *) case \"\$rp\" in
1577         '') echo $n \"[\$xxxm] $c\";;
1578         *)
1579                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1580                         echo \"\$rp\" >&4
1581                         echo $n \"[\$xxxm] $c\" >&4
1582                 else
1583                         echo $n \"\$rp [\$xxxm] $c\" >&4
1584                 fi
1585                 ;;
1586         esac;;
1587 esac"
1588
1589 : now set up to do reads with possible shell escape and default assignment
1590 cat <<EOSC >myread
1591 $startsh
1592 xxxm=\$dflt
1593 $myecho
1594 ans='!'
1595 case "\$fastread" in
1596 yes) case "\$dflt" in
1597         '') ;;
1598         *) ans='';
1599                 case "\$silent-\$rp" in
1600                 true-) ;;
1601                 *) echo " " >&4;;
1602                 esac;;
1603         esac;;
1604 *) case "\$silent" in
1605         true) case "\$rp" in
1606                 '') ans='';;
1607                 esac;;
1608         esac;;
1609 esac
1610 while expr "X\$ans" : "X!" >/dev/null; do
1611         read answ
1612         set x \$xxxm
1613         shift
1614         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1615         case  "\$answ" in
1616         "!")
1617                 sh 1>&4
1618                 echo " "
1619                 $myecho
1620                 ;;
1621         !*)
1622                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1623                 shift
1624                 sh 1>&4 -c "\$*"
1625                 echo " "
1626                 $myecho
1627                 ;;
1628         "\$ans")
1629                 case "\$ans" in
1630                 \\&*)
1631                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1632                         shift
1633                         case "\$1" in
1634                         -d)
1635                                 fastread=yes
1636                                 echo "(OK, I'll run with -d after this question.)" >&4
1637                                 ;;
1638                         -*)
1639                                 echo "*** Sorry, \$1 not supported yet." >&4
1640                                 ;;
1641                         esac
1642                         $myecho
1643                         ans=!
1644                         ;;
1645                 esac;;
1646         *)
1647                 case "\$aok" in
1648                 y)
1649                         echo "*** Substitution done -- please confirm."
1650                         xxxm="\$ans"
1651                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1652                         xxxm="\$ans"
1653                         ans=!
1654                         ;;
1655                 *)
1656                         echo "*** Error -- try again."
1657                         ans=!
1658                         ;;
1659                 esac
1660                 $myecho
1661                 ;;
1662         esac
1663         case "\$ans\$xxxm\$nostick" in
1664         '')
1665                 ans=!
1666                 $myecho
1667                 ;;
1668         esac
1669 done
1670 case "\$ans" in
1671 '') ans="\$xxxm";;
1672 esac
1673 EOSC
1674
1675 : create .config dir to save info across Configure sessions
1676 test -d ../.config || mkdir ../.config
1677 cat >../.config/README <<EOF
1678 This directory created by Configure to save information that should
1679 persist across sessions for $package.
1680
1681 You may safely delete it if you wish.
1682 EOF
1683
1684 : general instructions
1685 needman=true
1686 firsttime=true
1687 user=`(logname) 2>/dev/null`
1688 case "$user" in
1689 '') user=`whoami 2>&1`;;
1690 esac
1691 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1692         firsttime=false
1693         echo " "
1694         rp='Would you like to see the instructions?'
1695         dflt=n
1696         . ./myread
1697         case "$ans" in
1698         [yY]*) ;;
1699         *) needman=false;;
1700         esac
1701 fi
1702 if $needman; then
1703         cat <<EOH
1704
1705 This installation shell script will examine your system and ask you questions
1706 to determine how the perl5 package should be installed. If you get
1707 stuck on a question, you may use a ! shell escape to start a subshell or
1708 execute a command.  Many of the questions will have default answers in square
1709 brackets; typing carriage return will give you the default.
1710
1711 On some of the questions which ask for file or directory names you are allowed
1712 to use the ~name construct to specify the login directory belonging to "name",
1713 even if you don't have a shell which knows about that.  Questions where this is
1714 allowed will be marked "(~name ok)".
1715
1716 EOH
1717         rp=''
1718         dflt='Type carriage return to continue'
1719         . ./myread
1720         cat <<'EOH'
1721
1722 The prompter used in this script allows you to use shell variables and
1723 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1724 in the default answer, as if the default line was a set of arguments given to a
1725 script shell.  This means you may also use $* to repeat the whole default line,
1726 so you do not have to re-type everything to add something to the default.
1727
1728 Everytime there is a substitution, you will have to confirm.  If there is an
1729 error (e.g. an unmatched backtick), the default answer will remain unchanged
1730 and you will be prompted again.
1731
1732 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1733 the questions and use the computed defaults (or the previous answers if there
1734 was already a config.sh file). Type 'Configure -h' for a list of options.
1735 You may also start interactively and then answer '& -d' at any prompt to turn
1736 on the non-interactive behaviour for the remainder of the execution.
1737
1738 EOH
1739         . ./myread
1740         cat <<EOH
1741
1742 Much effort has been expended to ensure that this shell script will run on any
1743 Unix system.  If despite that it blows up on yours, your best bet is to edit
1744 Configure and run it again.  If you can't run Configure for some reason,
1745 you'll have to generate a config.sh file by hand.  Whatever problems you
1746 have, let me (perlbug@perl.com) know how I blew it.
1747
1748 This installation script affects things in two ways:
1749
1750 1) it may do direct variable substitutions on some of the files included
1751    in this kit.
1752 2) it builds a config.h file for inclusion in C programs.  You may edit
1753    any of these files as the need arises after running this script.
1754
1755 If you make a mistake on a question, there is no easy way to back up to it
1756 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1757 files.  Configure will offer to let you do this before it runs the SH files.
1758
1759 EOH
1760         dflt='Type carriage return to continue'
1761         . ./myread
1762         case "$firsttime" in
1763         true) echo $user >>../.config/instruct;;
1764         esac
1765 fi
1766
1767 : find out where common programs are
1768 echo " "
1769 echo "Locating common programs..." >&4
1770 cat <<EOSC >loc
1771 $startsh
1772 case \$# in
1773 0) exit 1;;
1774 esac
1775 thing=\$1
1776 shift
1777 dflt=\$1
1778 shift
1779 for dir in \$*; do
1780         case "\$thing" in
1781         .)
1782         if test -d \$dir/\$thing; then
1783                 echo \$dir
1784                 exit 0
1785         fi
1786         ;;
1787         *)
1788         for thisthing in \$dir/\$thing; do
1789                 : just loop through to pick last item
1790         done
1791         if test -f \$thisthing; then
1792                 echo \$thisthing
1793                 exit 0
1794         elif test -f \$dir/\$thing.exe; then
1795                 if test -n "$DJGPP"; then
1796                         echo \$dir/\$thing.exe
1797                 else
1798                         : on Eunice apparently
1799                         echo \$dir/\$thing
1800                 fi
1801                 exit 0
1802         fi
1803         ;;
1804         esac
1805 done
1806 echo \$dflt
1807 exit 1
1808 EOSC
1809 chmod +x loc
1810 $eunicefix loc
1811 loclist="
1812 awk
1813 cat
1814 comm
1815 cp
1816 echo
1817 expr
1818 grep
1819 ls
1820 make
1821 mkdir
1822 rm
1823 sed
1824 sort
1825 touch
1826 tr
1827 uniq
1828 "
1829 trylist="
1830 Mcc
1831 ar
1832 byacc
1833 cpp
1834 csh
1835 date
1836 egrep
1837 gzip
1838 less
1839 ln
1840 more
1841 nm
1842 nroff
1843 pg
1844 test
1845 uname
1846 zip
1847 "
1848 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1849 pth="$pth /lib /usr/lib"
1850 for file in $loclist; do
1851         eval xxx=\$$file
1852         case "$xxx" in
1853         /*|?:[\\/]*)
1854                 if test -f "$xxx"; then
1855                         : ok
1856                 else
1857                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1858                         xxx=`./loc $file $file $pth`
1859                 fi
1860                 ;;
1861         '') xxx=`./loc $file $file $pth`;;
1862         *) xxx=`./loc $xxx $xxx $pth`;;
1863         esac
1864         eval $file=$xxx
1865         eval _$file=$xxx
1866         case "$xxx" in
1867         /*)
1868                 echo $file is in $xxx.
1869                 ;;
1870         ?:[\\/]*)
1871                 echo $file is in $xxx.
1872                 ;;
1873         *)
1874                 echo "I don't know where '$file' is, and my life depends on it." >&4
1875                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1876                 exit 1
1877                 ;;
1878         esac
1879 done
1880 echo " "
1881 echo "Don't worry if any of the following aren't found..."
1882 say=offhand
1883 for file in $trylist; do
1884         eval xxx=\$$file
1885         case "$xxx" in
1886         /*|?:[\\/]*)
1887                 if test -f "$xxx"; then
1888                         : ok
1889                 else
1890                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1891                         xxx=`./loc $file $file $pth`
1892                 fi
1893                 ;;
1894         '') xxx=`./loc $file $file $pth`;;
1895         *) xxx=`./loc $xxx $xxx $pth`;;
1896         esac
1897         eval $file=$xxx
1898         eval _$file=$xxx
1899         case "$xxx" in
1900         /*)
1901                 echo $file is in $xxx.
1902                 ;;
1903         ?:[\\/]*)
1904                 echo $file is in $xxx.
1905                 ;;
1906         *)
1907                 echo "I don't see $file out there, $say."
1908                 say=either
1909                 ;;
1910         esac
1911 done
1912 case "$egrep" in
1913 egrep)
1914         echo "Substituting grep for egrep."
1915         egrep=$grep
1916         ;;
1917 esac
1918 case "$ln" in
1919 ln)
1920         echo "Substituting cp for ln."
1921         ln=$cp
1922         ;;
1923 esac
1924 case "$test" in
1925 test)
1926         echo "Hopefully test is built into your sh."
1927         ;;
1928 *)
1929         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1930                 echo "Using the test built into your sh."
1931                 test=test
1932                 _test=test
1933         fi
1934         ;;
1935 esac
1936 case "$echo" in
1937 echo)
1938         echo "Hopefully echo is built into your sh."
1939         ;;
1940 '') ;;
1941 *)
1942         echo " "
1943 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1944         $echo $n "hi there$c" >foo1
1945         echo $n "hi there$c" >foo2
1946         if cmp foo1 foo2 >/dev/null 2>&1; then
1947                 echo "They are compatible.  In fact, they may be identical."
1948         else
1949                 case "$n" in
1950                 '-n') n='' c='\c';;
1951                 *) n='-n' c='';;
1952                 esac
1953                 cat <<FOO
1954 They are not compatible!  You are probably running ksh on a non-USG system.
1955 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1956 have echo built in and we may have to run some Bourne shell scripts.  That
1957 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1958
1959 FOO
1960                 $echo $n "The star should be here-->$c"
1961                 $echo "*"
1962         fi
1963         $rm -f foo1 foo2
1964         ;;
1965 esac
1966
1967 : determine whether symbolic links are supported
1968 echo " "
1969 $touch blurfl
1970 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1971         echo "Symbolic links are supported." >&4
1972         lns="$ln -s"
1973 else
1974         echo "Symbolic links are NOT supported." >&4
1975         lns="$ln"
1976 fi
1977 $rm -f blurfl sym
1978
1979 : see whether [:lower:] and [:upper:] are supported character classes
1980 echo " "
1981 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1982 ABYZ)
1983         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1984         up='[:upper:]'
1985         low='[:lower:]'
1986         ;;
1987 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
1988         # (0xc9 and 0xd1), therefore that is a nice testing point.
1989         if test "X$up" = X -o "X$low" = X; then
1990             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
1991             ij) up='[A-Z]'
1992                 low='[a-z]'
1993                 ;;
1994             esac
1995         fi
1996         if test "X$up" = X -o "X$low" = X; then
1997             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
1998             ij) up='A-Z'
1999                 low='a-z'
2000                 ;;
2001             esac
2002         fi
2003         if test "X$up" = X -o "X$low" = X; then
2004             case "`echo IJ | od -x 2>/dev/null`" in
2005             *C9D1*|*c9d1*)
2006                 echo "Hey, this might be EBCDIC." >&4
2007                 if test "X$up" = X -o "X$low" = X; then
2008                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2009                     ij) up='[A-IJ-RS-Z]'
2010                         low='[a-ij-rs-z]'
2011                         ;;
2012                     esac
2013                 fi
2014                 if test "X$up" = X -o "X$low" = X; then
2015                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2016                     ij) up='A-IJ-RS-Z'
2017                         low='a-ij-rs-z'
2018                         ;;
2019                     esac
2020                 fi
2021                 ;;
2022             esac
2023         fi
2024 esac
2025 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2026 ij)
2027     echo "Using $up and $low to convert case." >&4
2028     ;;
2029 *)
2030     echo "I don't know how to translate letters from upper to lower case." >&4
2031     echo "Your tr is not acting any way I know of." >&4
2032     exit 1
2033     ;;
2034 esac
2035 : set up the translation script tr, must be called with ./tr of course
2036 cat >tr <<EOSC
2037 $startsh
2038 case "\$1\$2" in
2039 '[A-Z][a-z]') exec $tr '$up' '$low';;
2040 '[a-z][A-Z]') exec $tr '$low' '$up';;
2041 esac
2042 exec $tr "\$@"
2043 EOSC
2044 chmod +x tr
2045 $eunicefix tr
2046
2047 : Try to determine whether config.sh was made on this system
2048 case "$config_sh" in
2049 '')
2050 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2051 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2052 # because the A-Z/a-z are not consecutive.
2053 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2054         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2055 newmyuname="$myuname"
2056 dflt=n
2057 case "$knowitall" in
2058 '')
2059         if test -f ../config.sh; then
2060                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2061                         eval "`grep myuname= ../config.sh`"
2062                 fi
2063                 if test "X$myuname" = "X$newmyuname"; then
2064                         dflt=y
2065                 fi
2066         fi
2067         ;;
2068 *) dflt=y;;
2069 esac
2070
2071 : Get old answers from old config file if Configure was run on the
2072 : same system, otherwise use the hints.
2073 hint=default
2074 cd ..
2075 if test -f config.sh; then
2076         echo " "
2077         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2078         . UU/myread
2079         case "$ans" in
2080         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2081         *)  echo "Fetching default answers from your old config.sh file..." >&4
2082                 tmp_n="$n"
2083                 tmp_c="$c"
2084                 tmp_sh="$sh"
2085                 . ./config.sh
2086                 cp config.sh UU
2087                 n="$tmp_n"
2088                 c="$tmp_c"
2089                 : Older versions did not always set $sh.  Catch re-use of such
2090                 : an old config.sh.
2091                 case "$sh" in
2092                 '') sh="$tmp_sh" ;;
2093                 esac
2094                 hint=previous
2095                 ;;
2096         esac
2097 fi
2098 if test ! -f config.sh; then
2099         $cat <<EOM
2100
2101 First time through, eh?  I have some defaults handy for some systems
2102 that need some extra help getting the Configure answers right:
2103
2104 EOM
2105         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2106         dflt=''
2107         : Half the following guesses are probably wrong... If you have better
2108         : tests or hints, please send them to perlbug@perl.com
2109         : The metaconfig authors would also appreciate a copy...
2110         $test -f /irix && osname=irix
2111         $test -f /xenix && osname=sco_xenix
2112         $test -f /dynix && osname=dynix
2113         $test -f /dnix && osname=dnix
2114         $test -f /lynx.os && osname=lynxos
2115         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2116         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2117         $test -f /bin/mips && /bin/mips && osname=mips
2118         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2119                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2120         $test -d /usr/apollo/bin && osname=apollo
2121         $test -f /etc/saf/_sactab && osname=svr4
2122         $test -d /usr/include/minix && osname=minix
2123         if $test -d /MachTen -o -d /MachTen_Folder; then
2124                 osname=machten
2125                 if $test -x /sbin/version; then
2126                         osvers=`/sbin/version | $awk '{print $2}' |
2127                         $sed -e 's/[A-Za-z]$//'`
2128                 elif $test -x /usr/etc/version; then
2129                         osvers=`/usr/etc/version | $awk '{print $2}' |
2130                         $sed -e 's/[A-Za-z]$//'`
2131                 else
2132                         osvers="$2.$3"
2133                 fi
2134         fi
2135        $test -f /sys/posix.dll &&
2136                $test -f /usr/bin/what &&
2137                set X `/usr/bin/what /sys/posix.dll` &&
2138                $test "$3" = UWIN &&
2139                osname=uwin &&
2140                osvers="$5"
2141         if $test -f $uname; then
2142                 set X $myuname
2143                 shift
2144
2145                 case "$5" in
2146                 fps*) osname=fps ;;
2147                 mips*)
2148                         case "$4" in
2149                         umips) osname=umips ;;
2150                         *) osname=mips ;;
2151                         esac;;
2152                 [23]100) osname=mips ;;
2153                 next*) osname=next ;;
2154                 i386*)
2155                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2156                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2157                                 osname='sco'
2158                                 osvers=$tmp
2159                         elif $test -f /etc/kconfig; then
2160                                 osname=isc
2161                                 if test "$lns" = "$ln -s"; then
2162                                         osvers=4
2163                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2164                                         osvers=3
2165                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2166                                         osvers=2
2167                                 fi
2168                         fi
2169                         tmp=''
2170                         ;;
2171                 pc*)
2172                         if test -n "$DJGPP"; then
2173                                 osname=dos
2174                                 osvers=djgpp
2175                         fi
2176                         ;;
2177                 esac
2178
2179                 case "$1" in
2180                 aix) osname=aix
2181                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2182                         case "$tmp" in
2183                         'not found') osvers="$4"."$3" ;;
2184                         '<3240'|'<>3240') osvers=3.2.0 ;;
2185                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2186                         '=3250'|'>3250') osvers=3.2.5 ;;
2187                         *) osvers=$tmp;;
2188                         esac
2189                         ;;
2190                 *dc.osx) osname=dcosx
2191                         osvers="$3"
2192                         ;;
2193                 dnix) osname=dnix
2194                         osvers="$3"
2195                         ;;
2196                 domainos) osname=apollo
2197                         osvers="$3"
2198                         ;;
2199                 dgux) osname=dgux 
2200                         osvers="$3"
2201                         ;;
2202                 dynixptx*) osname=dynixptx
2203                         osvers=`echo "$4"|sed 's/^v//'`
2204                         ;;
2205                 freebsd) osname=freebsd 
2206                         osvers="$3" ;;
2207                 genix) osname=genix ;;
2208                 hp*) osname=hpux 
2209                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2210                         ;;
2211                 irix*) osname=irix
2212                         case "$3" in
2213                         4*) osvers=4 ;;
2214                         5*) osvers=5 ;;
2215                         *)      osvers="$3" ;;
2216                         esac
2217                         ;;
2218                 linux) osname=linux
2219                         case "$3" in
2220                         *)      osvers="$3" ;;
2221                         esac
2222                         ;;
2223                 MiNT) osname=mint
2224                         ;;
2225                 netbsd*) osname=netbsd
2226                         osvers="$3"
2227                         ;;
2228                 news-os) osvers="$3"
2229                         case "$3" in
2230                         4*) osname=newsos4 ;;
2231                         *) osname=newsos ;;
2232                         esac
2233                         ;;
2234                 bsd386) osname=bsd386
2235                         osvers=`$uname -r`
2236                         ;;
2237                 POSIX-BC | posix-bc ) osname=posix-bc
2238                         osvers="$3"
2239                         ;;
2240                 powerux | power_ux | powermax_os | powermaxos | \
2241                 powerunix | power_unix) osname=powerux
2242                         osvers="$3"
2243                         ;;
2244                 next*) osname=next ;;
2245                 solaris) osname=solaris
2246                         case "$3" in
2247                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2248                         *)      osvers="$3" ;;
2249                         esac
2250                         ;;
2251                 sunos) osname=sunos
2252                         case "$3" in
2253                         5*) osname=solaris
2254                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2255                         *)      osvers="$3" ;;
2256                         esac
2257                         ;;
2258                 titanos) osname=titanos
2259                         case "$3" in
2260                         1*) osvers=1 ;;
2261                         2*) osvers=2 ;;
2262                         3*) osvers=3 ;;
2263                         4*) osvers=4 ;;
2264                         *)      osvers="$3" ;;
2265                         esac
2266                         ;;
2267                 ultrix) osname=ultrix
2268                         osvers="$3"
2269                         ;;
2270                 osf1|mls+)      case "$5" in
2271                                 alpha)
2272                                         osname=dec_osf
2273                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2274                                         ;;
2275                         hp*)    osname=hp_osf1  ;;
2276                         mips)   osname=mips_osf1 ;;
2277                         esac
2278                         ;;
2279                 uts) osname=uts 
2280                         osvers="$3"
2281                         ;;
2282                 qnx) osname=qnx
2283                         osvers="$4"
2284                         ;;
2285                 $2) case "$osname" in
2286                         *isc*) ;;
2287                         *freebsd*) ;;
2288                         svr*)
2289                                 : svr4.x or possibly later
2290                                 case "svr$3" in 
2291                                 ${osname}*)
2292                                         osname=svr$3
2293                                         osvers=$4
2294                                         ;;
2295                                 esac
2296                                 case "$osname" in
2297                                 svr4.0)
2298                                         : Check for ESIX
2299                                         if test -f /stand/boot ; then
2300                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2301                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2302                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2303                                                         if test -n "$isesix"; then
2304                                                                 osname=esix4
2305                                                         fi
2306                                                 fi
2307                                         fi
2308                                         ;;
2309                                 esac
2310                                 ;;
2311                         *)      if test -f /etc/systemid; then
2312                                         osname=sco
2313                                         set `echo $3 | $sed 's/\./ /g'` $4
2314                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2315                                                 osvers=$1.$2.$3
2316                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2317                                                 osvers=$1.$2
2318                                         elif $test -f $src/hints/sco_$1.sh; then
2319                                                 osvers=$1
2320                                         fi
2321                                 else
2322                                         case "$osname" in
2323                                         '') : Still unknown.  Probably a generic Sys V.
2324                                                 osname="sysv"
2325                                                 osvers="$3"
2326                                                 ;;
2327                                         esac
2328                                 fi
2329                                 ;;
2330                         esac
2331                         ;;
2332                 *)      case "$osname" in
2333                         '') : Still unknown.  Probably a generic BSD.
2334                                 osname="$1"
2335                                 osvers="$3"
2336                                 ;;
2337                         esac
2338                         ;;
2339                 esac
2340         else
2341                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2342                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2343                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2344                                 osname=news_os
2345                         fi
2346                         $rm -f UU/kernel.what
2347                 elif test -d c:/.; then
2348                         set X $myuname
2349                         osname=os2
2350                         osvers="$5"
2351                 fi
2352         fi
2353         
2354         : Now look for a hint file osname_osvers, unless one has been
2355         : specified already.
2356         case "$hintfile" in
2357         ''|' ')
2358                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2359                 : Also try without trailing minor version numbers.
2360                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2361                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2362                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2363                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2364                 case "$file" in
2365                 '') dflt=none ;;
2366                 *)  case "$osvers" in
2367                         '') dflt=$file
2368                                 ;;
2369                         *)  if $test -f $src/hints/$file.sh ; then
2370                                         dflt=$file
2371                                 elif $test -f $src/hints/$xfile.sh ; then
2372                                         dflt=$xfile
2373                                 elif $test -f $src/hints/$xxfile.sh ; then
2374                                         dflt=$xxfile
2375                                 elif $test -f $src/hints/$xxxfile.sh ; then
2376                                         dflt=$xxxfile
2377                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2378                                         dflt=$xxxxfile
2379                                 elif $test -f "$src/hints/${osname}.sh" ; then
2380                                         dflt="${osname}"
2381                                 else
2382                                         dflt=none
2383                                 fi
2384                                 ;;
2385                         esac
2386                         ;;
2387                 esac
2388                 if $test -f Policy.sh ; then
2389                         case "$dflt" in
2390                         *Policy*) ;;
2391                         none) dflt="Policy" ;;
2392                         *) dflt="Policy $dflt" ;;
2393                         esac
2394                 fi
2395                 ;;
2396         *)
2397                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2398                 ;;
2399         esac
2400
2401         if $test -f Policy.sh ; then
2402                 $cat <<EOM
2403
2404 There's also a Policy hint file available, which should make the
2405 site-specific (policy) questions easier to answer.
2406 EOM
2407
2408         fi
2409
2410         $cat <<EOM
2411
2412 You may give one or more space-separated answers, or "none" if appropriate.
2413 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2414 is a good thing.  DO NOT give a wrong version or a wrong OS.
2415
2416 EOM
2417
2418         rp="Which of these apply, if any?"
2419         . UU/myread
2420         tans=$ans
2421         for file in $tans; do
2422                 if $test X$file = XPolicy -a -f Policy.sh; then
2423                         . Policy.sh
2424                         $cat Policy.sh >> UU/config.sh
2425                 elif $test -f $src/hints/$file.sh; then
2426                         . $src/hints/$file.sh
2427                         $cat $src/hints/$file.sh >> UU/config.sh
2428                 elif $test X$tans = X -o X$tans = Xnone ; then
2429                         : nothing
2430                 else
2431                         : Give one chance to correct a possible typo.
2432                         echo "$file.sh does not exist"
2433                         dflt=$file
2434                         rp="hint to use instead?"
2435                         . UU/myread
2436                         for file in $ans; do
2437                                 if $test -f "$src/hints/$file.sh"; then
2438                                         . $src/hints/$file.sh
2439                                         $cat $src/hints/$file.sh >> UU/config.sh
2440                                 elif $test X$ans = X -o X$ans = Xnone ; then
2441                                         : nothing
2442                                 else
2443                                         echo "$file.sh does not exist -- ignored."
2444                                 fi
2445                         done
2446                 fi
2447         done
2448
2449         hint=recommended
2450         : Remember our hint file for later.
2451         if $test -f "$src/hints/$file.sh" ; then
2452                 hintfile="$file"
2453         else
2454                 hintfile=''
2455         fi
2456 fi
2457 cd UU
2458 ;;
2459 *)
2460         echo " "
2461         echo "Fetching default answers from $config_sh..." >&4
2462         tmp_n="$n"
2463         tmp_c="$c"
2464         cd ..
2465         cp $config_sh config.sh 2>/dev/null
2466         chmod +w config.sh
2467         . ./config.sh
2468         cd UU
2469         cp ../config.sh .
2470         n="$tmp_n"
2471         c="$tmp_c"
2472         hint=previous
2473         ;;
2474 esac
2475 test "$override" && . ./optdef.sh
2476 myuname="$newmyuname"
2477
2478 : Restore computed paths
2479 for file in $loclist $trylist; do
2480         eval $file="\$_$file"
2481 done
2482
2483 cat << EOM
2484
2485 Configure uses the operating system name and version to set some defaults.
2486 The default value is probably right if the name rings a bell. Otherwise,
2487 since spelling matters for me, either accept the default or answer "none"
2488 to leave it blank.
2489
2490 EOM
2491 case "$osname" in
2492         ''|' ')
2493                 case "$hintfile" in
2494                 ''|' '|none) dflt=none ;;
2495                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2496                 esac
2497                 ;;
2498         *) dflt="$osname" ;;
2499 esac
2500 rp="Operating system name?"
2501 . ./myread
2502 case "$ans" in
2503 none)  osname='' ;;
2504 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2505 esac
2506 echo " "
2507 case "$osvers" in
2508         ''|' ')
2509                 case "$hintfile" in
2510                 ''|' '|none) dflt=none ;;
2511                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2512                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2513                         case "$dflt" in
2514                         ''|' ') dflt=none ;;
2515                         esac
2516                         ;;
2517                 esac
2518                 ;;
2519         *) dflt="$osvers" ;;
2520 esac
2521 rp="Operating system version?"
2522 . ./myread
2523 case "$ans" in
2524 none)  osvers='' ;;
2525 *) osvers="$ans" ;;
2526 esac
2527
2528 : who configured the system
2529 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2530 cf_by=`(logname) 2>/dev/null`
2531 case "$cf_by" in
2532 "")
2533         cf_by=`(whoami) 2>/dev/null`
2534         case "$cf_by" in
2535         "") cf_by=unknown ;;
2536         esac ;;
2537 esac
2538
2539 : set up the script used to warn in case of inconsistency
2540 cat <<EOS >whoa
2541 $startsh
2542 EOS
2543 cat <<'EOSC' >>whoa
2544 dflt=y
2545 echo " "
2546 echo "*** WHOA THERE!!! ***" >&4
2547 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2548 rp="    Keep the $hint value?"
2549 . ./myread
2550 case "$ans" in
2551 y) td=$was; tu=$was;;
2552 esac
2553 EOSC
2554
2555 : function used to set $1 to $val
2556 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2557 case "$val$was" in
2558 $define$undef) . ./whoa; eval "$var=\$td";;
2559 $undef$define) . ./whoa; eval "$var=\$tu";;
2560 *) eval "$var=$val";;
2561 esac'
2562
2563 cat <<EOM
2564
2565 Perl can be built to take advantage of threads, on some systems.
2566 To do so, Configure must be run with -Dusethreads.
2567
2568 Note that threading is a highly experimental feature, and
2569 some known race conditions still remain.  If you choose to try
2570 it, be very sure to not actually deploy it for production
2571 purposes.  README.threads has more details, and is required
2572 reading if you enable threads.
2573 EOM
2574 case "$usethreads" in
2575 $define|true|[yY]*)     dflt='y';;
2576 *) dflt='n';;
2577 esac
2578 rp='Build a threading Perl?'
2579 . ./myread
2580 case "$ans" in
2581 y|Y)    val="$define" ;;     
2582 *)      val="$undef" ;;
2583 esac
2584 set usethreads
2585 eval $setvar 
2586
2587 case "$d_oldpthreads" in
2588 '')     : Configure tests would be welcome here.  For now, assume undef.
2589         val="$undef" ;;
2590 *)      val="$d_oldpthreads" ;;
2591 esac
2592 set d_oldpthreads
2593 eval $setvar
2594
2595
2596 case "$usethreads" in
2597 "$define"|true|[yY]*)
2598 : Look for a hint-file generated 'call-back-unit'.  If the
2599 : user has specified that a threading perl is to be built,
2600 : we may need to set or change some other defaults.
2601         if $test -f usethreads.cbu; then
2602                 echo "Your platform has some specific hints for threaded builds, using them..."
2603                 . ./usethreads.cbu
2604         else
2605                 $cat <<EOM
2606 (Your platform doesn't have any specific hints for threaded builds.
2607  Assuming POSIX threads, then.)
2608 EOM
2609         fi
2610     ;;
2611 esac
2612
2613 cat <<EOM
2614
2615 Perl can be built so that multiple Perl interpreters can coexist
2616 within the same Perl executable.  To do so, Configure must be run with
2617 -Dusemultiplicity.
2618
2619 Normally you do not need this and you should answer no.
2620
2621 EOM
2622 case "$usemultiplicity" in
2623 $define|true|[yY]*)     dflt='y';;
2624 *) dflt='n';;
2625 esac
2626 rp='Build Perl for multiplicity?'
2627 . ./myread
2628 case "$ans" in
2629 y|Y)    val="$define" ;;     
2630 *)      val="$undef" ;;
2631 esac
2632 set usemultiplicity
2633 eval $setvar 
2634
2635 : determine where manual pages are on this system
2636 echo " "
2637 case "$sysman" in
2638 '') 
2639         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2640         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2641         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2642         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2643         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2644         sysman=`./loc . /usr/man/man1 $syspath`
2645         ;;
2646 esac
2647 if $test -d "$sysman"; then
2648         echo "System manual is in $sysman." >&4
2649 else
2650         echo "Could not find manual pages in source form." >&4
2651 fi
2652
2653 : see what memory models we can support
2654 case "$models" in
2655 '')
2656         $cat >pdp11.c <<'EOP'
2657 int main() {
2658 #ifdef pdp11
2659         exit(0);
2660 #else
2661         exit(1);
2662 #endif
2663 }
2664 EOP
2665         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2666         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2667                 dflt='unsplit split'
2668         else
2669                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2670                 case "$tans" in
2671                 X) dflt='none';;
2672                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2673                                 dflt='small'
2674                         else
2675                                 dflt=''
2676                         fi
2677                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2678                                 dflt="$dflt medium"
2679                         fi
2680                         if $test -d /lib/large || $test -d /usr/lib/large; then
2681                                 dflt="$dflt large"
2682                         fi
2683                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2684                                 dflt="$dflt huge"
2685                         fi
2686                 esac
2687         fi;;
2688 *) dflt="$models";;
2689 esac
2690 $cat <<EOM
2691  
2692 Some systems have different model sizes.  On most systems they are called
2693 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2694 split.  If your system doesn't support different memory models, say "none".
2695 If you wish to force everything to one memory model, say "none" here and
2696 put the appropriate flags later when it asks you for other cc and ld flags.
2697 Venix systems may wish to put "none" and let the compiler figure things out.
2698 (In the following question multiple model names should be space separated.)
2699
2700 The default for most systems is "none".
2701
2702 EOM
2703 rp="Which memory models are supported?"
2704 . ./myread
2705 models="$ans"
2706
2707 case "$models" in
2708 none)
2709         small=''
2710         medium=''
2711         large=''
2712         huge=''
2713         unsplit=''
2714         split=''
2715         ;;
2716 *split)
2717         case "$split" in
2718         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2719                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2720                         dflt='-i'
2721                 else
2722                         dflt='none'
2723                 fi;;
2724         *) dflt="$split";;
2725         esac
2726         rp="What flag indicates separate I and D space?"
2727         . ./myread
2728         tans="$ans"
2729         case "$tans" in
2730         none) tans='';;
2731         esac
2732         split="$tans"
2733         unsplit='';;
2734 *large*|*small*|*medium*|*huge*)
2735         case "$models" in
2736         *large*)
2737                 case "$large" in
2738                 '') dflt='-Ml';;
2739                 *) dflt="$large";;
2740                 esac
2741         rp="What flag indicates large model?"
2742         . ./myread
2743         tans="$ans"
2744         case "$tans" in
2745         none) tans='';
2746         esac
2747         large="$tans";;
2748         *) large='';;
2749         esac
2750         case "$models" in
2751         *huge*) case "$huge" in
2752                 '') dflt='-Mh';;
2753                 *) dflt="$huge";;
2754                 esac
2755                 rp="What flag indicates huge model?"
2756                 . ./myread
2757                 tans="$ans"
2758                 case "$tans" in
2759                 none) tans='';
2760                 esac
2761                 huge="$tans";;
2762         *) huge="$large";;
2763         esac
2764         case "$models" in
2765         *medium*) case "$medium" in
2766                 '') dflt='-Mm';;
2767                 *) dflt="$medium";;
2768                 esac
2769                 rp="What flag indicates medium model?"
2770                 . ./myread
2771                 tans="$ans"
2772                 case "$tans" in
2773                 none) tans='';
2774                 esac
2775                 medium="$tans";;
2776         *) medium="$large";;
2777         esac
2778         case "$models" in
2779         *small*) case "$small" in
2780                 '') dflt='none';;
2781                 *) dflt="$small";;
2782                 esac
2783                 rp="What flag indicates small model?"
2784                 . ./myread
2785                 tans="$ans"
2786                 case "$tans" in
2787                 none) tans='';
2788                 esac
2789                 small="$tans";;
2790         *) small='';;
2791         esac
2792         ;;
2793 *)
2794         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2795         ;;
2796 esac
2797 $rm -f pdp11.* pdp11
2798
2799 : make some quick guesses about what we are up against
2800 echo " "
2801 $echo $n "Hmm...  $c"
2802 echo exit 1 >bsd
2803 echo exit 1 >usg
2804 echo exit 1 >v7
2805 echo exit 1 >osf1
2806 echo exit 1 >eunice
2807 echo exit 1 >xenix
2808 echo exit 1 >venix
2809 echo exit 1 >os2
2810 d_bsd="$undef"
2811 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2812 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2813 then
2814         echo "Looks kind of like an OSF/1 system, but we'll see..."
2815         echo exit 0 >osf1
2816 elif test `echo abc | tr a-z A-Z` = Abc ; then
2817         xxx=`./loc addbib blurfl $pth`
2818         if $test -f $xxx; then
2819         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2820                 echo exit 0 >bsd
2821                 echo exit 0 >usg
2822         else
2823                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2824                         echo "Looks kind of like an extended USG system, but we'll see..."
2825                 else
2826                         echo "Looks kind of like a USG system, but we'll see..."
2827                 fi
2828                 echo exit 0 >usg
2829         fi
2830 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2831         echo "Looks kind of like a BSD system, but we'll see..."
2832         d_bsd="$define"
2833         echo exit 0 >bsd
2834 else
2835         echo "Looks kind of like a Version 7 system, but we'll see..."
2836         echo exit 0 >v7
2837 fi
2838 case "$eunicefix" in
2839 *unixtovms*)
2840         $cat <<'EOI'
2841 There is, however, a strange, musty smell in the air that reminds me of
2842 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2843 EOI
2844         echo exit 0 >eunice
2845         d_eunice="$define"
2846 : it so happens the Eunice I know will not run shell scripts in Unix format
2847         ;;
2848 *)
2849         echo " "
2850         echo "Congratulations.  You aren't running Eunice."
2851         d_eunice="$undef"
2852         ;;
2853 esac
2854 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2855 case "$p_" in
2856 :) ;;
2857 *)
2858         $cat <<'EOI'
2859 I have the feeling something is not exactly right, however...don't tell me...
2860 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2861 EOI
2862         echo exit 0 >os2
2863         ;;
2864 esac
2865 if test -f /xenix; then
2866         echo "Actually, this looks more like a XENIX system..."
2867         echo exit 0 >xenix
2868         d_xenix="$define"
2869 else
2870         echo " "
2871         echo "It's not Xenix..."
2872         d_xenix="$undef"
2873 fi
2874 chmod +x xenix
2875 $eunicefix xenix
2876 if test -f /venix; then
2877         echo "Actually, this looks more like a VENIX system..."
2878         echo exit 0 >venix
2879 else
2880         echo " "
2881         if ./xenix; then
2882                 : null
2883         else
2884                 echo "Nor is it Venix..."
2885         fi
2886 fi
2887 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2888 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2889 $rm -f foo
2890
2891 : see if we need a special compiler
2892 echo " "
2893 if ./usg; then
2894         case "$cc" in
2895         '') case "$Mcc" in
2896                 /*) dflt='Mcc';;
2897                 *) case "$large" in
2898                         -M*) dflt='cc';;
2899                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2900                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2901                                                 dflt='cc'
2902                                         else
2903                                                 dflt='cc -M'
2904                                         fi
2905                                 else
2906                                         dflt='cc'
2907                                 fi;;
2908                         esac;;
2909                 esac;;
2910         *)  dflt="$cc";;
2911         esac
2912         case "$dflt" in
2913         *M*)    $cat <<'EOM'
2914 On some older systems the default C compiler will not resolve multiple global
2915 references that happen to have the same name.  On some such systems the "Mcc"
2916 command may be used to force these to be resolved.  On other systems a "cc -M"
2917 command is required.  (Note that the -M flag on other systems indicates a
2918 memory model to use!) If you have the Gnu C compiler, you might wish to use
2919 that instead.
2920
2921 EOM
2922         ;;
2923         esac
2924         rp="Use which C compiler?"
2925         . ./myread
2926         cc="$ans"
2927 else
2928         case "$cc" in
2929         '') dflt=cc;;
2930         *) dflt="$cc";;
2931         esac
2932         rp="Use which C compiler?"
2933         . ./myread
2934         cc="$ans"
2935 fi
2936 : Look for a hint-file generated 'call-back-unit'.  Now that the
2937 : user has specified the compiler, we may need to set or change some
2938 : other defaults.
2939 if $test -f cc.cbu; then
2940     . ./cc.cbu
2941 fi
2942 echo " "
2943 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2944 $cat >gccvers.c <<EOM
2945 #include <stdio.h>
2946 int main() {
2947 #ifdef __GNUC__
2948 #ifdef __VERSION__
2949         printf("%s\n", __VERSION__);
2950 #else
2951         printf("%s\n", "1");
2952 #endif
2953 #endif
2954         exit(0);
2955 }
2956 EOM
2957 if $cc -o gccvers gccvers.c; then
2958         gccversion=`./gccvers`
2959         case "$gccversion" in
2960         '') echo "You are not using GNU cc." ;;
2961         *)  echo "You are using GNU cc $gccversion." ;;
2962         esac
2963 else
2964         echo " "
2965         echo "*** WHOA THERE!!! ***" >&4
2966         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
2967         case "$knowitall" in
2968         '')
2969         echo "    You'd better start hunting for one and let me know about it." >&4
2970                 exit 1
2971                 ;;
2972         esac
2973 fi
2974 $rm -f gccvers*
2975 case "$gccversion" in
2976 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2977 esac
2978
2979 cat <<EOM
2980
2981 Perl can be built to take advantage of explicit 64-bit interfaces,
2982 on some systems.  To do so, Configure must be run with -Duse64bits.
2983
2984 If this doesn't make any sense to you, just accept the default 'n'.
2985 EOM
2986 case "$use64bits" in
2987 $define|true|[yY]*)     dflt='y';;
2988 *) dflt='n';;
2989 esac
2990 rp='Try to use explicit 64-bit interfaces, if available?'
2991 . ./myread
2992 case "$ans" in
2993 y|Y) 
2994         val="$define"
2995         ;;     
2996 *)      
2997         val="$undef"
2998         ;;
2999 esac
3000 set use64bits
3001 eval $setvar
3002
3003 case "$archname64" in
3004 '') archname64='' ;;    # not a typo
3005 esac
3006
3007 case "$use64bits" in
3008 "$define"|true|[yY]*)
3009 : Look for a hint-file generated 'call-back-unit'.  If the
3010 : user has specified that a 64 bit perl is to be built,
3011 : we may need to set or change some other defaults.
3012         if $test -f use64bits.cbu; then
3013                 echo "Your platform has some specific hints for 64-bit builds, using them..."
3014                 . ./use64bits.cbu
3015         else
3016                 $cat <<EOM
3017 (Your platform doesn't have any specific hints for 64-bit builds.
3018  This is probably okay, especially if your system is a true 64-bit system.)
3019 EOM
3020                 case "$gccversion" in
3021                 '')     ;;
3022                 *)      $cat <<EOM
3023 But since you seem to be using gcc,
3024 I will now add -DUSE_LONG_LONG to the compilation flags.
3025 EOM
3026                         ccflags="$ccflags -DUSE_LONG_LONG"
3027                         ;;
3028                 esac
3029         fi
3030         ;;
3031 esac
3032
3033 : determine the architecture name
3034 echo " "
3035 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3036         tarch=`arch`"-$osname"
3037 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3038         if uname -m > tmparch 2>&1 ; then
3039                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3040                         -e 's/$/'"-$osname/" tmparch`
3041         else
3042                 tarch="$osname"
3043         fi
3044         $rm -f tmparch
3045 else
3046         tarch="$osname"
3047 fi
3048 case "$myarchname" in
3049 ''|"$tarch") ;;
3050 *)
3051         echo "(Your architecture name used to be $myarchname.)"
3052         archname=''
3053         ;;
3054 esac
3055 myarchname="$tarch"
3056 case "$archname" in
3057 '') dflt="$tarch";;
3058 *) dflt="$archname";;
3059 esac
3060 rp='What is your architecture name'
3061 . ./myread
3062 archname="$ans"
3063 case "$usethreads" in
3064 $define)
3065         echo "Threads selected." >&4
3066         case "$archname" in
3067         *-thread*) echo "...and architecture name already has -thread." >&4
3068                 ;;
3069         *)      archname="$archname-thread"
3070                 echo "...setting architecture name to $archname." >&4
3071                 ;;
3072         esac
3073         ;;
3074 esac
3075 case "$usemultiplicity" in
3076 $define)
3077         echo "Multiplicity selected." >&4
3078         case "$archname" in
3079         *-multi*) echo "...and architecture name already has -multi." >&4
3080                 ;;
3081         *)      archname="$archname-multi"
3082                 echo "...setting architecture name to $archname." >&4
3083                 ;;
3084         esac
3085         ;;
3086 esac
3087 case "$use64bits" in
3088 $define)
3089         echo "Explicit 64-bitness selected." >&4
3090         case "$archname64" in
3091         '')
3092                 ;;
3093         *)
3094                 case "$archname" in
3095                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3096                         ;;
3097                 *)      archname="$archname-$archname64"
3098                         echo "...setting architecture name to $archname." >&4
3099                         ;;
3100                 esac
3101                 ;;
3102         esac
3103 esac
3104
3105 : decide how portable to be.  Allow command line overrides.
3106 case "$d_portable" in
3107 "$undef") ;;
3108 *)      d_portable="$define" ;;
3109 esac
3110
3111 : set up shell script to do ~ expansion
3112 cat >filexp <<EOSS
3113 $startsh
3114 : expand filename
3115 case "\$1" in
3116  ~/*|~)
3117         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3118         ;;
3119  ~*)
3120         if $test -f /bin/csh; then
3121                 /bin/csh -f -c "glob \$1"
3122                 failed=\$?
3123                 echo ""
3124                 exit \$failed
3125         else
3126                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3127                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3128                 if $test ! -d "\$dir"; then
3129                         me=\`basename \$0\`
3130                         echo "\$me: can't locate home directory for: \$name" >&2
3131                         exit 1
3132                 fi
3133                 case "\$1" in
3134                 */*)
3135                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3136                         ;;
3137                 *)
3138                         echo \$dir
3139                         ;;
3140                 esac
3141         fi
3142         ;;
3143 *)
3144         echo \$1
3145         ;;
3146 esac
3147 EOSS
3148 chmod +x filexp
3149 $eunicefix filexp
3150
3151 : now set up to get a file name
3152 cat <<EOS >getfile
3153 $startsh
3154 EOS
3155 cat <<'EOSC' >>getfile
3156 tilde=''
3157 fullpath=''
3158 already=''
3159 skip=''
3160 none_ok=''
3161 exp_file=''
3162 nopath_ok=''
3163 orig_rp="$rp"
3164 orig_dflt="$dflt"
3165 case "$gfpth" in
3166 '') gfpth='.' ;;
3167 esac
3168
3169 case "$fn" in
3170 *\(*)
3171         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3172         fn=`echo $fn | sed 's/(.*)//'`
3173         ;;
3174 esac
3175
3176 case "$fn" in
3177 *:*)
3178         loc_file=`expr $fn : '.*:\(.*\)'`
3179         fn=`expr $fn : '\(.*\):.*'`
3180         ;;
3181 esac
3182
3183 case "$fn" in
3184 *~*) tilde=true;;
3185 esac
3186 case "$fn" in
3187 */*) fullpath=true;;
3188 esac
3189 case "$fn" in
3190 *+*) skip=true;;
3191 esac
3192 case "$fn" in
3193 *n*) none_ok=true;;
3194 esac
3195 case "$fn" in
3196 *e*) exp_file=true;;
3197 esac
3198 case "$fn" in
3199 *p*) nopath_ok=true;;
3200 esac
3201
3202 case "$fn" in
3203 *f*) type='File';;
3204 *d*) type='Directory';;
3205 *l*) type='Locate';;
3206 esac
3207
3208 what="$type"
3209 case "$what" in
3210 Locate) what='File';;
3211 esac
3212
3213 case "$exp_file" in
3214 '')
3215         case "$d_portable" in
3216         "$define") ;;
3217         *) exp_file=true;;
3218         esac
3219         ;;
3220 esac
3221
3222 cd ..
3223 while test "$type"; do
3224         redo=''
3225         rp="$orig_rp"
3226         dflt="$orig_dflt"
3227         case "$tilde" in
3228         true) rp="$rp (~name ok)";;
3229         esac
3230         . UU/myread
3231         if test -f UU/getfile.ok && \
3232                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3233         then
3234                 value="$ans"
3235                 ansexp="$ans"
3236                 break
3237         fi
3238         case "$ans" in
3239         none)
3240                 value=''
3241                 ansexp=''
3242                 case "$none_ok" in
3243                 true) type='';;
3244                 esac
3245                 ;;
3246         *)
3247                 case "$tilde" in
3248                 '') value="$ans"
3249                         ansexp="$ans";;
3250                 *)
3251                         value=`UU/filexp $ans`
3252                         case $? in
3253                         0)
3254                                 if test "$ans" != "$value"; then
3255                                         echo "(That expands to $value on this system.)"
3256                                 fi
3257                                 ;;
3258                         *) value="$ans";;
3259                         esac
3260                         ansexp="$value"
3261                         case "$exp_file" in
3262                         '') value="$ans";;
3263                         esac
3264                         ;;
3265                 esac
3266                 case "$fullpath" in
3267                 true)
3268                         case "$ansexp" in
3269                         /*) value="$ansexp" ;;
3270                         *)
3271                                 redo=true
3272                                 case "$already" in
3273                                 true)
3274                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3275                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3276                                         ;;
3277                                 *)
3278                                 echo "Please give a full path name, starting with slash." >&4
3279                                         case "$tilde" in
3280                                         true)
3281                                 echo "Note that using ~name is ok provided it expands well." >&4
3282                                                 already=true
3283                                                 ;;
3284                                         esac
3285                                 esac
3286                                 ;;
3287                         esac
3288                         ;;
3289                 esac
3290                 case "$redo" in
3291                 '')
3292                         case "$type" in
3293                         File)
3294                                 for fp in $gfpth; do
3295                                         if test "X$fp" = X.; then
3296                                             pf="$ansexp"
3297                                         else    
3298                                             pf="$fp/$ansexp"
3299                                         fi
3300                                         if test -f "$pf"; then
3301                                                 type=''
3302                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3303                                         then
3304                                                 echo "($value is not a plain file, but that's ok.)"
3305                                                 type=''
3306                                         fi
3307                                         if test X"$type" = X; then
3308                                             value="$pf"
3309                                             break
3310                                         fi
3311                                 done
3312                                 ;;
3313                         Directory)
3314                                 for fp in $gfpth; do
3315                                         if test "X$fp" = X.; then
3316                                             pf="$ansexp"
3317                                         else    
3318                                             pf="$fp/$ansexp"
3319                                         fi
3320                                         if test -d "$pf"; then
3321                                                 type=''
3322                                                 value="$pf"
3323                                                 break
3324                                         fi
3325                                 done
3326                                 ;;
3327                         Locate)
3328                                 if test -d "$ansexp"; then
3329                                         echo "(Looking for $loc_file in directory $value.)"
3330                                         value="$value/$loc_file"
3331                                         ansexp="$ansexp/$loc_file"
3332                                 fi
3333                                 if test -f "$ansexp"; then
3334                                         type=''
3335                                 fi
3336                                 case "$nopath_ok" in
3337                                 true)   case "$value" in
3338                                         */*) ;;
3339                                         *)      echo "Assuming $value will be in people's path."
3340                                                 type=''
3341                                                 ;;
3342                                         esac
3343                                         ;;
3344                                 esac
3345                                 ;;
3346                         esac
3347
3348                         case "$skip" in
3349                         true) type='';
3350                         esac
3351
3352                         case "$type" in
3353                         '') ;;
3354                         *)
3355                                 if test "$fastread" = yes; then
3356                                         dflt=y
3357                                 else
3358                                         dflt=n
3359                                 fi
3360                                 rp="$what $value doesn't exist.  Use that name anyway?"
3361                                 . UU/myread
3362                                 dflt=''
3363                                 case "$ans" in
3364                                 y*) type='';;
3365                                 *) echo " ";;
3366                                 esac
3367                                 ;;
3368                         esac
3369                         ;;
3370                 esac
3371                 ;;
3372         esac
3373 done
3374 cd UU
3375 ans="$value"
3376 rp="$orig_rp"
3377 dflt="$orig_dflt"
3378 rm -f getfile.ok
3379 test "X$gfpthkeep" != Xy && gfpth=""
3380 EOSC
3381
3382 : determine root of directory hierarchy where package will be installed.
3383 case "$prefix" in
3384 '')
3385         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3386         ;;
3387 *)
3388         dflt="$prefix"
3389         ;;
3390 esac
3391 $cat <<EOM
3392
3393 By default, $package will be installed in $dflt/bin, manual pages
3394 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3395 installation directories. Typically this is something like /usr/local.
3396 If you wish to have binaries under /usr/bin but other parts of the
3397 installation under /usr/local, that's ok: you will be prompted
3398 separately for each of the installation directories, the prefix being
3399 only used to set the defaults.
3400
3401 EOM
3402 fn=d~
3403 rp='Installation prefix to use?'
3404 . ./getfile
3405 oldprefix=''
3406 case "$prefix" in
3407 '') ;;
3408 *)
3409         case "$ans" in
3410         "$prefix") ;;
3411         *) oldprefix="$prefix";;
3412         esac
3413         ;;
3414 esac
3415 prefix="$ans"
3416 prefixexp="$ansexp"
3417
3418 : is AFS running?
3419 echo " "
3420 case "$afs" in
3421 $define|true)   afs=true ;;
3422 $undef|false)   afs=false ;;
3423 *)      if test -d /afs; then
3424                 afs=true
3425         else
3426                 afs=false
3427         fi
3428         ;;
3429 esac
3430 if $afs; then
3431         echo "AFS may be running... I'll be extra cautious then..." >&4
3432 else
3433         echo "AFS does not seem to be running..." >&4
3434 fi
3435
3436 : determine installation prefix for where package is to be installed.
3437 if $afs; then 
3438 $cat <<EOM
3439
3440 Since you are running AFS, I need to distinguish the directory in which
3441 files will reside from the directory in which they are installed (and from
3442 which they are presumably copied to the former directory by occult means).
3443
3444 EOM
3445         case "$installprefix" in
3446         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3447         *) dflt="$installprefix";;
3448         esac
3449 else
3450 $cat <<EOM
3451
3452 In some special cases, particularly when building $package for distribution,
3453 it is convenient to distinguish between the directory in which files should 
3454 be installed from the directory ($prefix) in which they 
3455 will eventually reside.  For most users, these two directories are the same.
3456
3457 EOM
3458         case "$installprefix" in
3459         '') dflt=$prefix ;;
3460         *) dflt=$installprefix;;
3461         esac
3462 fi
3463 fn=d~
3464 rp='What installation prefix should I use for installing files?'
3465 . ./getfile
3466 installprefix="$ans"
3467 installprefixexp="$ansexp"
3468
3469 : set the prefixit variable, to compute a suitable default value
3470 prefixit='case "$3" in
3471 ""|none)
3472         case "$oldprefix" in
3473         "") eval "$1=\"\$$2\"";;
3474         *)
3475                 case "$3" in
3476                 "") eval "$1=";;
3477                 none)
3478                         eval "tp=\"\$$2\"";
3479                         case "$tp" in
3480                         ""|" ") eval "$1=\"\$$2\"";;
3481                         *) eval "$1=";;
3482                         esac;;
3483                 esac;;
3484         esac;;
3485 *)
3486         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3487         case "$tp" in
3488         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3489         /*-$oldprefix/*|\~*-$oldprefix/*)
3490                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3491         *) eval "$1=\"\$$2\"";;
3492         esac;;
3493 esac'
3494
3495 : set the base revision
3496 baserev=5.0
3497
3498 : get the patchlevel
3499 echo " "
3500 echo "Getting the current patchlevel..." >&4
3501 if $test -r $rsrc/patchlevel.h;then
3502         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3503         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3504 else
3505         patchlevel=0
3506         subversion=0
3507 fi
3508 $echo $n "(You have $package" $c
3509 case "$package" in
3510 "*$baserev")    ;;
3511 *)              $echo $n " $baserev" $c ;;
3512 esac
3513 $echo $n " patchlevel $patchlevel" $c
3514 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3515 echo ".)"
3516
3517 if test 0 -eq "$subversion"; then
3518         version=`LC_ALL=C; export LC_ALL; \
3519                  echo $baserev $patchlevel | \
3520                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3521 else
3522         version=`LC_ALL=C; export LC_ALL; \
3523                  echo $baserev $patchlevel $subversion | \
3524                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3525 fi
3526 : Figure out perl API version.  Perhaps this should be in patchlevel.h
3527 if test "$subversion" -lt 50; then
3528         apiversion=`LC_ALL=C; export LC_ALL; \
3529                  LANGUAGE=C; export LANGUAGE; \
3530                  echo $baserev $patchlevel | \
3531                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3532 else
3533         apiversion="$version"
3534 fi
3535
3536 : determine installation style
3537 : For now, try to deduce it from prefix unless it is already set.
3538 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3539 case "$installstyle" in
3540 '')     case "$prefix" in
3541                 *perl*) dflt='lib';;
3542                 *) dflt='lib/perl5' ;;
3543         esac
3544         ;;
3545 *)      dflt='lib/perl5' ;;
3546 esac
3547 : Probably not worth prompting for this since we prompt for all
3548 : the directories individually, and the prompt would be too long and
3549 : confusing anyway.
3550 installstyle=$dflt
3551
3552 : determine where private library files go
3553 : Usual default is /usr/local/lib/perl5/$version.
3554 : Also allow things like /opt/perl/lib/$version, since 
3555 : /opt/perl/lib/perl5... would be redundant.
3556 : The default "style" setting is made in installstyle.U
3557 case "$installstyle" in
3558 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3559 *)       set dflt privlib lib/$version ;;
3560 esac
3561 eval $prefixit
3562 $cat <<EOM
3563
3564 There are some auxiliary files for $package that need to be put into a
3565 private library directory that is accessible by everyone.
3566
3567 EOM
3568 fn=d~+
3569 rp='Pathname where the private library files will reside?'
3570 . ./getfile
3571 privlib="$ans"
3572 privlibexp="$ansexp"
3573 : Change installation prefix, if necessary.
3574 if $test X"$prefix" != X"$installprefix"; then
3575         installprivlib=`echo $privlibexp | sed 's#^$prefix#$installprefix#'`
3576 else
3577         installprivlib="$privlibexp"
3578 fi
3579
3580 : set the prefixup variable, to restore leading tilda escape
3581 prefixup='case "$prefixexp" in
3582 "$prefix") ;;
3583 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3584 esac'
3585
3586 : determine where public architecture dependent libraries go
3587 set archlib archlib
3588 eval $prefixit
3589 : privlib default is /usr/local/lib/$package/$version
3590 : archlib default is /usr/local/lib/$package/$version/$archname
3591 : privlib may have an optional trailing /share.
3592 tdflt=`echo $privlib | $sed 's,/share$,,'`
3593 tdflt=$tdflt/$archname
3594 case "$archlib" in
3595 '')     dflt=$tdflt
3596         ;;
3597 *)      dflt="$archlib"
3598     ;;
3599 esac
3600 $cat <<EOM
3601
3602 $spackage contains architecture-dependent library files.  If you are
3603 sharing libraries in a heterogeneous environment, you might store
3604 these files in a separate location.  Otherwise, you can just include
3605 them with the rest of the public library files.
3606
3607 EOM
3608 fn=d+~
3609 rp='Where do you want to put the public architecture-dependent libraries?'
3610 . ./getfile
3611 archlib="$ans"
3612 archlibexp="$ansexp"
3613 if $test X"$archlib" = X"$privlib"; then
3614         d_archlib="$undef"
3615 else
3616         d_archlib="$define"
3617 fi
3618 : Change installation prefix, if necessary.
3619 if $test X"$prefix" != X"$installprefix"; then
3620         installarchlib=`echo $archlibexp | sed 's#^$prefix#$installprefix#'`
3621 else
3622         installarchlib="$archlibexp"
3623 fi
3624
3625
3626 : Binary compatibility with 5.005 is not possible for builds
3627 : with advanced features
3628 case "$usethreads$usemultiplicity" in
3629 *define*) bincompat5005="$undef" ;;
3630 *)      $cat <<EOM
3631
3632 Perl 5.006 can be compiled for binary compatibility with 5.005.
3633 If you decide to do so, you will be able to continue using most
3634 of the extensions that were compiled for Perl 5.005.
3635
3636 EOM
3637         case "$bincompat5005$d_bincompat5005" in
3638         *"$undef"*) dflt=n ;;
3639         *) dflt=y ;;
3640         esac
3641         rp='Binary compatibility with Perl 5.005?'
3642         . ./myread
3643         case "$ans" in
3644         y*) val="$define" ;;
3645         *)  val="$undef" ;;
3646         esac
3647         set d_bincompat5005
3648         eval $setvar
3649         case "$d_bincompat5005" in
3650         "$define") bincompat5005="$define" ;;
3651         *) bincompat5005="$undef" ;;
3652         esac
3653         ;;
3654 esac
3655
3656
3657 : see if setuid scripts can be secure
3658 $cat <<EOM
3659
3660 Some kernels have a bug that prevents setuid #! scripts from being
3661 secure.  Some sites have disabled setuid #! scripts because of this.
3662
3663 First let's decide if your kernel supports secure setuid #! scripts.
3664 (If setuid #! scripts would be secure but have been disabled anyway,
3665 don't say that they are secure if asked.)
3666
3667 EOM
3668
3669 val="$undef"
3670 if $test -d /dev/fd; then
3671         echo "#!$ls" >reflect
3672         chmod +x,u+s reflect
3673         ./reflect >flect 2>&1
3674         if $contains "/dev/fd" flect >/dev/null; then
3675                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3676                 val="$define"
3677         else
3678                 $cat <<EOM
3679 If you are not sure if they are secure, I can check but I'll need a
3680 username and password different from the one you are using right now.
3681 If you don't have such a username or don't want me to test, simply
3682 enter 'none'.
3683
3684 EOM
3685                 rp='Other username to test security of setuid scripts with?'
3686                 dflt='none'
3687                 . ./myread
3688                 case "$ans" in
3689                 n|none)
3690                         case "$d_suidsafe" in
3691                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3692                                 dflt=n;;
3693                         "$undef")
3694                                 echo "Well, the $hint value is *not* secure." >&4
3695                                 dflt=n;;
3696                         *)      echo "Well, the $hint value *is* secure." >&4
3697                                 dflt=y;;
3698                         esac
3699                         ;;
3700                 *)
3701                         $rm -f reflect flect
3702                         echo "#!$ls" >reflect
3703                         chmod +x,u+s reflect
3704                         echo >flect
3705                         chmod a+w flect
3706                         echo '"su" will (probably) prompt you for '"$ans's password."
3707                         su $ans -c './reflect >flect'
3708                         if $contains "/dev/fd" flect >/dev/null; then
3709                                 echo "Okay, it looks like setuid scripts are secure." >&4
3710                                 dflt=y
3711                         else
3712                                 echo "I don't think setuid scripts are secure." >&4
3713                                 dflt=n
3714                         fi
3715                         ;;
3716                 esac
3717                 rp='Does your kernel have *secure* setuid scripts?'
3718                 . ./myread
3719                 case "$ans" in
3720                 [yY]*)  val="$define";;
3721                 *)      val="$undef";;
3722                 esac
3723         fi
3724 else
3725         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3726         echo "(That's for file descriptors, not floppy disks.)"
3727         val="$undef"
3728 fi
3729 set d_suidsafe
3730 eval $setvar
3731
3732 $rm -f reflect flect
3733
3734 : now see if they want to do setuid emulation
3735 echo " "
3736 val="$undef"
3737 case "$d_suidsafe" in
3738 "$define")
3739         val="$undef"
3740         echo "No need to emulate SUID scripts since they are secure here." >& 4
3741         ;;
3742 *)
3743         $cat <<EOM
3744 Some systems have disabled setuid scripts, especially systems where
3745 setuid scripts cannot be secure.  On systems where setuid scripts have
3746 been disabled, the setuid/setgid bits on scripts are currently
3747 useless.  It is possible for $package to detect those bits and emulate
3748 setuid/setgid in a secure fashion.  This emulation will only work if
3749 setuid scripts have been disabled in your kernel.
3750
3751 EOM
3752         case "$d_dosuid" in
3753         "$define") dflt=y ;;
3754         *) dflt=n ;;
3755         esac
3756         rp="Do you want to do setuid/setgid emulation?"
3757         . ./myread
3758         case "$ans" in
3759         [yY]*)  val="$define";;
3760         *)      val="$undef";;
3761         esac
3762         ;;
3763 esac
3764 set d_dosuid
3765 eval $setvar
3766
3767 : What should the include directory be ?
3768 echo " "
3769 $echo $n "Hmm...  $c"
3770 dflt='/usr/include'
3771 incpath=''
3772 mips_type=''
3773 if $test -f /bin/mips && /bin/mips; then
3774         echo "Looks like a MIPS system..."
3775         $cat >usr.c <<'EOCP'
3776 #ifdef SYSTYPE_BSD43
3777 /bsd43
3778 #endif
3779 EOCP
3780         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3781                 dflt='/bsd43/usr/include'
3782                 incpath='/bsd43'
3783                 mips_type='BSD 4.3'
3784         else
3785                 mips_type='System V'
3786         fi
3787         $rm -f usr.c usr.out
3788         echo "and you're compiling with the $mips_type compiler and libraries."
3789         xxx_prompt=y
3790         echo "exit 0" >mips
3791 else
3792         echo "Doesn't look like a MIPS system."
3793         xxx_prompt=n
3794         echo "exit 1" >mips
3795 fi
3796 chmod +x mips
3797 $eunicefix mips
3798 case "$usrinc" in
3799 '') ;;
3800 *) dflt="$usrinc";;
3801 esac
3802 case "$xxx_prompt" in
3803 y)      fn=d/
3804         echo " "
3805         rp='Where are the include files you want to use?'
3806         . ./getfile
3807         usrinc="$ans"
3808         ;;
3809 *)      usrinc="$dflt"
3810         ;;
3811 esac
3812
3813 : see how we invoke the C preprocessor
3814 echo " "
3815 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3816 cat <<'EOT' >testcpp.c
3817 #define ABC abc
3818 #define XYZ xyz
3819 ABC.XYZ
3820 EOT
3821 cd ..
3822 if test ! -f cppstdin; then
3823         echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3824 else
3825         echo "Keeping your $hint cppstdin wrapper."
3826 fi
3827 chmod 755 cppstdin
3828 wrapper=`pwd`/cppstdin
3829 ok='false'
3830 cd UU
3831
3832 if $test "X$cppstdin" != "X" && \
3833         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3834         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3835 then
3836         echo "You used to use $cppstdin $cppminus so we'll use that again."
3837         case "$cpprun" in
3838         '') echo "But let's see if we can live without a wrapper..." ;;
3839         *)
3840                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3841                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3842                 then
3843                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3844                         ok='true'
3845                 else
3846                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3847                 fi
3848                 ;;
3849         esac
3850 else
3851         case "$cppstdin" in
3852         '') ;;
3853         *)
3854                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3855                 ;;
3856         esac
3857 fi
3858
3859 if $ok; then
3860         : nothing
3861 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3862         $cc -E <testcpp.c >testcpp.out 2>&1; \
3863         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3864         echo "Yup, it does."
3865         x_cpp="$cc -E"
3866         x_minus='';
3867 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3868         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3869         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3870         echo "Yup, it does."
3871         x_cpp="$cc -E"
3872         x_minus='-';
3873 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3874         $cc -P <testcpp.c >testcpp.out 2>&1; \
3875         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3876         echo "Yipee, that works!"
3877         x_cpp="$cc -P"
3878         x_minus='';
3879 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3880         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3881         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3882         echo "At long last!"
3883         x_cpp="$cc -P"
3884         x_minus='-';
3885 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3886         $cpp <testcpp.c >testcpp.out 2>&1; \
3887         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3888         echo "It works!"
3889         x_cpp="$cpp"
3890         x_minus='';
3891 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3892         $cpp - <testcpp.c >testcpp.out 2>&1; \
3893         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3894         echo "Hooray, it works!  I was beginning to wonder."
3895         x_cpp="$cpp"
3896         x_minus='-';
3897 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3898         $wrapper <testcpp.c >testcpp.out 2>&1; \
3899         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3900         x_cpp="$wrapper"
3901         x_minus=''
3902         echo "Eureka!"
3903 else
3904         dflt=''
3905         rp="No dice.  I can't find a C preprocessor.  Name one:"
3906         . ./myread
3907         x_cpp="$ans"
3908         x_minus=''
3909         $x_cpp <testcpp.c >testcpp.out 2>&1
3910         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3911                 echo "OK, that will do." >&4
3912         else
3913 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3914                 exit 1
3915         fi
3916 fi
3917
3918 case "$ok" in
3919 false)
3920         cppstdin="$x_cpp"
3921         cppminus="$x_minus"
3922         cpprun="$x_cpp"
3923         cpplast="$x_minus"
3924         set X $x_cpp
3925         shift
3926         case "$1" in
3927         "$cpp")
3928                 echo "Perhaps can we force $cc -E using a wrapper..."
3929                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3930                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3931                 then
3932                         echo "Yup, we can."
3933                         cppstdin="$wrapper"
3934                         cppminus='';
3935                 else
3936                         echo "Nope, we'll have to live without it..."
3937                 fi
3938                 ;;
3939         esac
3940         case "$cpprun" in
3941         "$wrapper")
3942                 cpprun=''
3943                 cpplast=''
3944                 ;;
3945         esac
3946         ;;
3947 esac
3948
3949 case "$cppstdin" in
3950 "$wrapper"|'cppstdin') ;;
3951 *) $rm -f $wrapper;;
3952 esac
3953 $rm -f testcpp.c testcpp.out
3954
3955 : Set private lib path
3956 case "$plibpth" in
3957 '') if ./mips; then
3958                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3959         fi;;
3960 esac
3961 case "$libpth" in
3962 ' ') dlist='';;
3963 '') dlist="$loclibpth $plibpth $glibpth";;
3964 *) dlist="$libpth";;
3965 esac
3966
3967 : Now check and see which directories actually exist, avoiding duplicates
3968 libpth=''
3969 for xxx in $dlist
3970 do
3971     if $test -d $xxx; then
3972                 case " $libpth " in
3973                 *" $xxx "*) ;;
3974                 *) libpth="$libpth $xxx";;
3975                 esac
3976     fi
3977 done
3978 $cat <<'EOM'
3979
3980 Some systems have incompatible or broken versions of libraries.  Among
3981 the directories listed in the question below, please remove any you
3982 know not to be holding relevant libraries, and add any that are needed.
3983 Say "none" for none.
3984
3985 EOM
3986 case "$libpth" in
3987 '') dflt='none';;
3988 *)
3989         set X $libpth
3990         shift
3991         dflt=${1+"$@"}
3992         ;;
3993 esac
3994 rp="Directories to use for library searches?"
3995 . ./myread
3996 case "$ans" in
3997 none) libpth=' ';;
3998 *) libpth="$ans";;
3999 esac
4000
4001 : compute shared library extension
4002 case "$so" in
4003 '')
4004         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4005                 dflt='sl'
4006         else
4007                 dflt='so'
4008         fi
4009         ;;
4010 *) dflt="$so";;
4011 esac
4012 $cat <<EOM
4013
4014 On some systems, shared libraries may be available.  Answer 'none' if
4015 you want to suppress searching of shared libraries for the remaining
4016 of this configuration.
4017
4018 EOM
4019 rp='What is the file extension used for shared libraries?'
4020 . ./myread
4021 so="$ans"
4022
4023 : Define several unixisms.
4024 : Hints files or command line option can be used to override them.
4025 : The convoluted testing is in case hints files set either the old
4026 : or the new name.
4027 case "$_exe" in
4028 '')     case "$exe_ext" in
4029     '') ;;
4030         *)      _exe="$exe_ext" ;;
4031         esac
4032         ;;
4033 esac
4034 case "$_a" in
4035 '')     case "$lib_ext" in
4036     '') _a='.a';;
4037         *)      _a="$lib_ext" ;;
4038         esac
4039         ;;
4040 esac
4041 case "$_o" in
4042 '') case "$obj_ext" in
4043         '')     _o='.o';;
4044         *)      _o="$obj_ext";;
4045         esac
4046         ;;
4047 esac
4048 case "$p_" in
4049 '') case "$path_sep" in
4050         '')     p_=':';;
4051         *)      p_="$path_sep";;
4052         esac
4053         ;;
4054 esac
4055 exe_ext=$_exe
4056 lib_ext=$_a
4057 obj_ext=$_o
4058 path_sep=$p_
4059
4060 : Which makefile gets called first.  This is used by make depend.
4061 case "$firstmakefile" in
4062 '') firstmakefile='makefile';;
4063 esac
4064
4065 cat <<EOM
4066
4067 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4068 Configure must be run with -Dusesocks.
4069
4070 Normally you do not need this and you should answer no.
4071
4072 EOM
4073 case "$usesocks" in
4074 $define|true|[yY]*)     dflt='y';;
4075 *) dflt='n';;
4076 esac
4077 rp='Build Perl for SOCKS?'
4078 . ./myread
4079 case "$ans" in
4080 y|Y)    val="$define" ;;     
4081 *)      val="$undef" ;;
4082 esac
4083 set usesocks
4084 eval $setvar
4085
4086 : Looking for optional libraries
4087 echo " "
4088 echo "Checking for optional libraries..." >&4
4089 case "$libs" in
4090 ' '|'') dflt='';;
4091 *) dflt="$libs";;
4092 esac
4093 case "$libswanted" in
4094 '') libswanted='c_s';;
4095 esac
4096 case "$usesocks" in
4097 $define)
4098         libswanted="$libswanted socks5 socks5_sh"
4099         ;;
4100 esac
4101 for thislib in $libswanted; do
4102         
4103         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4104                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4105                 echo "Found -l$thislib (shared)."
4106                 case " $dflt " in
4107                 *"-l$thislib "*);;
4108                 *) dflt="$dflt -l$thislib";;
4109                 esac
4110         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4111                 echo "Found -l$thislib (shared)."
4112                 case " $dflt " in
4113                 *"-l$thislib "*);;
4114                 *) dflt="$dflt -l$thislib";;
4115                 esac
4116         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4117                 echo "Found -l$thislib."
4118                 case " $dflt " in
4119                 *"-l$thislib "*);;
4120                 *) dflt="$dflt -l$thislib";;
4121                 esac
4122         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4123                 echo "Found -l$thislib."
4124                 case " $dflt " in
4125                 *"-l$thislib "*);;
4126                 *) dflt="$dflt -l$thislib";;
4127                 esac
4128         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4129                 echo "Found -l${thislib}_s."
4130                 case " $dflt " in
4131                 *"-l$thislib "*);;
4132                 *) dflt="$dflt -l${thislib}_s";;
4133                 esac
4134         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4135                 echo "Found -l$thislib."
4136                 case " $dflt " in
4137                 *"-l$thislib "*);;
4138                 *) dflt="$dflt -l$thislib";;
4139                 esac
4140         else
4141                 echo "No -l$thislib."
4142         fi
4143 done
4144 set X $dflt
4145 shift
4146 dflt="$*"
4147 case "$libs" in
4148 '') dflt="$dflt";;
4149 *) dflt="$libs";;
4150 esac
4151 case "$dflt" in
4152 ' '|'') dflt='none';;
4153 esac
4154
4155 $cat <<EOM
4156
4157 In order to compile $package on your machine, a number of libraries
4158 are usually needed.  Include any other special libraries here as well.
4159 Say "none" for none.  The default list is almost always right.
4160 EOM
4161
4162 echo " "
4163 rp="What libraries to use?"
4164 . ./myread
4165 case "$ans" in
4166 none) libs=' ';;
4167 *) libs="$ans";;
4168 esac
4169
4170 : determine optimize, if desired, or use for debug flag also
4171 case "$optimize" in
4172 ' '|$undef) dflt='none';;
4173 '') dflt='-O';;
4174 *) dflt="$optimize";;
4175 esac
4176 $cat <<EOH
4177
4178 Some C compilers have problems with their optimizers.  By default, $package
4179 compiles with the -O flag to use the optimizer.  Alternately, you might want
4180 to use the symbolic debugger, which uses the -g flag (on traditional Unix
4181 systems).  Either flag can be specified here.  To use neither flag, specify
4182 the word "none".
4183
4184 EOH
4185 rp="What optimizer/debugger flag should be used?"
4186 . ./myread
4187 optimize="$ans"
4188 case "$optimize" in
4189 'none') optimize=" ";;
4190 esac
4191
4192 dflt=''
4193 : We will not override a previous value, but we might want to
4194 : augment a hint file
4195 case "$hint" in
4196 none|recommended)
4197         case "$gccversion" in
4198         1*) dflt='-fpcc-struct-return' ;;
4199         esac
4200         case "$optimize" in
4201         *-g*) dflt="$dflt -DDEBUGGING";;
4202         esac
4203         case "$gccversion" in
4204         2*) if test -d /etc/conf/kconfig.d &&
4205                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4206                 then
4207                         dflt="$dflt -posix"
4208                 fi
4209                 ;;
4210         esac
4211         ;;
4212 esac
4213
4214 case "$mips_type" in
4215 *BSD*|'') inclwanted="$locincpth $usrinc";;
4216 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4217 esac
4218 for thisincl in $inclwanted; do
4219         if $test -d $thisincl; then
4220                 if $test x$thisincl != x$usrinc; then
4221                         case "$dflt" in
4222                         *$thisincl*);;
4223                         *) dflt="$dflt -I$thisincl";;
4224                         esac
4225                 fi
4226         fi
4227 done
4228
4229 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4230         xxx=true;
4231 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4232         xxx=true;
4233 else
4234         xxx=false;
4235 fi;
4236 if $xxx; then
4237         case "$dflt" in
4238         *$2*);;
4239         *) dflt="$dflt -D$2";;
4240         esac;
4241 fi'
4242
4243 set signal.h LANGUAGE_C; eval $inctest
4244
4245 case "$usesocks" in
4246 $define)
4247         ccflags="$ccflags -DSOCKS"
4248         ;;
4249 esac
4250
4251 case "$hint" in
4252 none|recommended) dflt="$ccflags $dflt" ;;
4253 *) dflt="$ccflags";;
4254 esac
4255
4256 case "$dflt" in
4257 ''|' ') dflt=none;;
4258 esac
4259 $cat <<EOH
4260
4261 Your C compiler may want other flags.  For this question you should include
4262 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4263 but you should NOT include libraries or ld flags like -lwhatever.  If you
4264 want $package to honor its debug switch, you should include -DDEBUGGING here.
4265 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4266
4267 To use no flags, specify the word "none".
4268
4269 EOH
4270 set X $dflt
4271 shift
4272 dflt=${1+"$@"}
4273 rp="Any additional cc flags?"
4274 . ./myread
4275 case "$ans" in
4276 none) ccflags='';;
4277 *) ccflags="$ans";;
4278 esac
4279
4280 : the following weeds options from ccflags that are of no interest to cpp
4281 cppflags="$ccflags"
4282 case "$gccversion" in
4283 1*) cppflags="$cppflags -D__GNUC__"
4284 esac
4285 case "$mips_type" in
4286 '');;
4287 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4288 esac
4289 case "$cppflags" in
4290 '');;
4291 *)
4292         echo " "
4293         echo "Let me guess what the preprocessor flags are..." >&4
4294         set X $cppflags
4295         shift
4296         cppflags=''
4297         $cat >cpp.c <<'EOM'
4298 #define BLURFL foo
4299
4300 BLURFL xx LFRULB
4301 EOM
4302         previous=''
4303         for flag in $*
4304         do
4305                 case "$flag" in
4306                 -*) ftry="$flag";;
4307                 *) ftry="$previous $flag";;
4308                 esac
4309                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4310                         >cpp1.out 2>/dev/null && \
4311                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4312                         >cpp2.out 2>/dev/null && \
4313                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4314                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4315                 then
4316                         cppflags="$cppflags $ftry"
4317                         previous=''
4318                 else
4319                         previous="$flag"
4320                 fi
4321         done
4322         set X $cppflags
4323         shift
4324         cppflags=${1+"$@"}
4325         case "$cppflags" in
4326         *-*)  echo "They appear to be: $cppflags";;
4327         esac
4328         $rm -f cpp.c cpp?.out
4329         ;;
4330 esac
4331
4332 : flags used in final linking phase
4333 case "$ldflags" in
4334 '') if ./venix; then
4335                 dflt='-i -z'
4336         else
4337                 dflt=''
4338         fi
4339         case "$ccflags" in
4340         *-posix*) dflt="$dflt -posix" ;;
4341         esac
4342         ;;
4343 *) dflt="$ldflags";;
4344 esac
4345
4346 : Try to guess additional flags to pick up local libraries.
4347 for thislibdir in $libpth; do
4348         case " $loclibpth " in
4349         *" $thislibdir "*)
4350                 case "$dflt " in 
4351                 *"-L$thislibdir "*) ;;
4352                 *)  dflt="$dflt -L$thislibdir" ;;
4353                 esac
4354                 ;;
4355         esac
4356 done
4357
4358 case "$dflt" in
4359 '') dflt='none' ;;
4360 esac
4361
4362 $cat <<EOH
4363
4364 Your C linker may need flags.  For this question you should
4365 include -L/whatever and any other flags used by the C linker, but you
4366 should NOT include libraries like -lwhatever.
4367
4368 Make sure you include the appropriate -L/path flags if your C linker
4369 does not normally search all of the directories you specified above,
4370 namely
4371         $libpth
4372 To use no flags, specify the word "none".
4373
4374 EOH
4375
4376 rp="Any additional ld flags (NOT including libraries)?"
4377 . ./myread
4378 case "$ans" in
4379 none) ldflags='';;
4380 *) ldflags="$ans";;
4381 esac
4382 rmlist="$rmlist pdp11"
4383
4384 : coherency check
4385 echo " "
4386 echo "Checking your choice of C compiler and flags for coherency..." >&4
4387 $cat > try.c <<'EOF'
4388 #include <stdio.h>
4389 int main() { printf("Ok\n"); exit(0); }
4390 EOF
4391 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4392 shift
4393 $cat >try.msg <<'EOM'
4394 I've tried to compile and run the following simple program:
4395
4396 EOM
4397 $cat try.c >> try.msg
4398
4399 $cat >> try.msg <<EOM
4400
4401 I used the command:
4402
4403         $*
4404         ./try
4405
4406 and I got the following output:
4407
4408 EOM
4409 dflt=y
4410 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4411         if sh -c './try' >>try.msg 2>&1; then
4412                 xxx=`./try`
4413                 case "$xxx" in
4414                 "Ok") dflt=n ;;
4415                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4416                         case " $libs " in
4417                         *" -lsfio "*)
4418                                 cat >> try.msg <<'EOQS'
4419 If $libs contains -lsfio, and sfio is mis-configured, then it
4420 sometimes (apparently) runs and exits with a 0 status, but with no
4421 output!  It may have to do with sfio's use of _exit vs. exit.
4422
4423 EOQS
4424                                 rp="You have a big problem.  Shall I abort Configure"
4425                                 dflt=y
4426                                 ;;
4427                         esac
4428                         ;;
4429                 esac
4430         else
4431                 echo "The program compiled OK, but exited with status $?." >>try.msg
4432                 rp="You have a problem.  Shall I abort Configure"
4433                 dflt=y
4434         fi
4435 else
4436         echo "I can't compile the test program." >>try.msg
4437         rp="You have a BIG problem.  Shall I abort Configure"
4438         dflt=y
4439 fi
4440 case "$dflt" in
4441 y)
4442         $cat try.msg >&4
4443         case "$knowitall" in
4444         '')
4445                 echo "(The supplied flags or libraries might be incorrect.)"
4446                 ;;
4447         *) dflt=n;;
4448         esac
4449         echo " "
4450         . ./myread
4451         case "$ans" in
4452         n*|N*) ;;
4453         *)      echo "Ok.  Stopping Configure." >&4
4454                 exit 1
4455                 ;;
4456         esac
4457         ;;
4458 n) echo "OK, that should do.";;
4459 esac
4460 $rm -f try try.* core
4461
4462 : determine filename position in cpp output
4463 echo " "
4464 echo "Computing filename position in cpp output for #include directives..." >&4
4465 echo '#include <stdio.h>' > foo.c
4466 $cat >fieldn <<EOF
4467 $startsh
4468 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4469 $grep '^[       ]*#.*stdio\.h' | \
4470 while read cline; do
4471         pos=1
4472         set \$cline
4473         while $test \$# -gt 0; do
4474                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4475                         echo "\$pos"
4476                         exit 0
4477                 fi
4478                 shift
4479                 pos=\`expr \$pos + 1\`
4480         done
4481 done
4482 EOF
4483 chmod +x fieldn
4484 fieldn=`./fieldn`
4485 $rm -f foo.c fieldn
4486 case $fieldn in
4487 '') pos='???';;
4488 1) pos=first;;
4489 2) pos=second;;
4490 3) pos=third;;
4491 *) pos="${fieldn}th";;
4492 esac
4493 echo "Your cpp writes the filename in the $pos field of the line."
4494
4495 : locate header file
4496 $cat >findhdr <<EOF
4497 $startsh
4498 wanted=\$1
4499 name=''
4500 for usrincdir in $usrinc
4501 do
4502         if test -f \$usrincdir/\$wanted; then
4503                 echo "\$usrincdir/\$wanted"
4504                 exit 0
4505         fi
4506 done
4507 awkprg='{ print \$$fieldn }'
4508 echo "#include <\$wanted>" > foo\$\$.c
4509 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4510 $grep "^[       ]*#.*\$wanted" | \
4511 while read cline; do
4512         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4513         case "\$name" in
4514         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4515         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4516         *) exit 2;;
4517         esac;
4518 done;
4519 #
4520 # status = 0: grep returned 0 lines, case statement not executed
4521 # status = 1: headerfile found
4522 # status = 2: while loop executed, no headerfile found
4523 #
4524 status=\$?
4525 $rm -f foo\$\$.c;
4526 if test \$status -eq 1; then
4527         exit 0;
4528 fi
4529 exit 1
4530 EOF
4531 chmod +x findhdr
4532
4533 : define an alternate in-header-list? function
4534 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4535 cont=true; xxf="echo \"<\$1> found.\" >&4";
4536 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4537 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4538 esac;
4539 case $# in 4) instead=instead;; *) instead="at last";; esac;
4540 while $test "$cont"; do
4541         xxx=`./findhdr $1`
4542         var=$2; eval "was=\$$2";
4543         if $test "$xxx" && $test -r "$xxx";
4544         then eval $xxf;
4545         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4546                 cont="";
4547         else eval $xxnf;
4548         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4549         set $yyy; shift; shift; yyy=$@;
4550         case $# in 0) cont="";;
4551         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4552                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4553         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4554                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4555         esac;
4556 done;
4557 while $test "$yyy";
4558 do set $yyy; var=$2; eval "was=\$$2";
4559         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4560         set $yyy; shift; shift; yyy=$@;
4561 done'
4562
4563 : see if this is a malloc.h system
4564 set malloc.h i_malloc
4565 eval $inhdr
4566
4567 : see if stdlib is available
4568 set stdlib.h i_stdlib
4569 eval $inhdr
4570
4571 : determine which malloc to compile in
4572 echo " "
4573 case "$usemymalloc" in
4574 ''|[yY]*|true|$define)  dflt='y' ;;
4575 *)      dflt='n' ;;
4576 esac
4577 rp="Do you wish to attempt to use the malloc that comes with $package?"
4578 . ./myread
4579 usemymalloc="$ans"
4580 case "$ans" in
4581 y*|true)
4582         usemymalloc='y'
4583         mallocsrc='malloc.c'
4584         mallocobj="malloc$_o"
4585         d_mymalloc="$define"
4586         case "$libs" in
4587         *-lmalloc*)
4588                 : Remove malloc from list of libraries to use
4589                 echo "Removing unneeded -lmalloc from library list" >&4
4590                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4591                 shift
4592                 libs="$*"
4593                 echo "libs = $libs" >&4
4594                 ;;
4595         esac
4596         ;;
4597 *)
4598         usemymalloc='n'
4599         mallocsrc=''
4600         mallocobj=''
4601         d_mymalloc="$undef"
4602         ;;
4603 esac
4604
4605 : compute the return types of malloc and free
4606 echo " "
4607 $cat >malloc.c <<END
4608 #$i_malloc I_MALLOC
4609 #$i_stdlib I_STDLIB
4610 #include <stdio.h>
4611 #include <sys/types.h>
4612 #ifdef I_MALLOC
4613 #include <malloc.h>
4614 #endif
4615 #ifdef I_STDLIB
4616 #include <stdlib.h>
4617 #endif
4618 #ifdef TRY_MALLOC
4619 void *malloc();
4620 #endif
4621 #ifdef TRY_FREE
4622 void free();
4623 #endif
4624 END
4625 case "$malloctype" in
4626 '')
4627         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4628                 malloctype='void *'
4629         else
4630                 malloctype='char *'
4631         fi
4632         ;;
4633 esac
4634 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4635
4636 case "$freetype" in
4637 '')
4638         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4639                 freetype='void'
4640         else
4641                 freetype='int'
4642         fi
4643         ;;
4644 esac
4645 echo "Your system uses $freetype free(), it would seem." >&4
4646 $rm -f malloc.[co]
4647 $cat <<EOM
4648
4649 The installation process will also create a directory for
4650 vendor-supplied add-ons.  Vendors who supply perl with their system
4651 may find it convenient to place all vendor-supplied files in this
4652 directory rather than in the main distribution directory.  This will
4653 ease upgrades between binary-compatible maintenance versions of perl.
4654
4655 Of course you may also use these directories in whatever way you see
4656 fit.  For example, you might use them to access modules shared over a
4657 company-wide network.
4658
4659 The default answer should be fine for most people.
4660 This causes further questions about vendor add-ons to be skipped
4661 and no vendor-specific directories will be configured for perl.
4662
4663 EOM
4664 rp='Do you want to configure vendor-specific add-on directories?'
4665 case "$usevendorprefix" in
4666 define|true|[yY]*) dflt=y ;;
4667 *) dflt=n ;;
4668 esac
4669 . ./myread
4670 case "$ans" in
4671 [yY]*)  fn=d~+
4672         rp='Installation prefix to use for vendor-supplied add-ons?'
4673         case "$vendorprefix" in
4674         '') dflt='' ;;
4675         *)  dflt=$vendorprefix ;;
4676         esac
4677         . ./getfile
4678         oldvendorprefix=''
4679         case "$vendorprefix" in
4680         '') ;;
4681         *)      case "$ans" in
4682                 "$prefix") ;;
4683                 *) oldvendorprefix="$prefix";;
4684                 esac
4685                 ;;
4686         esac
4687         usevendorprefix="$define"
4688         vendorprefix="$ans"
4689         vendorprefixexp="$ansexp"
4690         ;;
4691 *)      usevendorprefix="$undef"
4692         vendorprefix=''
4693         vendorprefixexp=''
4694         ;;
4695 esac
4696
4697 case "$vendorprefix" in
4698 '')     d_vendorlib="$undef"
4699         vendorlib=''
4700         vendorlibexp=''
4701         ;;
4702 *)      d_vendorlib="$define"
4703         : determine where vendor-supplied modules go.
4704         : Usual default is /usr/local/lib/perl5/vendor_perl
4705         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4706         case "$installstyle" in
4707         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4708         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4709         esac
4710         fn=d~+
4711         rp='Pathname for the vendor-supplied library files?'
4712         . ./getfile
4713         vendorlib="$ans"
4714         vendorlibexp="$ansexp"
4715         : Change installation prefix, if necessary.
4716         if $test X"$prefix" != X"$installprefix"; then
4717                 installvendorlib=`echo $vendorlibexp | $sed 's#^$prefix#$installprefix#'`
4718         else
4719                 installvendorlib="$vendorlibexp"
4720         fi
4721         ;;
4722 esac
4723
4724 : Cruising for prototypes
4725 echo " "
4726 echo "Checking out function prototypes..." >&4
4727 $cat >prototype.c <<'EOCP'
4728 int main(int argc, char *argv[]) {
4729         exit(0);}
4730 EOCP
4731 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4732         echo "Your C compiler appears to support function prototypes."
4733         val="$define"
4734 else
4735         echo "Your C compiler doesn't seem to understand function prototypes."
4736         val="$undef"
4737 fi
4738 set prototype
4739 eval $setvar
4740 $rm -f prototype*
4741
4742 case "$prototype" in
4743 "$define") ;;
4744 *)      ansi2knr='ansi2knr'
4745         echo " "
4746         cat <<EOM >&4
4747
4748 $me:  FATAL ERROR:
4749 This version of $package can only be compiled by a compiler that 
4750 understands function prototypes.  Unfortunately, your C compiler 
4751         $cc $ccflags
4752 doesn't seem to understand them.  Sorry about that.
4753
4754 If GNU cc is available for your system, perhaps you could try that instead.  
4755
4756 Eventually, we hope to support building Perl with pre-ANSI compilers.
4757 If you would like to help in that effort, please contact <perlbug@perl.org>.
4758
4759 Aborting Configure now.
4760 EOM
4761         exit 2
4762         ;;
4763 esac
4764
4765 : determine where public executables go
4766 echo " "
4767 set dflt bin bin
4768 eval $prefixit
4769 fn=d~
4770 rp='Pathname where the public executables will reside?'
4771 . ./getfile
4772 if $test "X$ansexp" != "X$binexp"; then
4773         installbin=''
4774 fi
4775 bin="$ans"
4776 binexp="$ansexp"
4777 : Change installation prefix, if necessary.
4778 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4779 if $test X"$prefix" != X"$installprefix"; then
4780         installbin=`echo $binexp | sed 's#^$prefix#$installprefix#'`
4781 else
4782         installbin="$binexp"
4783 fi
4784
4785 : determine whether to install perl also as /usr/bin/perl
4786
4787 echo " "
4788 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4789         $cat <<EOM
4790 Many scripts expect to perl to be installed as /usr/bin/perl.
4791 I can install the perl you are about to compile also as /usr/bin/perl
4792 (in addition to $installbin/perl).
4793 EOM
4794         case "$installusrbinperl" in
4795         "$undef"|[nN]*) dflt='n';;
4796         *)              dflt='y';;
4797         esac
4798         rp="Do you want to install perl as /usr/bin/perl?"
4799         . ./myread
4800         case "$ans" in
4801         [yY]*)  val="$define";;
4802         *)      val="$undef" ;;
4803         esac
4804 else
4805         val="$undef"
4806 fi
4807 set installusrbinperl
4808 eval $setvar
4809
4810 : define a shorthand compile call
4811 compile='
4812 mc_file=$1;
4813 shift;
4814 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4815 : define a shorthand compile call for compilations that should be ok.
4816 compile_ok='
4817 mc_file=$1;
4818 shift;
4819 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4820
4821 echo " "
4822 echo "Checking for GNU C Library..." >&4
4823 cat >gnulibc.c <<EOM
4824 #include <stdio.h>
4825 int main()
4826 {
4827 #ifdef __GLIBC__
4828     exit(0);
4829 #else
4830     exit(1);
4831 #endif
4832 }
4833 EOM
4834 set gnulibc
4835 if eval $compile_ok && ./gnulibc; then
4836         val="$define"
4837         echo "You are using the GNU C Library"
4838 else
4839         val="$undef"
4840         echo "You are not using the GNU C Library"
4841 fi
4842 $rm -f gnulibc*
4843 set d_gnulibc
4844 eval $setvar
4845
4846 : see if nm is to be used to determine whether a symbol is defined or not
4847 case "$usenm" in
4848 '')
4849         dflt=''
4850         case "$d_gnulibc" in
4851         "$define")
4852                 echo " "
4853                 echo "nm probably won't work on the GNU C Library." >&4
4854                 dflt=n
4855                 ;;
4856         esac
4857         case "$dflt" in
4858         '') 
4859                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4860                         echo " "
4861                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4862                         echo "'nm' won't be sufficient on this sytem." >&4
4863                         dflt=n
4864                 fi
4865                 ;;
4866         esac
4867         case "$dflt" in
4868         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4869                 if $test $dflt -gt 20; then
4870                         dflt=y
4871                 else
4872                         dflt=n
4873                 fi
4874                 ;;
4875         esac
4876         ;;
4877 *)
4878         case "$usenm" in
4879         true|$define) dflt=y;;
4880         *) dflt=n;;
4881         esac
4882         ;;
4883 esac
4884 $cat <<EOM
4885
4886 I can use $nm to extract the symbols from your C libraries. This
4887 is a time consuming task which may generate huge output on the disk (up
4888 to 3 megabytes) but that should make the symbols extraction faster. The
4889 alternative is to skip the 'nm' extraction part and to compile a small
4890 test program instead to determine whether each symbol is present. If
4891 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4892 this may be the best solution.
4893
4894 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4895
4896 EOM
4897 rp="Shall I use $nm to extract C symbols from the libraries?"
4898 . ./myread
4899 case "$ans" in
4900 [Nn]*) usenm=false;;
4901 *) usenm=true;;
4902 esac
4903
4904 runnm=$usenm
4905 case "$reuseval" in
4906 true) runnm=false;;
4907 esac
4908
4909 : nm options which may be necessary
4910 case "$nm_opt" in
4911 '') if $test -f /mach_boot; then
4912                 nm_opt=''       # Mach
4913         elif $test -d /usr/ccs/lib; then
4914                 nm_opt='-p'     # Solaris (and SunOS?)
4915         elif $test -f /dgux; then
4916                 nm_opt='-p'     # DG-UX
4917         elif $test -f /lib64/rld; then
4918                 nm_opt='-p'     # 64-bit Irix
4919         else
4920                 nm_opt=''
4921         fi;;
4922 esac
4923
4924 : nm options which may be necessary for shared libraries but illegal
4925 : for archive libraries.  Thank you, Linux.
4926 case "$nm_so_opt" in
4927 '')     case "$myuname" in
4928         *linux*)
4929                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
4930                         nm_so_opt='--dynamic'
4931                 fi
4932                 ;;
4933         esac
4934         ;;
4935 esac
4936
4937 case "$runnm" in
4938 true)
4939 : get list of predefined functions in a handy place
4940 echo " "
4941 case "$libc" in
4942 '') libc=unknown
4943         case "$libs" in
4944         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
4945         esac
4946         ;;
4947 esac
4948 libnames='';
4949 case "$libs" in
4950 '') ;;
4951 *)  for thislib in $libs; do
4952         case "$thislib" in
4953         -lc|-lc_s)
4954                 : Handle C library specially below.
4955                 ;;
4956         -l*)
4957                 thislib=`echo $thislib | $sed -e 's/^-l//'`
4958                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
4959                         :
4960                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
4961                         :
4962                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
4963                         :
4964                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
4965                         :
4966                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
4967                         :
4968                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
4969                         :
4970                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
4971                         :
4972                 else
4973                         try=''
4974                 fi
4975                 libnames="$libnames $try"
4976                 ;;
4977         *) libnames="$libnames $thislib" ;;
4978         esac
4979         done
4980         ;;
4981 esac
4982 xxx=normal
4983 case "$libc" in
4984 unknown)
4985         set /lib/libc.$so
4986         for xxx in $libpth; do
4987                 $test -r $1 || set $xxx/libc.$so
4988                 : The messy sed command sorts on library version numbers.
4989                 $test -r $1 || \
4990                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
4991                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
4992                                 h
4993                                 s/[0-9][0-9]*/0000&/g
4994                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
4995                                 G
4996                                 s/\n/ /' | \
4997                          sort | $sed -e 's/^.* //'`
4998                 eval set \$$#
4999         done
5000         $test -r $1 || set /usr/ccs/lib/libc.$so
5001         $test -r $1 || set /lib/libsys_s$_a
5002         ;;
5003 *)
5004         set blurfl
5005         ;;
5006 esac
5007 if $test -r "$1"; then
5008         echo "Your (shared) C library seems to be in $1."
5009         libc="$1"
5010 elif $test -r /lib/libc && $test -r /lib/clib; then
5011         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5012         xxx=apollo
5013         libc='/lib/clib /lib/libc'
5014         if $test -r /lib/syslib; then
5015                 echo "(Your math library is in /lib/syslib.)"
5016                 libc="$libc /lib/syslib"
5017         fi
5018 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5019         echo "Your C library seems to be in $libc, as you said before."
5020 elif $test -r $incpath/usr/lib/libc$_a; then
5021         libc=$incpath/usr/lib/libc$_a;
5022         echo "Your C library seems to be in $libc.  That's fine."
5023 elif $test -r /lib/libc$_a; then
5024         libc=/lib/libc$_a;
5025         echo "Your C library seems to be in $libc.  You're normal."
5026 else
5027         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5028                 :
5029         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5030                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5031         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5032                 :
5033         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5034                 :
5035         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5036                 :
5037         else
5038                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5039         fi
5040         if $test -r "$tans"; then
5041                 echo "Your C library seems to be in $tans, of all places."
5042                 libc=$tans
5043         else
5044                 libc='blurfl'
5045         fi
5046 fi
5047 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5048         dflt="$libc"
5049         cat <<EOM
5050
5051 If the guess above is wrong (which it might be if you're using a strange
5052 compiler, or your machine supports multiple models), you can override it here.
5053
5054 EOM
5055 else
5056         dflt=''
5057         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5058         cat >&4 <<EOM
5059 I can't seem to find your C library.  I've looked in the following places:
5060
5061 EOM
5062         $sed 's/^/      /' libpath
5063         cat <<EOM
5064
5065 None of these seems to contain your C library. I need to get its name...
5066
5067 EOM
5068 fi
5069 fn=f
5070 rp='Where is your C library?'
5071 . ./getfile
5072 libc="$ans"
5073
5074 echo " "
5075 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5076 set X `cat libnames`
5077 shift
5078 xxx=files
5079 case $# in 1) xxx=file; esac
5080 echo "Extracting names from the following $xxx for later perusal:" >&4
5081 echo " "
5082 $sed 's/^/      /' libnames >&4
5083 echo " "
5084 $echo $n "This may take a while...$c" >&4
5085
5086 for file in $*; do
5087         case $file in
5088         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5089         *) $nm $nm_opt $file 2>/dev/null;;
5090         esac
5091 done >libc.tmp
5092
5093 $echo $n ".$c"
5094 $grep fprintf libc.tmp > libc.ptf
5095 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5096 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5097 xxx='[ADTSIW]'
5098 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5099         eval $xscan;\
5100         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5101                 eval $xrun
5102 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5103         eval $xscan;\
5104         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5105                 eval $xrun
5106 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5107         eval $xscan;\
5108         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5109                 eval $xrun
5110 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5111         eval $xscan;\
5112         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5113                 eval $xrun
5114 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5115         eval $xscan;\
5116         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5117                 eval $xrun
5118 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5119         eval $xscan;\
5120         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5121                 eval $xrun
5122 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5123                                 -e '/ file/d' -e '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/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5128         eval $xscan;\
5129         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5130                 eval $xrun
5131 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5132         eval $xscan;\
5133         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5134                 eval $xrun
5135 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5136         eval $xscan;\
5137         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5138                 eval $xrun
5139 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5140         eval $xscan;\
5141         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5142                 eval $xrun
5143 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5144         eval $xscan;\
5145         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5146                 eval $xrun
5147 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5148         eval $xscan;\
5149         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5150                 eval $xrun
5151 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5152         eval $xscan;\
5153         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5154                 eval $xrun
5155 else
5156         $nm -p $* 2>/dev/null >libc.tmp
5157         $grep fprintf libc.tmp > libc.ptf
5158         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5159                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5160         then
5161                 nm_opt='-p'
5162                 eval $xrun
5163         else
5164                 echo " "
5165                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5166                 com=''
5167                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5168                         for thisname in $libnames $libc; do
5169                                 $ar t $thisname >>libc.tmp
5170                         done
5171                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5172                         echo "Ok." >&4
5173                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5174                         # Repeat libc to extract forwarders to DLL entries too
5175                         for thisname in $libnames $libc; do
5176                                 $ar tv $thisname >>libc.tmp
5177                                 # Revision 50 of EMX has bug in $ar.
5178                                 # it will not extract forwarders to DLL entries
5179                                 # Use emximp which will extract exactly them.
5180                                 emximp -o tmp.imp $thisname \
5181                                     2>/dev/null && \
5182                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5183                                     < tmp.imp >>libc.tmp
5184                                 $rm tmp.imp
5185                         done
5186                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5187                         echo "Ok." >&4
5188                 else
5189                         echo "$ar didn't seem to work right." >&4
5190                         echo "Maybe this is a Cray...trying bld instead..." >&4
5191                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5192                         then
5193                                 for thisname in $libnames; do
5194                                         bld t $libnames | \
5195                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5196                                         $ar t $thisname >>libc.tmp
5197                                 done
5198                                 echo "Ok." >&4
5199                         else
5200                                 echo "That didn't work either.  Giving up." >&4
5201                                 exit 1
5202                         fi
5203                 fi
5204         fi
5205 fi
5206 nm_extract="$com"
5207 if $test -f /lib/syscalls.exp; then
5208         echo " "
5209         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5210         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5211 fi
5212 ;;
5213 esac
5214 $rm -f libnames libpath
5215
5216 : see if dld is available
5217 set dld.h i_dld
5218 eval $inhdr
5219
5220 : is a C symbol defined?
5221 csym='tlook=$1;
5222 case "$3" in
5223 -v) tf=libc.tmp; tc=""; tdc="";;
5224 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5225 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5226 esac;
5227 tx=yes;
5228 case "$reuseval-$4" in
5229 true-) ;;
5230 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5231 esac;
5232 case "$tx" in
5233 yes)
5234         case "$runnm" in
5235         true)
5236                 if $contains $tlook $tf >/dev/null 2>&1;
5237                 then tval=true;
5238                 else tval=false;
5239                 fi;;
5240         *)
5241                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5242                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5243                 then tval=true;
5244                 else tval=false;
5245                 fi;
5246                 $rm -f t t.c;;
5247         esac;;
5248 *)
5249         case "$tval" in
5250         $define) tval=true;;
5251         *) tval=false;;
5252         esac;;
5253 esac;
5254 eval "$2=$tval"'
5255
5256 : define an is-in-libc? function
5257 inlibc='echo " "; td=$define; tu=$undef;
5258 sym=$1; var=$2; eval "was=\$$2";
5259 tx=yes;
5260 case "$reuseval$was" in
5261 true) ;;
5262 true*) tx=no;;
5263 esac;
5264 case "$tx" in
5265 yes)
5266         set $sym tres -f;
5267         eval $csym;
5268         case "$tres" in
5269         true)
5270                 echo "$sym() found." >&4;
5271                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5272         *)
5273                 echo "$sym() NOT found." >&4;
5274                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5275         esac;;
5276 *)
5277         case "$was" in
5278         $define) echo "$sym() found." >&4;;
5279         *) echo "$sym() NOT found." >&4;;
5280         esac;;
5281 esac'
5282
5283 : see if dlopen exists
5284 xxx_runnm="$runnm"
5285 runnm=false
5286 set dlopen d_dlopen
5287 eval $inlibc
5288 runnm="$xxx_runnm"
5289
5290 : determine which dynamic loading, if any, to compile in
5291 echo " "
5292 dldir="ext/DynaLoader"
5293 case "$usedl" in
5294 $define|y|true)
5295         dflt='y'
5296         usedl="$define"
5297         ;;
5298 $undef|n|false)
5299         dflt='n'
5300         usedl="$undef"
5301         ;;
5302 *) 
5303         dflt='n'
5304         case "$d_dlopen" in
5305             $define) dflt='y' ;;
5306         esac
5307         case "$i_dld" in
5308             $define) dflt='y' ;;
5309         esac
5310         : Does a dl_xxx.xs file exist for this operating system
5311         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5312         ;;
5313 esac
5314 rp="Do you wish to use dynamic loading?"
5315 . ./myread
5316 usedl="$ans"
5317 case "$ans" in
5318 y*) usedl="$define"
5319         case "$dlsrc" in
5320         '')
5321                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5322                         dflt="$dldir/dl_${osname}.xs"
5323                 elif $test "$d_dlopen" = "$define" ; then
5324                         dflt="$dldir/dl_dlopen.xs"
5325                 elif $test "$i_dld" = "$define" ; then
5326                         dflt="$dldir/dl_dld.xs"
5327                 else
5328                         dflt=''
5329                 fi
5330                 ;;
5331         *)      dflt="$dldir/$dlsrc"
5332                 ;;
5333         esac
5334     echo "The following dynamic loading files are available:"
5335         : Can not go over to $dldir because getfile has path hard-coded in.
5336         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5337         rp="Source file to use for dynamic loading"
5338         fn="fne"
5339         gfpth="$src"
5340         . ./getfile
5341         usedl="$define"
5342         : emulate basename
5343         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5344
5345         $cat << EOM
5346
5347 Some systems may require passing special flags to $cc -c to
5348 compile modules that will be used to create a shared library.
5349 To use no flags, say "none".
5350
5351 EOM
5352     case "$cccdlflags" in
5353     '') case "$gccversion" in
5354                 '') case "$osname" in
5355                         hpux)   dflt='+z' ;;
5356                         next)   dflt='none' ;;
5357                         irix*)  dflt='-KPIC' ;;
5358                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5359                         sunos)  dflt='-pic' ;;
5360                         *)      dflt='none' ;;
5361                     esac
5362                         ;;
5363                 *)  case "$osname" in
5364                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5365                         *)      dflt='-fpic' ;;
5366                     esac ;;
5367             esac ;;
5368         ' ') dflt='none' ;;
5369     *)  dflt="$cccdlflags" ;;
5370     esac
5371     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5372     . ./myread
5373     case "$ans" in
5374     none) cccdlflags=' ' ;;
5375     *) cccdlflags="$ans" ;;
5376     esac
5377
5378     cat << EOM
5379
5380 Some systems use ld to create libraries that can be dynamically loaded,
5381 while other systems (such as those using ELF) use $cc.
5382
5383 EOM
5384         case "$ld" in
5385         '')     $cat >try.c <<'EOM'
5386 /* Test for whether ELF binaries are produced */
5387 #include <fcntl.h>
5388 #include <stdlib.h>
5389 int main() {
5390         char b[4];
5391         int i = open("a.out",O_RDONLY);
5392         if(i == -1) 
5393                 exit(1); /* fail */
5394         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5395                 exit(0); /* succeed (yes, it's ELF) */
5396         else
5397                 exit(1); /* fail */
5398 }
5399 EOM
5400                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5401                         cat <<EOM
5402 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5403 EOM
5404                         dflt="$cc"
5405                 else
5406                         echo "I'll use ld to build dynamic libraries."
5407                         dflt='ld'
5408                 fi
5409                 rm -f try.c a.out
5410                 ;;
5411         *)      dflt="$ld"
5412                 ;;
5413         esac
5414
5415     rp="What command should be used to create dynamic libraries?"
5416     . ./myread
5417         ld="$ans"
5418
5419     cat << EOM
5420
5421 Some systems may require passing special flags to $ld to create a
5422 library that can be dynamically loaded.  If your ld flags include
5423 -L/other/path options to locate libraries outside your loader's normal
5424 search path, you may need to specify those -L options here as well.  To
5425 use no flags, say "none".
5426
5427 EOM
5428     case "$lddlflags" in
5429     '') case "$osname" in
5430                         beos) dflt='-nostart' ;;
5431                         hpux)  dflt='-b' ;;
5432                         linux|irix*)    dflt='-shared' ;;
5433                         next)  dflt='none' ;;
5434                         solaris) dflt='-G' ;;
5435                         sunos) dflt='-assert nodefinitions' ;;
5436                         svr4*|esix*) dflt="-G $ldflags" ;;
5437                 *)     dflt='none' ;;
5438                         esac
5439                         ;;
5440     *) dflt="$lddlflags" ;;
5441     esac
5442
5443         : Try to guess additional flags to pick up local libraries.
5444         : Be careful not to append to a plain 'none'
5445         case "$dflt" in
5446         none) dflt='' ;;
5447         esac
5448         for thisflag in $ldflags; do
5449                 case "$thisflag" in
5450                 -L*)
5451                         case " $dflt " in
5452                         *" $thisflag "*) ;;
5453                         *) dflt="$dflt $thisflag" ;;
5454                         esac
5455                         ;;
5456                 esac
5457         done
5458
5459         case "$dflt" in
5460         ''|' ') dflt='none' ;;
5461         esac
5462
5463     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5464     . ./myread
5465     case "$ans" in
5466     none) lddlflags=' ' ;;
5467     *) lddlflags="$ans" ;;
5468     esac
5469
5470         cat <<EOM
5471
5472 Some systems may require passing special flags to $cc to indicate that
5473 the resulting executable will use dynamic linking.  To use no flags,
5474 say "none".
5475
5476 EOM
5477     case "$ccdlflags" in
5478     '') case "$osname" in
5479                 hpux)   dflt='-Wl,-E' ;;
5480                 linux)  dflt='-rdynamic' ;;
5481                 next)   dflt='none' ;;
5482                 sunos)  dflt='none' ;;
5483                 *)      dflt='none' ;;
5484             esac ;;
5485     ' ')  dflt='none' ;;
5486     *)  dflt="$ccdlflags" ;;
5487     esac
5488     rp="Any special flags to pass to $cc to use dynamic loading?"
5489     . ./myread
5490     case "$ans" in
5491     none) ccdlflags=' ' ;;
5492     *) ccdlflags="$ans" ;;
5493     esac
5494     ;;
5495 *)  usedl="$undef"
5496         ld='ld'
5497     dlsrc='dl_none.xs'
5498     lddlflags=''
5499     ccdlflags=''
5500     ;;
5501 esac
5502
5503 also=''
5504 case "$usedl" in
5505 $undef)
5506         # No dynamic loading being used, so don't bother even to prompt.
5507         useshrplib='false'
5508         ;;
5509 *)      case "$useshrplib" in
5510         '')     case "$osname" in
5511                 svr4*|dgux|dynixptx|esix|powerux|beos)
5512                         dflt=y
5513                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5514                         ;;
5515                 next*)
5516                         case "$osvers" in
5517                         4*)     dflt=y
5518                                 also='Building a shared libperl is needed for MAB support.'
5519                                 ;;
5520                         *)      dflt=n
5521                                 ;;
5522                         esac
5523                         ;;
5524                 *)      dflt=n
5525                         ;;
5526                 esac
5527                 ;;
5528         $define|true|[Yy]*)
5529                 dflt=y
5530                 ;;
5531         *)      dflt=n
5532                 ;;
5533         esac
5534         $cat << EOM
5535
5536 The perl executable is normally obtained by linking perlmain.c with
5537 libperl${_a}, any static extensions (usually just DynaLoader), and
5538 any other libraries needed on this system (such as -lm, etc.).  Since
5539 your system supports dynamic loading, it is probably possible to build
5540 a shared libperl.$so.  If you will have more than one executable linked
5541 to libperl.$so, this will significantly reduce the size of each
5542 executable, but it may have a noticeable affect on performance.  The
5543 default is probably sensible for your system.
5544 $also
5545
5546 EOM
5547         rp="Build a shared libperl.$so (y/n)"
5548         . ./myread
5549         case "$ans" in
5550         true|$define|[Yy]*)
5551                 useshrplib='true'  ;;
5552         *)      useshrplib='false' ;;
5553         esac
5554         ;;
5555 esac
5556
5557 case "$useshrplib" in
5558 true)
5559         case "$libperl" in
5560         '')
5561                 # Figure out a good name for libperl.so.  Since it gets stored in
5562                 # a version-specific architecture-dependent library, the version
5563                 # number isn't really that important, except for making cc/ld happy.
5564                 #
5565                 # A name such as libperl.so.3.1
5566                 majmin="libperl.$so.$patchlevel.$subversion"
5567                 # A name such as libperl.so.301
5568                 majonly=`echo $patchlevel $subversion |
5569                         $awk '{printf "%d%02d", $1, $2}'`
5570                 majonly=libperl.$so.$majonly
5571                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5572                 # rely on figuring it out from the naming of libc.
5573                 case "${osname}${osvers}" in
5574                 next4*)
5575                         dflt=libperl.5.$so
5576                         # XXX How handle the --version stuff for MAB?
5577                         ;;
5578                 linux*)  # ld won't link with a bare -lperl otherwise.
5579                         dflt=libperl.$so
5580                         ;;
5581                 *)      # Try to guess based on whether libc has major.minor.
5582                         case "$libc" in
5583                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5584                         *libc.$so.[0-9]*) dflt=$majonly ;;
5585                         *)      dflt=libperl.$so ;;
5586                         esac
5587                         ;;
5588                 esac
5589                 ;;
5590         *)      dflt=$libperl
5591                 ;;
5592         esac
5593         cat << EOM
5594
5595 I need to select a good name for the shared libperl.  If your system uses
5596 library names with major and minor numbers, then you might want something
5597 like $majmin.  Alternatively, if your system uses a single version
5598 number for shared libraries, then you might want to use $majonly.
5599 Or, your system might be quite happy with a simple libperl.$so.
5600
5601 Since the shared libperl will get installed into a version-specific
5602 architecture-dependent directory, the version number of the shared perl
5603 library probably isn't important, so the default should be o.k.
5604
5605 EOM
5606         rp='What name do you want to give to the shared libperl?'
5607         . ./myread
5608         libperl=$ans
5609         echo "Ok, I'll use $libperl"
5610         ;;
5611 *)
5612         libperl="libperl${_a}"
5613         ;;
5614 esac
5615
5616 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5617 case "$shrpdir" in
5618 '') ;;
5619 *)      $cat >&4 <<EOM
5620 WARNING:  Use of the shrpdir variable for the installation location of
5621 the shared $libperl is not supported.  It was never documented and
5622 will not work in this version.  Let me (perlbug@perl.com)
5623 know of any problems this may cause.
5624
5625 EOM
5626         case "$shrpdir" in
5627         "$archlibexp/CORE")
5628                 $cat >&4 <<EOM
5629 But your current setting of $shrpdir is
5630 the default anyway, so it's harmless.
5631 EOM
5632                 ;;
5633         *)
5634                 $cat >&4 <<EOM
5635 Further, your current attempted setting of $shrpdir
5636 conflicts with the value of $archlibexp/CORE
5637 that installperl will use.
5638 EOM
5639                 ;;
5640         esac
5641         ;;
5642 esac
5643
5644 # How will the perl executable find the installed shared $libperl?
5645 # Add $xxx to ccdlflags.
5646 # If we can't figure out a command-line option, use $shrpenv to
5647 # set env LD_RUN_PATH.  The main perl makefile uses this.
5648 shrpdir=$archlibexp/CORE
5649 xxx=''
5650 tmp_shrpenv=''
5651 if "$useshrplib"; then
5652     case "$osname" in 
5653         aix)
5654                 # We'll set it in Makefile.SH...
5655                 ;;
5656         solaris|netbsd)
5657                 xxx="-R $shrpdir"
5658                 ;;
5659         freebsd)
5660                 xxx="-Wl,-R$shrpdir"
5661                 ;;
5662         linux|irix*|dec_osf)
5663                 xxx="-Wl,-rpath,$shrpdir"
5664                 ;;
5665         next)
5666                 # next doesn't like the default...
5667                 ;;
5668         beos)
5669                 # beos doesn't like the default, either.
5670                 ;;
5671         hpux*)
5672                 # hpux doesn't like the default, either.
5673                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5674                 ;;
5675         *)
5676                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5677                 ;;
5678         esac
5679         case "$xxx" in
5680         '') ;;
5681         *)      
5682                 # Only add $xxx if it isn't already in ccdlflags.
5683                 case " $ccdlflags " in
5684                 *" $xxx "*)     ;;
5685                 *)      ccdlflags="$ccdlflags $xxx"
5686                         cat <<EOM >&4
5687
5688 Adding $xxx to the flags
5689 passed to $ld so that the perl executable will find the 
5690 installed shared $libperl.
5691
5692 EOM
5693                         ;;
5694                 esac
5695                 ;;
5696         esac
5697 fi
5698 # Fix ccdlflags in AIX for building external extensions.
5699 # (For building Perl itself bare -bE:perl.exp is needed,
5700 #  Makefile.SH takes care of this.)
5701 case "$osname" in
5702 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5703 esac
5704 # Respect a hint or command-line value.
5705 case "$shrpenv" in
5706 '') shrpenv="$tmp_shrpenv" ;;
5707 esac
5708 case "$ldlibpthname" in
5709 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5710 none)   ldlibpthname='' ;;
5711 esac
5712
5713 : determine where manual pages go
5714 set man1dir man1dir none
5715 eval $prefixit
5716 $cat <<EOM
5717
5718 $spackage has manual pages available in source form.
5719 EOM
5720 case "$nroff" in
5721 nroff)
5722         echo "However, you don't have nroff, so they're probably useless to you."
5723         case "$man1dir" in
5724         '') man1dir="none";;
5725         esac;;
5726 esac
5727 echo "If you don't want the manual sources installed, answer 'none'."
5728 case "$man1dir" in
5729 ' ') dflt=none
5730         ;;
5731 '')
5732         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5733         lookpath="$lookpath $prefixexp/man/p_man/man1"
5734         lookpath="$lookpath $prefixexp/man/u_man/man1"
5735         lookpath="$lookpath $prefixexp/man/man.1"
5736         case "$sysman" in
5737         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5738         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5739         esac
5740         set dflt
5741         eval $prefixup
5742         ;;
5743 *)  dflt="$man1dir"
5744         ;;
5745 esac
5746 echo " "
5747 fn=dn+~
5748 rp="Where do the main $spackage manual pages (source) go?"
5749 . ./getfile
5750 if $test "X$man1direxp" != "X$ansexp"; then
5751         installman1dir=''
5752 fi
5753 man1dir="$ans"
5754 man1direxp="$ansexp"
5755 case "$man1dir" in
5756 '')     man1dir=' '
5757         installman1dir='';;
5758 esac
5759
5760 : Change installation prefix, if necessary.
5761 if $test X"$prefix" != X"$installprefix"; then
5762         installman1dir=`echo $man1direxp | $sed 's#^$prefix#$installprefix#'`
5763 else
5764         installman1dir="$man1direxp"
5765 fi
5766
5767 : What suffix to use on installed man pages
5768
5769 case "$man1dir" in
5770 ' ')
5771         man1ext='0'
5772         ;;
5773 *)
5774         rp="What suffix should be used for the main $spackage man pages?"
5775         case "$man1ext" in
5776         '')     case "$man1dir" in
5777                 *1)  dflt=1 ;;
5778                 *1p) dflt=1p ;;
5779                 *1pm) dflt=1pm ;;
5780                 *l) dflt=l;;
5781                 *n) dflt=n;;
5782                 *o) dflt=o;;
5783                 *p) dflt=p;;
5784                 *C) dflt=C;;
5785                 *L) dflt=L;;
5786                 *L1) dflt=L1;;
5787                 *) dflt=1;;
5788                 esac
5789                 ;;
5790         *)      dflt="$man1ext";;
5791         esac
5792         . ./myread
5793         man1ext="$ans"
5794         ;;
5795 esac
5796
5797 : see if we can have long filenames
5798 echo " "
5799 rmlist="$rmlist /tmp/cf$$"
5800 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5801 first=123456789abcdef
5802 second=/tmp/cf$$/$first
5803 $rm -f $first $second
5804 if (echo hi >$first) 2>/dev/null; then
5805         if $test -f 123456789abcde; then
5806                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5807                 val="$undef"
5808         else
5809                 if (echo hi >$second) 2>/dev/null; then
5810                         if $test -f /tmp/cf$$/123456789abcde; then
5811                                 $cat <<'EOM'
5812 That's peculiar... You can have filenames longer than 14 characters, but only
5813 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5814 I shall consider your system cannot support long filenames at all.
5815 EOM
5816                                 val="$undef"
5817                         else
5818                                 echo 'You can have filenames longer than 14 characters.' >&4
5819                                 val="$define"
5820                         fi
5821                 else
5822                         $cat <<'EOM'
5823 How confusing! Some of your filesystems are sane enough to allow filenames
5824 longer than 14 characters but some others like /tmp can't even think about them.
5825 So, for now on, I shall assume your kernel does not allow them at all.
5826 EOM
5827                         val="$undef"
5828                 fi
5829         fi
5830 else
5831         $cat <<'EOM'
5832 You can't have filenames longer than 14 chars.  You can't even think about them!
5833 EOM
5834         val="$undef"
5835 fi 
5836 set d_flexfnam
5837 eval $setvar
5838 $rm -rf /tmp/cf$$ 123456789abcde*
5839
5840 : determine where library module manual pages go
5841 set man3dir man3dir none
5842 eval $prefixit
5843 $cat <<EOM
5844
5845 $spackage has manual pages for many of the library modules.
5846 EOM
5847
5848 case "$nroff" in
5849 nroff)
5850         $cat <<'EOM'
5851 However, you don't have nroff, so they're probably useless to you.
5852 EOM
5853         case "$man3dir" in
5854         '') man3dir="none";;
5855         esac;;
5856 esac
5857
5858 case "$d_flexfnam" in
5859 undef)
5860         $cat <<'EOM'
5861 However, your system can't handle the long file names like File::Basename.3. 
5862 EOM
5863         case "$man3dir" in
5864         '') man3dir="none";;
5865         esac;;
5866 esac
5867
5868 echo "If you don't want the manual sources installed, answer 'none'."
5869 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5870 case "$man3dir" in
5871 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5872         if $test -d "$privlib/man/man3"; then
5873                 cat <<EOM >&4
5874
5875 WARNING:  Previous versions of perl installed man3 pages into
5876 $privlib/man/man3.  This version will suggest a 
5877 new default of $dflt.  
5878 EOM
5879                 tdflt=$dflt
5880                 dflt='n'
5881                 rp='Do you wish to preserve the old behavior?(y/n)'
5882                 . ./myread
5883                 case "$ans" in
5884                 y*) dflt="$privlib/man/man3" ;;
5885                 *)  dflt=$tdflt ;;
5886                 esac
5887     fi
5888         ;;
5889 ' ') dflt=none;;
5890 *)      dflt="$man3dir" ;;
5891 esac
5892 echo " "
5893 fn=dn+~
5894 rp="Where do the $package library man pages (source) go?"
5895 . ./getfile
5896 man3dir="$ans"
5897 man3direxp="$ansexp"
5898 case "$man1dir" in
5899 '')     man3dir=' '
5900         installman3dir='';;
5901 esac
5902
5903 : Change installation prefix, if necessary.
5904 if $test X"$prefix" != X"$installprefix"; then
5905         installman3dir=`echo $man3direxp | $sed 's#^$prefix#$installprefix#'`
5906 else
5907         installman3dir="$man3direxp"
5908 fi
5909
5910 : What suffix to use on installed man pages
5911 case "$man3dir" in
5912 ' ')
5913         man3ext='0'
5914         ;;
5915 *)
5916         rp="What suffix should be used for the $package library man pages?"
5917         case "$man3ext" in
5918         '')     case "$man3dir" in
5919                 *3)  dflt=3 ;;
5920                 *3p) dflt=3p ;;
5921                 *3pm) dflt=3pm ;;
5922                 *l) dflt=l;;
5923                 *n) dflt=n;;
5924                 *o) dflt=o;;
5925                 *p) dflt=p;;
5926                 *C) dflt=C;;
5927                 *L) dflt=L;;
5928                 *L3) dflt=L3;;
5929                 *) dflt=3;;
5930                 esac
5931                 ;;
5932         *)      dflt="$man3ext";;
5933         esac
5934         . ./myread
5935         man3ext="$ans"
5936         ;;
5937 esac
5938
5939 : see if we have to deal with yellow pages, now NIS.
5940 if $test -d /usr/etc/yp || $test -d /etc/yp; then
5941         if $test -f /usr/etc/nibindd; then
5942                 echo " "
5943                 echo "I'm fairly confident you're on a NeXT."
5944                 echo " "
5945                 rp='Do you get the hosts file via NetInfo?'
5946                 dflt=y
5947                 case "$hostcat" in
5948                 nidump*) ;;
5949                 '') ;;
5950                 *) dflt=n;;
5951                 esac
5952                 . ./myread
5953                 case "$ans" in
5954                 y*) hostcat='nidump hosts .';;
5955                 *)      case "$hostcat" in
5956                         nidump*) hostcat='';;
5957                         esac
5958                         ;;
5959                 esac
5960         fi
5961         case "$hostcat" in
5962         nidump*) ;;
5963         *)
5964                 case "$hostcat" in
5965                 *ypcat*) dflt=y;;
5966                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5967                                 dflt=y
5968                         else
5969                                 dflt=n
5970                         fi;;
5971                 *) dflt=n;;
5972                 esac
5973                 echo " "
5974                 rp='Are you getting the hosts file via yellow pages?'
5975                 . ./myread
5976                 case "$ans" in
5977                 y*) hostcat='ypcat hosts';;
5978                 *) hostcat='cat /etc/hosts';;
5979                 esac
5980                 ;;
5981         esac
5982 fi
5983 case "$hostcat" in
5984 '') hostcat='cat /etc/hosts';;
5985 esac
5986 case "$groupcat" in
5987 '') groupcat='cat /etc/group';;
5988 esac
5989 case "$passcat" in
5990 '') passcat='cat /etc/passwd';;
5991 esac
5992
5993 : now get the host name
5994 echo " "
5995 echo "Figuring out host name..." >&4
5996 case "$myhostname" in
5997 '') cont=true
5998         echo 'Maybe "hostname" will work...'
5999         if tans=`sh -c hostname 2>&1` ; then
6000                 myhostname=$tans
6001                 phostname=hostname
6002                 cont=''
6003         fi
6004         ;;
6005 *) cont='';;
6006 esac
6007 if $test "$cont"; then
6008         if ./xenix; then
6009                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6010                 if tans=`cat /etc/systemid 2>&1` ; then
6011                         myhostname=$tans
6012                         phostname='cat /etc/systemid'
6013                         echo "Whadyaknow.  Xenix always was a bit strange..."
6014                         cont=''
6015                 fi
6016         elif $test -r /etc/systemid; then
6017                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6018         fi
6019 fi
6020 if $test "$cont"; then
6021         echo 'No, maybe "uuname -l" will work...'
6022         if tans=`sh -c 'uuname -l' 2>&1` ; then
6023                 myhostname=$tans
6024                 phostname='uuname -l'
6025         else
6026                 echo 'Strange.  Maybe "uname -n" will work...'
6027                 if tans=`sh -c 'uname -n' 2>&1` ; then
6028                         myhostname=$tans
6029                         phostname='uname -n'
6030                 else
6031                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6032                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6033                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6034                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6035                         else
6036                                 case "$myhostname" in
6037                                 '') echo "Does this machine have an identity crisis or something?"
6038                                         phostname='';;
6039                                 *)
6040                                         echo "Well, you said $myhostname before..."
6041                                         phostname='echo $myhostname';;
6042                                 esac
6043                         fi
6044                 fi
6045         fi
6046 fi
6047 : you do not want to know about this
6048 set $myhostname
6049 myhostname=$1
6050
6051 : verify guess
6052 if $test "$myhostname" ; then
6053         dflt=y
6054         rp='Your host name appears to be "'$myhostname'".'" Right?"
6055         . ./myread
6056         case "$ans" in
6057         y*) ;;
6058         *) myhostname='';;
6059         esac
6060 fi
6061
6062 : bad guess or no guess
6063 while $test "X$myhostname" = X ; do
6064         dflt=''
6065         rp="Please type the (one word) name of your host:"
6066         . ./myread
6067         myhostname="$ans"
6068 done
6069
6070 : translate upper to lower if necessary
6071 case "$myhostname" in
6072 *[A-Z]*)
6073         echo "(Normalizing case in your host name)"
6074         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6075         ;;
6076 esac
6077
6078 case "$myhostname" in
6079 *.*)
6080         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6081         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6082         echo "(Trimming domain name from host name--host name is now $myhostname)"
6083         ;;
6084 *) case "$mydomain" in
6085         '')
6086                 {
6087                         test "X$hostcat" = "Xypcat hosts" &&
6088                         ypmatch "$myhostname" hosts 2>/dev/null |\
6089                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6090                         $test -s hosts
6091                 } || {
6092                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6093                                         /[       ]$myhostname[  . ]/p" > hosts
6094                 }
6095                 tmp_re="[       . ]"
6096                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6097                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6098                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6099                         hosts | $sort | $uniq | \
6100                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6101                 case `$echo X$dflt` in
6102                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6103                         dflt=.
6104                         ;;
6105                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6106                         ;;
6107                 esac
6108                 case "$dflt" in
6109                 .)
6110                         tans=`./loc resolv.conf X /etc /usr/etc`
6111                         if $test -f "$tans"; then
6112                                 echo "(Attempting domain name extraction from $tans)"
6113                                 dflt=.`$sed -n -e 's/   / /g' \
6114                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6115                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6116                                 case "$dflt" in
6117                                 .) dflt=.`$sed -n -e 's/        / /g' \
6118                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6119                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6120                                         ;;
6121                                 esac
6122                         fi
6123                         ;;
6124                 esac
6125                 case "$dflt" in
6126                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6127                         dflt=.`sh -c domainname 2>/dev/null`
6128                         case "$dflt" in
6129                         '') dflt='.';;
6130                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6131                         esac
6132                         ;;
6133                 esac
6134                 case "$dflt" in
6135                 .) echo "(Lost all hope -- silly guess then)"
6136                         dflt='.uucp'
6137                         ;;
6138                 esac
6139                 $rm -f hosts
6140                 ;;
6141         *) dflt="$mydomain";;
6142         esac;;
6143 esac
6144 echo " "
6145 rp="What is your domain name?"
6146 . ./myread
6147 tans="$ans"
6148 case "$ans" in
6149 '') ;;
6150 .*) ;;
6151 *) tans=".$tans";;
6152 esac
6153 mydomain="$tans"
6154
6155 : translate upper to lower if necessary
6156 case "$mydomain" in
6157 *[A-Z]*)
6158         echo "(Normalizing case in your domain name)"
6159         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6160         ;;
6161 esac
6162
6163 : a little sanity check here
6164 case "$phostname" in
6165 '') ;;
6166 *)
6167         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6168         $myhostname$mydomain|$myhostname) ;;
6169         *)
6170                 case "$phostname" in
6171                 sed*)
6172                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6173                         ;;
6174                 *)
6175                         echo "(That doesn't agree with your $phostname command, by the way.)"
6176                         ;;
6177                 esac
6178         ;;
6179         esac
6180         ;;
6181 esac
6182
6183 $cat <<EOM
6184
6185 I need to get your e-mail address in Internet format if possible, i.e.
6186 something like user@host.domain. Please answer accurately since I have
6187 no easy means to double check it. The default value provided below
6188 is most probably close to the reality but may not be valid from outside
6189 your organization...
6190
6191 EOM
6192 cont=x
6193 while test "$cont"; do
6194         case "$cf_email" in
6195         '') dflt="$cf_by@$myhostname$mydomain";;
6196         *) dflt="$cf_email";;
6197         esac
6198         rp='What is your e-mail address?'
6199         . ./myread
6200         cf_email="$ans"
6201         case "$cf_email" in
6202         *@*.*) cont='' ;;
6203         *)
6204                 rp='Address does not look like an Internet one.  Use it anyway?'
6205                 case "$fastread" in
6206                 yes) dflt=y ;;
6207                 *) dflt=n ;;
6208                 esac
6209                 . ./myread
6210                 case "$ans" in
6211                 y*) cont='' ;;
6212                 *) echo " " ;;
6213                 esac
6214                 ;;
6215         esac
6216 done
6217
6218 $cat <<EOM
6219
6220 If you or somebody else will be maintaining perl at your site, please
6221 fill in the correct e-mail address here so that they may be contacted
6222 if necessary. Currently, the "perlbug" program included with perl
6223 will send mail to this address in addition to perlbug@perl.com. You may
6224 enter "none" for no administrator.
6225
6226 EOM
6227 case "$perladmin" in
6228 '') dflt="$cf_email";;
6229 *) dflt="$perladmin";;
6230 esac
6231 rp='Perl administrator e-mail address'
6232 . ./myread
6233 perladmin="$ans"
6234
6235 : figure out how to guarantee perl startup
6236 case "$startperl" in
6237 '')
6238         case "$sharpbang" in
6239         *!)
6240                 $cat <<EOH
6241
6242 I can use the #! construct to start perl on your system. This will
6243 make startup of perl scripts faster, but may cause problems if you
6244 want to share those scripts and perl is not in a standard place
6245 ($binexp/perl) on all your platforms. The alternative is to force
6246 a shell by starting the script with a single ':' character.
6247
6248 EOH
6249                 dflt="$binexp/perl"
6250                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6251                 . ./myread
6252                 case "$ans" in
6253                 none)   startperl=": # use perl";;
6254                 *)      startperl="#!$ans"
6255                         if $test 30 -lt `echo "$ans" | wc -c`; then
6256                                 $cat >&4 <<EOM
6257
6258 WARNING:  Some systems limit the #! command to 32 characters.
6259 If you experience difficulty running Perl scripts with #!, try
6260 installing Perl in a directory with a shorter pathname.
6261
6262 EOM
6263                         fi ;;
6264                 esac
6265                 ;;
6266         *) startperl=": # use perl"
6267                 ;;
6268         esac
6269         ;;
6270 esac
6271 echo "I'll use $startperl to start perl scripts."
6272
6273 : figure best path for perl in scripts
6274 case "$perlpath" in
6275 '')
6276         perlpath="$binexp/perl"
6277         case "$startperl" in
6278         *!*) ;;
6279         *)
6280                 $cat <<EOH
6281
6282 I will use the "eval 'exec'" idiom to start Perl on your system.
6283 I can use the full path of your Perl binary for this purpose, but
6284 doing so may cause problems if you want to share those scripts and
6285 Perl is not always in a standard place ($binexp/perl).
6286
6287 EOH
6288                 dflt="$binexp/perl"
6289                 rp="What path shall I use in \"eval 'exec'\"?"
6290                 . ./myread
6291                 perlpath="$ans"
6292                 ;;
6293         esac
6294         ;;
6295 esac
6296 case "$startperl" in
6297 *!*)    ;;
6298 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6299 esac
6300
6301 : determine where public executable scripts go
6302 set scriptdir scriptdir
6303 eval $prefixit
6304 case "$scriptdir" in
6305 '')
6306         dflt="$bin"
6307         : guess some guesses
6308         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6309         $test -d /usr/share/bin     && dflt=/usr/share/bin
6310         $test -d /usr/local/script  && dflt=/usr/local/script
6311         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6312         $test -d $prefixexp/script  && dflt=$prefixexp/script
6313         set dflt
6314         eval $prefixup
6315         ;;
6316 *)  dflt="$scriptdir"
6317         ;;
6318 esac
6319 $cat <<EOM
6320  
6321 Some installations have a separate directory just for executable scripts so
6322 that they can mount it across multiple architectures but keep the scripts in
6323 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6324 Or you might just lump your scripts in with all your other executables.
6325  
6326 EOM
6327 fn=d~
6328 rp='Where do you keep publicly executable scripts?'
6329 . ./getfile
6330 if $test "X$ansexp" != "X$scriptdirexp"; then
6331         installscript=''
6332 fi
6333 scriptdir="$ans"
6334 scriptdirexp="$ansexp"
6335 : Change installation prefix, if necessary.
6336 if $test X"$prefix" != X"$installprefix"; then
6337         installscript=`echo $scriptdirexp | sed 's#^$prefix#$installprefix#'`
6338 else
6339         installscript="$scriptdirexp"
6340 fi
6341
6342 $cat <<EOM
6343
6344 After $package is installed, you may wish to install various
6345 add-on modules and utilities.  Typically, these add-ons will
6346 be installed under $prefix with the rest
6347 of this package.  However, you may wish to install such add-ons
6348 elsewhere under a different prefix.
6349
6350 If you do not wish to put everything under a single prefix, that's
6351 ok.  You will be prompted for the individual locations; this siteprefix
6352 is only used to suggest the defaults.
6353
6354 The default should be fine for most people.
6355
6356 EOM
6357 fn=d~+
6358 rp='Installation prefix to use for add-on modules and utilities?'
6359 : XXX Here might be another good place for an installstyle setting.
6360 case "$siteprefix" in
6361 '') dflt=$prefix ;;
6362 *)  dflt=$siteprefix ;;
6363 esac
6364 . ./getfile
6365 oldsiteprefix=''
6366 case "$siteprefix" in
6367 '') ;;
6368 *)
6369         case "$ans" in
6370         "$prefix") ;;
6371         *) oldsiteprefix="$prefix";;
6372         esac
6373         ;;
6374 esac
6375 siteprefix="$ans"
6376 siteprefixexp="$ansexp"
6377
6378 : determine where site specific libraries go.
6379 : Usual default is /usr/local/lib/perl5/site_perl
6380 : The default "style" setting is made in installstyle.U
6381 : XXX No longer works with Prefixit stuff.
6382 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6383 case "$installstyle" in
6384 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6385 *)       dflt=$siteprefix/lib/site_$prog ;;
6386 esac
6387 $cat <<EOM
6388
6389 The installation process will create a directory for
6390 site-specific extensions and modules.  Most users find it convenient
6391 to place all site-specific files in this directory rather than in the
6392 main distribution directory.
6393
6394 EOM
6395 fn=d~+
6396 rp='Pathname for the site-specific library files?'
6397 . ./getfile
6398 sitelib="$ans"
6399 sitelibexp="$ansexp"
6400 : Change installation prefix, if necessary.
6401 if $test X"$prefix" != X"$installprefix"; then
6402         installsitelib=`echo $sitelibexp | sed 's#^$prefix#$installprefix#'`
6403 else
6404         installsitelib="$sitelibexp"
6405 fi
6406
6407 : determine where site specific architecture-dependent libraries go.
6408 : sitelib  default is /usr/local/lib/perl5/site_perl/
6409 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6410 : sitelib may have an optional trailing /share.
6411 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6412 tdflt="$tdflt/$apiversion/$archname"
6413 set sitearch sitearch none
6414 eval $prefixit
6415 case "$sitearch" in
6416 '')     dflt="$tdflt" ;;
6417 *)      dflt="$sitearch" ;;
6418 esac
6419 $cat <<EOM
6420
6421 The installation process will also create a directory for
6422 architecture-dependent site-specific extensions and modules.
6423
6424 EOM
6425 fn=nd~+
6426 rp='Pathname for the site-specific architecture-dependent library files?'
6427 . ./getfile
6428 sitearch="$ans"
6429 sitearchexp="$ansexp"
6430 : Change installation prefix, if necessary.
6431 if $test X"$prefix" != X"$installprefix"; then
6432         installsitearch=`echo $sitearchexp | sed 's#^$prefix#$installprefix#'`
6433 else
6434         installsitearch="$sitearchexp"
6435 fi
6436
6437 cat <<EOM
6438
6439 Previous version of $package used the standard IO mechanisms as defined
6440 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6441 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6442 the default.  This abstraction layer can use AT&T's sfio (if you already
6443 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6444 problems with some extension modules.  Using PerlIO with stdio is safe,
6445 but it is slower than plain stdio and therefore is not the default.
6446
6447 If this doesn't make any sense to you, just accept the default 'n'.
6448 EOM
6449 case "$useperlio" in
6450 $define|true|[yY]*)     dflt='y';;
6451 *) dflt='n';;
6452 esac
6453 rp='Use the experimental PerlIO abstraction layer?'
6454 . ./myread
6455 case "$ans" in
6456 y|Y) 
6457         val="$define"
6458         ;;     
6459 *)      
6460         echo "Ok, doing things the stdio way"
6461         val="$undef"
6462         ;;
6463 esac
6464 set useperlio
6465 eval $setvar 
6466
6467 : Check how to convert floats to strings.
6468 if test "X$d_Gconvert" = X; then
6469         echo " "
6470         echo "Checking for an efficient way to convert floats to strings."
6471         $cat >try.c <<'EOP'
6472 #ifdef TRY_gconvert
6473 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6474 char *myname = "gconvert";
6475 #endif
6476 #ifdef TRY_gcvt
6477 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6478 char *myname = "gcvt";
6479 #endif
6480 #ifdef TRY_sprintf
6481 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6482 char *myname = "sprintf";
6483 #endif
6484
6485 #include <stdio.h>
6486
6487 int
6488 checkit(expect, got)
6489 char *expect;
6490 char *got;
6491 {
6492     if (strcmp(expect, got)) {
6493                 printf("%s oddity:  Expected %s, got %s\n",
6494                         myname, expect, got);
6495                 exit(1);
6496         }
6497 }
6498
6499 int main()
6500
6501         char buf[64]; 
6502         buf[63] = '\0';
6503
6504         /* This must be 1st test on (which?) platform */
6505         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6506         Gconvert(0.1, 8, 0, buf);
6507         checkit("0.1", buf);
6508
6509         Gconvert(1.0, 8, 0, buf); 
6510         checkit("1", buf);
6511
6512         Gconvert(0.0, 8, 0, buf); 
6513         checkit("0", buf);
6514
6515         Gconvert(-1.0, 8, 0, buf); 
6516         checkit("-1", buf);
6517
6518         /* Some Linux gcvt's give 1.e+5 here. */
6519         Gconvert(100000.0, 8, 0, buf); 
6520         checkit("100000", buf);
6521         
6522         /* Some Linux gcvt's give -1.e+5 here. */
6523         Gconvert(-100000.0, 8, 0, buf); 
6524         checkit("-100000", buf);
6525
6526         exit(0);
6527 }
6528 EOP
6529         case "$d_Gconvert" in
6530         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6531         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6532         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6533         *) xxx_list='gconvert gcvt sprintf' ;;
6534         esac
6535
6536         for xxx_convert in $xxx_list; do
6537                 echo "Trying $xxx_convert"
6538                 $rm -f try try$_o
6539                 set try -DTRY_$xxx_convert
6540                 if eval $compile; then
6541                         echo "$xxx_convert" found. >&4
6542                         if ./try; then
6543                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6544                                 break;
6545                         else
6546                                 echo "...But $xxx_convert didn't work as I expected."
6547                         fi
6548                 else
6549                         echo "$xxx_convert NOT found." >&4
6550                 fi
6551         done
6552                 
6553         case "$xxx_convert" in
6554         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6555         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6556         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6557         esac
6558 fi
6559
6560 : see if inttypes.h is available
6561 : we want a real compile instead of Inhdr because some systems
6562 : have an inttypes.h which includes non-existent headers
6563 echo " "
6564 $cat >try.c <<EOCP
6565 #include <inttypes.h>
6566 int main() {
6567         static int32_t foo32 = 0x12345678;
6568 }
6569 EOCP
6570 set try
6571 if eval $compile; then
6572         echo "<inttypes.h> found." >&4
6573         val="$define"
6574 else
6575         echo "<inttypes.h> NOT found." >&4
6576         val="$undef"
6577 fi
6578 $rm -f try.c try
6579 set i_inttypes
6580 eval $setvar
6581
6582 : check for int64_t
6583 case "$use64bits" in
6584 "$define" )
6585         echo " "
6586         echo $n "Checking to see if your system supports int64_t...$c" >&4
6587         $cat >try.c <<EOCP
6588 #include <sys/types.h>
6589 #$i_inttypes I_INTTYPES
6590 #ifdef I_INTTYPES
6591 #include <inttypes.h>
6592 #endif
6593 int64_t foo() { int64_t x; x = 7; return x; }
6594 EOCP
6595         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6596                 val="$define"
6597                 echo " Yup, it does." >&4
6598         else
6599                 val="$undef"
6600                 echo " Nope, it doesn't." >&4
6601         fi
6602         $rm -f try.*
6603         ;;
6604 *)      val="$undef"
6605         ;;
6606 esac
6607 set d_int64t
6608 eval $setvar
6609
6610
6611 : check for lengths of integral types
6612 echo " "
6613 case "$intsize" in
6614 '')
6615         echo "Checking to see how big your integers are..." >&4
6616         $cat >intsize.c <<'EOCP'
6617 #include <stdio.h>
6618 int main()
6619 {
6620         printf("intsize=%d;\n", sizeof(int));
6621         printf("longsize=%d;\n", sizeof(long));
6622         printf("shortsize=%d;\n", sizeof(short));
6623         exit(0);
6624 }
6625 EOCP
6626         set intsize
6627         if eval $compile_ok && ./intsize > /dev/null; then
6628                 eval `./intsize`
6629                 echo "Your integers are $intsize bytes long."
6630                 echo "Your long integers are $longsize bytes long."
6631                 echo "Your short integers are $shortsize bytes long."
6632         else
6633                 $cat >&4 <<EOM
6634 !
6635 Help! I can't compile and run the intsize test program: please enlighten me!
6636 (This is probably a misconfiguration in your system or libraries, and
6637 you really ought to fix it.  Still, I'll try anyway.)
6638 !
6639 EOM
6640                 dflt=4
6641                 rp="What is the size of an integer (in bytes)?"
6642                 . ./myread
6643                 intsize="$ans"
6644                 dflt=$intsize
6645                 rp="What is the size of a long integer (in bytes)?"
6646                 . ./myread
6647                 longsize="$ans"
6648                 dflt=2
6649                 rp="What is the size of a short integer (in bytes)?"
6650                 . ./myread
6651                 shortsize="$ans"
6652         fi
6653         ;;
6654 esac
6655 $rm -f intsize intsize.*
6656
6657 : check for long long
6658 echo " "
6659 echo $n "Checking to see if your system supports long long...$c" >&4
6660 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6661 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6662         val="$define"
6663         echo " Yup, it does." >&4
6664 else
6665         val="$undef"
6666         echo " Nope, it doesn't." >&4
6667 fi
6668 $rm try.*
6669 set d_longlong
6670 eval $setvar
6671
6672 : check for length of long long
6673 case "${d_longlong}${longlongsize}" in
6674 $define)
6675         echo " "
6676         $echo $n "Checking to see how big your long longs are...$c" >&4
6677         $cat >try.c <<'EOCP'
6678 #include <stdio.h>
6679 int main()
6680 {
6681         printf("%d\n", sizeof(long long));
6682 }
6683 EOCP
6684         set try
6685         if eval $compile_ok; then
6686                 longlongsize=`./try`
6687                 $echo " $longlongsize bytes." >&4
6688         else
6689                 dflt='8'
6690                 echo " "
6691                 echo "(I can't seem to compile the test program.  Guessing...)"
6692                 rp="What is the size of a long long (in bytes)?"
6693                 . ./myread
6694                 longlongsize="$ans"
6695         fi
6696         if $test "X$longsize" = "X$longlongsize"; then
6697                 echo "(That isn't any different from an ordinary long.)"
6698         fi      
6699         ;;
6700 esac
6701 $rm -f try.c try
6702
6703 echo " "
6704
6705 case "$d_longlong" in
6706 $define)
6707
6708 echo "Checking how to print 64-bit integers..." >&4
6709
6710 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6711         quad=int
6712         $cat >try.c <<'EOCP'
6713 #include <sys/types.h>
6714 #include <stdio.h>
6715 int main() {
6716   int q = 12345678901;
6717   printf("%ld\n", q);
6718 }
6719 EOCP
6720         set try
6721         if eval $compile; then
6722                 yyy=`./try$exe_ext`
6723                 case "$yyy" in
6724                 12345678901)
6725                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6726                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6727                         echo "We will use %d."
6728                         ;;
6729                 esac
6730         fi
6731 fi
6732
6733 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6734         quad=long
6735         $cat >try.c <<'EOCP'
6736 #include <sys/types.h>
6737 #include <stdio.h>
6738 int main() {
6739   long q = 12345678901;
6740   printf("%ld\n", q);
6741 }
6742 EOCP
6743         set try
6744         if eval $compile; then
6745                 yyy=`./try$exe_ext`
6746                 case "$yyy" in
6747                 12345678901)
6748                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6749                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6750                         echo "We will use %ld."
6751                         ;;
6752                 esac
6753         fi
6754 fi
6755
6756 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6757         quad=int64_t
6758         $cat >try.c <<'EOCP'
6759 #include <sys/types.h>
6760 #include <inttypes.h>
6761 #include <stdio.h>
6762 int main() {
6763   int64_t q = 12345678901;
6764   printf("%" PRId64 "\n", q);
6765 }
6766 EOCP
6767         set try
6768         if eval $compile; then
6769                 yyy=`./try$exe_ext`
6770                 case "$yyy" in
6771                 12345678901)
6772                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6773                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6774                         echo "We will use the C9X style."
6775                         ;;
6776                 esac
6777         fi
6778 fi
6779
6780 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6781         quad="long long"
6782         $cat >try.c <<'EOCP'
6783 #include <sys/types.h>
6784 #include <stdio.h>
6785 int main() {
6786   long long q = 12345678901;
6787   printf("%lld\n", q);
6788 }
6789 EOCP
6790         set try
6791         if eval $compile; then
6792                 yyy=`./try$exe_ext`
6793                 case "$yyy" in
6794                 12345678901)
6795                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6796                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6797                         echo "We will use the %lld style."
6798                         ;;
6799                 esac
6800         fi
6801 fi
6802
6803 if $test X"$sPRId64" = X -a X"$quad" != X; then
6804         $cat >try.c <<EOCP
6805 #include <sys/types.h>
6806 #include <stdio.h>
6807 int main() {
6808   $quad q = 12345678901;
6809   printf("%Ld\n", q);
6810 }
6811 EOCP
6812         set try
6813         if eval $compile; then
6814                 yyy=`./try$exe_ext`
6815                 case "$yyy" in
6816                 12345678901)
6817                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6818                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6819                         echo "We will use %lld."
6820                         ;;
6821                 esac
6822         fi
6823 fi
6824
6825 if $test X"$sPRId64" = X -a X"$quad" != X; then
6826         $cat >try.c <<EOCP
6827 #include <sys/types.h>
6828 #include <stdio.h>
6829 int main() {
6830   $quad q = 12345678901;
6831   printf("%qd\n", q);
6832 }
6833 EOCP
6834         set try
6835         if eval $compile; then
6836                 yyy=`./try$exe_ext`
6837                 case "$yyy" in
6838                 12345678901)
6839                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
6840                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
6841                         echo "We will use %qd."
6842                         ;;
6843                 esac
6844         fi
6845 fi
6846
6847 if $test X"$sPRId64" = X; then
6848         echo "Cannot figure out how to print 64-bit integers." >&4
6849 fi
6850
6851 ;;
6852 esac # case "$d_longlong"
6853
6854 case "$sPRId64" in
6855 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
6856         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
6857         ;;
6858 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
6859         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
6860         ;;
6861 esac
6862
6863 $rm -f try try.*
6864
6865 : check for length of double
6866 echo " "
6867 case "$doublesize" in
6868 '')
6869         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
6870         $cat >try.c <<'EOCP'
6871 #include <stdio.h>
6872 int main()
6873 {
6874         printf("%d\n", sizeof(double));
6875 }
6876 EOCP
6877         set try
6878         if eval $compile_ok; then
6879                 doublesize=`./try`
6880                 $echo " $doublesize bytes." >&4
6881         else
6882                 dflt='8'
6883                 echo "(I can't seem to compile the test program.  Guessing...)"
6884                 rp="What is the size of a double precision number (in bytes)?"
6885                 . ./myread
6886                 doublesize="$ans"
6887         fi
6888         ;;
6889 esac
6890 $rm -f try.c try
6891
6892 : check for long doubles
6893 echo " "
6894 echo $n "Checking to see if your system supports long doubles...$c" >&4
6895 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
6896 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6897         val="$define"
6898         echo " Yup, it does." >&4
6899 else
6900         val="$undef"
6901         echo " Nope, it doesn't." >&4
6902 fi
6903 $rm try.*
6904 set d_longdbl
6905 eval $setvar
6906
6907 : check for length of long double
6908 case "${d_longdbl}${longdblsize}" in
6909 $define)
6910         echo " "
6911         $echo $n "Checking to see how big your long doubles are...$c" >&4
6912         $cat >try.c <<'EOCP'
6913 #include <stdio.h>
6914 int main()
6915 {
6916         printf("%d\n", sizeof(long double));
6917 }
6918 EOCP
6919         set try
6920         if eval $compile; then
6921                 longdblsize=`./try`
6922                 $echo " $longdblsize bytes." >&4
6923         else
6924                 dflt='8'
6925                 echo " "
6926                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6927                 rp="What is the size of a long double (in bytes)?"
6928                 . ./myread
6929                 longdblsize="$ans"
6930         fi
6931         if $test "X$doublesize" = "X$longdblsize"; then
6932                 echo "(That isn't any different from an ordinary double.)"
6933         fi      
6934         ;;
6935 esac
6936 $rm -f try.c try
6937
6938 echo " "
6939
6940 case "$d_longdbl" in
6941 $define)
6942
6943 echo "Checking how to print long doubles..." >&4
6944
6945 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6946         $cat >try.c <<'EOCP'
6947 #include <sys/types.h>
6948 #include <stdio.h>
6949 int main() {
6950   double d = 123.456;
6951   printf("%.3f\n", d);
6952 }
6953 EOCP
6954         set try
6955         if eval $compile; then
6956                 yyy=`./try$exe_ext`
6957                 case "$yyy" in
6958                 123.456)
6959                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6960                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
6961                         echo "We will use %f."
6962                         ;;
6963                 esac
6964         fi
6965 fi
6966
6967 if $test X"$sPRIfldbl" = X; then
6968         $cat >try.c <<'EOCP'
6969 #include <sys/types.h>
6970 #include <stdio.h>
6971 int main() {
6972   long double d = 123.456;
6973   printf("%.3Lf\n", d);
6974 }
6975 EOCP
6976         set try
6977         if eval $compile; then
6978                 yyy=`./try$exe_ext`
6979                 case "$yyy" in
6980                 123.456)
6981                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6982                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
6983                         echo "We will use %Lf."
6984                         ;;
6985                 esac
6986         fi
6987 fi
6988
6989 if $test X"$sPRIfldbl" = X; then
6990         $cat >try.c <<'EOCP'
6991 #include <sys/types.h>
6992 #include <stdio.h>
6993 int main() {
6994   long double d = 123.456;
6995   printf("%.3lf\n", d);
6996 }
6997 EOCP
6998         set try
6999         if eval $compile; then
7000                 yyy=`./try$exe_ext`
7001                 case "$yyy" in
7002                 123.456)
7003                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7004                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7005                         echo "We will use %lf."
7006                         ;;
7007                 esac
7008         fi
7009 fi
7010
7011 if $test X"$sPRIfldbl" = X; then
7012         $cat >try.c <<'EOCP'
7013 #include <sys/types.h>
7014 #include <stdio.h>
7015 int main() {
7016   long double d = 123.456;
7017   printf("%.3llf\n", d);
7018 }
7019 EOCP
7020         set try
7021         if eval $compile; then
7022                 yyy=`./try$exe_ext`
7023                 case "$yyy" in
7024                 123.456)
7025                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7026                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7027                         echo "We will use %llf."
7028                         ;;
7029                 esac
7030         fi
7031 fi
7032
7033 if $test X"$sPRIfldbl" = X; then
7034         echo "Cannot figure out how to print long doubles." >&4
7035 fi
7036
7037 ;;
7038 esac # case "$d_longdbl"
7039
7040 case "$sPRIfldbl" in
7041 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7042         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7043         ;;
7044 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7045         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7046         ;;
7047 esac
7048
7049 $rm -f try try.*
7050
7051 : Initialize h_fcntl
7052 h_fcntl=false
7053
7054 : Initialize h_sysfile
7055 h_sysfile=false
7056
7057 : access call always available on UNIX
7058 set access d_access
7059 eval $inlibc
7060
7061 : locate the flags for 'access()'
7062 case "$d_access" in
7063 "$define")
7064         echo " "
7065         $cat >access.c <<'EOCP'
7066 #include <sys/types.h>
7067 #ifdef I_FCNTL
7068 #include <fcntl.h>
7069 #endif
7070 #ifdef I_SYS_FILE
7071 #include <sys/file.h>
7072 #endif
7073 #ifdef I_UNISTD
7074 #include <unistd.h>
7075 #endif
7076 int main() {
7077         exit(R_OK);
7078 }
7079 EOCP
7080         : check sys/file.h first, no particular reason here
7081         if $test `./findhdr sys/file.h` && \
7082                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7083                 h_sysfile=true;
7084                 echo "<sys/file.h> defines the *_OK access constants." >&4
7085         elif $test `./findhdr fcntl.h` && \
7086                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7087                 h_fcntl=true;
7088                 echo "<fcntl.h> defines the *_OK access constants." >&4
7089         elif $test `./findhdr unistd.h` && \
7090                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7091                 echo "<unistd.h> defines the *_OK access constants." >&4
7092         else
7093                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7094         fi
7095         ;;
7096 esac
7097 $rm -f access*
7098
7099 : see if accessx exists
7100 set accessx d_accessx
7101 eval $inlibc
7102
7103 : see if alarm exists
7104 set alarm d_alarm
7105 eval $inlibc
7106
7107 : see if atolf exists
7108 set atolf d_atolf
7109 eval $inlibc
7110
7111 : see if atoll exists
7112 set atoll d_atoll
7113 eval $inlibc
7114
7115 : Look for GNU-cc style attribute checking
7116 echo " "
7117 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7118 $cat >attrib.c <<'EOCP'
7119 #include <stdio.h>
7120 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7121 EOCP
7122 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7123         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7124                 echo "Your C compiler doesn't fully support __attribute__."
7125                 val="$undef"
7126         else
7127                 echo "Your C compiler supports __attribute__."
7128                 val="$define"
7129         fi
7130 else
7131         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7132         val="$undef"
7133 fi
7134 set d_attribut
7135 eval $setvar
7136 $rm -f attrib*
7137
7138 : see if bcmp exists
7139 set bcmp d_bcmp
7140 eval $inlibc
7141
7142 : see if bcopy exists
7143 set bcopy d_bcopy
7144 eval $inlibc
7145
7146 : see if this is a unistd.h system
7147 set unistd.h i_unistd
7148 eval $inhdr
7149
7150 : see if getpgrp exists
7151 set getpgrp d_getpgrp
7152 eval $inlibc
7153
7154 case "$d_getpgrp" in
7155 "$define")
7156         echo " "
7157         echo "Checking to see which flavor of getpgrp is in use..."
7158         $cat >set.c <<EOP
7159 #$i_unistd I_UNISTD
7160 #include <sys/types.h>
7161 #ifdef I_UNISTD
7162 #  include <unistd.h>
7163 #endif
7164 int main()
7165 {
7166         if (getuid() == 0) {
7167                 printf("(I see you are running Configure as super-user...)\n");
7168                 setuid(1);
7169         }
7170 #ifdef TRY_BSD_PGRP
7171         if (getpgrp(1) == 0)
7172                 exit(0);
7173 #else
7174         if (getpgrp() > 0)
7175                 exit(0);
7176 #endif
7177         exit(1);
7178 }
7179 EOP
7180         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7181                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7182                 val="$define"
7183         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7184                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7185                 val="$undef"
7186         else
7187                 echo "I can't seem to compile and run the test program."
7188                 if ./usg; then
7189                         xxx="a USG one, i.e. you use getpgrp()."
7190                 else
7191                         # SVR4 systems can appear rather BSD-ish.
7192                         case "$i_unistd" in
7193                         $undef)
7194                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7195                                 val="$define"
7196                                 ;;
7197                         $define)
7198                                 xxx="probably a USG one, i.e. you use getpgrp()."
7199                                 val="$undef"
7200                                 ;;
7201                         esac
7202                 fi
7203                 echo "Assuming your getpgrp is $xxx" >&4
7204         fi
7205         ;;
7206 *) val="$undef";;
7207 esac
7208 set d_bsdgetpgrp
7209 eval $setvar
7210 $rm -f set set.c
7211
7212 : see if setpgrp exists
7213 set setpgrp d_setpgrp
7214 eval $inlibc
7215
7216 case "$d_setpgrp" in
7217 "$define")
7218         echo " "
7219         echo "Checking to see which flavor of setpgrp is in use..."
7220         $cat >set.c <<EOP
7221 #$i_unistd I_UNISTD
7222 #include <sys/types.h>
7223 #ifdef I_UNISTD
7224 #  include <unistd.h>
7225 #endif
7226 int main()
7227 {
7228         if (getuid() == 0) {
7229                 printf("(I see you are running Configure as super-user...)\n");
7230                 setuid(1);
7231         }
7232 #ifdef TRY_BSD_PGRP
7233         if (-1 == setpgrp(1, 1))
7234                 exit(0);
7235 #else
7236         if (setpgrp() != -1)
7237                 exit(0);
7238 #endif
7239         exit(1);
7240 }
7241 EOP
7242         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7243                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7244                 val="$define"
7245         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7246                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7247                 val="$undef"
7248         else
7249                 echo "(I can't seem to compile and run the test program.)"
7250                 if ./usg; then
7251                         xxx="a USG one, i.e. you use setpgrp()."
7252                 else
7253                         # SVR4 systems can appear rather BSD-ish.
7254                         case "$i_unistd" in
7255                         $undef)
7256                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7257                                 val="$define"
7258                                 ;;
7259                         $define)
7260                                 xxx="probably a USG one, i.e. you use setpgrp()."
7261                                 val="$undef"
7262                                 ;;
7263                         esac
7264                 fi
7265                 echo "Assuming your setpgrp is $xxx" >&4
7266         fi
7267         ;;
7268 *) val="$undef";;
7269 esac
7270 set d_bsdsetpgrp
7271 eval $setvar
7272 $rm -f set set.c
7273 : see if bzero exists
7274 set bzero d_bzero
7275 eval $inlibc
7276
7277 : see if signal is declared as pointer to function returning int or void
7278 echo " "
7279 xxx=`./findhdr signal.h`
7280 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7281 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7282         echo "You have int (*signal())() instead of void." >&4
7283         val="$undef"
7284 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7285         echo "You have void (*signal())()." >&4
7286         val="$define"
7287 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7288         echo "You have int (*signal())() instead of void." >&4
7289         val="$undef"
7290 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7291         echo "You have void (*signal())()." >&4
7292         val="$define"
7293 else
7294         case "$d_voidsig" in
7295         '')
7296         echo "I can't determine whether signal handler returns void or int..." >&4
7297                 dflt=void
7298                 rp="What type does your signal handler return?"
7299                 . ./myread
7300                 case "$ans" in
7301                 v*) val="$define";;
7302                 *) val="$undef";;
7303                 esac;;
7304         "$define")
7305                 echo "As you already told me, signal handler returns void." >&4
7306                 val="$define"
7307                 ;;
7308         *)      echo "As you already told me, signal handler returns int." >&4
7309                 val="$undef"
7310                 ;;
7311         esac
7312 fi
7313 set d_voidsig
7314 eval $setvar
7315 case "$d_voidsig" in
7316 "$define") signal_t="void";;
7317 *) signal_t="int";;
7318 esac
7319 $rm -f $$.tmp
7320
7321 : check for ability to cast large floats to 32-bit ints.
7322 echo " "
7323 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7324 if $test "$intsize" -ge 4; then
7325         xxx=int
7326 else
7327         xxx=long
7328 fi
7329 $cat >try.c <<EOCP
7330 #include <stdio.h>
7331 #include <sys/types.h>
7332 #include <signal.h>
7333 $signal_t blech(s) int s; { exit(3); }
7334 int main()
7335 {
7336         $xxx i32;
7337         double f, g;
7338         int result = 0;
7339         char str[16];
7340         signal(SIGFPE, blech);
7341
7342         /* Don't let compiler optimize the test away.  Store the number 
7343            in a writable string for gcc to pass to sscanf under HP/UX.
7344         */
7345         sprintf(str, "2147483647");
7346         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7347         g = 10 * f;
7348         i32  = ($xxx) g;
7349
7350         /* x86 processors will probably give 0x8000 0000, which is a
7351        sign change.  We don't want that.  We want to mimic SPARC
7352            behavior here, which is to preserve the sign and give
7353            back 0x7fff ffff.
7354         */
7355         if (i32 != ($xxx) f)
7356                 result |= 1;
7357         exit(result);
7358 }
7359 EOCP
7360 set try
7361 if eval $compile_ok; then
7362         ./try
7363         yyy=$?
7364 else
7365         echo "(I can't seem to compile the test program--assuming it can't)"
7366         yyy=1
7367 fi
7368 case "$yyy" in
7369 0)      val="$define"
7370         echo "Yup, it can."
7371         ;;
7372 *)      val="$undef"
7373         echo "Nope, it can't."
7374         ;;
7375 esac
7376 set d_casti32
7377 eval $setvar
7378 $rm -f try try.*
7379
7380 : check for ability to cast negative floats to unsigned
7381 echo " "
7382 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7383 $cat >try.c <<EOCP
7384 #include <stdio.h>
7385 #include <sys/types.h>
7386 #include <signal.h>
7387 $signal_t blech(s) int s; { exit(7); }
7388 $signal_t blech_in_list(s) int s; { exit(4); }
7389 unsigned long dummy_long(p) unsigned long p; { return p; }
7390 unsigned int dummy_int(p) unsigned int p; { return p; }
7391 unsigned short dummy_short(p) unsigned short p; { return p; }
7392 int main()
7393 {
7394         double f;
7395         unsigned long along;
7396         unsigned int aint;
7397         unsigned short ashort;
7398         int result = 0;
7399         char str[16];
7400         
7401         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7402            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7403            optimized the whole file away
7404         */
7405         /* Store the number in a writable string for gcc to pass to 
7406            sscanf under HP/UX.
7407         */
7408         sprintf(str, "-123");
7409         sscanf(str, "%lf", &f);  /* f = -123.; */
7410
7411         signal(SIGFPE, blech);
7412         along = (unsigned long)f;
7413         aint = (unsigned int)f;
7414         ashort = (unsigned short)f;
7415         if (along != (unsigned long)-123)
7416                 result |= 1;
7417         if (aint != (unsigned int)-123)
7418                 result |= 1;
7419         if (ashort != (unsigned short)-123)
7420                 result |= 1;
7421         sprintf(str, "1073741824.");
7422         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7423         f = f + f;
7424         along = 0;
7425         along = (unsigned long)f;
7426         if (along != 0x80000000)
7427                 result |= 2;
7428         f -= 1.;
7429         along = 0;
7430         along = (unsigned long)f;
7431         if (along != 0x7fffffff)
7432                 result |= 1;
7433         f += 2.;
7434         along = 0;
7435         along = (unsigned long)f;
7436         if (along != 0x80000001)
7437                 result |= 2;
7438         if (result)
7439                 exit(result);
7440         signal(SIGFPE, blech_in_list);
7441         sprintf(str, "123.");
7442         sscanf(str, "%lf", &f);  /* f = 123.; */
7443         along = dummy_long((unsigned long)f);
7444         aint = dummy_int((unsigned int)f);
7445         ashort = dummy_short((unsigned short)f);
7446         if (along != (unsigned long)123)
7447                 result |= 4;
7448         if (aint != (unsigned int)123)
7449                 result |= 4;
7450         if (ashort != (unsigned short)123)
7451                 result |= 4;
7452         exit(result);
7453
7454 }
7455 EOCP
7456 set try
7457 if eval $compile_ok; then
7458         ./try
7459         castflags=$?
7460 else
7461         echo "(I can't seem to compile the test program--assuming it can't)"
7462         castflags=7
7463 fi
7464 case "$castflags" in
7465 0)      val="$define"
7466         echo "Yup, it can."
7467         ;;
7468 *)      val="$undef"
7469         echo "Nope, it can't."
7470         ;;
7471 esac
7472 set d_castneg
7473 eval $setvar
7474 $rm -f try.*
7475
7476 : see if vprintf exists
7477 echo " "
7478 if set vprintf val -f d_vprintf; eval $csym; $val; then
7479         echo 'vprintf() found.' >&4
7480         val="$define"
7481         $cat >vprintf.c <<'EOF'
7482 #include <varargs.h>
7483
7484 int main() { xxx("foo"); }
7485
7486 xxx(va_alist)
7487 va_dcl
7488 {
7489         va_list args;
7490         char buf[10];
7491
7492         va_start(args);
7493         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7494 }
7495 EOF
7496         set vprintf
7497         if eval $compile && ./vprintf; then
7498                 echo "Your vsprintf() returns (int)." >&4
7499                 val2="$undef"
7500         else
7501                 echo "Your vsprintf() returns (char*)." >&4
7502                 val2="$define"
7503         fi
7504 else
7505         echo 'vprintf() NOT found.' >&4
7506                 val="$undef"
7507                 val2="$undef"
7508 fi
7509 set d_vprintf
7510 eval $setvar
7511 val=$val2
7512 set d_charvspr
7513 eval $setvar
7514
7515 : see if chown exists
7516 set chown d_chown
7517 eval $inlibc
7518
7519 : see if chroot exists
7520 set chroot d_chroot
7521 eval $inlibc
7522
7523 : see if chsize exists
7524 set chsize d_chsize
7525 eval $inlibc
7526
7527 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7528 while $test $# -ge 2; do
7529         case "$1" in
7530         $define) echo "#include <$2>";;
7531         esac ;
7532     shift 2;
7533 done > try.c;
7534 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
7535 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7536         val="$define";
7537 else
7538         val="$undef";
7539 fi;
7540 set $varname;
7541 eval $setvar;
7542 $rm -f try.c try.o'
7543
7544 : see if this is a sys/uio.h system
7545 set sys/uio.h i_sysuio
7546 eval $inhdr
7547
7548 echo "Checking to see if your system supports struct iovec..." >&4
7549 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7550 eval $hasfield
7551 case "$d_iovec_s" in
7552 "$define")      echo "Yup, it does." >&4
7553                 ;;
7554 *)              echo "Nope, it doesn't." >&4
7555                 ;;
7556 esac
7557
7558 socketlib=''
7559 sockethdr=''
7560 : see whether socket exists
7561 echo " "
7562 $echo $n "Hmm... $c" >&4
7563 if set socket val -f d_socket; eval $csym; $val; then
7564         echo "Looks like you have Berkeley networking support." >&4
7565         d_socket="$define"
7566         if set setsockopt val -f; eval $csym; $val; then
7567                 d_oldsock="$undef"
7568         else
7569                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7570                 d_oldsock="$define"
7571         fi
7572 else
7573         if $contains socklib libc.list >/dev/null 2>&1; then
7574                 echo "Looks like you have Berkeley networking support." >&4
7575                 d_socket="$define"
7576                 : we will have to assume that it supports the 4.2 BSD interface
7577                 d_oldsock="$undef"
7578         else
7579                 echo "You don't have Berkeley networking in libc$_a..." >&4
7580                 if test "X$d_socket" = "X$define"; then
7581                    echo "...but you seem to believe that you have sockets." >&4
7582                 else
7583                         for net in net socket
7584                         do
7585                                 if test -f /usr/lib/lib$net$_a; then
7586                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7587                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7588                                         if $contains socket libc.list >/dev/null 2>&1; then
7589                                                 d_socket="$define"
7590                                                 socketlib="-l$net"
7591                                                 case "$net" in
7592                                                 net)
7593                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7594                                                         sockethdr="-I/usr/netinclude"
7595                                                         ;;
7596                                                 esac
7597                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7598                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7599                                                         d_oldsock="$undef"
7600                                                 else
7601                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7602                                                         d_oldsock="$define"
7603                                                 fi
7604                                                 break
7605                                         fi
7606                                 fi
7607                         done
7608                         if test "X$d_socket" != "X$define"; then
7609                            echo "or anywhere else I see." >&4
7610                            d_socket="$undef"
7611                            d_oldsock="$undef"
7612                         fi
7613                 fi
7614         fi
7615 fi
7616
7617 : see if socketpair exists
7618 set socketpair d_sockpair
7619 eval $inlibc
7620
7621
7622 echo " "
7623 echo "Checking the availability of certain socket constants..." >& 4
7624 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7625         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7626         $cat >try.c <<EOF
7627 #include <sys/types.h>
7628 #include <sys/socket.h>
7629 int main() {
7630     int i = $ENUM;
7631 }
7632 EOF
7633         val="$undef"
7634         set try; if eval $compile; then
7635                 val="$define"
7636         fi
7637         set d_${enum}; eval $setvar
7638         $rm -f try.c try
7639 done
7640
7641 set sendmsg d_sendmsg
7642 eval $inlibc
7643
7644 set recvmsg d_recvmsg
7645 eval $inlibc
7646
7647 echo " "
7648 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7649 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7650 eval $hasfield
7651 case "$d_msghdr_s" in
7652 "$define")      echo "Yup, it does." >&4
7653                 ;;
7654 *)              echo "Nope, it doesn't." >&4
7655                 ;;
7656 esac
7657
7658 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7659 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7660 eval $hasfield
7661 case "$d_cmsghdr_s" in
7662 "$define")      echo "Yup, it does." >&4
7663                 ;;
7664 *)              echo "Nope, it doesn't." >&4
7665                 ;;
7666 esac
7667
7668 : check for const keyword
7669 echo " "
7670 echo 'Checking to see if your C compiler knows about "const"...' >&4
7671 $cat >const.c <<'EOCP'
7672 typedef struct spug { int drokk; } spug;
7673 int main()
7674 {
7675         const char *foo;
7676         const spug y;
7677 }
7678 EOCP
7679 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7680         val="$define"
7681         echo "Yup, it does."
7682 else
7683         val="$undef"
7684         echo "Nope, it doesn't."
7685 fi
7686 set d_const
7687 eval $setvar
7688
7689 : see if crypt exists
7690 echo " "
7691 if set crypt val -f d_crypt; eval $csym; $val; then
7692         echo 'crypt() found.' >&4
7693         val="$define"
7694         cryptlib=''
7695 else
7696         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7697         if $test -z "$cryptlib"; then
7698                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7699         else
7700                 cryptlib=-lcrypt
7701         fi
7702         if $test -z "$cryptlib"; then
7703                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7704         else
7705                 cryptlib=-lcrypt
7706         fi
7707         if $test -z "$cryptlib"; then
7708                 cryptlib=`./loc libcrypt$_a "" $libpth`
7709         else
7710                 cryptlib=-lcrypt
7711         fi
7712         if $test -z "$cryptlib"; then
7713                 echo 'crypt() NOT found.' >&4
7714                 val="$undef"
7715         else
7716                 val="$define"
7717         fi
7718 fi
7719 set d_crypt
7720 eval $setvar
7721
7722 : get csh whereabouts
7723 case "$csh" in
7724 'csh') val="$undef" ;;
7725 *) val="$define" ;;
7726 esac
7727 set d_csh
7728 eval $setvar
7729 : Respect a hint or command line value for full_csh.
7730 case "$full_csh" in
7731 '') full_csh=$csh ;;
7732 esac
7733
7734 : see if cuserid exists
7735 set cuserid d_cuserid
7736 eval $inlibc
7737
7738 : see if this is a limits.h system
7739 set limits.h i_limits
7740 eval $inhdr
7741
7742 : see if this is a float.h system
7743 set float.h i_float
7744 eval $inhdr
7745
7746 : See if number of significant digits in a double precision number is known
7747 echo " "
7748 $cat >dbl_dig.c <<EOM
7749 #$i_limits I_LIMITS
7750 #$i_float I_FLOAT
7751 #ifdef I_LIMITS
7752 #include <limits.h>
7753 #endif
7754 #ifdef I_FLOAT
7755 #include <float.h>
7756 #endif
7757 #ifdef DBL_DIG
7758 printf("Contains DBL_DIG");
7759 #endif
7760 EOM
7761 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7762 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7763         echo "DBL_DIG found." >&4
7764         val="$define"
7765 else
7766         echo "DBL_DIG NOT found." >&4
7767         val="$undef"
7768 fi
7769 $rm -f dbl_dig.?
7770 set d_dbl_dig
7771 eval $setvar
7772
7773
7774 if $test X"$use64bits" = X"$define"; then
7775         : see if dbminit64 exists
7776         set dbminit64 d_dbminit64
7777         eval $inlibc
7778
7779         : see if dbmclose64 exists
7780         set dbmclose64 d_dbmclose64
7781         eval $inlibc
7782
7783         : see if fetch64 exists
7784         set fetch64 d_fetch64
7785         eval $inlibc
7786
7787         : see if store64 exists
7788         set store64 d_store64
7789         eval $inlibc
7790
7791         : see if delete64 exists
7792         set delete64 d_delete64
7793         eval $inlibc
7794
7795         : see if firstkey64 exists
7796         set firstkey64 d_firstkey64
7797         eval $inlibc
7798
7799         : see if nextkey64 exists
7800         set nextkey64 d_nextkey64
7801         eval $inlibc
7802 else
7803         val="$undef"
7804         for xxx in d_dbminit64 d_dbmclose64 d_fetch64 d_store64 d_delete64 d_firstkey64 d_nextkey64
7805         do
7806                 set $xxx
7807                 eval $setvar
7808         done
7809 fi
7810
7811 : see if difftime exists
7812 set difftime d_difftime
7813 eval $inlibc
7814
7815 : see if sys/stat.h is available
7816 set sys/stat.h i_sysstat
7817 eval $inhdr
7818
7819 : see if this is a dirent system
7820 echo " "
7821 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7822         val="$define"
7823         echo "<dirent.h> found." >&4
7824 else
7825         val="$undef"
7826         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7827                 echo "<sys/dir.h> found." >&4
7828                 echo " "
7829         else
7830                 xinc=`./findhdr sys/ndir.h`
7831         fi
7832         echo "<dirent.h> NOT found." >&4
7833 fi
7834 set i_dirent
7835 eval $setvar
7836
7837 : Look for type of directory structure.
7838 echo " "
7839 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7840
7841 case "$direntrytype" in
7842 ''|' ')
7843         case "$i_dirent" in
7844         $define) guess1='struct dirent' ;;
7845         *) guess1='struct direct'  ;;
7846         esac
7847         ;;
7848 *)      guess1="$direntrytype"
7849         ;;
7850 esac
7851
7852 case "$guess1" in
7853 'struct dirent') guess2='struct direct' ;;
7854 *) guess2='struct dirent' ;;
7855 esac
7856                 
7857 if $contains "$guess1" try.c >/dev/null 2>&1; then
7858         direntrytype="$guess1"
7859         echo "Your directory entries are $direntrytype." >&4
7860 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7861         direntrytype="$guess2"
7862         echo "Your directory entries seem to be $direntrytype." >&4
7863 else
7864         echo "I don't recognize your system's directory entries." >&4
7865         rp="What type is used for directory entries on this system?"
7866         dflt="$guess1"
7867         . ./myread
7868         direntrytype="$ans"
7869 fi
7870 $rm -f try.c
7871
7872
7873 : see if the directory entry stores field length
7874 echo " "
7875 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7876 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7877         echo "Good, your directory entry keeps length information in d_namlen." >&4
7878         val="$define"
7879 else
7880         echo "Your directory entry does not know about the d_namlen field." >&4
7881         val="$undef"
7882 fi
7883 set d_dirnamlen
7884 eval $setvar
7885 $rm -f try.c
7886
7887
7888 if $test X"$use64bits" = X"$define"; then
7889         : see if fstat64 exists
7890         set fstat64 d_fstat64
7891         eval $inlibc
7892
7893         : see if ftruncate64 exists
7894         set ftruncate64 d_ftruncate64
7895         eval $inlibc
7896
7897         : see if lockf64 exists
7898         set lockf64 d_lockf64
7899         eval $inlibc
7900
7901         : see if llseek exists
7902         set llseek d_llseek
7903         eval $inlibc
7904
7905         : see if lseek64 exists
7906         set lseek64 d_lseek64
7907         eval $inlibc
7908
7909         : see if lstat64 exists
7910         set lstat64 d_lstat64
7911         eval $inlibc
7912
7913         : see if open64 exists
7914         set open64 d_open64
7915         eval $inlibc
7916
7917         : see if opendir64 exists
7918         set opendir64 d_opendir64
7919         eval $inlibc
7920
7921         : see if readdir64 exists
7922         set readdir64 d_readdir64
7923         eval $inlibc
7924
7925         : see if seekdir64 exists
7926         set seekdir64 d_seekdir64
7927         eval $inlibc
7928
7929         : see if stat64 exists
7930         set stat64 d_stat64
7931         eval $inlibc
7932
7933         : see if telldir64 exists
7934         set telldir64 d_telldir64
7935         eval $inlibc
7936
7937         : see if truncate64 exists
7938         set truncate64 d_truncate64
7939         eval $inlibc
7940
7941         : check for off64_t
7942         echo " "
7943         echo $n "Checking to see if your system supports off64_t...$c" >&4
7944         $cat >try.c <<EOCP
7945 #include <sys/types.h>
7946 #include <unistd.h>
7947 off64_t foo() { off64_t x; x = 7; return x; }'
7948 EOCP
7949         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7950                 val="$define"
7951                 echo " Yup, it does." >&4
7952         else
7953                 val="$undef"
7954                 echo " Nope, it doesn't." >&4
7955         fi
7956         $rm -f try.*
7957         set d_off64_t
7958         eval $setvar
7959
7960         : check for offset_t
7961         echo " "
7962         echo $n "Checking to see if your system supports offset_t...$c" >&4
7963         $cat >try.c <<EOCP
7964 #include <sys/types.h>
7965 #include <unistd.h>
7966 offset_t foo() { offset_t x; x = 7; return x; }'
7967 EOCP
7968         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7969                 val="$define"
7970                 echo " Yup, it does." >&4
7971         else
7972                 val="$undef"
7973                 echo " Nope, it doesn't." >&4
7974         fi
7975         $rm -f try.*
7976         set d_offset_t
7977         eval $setvar
7978
7979         : check for ino64_t
7980         echo " "
7981         echo $n "Checking to see if your system supports ino64_t...$c" >&4
7982         val="$undef"
7983         case "$i_sysstat" in
7984         "$define" )
7985                 $cat >try.c <<EOCP
7986 #include <sys/types.h>
7987 #include <sys/stat.h>
7988 ino64_t foo() { ino64_t x; x = 7; return x; }'
7989 EOCP
7990                 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7991                         val="$define"
7992                 fi
7993                 $rm -f try.*
7994                 ;;
7995         esac
7996         if $test "X$val" = X"$define"; then
7997                 echo " Yup, it does." >&4
7998         else
7999                 echo " Nope, it doesn't." >&4
8000         fi
8001         set d_ino64_t
8002         eval $setvar
8003
8004         : check for struct flock64
8005         echo " "
8006         echo "Checking to see if your system supports struct flock64..." >&4
8007         if $h_fcntl; then
8008                 set d_flock64_s flock64 l_len define fcntl.h
8009                 eval $hasfield
8010         else
8011                 val="$undef"
8012                 set d_flock64_s
8013                 eval $setvar
8014         fi
8015         case "$d_flock64_s" in
8016         "$define")      echo "Yup, it does." >&4
8017                         ;;
8018         *)              echo "Nope, it doesn't." >&4
8019                         ;;
8020         esac
8021
8022         : check for struct dirent64
8023         echo " "
8024         echo "Checking to see if your system supports struct dirent64..." >&4
8025         set d_dirent64_s dirent64 d_off $i_dirent dirent.h
8026         eval $hasfield
8027         case "$d_dirent64_s" in
8028         "$define")      echo "Yup, it does." >&4
8029                         ;;
8030         *)              echo "Nope, it doesn't." >&4
8031                         ;;
8032         esac
8033
8034 else
8035         val="$undef"
8036         for xxx in d_fstat64 d_ftruncate64 d_lockf64 d_lseek64 d_lstat64 d_open64 d_opendir64 d_readdir64 d_seekdir64 d_stat64 d_telldir64 d_truncate64 d_off64_t d_offset_t d_ino64_t d_flock64_s d_dirent64_s
8037         do
8038                 set $xxx
8039                 eval $setvar
8040         done
8041 fi
8042
8043 : see if dlerror exists
8044 xxx_runnm="$runnm"
8045 runnm=false
8046 set dlerror d_dlerror
8047 eval $inlibc
8048 runnm="$xxx_runnm"
8049
8050 : see if dlfcn is available
8051 set dlfcn.h i_dlfcn
8052 eval $inhdr
8053
8054 case "$usedl" in
8055 $define|y|true)
8056         $cat << EOM
8057
8058 On a few systems, the dynamically loaded modules that perl generates and uses
8059 will need a different extension than shared libs. The default will probably
8060 be appropriate.
8061
8062 EOM
8063         case "$dlext" in
8064         '')     dflt="$so" ;;
8065         *)      dflt="$dlext" ;;
8066         esac
8067         rp='What is the extension of dynamically loaded modules'
8068         . ./myread
8069         dlext="$ans"
8070         ;;
8071 *)
8072         dlext="none"
8073         ;;
8074 esac
8075
8076 : Check if dlsym need a leading underscore
8077 echo " "
8078 val="$undef"
8079
8080 case "$dlsrc" in
8081 dl_dlopen.xs)
8082         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8083         $cat >dyna.c <<'EOM'
8084 fred () { }
8085 EOM
8086
8087 $cat >fred.c<<EOM
8088
8089 #include <stdio.h>
8090 #$i_dlfcn I_DLFCN
8091 #ifdef I_DLFCN
8092 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8093 #else
8094 #include <sys/types.h>
8095 #include <nlist.h>
8096 #include <link.h>
8097 #endif
8098
8099 extern int fred() ;
8100
8101 int main()
8102 {
8103     void * handle ;
8104     void * symbol ;
8105 #ifndef RTLD_LAZY
8106     int mode = 1 ;
8107 #else
8108     int mode = RTLD_LAZY ;
8109 #endif
8110     handle = dlopen("./dyna.$dlext", mode) ;
8111     if (handle == NULL) {
8112         printf ("1\n") ;
8113         fflush (stdout) ;
8114         exit(0);
8115     }
8116     symbol = dlsym(handle, "fred") ;
8117     if (symbol == NULL) {
8118         /* try putting a leading underscore */
8119         symbol = dlsym(handle, "_fred") ;
8120         if (symbol == NULL) {
8121             printf ("2\n") ;
8122             fflush (stdout) ;
8123             exit(0);
8124         }
8125         printf ("3\n") ;
8126     }
8127     else
8128         printf ("4\n") ;
8129     fflush (stdout) ;
8130     exit(0);
8131 }
8132 EOM
8133         : Call the object file tmp-dyna.o in case dlext=o.
8134         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8135                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8136                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8137                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8138                 xxx=`./fred`
8139                 case $xxx in
8140                 1)      echo "Test program failed using dlopen." >&4
8141                         echo "Perhaps you should not use dynamic loading." >&4;;
8142                 2)      echo "Test program failed using dlsym." >&4
8143                         echo "Perhaps you should not use dynamic loading." >&4;;
8144                 3)      echo "dlsym needs a leading underscore" >&4
8145                         val="$define" ;;
8146                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8147                 esac
8148         else
8149                 echo "I can't compile and run the test program." >&4
8150         fi
8151         ;;
8152 esac
8153                 
8154 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8155
8156 set d_dlsymun
8157 eval $setvar
8158
8159 hasproto='varname=$1; func=$2; shift; shift;
8160 while $test $# -ge 2; do
8161         case "$1" in
8162         $define) echo "#include <$2>";;
8163         esac ;
8164     shift 2;
8165 done > try.c;
8166 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8167 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8168         echo "$func() prototype found.";
8169         val="$define";
8170 else
8171         echo "$func() prototype NOT found.";
8172         val="$undef";
8173 fi;
8174 set $varname;
8175 eval $setvar;
8176 $rm -f try.c tryout.c'
8177
8178 : see if prototype for drand48 is available
8179 echo " "
8180 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8181 eval $hasproto
8182
8183 : see if dup2 exists
8184 set dup2 d_dup2
8185 eval $inlibc
8186
8187 : see if eaccess exists
8188 set eaccess d_eaccess
8189 eval $inlibc
8190
8191 : see if endgrent exists
8192 set endgrent d_endgrent
8193 eval $inlibc
8194
8195 : see if endhostent exists
8196 set endhostent d_endhent
8197 eval $inlibc
8198
8199 : see if endnetent exists
8200 set endnetent d_endnent
8201 eval $inlibc
8202
8203 : see if endprotoent exists
8204 set endprotoent d_endpent
8205 eval $inlibc
8206
8207 : see if endpwent exists
8208 set endpwent d_endpwent
8209 eval $inlibc
8210
8211 : see if endservent exists
8212 set endservent d_endsent
8213 eval $inlibc
8214
8215 : see if endspent exists
8216 set endspent d_endspent
8217 eval $inlibc
8218
8219 : Locate the flags for 'open()'
8220 echo " "
8221 $cat >open3.c <<'EOCP'
8222 #include <sys/types.h>
8223 #ifdef I_FCNTL
8224 #include <fcntl.h>
8225 #endif
8226 #ifdef I_SYS_FILE
8227 #include <sys/file.h>
8228 #endif
8229 int main() {
8230         if(O_RDONLY);
8231 #ifdef O_TRUNC
8232         exit(0);
8233 #else
8234         exit(1);
8235 #endif
8236 }
8237 EOCP
8238 : check sys/file.h first to get FREAD on Sun
8239 if $test `./findhdr sys/file.h` && \
8240                 set open3 -DI_SYS_FILE && eval $compile; then
8241         h_sysfile=true;
8242         echo "<sys/file.h> defines the O_* constants..." >&4
8243         if ./open3; then
8244                 echo "and you have the 3 argument form of open()." >&4
8245                 val="$define"
8246         else
8247                 echo "but not the 3 argument form of open().  Oh, well." >&4
8248                 val="$undef"
8249         fi
8250 elif $test `./findhdr fcntl.h` && \
8251                 set open3 -DI_FCNTL && eval $compile; then
8252         h_fcntl=true;
8253         echo "<fcntl.h> defines the O_* constants..." >&4
8254         if ./open3; then
8255                 echo "and you have the 3 argument form of open()." >&4
8256                 val="$define"
8257         else
8258                 echo "but not the 3 argument form of open().  Oh, well." >&4
8259                 val="$undef"
8260         fi
8261 else
8262         val="$undef"
8263         echo "I can't find the O_* constant definitions!  You got problems." >&4
8264 fi
8265 set d_open3
8266 eval $setvar
8267 $rm -f open3*
8268
8269 : check for non-blocking I/O stuff
8270 case "$h_sysfile" in
8271 true) echo "#include <sys/file.h>" > head.c;;
8272 *)
8273         case "$h_fcntl" in
8274         true) echo "#include <fcntl.h>" > head.c;;
8275         *) echo "#include <sys/fcntl.h>" > head.c;;
8276         esac
8277         ;;
8278 esac
8279 echo " "
8280 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8281 case "$o_nonblock" in
8282 '')
8283         $cat head.c > try.c
8284         $cat >>try.c <<'EOCP'
8285 int main() {
8286 #ifdef O_NONBLOCK
8287         printf("O_NONBLOCK\n");
8288         exit(0);
8289 #endif
8290 #ifdef O_NDELAY
8291         printf("O_NDELAY\n");
8292         exit(0);
8293 #endif
8294 #ifdef FNDELAY
8295         printf("FNDELAY\n");
8296         exit(0);
8297 #endif
8298         exit(0);
8299 }
8300 EOCP
8301         set try
8302         if eval $compile_ok; then
8303                 o_nonblock=`./try`
8304                 case "$o_nonblock" in
8305                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8306                 *) echo "Seems like we can use $o_nonblock.";;
8307                 esac
8308         else
8309                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8310         fi
8311         ;;
8312 *) echo "Using $hint value $o_nonblock.";;
8313 esac
8314 $rm -f try try.* .out core
8315
8316 echo " "
8317 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8318 case "$eagain" in
8319 '')
8320         $cat head.c > try.c
8321         $cat >>try.c <<EOCP
8322 #include <errno.h>
8323 #include <sys/types.h>
8324 #include <signal.h>
8325 #define MY_O_NONBLOCK $o_nonblock
8326 #ifndef errno  /* XXX need better Configure test */
8327 extern int errno;
8328 #endif
8329 $signal_t blech(x) int x; { exit(3); }
8330 EOCP
8331         $cat >> try.c <<'EOCP'
8332 int main()
8333 {
8334         int pd[2];
8335         int pu[2];
8336         char buf[1];
8337         char string[100];
8338
8339         pipe(pd);       /* Down: child -> parent */
8340         pipe(pu);       /* Up: parent -> child */
8341         if (0 != fork()) {
8342                 int ret;
8343                 close(pd[1]);   /* Parent reads from pd[0] */
8344                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8345                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8346                         exit(1);
8347                 signal(SIGALRM, blech);
8348                 alarm(5);
8349                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8350                         exit(2);
8351                 sprintf(string, "%d\n", ret);
8352                 write(2, string, strlen(string));
8353                 alarm(0);
8354 #ifdef EAGAIN
8355                 if (errno == EAGAIN) {
8356                         printf("EAGAIN\n");
8357                         goto ok;
8358                 }
8359 #endif
8360 #ifdef EWOULDBLOCK
8361                 if (errno == EWOULDBLOCK)
8362                         printf("EWOULDBLOCK\n");
8363 #endif
8364         ok:
8365                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8366                 sleep(2);                               /* Give it time to close our pipe */
8367                 alarm(5);
8368                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8369                 alarm(0);
8370                 sprintf(string, "%d\n", ret);
8371                 write(3, string, strlen(string));
8372                 exit(0);
8373         }
8374
8375         close(pd[0]);                   /* We write to pd[1] */
8376         close(pu[1]);                   /* We read from pu[0] */
8377         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8378         close(pd[1]);                   /* Pipe pd is now fully closed! */
8379         exit(0);                                /* Bye bye, thank you for playing! */
8380 }
8381 EOCP
8382         set try
8383         if eval $compile_ok; then
8384                 echo "$startsh" >mtry
8385                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8386                 chmod +x mtry
8387                 ./mtry >/dev/null 2>&1
8388                 case $? in
8389                 0) eagain=`$cat try.out`;;
8390                 1) echo "Could not perform non-blocking setting!";;
8391                 2) echo "I did a successful read() for something that was not there!";;
8392                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8393                 *) echo "Something terribly wrong happened during testing.";;
8394                 esac
8395                 rd_nodata=`$cat try.ret`
8396                 echo "A read() system call with no data present returns $rd_nodata."
8397                 case "$rd_nodata" in
8398                 0|-1) ;;
8399                 *)
8400                         echo "(That's peculiar, fixing that to be -1.)"
8401                         rd_nodata=-1
8402                         ;;
8403                 esac
8404                 case "$eagain" in
8405                 '')
8406                         echo "Forcing errno EAGAIN on read() with no data available."
8407                         eagain=EAGAIN
8408                         ;;
8409                 *)
8410                         echo "Your read() sets errno to $eagain when no data is available."
8411                         ;;
8412                 esac
8413                 status=`$cat try.err`
8414                 case "$status" in
8415                 0) echo "And it correctly returns 0 to signal EOF.";;
8416                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8417                 *) echo "However, your read() returns '$status' on EOF??";;
8418                 esac
8419                 val="$define"
8420                 if test "$status" = "$rd_nodata"; then
8421                         echo "WARNING: you can't distinguish between EOF and no data!"
8422                         val="$undef"
8423                 fi
8424         else
8425                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8426                 eagain=EAGAIN
8427         fi
8428         set d_eofnblk
8429         eval $setvar
8430         ;;
8431 *)
8432         echo "Using $hint value $eagain."
8433         echo "Your read() returns $rd_nodata when no data is present."
8434         case "$d_eofnblk" in
8435         "$define") echo "And you can see EOF because read() returns 0.";;
8436         "$undef") echo "But you can't see EOF status from read() returned value.";;
8437         *)
8438                 echo "(Assuming you can't see EOF status from read anyway.)"
8439                 d_eofnblk=$undef
8440                 ;;
8441         esac
8442         ;;
8443 esac
8444 $rm -f try try.* .out core head.c mtry
8445
8446 : see if fchmod exists
8447 set fchmod d_fchmod
8448 eval $inlibc
8449
8450 : see if fchown exists
8451 set fchown d_fchown
8452 eval $inlibc
8453
8454 : see if this is an fcntl system
8455 set fcntl d_fcntl
8456 eval $inlibc
8457
8458 : see if sys/select.h has to be included
8459 set sys/select.h i_sysselct
8460 eval $inhdr
8461
8462 : see if we should include time.h, sys/time.h, or both
8463 echo " "
8464 if test "X$timeincl" = X; then
8465         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8466         $echo $n "I'm now running the test program...$c"
8467         $cat >try.c <<'EOCP'
8468 #include <sys/types.h>
8469 #ifdef I_TIME
8470 #include <time.h>
8471 #endif
8472 #ifdef I_SYSTIME
8473 #ifdef SYSTIMEKERNEL
8474 #define KERNEL
8475 #endif
8476 #include <sys/time.h>
8477 #endif
8478 #ifdef I_SYSSELECT
8479 #include <sys/select.h>
8480 #endif
8481 int main()
8482 {
8483         struct tm foo;
8484 #ifdef S_TIMEVAL
8485         struct timeval bar;
8486 #endif
8487 #ifdef S_TIMEZONE
8488         struct timezone tzp;
8489 #endif
8490         if (foo.tm_sec == foo.tm_sec)
8491                 exit(0);
8492 #ifdef S_TIMEVAL
8493         if (bar.tv_sec == bar.tv_sec)
8494                 exit(0);
8495 #endif
8496         exit(1);
8497 }
8498 EOCP
8499         flags=''
8500         for s_timezone in '-DS_TIMEZONE' ''; do
8501         sysselect=''
8502         for s_timeval in '-DS_TIMEVAL' ''; do
8503         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8504         for i_time in '' '-DI_TIME'; do
8505         for i_systime in '-DI_SYSTIME' ''; do
8506                 case "$flags" in
8507                 '') $echo $n ".$c"
8508                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8509                         if eval $compile; then
8510                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8511                                 shift
8512                                 flags="$*"
8513                                 echo " "
8514                                 $echo $n "Succeeded with $flags$c"
8515                         fi
8516                         ;;
8517                 esac
8518         done
8519         done
8520         done
8521         done
8522         done
8523         timeincl=''
8524         echo " "
8525         case "$flags" in
8526         *SYSTIMEKERNEL*) i_systimek="$define"
8527                 timeincl=`./findhdr sys/time.h`
8528                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8529         *) i_systimek="$undef";;
8530         esac
8531         case "$flags" in
8532         *I_TIME*) i_time="$define"
8533                 timeincl=`./findhdr time.h`" $timeincl"
8534                 echo "We'll include <time.h>." >&4;;
8535         *) i_time="$undef";;
8536         esac
8537         case "$flags" in
8538         *I_SYSTIME*) i_systime="$define"
8539                 timeincl=`./findhdr sys/time.h`" $timeincl"
8540                 echo "We'll include <sys/time.h>." >&4;;
8541         *) i_systime="$undef";;
8542         esac
8543         $rm -f try.c try
8544 fi
8545
8546 : check for fd_set items
8547 $cat <<EOM
8548
8549 Checking to see how well your C compiler handles fd_set and friends ...
8550 EOM
8551 $cat >fd_set.c <<EOCP
8552 #$i_systime I_SYS_TIME
8553 #$i_sysselct I_SYS_SELECT
8554 #$d_socket HAS_SOCKET
8555 #include <sys/types.h>
8556 #ifdef HAS_SOCKET
8557 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8558 #endif
8559 #ifdef I_SYS_TIME
8560 #include <sys/time.h>
8561 #endif
8562 #ifdef I_SYS_SELECT
8563 #include <sys/select.h>
8564 #endif
8565 int main() {
8566         fd_set fds;
8567
8568 #ifdef TRYBITS
8569         if(fds.fds_bits);
8570 #endif
8571
8572 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8573         exit(0);
8574 #else
8575         exit(1);
8576 #endif
8577 }
8578 EOCP
8579 set fd_set -DTRYBITS
8580 if eval $compile; then
8581         d_fds_bits="$define"
8582         d_fd_set="$define"
8583         echo "Well, your system knows about the normal fd_set typedef..." >&4
8584         if ./fd_set; then
8585                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8586                 d_fd_macros="$define"
8587         else
8588                 $cat >&4 <<'EOM'
8589 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8590 EOM
8591                 d_fd_macros="$undef"
8592         fi
8593 else
8594         $cat <<'EOM'
8595 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8596 EOM
8597         set fd_set
8598         if eval $compile; then
8599                 d_fds_bits="$undef"
8600                 d_fd_set="$define"
8601                 echo "Well, your system has some sort of fd_set available..." >&4
8602                 if ./fd_set; then
8603                         echo "and you have the normal fd_set macros." >&4
8604                         d_fd_macros="$define"
8605                 else
8606                         $cat <<'EOM'
8607 but not the normal fd_set macros!  Gross!  More work for me...
8608 EOM
8609                         d_fd_macros="$undef"
8610                 fi
8611         else
8612         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8613                 d_fd_set="$undef"
8614                 d_fds_bits="$undef"
8615                 d_fd_macros="$undef"
8616         fi
8617 fi
8618 $rm -f fd_set*
8619
8620 : see if fgetpos exists
8621 set fgetpos d_fgetpos
8622 eval $inlibc
8623
8624
8625 if $test X"$use64bits" = X"$define"; then
8626         : see if fgetpos64 exists
8627         set fgetpos64 d_fgetpos64
8628         eval $inlibc
8629
8630         : see if fopen64 exists
8631         set freopen64 d_fopen64
8632         eval $inlibc
8633
8634         : see if freopen64 exists
8635         set freopen64 d_freopen64
8636         eval $inlibc
8637
8638         : see if fseek64 exists
8639         set fseek64 d_fseek64
8640         eval $inlibc
8641
8642         : see if fseeko64 exists
8643         set fseeko64 d_fseeko64
8644         eval $inlibc
8645
8646         : see if fsetpos64 exists
8647         set fsetpos64 d_fsetpos64
8648         eval $inlibc
8649
8650         : see if ftell64 exists
8651         set ftell64 d_ftell64
8652         eval $inlibc
8653
8654         : see if ftello64 exists
8655         set ftello64 d_ftello64
8656         eval $inlibc
8657
8658         : see if tmpfile64 exists
8659         set tmpfile64 d_tmpfile64
8660         eval $inlibc
8661 else
8662         val="$undef"
8663         for xxx in d_fgetpos64 d_fopen64 d_freopen64 d_fseek64 d_fseeko64 d_fsetpos64 d_ftell64 d_ftello64 d_tmpfile64
8664         do
8665                 set $xxx
8666                 eval $setvar
8667         done
8668 fi
8669
8670 : see if flock exists
8671 set flock d_flock
8672 eval $inlibc
8673
8674 : see if fork exists
8675 set fork d_fork
8676 eval $inlibc
8677
8678 : see if pathconf exists
8679 set pathconf d_pathconf
8680 eval $inlibc
8681
8682 : see if fpathconf exists
8683 set fpathconf d_fpathconf
8684 eval $inlibc
8685
8686 : see if fseeko exists
8687 set fseeko d_fseeko
8688 eval $inlibc
8689
8690 : see if fsetpos exists
8691 set fsetpos d_fsetpos
8692 eval $inlibc
8693
8694 : see if this is a sys/param system
8695 set sys/param.h i_sysparam
8696 eval $inhdr
8697
8698 : see if this is a sys/mount.h system
8699 set sys/mount.h i_sysmount
8700 eval $inhdr
8701
8702
8703 : see if statfs exists
8704 set statfs d_statfs
8705 eval $inlibc
8706
8707 : see if fstatfs exists
8708 set fstatfs d_fstatfs
8709 eval $inlibc
8710
8711 : see if statfs knows about mount flags
8712 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8713 eval $hasfield
8714
8715
8716 : see if statvfs exists
8717 set statvfs d_statvfs
8718 eval $inlibc
8719
8720 : see if fstatvfs exists
8721 set fstatvfs d_fstatvfs
8722 eval $inlibc
8723
8724
8725 : see if ftello exists
8726 set ftello d_ftello
8727 eval $inlibc
8728
8729 : see if getgrent exists
8730 set getgrent d_getgrent
8731 eval $inlibc
8732
8733 : see if gethostbyaddr exists
8734 set gethostbyaddr d_gethbyaddr
8735 eval $inlibc
8736
8737 : see if gethostbyname exists
8738 set gethostbyname d_gethbyname
8739 eval $inlibc
8740
8741 : see if gethostent exists
8742 set gethostent d_gethent
8743 eval $inlibc
8744
8745 : see how we will look up host name
8746 echo " "
8747 call=''
8748 if set gethostname val -f d_gethname; eval $csym; $val; then
8749         echo 'gethostname() found.' >&4
8750         d_gethname="$define"
8751         call=gethostname
8752 fi
8753 if set uname val -f d_uname; eval $csym; $val; then
8754         if ./xenix; then
8755                 $cat <<'EOM'
8756 uname() was found, but you're running xenix, and older versions of xenix
8757 have a broken uname(). If you don't really know whether your xenix is old
8758 enough to have a broken system call, use the default answer.
8759
8760 EOM
8761                 dflt=y
8762                 case "$d_uname" in
8763                 "$define") dflt=n;;
8764                 esac
8765                 rp='Is your uname() broken?'
8766                 . ./myread
8767                 case "$ans" in
8768                 n*) d_uname="$define"; call=uname;;
8769                 esac
8770         else
8771                 echo 'uname() found.' >&4
8772                 d_uname="$define"
8773                 case "$call" in
8774                 '') call=uname ;;
8775                 esac
8776         fi
8777 fi
8778 case "$d_gethname" in
8779 '') d_gethname="$undef";;
8780 esac
8781 case "$d_uname" in
8782 '') d_uname="$undef";;
8783 esac
8784 case "$d_uname$d_gethname" in
8785 *define*)
8786         dflt=n
8787         cat <<EOM
8788  
8789 Every now and then someone has a $call() that lies about the hostname
8790 but can't be fixed for political or economic reasons.  If you wish, I can
8791 pretend $call() isn't there and maybe compute hostname at run-time
8792 thanks to the '$phostname' command.
8793
8794 EOM
8795         rp="Shall I ignore $call() from now on?"
8796         . ./myread
8797         case "$ans" in
8798         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8799         esac;;
8800 esac
8801 case "$phostname" in
8802 '') aphostname='';;
8803 *) case "$aphostname" in
8804         /*) ;;
8805         *) set X $phostname
8806                 shift
8807                 file=$1
8808                 shift
8809                 file=`./loc $file $file $pth`
8810                 aphostname=`echo $file $*`
8811                 ;;
8812         esac
8813         ;;
8814 esac
8815 case "$d_uname$d_gethname" in
8816 *define*) ;;
8817 *)
8818         case "$phostname" in
8819         '')
8820                 echo "There will be no way for $package to get your hostname." >&4;;
8821         *)
8822         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8823                 ;;
8824         esac;;
8825 esac
8826 case "$d_phostname" in
8827 '') d_phostname="$undef";;
8828 esac
8829
8830 : see if this is a netdb.h system
8831 set netdb.h i_netdb
8832 eval $inhdr
8833
8834 : see if prototypes for various gethostxxx netdb.h functions are available
8835 echo " "
8836 set d_gethostprotos gethostent $i_netdb netdb.h
8837 eval $hasproto
8838
8839 : see if getlogin exists
8840 set getlogin d_getlogin
8841 eval $inlibc
8842
8843 : see if getmntent exists
8844 set getmntent d_getmntent
8845 eval $inlibc
8846
8847 : see if getnetbyaddr exists
8848 set getnetbyaddr d_getnbyaddr
8849 eval $inlibc
8850
8851 : see if getnetbyname exists
8852 set getnetbyname d_getnbyname
8853 eval $inlibc
8854
8855 : see if getnetent exists
8856 set getnetent d_getnent
8857 eval $inlibc
8858
8859 : see if prototypes for various getnetxxx netdb.h functions are available
8860 echo " "
8861 set d_getnetprotos getnetent $i_netdb netdb.h
8862 eval $hasproto
8863
8864
8865 : see if getprotobyname exists
8866 set getprotobyname d_getpbyname
8867 eval $inlibc
8868
8869 : see if getprotobynumber exists
8870 set getprotobynumber d_getpbynumber
8871 eval $inlibc
8872
8873 : see if getprotoent exists
8874 set getprotoent d_getpent
8875 eval $inlibc
8876
8877 : see if getpgid exists
8878 set getpgid d_getpgid
8879 eval $inlibc
8880
8881 : see if getpgrp2 exists
8882 set getpgrp2 d_getpgrp2
8883 eval $inlibc
8884
8885 : see if getppid exists
8886 set getppid d_getppid
8887 eval $inlibc
8888
8889 : see if getpriority exists
8890 set getpriority d_getprior
8891 eval $inlibc
8892
8893 : see if prototypes for various getprotoxxx netdb.h functions are available
8894 echo " "
8895 set d_getprotoprotos getprotoent $i_netdb netdb.h
8896 eval $hasproto
8897
8898 : see if getpwent exists
8899 set getpwent d_getpwent
8900 eval $inlibc
8901
8902
8903 : see if getservbyname exists
8904 set getservbyname d_getsbyname
8905 eval $inlibc
8906
8907 : see if getservbyport exists
8908 set getservbyport d_getsbyport
8909 eval $inlibc
8910
8911 : see if getservent exists
8912 set getservent d_getsent
8913 eval $inlibc
8914
8915 : see if prototypes for various getservxxx netdb.h functions are available
8916 echo " "
8917 set d_getservprotos getservent $i_netdb netdb.h
8918 eval $hasproto
8919
8920 : see if getspent exists
8921 set getspent d_getspent
8922 eval $inlibc
8923
8924 : see if getspnam exists
8925 set getspnam d_getspnam
8926 eval $inlibc
8927
8928 : see if gettimeofday or ftime exists
8929 set gettimeofday d_gettimeod
8930 eval $inlibc
8931 case "$d_gettimeod" in
8932 "$undef")
8933         set ftime d_ftime 
8934         eval $inlibc
8935         ;;
8936 *)
8937         val="$undef"; set d_ftime; eval $setvar
8938         ;;
8939 esac
8940 case "$d_gettimeod$d_ftime" in
8941 "$undef$undef")
8942         echo " "
8943         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8944         ;;
8945 esac
8946
8947 : see if this is an grp system
8948 set grp.h i_grp
8949 eval $inhdr
8950
8951 case "$i_grp" in
8952 $define)
8953         xxx=`./findhdr grp.h`
8954         $cppstdin $cppflags $cppminus < $xxx >$$.h
8955
8956         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8957                 val="$define"
8958         else
8959                 val="$undef"
8960         fi
8961         set d_grpasswd
8962         eval $setvar
8963
8964         $rm -f $$.h
8965         ;;
8966 *)
8967         val="$undef";
8968         set d_grpasswd; eval $setvar
8969         ;;
8970 esac
8971
8972 : see if hasmntopt exists
8973 set hasmntopt d_hasmntopt
8974 eval $inlibc
8975
8976 : see if this is a netinet/in.h or sys/in.h system
8977 set netinet/in.h i_niin sys/in.h i_sysin
8978 eval $inhdr
8979
8980 : see if arpa/inet.h has to be included
8981 set arpa/inet.h i_arpainet
8982 eval $inhdr
8983
8984 : see if htonl --and friends-- exists
8985 val=''
8986 set htonl val
8987 eval $inlibc
8988
8989 : Maybe they are macros.
8990 case "$val" in
8991 $undef)
8992         $cat >htonl.c <<EOM
8993 #include <stdio.h>
8994 #include <sys/types.h>
8995 #$i_niin I_NETINET_IN
8996 #$i_sysin I_SYS_IN
8997 #$i_arpainet I_ARPA_INET
8998 #ifdef I_NETINET_IN
8999 #include <netinet/in.h>
9000 #endif
9001 #ifdef I_SYS_IN
9002 #include <sys/in.h>
9003 #endif
9004 #ifdef I_ARPA_INET
9005 #include <arpa/inet.h>
9006 #endif
9007 #ifdef htonl
9008 printf("Defined as a macro.");
9009 #endif
9010 EOM
9011         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
9012         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
9013                 val="$define"
9014                 echo "But it seems to be defined as a macro." >&4
9015         fi
9016         $rm -f htonl.?
9017         ;;
9018 esac
9019 set d_htonl
9020 eval $setvar
9021
9022 : see which of string.h or strings.h is needed
9023 echo " "
9024 strings=`./findhdr string.h`
9025 if $test "$strings" && $test -r "$strings"; then
9026         echo "Using <string.h> instead of <strings.h>." >&4
9027         val="$define"
9028 else
9029         val="$undef"
9030         strings=`./findhdr strings.h`
9031         if $test "$strings" && $test -r "$strings"; then
9032                 echo "Using <strings.h> instead of <string.h>." >&4
9033         else
9034                 echo "No string header found -- You'll surely have problems." >&4
9035         fi
9036 fi
9037 set i_string
9038 eval $setvar
9039 case "$i_string" in
9040 "$undef") strings=`./findhdr strings.h`;;
9041 *)        strings=`./findhdr string.h`;;
9042 esac
9043
9044 : index or strchr
9045 echo " "
9046 if set index val -f; eval $csym; $val; then
9047         if set strchr val -f d_strchr; eval $csym; $val; then
9048                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
9049                         val="$define"
9050                         vali="$undef"
9051                         echo "strchr() found." >&4
9052                 else
9053                         val="$undef"
9054                         vali="$define"
9055                         echo "index() found." >&4
9056                 fi
9057         else
9058                 val="$undef"
9059                 vali="$define"
9060                 echo "index() found." >&4
9061         fi
9062 else
9063         if set strchr val -f d_strchr; eval $csym; $val; then
9064                 val="$define"
9065                 vali="$undef"
9066                 echo "strchr() found." >&4
9067         else
9068                 echo "No index() or strchr() found!" >&4
9069                 val="$undef"
9070                 vali="$undef"
9071         fi
9072 fi
9073 set d_strchr; eval $setvar
9074 val="$vali"
9075 set d_index; eval $setvar
9076
9077 : check whether inet_aton exists
9078 set inet_aton d_inetaton
9079 eval $inlibc
9080
9081 : Look for isascii
9082 echo " "
9083 $cat >isascii.c <<'EOCP'
9084 #include <stdio.h>
9085 #include <ctype.h>
9086 int main() {
9087         int c = 'A';
9088         if (isascii(c))
9089                 exit(0);
9090         else
9091                 exit(1);
9092 }
9093 EOCP
9094 set isascii
9095 if eval $compile; then
9096         echo "isascii() found." >&4
9097         val="$define"
9098 else
9099         echo "isascii() NOT found." >&4
9100         val="$undef"
9101 fi
9102 set d_isascii
9103 eval $setvar
9104 $rm -f isascii*
9105
9106 : see if killpg exists
9107 set killpg d_killpg
9108 eval $inlibc
9109
9110 : see if lchown exists
9111 echo " "
9112 $cat > try.c <<'EOCP'
9113 /* System header to define __stub macros and hopefully few prototypes,
9114     which can conflict with char lchown(); below.  */
9115 #include <assert.h>
9116 /* Override any gcc2 internal prototype to avoid an error.  */
9117 /* We use char because int might match the return type of a gcc2
9118    builtin and then its argument prototype would still apply.  */
9119 char lchown();
9120 int main() {
9121     /*  The GNU C library defines this for functions which it implements
9122         to always fail with ENOSYS.  Some functions are actually named
9123         something starting with __ and the normal name is an alias.  */
9124 #if defined (__stub_lchown) || defined (__stub___lchown)
9125 choke me
9126 #else
9127 lchown();
9128 #endif
9129 ; return 0; }
9130 EOCP
9131 set try
9132 if eval $compile; then
9133     $echo "lchown() found." >&4
9134     val="$define"
9135 else
9136     $echo "lchown() NOT found." >&4
9137     val="$undef"
9138 fi
9139 set d_lchown
9140 eval $setvar
9141
9142 : see if link exists
9143 set link d_link
9144 eval $inlibc
9145
9146 : see if localeconv exists
9147 set localeconv d_locconv
9148 eval $inlibc
9149
9150 : see if lockf exists
9151 set lockf d_lockf
9152 eval $inlibc
9153
9154 : see if lstat exists
9155 set lstat d_lstat
9156 eval $inlibc
9157
9158 : see if madvise exists
9159 set madvise d_madvise
9160 eval $inlibc
9161
9162 : see if mblen exists
9163 set mblen d_mblen
9164 eval $inlibc
9165
9166 : see if mbstowcs exists
9167 set mbstowcs d_mbstowcs
9168 eval $inlibc
9169
9170 : see if mbtowc exists
9171 set mbtowc d_mbtowc
9172 eval $inlibc
9173
9174 : see if memchr exists
9175 set memchr d_memchr
9176 eval $inlibc
9177
9178 : see if memcmp exists
9179 set memcmp d_memcmp
9180 eval $inlibc
9181
9182 : see if memcpy exists
9183 set memcpy d_memcpy
9184 eval $inlibc
9185
9186 : see if memmove exists
9187 set memmove d_memmove
9188 eval $inlibc
9189
9190 : see if memset exists
9191 set memset d_memset
9192 eval $inlibc
9193
9194 : see if mkdir exists
9195 set mkdir d_mkdir
9196 eval $inlibc
9197
9198 : see if mkfifo exists
9199 set mkfifo d_mkfifo
9200 eval $inlibc
9201
9202 : see if mktime exists
9203 set mktime d_mktime
9204 eval $inlibc
9205
9206 : see if this is a sys/mman.h system
9207 set sys/mman.h i_sysmman
9208 eval $inhdr
9209
9210 : see if mmap exists
9211 set mmap d_mmap
9212 eval $inlibc
9213 : see what shmat returns
9214 : default to something harmless
9215 mmaptype='void *'
9216 case "$i_sysmman$d_mmap" in
9217 "$define$define")
9218         $cat >mmap.c <<'END'
9219 #include <sys/mman.h>
9220 void *mmap();
9221 END
9222         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9223                 mmaptype='void *'
9224         else
9225                 mmaptype='caddr_t'
9226         fi
9227         echo "and it returns ($mmaptype)." >&4
9228         ;;
9229 esac
9230
9231
9232
9233 : see if mprotect exists
9234 set mprotect d_mprotect
9235 eval $inlibc
9236
9237 : see if msgctl exists
9238 set msgctl d_msgctl
9239 eval $inlibc
9240
9241 : see if msgget exists
9242 set msgget d_msgget
9243 eval $inlibc
9244
9245 : see if msgsnd exists
9246 set msgsnd d_msgsnd
9247 eval $inlibc
9248
9249 : see if msgrcv exists
9250 set msgrcv d_msgrcv
9251 eval $inlibc
9252
9253 : see how much of the 'msg*(2)' library is present.
9254 h_msg=true
9255 echo " "
9256 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9257 *"$undef"*) h_msg=false;;
9258 esac
9259 case "$osname" in
9260 freebsd)
9261     case "`ipcs 2>&1`" in
9262     "SVID messages"*"not configured"*)
9263         echo "Your $osname does not have the msg*(2) configured." >&4
9264         h_msg=false
9265         val="$undef"
9266         set msgctl d_msgctl
9267         eval $setvar
9268         set msgget d_msgget
9269         eval $setvar
9270         set msgsnd d_msgsnd
9271         eval $setvar
9272         set msgrcv d_msgrcv
9273         eval $setvar
9274         ;;
9275     esac
9276     ;;
9277 esac
9278 : we could also check for sys/ipc.h ...
9279 if $h_msg && $test `./findhdr sys/msg.h`; then
9280         echo "You have the full msg*(2) library." >&4
9281         val="$define"
9282 else
9283         echo "You don't have the full msg*(2) library." >&4
9284         val="$undef"
9285 fi
9286 set d_msg
9287 eval $setvar
9288
9289 : see if msync exists
9290 set msync d_msync
9291 eval $inlibc
9292
9293 : see if munmap exists
9294 set munmap d_munmap
9295 eval $inlibc
9296
9297 : see if nice exists
9298 set nice d_nice
9299 eval $inlibc
9300
9301 : see if POSIX threads are available
9302 if test "X$usethreads" = "X$define"; then
9303         set pthread.h i_pthread
9304         eval $inhdr
9305 else
9306         i_pthread="$undef"
9307 fi
9308
9309
9310
9311 : how to create joinable pthreads
9312 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9313         echo " "
9314         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9315         $cat >try.c <<'EOCP'
9316 #include <pthread.h>
9317 int main() {
9318     int detachstate = JOINABLE;
9319 }
9320 EOCP
9321         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9322         if eval $compile; then
9323                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9324                 val="$undef" # Yes, undef.
9325                 set d_old_pthread_create_joinable
9326                 eval $setvar
9327                 val=""
9328                 set old_pthread_create_joinable
9329                 eval $setvar
9330         else
9331                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9332                 if eval $compile; then
9333                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9334                         val="$define"
9335                         set d_old_pthread_create_joinable
9336                         eval $setvar
9337                         val=PTHREAD_CREATE_UNDETACHED
9338                         set old_pthread_create_joinable
9339                         eval $setvar
9340                 else            
9341                         set try -DJOINABLE=__UNDETACHED
9342                         if eval $compile; then
9343                                 echo "You seem to use __UNDETACHED." >&4
9344                                 val="$define"
9345                                 set d_old_pthread_create_joinable
9346                                 eval $setvar
9347                                 val=__UNDETACHED
9348                                 set old_pthread_create_joinable
9349                                 eval $setvar
9350                         else
9351                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9352                                 val="$define"
9353                                 set d_old_pthread_create_joinable
9354                                 eval $setvar
9355                                 val=0
9356                                 set old_pthread_create_joinable
9357                                 eval $setvar
9358                         fi
9359                 fi
9360         fi
9361         $rm -f try try.*
9362 else
9363     d_old_pthread_create_joinable="$undef"
9364     old_pthread_create_joinable=""
9365 fi
9366
9367 : see if pause exists
9368 set pause d_pause
9369 eval $inlibc
9370
9371 : see if pipe exists
9372 set pipe d_pipe
9373 eval $inlibc
9374
9375 : see if poll exists
9376 set poll d_poll
9377 eval $inlibc
9378
9379
9380 : see whether the various POSIXish _yields exist
9381 $cat >try.c <<EOP
9382 #include <pthread.h>
9383 #include <stdio.h>
9384 int main() {
9385 #ifdef SCHED_YIELD
9386         sched_yield();
9387 #else
9388 #ifdef PTHREAD_YIELD
9389         pthread_yield();
9390 #else
9391 #ifdef PTHREAD_YIELD_NULL
9392         pthread_yield(NULL);
9393 #endif
9394 #endif
9395 #endif
9396 }
9397 EOP
9398 : see if sched_yield exists
9399 set try -DSCHED_YIELD
9400 if eval $compile; then
9401     val="$define"
9402     sched_yield='sched_yield()'
9403 else
9404     val="$undef"
9405 fi
9406 case "$usethreads" in
9407 $define)
9408         case "$val" in
9409         $define) echo 'sched_yield() found.' >&4        ;;
9410         *)       echo 'sched_yield() NOT found.' >&4    ;;
9411         esac
9412 esac
9413 set d_sched_yield
9414 eval $setvar
9415
9416 : see if pthread_yield exists
9417 set try -DPTHREAD_YIELD
9418 if eval $compile; then
9419     val="$define"
9420     case "$sched_yield" in
9421     '') sched_yield='pthread_yield()' ;;
9422     esac
9423 else
9424     set try -DPTHREAD_YIELD_NULL
9425     if eval $compile; then
9426         val="$define"
9427         case "$sched_yield" in
9428         '') sched_yield='pthread_yield(NULL)' ;;
9429         esac
9430     else
9431         val="$undef"
9432     fi
9433 fi
9434 case "$usethreads" in
9435 $define)
9436         case "$val" in
9437         $define) echo 'pthread_yield() found.' >&4      ;;
9438         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9439         esac
9440         ;;
9441 esac
9442 set d_pthread_yield
9443 eval $setvar
9444
9445 case "$sched_yield" in
9446 '') sched_yield=undef ;;
9447 esac
9448
9449 $rm -f try try.*
9450
9451 : see if this is a pwd.h system
9452 set pwd.h i_pwd
9453 eval $inhdr
9454
9455 case "$i_pwd" in
9456 $define)
9457         xxx=`./findhdr pwd.h`
9458         $cppstdin $cppflags $cppminus < $xxx >$$.h
9459
9460         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9461                 val="$define"
9462         else
9463                 val="$undef"
9464         fi
9465         set d_pwquota
9466         eval $setvar
9467
9468         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9469                 val="$define"
9470         else
9471                 val="$undef"
9472         fi
9473         set d_pwage
9474         eval $setvar
9475
9476         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9477                 val="$define"
9478         else
9479                 val="$undef"
9480         fi
9481         set d_pwchange
9482         eval $setvar
9483
9484         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9485                 val="$define"
9486         else
9487                 val="$undef"
9488         fi
9489         set d_pwclass
9490         eval $setvar
9491
9492         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9493                 val="$define"
9494         else
9495                 val="$undef"
9496         fi
9497         set d_pwexpire
9498         eval $setvar
9499
9500         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9501                 val="$define"
9502         else
9503                 val="$undef"
9504         fi
9505         set d_pwcomment
9506         eval $setvar
9507
9508         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9509                 val="$define"
9510         else
9511                 val="$undef"
9512         fi
9513         set d_pwgecos
9514         eval $setvar
9515
9516         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9517                 val="$define"
9518         else
9519                 val="$undef"
9520         fi
9521         set d_pwpasswd
9522         eval $setvar
9523
9524         $rm -f $$.h
9525         ;;
9526 *)
9527         val="$undef"; 
9528         set d_pwquota; eval $setvar
9529         set d_pwage; eval $setvar
9530         set d_pwchange; eval $setvar
9531         set d_pwclass; eval $setvar
9532         set d_pwexpire; eval $setvar
9533         set d_pwcomment; eval $setvar
9534         set d_pwgecos; eval $setvar
9535         set d_pwpasswd; eval $setvar
9536         ;;
9537 esac
9538
9539 : see if readdir and friends exist
9540 set readdir d_readdir
9541 eval $inlibc
9542 set seekdir d_seekdir
9543 eval $inlibc
9544 set telldir d_telldir
9545 eval $inlibc
9546 set rewinddir d_rewinddir
9547 eval $inlibc
9548
9549 : see if readlink exists
9550 set readlink d_readlink
9551 eval $inlibc
9552
9553 : see if readv exists
9554 set readv d_readv
9555 eval $inlibc
9556
9557 : see if rename exists
9558 set rename d_rename
9559 eval $inlibc
9560
9561 : see if rmdir exists
9562 set rmdir d_rmdir
9563 eval $inlibc
9564
9565 : see if memory.h is available.
9566 val=''
9567 set memory.h val
9568 eval $inhdr
9569
9570 : See if it conflicts with string.h
9571 case "$val" in
9572 $define)
9573         case "$strings" in
9574         '') ;;
9575         *)
9576                 $cppstdin $cppflags $cppminus < $strings > mem.h
9577                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9578                         echo " "
9579                         echo "We won't be including <memory.h>."
9580                         val="$undef"
9581                 fi
9582                 $rm -f mem.h
9583                 ;;
9584         esac
9585 esac
9586 set i_memory
9587 eval $setvar
9588
9589 : can bcopy handle overlapping blocks?
9590 val="$undef"
9591 case "$d_bcopy" in
9592 "$define")
9593         echo " "
9594         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9595         $cat >try.c <<EOCP
9596 #$i_memory I_MEMORY
9597 #$i_stdlib I_STDLIB
9598 #$i_string I_STRING
9599 #$i_unistd I_UNISTD
9600 EOCP
9601         $cat >>try.c <<'EOCP'
9602 #include <stdio.h>
9603 #ifdef I_MEMORY
9604 #  include <memory.h>
9605 #endif
9606 #ifdef I_STDLIB
9607 #  include <stdlib.h>
9608 #endif
9609 #ifdef I_STRING
9610 #  include <string.h>
9611 #else
9612 #  include <strings.h>
9613 #endif
9614 #ifdef I_UNISTD
9615 #  include <unistd.h>  /* Needed for NetBSD */
9616 #endif
9617 int main()
9618 {
9619 char buf[128], abc[128];
9620 char *b;
9621 int len;
9622 int off;
9623 int align;
9624
9625 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9626
9627 for (align = 7; align >= 0; align--) {
9628         for (len = 36; len; len--) {
9629                 b = buf+align;
9630                 bcopy(abc, b, len);
9631                 for (off = 1; off <= len; off++) {
9632                         bcopy(b, b+off, len);
9633                         bcopy(b+off, b, len);
9634                         if (bcmp(b, abc, len))
9635                                 exit(1);
9636                 }
9637         }
9638 }
9639 exit(0);
9640 }
9641 EOCP
9642         set try
9643         if eval $compile_ok; then
9644                 if ./try 2>/dev/null; then
9645                         echo "Yes, it can."
9646                         val="$define"
9647                 else
9648                         echo "It can't, sorry."
9649                         case "$d_memmove" in
9650                         "$define") echo "But that's Ok since you have memmove()." ;;
9651                         esac
9652                 fi
9653         else
9654                 echo "(I can't compile the test program, so we'll assume not...)"
9655                 case "$d_memmove" in
9656                 "$define") echo "But that's Ok since you have memmove()." ;;
9657                 esac
9658         fi
9659         ;;
9660 esac
9661 $rm -f try.* try core
9662 set d_safebcpy
9663 eval $setvar
9664
9665 : can memcpy handle overlapping blocks?
9666 val="$undef"
9667 case "$d_memcpy" in
9668 "$define")
9669         echo " "
9670         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9671         $cat >try.c <<EOCP
9672 #$i_memory I_MEMORY
9673 #$i_stdlib I_STDLIB
9674 #$i_string I_STRING
9675 #$i_unistd I_UNISTD
9676 EOCP
9677         $cat >>try.c <<'EOCP'
9678 #include <stdio.h>
9679 #ifdef I_MEMORY
9680 #  include <memory.h>
9681 #endif
9682 #ifdef I_STDLIB
9683 #  include <stdlib.h>
9684 #endif
9685 #ifdef I_STRING
9686 #  include <string.h>
9687 #else
9688 #  include <strings.h>
9689 #endif
9690 #ifdef I_UNISTD
9691 #  include <unistd.h>  /* Needed for NetBSD */
9692 #endif
9693 int main()
9694 {
9695 char buf[128], abc[128];
9696 char *b;
9697 int len;
9698 int off;
9699 int align;
9700
9701 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9702    try to store the string in read-only memory. */
9703 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9704
9705 for (align = 7; align >= 0; align--) {
9706         for (len = 36; len; len--) {
9707                 b = buf+align;
9708                 memcpy(b, abc, len);
9709                 for (off = 1; off <= len; off++) {
9710                         memcpy(b+off, b, len);
9711                         memcpy(b, b+off, len);
9712                         if (memcmp(b, abc, len))
9713                                 exit(1);
9714                 }
9715         }
9716 }
9717 exit(0);
9718 }
9719 EOCP
9720         set try
9721         if eval $compile_ok; then
9722                 if ./try 2>/dev/null; then
9723                         echo "Yes, it can."
9724                         val="$define"
9725                 else
9726                         echo "It can't, sorry."
9727                         case "$d_memmove" in
9728                         "$define") echo "But that's Ok since you have memmove()." ;;
9729                         esac
9730                 fi
9731         else
9732                 echo "(I can't compile the test program, so we'll assume not...)"
9733                 case "$d_memmove" in
9734                 "$define") echo "But that's Ok since you have memmove()." ;;
9735                 esac
9736         fi
9737         ;;
9738 esac
9739 $rm -f try.* try core
9740 set d_safemcpy
9741 eval $setvar
9742
9743 : can memcmp be trusted to compare relative magnitude?
9744 val="$undef"
9745 case "$d_memcmp" in
9746 "$define")
9747         echo " "
9748         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9749         $cat >try.c <<EOCP
9750 #$i_memory I_MEMORY
9751 #$i_stdlib I_STDLIB
9752 #$i_string I_STRING
9753 #$i_unistd I_UNISTD
9754 EOCP
9755         $cat >>try.c <<'EOCP'
9756 #include <stdio.h>
9757 #ifdef I_MEMORY
9758 #  include <memory.h>
9759 #endif
9760 #ifdef I_STDLIB
9761 #  include <stdlib.h>
9762 #endif
9763 #ifdef I_STRING
9764 #  include <string.h>
9765 #else
9766 #  include <strings.h>
9767 #endif
9768 #ifdef I_UNISTD
9769 #  include <unistd.h>  /* Needed for NetBSD */
9770 #endif
9771 int main()
9772 {
9773 char a = -1;
9774 char b = 0;
9775 if ((a < b) && memcmp(&a, &b, 1) < 0)
9776         exit(1);
9777 exit(0);
9778 }
9779 EOCP
9780         set try
9781         if eval $compile_ok; then
9782                 if ./try 2>/dev/null; then
9783                         echo "Yes, it can."
9784                         val="$define"
9785                 else
9786                         echo "No, it can't (it uses signed chars)."
9787                 fi
9788         else
9789                 echo "(I can't compile the test program, so we'll assume not...)"
9790         fi
9791         ;;
9792 esac
9793 $rm -f try.* try core
9794 set d_sanemcmp
9795 eval $setvar
9796
9797 : see if select exists
9798 set select d_select
9799 eval $inlibc
9800
9801 : see if semctl exists
9802 set semctl d_semctl
9803 eval $inlibc
9804
9805 : see if semget exists
9806 set semget d_semget
9807 eval $inlibc
9808
9809 : see if semop exists
9810 set semop d_semop
9811 eval $inlibc
9812
9813 : see how much of the 'sem*(2)' library is present.
9814 h_sem=true
9815 echo " "
9816 case "$d_semctl$d_semget$d_semop" in
9817 *"$undef"*) h_sem=false;;
9818 esac
9819 case "$osname" in
9820 freebsd)
9821     case "`ipcs 2>&1`" in
9822     "SVID messages"*"not configured"*)
9823         echo "Your $osname does not have the sem*(2) configured." >&4
9824         h_sem=false
9825         val="$undef"
9826         set semctl d_semctl
9827         eval $setvar
9828         set semget d_semget
9829         eval $setvar
9830         set semop d_semop
9831         eval $setvar
9832         ;;
9833     esac
9834     ;;
9835 esac
9836 : we could also check for sys/ipc.h ...
9837 if $h_sem && $test `./findhdr sys/sem.h`; then
9838         echo "You have the full sem*(2) library." >&4
9839         val="$define"
9840 else
9841         echo "You don't have the full sem*(2) library." >&4
9842         val="$undef"
9843 fi
9844 set d_sem
9845 eval $setvar
9846
9847 : see whether sys/sem.h defines union semun
9848 echo " "
9849 $cat > try.c <<'END'
9850 #include <sys/types.h>
9851 #include <sys/ipc.h>
9852 #include <sys/sem.h>
9853 int main () { union semun semun; semun.buf = 0; }
9854 END
9855 set try
9856 if eval $compile; then
9857     echo "You have union semun in <sys/sem.h>." >&4
9858     val="$define"
9859 else
9860     echo "You do not have union semun in <sys/sem.h>." >&4
9861     val="$undef"
9862 fi
9863 $rm -f try try.c try.h
9864 set d_union_semun
9865 eval $setvar
9866
9867 : see how to do semctl IPC_STAT
9868 case "$d_sem" in
9869 $define)
9870     : see whether semctl IPC_STAT can use union semun
9871     echo " "
9872     $cat > try.h <<END
9873 #ifndef S_IRUSR
9874 #   ifdef S_IREAD
9875 #       define S_IRUSR S_IREAD
9876 #       define S_IWUSR S_IWRITE
9877 #       define S_IXUSR S_IEXEC
9878 #   else
9879 #       define S_IRUSR 0400
9880 #       define S_IWUSR 0200
9881 #       define S_IXUSR 0100
9882 #   endif
9883 #   define S_IRGRP (S_IRUSR>>3)
9884 #   define S_IWGRP (S_IWUSR>>3)
9885 #   define S_IXGRP (S_IXUSR>>3)
9886 #   define S_IROTH (S_IRUSR>>6)
9887 #   define S_IWOTH (S_IWUSR>>6)
9888 #   define S_IXOTH (S_IXUSR>>6)
9889 #endif
9890 #ifndef S_IRWXU
9891 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9892 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9893 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9894 #endif
9895 END
9896
9897     $cat > try.c <<END
9898 #include <sys/types.h>
9899 #include <sys/ipc.h>
9900 #include <sys/sem.h>
9901 #include <sys/stat.h>
9902 #include <stdio.h>
9903 #include <errno.h>
9904 #include "try.h"
9905 #ifndef errno
9906 extern int errno;
9907 #endif
9908 #$d_union_semun HAS_UNION_SEMUN
9909 int main() {
9910     union semun
9911 #ifndef HAS_UNION_SEMUN
9912     {
9913         int val;
9914         struct semid_ds *buf;
9915         unsigned short *array;
9916     }
9917 #endif
9918     arg;
9919     int sem, st;
9920
9921 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9922     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9923     if (sem > -1) {
9924         struct semid_ds argbuf;
9925         arg.buf = &argbuf;
9926 #       ifdef IPC_STAT
9927         st = semctl(sem, 0, IPC_STAT, arg);
9928         if (st == 0)
9929             printf("semun\n");
9930         else
9931 #       endif /* IPC_STAT */
9932             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9933 #       ifdef IPC_RMID
9934         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9935 #       endif /* IPC_RMID */
9936             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9937     } else
9938 #endif /* IPC_PRIVATE && ... */
9939         printf("semget failed: errno = %d\n", errno);
9940   return 0;
9941 }
9942 END
9943     val="$undef"
9944     set try
9945     if eval $compile; then
9946         xxx=`./try`
9947         case "$xxx" in
9948         semun) val="$define" ;;
9949         esac
9950     fi
9951     $rm -f try try.c
9952     set d_semctl_semun
9953     eval $setvar
9954     case "$d_semctl_semun" in
9955     $define)
9956         echo "You can use union semun for semctl IPC_STAT." >&4
9957         also='also'
9958         ;;
9959     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9960         also=''
9961         ;;
9962     esac
9963
9964     : see whether semctl IPC_STAT can use struct semid_ds pointer
9965     $cat > try.c <<'END'
9966 #include <sys/types.h>
9967 #include <sys/ipc.h>
9968 #include <sys/sem.h>
9969 #include <sys/stat.h>
9970 #include "try.h"
9971 #include <stdio.h>
9972 #include <errno.h>
9973 #ifndef errno
9974 extern int errno;
9975 #endif
9976 int main() {
9977     struct semid_ds arg;
9978     int sem, st;
9979
9980 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9981     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9982     if (sem > -1) {
9983 #       ifdef IPC_STAT
9984         st = semctl(sem, 0, IPC_STAT, &arg);
9985         if (st == 0)
9986             printf("semid_ds\n");
9987         else
9988 #       endif /* IPC_STAT */
9989             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9990 #       ifdef IPC_RMID
9991         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9992 #       endif /* IPC_RMID */
9993             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9994     } else
9995 #endif /* IPC_PRIVATE && ... */
9996         printf("semget failed: errno = %d\n", errno);
9997
9998     return 0;
9999 }
10000 END
10001     val="$undef"
10002     set try
10003     if eval $compile; then
10004         xxx=`./try`
10005         case "$xxx" in
10006         semid_ds) val="$define" ;;
10007         esac
10008     fi
10009     $rm -f try try.c
10010     set d_semctl_semid_ds
10011     eval $setvar
10012     case "$d_semctl_semid_ds" in
10013     $define)
10014         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
10015         ;;
10016     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
10017         ;;
10018     esac
10019     $rm -f try.h
10020     ;;
10021 *)  val="$undef"
10022
10023     # We do not have the full sem*(2) library, so assume we can not
10024     # use either.
10025
10026     set d_semctl_semun
10027     eval $setvar
10028
10029     set d_semctl_semid_ds
10030     eval $setvar
10031     ;;
10032 esac
10033
10034 : see if setegid exists
10035 set setegid d_setegid
10036 eval $inlibc
10037
10038 : see if seteuid exists
10039 set seteuid d_seteuid
10040 eval $inlibc
10041
10042 : see if setgrent exists
10043 set setgrent d_setgrent
10044 eval $inlibc
10045
10046 : see if sethostent exists
10047 set sethostent d_sethent
10048 eval $inlibc
10049
10050 : see if setlinebuf exists
10051 set setlinebuf d_setlinebuf
10052 eval $inlibc
10053
10054 : see if setlocale exists
10055 set setlocale d_setlocale
10056 eval $inlibc
10057
10058 : see if setnetent exists
10059 set setnetent d_setnent
10060 eval $inlibc
10061
10062 : see if setprotoent exists
10063 set setprotoent d_setpent
10064 eval $inlibc
10065
10066 : see if setpgid exists
10067 set setpgid d_setpgid
10068 eval $inlibc
10069
10070 : see if setpgrp2 exists
10071 set setpgrp2 d_setpgrp2
10072 eval $inlibc
10073
10074 : see if setpriority exists
10075 set setpriority d_setprior
10076 eval $inlibc
10077
10078 : see if setpwent exists
10079 set setpwent d_setpwent
10080 eval $inlibc
10081
10082 : see if setregid exists
10083 set setregid d_setregid
10084 eval $inlibc
10085 set setresgid d_setresgid
10086 eval $inlibc
10087
10088 : see if setreuid exists
10089 set setreuid d_setreuid
10090 eval $inlibc
10091 set setresuid d_setresuid
10092 eval $inlibc
10093
10094 : see if setrgid exists
10095 set setrgid d_setrgid
10096 eval $inlibc
10097
10098 : see if setruid exists
10099 set setruid d_setruid
10100 eval $inlibc
10101
10102 : see if setservent exists
10103 set setservent d_setsent
10104 eval $inlibc
10105
10106 : see if setsid exists
10107 set setsid d_setsid
10108 eval $inlibc
10109
10110 : see if setspent exists
10111 set setspent d_setspent
10112 eval $inlibc
10113
10114 : see if setvbuf exists
10115 set setvbuf d_setvbuf
10116 eval $inlibc
10117
10118 : see if sfio.h is available
10119 set sfio.h i_sfio
10120 eval $inhdr
10121
10122
10123 : see if sfio library is available
10124 case "$i_sfio" in
10125 $define)
10126         val=''
10127         set sfreserve val
10128         eval $inlibc
10129         ;;
10130 *)
10131         val="$undef"
10132         ;;
10133 esac
10134 : Ok, but do we want to use it.
10135 case "$val" in
10136 $define)
10137         case "$usesfio" in
10138         true|$define|[yY]*) dflt='y';;
10139         *) dflt='n';;
10140         esac
10141         echo "$package can use the sfio library, but it is experimental."
10142         rp="You seem to have sfio available, do you want to try using it?"
10143         . ./myread
10144         case "$ans" in
10145         y|Y) ;;
10146         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10147                 val="$undef"
10148                 : Remove sfio from list of libraries to use
10149                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10150                 shift
10151                 libs="$*"
10152                 echo "libs = $libs" >&4
10153                 ;;
10154         esac
10155         ;;
10156 *)      case "$usesfio" in
10157         true|$define|[yY]*)
10158                 echo "Sorry, cannot find sfio on this machine" >&4
10159                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10160                 ;;
10161         esac
10162         ;;
10163 esac
10164 set d_sfio
10165 eval $setvar
10166 case "$d_sfio" in
10167 $define) usesfio='true';;
10168 *) usesfio='false';;
10169 esac
10170
10171 : see if shmctl exists
10172 set shmctl d_shmctl
10173 eval $inlibc
10174
10175 : see if shmget exists
10176 set shmget d_shmget
10177 eval $inlibc
10178
10179 : see if shmat exists
10180 set shmat d_shmat
10181 eval $inlibc
10182 : see what shmat returns
10183 case "$d_shmat" in
10184 "$define")
10185         $cat >shmat.c <<'END'
10186 #include <sys/shm.h>
10187 void *shmat();
10188 END
10189         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10190                 shmattype='void *'
10191         else
10192                 shmattype='char *'
10193         fi
10194         echo "and it returns ($shmattype)." >&4
10195         : see if a prototype for shmat is available
10196         xxx=`./findhdr sys/shm.h`
10197         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10198         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10199                 val="$define"
10200         else
10201                 val="$undef"
10202         fi
10203         $rm -f shmat.[co]
10204         ;;
10205 *)
10206         val="$undef"
10207         ;;
10208 esac
10209 set d_shmatprototype
10210 eval $setvar
10211
10212 : see if shmdt exists
10213 set shmdt d_shmdt
10214 eval $inlibc
10215
10216 : see how much of the 'shm*(2)' library is present.
10217 h_shm=true
10218 echo " "
10219 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10220 *"$undef"*) h_shm=false;;
10221 esac
10222 case "$osname" in
10223 freebsd)
10224     case "`ipcs 2>&1`" in
10225     "SVID shared memory"*"not configured"*)
10226         echo "Your $osname does not have the shm*(2) configured." >&4
10227         h_shm=false
10228         val="$undef"
10229         set shmctl d_shmctl
10230         evat $setvar
10231         set shmget d_shmget
10232         evat $setvar
10233         set shmat d_shmat
10234         evat $setvar
10235         set shmdt d_shmdt
10236         evat $setvar
10237         ;;
10238     esac
10239     ;;
10240 esac
10241 : we could also check for sys/ipc.h ...
10242 if $h_shm && $test `./findhdr sys/shm.h`; then
10243         echo "You have the full shm*(2) library." >&4
10244         val="$define"
10245 else
10246         echo "You don't have the full shm*(2) library." >&4
10247         val="$undef"
10248 fi
10249 set d_shm
10250 eval $setvar
10251
10252 echo " "
10253 : see if we have sigaction
10254 if set sigaction val -f d_sigaction; eval $csym; $val; then
10255         echo 'sigaction() found.' >&4
10256         $cat > try.c <<'EOP'
10257 #include <stdio.h>
10258 #include <sys/types.h>
10259 #include <signal.h>
10260 int main()
10261 {
10262     struct sigaction act, oact;
10263 }
10264 EOP
10265         set try
10266         if eval $compile_ok; then
10267                 val="$define"
10268         else
10269                 echo "But you don't seem to have a useable struct sigaction." >&4
10270                 val="$undef"
10271         fi
10272 else
10273         echo 'sigaction NOT found.' >&4
10274         val="$undef"
10275 fi
10276 set d_sigaction; eval $setvar
10277 $rm -f try try$_o try.c
10278
10279 : see if sigsetjmp exists
10280 echo " "
10281 case "$d_sigsetjmp" in
10282 '')
10283         $cat >try.c <<'EOP'
10284 #include <setjmp.h>
10285 sigjmp_buf env;
10286 int set = 1;
10287 int main()
10288 {
10289         if (sigsetjmp(env,1))
10290                 exit(set);
10291         set = 0;
10292         siglongjmp(env, 1);
10293         exit(1);
10294 }
10295 EOP
10296         set try
10297         if eval $compile; then
10298                 if ./try >/dev/null 2>&1; then
10299                         echo "POSIX sigsetjmp found." >&4
10300                         val="$define"
10301                 else
10302                         $cat >&4 <<EOM
10303 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10304 I'll ignore them.
10305 EOM
10306                         val="$undef"
10307                 fi
10308         else
10309                 echo "sigsetjmp not found." >&4
10310                 val="$undef"
10311         fi
10312         ;;
10313 *) val="$d_sigsetjmp"
10314         case "$d_sigsetjmp" in
10315         $define) echo "POSIX sigsetjmp found." >&4;;
10316         $undef) echo "sigsetjmp not found." >&4;;
10317         esac
10318         ;;
10319 esac
10320 set d_sigsetjmp
10321 eval $setvar
10322 $rm -f try.c try
10323
10324 : see if stat knows about block sizes
10325 echo " "
10326 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10327 eval $hasfield
10328
10329 : see if _ptr and _cnt from stdio act std
10330 echo " "
10331 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10332         echo "(Looks like you have stdio.h from Linux.)"
10333         case "$stdio_ptr" in
10334         '') stdio_ptr='((fp)->_IO_read_ptr)'
10335                 ptr_lval=$define
10336                 ;;
10337         *)      ptr_lval=$d_stdio_ptr_lval;;
10338         esac
10339         case "$stdio_cnt" in
10340         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10341                 cnt_lval=$undef
10342                 ;;
10343         *)      cnt_lval=$d_stdio_cnt_lval;;
10344         esac
10345         case "$stdio_base" in
10346         '') stdio_base='((fp)->_IO_read_base)';;
10347         esac
10348         case "$stdio_bufsiz" in
10349         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10350         esac
10351 else
10352         case "$stdio_ptr" in
10353         '') stdio_ptr='((fp)->_ptr)'
10354                 ptr_lval=$define
10355                 ;;
10356         *)      ptr_lval=$d_stdio_ptr_lval;;
10357         esac
10358         case "$stdio_cnt" in
10359         '') stdio_cnt='((fp)->_cnt)'
10360                 cnt_lval=$define
10361                 ;;
10362         *)      cnt_lval=$d_stdio_cnt_lval;;
10363         esac
10364         case "$stdio_base" in
10365         '') stdio_base='((fp)->_base)';;
10366         esac
10367         case "$stdio_bufsiz" in
10368         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10369         esac
10370 fi
10371 : test whether _ptr and _cnt really work
10372 echo "Checking how std your stdio is..." >&4
10373 $cat >try.c <<EOP
10374 #include <stdio.h>
10375 #define FILE_ptr(fp)    $stdio_ptr
10376 #define FILE_cnt(fp)    $stdio_cnt
10377 int main() {
10378         FILE *fp = fopen("try.c", "r");
10379         char c = getc(fp);
10380         if (
10381                 18 <= FILE_cnt(fp) &&
10382                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10383         )
10384                 exit(0);
10385         exit(1);
10386 }
10387 EOP
10388 val="$undef"
10389 set try
10390 if eval $compile; then
10391         if ./try; then
10392                 echo "Your stdio acts pretty std."
10393                 val="$define"
10394         else
10395                 echo "Your stdio isn't very std."
10396         fi
10397 else
10398         echo "Your stdio doesn't appear very std."
10399 fi
10400 $rm -f try.c try
10401 set d_stdstdio
10402 eval $setvar
10403
10404 : Can _ptr be used as an lvalue?
10405 case "$d_stdstdio$ptr_lval" in
10406 $define$define) val=$define ;;
10407 *) val=$undef ;;
10408 esac
10409 set d_stdio_ptr_lval
10410 eval $setvar
10411
10412 : Can _cnt be used as an lvalue?
10413 case "$d_stdstdio$cnt_lval" in
10414 $define$define) val=$define ;;
10415 *) val=$undef ;;
10416 esac
10417 set d_stdio_cnt_lval
10418 eval $setvar
10419
10420 : see if _base is also standard
10421 val="$undef"
10422 case "$d_stdstdio" in
10423 $define)
10424         $cat >try.c <<EOP
10425 #include <stdio.h>
10426 #define FILE_base(fp)   $stdio_base
10427 #define FILE_bufsiz(fp) $stdio_bufsiz
10428 int main() {
10429         FILE *fp = fopen("try.c", "r");
10430         char c = getc(fp);
10431         if (
10432                 19 <= FILE_bufsiz(fp) &&
10433                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10434         )
10435                 exit(0);
10436         exit(1);
10437 }
10438 EOP
10439         set try
10440         if eval $compile; then
10441                 if ./try; then
10442                         echo "And its _base field acts std."
10443                         val="$define"
10444                 else
10445                         echo "But its _base field isn't std."
10446                 fi
10447         else
10448                 echo "However, it seems to be lacking the _base field."
10449         fi
10450         $rm -f try.c try
10451         ;;
10452 esac
10453 set d_stdiobase
10454 eval $setvar
10455
10456 $cat >&4 <<EOM
10457 Checking how to access stdio streams by file descriptor number...
10458 EOM
10459 case "$stdio_stream_array" in
10460 '')     $cat >try.c <<EOCP
10461 #include <stdio.h>
10462 int main() {
10463   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10464     printf("yes\n");
10465 }
10466 EOCP
10467         for s in _iob __iob __sF
10468         do
10469                 set try -DSTDIO_STREAM_ARRAY=$s
10470                 if eval $compile; then
10471                         case "`./try$exe_ext`" in
10472                         yes)    stdio_stream_array=$s; break ;;
10473                         esac
10474                 fi
10475         done
10476         $rm -f try.* try$exe_ext
10477 esac
10478 case "$stdio_stream_array" in
10479 '')     $cat >&4 <<EOM
10480 I can't figure out how to access stdio streams by file descriptor number.
10481 EOM
10482         d_stdio_stream_array="$undef"
10483         ;;
10484 *)      $cat >&4 <<EOM
10485 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10486 EOM
10487         d_stdio_stream_array="$define"
10488         ;;
10489 esac
10490
10491 : see if strcoll exists
10492 set strcoll d_strcoll
10493 eval $inlibc
10494
10495 : check for structure copying
10496 echo " "
10497 echo "Checking to see if your C compiler can copy structs..." >&4
10498 $cat >try.c <<'EOCP'
10499 int main()
10500 {
10501         struct blurfl {
10502                 int dyick;
10503         } foo, bar;
10504
10505         foo = bar;
10506 }
10507 EOCP
10508 if $cc -c try.c >/dev/null 2>&1 ; then
10509         val="$define"
10510         echo "Yup, it can."
10511 else
10512         val="$undef"
10513         echo "Nope, it can't."
10514 fi
10515 set d_strctcpy
10516 eval $setvar
10517 $rm -f try.*
10518
10519 : see if strerror and/or sys_errlist[] exist
10520 echo " "
10521 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10522     if set strerror val -f d_strerror; eval $csym; $val; then
10523                 echo 'strerror() found.' >&4
10524                 d_strerror="$define"
10525                 d_strerrm='strerror(e)'
10526                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10527                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10528                         d_syserrlst="$define"
10529                 else
10530                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10531                         d_syserrlst="$undef"
10532                 fi
10533     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10534                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10535                 echo 'strerror() found in string header.' >&4
10536                 d_strerror="$define"
10537                 d_strerrm='strerror(e)'
10538                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10539                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10540                                 d_syserrlst="$define"
10541                 else
10542                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10543                         d_syserrlst="$undef"
10544                 fi
10545     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10546                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10547                 d_strerror="$undef"
10548                 d_syserrlst="$define"
10549                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10550     else
10551                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10552                 d_strerror="$undef"
10553                 d_syserrlst="$undef"
10554                 d_strerrm='"unknown"'
10555     fi
10556 fi
10557
10558 : see if strtod exists
10559 set strtod d_strtod
10560 eval $inlibc
10561
10562 : see if strtol exists
10563 set strtol d_strtol
10564 eval $inlibc
10565
10566 : see if strtoul exists
10567 set strtoul d_strtoul
10568 eval $inlibc
10569
10570 : see if strtoull exists
10571 set strtoull d_strtoull
10572 eval $inlibc
10573
10574 : see if strxfrm exists
10575 set strxfrm d_strxfrm
10576 eval $inlibc
10577
10578 : see if symlink exists
10579 set symlink d_symlink
10580 eval $inlibc
10581
10582 : see if syscall exists
10583 set syscall d_syscall
10584 eval $inlibc
10585
10586 : see if sysconf exists
10587 set sysconf d_sysconf
10588 eval $inlibc
10589
10590 : see if system exists
10591 set system d_system
10592 eval $inlibc
10593
10594 : see if tcgetpgrp exists
10595 set tcgetpgrp d_tcgetpgrp
10596 eval $inlibc
10597
10598 : see if tcsetpgrp exists
10599 set tcsetpgrp d_tcsetpgrp
10600 eval $inlibc
10601
10602 : see if sys/types.h has to be included
10603 set sys/types.h i_systypes
10604 eval $inhdr
10605
10606 : see if prototype for telldir is available
10607 echo " "
10608 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10609 eval $hasproto
10610
10611 : define an is-a-typedef? function
10612 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10613 case "$inclist" in
10614 "") inclist="sys/types.h";;
10615 esac;
10616 eval "varval=\$$var";
10617 case "$varval" in
10618 "")
10619         $rm -f temp.c;
10620         for inc in $inclist; do
10621                 echo "#include <$inc>" >>temp.c;
10622         done;
10623         echo "#ifdef $type" >> temp.c;
10624         echo "printf(\"We have $type\");" >> temp.c;
10625         echo "#endif" >> temp.c;
10626         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10627         if $contains $type temp.E >/dev/null 2>&1; then
10628                 eval "$var=\$type";
10629         else
10630                 eval "$var=\$def";
10631         fi;
10632         $rm -f temp.?;;
10633 *) eval "$var=\$varval";;
10634 esac'
10635
10636 : define an is-a-typedef? function that prompts if the type is not available.
10637 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10638 case "$inclist" in
10639 "") inclist="sys/types.h";;
10640 esac;
10641 eval "varval=\$$var";
10642 case "$varval" in
10643 "")
10644         $rm -f temp.c;
10645         for inc in $inclist; do
10646                 echo "#include <$inc>" >>temp.c;
10647         done;
10648         echo "#ifdef $type" >> temp.c;
10649         echo "printf(\"We have $type\");" >> temp.c;
10650         echo "#endif" >> temp.c;
10651         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10652         echo " " ;
10653         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10654         if $contains $type temp.E >/dev/null 2>&1; then
10655                 echo "$type found." >&4;
10656                 eval "$var=\$type";
10657         else
10658                 echo "$type NOT found." >&4;
10659                 dflt="$def";
10660                 . ./myread ;
10661                 eval "$var=\$ans";
10662         fi;
10663         $rm -f temp.?;;
10664 *) eval "$var=\$varval";;
10665 esac'
10666
10667 : see if this is a sys/times.h system
10668 set sys/times.h i_systimes
10669 eval $inhdr
10670
10671 : see if times exists
10672 echo " "
10673 if set times val -f d_times; eval $csym; $val; then
10674         echo 'times() found.' >&4
10675         d_times="$define"
10676         inc=''
10677         case "$i_systimes" in
10678         "$define") inc='sys/times.h';;
10679         esac
10680         rp="What is the type returned by times() on this system?"
10681         set clock_t clocktype long stdio.h sys/types.h $inc
10682         eval $typedef_ask
10683 else
10684         echo 'times() NOT found, hope that will do.' >&4
10685         d_times="$undef"
10686         clocktype='int'
10687 fi
10688
10689 : see if truncate exists
10690 set truncate d_truncate
10691 eval $inlibc
10692
10693 : see if tzname[] exists
10694 echo " "
10695 if set tzname val -a d_tzname; eval $csym; $val; then
10696         val="$define"
10697         echo 'tzname[] found.' >&4
10698 else
10699         val="$undef"
10700         echo 'tzname[] NOT found.' >&4
10701 fi
10702 set d_tzname
10703 eval $setvar
10704
10705 : see if umask exists
10706 set umask d_umask
10707 eval $inlibc
10708
10709 : backward compatibility for d_hvfork
10710 if test X$d_hvfork != X; then
10711         d_vfork="$d_hvfork"
10712         d_hvfork=''
10713 fi
10714 : see if there is a vfork
10715 val=''
10716 set vfork val
10717 eval $inlibc
10718
10719 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10720 : perl on Solaris 2.x, and probably elsewhere.
10721 case "$val" in
10722 $define)
10723         echo " "
10724         case "$usevfork" in
10725         false) dflt='n';;
10726         *) dflt='y';;
10727         esac
10728         cat <<'EOM'
10729  
10730 Perl can only use a vfork() that doesn't suffer from strict
10731 restrictions on calling functions or modifying global data in
10732 the child.  For example, glibc-2.1 contains such a vfork()
10733 that is unsuitable.  If your system provides a proper fork()
10734 call, chances are that you do NOT want perl to use vfork().
10735
10736 EOM
10737         rp="Do you still want to use vfork()?"
10738         . ./myread
10739         case "$ans" in
10740         y|Y) ;;
10741         *)
10742                 echo "Ok, we won't use vfork()."
10743                 val="$undef"
10744                 ;;
10745         esac
10746         ;;
10747 esac
10748 set d_vfork
10749 eval $setvar
10750 case "$d_vfork" in
10751 $define) usevfork='true';;
10752 *) usevfork='false';;
10753 esac
10754
10755 : see if this is an sysdir system
10756 set sys/dir.h i_sysdir
10757 eval $inhdr
10758
10759 : see if this is an sysndir system
10760 set sys/ndir.h i_sysndir
10761 eval $inhdr
10762
10763 : see if closedir exists
10764 set closedir d_closedir
10765 eval $inlibc
10766
10767 case "$d_closedir" in
10768 "$define")
10769         echo " "
10770         echo "Checking whether closedir() returns a status..." >&4
10771         cat > closedir.c <<EOM
10772 #$i_dirent I_DIRENT             /**/
10773 #$i_sysdir I_SYS_DIR            /**/
10774 #$i_sysndir I_SYS_NDIR          /**/
10775 #$i_systypes I_SYS_TYPES        /**/
10776
10777 #if defined(I_SYS_TYPES)
10778 #include <sys/types.h>
10779 #endif
10780 #if defined(I_DIRENT)
10781 #include <dirent.h>
10782 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10783 #include <sys/dir.h>
10784 #endif
10785 #else
10786 #ifdef I_SYS_NDIR
10787 #include <sys/ndir.h>
10788 #else
10789 #ifdef I_SYS_DIR
10790 #ifdef hp9000s500
10791 #include <ndir.h>       /* may be wrong in the future */
10792 #else
10793 #include <sys/dir.h>
10794 #endif
10795 #endif
10796 #endif
10797 #endif 
10798 int main() { return closedir(opendir(".")); }
10799 EOM
10800         set closedir
10801         if eval $compile_ok; then
10802                 if ./closedir > /dev/null 2>&1 ; then
10803                         echo "Yes, it does."
10804                         val="$undef"
10805                 else
10806                         echo "No, it doesn't."
10807                         val="$define"
10808                 fi
10809         else
10810                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10811                 val="$define"
10812         fi
10813         ;;
10814 *)
10815         val="$undef";
10816         ;;
10817 esac
10818 set d_void_closedir
10819 eval $setvar
10820 $rm -f closedir*
10821 : check for volatile keyword
10822 echo " "
10823 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10824 $cat >try.c <<'EOCP'
10825 int main()
10826 {
10827         typedef struct _goo_struct goo_struct;
10828         goo_struct * volatile goo = ((goo_struct *)0);
10829         struct _goo_struct {
10830                 long long_int;
10831                 int reg_int;
10832                 char char_var;
10833         };
10834         typedef unsigned short foo_t;
10835         char *volatile foo;
10836         volatile int bar;
10837         volatile foo_t blech;
10838         foo = foo;
10839 }
10840 EOCP
10841 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10842         val="$define"
10843         echo "Yup, it does."
10844 else
10845         val="$undef"
10846         echo "Nope, it doesn't."
10847 fi
10848 set d_volatile
10849 eval $setvar
10850 $rm -f try.*
10851
10852 : see if there is a wait4
10853 set wait4 d_wait4
10854 eval $inlibc
10855
10856 : see if waitpid exists
10857 set waitpid d_waitpid
10858 eval $inlibc
10859
10860 : see if wcstombs exists
10861 set wcstombs d_wcstombs
10862 eval $inlibc
10863
10864 : see if wctomb exists
10865 set wctomb d_wctomb
10866 eval $inlibc
10867
10868 : see if writev exists
10869 set writev d_writev
10870 eval $inlibc
10871
10872 : preserve RCS keywords in files with variable substitution, grrr
10873 Date='$Date'
10874 Id='$Id'
10875 Log='$Log'
10876 RCSfile='$RCSfile'
10877 Revision='$Revision'
10878
10879 case "$crosscompile" in
10880 ''|[nN]*) crosscompile="$undef" ;;
10881 esac
10882
10883 case "$osname" in
10884 next|rhapsody) multiarch="$define" ;;
10885 esac
10886 case "$multiarch" in
10887 ''|[nN]*) multiarch="$undef" ;;
10888 esac
10889
10890 : check for alignment requirements
10891 echo " "
10892 case "$crosscompile$multiarch" in
10893 *$define*)
10894         $cat <<EOM
10895 You seem to be either cross-compiling or doing a multiarchitecture build,
10896 skipping the memory alignment check.
10897
10898 EOM
10899         case "$alignbytes" in
10900         '') alignbytes=8 ;;
10901         esac
10902         ;;
10903 *)
10904         case "$alignbytes" in
10905         '') echo "Checking alignment constraints..." >&4
10906                 $cat >try.c <<'EOCP'
10907 struct foobar {
10908         char foo;
10909         double bar;
10910 } try_algn;
10911 int main()
10912 {
10913         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10914 }
10915 EOCP
10916                 set try
10917                 if eval $compile_ok; then
10918                         dflt=`./try`
10919                 else
10920                         dflt='8'
10921                         echo "(I can't seem to compile the test program...)"
10922                 fi
10923                 ;;
10924         *) dflt="$alignbytes"
10925                 ;;
10926         esac
10927         rp="Doubles must be aligned on a how-many-byte boundary?"
10928         . ./myread
10929         alignbytes="$ans"
10930         $rm -f try.c try
10931         ;;
10932 esac
10933
10934
10935 : check for ordering of bytes in a long
10936 echo " "
10937 case "$crosscompile$multiarch" in
10938 *$define*)
10939         $cat <<EOM
10940 You seem to be either cross-compiling or doing a multiarchitecture build,
10941 skipping the byteorder check.
10942
10943 EOM
10944         byteorder=''
10945         ;;
10946 *)
10947         case "$byteorder" in
10948         '')
10949                 $cat <<'EOM'
10950 In the following, larger digits indicate more significance.  A big-endian
10951 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10952 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10953 machines may have weird orders like 3412.  A Cray will report 87654321. If
10954 the test program works the default is probably right.
10955 I'm now running the test program...
10956 EOM
10957                 $cat >try.c <<'EOCP'
10958 #include <stdio.h>
10959 int main()
10960 {
10961         int i;
10962         union {
10963                 unsigned long l;
10964                 char c[sizeof(long)];
10965         } u;
10966
10967         if (sizeof(long) > 4)
10968                 u.l = (0x08070605L << 32) | 0x04030201L;
10969         else
10970                 u.l = 0x04030201L;
10971         for (i = 0; i < sizeof(long); i++)
10972                 printf("%c", u.c[i]+'0');
10973         printf("\n");
10974         exit(0);
10975 }
10976 EOCP
10977                 xxx_prompt=y
10978                 set try
10979                 if eval $compile && ./try > /dev/null; then
10980                         dflt=`./try`
10981                         case "$dflt" in
10982                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10983                                 echo "(The test program ran ok.)"
10984                                 echo "byteorder=$dflt"
10985                                 xxx_prompt=n
10986                         ;;
10987                         ????|????????) echo "(The test program ran ok.)" ;;
10988                         *) echo "(The test program didn't run right for some reason.)" ;;
10989                         esac
10990                 else
10991                         dflt='4321'
10992                         cat <<'EOM'
10993 (I can't seem to compile the test program.  Guessing big-endian...)
10994 EOM
10995                 fi
10996                 case "$xxx_prompt" in
10997                 y)
10998                         rp="What is the order of bytes in a long?"
10999                         . ./myread
11000                         byteorder="$ans"
11001                         ;;
11002                 *)      byteorder=$dflt
11003                         ;;
11004                 esac
11005                 ;;
11006         esac
11007         $rm -f try.c try
11008         ;;
11009 esac
11010
11011
11012 : how do we catenate cpp tokens here?
11013 echo " "
11014 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
11015 $cat >cpp_stuff.c <<'EOCP'
11016 #define RCAT(a,b)a/**/b
11017 #define ACAT(a,b)a ## b
11018 RCAT(Rei,ser)
11019 ACAT(Cir,cus)
11020 EOCP
11021 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
11022 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
11023         echo "Oh!  Smells like ANSI's been here." >&4
11024         echo "We can catify or stringify, separately or together!"
11025         cpp_stuff=42
11026 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
11027         echo "Ah, yes!  The good old days!" >&4
11028         echo "However, in the good old days we don't know how to stringify and"
11029         echo "catify at the same time."
11030         cpp_stuff=1
11031 else
11032         $cat >&4 <<EOM
11033 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
11034 to have to edit the values of CAT[2-5] in config.h...
11035 EOM
11036         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11037 fi
11038 $rm -f cpp_stuff.*
11039
11040 : see if this is a db.h system
11041 set db.h i_db
11042 eval $inhdr
11043
11044 case "$i_db" in
11045 $define)
11046         : Check db version.
11047         echo " "
11048         echo "Checking Berkeley DB version ..." >&4
11049         $cat >try.c <<EOCP
11050 #$d_const HASCONST
11051 #ifndef HASCONST
11052 #define const
11053 #endif
11054 #include <sys/types.h>
11055 #include <stdio.h>
11056 #include <db.h>
11057 int main()
11058 {
11059 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11060     int Major, Minor, Patch ;
11061     unsigned long Version ;
11062     (void)db_version(&Major, &Minor, &Patch) ;
11063     printf("You have Berkeley DB Version 2 or greater\n");
11064
11065     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11066                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11067     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11068                 Major, Minor, Patch) ;
11069
11070     /* check that db.h & libdb are compatible */
11071     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11072         printf("db.h and libdb are incompatible\n") ;
11073         exit(3);        
11074     }
11075
11076     printf("db.h and libdb are compatible\n") ;
11077
11078     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11079                 + DB_VERSION_PATCH ;
11080
11081     /* needs to be >= 2.3.4 */
11082     if (Version < 2003004) {
11083     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11084         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11085         exit(2);        
11086     }
11087
11088     exit(0);
11089 #else
11090 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11091     printf("You have Berkeley DB Version 1\n");
11092     exit(0);    /* DB version < 2: the coast is clear. */
11093 #else
11094     exit(1);    /* <db.h> not Berkeley DB? */
11095 #endif
11096 #endif
11097 }
11098 EOCP
11099         set try
11100         if eval $compile && ./try; then
11101                 echo 'Looks OK.' >&4
11102         else
11103                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11104                 i_db=$undef
11105                 case " $libs " in
11106                 *"-ldb "*)
11107                         : Remove db from list of libraries to use
11108                         echo "Removing unusable -ldb from library list" >&4
11109                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11110                         shift
11111                         libs="$*"
11112                         echo "libs = $libs" >&4
11113                         ;;
11114                 esac
11115         fi
11116         $rm -f try.*
11117         ;;
11118 esac
11119
11120 case "$i_db" in
11121 define)
11122         : Check the return type needed for hash 
11123         echo " "
11124         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11125         $cat >try.c <<EOCP
11126 #$d_const HASCONST
11127 #ifndef HASCONST
11128 #define const
11129 #endif
11130 #include <sys/types.h>
11131 #include <db.h>
11132
11133 #ifndef DB_VERSION_MAJOR
11134 u_int32_t hash_cb (ptr, size)
11135 const void *ptr;
11136 size_t size;
11137 {
11138 }
11139 HASHINFO info;
11140 int main()
11141 {
11142         info.hash = hash_cb;
11143 }
11144 #endif
11145 EOCP
11146         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11147                 if $contains warning try.out >>/dev/null 2>&1 ; then
11148                         db_hashtype='int'
11149                 else
11150                         db_hashtype='u_int32_t'
11151                 fi
11152         else
11153                 : XXX Maybe we should just give up here.
11154                 db_hashtype=u_int32_t
11155                 $cat try.out >&4
11156                 echo "Help:  I can't seem to compile the db test program." >&4
11157                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11158         fi
11159         $rm -f try.*
11160         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11161         ;;
11162 *)      db_hashtype=u_int32_t
11163         ;;
11164 esac
11165 case "$i_db" in
11166 define)
11167         : Check the return type needed for prefix 
11168         echo " "
11169         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11170         cat >try.c <<EOCP
11171 #$d_const HASCONST
11172 #ifndef HASCONST
11173 #define const
11174 #endif
11175 #include <sys/types.h>
11176 #include <db.h>
11177
11178 #ifndef DB_VERSION_MAJOR
11179 size_t prefix_cb (key1, key2)
11180 const DBT *key1;
11181 const DBT *key2;
11182 {
11183 }
11184 BTREEINFO info;
11185 int main()
11186 {
11187         info.prefix = prefix_cb;
11188 }
11189 #endif
11190 EOCP
11191         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11192                 if $contains warning try.out >>/dev/null 2>&1 ; then
11193                         db_prefixtype='int'
11194                 else
11195                         db_prefixtype='size_t'
11196                 fi
11197         else
11198                 db_prefixtype='size_t'
11199                 : XXX Maybe we should just give up here.
11200                 $cat try.out >&4
11201                 echo "Help:  I can't seem to compile the db test program." >&4
11202                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11203         fi
11204         $rm -f try.*
11205         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11206         ;;
11207 *)      db_prefixtype='size_t'
11208         ;;
11209 esac
11210
11211 : check for void type
11212 echo " "
11213 echo "Checking to see how well your C compiler groks the void type..." >&4
11214 case "$voidflags" in
11215 '')
11216         $cat >try.c <<'EOCP'
11217 #if TRY & 1
11218 void sub() {
11219 #else
11220 sub() {
11221 #endif
11222         extern void moo();      /* function returning void */
11223         void (*goo)();          /* ptr to func returning void */
11224 #if TRY & 8
11225         void *hue;              /* generic ptr */
11226 #endif
11227 #if TRY & 2
11228         void (*foo[10])();
11229 #endif
11230
11231 #if TRY & 4
11232         if(goo == moo) {
11233                 exit(0);
11234         }
11235 #endif
11236         exit(0);
11237 }
11238 int main() { sub(); }
11239 EOCP
11240         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11241                 voidflags=$defvoidused
11242         echo "Good.  It appears to support void to the level $package wants.">&4
11243                 if $contains warning .out >/dev/null 2>&1; then
11244                         echo "However, you might get some warnings that look like this:"
11245                         $cat .out
11246                 fi
11247         else
11248 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11249                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11250                         echo "It supports 1..."
11251                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11252                                 echo "It also supports 2..."
11253                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11254                                         voidflags=7
11255                                         echo "And it supports 4 but not 8 definitely."
11256                                 else
11257                                         echo "It doesn't support 4..."
11258                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11259                                                 voidflags=11
11260                                                 echo "But it supports 8."
11261                                         else
11262                                                 voidflags=3
11263                                                 echo "Neither does it support 8."
11264                                         fi
11265                                 fi
11266                         else
11267                                 echo "It does not support 2..."
11268                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11269                                         voidflags=13
11270                                         echo "But it supports 4 and 8."
11271                                 else
11272                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11273                                                 voidflags=5
11274                                                 echo "And it supports 4 but has not heard about 8."
11275                                         else
11276                                                 echo "However it supports 8 but not 4."
11277                                         fi
11278                                 fi
11279                         fi
11280                 else
11281                         echo "There is no support at all for void."
11282                         voidflags=0
11283                 fi
11284         fi
11285 esac
11286 case "$voidflags" in
11287 "$defvoidused") ;;
11288 *)      $cat >&4 <<'EOM'
11289   Support flag bits are:
11290     1: basic void declarations.
11291     2: arrays of pointers to functions returning void.
11292     4: operations between pointers to and addresses of void functions.
11293     8: generic void pointers.
11294 EOM
11295         dflt="$voidflags";
11296         rp="Your void support flags add up to what?"
11297         . ./myread
11298         voidflags="$ans"
11299         ;;
11300 esac
11301 $rm -f try.* .out
11302
11303
11304 : How can we generate normalized random numbers ?
11305 echo " "
11306 echo "Looking for a random number function..." >&4
11307 case "$randfunc" in
11308 '')
11309         if set drand48 val -f; eval $csym; $val; then
11310                 dflt="drand48"
11311                 echo "Good, found drand48()." >&4
11312         elif set random val -f; eval $csym; $val; then
11313                 dflt="random"
11314                 echo "OK, found random()." >&4
11315         else
11316                 dflt="rand"
11317                 echo "Yick, looks like I have to use rand()." >&4
11318         fi
11319         echo " "
11320         ;;
11321 *)
11322         dflt="$randfunc"
11323         ;;
11324 esac
11325 cont=true
11326
11327 case "$ccflags" in
11328 *-Dmy_rand=*|*-Dmy_srand=*)
11329         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11330         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11331         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11332         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11333         ;;
11334 esac
11335
11336 while $test "$cont"; do
11337         rp="Use which function to generate random numbers?"
11338         . ./myread
11339         if $test "$ans" = "$dflt"; then
11340                 : null
11341         else
11342                 randbits=''
11343         fi
11344         randfunc="$ans"
11345         if set $ans val -f; eval $csym; $val; then
11346                 cont=''
11347         else
11348                 dflt=y
11349                 rp="I cannot find function $ans. Use that name anyway?"
11350                 . ./myread
11351                 dflt=rand
11352                 case "$ans" in
11353                         [yY]*) cont='';;
11354                 esac
11355         fi
11356         case "$cont" in
11357         '')
11358                 case "$randfunc" in
11359                 drand48)
11360                         drand01="drand48()"
11361                         seedfunc="srand48"
11362                         randbits=48
11363                         randseedtype=long
11364                         ;;
11365                 rand|random)
11366                         case "$randbits" in
11367                         '')
11368 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11369                                 $cat >try.c <<EOCP
11370 #$i_unistd I_UNISTD
11371 #$i_stdlib I_STDLIB
11372 #include <stdio.h>
11373 #ifdef I_UNISTD
11374 #  include <unistd.h>
11375 #endif
11376 #ifdef I_STDLIB
11377 #  include <stdlib.h>
11378 #endif
11379 int main()
11380 {
11381         register int i;
11382         register unsigned long tmp;
11383         register unsigned long max = 0L;
11384
11385         for (i = 1000; i; i--) {
11386                 tmp = (unsigned long) $randfunc();
11387                 if (tmp > max) max = tmp;
11388         }
11389         for (i = 0; max; i++)
11390                 max /= 2;
11391         printf("%d\n",i);
11392 }
11393 EOCP
11394                                 set try
11395                                 if eval $compile_ok; then
11396                                         dflt=`try`
11397                                 else
11398                                         dflt='?'
11399                                         echo "(I can't seem to compile the test program...)"
11400                                 fi
11401                                 ;;
11402                         *)
11403                                 dflt="$randbits"
11404                                 ;;
11405                         esac
11406                         rp="How many bits does your $randfunc() function produce?"
11407                         . ./myread
11408                         randbits="$ans"
11409                         $rm -f try.c try
11410                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11411                         seedfunc="s$randfunc"
11412                         randseedtype=unsigned
11413                         ;;
11414                 *)
11415                         dflt="31"
11416                         rp="How many bits does your $randfunc() function produce?"
11417                         . ./myread
11418                         randbits="$ans"
11419                         seedfunc="s$randfunc"
11420                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11421                         if set $seedfunc val -f; eval $csym; $val; then
11422                                 echo "(Using $seedfunc() to seed random generator)"
11423                         else
11424                                 echo "(Warning: no $seedfunc() to seed random generator)"
11425                                 seedfunc=rand
11426                         fi
11427                         randseedtype=unsigned
11428                         ;;
11429                 esac
11430                 ;;
11431         esac
11432 done
11433
11434 echo " "
11435 echo "Determining whether or not we are on an EBCDIC system..." >&4
11436 $cat >tebcdic.c <<'EOM'
11437 int main()
11438 {
11439   if ('M'==0xd4) return 0;
11440   return 1;
11441 }
11442 EOM
11443
11444 val=$undef
11445 set tebcdic
11446 if eval $compile_ok; then
11447         if ./tebcdic; then
11448                 echo "You have EBCDIC." >&4
11449                 val="$define"
11450         else
11451                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin, or UTF." >&4
11452         fi
11453 else
11454         echo "I'm unable to compile the test program." >&4
11455         echo "I'll assume ASCII or some ISO Latin." >&4
11456 fi
11457 $rm -f tebcdic.c tebcdic
11458 set ebcdic
11459 eval $setvar
11460
11461 echo " "
11462 $cat >&4 <<EOM
11463 Checking how to flush all pending stdio output...
11464 EOM
11465 # I only know how to find the first 32 possibly open files on SunOS.
11466 # See also hints/sunos_4_1.sh and util.c  --AD
11467 case "$osname" in
11468 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11469 esac
11470 $cat >>try.c <<EOCP
11471 #include <stdio.h>
11472 #$i_unistd I_UNISTD
11473 #ifdef I_UNISTD
11474 # include <unistd.h>
11475 #endif
11476 #$d_sysconf HAS_SYSCONF
11477 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11478 #ifdef HAS_STDIO_STREAM_ARRAY
11479 # define STDIO_STREAM_ARRAY $stdio_stream_array
11480 #endif
11481 int main() {
11482   FILE* p = fopen("try.out", "w");
11483 #ifdef TRY_FPUTC
11484   fputc('x', p);
11485 #else
11486 # ifdef TRY_FPRINTF
11487   fprintf(p, "x");
11488 # endif
11489 #endif
11490 #ifdef TRY_FFLUSH_NULL
11491   fflush(NULL);
11492 #endif
11493 #ifdef TRY_FFLUSH_ALL
11494   {
11495     long open_max = -1;
11496 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11497     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11498 # else
11499 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11500     open_max = sysconf(_SC_OPEN_MAX);
11501 #  else
11502 #   ifdef FOPEN_MAX
11503     open_max = FOPEN_MAX;
11504 #   else
11505 #    ifdef OPEN_MAX
11506     open_max = OPEN_MAX;
11507 #    else
11508 #     ifdef _NFILE
11509     open_max = _NFILE;
11510 #     endif
11511 #    endif
11512 #   endif
11513 #  endif
11514 # endif 
11515 # ifdef HAS_STDIO_STREAM_ARRAY
11516     if (open_max > 0) {
11517       long i;
11518       for (i = 0; i < open_max; i++)
11519             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11520                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11521                 STDIO_STREAM_ARRAY[i]._flag)
11522                 fflush(&STDIO_STREAM_ARRAY[i]);
11523     }   
11524   }
11525 # endif
11526 #endif
11527   _exit(42);
11528 }
11529 EOCP
11530 : first we have to find out how _not_ to flush
11531 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11532     output=''
11533     set try -DTRY_FPUTC
11534     if eval $compile; then
11535             $rm -f try.out
11536             ./try$exe_ext 2>/dev/null
11537             if $test ! -s try.out -a "X$?" = X42; then
11538                 output=-DTRY_FPUTC
11539             fi
11540     fi
11541     case "$output" in
11542     '')
11543             set try -DTRY_FPRINTF
11544             $rm -f try.out
11545             if eval $compile; then
11546                     $rm -f try.out
11547                     ./try$exe_ext 2>/dev/null
11548                     if $test ! -s try.out -a "X$?" = X42; then
11549                         output=-DTRY_FPRINTF
11550                     fi
11551             fi
11552         ;;
11553     esac
11554 fi
11555 : check for fflush NULL behaviour
11556 case "$fflushNULL" in
11557 '')     set try -DTRY_FFLUSH_NULL $output
11558         if eval $compile; then
11559                 $rm -f try.out
11560                 ./try$exe_ext 2>/dev/null
11561                 code="$?"
11562                 if $test -s try.out -a "X$code" = X42; then
11563                         fflushNULL="`$cat try.out`"
11564                 else
11565                         if $test "X$code" != X42; then
11566                                 $cat >&4 <<EOM
11567 (If this test failed, don't worry, we'll try another method shortly.)
11568 EOM
11569                         fi
11570                 fi
11571         fi
11572         $rm -f core try.core core.try.*
11573         case "$fflushNULL" in
11574         x)      $cat >&4 <<EOM
11575 Your fflush(NULL) works okay.
11576 EOM
11577                 fflushNULL="$define"
11578                 ;;
11579         '')     $cat >&4 <<EOM
11580 Your fflush(NULL) isn't working (contrary to ANSI C).
11581 EOM
11582                 fflushNULL="$undef"
11583                 ;;
11584         *)      $cat >&4 <<EOM
11585 Cannot figure out whether your fflush(NULL) works or not.
11586 I'm assuming it doesn't (contrary to ANSI C).
11587 EOM
11588                 fflushNULL="$undef"
11589                 ;;
11590         esac
11591         ;;
11592 $define|true|[yY]*)
11593         fflushNULL="$define"
11594         ;;
11595 *)
11596         fflushNULL="$undef"
11597         ;;
11598 esac
11599 : check explicit looping only if NULL did not work
11600 case "$fflushNULL" in
11601 "$undef")
11602         : check for fflush all behaviour
11603         case "$fflushall" in
11604         '')     set try -DTRY_FFLUSH_ALL $output
11605                 if eval $compile; then
11606                         $cat >&4 <<EOM
11607 (Now testing the other method--but note that also this may fail.)
11608 EOM
11609                         $rm -f try.out
11610                         ./try$exe_ext 2>/dev/null
11611                         if $test -s try.out -a "X$?" = X42; then
11612                                 fflushall="`$cat try.out`"
11613                         fi
11614                 fi
11615                 $rm -f core try.core core.try.*
11616                 case "$fflushall" in
11617                 x)      $cat >&4 <<EOM
11618 Whew. Flushing explicitly all the stdio streams works.
11619 EOM
11620                         fflushall="$define"
11621                         ;;
11622                 '')     $cat >&4 <<EOM
11623 Sigh. Flushing explicitly all the stdio streams doesn't work.
11624 EOM
11625                         fflushall="$undef"
11626                         ;;
11627                 *)      $cat >&4 <<EOM
11628 Cannot figure out whether flushing stdio streams explicitly works or not.
11629 I'm assuming it doesn't.
11630 EOM
11631                         fflushall="$undef"
11632                         ;;
11633                 esac
11634                 ;;
11635         "$define"|true|[yY]*)
11636                 fflushall="$define"
11637                 ;;
11638         *)
11639                 fflushall="$undef"
11640                 ;;
11641         esac
11642         ;;
11643 *)      fflushall="$undef"      
11644         ;;
11645 esac
11646 case "$fflushNULL$fflushall" in
11647 undefundef)
11648         $cat <<EOM
11649 I cannot figure out how to flush pending stdio output.
11650 EOM
11651         ;;
11652 esac
11653 $rm -f try.* try$exe_ext
11654
11655 : see what type file positions are declared as in the library
11656 rp="What is the type for file position used by fsetpos()?"
11657 set fpos_t fpostype long stdio.h sys/types.h
11658 eval $typedef_ask
11659
11660 : Store the full pathname to the ar program for use in the C program
11661 : Respect a hint or command line value for full_ar.
11662 case "$full_ar" in
11663 '') full_ar=$ar ;;
11664 esac
11665
11666 : Store the full pathname to the sed program for use in the C program
11667 full_sed=$sed
11668
11669 : see what type gids are declared as in the kernel
11670 echo " "
11671 echo "Looking for the type for group ids returned by getgid()."
11672 set gid_t gidtype xxx stdio.h sys/types.h
11673 eval $typedef
11674 case "$gidtype" in
11675 xxx)
11676         xxx=`./findhdr sys/user.h`
11677         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11678         case $1 in
11679         unsigned) dflt="$1 $2" ;;
11680         *) dflt="$1" ;;
11681         esac
11682         ;;
11683 *) dflt="$gidtype";;
11684 esac
11685 case "$gidtype" in
11686 gid_t) echo "gid_t found." ;;
11687 *)      rp="What is the type for group ids returned by getgid()?"
11688         . ./myread
11689         gidtype="$ans"
11690         ;;
11691 esac
11692
11693 : see if getgroups exists
11694 set getgroups d_getgrps
11695 eval $inlibc
11696
11697 : see if setgroups exists
11698 set setgroups d_setgrps
11699 eval $inlibc
11700
11701
11702 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11703 echo " "
11704 case "$d_getgrps$d_setgrps" in
11705 *define*)
11706         case "$groupstype" in
11707         '') dflt="$gidtype" ;;
11708         *)  dflt="$groupstype" ;;
11709         esac
11710         $cat <<EOM
11711 What type of pointer is the second argument to getgroups() and setgroups()?
11712 Usually this is the same as group ids, $gidtype, but not always.
11713
11714 EOM
11715         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11716         . ./myread
11717         groupstype="$ans"
11718         ;;
11719 *)  groupstype="$gidtype";;
11720 esac
11721
11722 : see what type lseek is declared as in the kernel
11723 rp="What is the type used for lseek's offset on this system?"
11724 set off_t lseektype long stdio.h sys/types.h
11725 eval $typedef_ask
11726
11727 echo " "
11728 $echo $n "Checking to see how big your file offsets are...$c" >&4
11729 $cat >try.c <<EOCP
11730 #include <sys/types.h>
11731 #include <stdio.h>
11732 int main()
11733 {
11734         printf("%d\n", sizeof($lseektype));
11735 }
11736 EOCP
11737 set try
11738 if eval $compile_ok; then
11739         lseeksize=`./try`
11740         $echo " $lseeksize bytes." >&4
11741 else
11742         dflt='4'
11743         echo " "
11744         echo "(I can't seem to compile the test program.  Guessing...)"
11745         rp="What is the size of your file offsets (in bytes)?"
11746         . ./myread
11747         lseeksize="$ans"
11748 fi
11749 $rm -f try.c try
11750
11751 echo " "
11752 echo "Checking if your $make program sets \$(MAKE)..." >&4
11753 case "$make_set_make" in
11754 '')
11755         $sed 's/^X //' > testmake.mak << 'EOF'
11756 Xall:
11757 X       @echo 'maketemp="$(MAKE)"'
11758 EOF
11759         case "`$make -f testmake.mak 2>/dev/null`" in
11760         *maketemp=*) make_set_make='#' ;;
11761         *)      make_set_make="MAKE=$make" ;;
11762         esac
11763         $rm -f testmake.mak
11764         ;;
11765 esac
11766 case "$make_set_make" in
11767 '#') echo "Yup, it does.";;
11768 *) echo "Nope, it doesn't.";;
11769 esac
11770
11771 : see what type is used for mode_t
11772 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11773 set mode_t modetype int stdio.h sys/types.h
11774 eval $typedef_ask
11775
11776 : define a fucntion to check prototypes
11777 $cat > protochk <<EOSH
11778 $startsh
11779 cc="$cc"
11780 optimize="$optimize"
11781 ccflags="$ccflags"
11782 prototype="$prototype"
11783 define="$define"
11784 rm=$rm
11785 EOSH
11786
11787 $cat >> protochk <<'EOSH'
11788
11789 $rm -f try.c
11790 foo="$1"
11791 shift
11792 while test $# -ge 2; do
11793         case "$1" in
11794                 $define) echo "#include <$2>" >> try.c ;;
11795                 literal) echo "$2" >> try.c ;;
11796         esac
11797     shift 2
11798 done
11799 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11800 cat >> try.c <<'EOCP'
11801 #ifdef CAN_PROTOTYPE
11802 #define _(args) args
11803 #else
11804 #define _(args) ()
11805 #endif
11806 EOCP
11807 echo "$foo" >> try.c
11808 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11809 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11810 status=$?
11811 $rm -f try.[co]
11812 exit $status
11813 EOSH
11814 chmod +x protochk
11815 $eunicefix protochk
11816
11817 : see what type is used for size_t
11818 rp="What is the type used for the length parameter for string functions?"
11819 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11820 eval $typedef_ask
11821
11822 : check for type of arguments to gethostbyaddr. 
11823 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11824         case "$d_gethbyaddr" in
11825         $define)
11826                 $cat <<EOM
11827
11828 Checking to see what type of arguments are accepted by gethostbyaddr().
11829 EOM
11830                 hdrs="$define sys/types.h
11831                         $d_socket sys/socket.h 
11832                         $i_niin netinet/in.h 
11833                         $i_netdb netdb.h
11834                         $i_unistd unistd.h"
11835                 : The first arg can 'char *' or 'void *'
11836                 : The second arg is some of integral type
11837                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11838                         for yyy in size_t long int; do
11839                                 case "$netdb_host_type" in
11840                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11841                                         if ./protochk "$try" $hdrs; then
11842                                                 echo "Your system accepts $xxx for the first arg."
11843                                                 echo "...and $yyy for the second arg."
11844                                                 netdb_host_type="$xxx"
11845                                                 netdb_hlen_type="$yyy"
11846                                         fi
11847                                         ;;
11848                                 esac
11849                         done
11850                 done
11851                 : In case none of those worked, prompt the user.
11852                 case "$netdb_host_type" in
11853                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11854                         dflt='char *'
11855                         . ./myread
11856                         netdb_host_type=$ans
11857                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11858                         dflt="$sizetype"
11859                         . ./myread
11860                         netdb_hlen_type=$ans
11861                         ;;
11862                 esac
11863                 ;;
11864         *)      : no gethostbyaddr, so pick harmless defaults
11865                 netdb_host_type='char *'
11866                 netdb_hlen_type="$sizetype"
11867                 ;;
11868         esac
11869         # Remove the "const" if needed. -- but then we'll have a 
11870         # prototype clash!
11871         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11872 fi
11873
11874 : check for type of argument to gethostbyname. 
11875 if test "X$netdb_name_type" = X ; then
11876         case "$d_gethbyname" in
11877         $define)
11878                 $cat <<EOM
11879
11880 Checking to see what type of argument is accepted by gethostbyname().
11881 EOM
11882                 hdrs="$define sys/types.h
11883                         $d_socket sys/socket.h 
11884                         $i_niin netinet/in.h 
11885                         $i_netdb netdb.h
11886                         $i_unistd unistd.h"
11887                 for xxx in "const char *" "char *"; do
11888                         case "$netdb_name_type" in
11889                         '')     try="extern struct hostent *gethostbyname($xxx);"
11890                                 if ./protochk "$try" $hdrs; then
11891                                         echo "Your system accepts $xxx."
11892                                         netdb_name_type="$xxx"
11893                                 fi
11894                                 ;;
11895                         esac
11896                 done
11897                 : In case none of those worked, prompt the user.
11898                 case "$netdb_name_type" in
11899                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11900                         dflt='char *'
11901                         . ./myread
11902                         netdb_name_type=$ans
11903                         ;;
11904                 esac
11905                 ;;
11906         *)      : no gethostbyname, so pick harmless default
11907                 netdb_name_type='char *'
11908                 ;;
11909         esac
11910 fi
11911
11912 : check for type of 1st argument to getnetbyaddr. 
11913 if test "X$netdb_net_type" = X ; then
11914         case "$d_getnbyaddr" in
11915         $define)
11916                 $cat <<EOM
11917
11918 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11919 EOM
11920                 hdrs="$define sys/types.h
11921                         $d_socket sys/socket.h 
11922                         $i_niin netinet/in.h 
11923                         $i_netdb netdb.h
11924                         $i_unistd unistd.h"
11925                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11926                         case "$netdb_net_type" in
11927                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11928                                 if ./protochk "$try" $hdrs; then
11929                                         echo "Your system accepts $xxx."
11930                                         netdb_net_type="$xxx"
11931                                 fi
11932                                 ;;
11933                         esac
11934                 done
11935                 : In case none of those worked, prompt the user.
11936                 case "$netdb_net_type" in
11937                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11938                         dflt='long'
11939                         . ./myread
11940                         netdb_net_type=$ans
11941                         ;;
11942                 esac
11943                 ;;
11944         *)      : no getnetbyaddr, so pick harmless default
11945                 netdb_net_type='long'
11946                 ;;
11947         esac
11948 fi
11949 : locate the preferred pager for this system
11950 case "$pager" in
11951 '')
11952         dflt=''
11953         case "$pg" in
11954         /*) dflt=$pg;;
11955         esac
11956         case "$more" in
11957         /*) dflt=$more;;
11958         esac
11959         case "$less" in
11960         /*) dflt=$less;;
11961         esac
11962         case "$dflt" in
11963         '') dflt=/usr/ucb/more;;
11964         esac
11965         ;;
11966 *) dflt="$pager";;
11967 esac
11968 echo " "
11969 fn=f/
11970 rp='What pager is used on your system?'
11971 . ./getfile
11972 pager="$ans"
11973
11974 : see what type pids are declared as in the kernel
11975 rp="What is the type of process ids on this system?"
11976 set pid_t pidtype int stdio.h sys/types.h
11977 eval $typedef_ask
11978
11979 : check for length of pointer
11980 echo " "
11981 case "$ptrsize" in
11982 '')
11983         $echo $n "Checking to see how big your pointers are...$c" >&4
11984         if test "$voidflags" -gt 7; then
11985                 echo '#define VOID_PTR char *' > try.c
11986         else
11987                 echo '#define VOID_PTR void *' > try.c
11988         fi
11989         $cat >>try.c <<'EOCP'
11990 #include <stdio.h>
11991 int main()
11992 {
11993         printf("%d\n", sizeof(VOID_PTR));
11994         exit(0);
11995 }
11996 EOCP
11997         set try
11998         if eval $compile_ok; then
11999                 ptrsize=`./try`
12000                 $echo " $ptrsize bytes." >&4
12001         else
12002                 dflt='4'
12003                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
12004                 rp="What is the size of a pointer (in bytes)?"
12005                 . ./myread
12006                 ptrsize="$ans"
12007         fi
12008         ;;
12009 esac
12010 $rm -f try.c try
12011
12012 : see if ar generates random libraries by itself
12013 echo " "
12014 echo "Checking how to generate random libraries on your machine..." >&4
12015 echo 'int bar1() { return bar2(); }' > bar1.c
12016 echo 'int bar2() { return 2; }' > bar2.c
12017 $cat > foo.c <<'EOP'
12018 int main() { printf("%d\n", bar1()); exit(0); }
12019 EOP
12020 $cc $ccflags -c bar1.c >/dev/null 2>&1
12021 $cc $ccflags -c bar2.c >/dev/null 2>&1
12022 $cc $ccflags -c foo.c >/dev/null 2>&1
12023 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
12024 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12025         ./foobar >/dev/null 2>&1; then
12026         echo "$ar appears to generate random libraries itself."
12027         orderlib=false
12028         ranlib=":"
12029 elif $ar ts bar$_a >/dev/null 2>&1 &&
12030         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12031         ./foobar >/dev/null 2>&1; then
12032                 echo "a table of contents needs to be added with '$ar ts'."
12033                 orderlib=false
12034                 ranlib="$ar ts"
12035 else
12036         case "$ranlib" in
12037         :) ranlib='';;
12038         '')
12039                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12040                 $test -f $ranlib || ranlib=''
12041                 ;;
12042         esac
12043         if $test -n "$ranlib"; then
12044                 echo "your system has '$ranlib'; we'll use that."
12045                 orderlib=false
12046         else
12047                 echo "your system doesn't seem to support random libraries"
12048                 echo "so we'll use lorder and tsort to order the libraries."
12049                 orderlib=true
12050                 ranlib=":"
12051         fi
12052 fi
12053 $rm -f foo* bar* 
12054
12055 : check for type of arguments to select. 
12056 case "$selecttype" in
12057 '') case "$d_select" in
12058         $define)
12059                 $cat <<EOM
12060 Checking to see what type of arguments are accepted by select().
12061 EOM
12062                 hdrs="$define sys/types.h
12063                         $i_systime sys/time.h 
12064                         $i_sysselct sys/select.h
12065                         $d_socket sys/socket.h"
12066                 : The first arg can be int, unsigned, or size_t
12067                 : The last arg may or may not be 'const'
12068                 val=''
12069                 : void pointer has been seen but using that
12070                 : breaks the selectminbits test
12071                 for xxx in 'fd_set *' 'int *'; do
12072                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12073                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12074                                         case "$val" in
12075                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12076                                                 if ./protochk "$try" $hdrs; then
12077                                                         echo "Your system accepts $xxx."
12078                                                         val="$xxx"
12079                                                 fi
12080                                                 ;;
12081                                         esac
12082                                 done
12083                         done
12084                 done
12085                 case "$val" in
12086                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12087                         case "$d_fd_set" in
12088                                 $define) dflt="fd_set *" ;;
12089                                 *)              dflt="int *" ;;
12090                         esac
12091                         . ./myread
12092                         val=$ans
12093                         ;;
12094                 esac
12095                 selecttype="$val"
12096                 ;;
12097         *)      : no select, so pick a harmless default
12098                 selecttype='int *'
12099                 ;;
12100         esac
12101         ;;
12102 esac
12103
12104 : check for the select 'width'
12105 case "$selectminbits" in
12106 '') case "$d_select" in
12107         $define)
12108                 $cat <<EOM
12109
12110 Checking to see on how many bits at a time your select() operates...
12111 EOM
12112                 $cat >try.c <<EOCP
12113 #include <sys/types.h>
12114 #$i_time I_TIME
12115 #$i_systime I_SYS_TIME
12116 #$i_systimek I_SYS_TIME_KERNEL
12117 #ifdef I_TIME
12118 #   include <time.h>
12119 #endif
12120 #ifdef I_SYS_TIME
12121 #   ifdef I_SYS_TIME_KERNEL
12122 #       define KERNEL
12123 #   endif
12124 #   include <sys/time.h>
12125 #   ifdef I_SYS_TIME_KERNEL
12126 #       undef KERNEL
12127 #   endif
12128 #endif
12129 #$i_sysselct I_SYS_SELECT
12130 #ifdef I_SYS_SELECT
12131 #include <sys/select.h>
12132 #endif
12133 #$d_socket HAS_SOCKET
12134 #ifdef HAS_SOCKET
12135 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12136 #endif
12137 #include <stdio.h>
12138 $selecttype b;
12139 #define S sizeof(*(b))
12140 #define MINBITS 64
12141 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12142 #define NBITS  (NBYTES * 8)
12143 int main() {
12144     char s[NBYTES];
12145     struct timeval t;
12146     int i;
12147     FILE* fp;
12148     int fd;
12149
12150     fclose(stdin);
12151     fp = fopen("try.c", "r");
12152     if (fp == 0)
12153       exit(1);
12154     fd = fileno(fp);
12155     if (fd < 0)
12156       exit(2);
12157     b = ($selecttype)s;
12158     for (i = 0; i < NBITS; i++)
12159         FD_SET(i, b);
12160     t.tv_sec  = 0;
12161     t.tv_usec = 0;
12162     select(fd + 1, b, 0, 0, &t);
12163     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12164     printf("%d\n", i + 1);
12165     return 0;
12166 }
12167 EOCP
12168                 set try
12169                 if eval $compile_ok; then
12170                         selectminbits=`./try`
12171                         case "$selectminbits" in
12172                         '')     cat >&4 <<EOM
12173 Cannot figure out on how many bits at a time your select() operates.
12174 I'll play safe and guess it is 32 bits.
12175 EOM
12176                                 selectminbits=32
12177                                 bits="32 bits"
12178                                 ;;
12179                         1)      bits="1 bit" ;;
12180                         *)      bits="$selectminbits bits" ;;
12181                         esac
12182                         echo "Your select() operates on $bits at a time." >&4
12183                 else
12184                         rp='What is the minimum number of bits your select() operates on?'
12185                         case "$byteorder" in
12186                         1234|12345678)  dflt=32 ;;
12187                         *)              dflt=1  ;;
12188                         esac
12189                         . ./myread
12190                         val=$ans
12191                         selectminbits="$val"
12192                 fi
12193                 $rm -f try.* try
12194                 ;;
12195         *)      : no select, so pick a harmless default
12196                 selectminbits='32'
12197                 ;;
12198         esac
12199         ;;
12200 esac
12201
12202 : Trace out the files included by signal.h, then look for SIGxxx names.
12203 : Remove SIGARRAYSIZE used by HPUX.
12204 : Remove SIGSTKSIZE used by Linux.
12205 : Remove SIGSTKSZ used by Posix.
12206 : Remove SIGTYP void lines used by OS2.
12207 xxx=`echo '#include <signal.h>' |
12208         $cppstdin $cppminus $cppflags 2>/dev/null |
12209         $grep '^[       ]*#.*include' | 
12210         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12211 : Check this list of files to be sure we have parsed the cpp output ok.
12212 : This will also avoid potentially non-existent files, such 
12213 : as ../foo/bar.h
12214 xxxfiles=''
12215 for xx in $xxx /dev/null ; do
12216         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12217 done
12218 : If we have found no files, at least try signal.h
12219 case "$xxxfiles" in
12220 '')     xxxfiles=`./findhdr signal.h` ;;
12221 esac
12222 xxx=`awk '
12223 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12224         print substr($2, 4, 20)
12225 }
12226 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12227         print substr($3, 4, 20)
12228 }' $xxxfiles`
12229 : Append some common names just in case the awk scan failed.
12230 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12231 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12232 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12233 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12234 : generate a few handy files for later
12235 $cat > signal.c <<'EOCP'
12236 #include <sys/types.h>
12237 #include <signal.h>
12238 #include <stdio.h>
12239 int main() {
12240
12241 /* Strange style to avoid deeply-nested #if/#else/#endif */
12242 #ifndef NSIG
12243 #  ifdef _NSIG
12244 #    define NSIG (_NSIG)
12245 #  endif
12246 #endif
12247
12248 #ifndef NSIG
12249 #  ifdef SIGMAX
12250 #    define NSIG (SIGMAX+1)
12251 #  endif
12252 #endif
12253
12254 #ifndef NSIG
12255 #  ifdef SIG_MAX
12256 #    define NSIG (SIG_MAX+1)
12257 #  endif
12258 #endif
12259
12260 #ifndef NSIG
12261 #  ifdef MAXSIG
12262 #    define NSIG (MAXSIG+1)
12263 #  endif
12264 #endif
12265
12266 #ifndef NSIG
12267 #  ifdef MAX_SIG
12268 #    define NSIG (MAX_SIG+1)
12269 #  endif
12270 #endif
12271
12272 #ifndef NSIG
12273 #  ifdef SIGARRAYSIZE
12274 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12275 #  endif
12276 #endif
12277
12278 #ifndef NSIG
12279 #  ifdef _sys_nsig
12280 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12281 #  endif
12282 #endif
12283
12284 /* Default to some arbitrary number that's big enough to get most
12285    of the common signals.
12286 */
12287 #ifndef NSIG
12288 #    define NSIG 50
12289 #endif
12290
12291 printf("NSIG %d\n", NSIG);
12292
12293 #ifndef JUST_NSIG
12294
12295 EOCP
12296
12297 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12298 {
12299         printf "#ifdef SIG"; printf $1; printf "\n"
12300         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12301         printf $1; printf ");\n"
12302         printf "#endif\n"
12303 }
12304 END {
12305         printf "#endif /* JUST_NSIG */\n";
12306         printf "}\n";
12307 }
12308 ' >>signal.c
12309 $cat >signal.awk <<'EOP'
12310 BEGIN { ndups = 0 }
12311 $1 ~ /^NSIG$/ { nsig = $2 }
12312 ($1 !~ /^NSIG$/) && (NF == 2) {
12313     if ($2 > maxsig) { maxsig = $2 }
12314     if (sig_name[$2]) {
12315         dup_name[ndups] = $1
12316         dup_num[ndups] = $2
12317         ndups++ 
12318     }
12319     else {
12320         sig_name[$2] = $1
12321         sig_num[$2] = $2
12322     }
12323 }
12324 END { 
12325     if (nsig == 0) {
12326         nsig = maxsig + 1
12327     }
12328     printf("NSIG %d\n", nsig);
12329     for (n = 1; n < nsig; n++) {
12330         if (sig_name[n]) {
12331             printf("%s %d\n", sig_name[n], sig_num[n])
12332         }
12333         else {
12334             printf("NUM%d %d\n", n, n) 
12335         }
12336     }
12337     for (n = 0; n < ndups; n++) {
12338         printf("%s %d\n", dup_name[n], dup_num[n])
12339     }
12340 }
12341 EOP
12342 $cat >signal_cmd <<EOS
12343 $startsh
12344 if $test -s signal.lst; then
12345     echo "Using your existing signal.lst file"
12346         exit 0
12347 fi
12348 xxx="$xxx"
12349 EOS
12350 $cat >>signal_cmd <<'EOS'
12351
12352 set signal
12353 if eval $compile_ok; then
12354         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12355 else
12356         echo "(I can't seem be able to compile the whole test program)" >&4
12357         echo "(I'll try it in little pieces.)" >&4
12358         set signal -DJUST_NSIG
12359         if eval $compile_ok; then
12360                 ./signal$_exe > signal.nsg
12361                 $cat signal.nsg
12362         else
12363                 echo "I can't seem to figure out how many signals you have." >&4
12364                 echo "Guessing 50." >&4
12365                 echo 'NSIG 50' > signal.nsg
12366         fi
12367         : Now look at all the signal names, one at a time.
12368         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12369                 $cat > signal.c <<EOCP
12370 #include <sys/types.h>
12371 #include <signal.h>
12372 #include <stdio.h>
12373 int main() {
12374 printf("$xx %d\n", SIG${xx});
12375 return 0;
12376 }
12377 EOCP
12378                 set signal
12379                 if eval $compile; then
12380                         echo "SIG${xx} found."
12381                         ./signal$_exe  >> signal.ls1
12382                 else
12383                         echo "SIG${xx} NOT found."
12384                 fi
12385         done
12386         if $test -s signal.ls1; then
12387                 $cat signal.nsg signal.ls1 |
12388                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12389         fi
12390
12391 fi
12392 if $test -s signal.lst; then
12393         :
12394 else
12395         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12396         echo 'kill -l' >signal
12397         set X `csh -f <signal`
12398         $rm -f signal
12399         shift
12400         case $# in
12401         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12402         esac
12403         echo $@ | $tr ' ' $trnl | \
12404             $awk '{ printf "%s %d\n", $1, ++s; }
12405                   END { printf "NSIG %d\n", ++s }' >signal.lst
12406 fi
12407 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12408 EOS
12409 chmod a+x signal_cmd
12410 $eunicefix signal_cmd
12411
12412 : generate list of signal names
12413 echo " "
12414 case "$sig_name_init" in
12415 '') doinit=yes ;;
12416 *)  case "$sig_num_init" in
12417     ''|*,*) doinit=yes ;;
12418     esac ;;
12419 esac
12420 case "$doinit" in
12421 yes)
12422         echo "Generating a list of signal names and numbers..." >&4
12423         . ./signal_cmd
12424         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12425         sig_name=`$awk 'BEGIN { printf "ZERO " }
12426                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12427         sig_num=`$awk  'BEGIN { printf "0 " }
12428                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12429         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12430                              !/^NSIG/   { printf "\"%s\", ", $1 }
12431                              END        { printf "0\n" }' signal.lst`
12432         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12433                              !/^NSIG/   { printf "%d, ", $2}
12434                              END        { printf "0\n"}' signal.lst`
12435         ;;
12436 esac
12437 echo "The following $sig_count signals are available:"
12438 echo " "
12439 echo $sig_name | $awk \
12440 'BEGIN { linelen = 0 }
12441 {
12442         for (i = 1; i <= NF; i++) {
12443                 name = "SIG" $i " "
12444                 linelen = linelen + length(name)
12445                 if (linelen > 70) {
12446                         printf "\n"
12447                         linelen = length(name)
12448                 }
12449                 printf "%s", name
12450         }
12451         printf "\n"
12452 }'
12453 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12454
12455 : see what type is used for signed size_t
12456 set ssize_t ssizetype int stdio.h sys/types.h
12457 eval $typedef
12458 dflt="$ssizetype"
12459 $cat > ssize.c <<EOM
12460 #include <stdio.h>
12461 #include <sys/types.h>
12462 #define Size_t $sizetype
12463 #define SSize_t $dflt
12464 int main()
12465 {
12466         if (sizeof(Size_t) == sizeof(SSize_t))
12467                 printf("$dflt\n");
12468         else if (sizeof(Size_t) == sizeof(int))
12469                 printf("int\n");
12470         else 
12471                 printf("long\n");
12472         exit(0);
12473 }
12474 EOM
12475 echo " "
12476 set ssize
12477 if eval $compile_ok && ./ssize > /dev/null; then
12478         ssizetype=`./ssize`
12479         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12480 else
12481         $cat >&4 <<EOM
12482 Help! I can't compile and run the ssize_t test program: please enlighten me!
12483 (This is probably a misconfiguration in your system or libraries, and
12484 you really ought to fix it.  Still, I'll try anyway.)
12485
12486 I need a type that is the same size as $sizetype, but is guaranteed to
12487 be signed.  Common values are ssize_t, int and long.
12488
12489 EOM
12490         rp="What signed type is the same size as $sizetype?"
12491         . ./myread
12492         ssizetype="$ans"
12493 fi
12494 $rm -f ssize ssize.*
12495
12496 : see what type of char stdio uses.
12497 echo " "
12498 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12499         echo "Your stdio uses unsigned chars." >&4
12500         stdchar="unsigned char"
12501 else
12502         echo "Your stdio uses signed chars." >&4
12503         stdchar="char"
12504 fi
12505
12506 : see if time exists
12507 echo " "
12508 if test "X$d_time" = X -o X"$timetype" = X; then
12509     if set time val -f d_time; eval $csym; $val; then
12510                 echo 'time() found.' >&4
12511                 val="$define"
12512                 rp="What is the type returned by time() on this system?"
12513                 set time_t timetype long stdio.h sys/types.h
12514                 eval $typedef_ask
12515     else
12516                 echo 'time() not found, hope that will do.' >&4
12517                 val="$undef"
12518                 timetype='int';
12519     fi
12520     set d_time
12521     eval $setvar
12522 fi
12523
12524 : see what type uids are declared as in the kernel
12525 echo " "
12526 echo "Looking for the type for user ids returned by getuid()."
12527 set uid_t uidtype xxx stdio.h sys/types.h
12528 eval $typedef
12529 case "$uidtype" in
12530 xxx)
12531         xxx=`./findhdr sys/user.h`
12532         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12533         case $1 in
12534         unsigned) dflt="$1 $2" ;;
12535         *) dflt="$1" ;;
12536         esac
12537         ;;
12538 *) dflt="$uidtype";;
12539 esac
12540 case "$uidtype" in
12541 uid_t)  echo "uid_t found." ;;
12542 *)      rp="What is the type for user ids returned by getuid()?"
12543         . ./myread
12544         uidtype="$ans"
12545         ;;
12546 esac
12547
12548 : see if dbm.h is available
12549 : see if dbmclose exists
12550 set dbmclose d_dbmclose
12551 eval $inlibc
12552
12553 case "$d_dbmclose" in
12554 $define)
12555         set dbm.h i_dbm
12556         eval $inhdr
12557         case "$i_dbm" in
12558         $define)
12559                 val="$undef"
12560                 set i_rpcsvcdbm
12561                 eval $setvar
12562                 ;;
12563         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12564                 eval $inhdr
12565                 ;;
12566         esac
12567         ;;
12568 *)      echo "We won't be including <dbm.h>"
12569         val="$undef"
12570         set i_dbm
12571         eval $setvar
12572         val="$undef"
12573         set i_rpcsvcdbm
12574         eval $setvar
12575         ;;
12576 esac
12577
12578 : see if this is a sys/file.h system
12579 val=''
12580 set sys/file.h val
12581 eval $inhdr
12582
12583 : do we need to include sys/file.h ?
12584 case "$val" in
12585 "$define")
12586         echo " "
12587         if $h_sysfile; then
12588                 val="$define"
12589                 echo "We'll be including <sys/file.h>." >&4
12590         else
12591                 val="$undef"
12592                 echo "We won't be including <sys/file.h>." >&4
12593         fi
12594         ;;
12595 *)
12596         h_sysfile=false
12597         ;;
12598 esac
12599 set i_sysfile
12600 eval $setvar
12601
12602 : see if fcntl.h is there
12603 val=''
12604 set fcntl.h val
12605 eval $inhdr
12606
12607 : see if we can include fcntl.h
12608 case "$val" in
12609 "$define")
12610         echo " "
12611         if $h_fcntl; then
12612                 val="$define"
12613                 echo "We'll be including <fcntl.h>." >&4
12614         else
12615                 val="$undef"
12616                 if $h_sysfile; then
12617         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12618                 else
12619                         echo "We won't be including <fcntl.h>." >&4
12620                 fi
12621         fi
12622         ;;
12623 *)
12624         h_fcntl=false
12625         val="$undef"
12626         ;;
12627 esac
12628 set i_fcntl
12629 eval $setvar
12630
12631 : see if locale.h is available
12632 set locale.h i_locale
12633 eval $inhdr
12634
12635 : see if mach cthreads are available
12636 if test "X$usethreads" = "X$define"; then
12637         set mach/cthreads.h i_machcthr
12638         eval $inhdr
12639 else
12640         i_machcthr="$undef"
12641 fi
12642
12643
12644
12645 : see if this is a math.h system
12646 set math.h i_math
12647 eval $inhdr
12648
12649 : see if this is a mntent.h system
12650 set mntent.h i_mntent
12651 eval $inhdr
12652
12653 : see if ndbm.h is available
12654 set ndbm.h t_ndbm
12655 eval $inhdr
12656 case "$t_ndbm" in
12657 $define)
12658         : see if dbm_open exists
12659         set dbm_open d_dbm_open
12660         eval $inlibc
12661         case "$d_dbm_open" in
12662         $undef)
12663                 t_ndbm="$undef"
12664                 echo "We won't be including <ndbm.h>"
12665                 ;;
12666         esac
12667         ;;
12668 esac
12669 val="$t_ndbm"
12670 set i_ndbm
12671 eval $setvar
12672
12673 : see if net/errno.h is available
12674 val=''
12675 set net/errno.h val
12676 eval $inhdr
12677
12678 : Unfortunately, it causes problems on some systems.  Arrgh.
12679 case "$val" in
12680 $define)
12681         cat > try.c <<'EOM'
12682 #include <stdio.h>
12683 #include <errno.h>
12684 #include <net/errno.h>
12685 int func()
12686 {
12687         return ENOTSOCK;
12688 }
12689 EOM
12690         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12691                 echo "We'll be including <net/errno.h>." >&4
12692         else
12693                 echo "We won't be including <net/errno.h>." >&4
12694                 val="$undef"
12695         fi
12696         $rm -f try.* try
12697         ;;
12698 esac
12699 set i_neterrno
12700 eval $setvar
12701
12702 : see if netinet/tcp.h is available
12703 set netinet/tcp.h i_netinettcp
12704 eval $inhdr
12705
12706 : see if this is a poll.h system
12707 set poll.h i_poll
12708 eval $inhdr
12709
12710 : get C preprocessor symbols handy
12711 echo " "
12712 $echo $n "Hmm... $c"
12713 echo $al | $tr ' ' $trnl >Cppsym.know
12714 $cat <<EOSS >Cppsym
12715 $startsh
12716 case "\$1" in
12717 -l) list=true
12718         shift
12719         ;;
12720 esac
12721 unknown=''
12722 case "\$list\$#" in
12723 1|2)
12724         for sym do
12725                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12726                         exit 0
12727                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12728                         :
12729                 else
12730                         unknown="\$unknown \$sym"
12731                 fi
12732         done
12733         set X \$unknown
12734         shift
12735         ;;
12736 esac
12737 case \$# in
12738 0) exit 1;;
12739 esac
12740 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12741 #ifdef \1\\
12742 exit 0; _ _ _ _\1\\      \1\\
12743 #endif\\
12744 /' >Cppsym\$\$
12745 echo "exit 1; _ _ _" >>Cppsym\$\$
12746 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12747 case "\$list" in
12748 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12749 *)
12750         sh Cppsym2\$\$
12751         status=\$?
12752         ;;
12753 esac
12754 $rm -f Cppsym\$\$ Cppsym2\$\$
12755 exit \$status
12756 EOSS
12757 chmod +x Cppsym
12758 $eunicefix Cppsym
12759 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12760
12761 : now check the C compiler for additional symbols
12762 postprocess_cc_v=''
12763 case "$osname" in
12764 aix) postprocess_cc_v="|$tr , ' '" ;;
12765 esac
12766 $cat >ccsym <<EOS
12767 $startsh
12768 $cat >tmp.c <<EOF
12769 extern int foo;
12770 EOF
12771 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12772 do
12773         case "\$i" in
12774         -D*) echo "\$i" | $sed 's/^-D//';;
12775         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12776         esac
12777 done
12778 $rm -f try.c
12779 EOS
12780 postprocess_cc_v=''
12781 chmod +x ccsym
12782 $eunicefix ccsym
12783 ./ccsym > ccsym1.raw
12784 if $test -s ccsym1.raw; then
12785        $sort ccsym1.raw | $uniq >ccsym.raw
12786 else
12787        mv ccsym1.raw ccsym.raw
12788 fi
12789
12790 $awk '/\=/ { print $0; next }
12791         { print $0"=1" }' ccsym.raw >ccsym.list
12792 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12793 $comm -13 ccsym.true ccsym.list >ccsym.own
12794 $comm -12 ccsym.true ccsym.list >ccsym.com
12795 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12796 also=''
12797 if $test -z ccsym.raw; then
12798         echo "Your C compiler doesn't seem to define any symbols!" >&4
12799         echo " "
12800         echo "However, your C preprocessor defines the following symbols:"
12801         $cat Cppsym.true
12802         ccsymbols=''
12803         cppsymbols=`$cat Cppsym.true`
12804         cppsymbols=`echo $cppsymbols`
12805         cppccsymbols="$cppsymbols"
12806 else
12807         if $test -s ccsym.com; then
12808                 echo "Your C compiler and pre-processor define these symbols:"
12809                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12810                 also='also '
12811                 symbols='ones'
12812                 cppccsymbols=`$cat ccsym.com`
12813                 cppccsymbols=`echo $cppccsymbols`
12814                 $test "$silent" || sleep 1
12815         fi
12816         if $test -s ccsym.cpp; then
12817                 $test "$also" && echo " "
12818                 echo "Your C pre-processor ${also}defines the following symbols:"
12819                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12820                 also='further '
12821                 cppsymbols=`$cat ccsym.cpp`
12822                 cppsymbols=`echo $cppsymbols`
12823                 $test "$silent" || sleep 1
12824         fi
12825         if $test -s ccsym.own; then
12826                 $test "$also" && echo " "
12827                 echo "Your C compiler ${also}defines the following cpp symbols:"
12828                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12829                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12830                 ccsymbols=`$cat ccsym.own`
12831                 ccsymbols=`echo $ccsymbols`
12832                 $test "$silent" || sleep 1
12833         fi
12834 fi
12835 $rm -f ccsym*
12836
12837 : see if this is a termio system
12838 val="$undef"
12839 val2="$undef"
12840 val3="$undef"
12841 if $test `./findhdr termios.h`; then
12842         set tcsetattr i_termios
12843         eval $inlibc
12844         val3="$i_termios"
12845 fi
12846 echo " "
12847 case "$val3" in
12848 "$define") echo "You have POSIX termios.h... good!" >&4;;
12849 *) if ./Cppsym pyr; then
12850                 case "`/bin/universe`" in
12851                 ucb) if $test `./findhdr sgtty.h`; then
12852                                 val2="$define"
12853                                 echo "<sgtty.h> found." >&4
12854                         else
12855                                 echo "System is pyramid with BSD universe."
12856                                 echo "<sgtty.h> not found--you could have problems." >&4
12857                         fi;;
12858                 *) if $test `./findhdr termio.h`; then
12859                                 val="$define"
12860                                 echo "<termio.h> found." >&4
12861                         else
12862                                 echo "System is pyramid with USG universe."
12863                                 echo "<termio.h> not found--you could have problems." >&4
12864                         fi;;
12865                 esac
12866         elif ./usg; then
12867                 if $test `./findhdr termio.h`; then
12868                         echo "<termio.h> found." >&4
12869                         val="$define"
12870                 elif $test `./findhdr sgtty.h`; then
12871                         echo "<sgtty.h> found." >&4
12872                         val2="$define"
12873                 else
12874 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12875                 fi
12876         else
12877                 if $test `./findhdr sgtty.h`; then
12878                         echo "<sgtty.h> found." >&4
12879                         val2="$define"
12880                 elif $test `./findhdr termio.h`; then
12881                         echo "<termio.h> found." >&4
12882                         val="$define"
12883                 else
12884 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12885                 fi
12886         fi;;
12887 esac
12888 set i_termio; eval $setvar
12889 val=$val2; set i_sgtty; eval $setvar
12890 val=$val3; set i_termios; eval $setvar
12891
12892 : see if this is a shadow.h system
12893 set shadow.h i_shadow
12894 eval $inhdr
12895
12896 : see if this is a socks.h system
12897 set socks.h i_socks
12898 eval $inhdr
12899
12900 : see if stdarg is available
12901 echo " "
12902 if $test `./findhdr stdarg.h`; then
12903         echo "<stdarg.h> found." >&4
12904         valstd="$define"
12905 else
12906         echo "<stdarg.h> NOT found." >&4
12907         valstd="$undef"
12908 fi
12909
12910 : see if varags is available
12911 echo " "
12912 if $test `./findhdr varargs.h`; then
12913         echo "<varargs.h> found." >&4
12914 else
12915         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12916 fi
12917
12918 : set up the varargs testing programs
12919 $cat > varargs.c <<EOP
12920 #ifdef I_STDARG
12921 #include <stdarg.h>
12922 #endif
12923 #ifdef I_VARARGS
12924 #include <varargs.h>
12925 #endif
12926
12927 #ifdef I_STDARG
12928 int f(char *p, ...)
12929 #else
12930 int f(va_alist)
12931 va_dcl
12932 #endif
12933 {
12934         va_list ap;
12935 #ifndef I_STDARG
12936         char *p;
12937 #endif
12938 #ifdef I_STDARG
12939         va_start(ap,p);
12940 #else
12941         va_start(ap);
12942         p = va_arg(ap, char *);
12943 #endif
12944         va_end(ap);
12945 }
12946 EOP
12947 $cat > varargs <<EOP
12948 $startsh
12949 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12950         echo "true"
12951 else
12952         echo "false"
12953 fi
12954 $rm -f varargs$_o
12955 EOP
12956 chmod +x varargs
12957
12958 : now check which varargs header should be included
12959 echo " "
12960 i_varhdr=''
12961 case "$valstd" in
12962 "$define")
12963         if `./varargs I_STDARG`; then
12964                 val='stdarg.h'
12965         elif `./varargs I_VARARGS`; then
12966                 val='varargs.h'
12967         fi
12968         ;;
12969 *)
12970         if `./varargs I_VARARGS`; then
12971                 val='varargs.h'
12972         fi
12973         ;;
12974 esac
12975 case "$val" in
12976 '')
12977 echo "I could not find the definition for va_dcl... You have problems..." >&4
12978         val="$undef"; set i_stdarg; eval $setvar
12979         val="$undef"; set i_varargs; eval $setvar
12980         ;;
12981 *) 
12982         set i_varhdr
12983         eval $setvar
12984         case "$i_varhdr" in
12985         stdarg.h)
12986                 val="$define"; set i_stdarg; eval $setvar
12987                 val="$undef"; set i_varargs; eval $setvar
12988                 ;;
12989         varargs.h)
12990                 val="$undef"; set i_stdarg; eval $setvar
12991                 val="$define"; set i_varargs; eval $setvar
12992                 ;;
12993         esac
12994         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12995 esac
12996 $rm -f varargs*
12997
12998 : see if stddef is available
12999 set stddef.h i_stddef
13000 eval $inhdr
13001
13002 : see if sys/access.h is available
13003 set sys/access.h i_sysaccess
13004 eval $inhdr
13005
13006 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
13007 set sys/filio.h i_sysfilio
13008 eval $inhdr
13009 echo " "
13010 if $test `./findhdr sys/ioctl.h`; then
13011         val="$define"
13012         echo '<sys/ioctl.h> found.' >&4
13013 else
13014         val="$undef"
13015         if $test $i_sysfilio = "$define"; then
13016             echo '<sys/ioctl.h> NOT found.' >&4
13017         else
13018                 $test $i_sgtty = "$define" && xxx="sgtty.h"
13019                 $test $i_termio = "$define" && xxx="termio.h"
13020                 $test $i_termios = "$define" && xxx="termios.h"
13021 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
13022         fi
13023 fi
13024 set i_sysioctl
13025 eval $setvar
13026
13027 : see if sys/resource.h has to be included
13028 set sys/resource.h i_sysresrc
13029 eval $inhdr
13030
13031 : see if sys/security.h is available
13032 set sys/security.h i_syssecrt
13033 eval $inhdr
13034
13035 : see if this is a sys/statvfs.h system
13036 set sys/statvfs.h i_sysstatvfs
13037 eval $inhdr
13038
13039 : see if this is a sys/un.h system
13040 set sys/un.h i_sysun
13041 eval $inhdr
13042
13043 : see if this is a syswait system
13044 set sys/wait.h i_syswait
13045 eval $inhdr
13046
13047 : see if this is an utime system
13048 set utime.h i_utime
13049 eval $inhdr
13050
13051 : see if this is a values.h system
13052 set values.h i_values
13053 eval $inhdr
13054
13055 : see if this is a vfork system
13056 case "$d_vfork" in
13057 "$define")
13058         set vfork.h i_vfork
13059         eval $inhdr
13060         ;;
13061 *)
13062         i_vfork="$undef"
13063         ;;
13064 esac
13065
13066 : see if gdbm.h is available
13067 set gdbm.h t_gdbm
13068 eval $inhdr
13069 case "$t_gdbm" in
13070 $define)
13071         : see if gdbm_open exists
13072         set gdbm_open d_gdbm_open
13073         eval $inlibc
13074         case "$d_gdbm_open" in
13075         $undef)
13076                 t_gdbm="$undef"
13077                 echo "We won't be including <gdbm.h>"
13078                 ;;
13079         esac
13080         ;;
13081 esac
13082 val="$t_gdbm"
13083 set i_gdbm
13084 eval $setvar
13085
13086 echo " "
13087 echo "Looking for extensions..." >&4
13088 : If we are using the old config.sh, known_extensions may contain
13089 : old or inaccurate or duplicate values.
13090 known_extensions=''
13091 nonxs_extensions=''
13092 : We do not use find because it might not be available.
13093 : We do not just use MANIFEST because the user may have dropped
13094 : some additional extensions into the source tree and expect them
13095 : to be built.
13096
13097 : Function to recursively find available extensions, ignoring DynaLoader
13098 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13099 find_extensions='
13100     for xxx in *; do
13101        case "$xxx" in
13102            DynaLoader|dynaload) ;;
13103            *)
13104            if $test -f $xxx/$xxx.xs; then
13105                known_extensions="$known_extensions $1$xxx";
13106            elif $test -f $xxx/Makefile.PL; then
13107                nonxs_extensions="$nonxs_extensions $1$xxx";
13108            else
13109                if $test -d $xxx -a $# -lt 10; then
13110                    set $1$xxx/ $*;
13111                    cd $xxx;
13112                    eval $find_extensions;
13113                    cd ..;
13114                    shift;
13115                fi;
13116            fi
13117            ;;
13118        esac;
13119     done'
13120 tdir=`pwd`
13121 cd $rsrc/ext
13122 set X
13123 shift
13124 eval $find_extensions
13125 set X $nonxs_extensions
13126 shift
13127 nonxs_extensions="$*"
13128 set X $known_extensions
13129 shift
13130 known_extensions="$*"
13131 cd $tdir
13132
13133 : Now see which are supported on this system.
13134 avail_ext=''
13135 for xxx in $known_extensions ; do
13136         case "$xxx" in
13137         DB_File|db_file)
13138                 case "$i_db" in
13139                 $define) avail_ext="$avail_ext $xxx" ;;
13140                 esac
13141                 ;;
13142         GDBM_File|gdbm_fil)
13143                 case "$i_gdbm" in 
13144                 $define) avail_ext="$avail_ext $xxx" ;;
13145                 esac
13146                 ;;
13147         NDBM_File|ndbm_fil)
13148                 case "$i_ndbm" in
13149                 $define) avail_ext="$avail_ext $xxx" ;;
13150                 esac
13151                 ;;
13152         ODBM_File|odbm_fil) 
13153                 case "${i_dbm}${i_rpcsvcdbm}" in
13154                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13155                 esac
13156                 ;;
13157         POSIX|posix)
13158                 case "$useposix" in
13159                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13160                 esac
13161                 ;;
13162         Opcode|opcode)
13163                 case "$useopcode" in
13164                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13165                 esac
13166                 ;;
13167         Socket|socket)
13168                 case "$d_socket" in 
13169                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13170                 esac
13171                 ;;
13172         Thread|thread)
13173                 case "$usethreads" in 
13174                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13175                 esac
13176                 ;;
13177         IPC/SysV|ipc/sysv)
13178                 : XXX Do we need a useipcsysv variable here
13179                 case "${d_msg}${d_sem}${d_shm}" in 
13180                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13181                 esac
13182                 ;;
13183         *)      avail_ext="$avail_ext $xxx"
13184                 ;;
13185         esac
13186 done
13187
13188 set X $avail_ext
13189 shift
13190 avail_ext="$*"
13191
13192 : Now see which nonxs extensions are supported on this system.
13193 : For now assume all are.
13194 nonxs_ext=''
13195 for xxx in $nonxs_extensions ; do
13196         case "$xxx" in
13197         *)      nonxs_ext="$nonxs_ext $xxx"
13198                 ;;
13199         esac
13200 done
13201
13202 set X $nonxs_ext
13203 shift
13204 nonxs_ext="$*"
13205
13206 case $usedl in
13207 $define)
13208         $cat <<EOM
13209 A number of extensions are supplied with $package.  You may choose to
13210 compile these extensions for dynamic loading (the default), compile
13211 them into the $package executable (static loading), or not include
13212 them at all.  Answer "none" to include no extensions.
13213 Note that DynaLoader is always built and need not be mentioned here.
13214
13215 EOM
13216         case "$dynamic_ext" in
13217         '') dflt="$avail_ext" ;;
13218         *)      dflt="$dynamic_ext"
13219                 # Perhaps we are reusing an old out-of-date config.sh.
13220                 case "$hint" in
13221                 previous)
13222                         if test X"$dynamic_ext" != X"$avail_ext"; then
13223                                 $cat <<EOM
13224 NOTICE:  Your previous config.sh list may be incorrect. 
13225 The extensions now available to you are 
13226         ${avail_ext}
13227 but the default list from your previous config.sh is
13228         ${dynamic_ext} 
13229
13230 EOM
13231                         fi
13232                         ;;
13233                 esac
13234                 ;;
13235         esac
13236         case "$dflt" in
13237         '')     dflt=none;;
13238         esac
13239         rp="What extensions do you wish to load dynamically?"
13240         . ./myread
13241         case "$ans" in
13242         none) dynamic_ext=' ' ;;
13243         *) dynamic_ext="$ans" ;;
13244         esac
13245
13246         case "$static_ext" in
13247         '')
13248                 : Exclude those already listed in dynamic linking
13249                 dflt=''
13250                 for xxx in $avail_ext; do
13251                         case " $dynamic_ext " in
13252                         *" $xxx "*) ;;
13253                         *) dflt="$dflt $xxx" ;;
13254                         esac
13255                 done
13256                 set X $dflt
13257                 shift
13258                 dflt="$*"
13259                 ;;
13260         *)  dflt="$static_ext" 
13261                 ;;
13262         esac
13263
13264         case "$dflt" in
13265         '')     dflt=none;;
13266         esac
13267         rp="What extensions do you wish to load statically?"
13268         . ./myread
13269         case "$ans" in
13270         none) static_ext=' ' ;;
13271         *) static_ext="$ans" ;;
13272         esac
13273         ;;
13274 *)
13275         $cat <<EOM
13276 A number of extensions are supplied with $package.  Answer "none" 
13277 to include no extensions. 
13278 Note that DynaLoader is always built and need not be mentioned here.
13279
13280 EOM
13281         case "$static_ext" in
13282         '') dflt="$avail_ext" ;;
13283         *)      dflt="$static_ext"
13284                 # Perhaps we are reusing an old out-of-date config.sh.
13285                 case "$hint" in
13286                 previous)
13287                         if test X"$static_ext" != X"$avail_ext"; then
13288                                 $cat <<EOM
13289 NOTICE:  Your previous config.sh list may be incorrect. 
13290 The extensions now available to you are 
13291         ${avail_ext}
13292 but the default list from your previous config.sh is
13293         ${static_ext} 
13294
13295 EOM
13296                         fi
13297                         ;;
13298                 esac
13299                 ;;
13300         esac
13301         : Exclude those that are not xs extensions
13302         case "$dflt" in
13303         '')     dflt=none;;
13304         esac
13305         rp="What extensions do you wish to include?"
13306         . ./myread
13307         case "$ans" in
13308         none) static_ext=' ' ;;
13309         *) static_ext="$ans" ;;
13310         esac
13311         ;;
13312 esac
13313
13314 set X $dynamic_ext $static_ext $nonxs_ext
13315 shift
13316 extensions="$*"
13317
13318 : Remove build directory name from cppstdin so it can be used from
13319 : either the present location or the final installed location.
13320 echo " "
13321 : Get out of the UU directory to get correct path name.
13322 cd ..
13323 case "$cppstdin" in
13324 `pwd`/cppstdin)
13325         echo "Stripping down cppstdin path name"
13326         cppstdin=cppstdin
13327         ;;
13328 esac
13329 cd UU
13330
13331 : end of configuration questions
13332 echo " "
13333 echo "End of configuration questions."
13334 echo " "
13335
13336 : back to where it started
13337 if test -d ../UU; then
13338         cd ..
13339 fi
13340
13341 : configuration may be patched via a 'config.over' file
13342 if $test -f config.over; then
13343         echo " "
13344         dflt=y
13345         rp='I see a config.over file.  Do you wish to load it?'
13346         . UU/myread
13347         case "$ans" in
13348         n*) echo "OK, I'll ignore it.";;
13349         *)      . ./config.over
13350                 echo "Configuration override changes have been loaded."
13351                 ;;
13352         esac
13353 fi
13354
13355 : in case they want portability, strip down executable paths
13356 case "$d_portable" in
13357 "$define")
13358         echo " "
13359         echo "Stripping down executable paths..." >&4
13360         for file in $loclist $trylist; do
13361                 if test X$file != Xln -a X$file != Xar -o X$osname != Xos2; then
13362                         eval $file="\$file"
13363                 fi
13364         done
13365         ;;
13366 esac
13367
13368 : create config.sh file
13369 echo " "
13370 echo "Creating config.sh..." >&4
13371 $spitshell <<EOT >config.sh
13372 $startsh
13373 #
13374 # This file was produced by running the Configure script. It holds all the
13375 # definitions figured out by Configure. Should you modify one of these values,
13376 # do not forget to propagate your changes by running "Configure -der". You may
13377 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13378 #
13379
13380 # Package name      : $package
13381 # Source directory  : $src
13382 # Configuration time: $cf_time
13383 # Configured by     : $cf_by
13384 # Target system     : $myuname
13385
13386 Author='$Author'
13387 Date='$Date'
13388 Header='$Header'
13389 Id='$Id'
13390 Locker='$Locker'
13391 Log='$Log'
13392 Mcc='$Mcc'
13393 RCSfile='$RCSfile'
13394 Revision='$Revision'
13395 Source='$Source'
13396 State='$State'
13397 _a='$_a'
13398 _exe='$_exe'
13399 _o='$_o'
13400 afs='$afs'
13401 alignbytes='$alignbytes'
13402 ansi2knr='$ansi2knr'
13403 aphostname='$aphostname'
13404 apiversion='$apiversion'
13405 ar='$ar'
13406 archlib='$archlib'
13407 archlibexp='$archlibexp'
13408 archname64='$archname64'
13409 archname='$archname'
13410 archobjs='$archobjs'
13411 awk='$awk'
13412 baserev='$baserev'
13413 bash='$bash'
13414 bin='$bin'
13415 bincompat5005='$bincompat5005'
13416 binexp='$binexp'
13417 bison='$bison'
13418 byacc='$byacc'
13419 byteorder='$byteorder'
13420 c='$c'
13421 castflags='$castflags'
13422 cat='$cat'
13423 cc='$cc'
13424 cccdlflags='$cccdlflags'
13425 ccdlflags='$ccdlflags'
13426 ccflags='$ccflags'
13427 ccsymbols='$ccsymbols'
13428 cf_by='$cf_by'
13429 cf_email='$cf_email'
13430 cf_time='$cf_time'
13431 chgrp='$chgrp'
13432 chmod='$chmod'
13433 chown='$chown'
13434 clocktype='$clocktype'
13435 comm='$comm'
13436 compress='$compress'
13437 contains='$contains'
13438 cp='$cp'
13439 cpio='$cpio'
13440 cpp='$cpp'
13441 cpp_stuff='$cpp_stuff'
13442 cppccsymbols='$cppccsymbols'
13443 cppflags='$cppflags'
13444 cpplast='$cpplast'
13445 cppminus='$cppminus'
13446 cpprun='$cpprun'
13447 cppstdin='$cppstdin'
13448 cppsymbols='$cppsymbols'
13449 crosscompile='$crosscompile'
13450 cryptlib='$cryptlib'
13451 csh='$csh'
13452 d_Gconvert='$d_Gconvert'
13453 d_PRIEldbl='$d_PRIEldbl'
13454 d_PRIFldbl='$d_PRIFldbl'
13455 d_PRIGldbl='$d_PRIGldbl'
13456 d_PRIX64='$d_PRIX64'
13457 d_PRId64='$d_PRId64'
13458 d_PRIeldbl='$d_PRIeldbl'
13459 d_PRIfldbl='$d_PRIfldbl'
13460 d_PRIgldbl='$d_PRIgldbl'
13461 d_PRIi64='$d_PRIi64'
13462 d_PRIo64='$d_PRIo64'
13463 d_PRIu64='$d_PRIu64'
13464 d_PRIx64='$d_PRIx64'
13465 d_access='$d_access'
13466 d_accessx='$d_accessx'
13467 d_alarm='$d_alarm'
13468 d_archlib='$d_archlib'
13469 d_atolf='$d_atolf'
13470 d_atoll='$d_atoll'
13471 d_attribut='$d_attribut'
13472 d_bcmp='$d_bcmp'
13473 d_bcopy='$d_bcopy'
13474 d_bincompat5005='$d_bincompat5005'
13475 d_bsd='$d_bsd'
13476 d_bsdgetpgrp='$d_bsdgetpgrp'
13477 d_bsdsetpgrp='$d_bsdsetpgrp'
13478 d_bzero='$d_bzero'
13479 d_casti32='$d_casti32'
13480 d_castneg='$d_castneg'
13481 d_charvspr='$d_charvspr'
13482 d_chown='$d_chown'
13483 d_chroot='$d_chroot'
13484 d_chsize='$d_chsize'
13485 d_closedir='$d_closedir'
13486 d_cmsghdr_s='$d_cmsghdr_s'
13487 d_const='$d_const'
13488 d_crypt='$d_crypt'
13489 d_csh='$d_csh'
13490 d_cuserid='$d_cuserid'
13491 d_dbl_dig='$d_dbl_dig'
13492 d_dbmclose64='$d_dbmclose64'
13493 d_dbminit64='$d_dbminit64'
13494 d_delete64='$d_delete64'
13495 d_difftime='$d_difftime'
13496 d_dirent64_s='$d_dirent64_s'
13497 d_dirnamlen='$d_dirnamlen'
13498 d_dlerror='$d_dlerror'
13499 d_dlopen='$d_dlopen'
13500 d_dlsymun='$d_dlsymun'
13501 d_dosuid='$d_dosuid'
13502 d_drand48proto='$d_drand48proto'
13503 d_dup2='$d_dup2'
13504 d_eaccess='$d_eaccess'
13505 d_endgrent='$d_endgrent'
13506 d_endhent='$d_endhent'
13507 d_endnent='$d_endnent'
13508 d_endpent='$d_endpent'
13509 d_endpwent='$d_endpwent'
13510 d_endsent='$d_endsent'
13511 d_endspent='$d_endspent'
13512 d_eofnblk='$d_eofnblk'
13513 d_eunice='$d_eunice'
13514 d_fchmod='$d_fchmod'
13515 d_fchown='$d_fchown'
13516 d_fcntl='$d_fcntl'
13517 d_fd_macros='$d_fd_macros'
13518 d_fd_set='$d_fd_set'
13519 d_fds_bits='$d_fds_bits'
13520 d_fetch64='$d_fetch64'
13521 d_fgetpos64='$d_fgetpos64'
13522 d_fgetpos='$d_fgetpos'
13523 d_firstkey64='$d_firstkey64'
13524 d_flexfnam='$d_flexfnam'
13525 d_flock64_s='$d_flock64_s'
13526 d_flock='$d_flock'
13527 d_fopen64='$d_fopen64'
13528 d_fork='$d_fork'
13529 d_fpathconf='$d_fpathconf'
13530 d_freopen64='$d_freopen64'
13531 d_fseek64='$d_fseek64'
13532 d_fseeko64='$d_fseeko64'
13533 d_fseeko='$d_fseeko'
13534 d_fsetpos64='$d_fsetpos64'
13535 d_fsetpos='$d_fsetpos'
13536 d_fstat64='$d_fstat64'
13537 d_fstatfs='$d_fstatfs'
13538 d_fstatvfs='$d_fstatvfs'
13539 d_ftell64='$d_ftell64'
13540 d_ftello64='$d_ftello64'
13541 d_ftello='$d_ftello'
13542 d_ftime='$d_ftime'
13543 d_ftruncate64='$d_ftruncate64'
13544 d_getgrent='$d_getgrent'
13545 d_getgrps='$d_getgrps'
13546 d_gethbyaddr='$d_gethbyaddr'
13547 d_gethbyname='$d_gethbyname'
13548 d_gethent='$d_gethent'
13549 d_gethname='$d_gethname'
13550 d_gethostprotos='$d_gethostprotos'
13551 d_getlogin='$d_getlogin'
13552 d_getmntent='$d_getmntent'
13553 d_getnbyaddr='$d_getnbyaddr'
13554 d_getnbyname='$d_getnbyname'
13555 d_getnent='$d_getnent'
13556 d_getnetprotos='$d_getnetprotos'
13557 d_getpbyname='$d_getpbyname'
13558 d_getpbynumber='$d_getpbynumber'
13559 d_getpent='$d_getpent'
13560 d_getpgid='$d_getpgid'
13561 d_getpgrp2='$d_getpgrp2'
13562 d_getpgrp='$d_getpgrp'
13563 d_getppid='$d_getppid'
13564 d_getprior='$d_getprior'
13565 d_getprotoprotos='$d_getprotoprotos'
13566 d_getpwent='$d_getpwent'
13567 d_getsbyname='$d_getsbyname'
13568 d_getsbyport='$d_getsbyport'
13569 d_getsent='$d_getsent'
13570 d_getservprotos='$d_getservprotos'
13571 d_getspent='$d_getspent'
13572 d_getspnam='$d_getspnam'
13573 d_gettimeod='$d_gettimeod'
13574 d_gnulibc='$d_gnulibc'
13575 d_grpasswd='$d_grpasswd'
13576 d_hasmntopt='$d_hasmntopt'
13577 d_htonl='$d_htonl'
13578 d_index='$d_index'
13579 d_inetaton='$d_inetaton'
13580 d_ino64_t='$d_ino64_t'
13581 d_int64t='$d_int64t'
13582 d_iovec_s='$d_iovec_s'
13583 d_isascii='$d_isascii'
13584 d_killpg='$d_killpg'
13585 d_lchown='$d_lchown'
13586 d_link='$d_link'
13587 d_llseek='$d_llseek'
13588 d_locconv='$d_locconv'
13589 d_lockf64='$d_lockf64'
13590 d_lockf='$d_lockf'
13591 d_longdbl='$d_longdbl'
13592 d_longlong='$d_longlong'
13593 d_lseek64='$d_lseek64'
13594 d_lstat64='$d_lstat64'
13595 d_lstat='$d_lstat'
13596 d_madvise='$d_madvise'
13597 d_mblen='$d_mblen'
13598 d_mbstowcs='$d_mbstowcs'
13599 d_mbtowc='$d_mbtowc'
13600 d_memchr='$d_memchr'
13601 d_memcmp='$d_memcmp'
13602 d_memcpy='$d_memcpy'
13603 d_memmove='$d_memmove'
13604 d_memset='$d_memset'
13605 d_mkdir='$d_mkdir'
13606 d_mkfifo='$d_mkfifo'
13607 d_mktime='$d_mktime'
13608 d_mmap='$d_mmap'
13609 d_mprotect='$d_mprotect'
13610 d_msg='$d_msg'
13611 d_msg_ctrunc='$d_msg_ctrunc'
13612 d_msg_dontroute='$d_msg_dontroute'
13613 d_msg_oob='$d_msg_oob'
13614 d_msg_peek='$d_msg_peek'
13615 d_msg_proxy='$d_msg_proxy'
13616 d_msgctl='$d_msgctl'
13617 d_msgget='$d_msgget'
13618 d_msghdr_s='$d_msghdr_s'
13619 d_msgrcv='$d_msgrcv'
13620 d_msgsnd='$d_msgsnd'
13621 d_msync='$d_msync'
13622 d_munmap='$d_munmap'
13623 d_mymalloc='$d_mymalloc'
13624 d_nextkey64='$d_nextkey64'
13625 d_nice='$d_nice'
13626 d_off64_t='$d_off64_t'
13627 d_offset_t='$d_offset_t'
13628 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13629 d_oldpthreads='$d_oldpthreads'
13630 d_oldsock='$d_oldsock'
13631 d_open3='$d_open3'
13632 d_open64='$d_open64'
13633 d_opendir64='$d_opendir64'
13634 d_pathconf='$d_pathconf'
13635 d_pause='$d_pause'
13636 d_phostname='$d_phostname'
13637 d_pipe='$d_pipe'
13638 d_poll='$d_poll'
13639 d_portable='$d_portable'
13640 d_pthread_yield='$d_pthread_yield'
13641 d_pwage='$d_pwage'
13642 d_pwchange='$d_pwchange'
13643 d_pwclass='$d_pwclass'
13644 d_pwcomment='$d_pwcomment'
13645 d_pwexpire='$d_pwexpire'
13646 d_pwgecos='$d_pwgecos'
13647 d_pwpasswd='$d_pwpasswd'
13648 d_pwquota='$d_pwquota'
13649 d_readdir64='$d_readdir64'
13650 d_readdir='$d_readdir'
13651 d_readlink='$d_readlink'
13652 d_readv='$d_readv'
13653 d_recvmsg='$d_recvmsg'
13654 d_rename='$d_rename'
13655 d_rewinddir='$d_rewinddir'
13656 d_rmdir='$d_rmdir'
13657 d_safebcpy='$d_safebcpy'
13658 d_safemcpy='$d_safemcpy'
13659 d_sanemcmp='$d_sanemcmp'
13660 d_sched_yield='$d_sched_yield'
13661 d_scm_rights='$d_scm_rights'
13662 d_seekdir64='$d_seekdir64'
13663 d_seekdir='$d_seekdir'
13664 d_select='$d_select'
13665 d_sem='$d_sem'
13666 d_semctl='$d_semctl'
13667 d_semctl_semid_ds='$d_semctl_semid_ds'
13668 d_semctl_semun='$d_semctl_semun'
13669 d_semget='$d_semget'
13670 d_semop='$d_semop'
13671 d_sendmsg='$d_sendmsg'
13672 d_setegid='$d_setegid'
13673 d_seteuid='$d_seteuid'
13674 d_setgrent='$d_setgrent'
13675 d_setgrps='$d_setgrps'
13676 d_sethent='$d_sethent'
13677 d_setlinebuf='$d_setlinebuf'
13678 d_setlocale='$d_setlocale'
13679 d_setnent='$d_setnent'
13680 d_setpent='$d_setpent'
13681 d_setpgid='$d_setpgid'
13682 d_setpgrp2='$d_setpgrp2'
13683 d_setpgrp='$d_setpgrp'
13684 d_setprior='$d_setprior'
13685 d_setpwent='$d_setpwent'
13686 d_setregid='$d_setregid'
13687 d_setresgid='$d_setresgid'
13688 d_setresuid='$d_setresuid'
13689 d_setreuid='$d_setreuid'
13690 d_setrgid='$d_setrgid'
13691 d_setruid='$d_setruid'
13692 d_setsent='$d_setsent'
13693 d_setsid='$d_setsid'
13694 d_setspent='$d_setspent'
13695 d_setvbuf='$d_setvbuf'
13696 d_sfio='$d_sfio'
13697 d_shm='$d_shm'
13698 d_shmat='$d_shmat'
13699 d_shmatprototype='$d_shmatprototype'
13700 d_shmctl='$d_shmctl'
13701 d_shmdt='$d_shmdt'
13702 d_shmget='$d_shmget'
13703 d_sigaction='$d_sigaction'
13704 d_sigsetjmp='$d_sigsetjmp'
13705 d_socket='$d_socket'
13706 d_sockpair='$d_sockpair'
13707 d_stat64='$d_stat64'
13708 d_statblks='$d_statblks'
13709 d_statfs='$d_statfs'
13710 d_statfsflags='$d_statfsflags'
13711 d_statvfs='$d_statvfs'
13712 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13713 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13714 d_stdio_stream_array='$d_stdio_stream_array'
13715 d_stdiobase='$d_stdiobase'
13716 d_stdstdio='$d_stdstdio'
13717 d_store64='$d_store64'
13718 d_strchr='$d_strchr'
13719 d_strcoll='$d_strcoll'
13720 d_strctcpy='$d_strctcpy'
13721 d_strerrm='$d_strerrm'
13722 d_strerror='$d_strerror'
13723 d_strtod='$d_strtod'
13724 d_strtol='$d_strtol'
13725 d_strtoul='$d_strtoul'
13726 d_strtoull='$d_strtoull'
13727 d_strxfrm='$d_strxfrm'
13728 d_suidsafe='$d_suidsafe'
13729 d_symlink='$d_symlink'
13730 d_syscall='$d_syscall'
13731 d_sysconf='$d_sysconf'
13732 d_sysernlst='$d_sysernlst'
13733 d_syserrlst='$d_syserrlst'
13734 d_system='$d_system'
13735 d_tcgetpgrp='$d_tcgetpgrp'
13736 d_tcsetpgrp='$d_tcsetpgrp'
13737 d_telldir64='$d_telldir64'
13738 d_telldir='$d_telldir'
13739 d_telldirproto='$d_telldirproto'
13740 d_time='$d_time'
13741 d_times='$d_times'
13742 d_tmpfile64='$d_tmpfile64'
13743 d_truncate64='$d_truncate64'
13744 d_truncate='$d_truncate'
13745 d_tzname='$d_tzname'
13746 d_umask='$d_umask'
13747 d_uname='$d_uname'
13748 d_union_semun='$d_union_semun'
13749 d_vendorlib='$d_vendorlib'
13750 d_vfork='$d_vfork'
13751 d_void_closedir='$d_void_closedir'
13752 d_voidsig='$d_voidsig'
13753 d_voidtty='$d_voidtty'
13754 d_volatile='$d_volatile'
13755 d_vprintf='$d_vprintf'
13756 d_wait4='$d_wait4'
13757 d_waitpid='$d_waitpid'
13758 d_wcstombs='$d_wcstombs'
13759 d_wctomb='$d_wctomb'
13760 d_writev='$d_writev'
13761 d_xenix='$d_xenix'
13762 date='$date'
13763 db_hashtype='$db_hashtype'
13764 db_prefixtype='$db_prefixtype'
13765 defvoidused='$defvoidused'
13766 direntrytype='$direntrytype'
13767 dlext='$dlext'
13768 dlsrc='$dlsrc'
13769 doublesize='$doublesize'
13770 drand01='$drand01'
13771 dynamic_ext='$dynamic_ext'
13772 eagain='$eagain'
13773 ebcdic='$ebcdic'
13774 echo='$echo'
13775 egrep='$egrep'
13776 emacs='$emacs'
13777 eunicefix='$eunicefix'
13778 exe_ext='$exe_ext'
13779 expr='$expr'
13780 extensions='$extensions'
13781 fflushNULL='$fflushNULL'
13782 fflushall='$fflushall'
13783 find='$find'
13784 firstmakefile='$firstmakefile'
13785 flex='$flex'
13786 fpostype='$fpostype'
13787 freetype='$freetype'
13788 full_ar='$full_ar'
13789 full_csh='$full_csh'
13790 full_sed='$full_sed'
13791 gccversion='$gccversion'
13792 gidtype='$gidtype'
13793 glibpth='$glibpth'
13794 grep='$grep'
13795 groupcat='$groupcat'
13796 groupstype='$groupstype'
13797 gzip='$gzip'
13798 h_fcntl='$h_fcntl'
13799 h_sysfile='$h_sysfile'
13800 hint='$hint'
13801 hostcat='$hostcat'
13802 huge='$huge'
13803 i_arpainet='$i_arpainet'
13804 i_bsdioctl='$i_bsdioctl'
13805 i_db='$i_db'
13806 i_dbm='$i_dbm'
13807 i_dirent='$i_dirent'
13808 i_dld='$i_dld'
13809 i_dlfcn='$i_dlfcn'
13810 i_fcntl='$i_fcntl'
13811 i_float='$i_float'
13812 i_gdbm='$i_gdbm'
13813 i_grp='$i_grp'
13814 i_inttypes='$i_inttypes'
13815 i_limits='$i_limits'
13816 i_locale='$i_locale'
13817 i_machcthr='$i_machcthr'
13818 i_malloc='$i_malloc'
13819 i_math='$i_math'
13820 i_memory='$i_memory'
13821 i_mntent='$i_mntent'
13822 i_ndbm='$i_ndbm'
13823 i_netdb='$i_netdb'
13824 i_neterrno='$i_neterrno'
13825 i_netinettcp='$i_netinettcp'
13826 i_niin='$i_niin'
13827 i_poll='$i_poll'
13828 i_pthread='$i_pthread'
13829 i_pwd='$i_pwd'
13830 i_rpcsvcdbm='$i_rpcsvcdbm'
13831 i_sfio='$i_sfio'
13832 i_sgtty='$i_sgtty'
13833 i_shadow='$i_shadow'
13834 i_socks='$i_socks'
13835 i_stdarg='$i_stdarg'
13836 i_stddef='$i_stddef'
13837 i_stdlib='$i_stdlib'
13838 i_string='$i_string'
13839 i_sysaccess='$i_sysaccess'
13840 i_sysdir='$i_sysdir'
13841 i_sysfile='$i_sysfile'
13842 i_sysfilio='$i_sysfilio'
13843 i_sysin='$i_sysin'
13844 i_sysioctl='$i_sysioctl'
13845 i_sysmman='$i_sysmman'
13846 i_sysmount='$i_sysmount'
13847 i_sysndir='$i_sysndir'
13848 i_sysparam='$i_sysparam'
13849 i_sysresrc='$i_sysresrc'
13850 i_syssecrt='$i_syssecrt'
13851 i_sysselct='$i_sysselct'
13852 i_syssockio='$i_syssockio'
13853 i_sysstat='$i_sysstat'
13854 i_sysstatvfs='$i_sysstatvfs'
13855 i_systime='$i_systime'
13856 i_systimek='$i_systimek'
13857 i_systimes='$i_systimes'
13858 i_systypes='$i_systypes'
13859 i_sysuio='$i_sysuio'
13860 i_sysun='$i_sysun'
13861 i_syswait='$i_syswait'
13862 i_termio='$i_termio'
13863 i_termios='$i_termios'
13864 i_time='$i_time'
13865 i_unistd='$i_unistd'
13866 i_utime='$i_utime'
13867 i_values='$i_values'
13868 i_varargs='$i_varargs'
13869 i_varhdr='$i_varhdr'
13870 i_vfork='$i_vfork'
13871 ignore_versioned_solibs='$ignore_versioned_solibs'
13872 incpath='$incpath'
13873 inews='$inews'
13874 installarchlib='$installarchlib'
13875 installbin='$installbin'
13876 installman1dir='$installman1dir'
13877 installman3dir='$installman3dir'
13878 installprefix='$installprefix'
13879 installprefixexp='$installprefixexp'
13880 installprivlib='$installprivlib'
13881 installscript='$installscript'
13882 installsitearch='$installsitearch'
13883 installsitelib='$installsitelib'
13884 installstyle='$installstyle'
13885 installusrbinperl='$installusrbinperl'
13886 installvendorlib='$installvendorlib'
13887 intsize='$intsize'
13888 known_extensions='$known_extensions'
13889 ksh='$ksh'
13890 large='$large'
13891 ld='$ld'
13892 lddlflags='$lddlflags'
13893 ldflags='$ldflags'
13894 ldlibpthname='$ldlibpthname'
13895 less='$less'
13896 lib_ext='$lib_ext'
13897 libc='$libc'
13898 libperl='$libperl'
13899 libpth='$libpth'
13900 libs='$libs'
13901 libswanted='$libswanted'
13902 line='$line'
13903 lint='$lint'
13904 lkflags='$lkflags'
13905 ln='$ln'
13906 lns='$lns'
13907 locincpth='$locincpth'
13908 loclibpth='$loclibpth'
13909 longdblsize='$longdblsize'
13910 longlongsize='$longlongsize'
13911 longsize='$longsize'
13912 lp='$lp'
13913 lpr='$lpr'
13914 ls='$ls'
13915 lseeksize='$lseeksize'
13916 lseektype='$lseektype'
13917 mail='$mail'
13918 mailx='$mailx'
13919 make='$make'
13920 make_set_make='$make_set_make'
13921 mallocobj='$mallocobj'
13922 mallocsrc='$mallocsrc'
13923 malloctype='$malloctype'
13924 man1dir='$man1dir'
13925 man1direxp='$man1direxp'
13926 man1ext='$man1ext'
13927 man3dir='$man3dir'
13928 man3direxp='$man3direxp'
13929 man3ext='$man3ext'
13930 medium='$medium'
13931 mips='$mips'
13932 mips_type='$mips_type'
13933 mkdir='$mkdir'
13934 mmaptype='$mmaptype'
13935 models='$models'
13936 modetype='$modetype'
13937 more='$more'
13938 multiarch='$multiarch'
13939 mv='$mv'
13940 myarchname='$myarchname'
13941 mydomain='$mydomain'
13942 myhostname='$myhostname'
13943 myuname='$myuname'
13944 n='$n'
13945 netdb_hlen_type='$netdb_hlen_type'
13946 netdb_host_type='$netdb_host_type'
13947 netdb_name_type='$netdb_name_type'
13948 netdb_net_type='$netdb_net_type'
13949 nm='$nm'
13950 nm_opt='$nm_opt'
13951 nm_so_opt='$nm_so_opt'
13952 nonxs_ext='$nonxs_ext'
13953 nroff='$nroff'
13954 o_nonblock='$o_nonblock'
13955 obj_ext='$obj_ext'
13956 old_pthread_create_joinable='$old_pthread_create_joinable'
13957 optimize='$optimize'
13958 orderlib='$orderlib'
13959 osname='$osname'
13960 osvers='$osvers'
13961 package='$package'
13962 pager='$pager'
13963 passcat='$passcat'
13964 patchlevel='$patchlevel'
13965 path_sep='$path_sep'
13966 perl='$perl'
13967 perladmin='$perladmin'
13968 perlpath='$perlpath'
13969 pg='$pg'
13970 phostname='$phostname'
13971 pidtype='$pidtype'
13972 plibpth='$plibpth'
13973 pmake='$pmake'
13974 pr='$pr'
13975 prefix='$prefix'
13976 prefixexp='$prefixexp'
13977 privlib='$privlib'
13978 privlibexp='$privlibexp'
13979 prototype='$prototype'
13980 ptrsize='$ptrsize'
13981 randbits='$randbits'
13982 randfunc='$randfunc'
13983 randseedtype='$randseedtype'
13984 ranlib='$ranlib'
13985 rd_nodata='$rd_nodata'
13986 rm='$rm'
13987 rmail='$rmail'
13988 runnm='$runnm'
13989 sPRIEldbl='$sPRIEldbl'
13990 sPRIFldbl='$sPRIFldbl'
13991 sPRIGldbl='$sPRIGldbl'
13992 sPRIX64='$sPRIX64'
13993 sPRId64='$sPRId64'
13994 sPRIeldbl='$sPRIeldbl'
13995 sPRIfldbl='$sPRIfldbl'
13996 sPRIgldbl='$sPRIgldbl'
13997 sPRIi64='$sPRIi64'
13998 sPRIo64='$sPRIo64'
13999 sPRIu64='$sPRIu64'
14000 sPRIx64='$sPRIx64'
14001 sched_yield='$sched_yield'
14002 scriptdir='$scriptdir'
14003 scriptdirexp='$scriptdirexp'
14004 sed='$sed'
14005 seedfunc='$seedfunc'
14006 selectminbits='$selectminbits'
14007 selecttype='$selecttype'
14008 sendmail='$sendmail'
14009 sh='$sh'
14010 shar='$shar'
14011 sharpbang='$sharpbang'
14012 shmattype='$shmattype'
14013 shortsize='$shortsize'
14014 shrpenv='$shrpenv'
14015 shsharp='$shsharp'
14016 sig_count='$sig_count'
14017 sig_name='$sig_name'
14018 sig_name_init='$sig_name_init'
14019 sig_num='$sig_num'
14020 sig_num_init='$sig_num_init'
14021 signal_t='$signal_t'
14022 sitearch='$sitearch'
14023 sitearchexp='$sitearchexp'
14024 sitelib='$sitelib'
14025 sitelibexp='$sitelibexp'
14026 siteprefix='$siteprefix'
14027 siteprefixexp='$siteprefixexp'
14028 sizetype='$sizetype'
14029 sleep='$sleep'
14030 smail='$smail'
14031 small='$small'
14032 so='$so'
14033 sockethdr='$sockethdr'
14034 socketlib='$socketlib'
14035 sort='$sort'
14036 spackage='$spackage'
14037 spitshell='$spitshell'
14038 split='$split'
14039 src='$src'
14040 ssizetype='$ssizetype'
14041 startperl='$startperl'
14042 startsh='$startsh'
14043 static_ext='$static_ext'
14044 stdchar='$stdchar'
14045 stdio_base='$stdio_base'
14046 stdio_bufsiz='$stdio_bufsiz'
14047 stdio_cnt='$stdio_cnt'
14048 stdio_filbuf='$stdio_filbuf'
14049 stdio_ptr='$stdio_ptr'
14050 stdio_stream_array='$stdio_stream_array'
14051 strings='$strings'
14052 submit='$submit'
14053 subversion='$subversion'
14054 sysman='$sysman'
14055 tail='$tail'
14056 tar='$tar'
14057 tbl='$tbl'
14058 tee='$tee'
14059 test='$test'
14060 timeincl='$timeincl'
14061 timetype='$timetype'
14062 touch='$touch'
14063 tr='$tr'
14064 trnl='$trnl'
14065 troff='$troff'
14066 uidtype='$uidtype'
14067 uname='$uname'
14068 uniq='$uniq'
14069 use64bits='$use64bits'
14070 usedl='$usedl'
14071 usemultiplicity='$usemultiplicity'
14072 usemymalloc='$usemymalloc'
14073 usenm='$usenm'
14074 useopcode='$useopcode'
14075 useperlio='$useperlio'
14076 useposix='$useposix'
14077 usesfio='$usesfio'
14078 useshrplib='$useshrplib'
14079 usesocks='$usesocks'
14080 usethreads='$usethreads'
14081 usevendorprefix='$usevendorprefix'
14082 usevfork='$usevfork'
14083 usrinc='$usrinc'
14084 uuname='$uuname'
14085 vendorlib='$vendorlib'
14086 vendorlibexp='$vendorlibexp'
14087 vendorprefix='$vendorprefix'
14088 vendorprefixexp='$vendorprefixexp'
14089 version='$version'
14090 vi='$vi'
14091 voidflags='$voidflags'
14092 xlibpth='$xlibpth'
14093 zcat='$zcat'
14094 zip='$zip'
14095 EOT
14096
14097 : Add in command line options if available
14098 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14099
14100 : add special variables
14101 $test -f $src/patchlevel.h && \
14102 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14103 echo "CONFIGDOTSH=true" >>config.sh
14104
14105 : propagate old symbols
14106 if $test -f UU/config.sh; then
14107         <UU/config.sh sort | uniq >UU/oldconfig.sh
14108         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14109         sort | uniq -u >UU/oldsyms
14110         set X `cat UU/oldsyms`
14111         shift
14112         case $# in
14113         0) ;;
14114         *)
14115                 cat <<EOM
14116 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14117 EOM
14118                 echo "# Variables propagated from previous config.sh file." >>config.sh
14119                 for sym in `cat UU/oldsyms`; do
14120                         echo "    Propagating $hint variable "'$'"$sym..."
14121                         eval 'tmp="$'"${sym}"'"'
14122                         echo "$tmp" | \
14123                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14124                 done
14125                 ;;
14126         esac
14127 fi
14128
14129 : Finish up by extracting the .SH files
14130 case "$alldone" in
14131 exit)
14132         $rm -rf UU
14133         echo "Done."
14134         exit 0
14135         ;;
14136 cont)
14137         ;;
14138 '')
14139         dflt=''
14140         nostick=true
14141         $cat <<EOM
14142
14143 If you'd like to make any changes to the config.sh file before I begin
14144 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14145
14146 EOM
14147         rp="Press return or use a shell escape to edit config.sh:"
14148         . UU/myread
14149         nostick=''
14150         case "$ans" in
14151         '') ;;
14152         *) : in case they cannot read
14153                 sh 1>&4 -c "$ans";;
14154         esac
14155         ;;
14156 esac
14157
14158 : if this fails, just run all the .SH files by hand
14159 . ./config.sh
14160
14161 echo " "
14162 exec 1>&4
14163 . ./UU/extract
14164
14165 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14166         dflt=y
14167         case "$silent" in
14168         true) ;;
14169         *)
14170                 $cat <<EOM
14171
14172 Now you need to generate make dependencies by running "$make depend".
14173 You might prefer to run it in background: "$make depend > makedepend.out &"
14174 It can take a while, so you might not want to run it right now.
14175
14176 EOM
14177                 ;;
14178         esac
14179         rp="Run $make depend now?"
14180         . UU/myread
14181         case "$ans" in
14182         y*)
14183                 $make depend && echo "Now you must run a $make."
14184                 ;;
14185         *)
14186                 echo "You must run '$make depend' then '$make'."
14187                 ;;
14188         esac
14189 elif test -f [Mm]akefile; then
14190         echo " "
14191         echo "Now you must run a $make."
14192 else
14193         echo "Done."
14194 fi
14195
14196 if $test -f Policy.sh; then
14197     $cat <<EOM
14198
14199 If you compile $package on a different machine or from a different object
14200 directory, copy the Policy.sh file from this object directory to the
14201 new one before you run Configure -- this will help you with most of
14202 the policy defaults.
14203
14204 EOM
14205 fi
14206 if $test -f config.msg; then
14207     echo "Hmm.  I also noted the following information while running:"
14208     echo " "
14209     $cat config.msg >&4
14210     $rm -f config.msg
14211 fi
14212 $rm -f kit*isdone ark*isdone
14213 $rm -rf UU
14214
14215 : End of Configure
14216