Regen Configure, all of xs_apiversion didn't take.
[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 Sat Oct  2 13:06:57 EET DST 1999 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.com)
25
26 cat >/tmp/c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >/tmp/c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat /tmp/c1$$ /tmp/c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat /tmp/c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f /tmp/c1$$ /tmp/c2$$
49
50 : compute my invocation name
51 me=$0
52 case "$0" in
53 */*)
54         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
55         test "$me" || me=$0
56         ;;
57 esac
58
59 : Proper separator for the PATH environment variable
60 p_=:
61 : On OS/2 this directory should exist if this is not floppy only system :-]
62 if test -d c:/. ; then
63     if test -n "$OS2_SHELL"; then
64                 p_=\;
65                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
66                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
67         elif test -n "$DJGPP"; then
68                 p_=\;
69         fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81
82 for p in $paths
83 do
84         case "$p_$PATH$p_" in
85         *$p_$p$p_*) ;;
86         *) test -d $p && PATH=$PATH$p_$p ;;
87         esac
88 done
89
90 PATH=.$p_$PATH
91 export PATH
92
93 : shall we be using ksh?
94 inksh=''
95 needksh=''
96 avoidksh=''
97 newsh=/bin/ksh
98 changesh=''
99 if (PATH=.; alias -x) >/dev/null 2>&1; then
100                 inksh=true
101 fi
102 if test -f /hp-ux -a -f /bin/ksh; then
103         needksh='to avoid sh bug in "here document" expansion'
104 fi
105 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
106         if test X`/usr/bin/uname -v` = X4; then
107                 avoidksh="to avoid AIX 4's /bin/sh"
108                 newsh=/usr/bin/bsh
109         fi
110 fi
111 if test -f /osf_boot -a -f /usr/sbin/setld; then
112         if test X`/usr/bin/uname -s` = XOSF1; then
113                 avoidksh="to avoid Digital UNIX' ksh"
114                 newsh=/bin/sh
115                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
116         fi
117 fi
118 case "$inksh/$needksh" in
119 /[a-z]*)
120                 ENV=''
121                 changesh=true
122                 reason="$needksh"
123         ;;
124 esac
125 case "$inksh/$avoidksh" in
126 true/[a-z]*)
127         changesh=true
128         reason="$avoidksh"
129         ;;
130 esac
131 case "$inksh/$needksh-$avoidksh-" in
132 true/--)
133                 cat <<EOM
134 (I see you are using the Korn shell.  Some ksh's blow up on $me,
135 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
136 EOM
137         ;;
138 esac
139 case "$changesh" in
140 true)
141         echo "(Feeding myself to $newsh $reason.)"
142         case "$0" in
143         Configure|*/Configure) exec $newsh $0 "$@";;
144         *) exec $newsh Configure "$@";;
145         esac
146         ;;
147 esac
148
149 : if needed set CDPATH to a harmless value that is not chatty
150 : avoid bash 2.02 problems with empty CDPATH.
151 case "$CDPATH" in
152 '')     ;;
153 *)      case "$SHELL" in
154         *bash*) CDPATH='.' ;;
155         *)              CDPATH='' ;;
156         esac
157         ;;
158 esac
159 : Configure runs within the UU subdirectory
160 test -d UU || mkdir UU
161 cd UU && rm -f ./*
162
163 ccsymbols=''
164 cppccsymbols=''
165 cppsymbols=''
166 dynamic_ext=''
167 extensions=''
168 known_extensions=''
169 nonxs_ext=''
170 static_ext=''
171 useopcode=''
172 useposix=''
173 d_bsd=''
174 d_eunice=''
175 d_xenix=''
176 eunicefix=''
177 Mcc=''
178 ar=''
179 awk=''
180 bash=''
181 bison=''
182 byacc=''
183 cat=''
184 chgrp=''
185 chmod=''
186 chown=''
187 comm=''
188 compress=''
189 cp=''
190 cpio=''
191 cpp=''
192 csh=''
193 date=''
194 echo=''
195 egrep=''
196 emacs=''
197 expr=''
198 find=''
199 flex=''
200 grep=''
201 gzip=''
202 inews=''
203 ksh=''
204 less=''
205 line=''
206 lint=''
207 ln=''
208 lp=''
209 lpr=''
210 ls=''
211 mail=''
212 mailx=''
213 make=''
214 mkdir=''
215 more=''
216 mv=''
217 nm=''
218 nroff=''
219 perl=''
220 pg=''
221 pmake=''
222 pr=''
223 rm=''
224 rmail=''
225 sed=''
226 sendmail=''
227 shar=''
228 sleep=''
229 smail=''
230 sort=''
231 submit=''
232 tail=''
233 tar=''
234 tbl=''
235 tee=''
236 test=''
237 touch=''
238 tr=''
239 troff=''
240 uname=''
241 uniq=''
242 uuname=''
243 vi=''
244 zcat=''
245 zip=''
246 full_ar=''
247 full_sed=''
248 libswanted=''
249 hint=''
250 myuname=''
251 osname=''
252 osvers=''
253 Author=''
254 Date=''
255 Header=''
256 Id=''
257 Locker=''
258 Log=''
259 RCSfile=''
260 Revision=''
261 Source=''
262 State=''
263 _a=''
264 _exe=''
265 _o=''
266 archobjs=''
267 exe_ext=''
268 firstmakefile=''
269 lib_ext=''
270 obj_ext=''
271 path_sep=''
272 afs=''
273 alignbytes=''
274 ansi2knr=''
275 archlib=''
276 archlibexp=''
277 d_archlib=''
278 installarchlib=''
279 archname=''
280 myarchname=''
281 d_atolf=''
282 d_atoll=''
283 baserev=''
284 bin=''
285 binexp=''
286 installbin=''
287 bincompat5005=''
288 d_bincompat5005=''
289 byteorder=''
290 cc=''
291 gccversion=''
292 ccflags=''
293 cppflags=''
294 ldflags=''
295 lkflags=''
296 locincpth=''
297 optimize=''
298 cf_email=''
299 cf_by=''
300 cf_time=''
301 contains=''
302 cpp_stuff=''
303 cpplast=''
304 cppminus=''
305 cpprun=''
306 cppstdin=''
307 crosscompile=''
308 d_access=''
309 d_accessx=''
310 d_alarm=''
311 d_attribut=''
312 d_bcmp=''
313 d_bcopy=''
314 d_bzero=''
315 d_casti32=''
316 castflags=''
317 d_castneg=''
318 d_chown=''
319 d_chroot=''
320 d_chsize=''
321 d_closedir=''
322 d_void_closedir=''
323 d_const=''
324 cryptlib=''
325 d_crypt=''
326 d_csh=''
327 full_csh=''
328 d_cuserid=''
329 d_dbl_dig=''
330 d_difftime=''
331 d_dlerror=''
332 d_dlopen=''
333 d_dlsymun=''
334 d_dosuid=''
335 d_suidsafe=''
336 d_drand48proto=''
337 d_dup2=''
338 d_eaccess=''
339 d_endgrent=''
340 d_endhent=''
341 d_endnent=''
342 d_endpent=''
343 d_endpwent=''
344 d_endsent=''
345 d_endspent=''
346 d_fchmod=''
347 d_fchown=''
348 d_fcntl=''
349 d_fd_macros=''
350 d_fd_set=''
351 d_fds_bits=''
352 d_fgetpos=''
353 d_flexfnam=''
354 d_flock=''
355 d_fork=''
356 d_fseeko=''
357 d_fsetpos=''
358 d_ftello=''
359 d_ftime=''
360 d_gettimeod=''
361 d_Gconvert=''
362 d_getgrent=''
363 d_getgrps=''
364 d_gethbyaddr=''
365 d_gethbyname=''
366 d_gethent=''
367 aphostname=''
368 d_gethname=''
369 d_phostname=''
370 d_uname=''
371 d_gethostprotos=''
372 d_getlogin=''
373 d_getmntent=''
374 d_getnbyaddr=''
375 d_getnbyname=''
376 d_getnent=''
377 d_getnetprotos=''
378 d_getpent=''
379 d_getpgid=''
380 d_getpgrp2=''
381 d_bsdgetpgrp=''
382 d_getpgrp=''
383 d_getppid=''
384 d_getprior=''
385 d_getpbyname=''
386 d_getpbynumber=''
387 d_getprotoprotos=''
388 d_getpwent=''
389 d_getsent=''
390 d_getservprotos=''
391 d_getspent=''
392 d_getspnam=''
393 d_getsbyname=''
394 d_getsbyport=''
395 d_gnulibc=''
396 d_hasmntopt=''
397 d_htonl=''
398 d_inetaton=''
399 d_isascii=''
400 d_killpg=''
401 d_lchown=''
402 d_ldbl_dig=''
403 d_link=''
404 d_locconv=''
405 d_lockf=''
406 d_longdbl=''
407 longdblsize=''
408 d_longlong=''
409 longlongsize=''
410 d_lstat=''
411 d_madvise=''
412 d_mblen=''
413 d_mbstowcs=''
414 d_mbtowc=''
415 d_memchr=''
416 d_memcmp=''
417 d_memcpy=''
418 d_memmove=''
419 d_memset=''
420 d_mkdir=''
421 d_mkfifo=''
422 d_mktime=''
423 d_mmap=''
424 mmaptype=''
425 d_mprotect=''
426 d_msg=''
427 d_msgctl=''
428 d_msgget=''
429 d_msgrcv=''
430 d_msgsnd=''
431 d_msync=''
432 d_munmap=''
433 d_nice=''
434 d_open3=''
435 d_fpathconf=''
436 d_pathconf=''
437 d_pause=''
438 d_pipe=''
439 d_poll=''
440 d_portable=''
441 d_old_pthread_create_joinable=''
442 old_pthread_create_joinable=''
443 d_pthread_yield=''
444 d_sched_yield=''
445 sched_yield=''
446 d_readdir=''
447 d_rewinddir=''
448 d_seekdir=''
449 d_telldir=''
450 d_readlink=''
451 d_readv=''
452 d_rename=''
453 d_rmdir=''
454 d_safebcpy=''
455 d_safemcpy=''
456 d_sanemcmp=''
457 d_select=''
458 d_sem=''
459 d_semctl=''
460 d_semget=''
461 d_semop=''
462 d_setegid=''
463 d_seteuid=''
464 d_setgrent=''
465 d_setgrps=''
466 d_sethent=''
467 d_setlinebuf=''
468 d_setlocale=''
469 d_setnent=''
470 d_setpent=''
471 d_setpgid=''
472 d_setpgrp2=''
473 d_bsdsetpgrp=''
474 d_setpgrp=''
475 d_setprior=''
476 d_setpwent=''
477 d_setregid=''
478 d_setresgid=''
479 d_setresuid=''
480 d_setreuid=''
481 d_setrgid=''
482 d_setruid=''
483 d_setsent=''
484 d_setsid=''
485 d_setspent=''
486 d_setvbuf=''
487 d_sfio=''
488 usesfio=''
489 d_shm=''
490 d_shmat=''
491 d_shmatprototype=''
492 shmattype=''
493 d_shmctl=''
494 d_shmdt=''
495 d_shmget=''
496 d_sigaction=''
497 d_sigsetjmp=''
498 d_cmsghdr_s=''
499 d_msg_ctrunc=''
500 d_msg_dontroute=''
501 d_msg_oob=''
502 d_msg_peek=''
503 d_msg_proxy=''
504 d_msghdr_s=''
505 d_oldsock=''
506 d_recvmsg=''
507 d_scm_rights=''
508 d_sendmsg=''
509 d_socket=''
510 d_sockpair=''
511 sockethdr=''
512 socketlib=''
513 d_statblks=''
514 d_fstatfs=''
515 d_statfs=''
516 d_statfsflags=''
517 d_fstatvfs=''
518 d_statvfs=''
519 d_stdio_cnt_lval=''
520 d_stdio_ptr_lval=''
521 d_stdiobase=''
522 d_stdstdio=''
523 stdio_base=''
524 stdio_bufsiz=''
525 stdio_cnt=''
526 stdio_filbuf=''
527 stdio_ptr=''
528 d_index=''
529 d_strchr=''
530 d_strcoll=''
531 d_strctcpy=''
532 d_strerrm=''
533 d_strerror=''
534 d_sysernlst=''
535 d_syserrlst=''
536 d_strtod=''
537 d_strtol=''
538 d_strtoul=''
539 d_strxfrm=''
540 d_symlink=''
541 d_syscall=''
542 d_sysconf=''
543 d_system=''
544 d_tcgetpgrp=''
545 d_tcsetpgrp=''
546 d_telldirproto=''
547 d_time=''
548 timetype=''
549 clocktype=''
550 d_times=''
551 d_truncate=''
552 d_tzname=''
553 d_umask=''
554 d_semctl_semid_ds=''
555 d_semctl_semun=''
556 d_union_semun=''
557 d_vfork=''
558 usevfork=''
559 d_voidsig=''
560 signal_t=''
561 d_volatile=''
562 d_charvspr=''
563 d_vprintf=''
564 d_wait4=''
565 d_waitpid=''
566 d_wcstombs=''
567 d_wctomb=''
568 d_writev=''
569 dlext=''
570 cccdlflags=''
571 ccdlflags=''
572 dlsrc=''
573 ld=''
574 lddlflags=''
575 usedl=''
576 doublesize=''
577 ebcdic=''
578 fflushNULL=''
579 fflushall=''
580 fpostype=''
581 gidtype=''
582 groupstype=''
583 h_fcntl=''
584 h_sysfile=''
585 i_arpainet=''
586 db_hashtype=''
587 db_prefixtype=''
588 i_db=''
589 i_dbm=''
590 i_rpcsvcdbm=''
591 d_dirnamlen=''
592 direntrytype=''
593 i_dirent=''
594 i_dld=''
595 i_dlfcn=''
596 i_fcntl=''
597 i_float=''
598 i_gdbm=''
599 d_grpasswd=''
600 i_grp=''
601 d_int64t=''
602 i_inttypes=''
603 i_limits=''
604 i_locale=''
605 i_machcthr=''
606 i_malloc=''
607 i_math=''
608 i_memory=''
609 i_mntent=''
610 i_ndbm=''
611 i_netdb=''
612 i_neterrno=''
613 i_netinettcp=''
614 i_niin=''
615 i_sysin=''
616 i_poll=''
617 i_pthread=''
618 d_pwage=''
619 d_pwchange=''
620 d_pwclass=''
621 d_pwcomment=''
622 d_pwexpire=''
623 d_pwgecos=''
624 d_pwpasswd=''
625 d_pwquota=''
626 i_pwd=''
627 i_sfio=''
628 i_shadow=''
629 i_socks=''
630 i_stddef=''
631 i_stdlib=''
632 i_string=''
633 strings=''
634 i_sysaccess=''
635 i_sysdir=''
636 i_sysfile=''
637 d_voidtty=''
638 i_bsdioctl=''
639 i_sysfilio=''
640 i_sysioctl=''
641 i_syssockio=''
642 i_sysmman=''
643 i_sysmount=''
644 i_sysndir=''
645 i_sysparam=''
646 i_sysresrc=''
647 i_syssecrt=''
648 i_sysselct=''
649 i_sysstat=''
650 i_sysstatvfs=''
651 i_systimes=''
652 i_systypes=''
653 d_iovec_s=''
654 i_sysuio=''
655 i_sysun=''
656 i_syswait=''
657 i_sgtty=''
658 i_termio=''
659 i_termios=''
660 i_systime=''
661 i_systimek=''
662 i_time=''
663 timeincl=''
664 i_unistd=''
665 i_utime=''
666 i_values=''
667 i_stdarg=''
668 i_varargs=''
669 i_varhdr=''
670 i_vfork=''
671 installprefix=''
672 installprefixexp=''
673 installstyle=''
674 installusrbinperl=''
675 intsize=''
676 longsize=''
677 shortsize=''
678 d_fpos64_t=''
679 d_llseek=''
680 d_off64_t=''
681 libc=''
682 ldlibpthname=''
683 libperl=''
684 shrpenv=''
685 useshrplib=''
686 glibpth=''
687 libpth=''
688 loclibpth=''
689 plibpth=''
690 xlibpth=''
691 ignore_versioned_solibs=''
692 libs=''
693 lns=''
694 d_PRIEldbl=''
695 d_PRIFldbl=''
696 d_PRIGldbl=''
697 d_PRIeldbl=''
698 d_PRIfldbl=''
699 d_PRIgldbl=''
700 sPRIEldbl=''
701 sPRIFldbl=''
702 sPRIGldbl=''
703 sPRIeldbl=''
704 sPRIfldbl=''
705 sPRIgldbl=''
706 lseeksize=''
707 lseektype=''
708 make_set_make=''
709 d_mymalloc=''
710 freetype=''
711 mallocobj=''
712 mallocsrc=''
713 malloctype=''
714 usemymalloc=''
715 installman1dir=''
716 man1dir=''
717 man1direxp=''
718 man1ext=''
719 installman3dir=''
720 man3dir=''
721 man3direxp=''
722 man3ext=''
723 huge=''
724 large=''
725 medium=''
726 models=''
727 small=''
728 split=''
729 modetype=''
730 multiarch=''
731 mydomain=''
732 myhostname=''
733 phostname=''
734 c=''
735 n=''
736 d_eofnblk=''
737 eagain=''
738 o_nonblock=''
739 rd_nodata=''
740 netdb_hlen_type=''
741 netdb_host_type=''
742 netdb_name_type=''
743 netdb_net_type=''
744 groupcat=''
745 hostcat=''
746 passcat=''
747 orderlib=''
748 ranlib=''
749 package=''
750 spackage=''
751 pager=''
752 apiversion=''
753 patchlevel=''
754 subversion=''
755 version=''
756 perladmin=''
757 perlpath=''
758 pidtype=''
759 prefix=''
760 prefixexp=''
761 installprivlib=''
762 privlib=''
763 privlibexp=''
764 prototype=''
765 ptrsize=''
766 d_PRIX64=''
767 d_PRId64=''
768 d_PRIi64=''
769 d_PRIo64=''
770 d_PRIu64=''
771 d_PRIx64=''
772 sPRIX64=''
773 sPRId64=''
774 sPRIi64=''
775 sPRIo64=''
776 sPRIu64=''
777 sPRIx64=''
778 drand01=''
779 randbits=''
780 randfunc=''
781 randseedtype=''
782 seedfunc=''
783 installscript=''
784 scriptdir=''
785 scriptdirexp=''
786 selectminbits=''
787 selecttype=''
788 sh=''
789 sig_count=''
790 sig_name=''
791 sig_name_init=''
792 sig_num=''
793 sig_num_init=''
794 installsitearch=''
795 sitearch=''
796 sitearchexp=''
797 installsitelib=''
798 sitelib=''
799 sitelibexp=''
800 siteprefix=''
801 siteprefixexp=''
802 sizetype=''
803 so=''
804 sharpbang=''
805 shsharp=''
806 spitshell=''
807 src=''
808 ssizetype=''
809 startperl=''
810 startsh=''
811 stdchar=''
812 d_stdio_stream_array=''
813 stdio_stream_array=''
814 d_strtoull=''
815 sysman=''
816 trnl=''
817 uidtype=''
818 archname64=''
819 use64bits=''
820 uselargefiles=''
821 uselongdouble=''
822 usemorebits=''
823 usemultiplicity=''
824 nm_opt=''
825 nm_so_opt=''
826 runnm=''
827 usenm=''
828 useperlio=''
829 usesocks=''
830 d_oldpthreads=''
831 usethreads=''
832 incpath=''
833 mips=''
834 mips_type=''
835 usrinc=''
836 d_vendorlib=''
837 installvendorlib=''
838 vendorlib=''
839 vendorlibexp=''
840 usevendorprefix=''
841 vendorprefix=''
842 vendorprefixexp=''
843 defvoidused=''
844 voidflags=''
845 pm_apiversion=''
846 xs_apiversion=''
847 CONFIG=''
848
849 define='define'
850 undef='undef'
851 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
852 rmlist=''
853
854 : We must find out about Eunice early
855 eunicefix=':'
856 if test -f /etc/unixtovms; then
857         eunicefix=/etc/unixtovms
858 fi
859 if test -f /etc/unixtovms.exe; then
860         eunicefix=/etc/unixtovms.exe
861 fi
862
863 i_whoami=''
864 : Possible local include directories to search.
865 : Set locincpth to "" in a hint file to defeat local include searches.
866 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
867 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
868 :
869 : no include file wanted by default
870 inclwanted=''
871
872 : list of known cpp symbols, sorted alphabetically
873 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2"
874 al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
875 al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS"
876 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
877 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
878 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
879 al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4 SVR5"
880 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
881 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
882 al="$al VMS Xenix286"
883 al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI"
884 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET _POWER"
885 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
886 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
887 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
888 al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS"
889 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
890 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
891 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
892 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
893 al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__"
894 al="$al __SVR4_2__ __UMAXV__"
895 al="$al ____386BSD____ __alpha __alpha__ __amiga"
896 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
897 al="$al __host_mips__"
898 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
899 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
900 al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__"
901 al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__"
902 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
903 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
904 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
905 al="$al __mc88100 __mc88100__ __mips __mips__"
906 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
907 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
908 al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__"
909 al="$al _host_mips _mips _unix"
910 al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent"
911 al="$al apollo ardent att386 att3b"
912 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull"
913 al="$al cadmus clipper concurrent convex cray ctix"
914 al="$al dmert encore gcos gcx gimpel gould"
915 al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800"
916 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
917 al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux"
918 al="$al i186 i286 i386 i486 i8086"
919 al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k"
920 al="$al ksr1 linux luna luna88k m68k m88100 m88k"
921 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
922 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
923 al="$al mc88000 mc88100 merlin mert mips mvs n16"
924 al="$al ncl_el ncl_mr"
925 al="$al news1500 news1700 news1800 news1900 news3700"
926 al="$al news700 news800 news900 ns16000 ns32000"
927 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
928 al="$al parisc pc532 pdp11 plexus posix pyr"
929 al="$al riscix riscos scs sequent sgi sinix sony sony_news"
930 al="$al sonyrisc sparc sparclite spectrum stardent stratos"
931 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
932 al="$al titan tower tower32 tower32_200 tower32_600 tower32_700"
933 al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200"
934 al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms"
935 al="$al xenix z8000"
936
937 : Trailing extension.  Override this in a hint file, if needed.
938 _exe=''
939 : Extra object files, if any, needed on this platform.
940 archobjs=''
941 groupstype=''
942 : change the next line if compiling for Xenix/286 on Xenix/386
943 xlibpth='/usr/lib/386 /lib/386'
944
945 : Possible local library directories to search.
946 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
947 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
948
949 : general looking path for locating libraries
950 glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large"
951 glibpth="$glibpth /lib /usr/lib $xlibpth"
952 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
953 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
954
955 : Private path used by Configure to find libraries.  Its value
956 : is prepended to libpth. This variable takes care of special
957 : machines, like the mips.  Usually, it should be empty.
958 plibpth=''
959
960 : default library list
961 libswanted=''
962 : some systems want to use only the non-versioned libso:s
963 ignore_versioned_solibs=''
964 : full support for void wanted by default
965 defvoidused=15
966
967 : set useposix=false in your hint file to disable the POSIX extension.
968 useposix=true
969 : set useopcode=false in your hint file to disable the Opcode extension.
970 useopcode=true
971 : set usemultiplicity on the Configure command line to enable multiplicity.
972 : set usesocks on the Configure command line to enable socks.
973 : set usethreads on the Configure command line to enable threads.
974 : List of libraries we want.
975 : If anyone needs -lnet, put it in a hint file.
976 libswanted='sfio socket inet nsl nm ndbm gdbm dbm db malloc dl'
977 libswanted="$libswanted dld ld sun m c cposix posix"
978 libswanted="$libswanted ndir dir crypt sec"
979 libswanted="$libswanted ucb bsd BSD PW x"
980 : We probably want to search /usr/shlib before most other libraries.
981 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
982 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
983 glibpth="/usr/shlib $glibpth"
984 : Do not use vfork unless overridden by a hint file.
985 usevfork=false
986
987 : Find the basic shell for Bourne shell scripts
988 case "$sh" in
989 '')
990         case "$SYSTYPE" in
991         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
992         *) xxx='/bin/sh';;
993         esac
994         if test -f "$xxx"; then
995                 sh="$xxx"
996         else
997                 : Build up a list and do a single loop so we can 'break' out.
998                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
999                 for xxx in sh bash ksh pdksh ash; do
1000                         for p in $pth; do
1001                                 try="$try ${p}/${xxx}"
1002                         done
1003                 done
1004                 for xxx in $try; do
1005                         if test -f "$xxx"; then
1006                                 sh="$xxx";
1007                                 break
1008                         elif test -f "$xxx.exe"; then
1009                                 sh="$xxx";
1010                                 break
1011                         fi
1012                 done
1013         fi
1014         ;;
1015 esac
1016
1017 case "$sh" in
1018 '')     cat <<EOM >&2
1019 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1020
1021 Usually it's in /bin/sh.  How did you even get this far?
1022 Please contact me (Perl Maintainers) at perlbug@perl.com and 
1023 we'll try to straighten this all out.
1024 EOM
1025         exit 1
1026         ;;
1027 esac
1028
1029 : see if sh knows # comments
1030 if `$sh -c '#' >/dev/null 2>&1`; then
1031         shsharp=true
1032         spitshell=cat
1033         xcat=/bin/cat
1034         test -f $xcat || xcat=/usr/bin/cat
1035         echo "#!$xcat" >try
1036         $eunicefix try
1037         chmod +x try
1038         ./try > today
1039         if test -s today; then
1040                 sharpbang='#!'
1041         else
1042                 echo "#! $xcat" > try
1043                 $eunicefix try
1044                 chmod +x try
1045                 ./try > today
1046                 if test -s today; then
1047                         sharpbang='#! '
1048                 else
1049                         sharpbang=': use '
1050                 fi
1051         fi
1052 else
1053         echo " "
1054         echo "Your $sh doesn't grok # comments--I will strip them later on."
1055         shsharp=false
1056         cd ..
1057         echo "exec grep -v '^[  ]*#'" >spitshell
1058         chmod +x spitshell
1059         $eunicefix spitshell
1060         spitshell=`pwd`/spitshell
1061         cd UU
1062         echo "I presume that if # doesn't work, #! won't work either!"
1063         sharpbang=': use '
1064 fi
1065 rm -f try today
1066
1067 : figure out how to guarantee sh startup
1068 case "$startsh" in
1069 '') startsh=${sharpbang}${sh} ;;
1070 *)
1071 esac
1072 cat >try <<EOSS
1073 $startsh
1074 set abc
1075 test "$?abc" != 1
1076 EOSS
1077
1078 chmod +x try
1079 $eunicefix try
1080 if ./try; then
1081         : echo "Yup, it does."
1082 else
1083         echo "Hmm... '$startsh' does not guarantee sh startup..."
1084         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1085 fi
1086 rm -f try
1087
1088
1089 : Save command line options in file UU/cmdline.opt for later use in
1090 : generating config.sh.
1091 cat > cmdline.opt <<EOSH
1092 # Configure command line arguments.
1093 config_arg0='$0'
1094 config_args='$*'
1095 config_argc=$#
1096 EOSH
1097 argn=1
1098 for arg in "$@"; do
1099         cat >>cmdline.opt <<EOSH
1100 config_arg$argn='$arg'
1101 EOSH
1102         argn=`expr $argn + 1`
1103 done
1104
1105 : produce awk script to parse command line options
1106 cat >options.awk <<'EOF'
1107 BEGIN {
1108         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1109
1110         len = length(optstr);
1111         for (i = 1; i <= len; i++) {
1112                 c = substr(optstr, i, 1);
1113                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1114                 if (a == ":") {
1115                         arg[c] = 1;
1116                         i++;
1117                 }
1118                 opt[c] = 1;
1119         }
1120 }
1121 {
1122         expect = 0;
1123         str = $0;
1124         if (substr(str, 1, 1) != "-") {
1125                 printf("'%s'\n", str);
1126                 next;
1127         }
1128         len = length($0);
1129         for (i = 2; i <= len; i++) {
1130                 c = substr(str, i, 1);
1131                 if (!opt[c]) {
1132                         printf("-%s\n", substr(str, i));
1133                         next;
1134                 }
1135                 printf("-%s\n", c);
1136                 if (arg[c]) {
1137                         if (i < len)
1138                                 printf("'%s'\n", substr(str, i + 1));
1139                         else
1140                                 expect = 1;
1141                         next;
1142                 }
1143         }
1144 }
1145 END {
1146         if (expect)
1147                 print "?";
1148 }
1149 EOF
1150
1151 : process the command line options
1152 set X `for arg in "$@"; do echo "X$arg"; done |
1153         sed -e s/X// | awk -f options.awk`
1154 eval "set $*"
1155 shift
1156 rm -f options.awk
1157
1158 : set up default values
1159 fastread=''
1160 reuseval=false
1161 config_sh=''
1162 alldone=''
1163 error=''
1164 silent=''
1165 extractsh=''
1166 override=''
1167 knowitall=''
1168 rm -f optdef.sh posthint.sh
1169 cat >optdef.sh <<EOS
1170 $startsh
1171 EOS
1172
1173
1174 : option parsing
1175 while test $# -gt 0; do
1176         case "$1" in
1177         -d) shift; fastread=yes;;
1178         -e) shift; alldone=cont;;
1179         -f)
1180                 shift
1181                 cd ..
1182                 if test -r "$1"; then
1183                         config_sh="$1"
1184                 else
1185                         echo "$me: cannot read config file $1." >&2
1186                         error=true
1187                 fi
1188                 cd UU
1189                 shift;;
1190         -h) shift; error=true;;
1191         -r) shift; reuseval=true;;
1192         -s) shift; silent=true; realsilent=true;;
1193         -E) shift; alldone=exit;;
1194         -K) shift; knowitall=true;;
1195         -O) shift; override=true;;
1196         -S) shift; silent=true; extractsh=true;;
1197         -D)
1198                 shift
1199                 case "$1" in
1200                 *=)
1201                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1202                         echo "$me: ignoring -D $1" >&2
1203                         ;;
1204                 *=*) echo "$1" | \
1205                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1206                 *) echo "$1='define'" >> optdef.sh;;
1207                 esac
1208                 shift
1209                 ;;
1210         -U)
1211                 shift
1212                 case "$1" in
1213                 *=) echo "$1" >> optdef.sh;;
1214                 *=*)
1215                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1216                         echo "$me: ignoring -U $1" >&2
1217                         ;;
1218                 *) echo "$1='undef'" >> optdef.sh;;
1219                 esac
1220                 shift
1221                 ;;
1222         -A)
1223             shift
1224             xxx=''
1225             yyy="$1"
1226             zzz=''
1227             uuu=undef
1228             case "$yyy" in
1229             *=*) zzz=`echo $yyy|sed 's!=.*!!'`
1230                  case "$zzz" in
1231                  *:*) zzz='' ;;
1232                  *)   xxx=append
1233                       zzz=" "`echo $yyy|sed 's!^[^=]*=!!'` 
1234                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1235                  esac
1236                  ;;
1237             esac
1238             case "$xxx" in
1239             '')  case "$yyy" in
1240                  *:*) xxx=`echo $yyy|sed 's!:.*!!'`
1241                       yyy=`echo $yyy|sed 's!^[^:]*:!!'`
1242                       zzz=`echo $yyy|sed 's!^[^=]*=!!'`
1243                       yyy=`echo $yyy|sed 's!=.*!!'` ;;
1244                  *)   xxx=`echo $yyy|sed 's!:.*!!'`
1245                       yyy=`echo $yyy|sed 's!^[^:]*:!!'` ;;
1246                  esac
1247                  ;;       
1248             esac
1249             case "$xxx" in
1250             append)
1251                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1252             clear)
1253                 echo "$yyy=''"                  >> posthint.sh ;;
1254             define)
1255                 case "$zzz" in
1256                 '') zzz=define ;;
1257                 esac
1258                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1259             eval)
1260                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1261             prepend)
1262                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1263             undef)
1264                 case "$zzz" in
1265                 '') zzz="$uuu" ;;
1266                 esac
1267                 echo "$yyy=$zzz"                >> posthint.sh ;;
1268             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1269             esac
1270             ;;
1271         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1272             exit 0;;
1273         --) break;;
1274         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1275         *) break;;
1276         esac
1277 done
1278
1279 case "$error" in
1280 true)
1281         cat >&2 <<EOM
1282 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1283                  [-U symbol] [-U symbol=] [-A command:symbol...]
1284   -d : use defaults for all answers.
1285   -e : go on without questioning past the production of config.sh.
1286   -f : specify an alternate default configuration file.
1287   -h : print this help message and exit (with an error status).
1288   -r : reuse C symbols value if possible (skips costly nm extraction).
1289   -s : silent mode, only echoes questions and essential information.
1290   -D : define symbol to have some value:
1291          -D symbol         symbol gets the value 'define'
1292          -D symbol=value   symbol gets the value 'value'
1293   -E : stop at the end of questions, after having produced config.sh.
1294   -K : do not use unless you know what you are doing.
1295   -O : let -D and -U override definitions from loaded configuration file.
1296   -S : perform variable substitutions on all .SH files (can mix with -f)
1297   -U : undefine symbol:
1298          -U symbol    symbol gets the value 'undef'
1299          -U symbol=   symbol gets completely empty
1300   -A : manipulate symbol after the platform specific hints have been applied:
1301          -A symbol=value                append " "value to symbol
1302          -A append:symbol=value         append value to symbol
1303          -A define:symbol=value         define symbol to have value
1304          -A clear:symbol                define symbol to be ''
1305          -A define:symbol               define symbol to be 'define'
1306          -A eval:symbol=value           define symbol to be eval of value
1307          -A prepend:symbol=value        prepend value to symbol
1308          -A undef:symbol                define symbol to be 'undef'
1309          -A undef:symbol=               define symbol to be ''
1310   -V : print version number and exit (with a zero status).
1311 EOM
1312         exit 1
1313         ;;
1314 esac
1315
1316 : Sanity checks
1317 case "$fastread$alldone" in
1318 yescont|yesexit) ;;
1319 *)
1320         if test ! -t 0; then
1321                 echo "Say 'sh Configure', not 'sh <Configure'"
1322                 exit 1
1323         fi
1324         ;;
1325 esac
1326
1327 exec 4>&1
1328 case "$silent" in
1329 true) exec 1>/dev/null;;
1330 esac
1331
1332 : run the defines and the undefines, if any, but leave the file out there...
1333 touch optdef.sh
1334 . ./optdef.sh
1335 : create the posthint manipulation script and leave the file out there...
1336 touch posthint.sh
1337
1338 : set package name
1339 package=perl5
1340 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1341 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1342 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1343 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1344 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1345 esac
1346
1347 : Some greps do not return status, grrr.
1348 echo "grimblepritz" >grimble
1349 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1350         contains=contains
1351 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1352         contains=grep
1353 else
1354         contains=contains
1355 fi
1356 rm -f grimble
1357 : the following should work in any shell
1358 case "$contains" in
1359 contains*)
1360         echo " "
1361         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1362         cat >contains <<'EOSS'
1363 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1364 EOSS
1365 chmod +x contains
1366 esac
1367
1368 : Find the path to the source tree
1369 case "$src" in
1370 '') case "$0" in
1371     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1372          case "$src" in
1373          /*)    ;;
1374          *)     src=`cd ../$src && pwd` ;;
1375          esac
1376          ;;
1377     *)   src='.';;
1378     esac;;
1379 esac
1380 case "$src" in
1381 '')     src=/
1382         rsrc=/
1383         ;;
1384 /*) rsrc="$src";;
1385 *) rsrc="../$src";;
1386 esac
1387 if test -f $rsrc/Configure && \
1388         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1389 then
1390    : found it, so we are ok.
1391 else
1392         rsrc=''
1393         for src in . .. ../.. ../../.. ../../../..; do
1394                 if test -f ../$src/Configure && \
1395                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1396                 then
1397                         rsrc=../$src
1398                         break
1399                 fi
1400         done
1401 fi
1402 case "$rsrc" in
1403 '')
1404         cat <<EOM >&4
1405
1406 Sorry, I can't seem to locate the source dir for $package.  Please start
1407 Configure with an explicit path -- i.e. /some/path/Configure.
1408
1409 EOM
1410         exit 1
1411         ;;
1412 ../.)   rsrc='..';;
1413 *)
1414         echo " "
1415         echo "Sources for $package found in \"$src\"." >&4
1416         ;;
1417 esac
1418
1419 : script used to extract .SH files with variable substitutions
1420 cat >extract <<'EOS'
1421 CONFIGDOTSH=true
1422 echo "Doing variable substitutions on .SH files..."
1423 if test -f $src/MANIFEST; then
1424         set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH$'`
1425 else
1426         echo "(Looking for .SH files under the source directory.)"
1427         set x `(cd $src; find . -name "*.SH" -print)`
1428 fi
1429 shift
1430 case $# in
1431 0) set x `(cd $src; echo *.SH)`; shift;;
1432 esac
1433 if test ! -f $src/$1; then
1434         shift
1435 fi
1436 mkdir_p='
1437 name=$1;
1438 create="";
1439 while test $name; do
1440         if test ! -d "$name"; then
1441                 create="$name $create";
1442                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1443                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1444         else
1445                 name="";
1446         fi;
1447 done;
1448 for file in $create; do
1449         mkdir $file;
1450 done
1451 '
1452 for file in $*; do
1453         case "$src" in
1454         ".")
1455                 case "$file" in
1456                 */*)
1457                         dir=`expr X$file : 'X\(.*\)/'`
1458                         file=`expr X$file : 'X.*/\(.*\)'`
1459                         (cd $dir && . ./$file)
1460                         ;;
1461                 *)
1462                         . ./$file
1463                         ;;
1464                 esac
1465                 ;;
1466         *)
1467                 case "$file" in
1468                 */*)
1469                         dir=`expr X$file : 'X\(.*\)/'`
1470                         file=`expr X$file : 'X.*/\(.*\)'`
1471                         (set x $dir; shift; eval $mkdir_p)
1472                         sh <$src/$dir/$file
1473                         ;;
1474                 *)
1475                         sh <$src/$file
1476                         ;;
1477                 esac
1478                 ;;
1479         esac
1480 done
1481 if test -f $src/config_h.SH; then
1482         if test ! -f config.h; then
1483         : oops, they left it out of MANIFEST, probably, so do it anyway.
1484         . $src/config_h.SH
1485         fi
1486 fi
1487 EOS
1488
1489 : extract files and exit if asked to do so
1490 case "$extractsh" in
1491 true)
1492         case "$realsilent" in
1493         true) ;;
1494         *) exec 1>&4;;
1495         esac
1496         case "$config_sh" in
1497         '') config_sh='config.sh';;
1498         esac
1499         echo " "
1500         echo "Fetching answers from $config_sh..."
1501         cd ..
1502         . $config_sh
1503         test "$override" && . ./optdef.sh
1504         echo " "
1505         . UU/extract
1506         rm -rf UU
1507         echo "Done."
1508         exit 0
1509         ;;
1510 esac
1511
1512 : Eunice requires " " instead of "", can you believe it
1513 echo " "
1514 : Here we go...
1515 echo "Beginning of configuration questions for $package."
1516
1517 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1518
1519 : first determine how to suppress newline on echo command
1520 echo " "
1521 echo "Checking echo to see how to suppress newlines..."
1522 (echo "hi there\c" ; echo " ") >.echotmp
1523 if $contains c .echotmp >/dev/null 2>&1 ; then
1524         echo "...using -n."
1525         n='-n'
1526         c=''
1527 else
1528         cat <<'EOM'
1529 ...using \c
1530 EOM
1531         n=''
1532         c='\c'
1533 fi
1534 echo $n "The star should be here-->$c"
1535 echo '*'
1536 rm -f .echotmp
1537
1538 : Now test for existence of everything in MANIFEST
1539 echo " "
1540 if test -f $rsrc/MANIFEST; then
1541         echo "First let's make sure your kit is complete.  Checking..." >&4
1542         awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
1543         rm -f missing
1544         tmppwd=`pwd`
1545         for filelist in x??; do
1546                 (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
1547         done
1548         if test -s missing; then
1549                 cat missing >&4
1550                 cat >&4 <<'EOM'
1551
1552 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1553
1554 You have the option of continuing the configuration process, despite the
1555 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1556 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1557 and contact the author (perlbug@perl.com).
1558
1559 EOM
1560                 echo $n "Continue? [n] $c" >&4
1561                 read ans
1562                 case "$ans" in
1563                 y*)
1564                         echo "Continuing..." >&4
1565                         rm -f missing
1566                         ;;
1567                 *)
1568                         echo "ABORTING..." >&4
1569                         kill $$
1570                         ;;
1571                 esac
1572         else
1573                 echo "Looks good..."
1574         fi
1575 else
1576         echo "There is no MANIFEST file.  I hope your kit is complete !"
1577 fi
1578 rm -f missing x??
1579
1580 echo " "
1581 : Find the appropriate value for a newline for tr
1582 if test -n "$DJGPP"; then
1583        trnl='\012'
1584 fi
1585 if test X"$trnl" = X; then
1586         case "`echo foo|tr '\n' x 2>/dev/null`" in
1587         foox) trnl='\n' ;;
1588         esac
1589 fi
1590 if test X"$trnl" = X; then
1591         case "`echo foo|tr '\012' x 2>/dev/null`" in
1592         foox) trnl='\012' ;;
1593         esac
1594 fi
1595 if test X"$trnl" = X; then
1596         cat <<EOM >&2
1597
1598 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1599
1600 EOM
1601         exit 1
1602 fi
1603
1604 : compute the number of columns on the terminal for proper question formatting
1605 case "$COLUMNS" in
1606 '') COLUMNS='80';;
1607 esac
1608
1609 : set up the echo used in my read
1610 myecho="case \"\$xxxm\" in
1611 '') echo $n \"\$rp $c\" >&4;;
1612 *) case \"\$rp\" in
1613         '') echo $n \"[\$xxxm] $c\";;
1614         *)
1615                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1616                         echo \"\$rp\" >&4
1617                         echo $n \"[\$xxxm] $c\" >&4
1618                 else
1619                         echo $n \"\$rp [\$xxxm] $c\" >&4
1620                 fi
1621                 ;;
1622         esac;;
1623 esac"
1624
1625 : now set up to do reads with possible shell escape and default assignment
1626 cat <<EOSC >myread
1627 $startsh
1628 xxxm=\$dflt
1629 $myecho
1630 ans='!'
1631 case "\$fastread" in
1632 yes) case "\$dflt" in
1633         '') ;;
1634         *) ans='';
1635                 case "\$silent-\$rp" in
1636                 true-) ;;
1637                 *) echo " " >&4;;
1638                 esac;;
1639         esac;;
1640 *) case "\$silent" in
1641         true) case "\$rp" in
1642                 '') ans='';;
1643                 esac;;
1644         esac;;
1645 esac
1646 while expr "X\$ans" : "X!" >/dev/null; do
1647         read answ
1648         set x \$xxxm
1649         shift
1650         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1651         case  "\$answ" in
1652         "!")
1653                 sh 1>&4
1654                 echo " "
1655                 $myecho
1656                 ;;
1657         !*)
1658                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1659                 shift
1660                 sh 1>&4 -c "\$*"
1661                 echo " "
1662                 $myecho
1663                 ;;
1664         "\$ans")
1665                 case "\$ans" in
1666                 \\&*)
1667                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1668                         shift
1669                         case "\$1" in
1670                         -d)
1671                                 fastread=yes
1672                                 echo "(OK, I'll run with -d after this question.)" >&4
1673                                 ;;
1674                         -*)
1675                                 echo "*** Sorry, \$1 not supported yet." >&4
1676                                 ;;
1677                         esac
1678                         $myecho
1679                         ans=!
1680                         ;;
1681                 esac;;
1682         *)
1683                 case "\$aok" in
1684                 y)
1685                         echo "*** Substitution done -- please confirm."
1686                         xxxm="\$ans"
1687                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1688                         xxxm="\$ans"
1689                         ans=!
1690                         ;;
1691                 *)
1692                         echo "*** Error -- try again."
1693                         ans=!
1694                         ;;
1695                 esac
1696                 $myecho
1697                 ;;
1698         esac
1699         case "\$ans\$xxxm\$nostick" in
1700         '')
1701                 ans=!
1702                 $myecho
1703                 ;;
1704         esac
1705 done
1706 case "\$ans" in
1707 '') ans="\$xxxm";;
1708 esac
1709 EOSC
1710
1711 : create .config dir to save info across Configure sessions
1712 test -d ../.config || mkdir ../.config
1713 cat >../.config/README <<EOF
1714 This directory created by Configure to save information that should
1715 persist across sessions for $package.
1716
1717 You may safely delete it if you wish.
1718 EOF
1719
1720 : general instructions
1721 needman=true
1722 firsttime=true
1723 user=`(logname) 2>/dev/null`
1724 case "$user" in
1725 '') user=`whoami 2>&1`;;
1726 esac
1727 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1728         firsttime=false
1729         echo " "
1730         rp='Would you like to see the instructions?'
1731         dflt=n
1732         . ./myread
1733         case "$ans" in
1734         [yY]*) ;;
1735         *) needman=false;;
1736         esac
1737 fi
1738 if $needman; then
1739         cat <<EOH
1740
1741 This installation shell script will examine your system and ask you questions
1742 to determine how the perl5 package should be installed. If you get
1743 stuck on a question, you may use a ! shell escape to start a subshell or
1744 execute a command.  Many of the questions will have default answers in square
1745 brackets; typing carriage return will give you the default.
1746
1747 On some of the questions which ask for file or directory names you are allowed
1748 to use the ~name construct to specify the login directory belonging to "name",
1749 even if you don't have a shell which knows about that.  Questions where this is
1750 allowed will be marked "(~name ok)".
1751
1752 EOH
1753         rp=''
1754         dflt='Type carriage return to continue'
1755         . ./myread
1756         cat <<'EOH'
1757
1758 The prompter used in this script allows you to use shell variables and
1759 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
1760 in the default answer, as if the default line was a set of arguments given to a
1761 script shell.  This means you may also use $* to repeat the whole default line,
1762 so you do not have to re-type everything to add something to the default.
1763
1764 Everytime there is a substitution, you will have to confirm.  If there is an
1765 error (e.g. an unmatched backtick), the default answer will remain unchanged
1766 and you will be prompted again.
1767
1768 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
1769 the questions and use the computed defaults (or the previous answers if there
1770 was already a config.sh file). Type 'Configure -h' for a list of options.
1771 You may also start interactively and then answer '& -d' at any prompt to turn
1772 on the non-interactive behaviour for the remainder of the execution.
1773
1774 EOH
1775         . ./myread
1776         cat <<EOH
1777
1778 Much effort has been expended to ensure that this shell script will run on any
1779 Unix system.  If despite that it blows up on yours, your best bet is to edit
1780 Configure and run it again.  If you can't run Configure for some reason,
1781 you'll have to generate a config.sh file by hand.  Whatever problems you
1782 have, let me (perlbug@perl.com) know how I blew it.
1783
1784 This installation script affects things in two ways:
1785
1786 1) it may do direct variable substitutions on some of the files included
1787    in this kit.
1788 2) it builds a config.h file for inclusion in C programs.  You may edit
1789    any of these files as the need arises after running this script.
1790
1791 If you make a mistake on a question, there is no easy way to back up to it
1792 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
1793 files.  Configure will offer to let you do this before it runs the SH files.
1794
1795 EOH
1796         dflt='Type carriage return to continue'
1797         . ./myread
1798         case "$firsttime" in
1799         true) echo $user >>../.config/instruct;;
1800         esac
1801 fi
1802
1803 : find out where common programs are
1804 echo " "
1805 echo "Locating common programs..." >&4
1806 cat <<EOSC >loc
1807 $startsh
1808 case \$# in
1809 0) exit 1;;
1810 esac
1811 thing=\$1
1812 shift
1813 dflt=\$1
1814 shift
1815 for dir in \$*; do
1816         case "\$thing" in
1817         .)
1818         if test -d \$dir/\$thing; then
1819                 echo \$dir
1820                 exit 0
1821         fi
1822         ;;
1823         *)
1824         for thisthing in \$dir/\$thing; do
1825                 : just loop through to pick last item
1826         done
1827         if test -f \$thisthing; then
1828                 echo \$thisthing
1829                 exit 0
1830         elif test -f \$dir/\$thing.exe; then
1831                 if test -n "$DJGPP"; then
1832                         echo \$dir/\$thing.exe
1833                 else
1834                         : on Eunice apparently
1835                         echo \$dir/\$thing
1836                 fi
1837                 exit 0
1838         fi
1839         ;;
1840         esac
1841 done
1842 echo \$dflt
1843 exit 1
1844 EOSC
1845 chmod +x loc
1846 $eunicefix loc
1847 loclist="
1848 awk
1849 cat
1850 comm
1851 cp
1852 echo
1853 expr
1854 grep
1855 ls
1856 make
1857 mkdir
1858 rm
1859 sed
1860 sort
1861 touch
1862 tr
1863 uniq
1864 "
1865 trylist="
1866 Mcc
1867 ar
1868 byacc
1869 cpp
1870 csh
1871 date
1872 egrep
1873 gzip
1874 less
1875 ln
1876 more
1877 nm
1878 nroff
1879 pg
1880 test
1881 uname
1882 zip
1883 "
1884 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1885 pth="$pth /lib /usr/lib"
1886 for file in $loclist; do
1887         eval xxx=\$$file
1888         case "$xxx" in
1889         /*|?:[\\/]*)
1890                 if test -f "$xxx"; then
1891                         : ok
1892                 else
1893                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1894                         xxx=`./loc $file $file $pth`
1895                 fi
1896                 ;;
1897         '') xxx=`./loc $file $file $pth`;;
1898         *) xxx=`./loc $xxx $xxx $pth`;;
1899         esac
1900         eval $file=$xxx
1901         eval _$file=$xxx
1902         case "$xxx" in
1903         /*)
1904                 echo $file is in $xxx.
1905                 ;;
1906         ?:[\\/]*)
1907                 echo $file is in $xxx.
1908                 ;;
1909         *)
1910                 echo "I don't know where '$file' is, and my life depends on it." >&4
1911                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1912                 exit 1
1913                 ;;
1914         esac
1915 done
1916 echo " "
1917 echo "Don't worry if any of the following aren't found..."
1918 say=offhand
1919 for file in $trylist; do
1920         eval xxx=\$$file
1921         case "$xxx" in
1922         /*|?:[\\/]*)
1923                 if test -f "$xxx"; then
1924                         : ok
1925                 else
1926                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
1927                         xxx=`./loc $file $file $pth`
1928                 fi
1929                 ;;
1930         '') xxx=`./loc $file $file $pth`;;
1931         *) xxx=`./loc $xxx $xxx $pth`;;
1932         esac
1933         eval $file=$xxx
1934         eval _$file=$xxx
1935         case "$xxx" in
1936         /*)
1937                 echo $file is in $xxx.
1938                 ;;
1939         ?:[\\/]*)
1940                 echo $file is in $xxx.
1941                 ;;
1942         *)
1943                 echo "I don't see $file out there, $say."
1944                 say=either
1945                 ;;
1946         esac
1947 done
1948 case "$egrep" in
1949 egrep)
1950         echo "Substituting grep for egrep."
1951         egrep=$grep
1952         ;;
1953 esac
1954 case "$ln" in
1955 ln)
1956         echo "Substituting cp for ln."
1957         ln=$cp
1958         ;;
1959 esac
1960 case "$test" in
1961 test)
1962         echo "Hopefully test is built into your sh."
1963         ;;
1964 *)
1965         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1966                 echo "Using the test built into your sh."
1967                 test=test
1968                 _test=test
1969         fi
1970         ;;
1971 esac
1972 case "$echo" in
1973 echo)
1974         echo "Hopefully echo is built into your sh."
1975         ;;
1976 '') ;;
1977 *)
1978         echo " "
1979 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1980         $echo $n "hi there$c" >foo1
1981         echo $n "hi there$c" >foo2
1982         if cmp foo1 foo2 >/dev/null 2>&1; then
1983                 echo "They are compatible.  In fact, they may be identical."
1984         else
1985                 case "$n" in
1986                 '-n') n='' c='\c';;
1987                 *) n='-n' c='';;
1988                 esac
1989                 cat <<FOO
1990 They are not compatible!  You are probably running ksh on a non-USG system.
1991 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1992 have echo built in and we may have to run some Bourne shell scripts.  That
1993 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
1994
1995 FOO
1996                 $echo $n "The star should be here-->$c"
1997                 $echo "*"
1998         fi
1999         $rm -f foo1 foo2
2000         ;;
2001 esac
2002
2003 : determine whether symbolic links are supported
2004 echo " "
2005 $touch blurfl
2006 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2007         echo "Symbolic links are supported." >&4
2008         lns="$ln -s"
2009 else
2010         echo "Symbolic links are NOT supported." >&4
2011         lns="$ln"
2012 fi
2013 $rm -f blurfl sym
2014
2015 : see whether [:lower:] and [:upper:] are supported character classes
2016 echo " "
2017 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2018 ABYZ)
2019         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2020         up='[:upper:]'
2021         low='[:lower:]'
2022         ;;
2023 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2024         # (0xc9 and 0xd1), therefore that is a nice testing point.
2025         if test "X$up" = X -o "X$low" = X; then
2026             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2027             ij) up='[A-Z]'
2028                 low='[a-z]'
2029                 ;;
2030             esac
2031         fi
2032         if test "X$up" = X -o "X$low" = X; then
2033             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2034             ij) up='A-Z'
2035                 low='a-z'
2036                 ;;
2037             esac
2038         fi
2039         if test "X$up" = X -o "X$low" = X; then
2040             case "`echo IJ | od -x 2>/dev/null`" in
2041             *C9D1*|*c9d1*)
2042                 echo "Hey, this might be EBCDIC." >&4
2043                 if test "X$up" = X -o "X$low" = X; then
2044                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2045                     ij) up='[A-IJ-RS-Z]'
2046                         low='[a-ij-rs-z]'
2047                         ;;
2048                     esac
2049                 fi
2050                 if test "X$up" = X -o "X$low" = X; then
2051                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2052                     ij) up='A-IJ-RS-Z'
2053                         low='a-ij-rs-z'
2054                         ;;
2055                     esac
2056                 fi
2057                 ;;
2058             esac
2059         fi
2060 esac
2061 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2062 ij)
2063     echo "Using $up and $low to convert case." >&4
2064     ;;
2065 *)
2066     echo "I don't know how to translate letters from upper to lower case." >&4
2067     echo "Your tr is not acting any way I know of." >&4
2068     exit 1
2069     ;;
2070 esac
2071 : set up the translation script tr, must be called with ./tr of course
2072 cat >tr <<EOSC
2073 $startsh
2074 case "\$1\$2" in
2075 '[A-Z][a-z]') exec $tr '$up' '$low';;
2076 '[a-z][A-Z]') exec $tr '$low' '$up';;
2077 esac
2078 exec $tr "\$@"
2079 EOSC
2080 chmod +x tr
2081 $eunicefix tr
2082
2083 : Try to determine whether config.sh was made on this system
2084 case "$config_sh" in
2085 '')
2086 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
2087 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2088 # because the A-Z/a-z are not consecutive.
2089 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2090         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2091 newmyuname="$myuname"
2092 dflt=n
2093 case "$knowitall" in
2094 '')
2095         if test -f ../config.sh; then
2096                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2097                         eval "`grep myuname= ../config.sh`"
2098                 fi
2099                 if test "X$myuname" = "X$newmyuname"; then
2100                         dflt=y
2101                 fi
2102         fi
2103         ;;
2104 *) dflt=y;;
2105 esac
2106
2107 : Get old answers from old config file if Configure was run on the
2108 : same system, otherwise use the hints.
2109 hint=default
2110 cd ..
2111 if test -f config.sh; then
2112         echo " "
2113         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2114         . UU/myread
2115         case "$ans" in
2116         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
2117         *)  echo "Fetching default answers from your old config.sh file..." >&4
2118                 tmp_n="$n"
2119                 tmp_c="$c"
2120                 tmp_sh="$sh"
2121                 . ./config.sh
2122                 cp config.sh UU
2123                 n="$tmp_n"
2124                 c="$tmp_c"
2125                 : Older versions did not always set $sh.  Catch re-use of such
2126                 : an old config.sh.
2127                 case "$sh" in
2128                 '') sh="$tmp_sh" ;;
2129                 esac
2130                 hint=previous
2131                 ;;
2132         esac
2133 fi
2134 if test ! -f config.sh; then
2135         $cat <<EOM
2136
2137 First time through, eh?  I have some defaults handy for some systems
2138 that need some extra help getting the Configure answers right:
2139
2140 EOM
2141         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2142         dflt=''
2143         : Half the following guesses are probably wrong... If you have better
2144         : tests or hints, please send them to perlbug@perl.com
2145         : The metaconfig authors would also appreciate a copy...
2146         $test -f /irix && osname=irix
2147         $test -f /xenix && osname=sco_xenix
2148         $test -f /dynix && osname=dynix
2149         $test -f /dnix && osname=dnix
2150         $test -f /lynx.os && osname=lynxos
2151         $test -f /unicos && osname=unicos && osvers=`$uname -r`
2152         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
2153         $test -f /bin/mips && /bin/mips && osname=mips
2154         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
2155                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
2156         $test -d /usr/apollo/bin && osname=apollo
2157         $test -f /etc/saf/_sactab && osname=svr4
2158         $test -d /usr/include/minix && osname=minix
2159         if $test -d /MachTen -o -d /MachTen_Folder; then
2160                 osname=machten
2161                 if $test -x /sbin/version; then
2162                         osvers=`/sbin/version | $awk '{print $2}' |
2163                         $sed -e 's/[A-Za-z]$//'`
2164                 elif $test -x /usr/etc/version; then
2165                         osvers=`/usr/etc/version | $awk '{print $2}' |
2166                         $sed -e 's/[A-Za-z]$//'`
2167                 else
2168                         osvers="$2.$3"
2169                 fi
2170         fi
2171        $test -f /sys/posix.dll &&
2172                $test -f /usr/bin/what &&
2173                set X `/usr/bin/what /sys/posix.dll` &&
2174                $test "$3" = UWIN &&
2175                osname=uwin &&
2176                osvers="$5"
2177         if $test -f $uname; then
2178                 set X $myuname
2179                 shift
2180
2181                 case "$5" in
2182                 fps*) osname=fps ;;
2183                 mips*)
2184                         case "$4" in
2185                         umips) osname=umips ;;
2186                         *) osname=mips ;;
2187                         esac;;
2188                 [23]100) osname=mips ;;
2189                 next*) osname=next ;;
2190                 i386*)
2191                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
2192                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
2193                                 osname='sco'
2194                                 osvers=$tmp
2195                         elif $test -f /etc/kconfig; then
2196                                 osname=isc
2197                                 if test "$lns" = "$ln -s"; then
2198                                         osvers=4
2199                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
2200                                         osvers=3
2201                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
2202                                         osvers=2
2203                                 fi
2204                         fi
2205                         tmp=''
2206                         ;;
2207                 pc*)
2208                         if test -n "$DJGPP"; then
2209                                 osname=dos
2210                                 osvers=djgpp
2211                         fi
2212                         ;;
2213                 esac
2214
2215                 case "$1" in
2216                 aix) osname=aix
2217                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
2218                         case "$tmp" in
2219                         'not found') osvers="$4"."$3" ;;
2220                         '<3240'|'<>3240') osvers=3.2.0 ;;
2221                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
2222                         '=3250'|'>3250') osvers=3.2.5 ;;
2223                         *) osvers=$tmp;;
2224                         esac
2225                         ;;
2226                 *dc.osx) osname=dcosx
2227                         osvers="$3"
2228                         ;;
2229                 dnix) osname=dnix
2230                         osvers="$3"
2231                         ;;
2232                 domainos) osname=apollo
2233                         osvers="$3"
2234                         ;;
2235                 dgux) osname=dgux 
2236                         osvers="$3"
2237                         ;;
2238                 dynixptx*) osname=dynixptx
2239                         osvers=`echo "$4"|sed 's/^v//'`
2240                         ;;
2241                 freebsd) osname=freebsd 
2242                         osvers="$3" ;;
2243                 genix) osname=genix ;;
2244                 hp*) osname=hpux 
2245                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
2246                         ;;
2247                 irix*) osname=irix
2248                         case "$3" in
2249                         4*) osvers=4 ;;
2250                         5*) osvers=5 ;;
2251                         *)      osvers="$3" ;;
2252                         esac
2253                         ;;
2254                 linux) osname=linux
2255                         case "$3" in
2256                         *)      osvers="$3" ;;
2257                         esac
2258                         ;;
2259                 MiNT) osname=mint
2260                         ;;
2261                 netbsd*) osname=netbsd
2262                         osvers="$3"
2263                         ;;
2264                 news-os) osvers="$3"
2265                         case "$3" in
2266                         4*) osname=newsos4 ;;
2267                         *) osname=newsos ;;
2268                         esac
2269                         ;;
2270                 bsd386) osname=bsd386
2271                         osvers=`$uname -r`
2272                         ;;
2273                 POSIX-BC | posix-bc ) osname=posix-bc
2274                         osvers="$3"
2275                         ;;
2276                 powerux | power_ux | powermax_os | powermaxos | \
2277                 powerunix | power_unix) osname=powerux
2278                         osvers="$3"
2279                         ;;
2280                 next*) osname=next ;;
2281                 solaris) osname=solaris
2282                         case "$3" in
2283                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2284                         *)      osvers="$3" ;;
2285                         esac
2286                         ;;
2287                 sunos) osname=sunos
2288                         case "$3" in
2289                         5*) osname=solaris
2290                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2291                         *)      osvers="$3" ;;
2292                         esac
2293                         ;;
2294                 titanos) osname=titanos
2295                         case "$3" in
2296                         1*) osvers=1 ;;
2297                         2*) osvers=2 ;;
2298                         3*) osvers=3 ;;
2299                         4*) osvers=4 ;;
2300                         *)      osvers="$3" ;;
2301                         esac
2302                         ;;
2303                 ultrix) osname=ultrix
2304                         osvers="$3"
2305                         ;;
2306                 osf1|mls+)      case "$5" in
2307                                 alpha)
2308                                         osname=dec_osf
2309                                         osvers=`echo "$3" | sed 's/^[xvt]//'`
2310                                         ;;
2311                         hp*)    osname=hp_osf1  ;;
2312                         mips)   osname=mips_osf1 ;;
2313                         esac
2314                         ;;
2315                 unixware) osname=svr5
2316                         osvers="$4"
2317                         ;;
2318                 uts) osname=uts
2319                         osvers="$3"
2320                         ;;
2321                 qnx) osname=qnx
2322                         osvers="$4"
2323                         ;;
2324                 $2) case "$osname" in
2325                         *isc*) ;;
2326                         *freebsd*) ;;
2327                         svr*)
2328                                 : svr4.x or possibly later
2329                                 case "svr$3" in 
2330                                 ${osname}*)
2331                                         osname=svr$3
2332                                         osvers=$4
2333                                         ;;
2334                                 esac
2335                                 case "$osname" in
2336                                 svr4.0)
2337                                         : Check for ESIX
2338                                         if test -f /stand/boot ; then
2339                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2340                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
2341                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
2342                                                         if test -n "$isesix"; then
2343                                                                 osname=esix4
2344                                                         fi
2345                                                 fi
2346                                         fi
2347                                         ;;
2348                                 esac
2349                                 ;;
2350                         *)      if test -f /etc/systemid; then
2351                                         osname=sco
2352                                         set `echo $3 | $sed 's/\./ /g'` $4
2353                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
2354                                                 osvers=$1.$2.$3
2355                                         elif $test -f $src/hints/sco_$1_$2.sh; then
2356                                                 osvers=$1.$2
2357                                         elif $test -f $src/hints/sco_$1.sh; then
2358                                                 osvers=$1
2359                                         fi
2360                                 else
2361                                         case "$osname" in
2362                                         '') : Still unknown.  Probably a generic Sys V.
2363                                                 osname="sysv"
2364                                                 osvers="$3"
2365                                                 ;;
2366                                         esac
2367                                 fi
2368                                 ;;
2369                         esac
2370                         ;;
2371                 *)      case "$osname" in
2372                         '') : Still unknown.  Probably a generic BSD.
2373                                 osname="$1"
2374                                 osvers="$3"
2375                                 ;;
2376                         esac
2377                         ;;
2378                 esac
2379         else
2380                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
2381                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2382                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2383                                 osname=news_os
2384                         fi
2385                         $rm -f UU/kernel.what
2386                 elif test -d c:/.; then
2387                         set X $myuname
2388                         osname=os2
2389                         osvers="$5"
2390                 fi
2391         fi
2392         
2393         : Now look for a hint file osname_osvers, unless one has been
2394         : specified already.
2395         case "$hintfile" in
2396         ''|' ')
2397                 file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'`
2398                 : Also try without trailing minor version numbers.
2399                 xfile=`echo $file | $sed -e 's@_[^_]*$@@'`
2400                 xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'`
2401                 xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'`
2402                 xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'`
2403                 case "$file" in
2404                 '') dflt=none ;;
2405                 *)  case "$osvers" in
2406                         '') dflt=$file
2407                                 ;;
2408                         *)  if $test -f $src/hints/$file.sh ; then
2409                                         dflt=$file
2410                                 elif $test -f $src/hints/$xfile.sh ; then
2411                                         dflt=$xfile
2412                                 elif $test -f $src/hints/$xxfile.sh ; then
2413                                         dflt=$xxfile
2414                                 elif $test -f $src/hints/$xxxfile.sh ; then
2415                                         dflt=$xxxfile
2416                                 elif $test -f $src/hints/$xxxxfile.sh ; then
2417                                         dflt=$xxxxfile
2418                                 elif $test -f "$src/hints/${osname}.sh" ; then
2419                                         dflt="${osname}"
2420                                 else
2421                                         dflt=none
2422                                 fi
2423                                 ;;
2424                         esac
2425                         ;;
2426                 esac
2427                 if $test -f Policy.sh ; then
2428                         case "$dflt" in
2429                         *Policy*) ;;
2430                         none) dflt="Policy" ;;
2431                         *) dflt="Policy $dflt" ;;
2432                         esac
2433                 fi
2434                 ;;
2435         *)
2436                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
2437                 ;;
2438         esac
2439
2440         if $test -f Policy.sh ; then
2441                 $cat <<EOM
2442
2443 There's also a Policy hint file available, which should make the
2444 site-specific (policy) questions easier to answer.
2445 EOM
2446
2447         fi
2448
2449         $cat <<EOM
2450
2451 You may give one or more space-separated answers, or "none" if appropriate.
2452 A well-behaved OS will have no hints, so answering "none" or just "Policy"
2453 is a good thing.  DO NOT give a wrong version or a wrong OS.
2454
2455 EOM
2456
2457         rp="Which of these apply, if any?"
2458         . UU/myread
2459         tans=$ans
2460         for file in $tans; do
2461                 if $test X$file = XPolicy -a -f Policy.sh; then
2462                         . Policy.sh
2463                         $cat Policy.sh >> UU/config.sh
2464                 elif $test -f $src/hints/$file.sh; then
2465                         . $src/hints/$file.sh
2466                         $cat $src/hints/$file.sh >> UU/config.sh
2467                 elif $test X$tans = X -o X$tans = Xnone ; then
2468                         : nothing
2469                 else
2470                         : Give one chance to correct a possible typo.
2471                         echo "$file.sh does not exist"
2472                         dflt=$file
2473                         rp="hint to use instead?"
2474                         . UU/myread
2475                         for file in $ans; do
2476                                 if $test -f "$src/hints/$file.sh"; then
2477                                         . $src/hints/$file.sh
2478                                         $cat $src/hints/$file.sh >> UU/config.sh
2479                                 elif $test X$ans = X -o X$ans = Xnone ; then
2480                                         : nothing
2481                                 else
2482                                         echo "$file.sh does not exist -- ignored."
2483                                 fi
2484                         done
2485                 fi
2486         done
2487
2488         hint=recommended
2489         : Remember our hint file for later.
2490         if $test -f "$src/hints/$file.sh" ; then
2491                 hintfile="$file"
2492         else
2493                 hintfile=''
2494         fi
2495 fi
2496 cd UU
2497 ;;
2498 *)
2499         echo " "
2500         echo "Fetching default answers from $config_sh..." >&4
2501         tmp_n="$n"
2502         tmp_c="$c"
2503         cd ..
2504         cp $config_sh config.sh 2>/dev/null
2505         chmod +w config.sh
2506         . ./config.sh
2507         cd UU
2508         cp ../config.sh .
2509         n="$tmp_n"
2510         c="$tmp_c"
2511         hint=previous
2512         ;;
2513 esac
2514 test "$override" && . ./optdef.sh
2515 myuname="$newmyuname"
2516
2517 : Restore computed paths
2518 for file in $loclist $trylist; do
2519         eval $file="\$_$file"
2520 done
2521
2522 cat << EOM
2523
2524 Configure uses the operating system name and version to set some defaults.
2525 The default value is probably right if the name rings a bell. Otherwise,
2526 since spelling matters for me, either accept the default or answer "none"
2527 to leave it blank.
2528
2529 EOM
2530 case "$osname" in
2531         ''|' ')
2532                 case "$hintfile" in
2533                 ''|' '|none) dflt=none ;;
2534                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2535                 esac
2536                 ;;
2537         *) dflt="$osname" ;;
2538 esac
2539 rp="Operating system name?"
2540 . ./myread
2541 case "$ans" in
2542 none)  osname='' ;;
2543 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2544 esac
2545 echo " "
2546 case "$osvers" in
2547         ''|' ')
2548                 case "$hintfile" in
2549                 ''|' '|none) dflt=none ;;
2550                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2551                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2552                         case "$dflt" in
2553                         ''|' ') dflt=none ;;
2554                         esac
2555                         ;;
2556                 esac
2557                 ;;
2558         *) dflt="$osvers" ;;
2559 esac
2560 rp="Operating system version?"
2561 . ./myread
2562 case "$ans" in
2563 none)  osvers='' ;;
2564 *) osvers="$ans" ;;
2565 esac
2566
2567
2568 . ./posthint.sh
2569
2570 : who configured the system
2571 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2572 cf_by=`(logname) 2>/dev/null`
2573 case "$cf_by" in
2574 "")
2575         cf_by=`(whoami) 2>/dev/null`
2576         case "$cf_by" in
2577         "") cf_by=unknown ;;
2578         esac ;;
2579 esac
2580
2581 : set up the script used to warn in case of inconsistency
2582 cat <<EOS >whoa
2583 $startsh
2584 EOS
2585 cat <<'EOSC' >>whoa
2586 dflt=y
2587 echo " "
2588 echo "*** WHOA THERE!!! ***" >&4
2589 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
2590 rp="    Keep the $hint value?"
2591 . ./myread
2592 case "$ans" in
2593 y) td=$was; tu=$was;;
2594 esac
2595 EOSC
2596
2597 : function used to set $1 to $val
2598 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2599 case "$val$was" in
2600 $define$undef) . ./whoa; eval "$var=\$td";;
2601 $undef$define) . ./whoa; eval "$var=\$tu";;
2602 *) eval "$var=$val";;
2603 esac'
2604
2605 cat <<EOM
2606
2607 Perl can be built to take advantage of threads, on some systems.
2608 To do so, Configure must be run with -Dusethreads.
2609
2610 Note that threading is a highly experimental feature, and
2611 some known race conditions still remain.  If you choose to try
2612 it, be very sure to not actually deploy it for production
2613 purposes.  README.threads has more details, and is required
2614 reading if you enable threads.
2615 EOM
2616 case "$usethreads" in
2617 $define|true|[yY]*)     dflt='y';;
2618 *) dflt='n';;
2619 esac
2620 rp='Build a threading Perl?'
2621 . ./myread
2622 case "$ans" in
2623 y|Y)    val="$define" ;;     
2624 *)      val="$undef" ;;
2625 esac
2626 set usethreads
2627 eval $setvar 
2628
2629 case "$d_oldpthreads" in
2630 '')     : Configure tests would be welcome here.  For now, assume undef.
2631         val="$undef" ;;
2632 *)      val="$d_oldpthreads" ;;
2633 esac
2634 set d_oldpthreads
2635 eval $setvar
2636
2637
2638 case "$usethreads" in
2639 "$define"|true|[yY]*)
2640 : Look for a hint-file generated 'call-back-unit'.  If the
2641 : user has specified that a threading perl is to be built,
2642 : we may need to set or change some other defaults.
2643         if $test -f usethreads.cbu; then
2644                 echo "Your platform has some specific hints for threaded builds, using them..."
2645                 . ./usethreads.cbu
2646         else
2647                 $cat <<EOM
2648 (Your platform doesn't have any specific hints for threaded builds.
2649  Assuming POSIX threads, then.)
2650 EOM
2651         fi
2652     ;;
2653 esac
2654
2655 cat <<EOM
2656
2657 Perl can be built so that multiple Perl interpreters can coexist
2658 within the same Perl executable.  To do so, Configure must be run with
2659 -Dusemultiplicity.
2660
2661 Normally you do not need this and you should answer no.
2662
2663 EOM
2664 case "$usemultiplicity" in
2665 $define|true|[yY]*)     dflt='y';;
2666 *) dflt='n';;
2667 esac
2668 rp='Build Perl for multiplicity?'
2669 . ./myread
2670 case "$ans" in
2671 y|Y)    val="$define" ;;     
2672 *)      val="$undef" ;;
2673 esac
2674 set usemultiplicity
2675 eval $setvar 
2676
2677 : determine where manual pages are on this system
2678 echo " "
2679 case "$sysman" in
2680 '') 
2681         syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
2682         syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2683         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2684         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2685         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2686         sysman=`./loc . /usr/man/man1 $syspath`
2687         ;;
2688 esac
2689 if $test -d "$sysman"; then
2690         echo "System manual is in $sysman." >&4
2691 else
2692         echo "Could not find manual pages in source form." >&4
2693 fi
2694
2695 : see what memory models we can support
2696 case "$models" in
2697 '')
2698         $cat >pdp11.c <<'EOP'
2699 int main() {
2700 #ifdef pdp11
2701         exit(0);
2702 #else
2703         exit(1);
2704 #endif
2705 }
2706 EOP
2707         ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1
2708         if $test -f pdp11 && ./pdp11 2>/dev/null; then
2709                 dflt='unsplit split'
2710         else
2711                 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
2712                 case "$tans" in
2713                 X) dflt='none';;
2714                 *) if $test -d /lib/small || $test -d /usr/lib/small; then
2715                                 dflt='small'
2716                         else
2717                                 dflt=''
2718                         fi
2719                         if $test -d /lib/medium || $test -d /usr/lib/medium; then
2720                                 dflt="$dflt medium"
2721                         fi
2722                         if $test -d /lib/large || $test -d /usr/lib/large; then
2723                                 dflt="$dflt large"
2724                         fi
2725                         if $test -d /lib/huge || $test -d /usr/lib/huge; then
2726                                 dflt="$dflt huge"
2727                         fi
2728                 esac
2729         fi;;
2730 *) dflt="$models";;
2731 esac
2732 $cat <<EOM
2733  
2734 Some systems have different model sizes.  On most systems they are called
2735 small, medium, large, and huge.  On the PDP11 they are called unsplit and
2736 split.  If your system doesn't support different memory models, say "none".
2737 If you wish to force everything to one memory model, say "none" here and
2738 put the appropriate flags later when it asks you for other cc and ld flags.
2739 Venix systems may wish to put "none" and let the compiler figure things out.
2740 (In the following question multiple model names should be space separated.)
2741
2742 The default for most systems is "none".
2743
2744 EOM
2745 rp="Which memory models are supported?"
2746 . ./myread
2747 models="$ans"
2748
2749 case "$models" in
2750 none)
2751         small=''
2752         medium=''
2753         large=''
2754         huge=''
2755         unsplit=''
2756         split=''
2757         ;;
2758 *split)
2759         case "$split" in
2760         '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
2761                          $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
2762                         dflt='-i'
2763                 else
2764                         dflt='none'
2765                 fi;;
2766         *) dflt="$split";;
2767         esac
2768         rp="What flag indicates separate I and D space?"
2769         . ./myread
2770         tans="$ans"
2771         case "$tans" in
2772         none) tans='';;
2773         esac
2774         split="$tans"
2775         unsplit='';;
2776 *large*|*small*|*medium*|*huge*)
2777         case "$models" in
2778         *large*)
2779                 case "$large" in
2780                 '') dflt='-Ml';;
2781                 *) dflt="$large";;
2782                 esac
2783         rp="What flag indicates large model?"
2784         . ./myread
2785         tans="$ans"
2786         case "$tans" in
2787         none) tans='';
2788         esac
2789         large="$tans";;
2790         *) large='';;
2791         esac
2792         case "$models" in
2793         *huge*) case "$huge" in
2794                 '') dflt='-Mh';;
2795                 *) dflt="$huge";;
2796                 esac
2797                 rp="What flag indicates huge model?"
2798                 . ./myread
2799                 tans="$ans"
2800                 case "$tans" in
2801                 none) tans='';
2802                 esac
2803                 huge="$tans";;
2804         *) huge="$large";;
2805         esac
2806         case "$models" in
2807         *medium*) case "$medium" in
2808                 '') dflt='-Mm';;
2809                 *) dflt="$medium";;
2810                 esac
2811                 rp="What flag indicates medium model?"
2812                 . ./myread
2813                 tans="$ans"
2814                 case "$tans" in
2815                 none) tans='';
2816                 esac
2817                 medium="$tans";;
2818         *) medium="$large";;
2819         esac
2820         case "$models" in
2821         *small*) case "$small" in
2822                 '') dflt='none';;
2823                 *) dflt="$small";;
2824                 esac
2825                 rp="What flag indicates small model?"
2826                 . ./myread
2827                 tans="$ans"
2828                 case "$tans" in
2829                 none) tans='';
2830                 esac
2831                 small="$tans";;
2832         *) small='';;
2833         esac
2834         ;;
2835 *)
2836         echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
2837         ;;
2838 esac
2839 $rm -f pdp11.* pdp11
2840
2841 : make some quick guesses about what we are up against
2842 echo " "
2843 $echo $n "Hmm...  $c"
2844 echo exit 1 >bsd
2845 echo exit 1 >usg
2846 echo exit 1 >v7
2847 echo exit 1 >osf1
2848 echo exit 1 >eunice
2849 echo exit 1 >xenix
2850 echo exit 1 >venix
2851 echo exit 1 >os2
2852 d_bsd="$undef"
2853 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2854 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2855 then
2856         echo "Looks kind of like an OSF/1 system, but we'll see..."
2857         echo exit 0 >osf1
2858 elif test `echo abc | tr a-z A-Z` = Abc ; then
2859         xxx=`./loc addbib blurfl $pth`
2860         if $test -f $xxx; then
2861         echo "Looks kind of like a USG system with BSD features, but we'll see..."
2862                 echo exit 0 >bsd
2863                 echo exit 0 >usg
2864         else
2865                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2866                         echo "Looks kind of like an extended USG system, but we'll see..."
2867                 else
2868                         echo "Looks kind of like a USG system, but we'll see..."
2869                 fi
2870                 echo exit 0 >usg
2871         fi
2872 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2873         echo "Looks kind of like a BSD system, but we'll see..."
2874         d_bsd="$define"
2875         echo exit 0 >bsd
2876 else
2877         echo "Looks kind of like a Version 7 system, but we'll see..."
2878         echo exit 0 >v7
2879 fi
2880 case "$eunicefix" in
2881 *unixtovms*)
2882         $cat <<'EOI'
2883 There is, however, a strange, musty smell in the air that reminds me of
2884 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2885 EOI
2886         echo exit 0 >eunice
2887         d_eunice="$define"
2888 : it so happens the Eunice I know will not run shell scripts in Unix format
2889         ;;
2890 *)
2891         echo " "
2892         echo "Congratulations.  You aren't running Eunice."
2893         d_eunice="$undef"
2894         ;;
2895 esac
2896 : Detect OS2.  The p_ variable is set above in the Head.U unit.
2897 case "$p_" in
2898 :) ;;
2899 *)
2900         $cat <<'EOI'
2901 I have the feeling something is not exactly right, however...don't tell me...
2902 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2903 EOI
2904         echo exit 0 >os2
2905         ;;
2906 esac
2907 if test -f /xenix; then
2908         echo "Actually, this looks more like a XENIX system..."
2909         echo exit 0 >xenix
2910         d_xenix="$define"
2911 else
2912         echo " "
2913         echo "It's not Xenix..."
2914         d_xenix="$undef"
2915 fi
2916 chmod +x xenix
2917 $eunicefix xenix
2918 if test -f /venix; then
2919         echo "Actually, this looks more like a VENIX system..."
2920         echo exit 0 >venix
2921 else
2922         echo " "
2923         if ./xenix; then
2924                 : null
2925         else
2926                 echo "Nor is it Venix..."
2927         fi
2928 fi
2929 chmod +x bsd usg v7 osf1 eunice xenix venix os2
2930 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
2931 $rm -f foo
2932
2933 : see if we need a special compiler
2934 echo " "
2935 if ./usg; then
2936         case "$cc" in
2937         '') case "$Mcc" in
2938                 /*) dflt='Mcc';;
2939                 *) case "$large" in
2940                         -M*) dflt='cc';;
2941                         *)      if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
2942                                         if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
2943                                                 dflt='cc'
2944                                         else
2945                                                 dflt='cc -M'
2946                                         fi
2947                                 else
2948                                         dflt='cc'
2949                                 fi;;
2950                         esac;;
2951                 esac;;
2952         *)  dflt="$cc";;
2953         esac
2954         case "$dflt" in
2955         *M*)    $cat <<'EOM'
2956 On some older systems the default C compiler will not resolve multiple global
2957 references that happen to have the same name.  On some such systems the "Mcc"
2958 command may be used to force these to be resolved.  On other systems a "cc -M"
2959 command is required.  (Note that the -M flag on other systems indicates a
2960 memory model to use!) If you have the Gnu C compiler, you might wish to use
2961 that instead.
2962
2963 EOM
2964         ;;
2965         esac
2966         rp="Use which C compiler?"
2967         . ./myread
2968         cc="$ans"
2969 else
2970         case "$cc" in
2971         '') dflt=cc;;
2972         *) dflt="$cc";;
2973         esac
2974         rp="Use which C compiler?"
2975         . ./myread
2976         cc="$ans"
2977 fi
2978 : Look for a hint-file generated 'call-back-unit'.  Now that the
2979 : user has specified the compiler, we may need to set or change some
2980 : other defaults.
2981 if $test -f cc.cbu; then
2982     . ./cc.cbu
2983 fi
2984 echo " "
2985 echo "Checking for GNU cc in disguise and/or its version number..." >&4
2986 $cat >gccvers.c <<EOM
2987 #include <stdio.h>
2988 int main() {
2989 #ifdef __GNUC__
2990 #ifdef __VERSION__
2991         printf("%s\n", __VERSION__);
2992 #else
2993         printf("%s\n", "1");
2994 #endif
2995 #endif
2996         exit(0);
2997 }
2998 EOM
2999 if $cc -o gccvers gccvers.c; then
3000         gccversion=`./gccvers`
3001         case "$gccversion" in
3002         '') echo "You are not using GNU cc." ;;
3003         *)  echo "You are using GNU cc $gccversion." ;;
3004         esac
3005 else
3006         echo " "
3007         echo "*** WHOA THERE!!! ***" >&4
3008         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3009         case "$knowitall" in
3010         '')
3011         echo "    You'd better start hunting for one and let me know about it." >&4
3012                 exit 1
3013                 ;;
3014         esac
3015 fi
3016 $rm -f gccvers*
3017 case "$gccversion" in
3018 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3019 esac
3020
3021
3022 case "$usemorebits" in
3023 "$define"|true|[yY]*)
3024         use64bits="$define"
3025         uselongdouble="$define"
3026         usemorebits="$define"
3027         ;;
3028 *)      usemorebits="$undef"
3029         ;;
3030 esac
3031
3032
3033 cat <<EOM
3034
3035 Perl can be built to understand large files (files larger than 2 gigabytes)
3036 on some systems.  To do so, Configure must be run with -Duselargefiles.
3037
3038 If this doesn't make any sense to you, just accept the default.
3039 EOM
3040 case "$uselargefiles" in
3041 "$define"|true|[yY]*) dflt='y' ;;
3042 *)      dflt='n' ;;
3043 esac
3044 rp='Try to understand large files?'
3045 . ./myread
3046 case "$ans" in
3047 y|Y)    val="$define" ;;
3048 *)      val="$undef"  ;;
3049 esac
3050 set uselargefiles
3051 eval $setvar
3052 case "$uselargefiles" in
3053 "$define") use64bits="$define" ;;
3054 esac
3055
3056 cat <<EOM
3057
3058 Perl can be built to take advantage of explicit 64-bit interfaces,
3059 on some systems.  To do so, Configure must be run with -Duse64bits.
3060
3061 If this doesn't make any sense to you, just accept the default.
3062 EOM
3063 case "$use64bits" in
3064 $define|true|[yY]*)     dflt='y';;
3065 *) dflt='n';;
3066 esac
3067 rp='Try to use explicit 64-bit interfaces, if available?'
3068 . ./myread
3069 case "$ans" in
3070 y|Y) 
3071         val="$define"
3072         ;;     
3073 *)      
3074         val="$undef"
3075         ;;
3076 esac
3077 set use64bits
3078 eval $setvar
3079
3080 case "$archname64" in
3081 '') archname64='' ;;    # not a typo
3082 esac
3083
3084 case "$use64bits" in
3085 "$define"|true|[yY]*)
3086 : Look for a hint-file generated 'call-back-unit'.  If the
3087 : user has specified that a 64 bit perl is to be built,
3088 : we may need to set or change some other defaults.
3089         if $test -f use64bits.cbu; then
3090                 echo "Your platform has some specific hints for 64-bit builds, using them..."
3091                 . ./use64bits.cbu
3092         else
3093                 $cat <<EOM
3094 (Your platform doesn't have any specific hints for 64-bit builds.
3095  This is probably okay, especially if your system is a true 64-bit system.)
3096 EOM
3097                 case "$gccversion" in
3098                 '')     ;;
3099                 *)      $cat <<EOM
3100 But since you seem to be using gcc,
3101 I will now add -DUSE_LONG_LONG to the compilation flags.
3102 EOM
3103                         ccflags="$ccflags -DUSE_LONG_LONG"
3104                         ;;
3105                 esac
3106         fi
3107         ;;
3108 esac
3109
3110 : determine the architecture name
3111 echo " "
3112 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
3113         tarch=`arch`"-$osname"
3114 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
3115         if uname -m > tmparch 2>&1 ; then
3116                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
3117                         -e 's/$/'"-$osname/" tmparch`
3118         else
3119                 tarch="$osname"
3120         fi
3121         $rm -f tmparch
3122 else
3123         tarch="$osname"
3124 fi
3125 case "$myarchname" in
3126 ''|"$tarch") ;;
3127 *)
3128         echo "(Your architecture name used to be $myarchname.)"
3129         archname=''
3130         ;;
3131 esac
3132 myarchname="$tarch"
3133 case "$archname" in
3134 '') dflt="$tarch";;
3135 *) dflt="$archname";;
3136 esac
3137 rp='What is your architecture name'
3138 . ./myread
3139 archname="$ans"
3140 case "$usethreads" in
3141 $define)
3142         echo "Threads selected." >&4
3143         case "$archname" in
3144         *-thread*) echo "...and architecture name already has -thread." >&4
3145                 ;;
3146         *)      archname="$archname-thread"
3147                 echo "...setting architecture name to $archname." >&4
3148                 ;;
3149         esac
3150         ;;
3151 esac
3152 case "$usemultiplicity" in
3153 $define)
3154         echo "Multiplicity selected." >&4
3155         case "$archname" in
3156         *-multi*) echo "...and architecture name already has -multi." >&4
3157                 ;;
3158         *)      archname="$archname-multi"
3159                 echo "...setting architecture name to $archname." >&4
3160                 ;;
3161         esac
3162         ;;
3163 esac
3164 case "$use64bits" in
3165 $define)
3166         echo "Explicit 64-bitness selected." >&4
3167         case "$archname64" in
3168         '')
3169                 ;;
3170         *)
3171                 case "$archname" in
3172                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
3173                         ;;
3174                 *)      archname="$archname-$archname64"
3175                         echo "...setting architecture name to $archname." >&4
3176                         ;;
3177                 esac
3178                 ;;
3179         esac
3180 esac
3181
3182 : decide how portable to be.  Allow command line overrides.
3183 case "$d_portable" in
3184 "$undef") ;;
3185 *)      d_portable="$define" ;;
3186 esac
3187
3188 : set up shell script to do ~ expansion
3189 cat >filexp <<EOSS
3190 $startsh
3191 : expand filename
3192 case "\$1" in
3193  ~/*|~)
3194         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3195         ;;
3196  ~*)
3197         if $test -f /bin/csh; then
3198                 /bin/csh -f -c "glob \$1"
3199                 failed=\$?
3200                 echo ""
3201                 exit \$failed
3202         else
3203                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3204                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3205                 if $test ! -d "\$dir"; then
3206                         me=\`basename \$0\`
3207                         echo "\$me: can't locate home directory for: \$name" >&2
3208                         exit 1
3209                 fi
3210                 case "\$1" in
3211                 */*)
3212                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3213                         ;;
3214                 *)
3215                         echo \$dir
3216                         ;;
3217                 esac
3218         fi
3219         ;;
3220 *)
3221         echo \$1
3222         ;;
3223 esac
3224 EOSS
3225 chmod +x filexp
3226 $eunicefix filexp
3227
3228 : now set up to get a file name
3229 cat <<EOS >getfile
3230 $startsh
3231 EOS
3232 cat <<'EOSC' >>getfile
3233 tilde=''
3234 fullpath=''
3235 already=''
3236 skip=''
3237 none_ok=''
3238 exp_file=''
3239 nopath_ok=''
3240 orig_rp="$rp"
3241 orig_dflt="$dflt"
3242 case "$gfpth" in
3243 '') gfpth='.' ;;
3244 esac
3245
3246 case "$fn" in
3247 *\(*)
3248         expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
3249         fn=`echo $fn | sed 's/(.*)//'`
3250         ;;
3251 esac
3252
3253 case "$fn" in
3254 *:*)
3255         loc_file=`expr $fn : '.*:\(.*\)'`
3256         fn=`expr $fn : '\(.*\):.*'`
3257         ;;
3258 esac
3259
3260 case "$fn" in
3261 *~*) tilde=true;;
3262 esac
3263 case "$fn" in
3264 */*) fullpath=true;;
3265 esac
3266 case "$fn" in
3267 *+*) skip=true;;
3268 esac
3269 case "$fn" in
3270 *n*) none_ok=true;;
3271 esac
3272 case "$fn" in
3273 *e*) exp_file=true;;
3274 esac
3275 case "$fn" in
3276 *p*) nopath_ok=true;;
3277 esac
3278
3279 case "$fn" in
3280 *f*) type='File';;
3281 *d*) type='Directory';;
3282 *l*) type='Locate';;
3283 esac
3284
3285 what="$type"
3286 case "$what" in
3287 Locate) what='File';;
3288 esac
3289
3290 case "$exp_file" in
3291 '')
3292         case "$d_portable" in
3293         "$define") ;;
3294         *) exp_file=true;;
3295         esac
3296         ;;
3297 esac
3298
3299 cd ..
3300 while test "$type"; do
3301         redo=''
3302         rp="$orig_rp"
3303         dflt="$orig_dflt"
3304         case "$tilde" in
3305         true) rp="$rp (~name ok)";;
3306         esac
3307         . UU/myread
3308         if test -f UU/getfile.ok && \
3309                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3310         then
3311                 value="$ans"
3312                 ansexp="$ans"
3313                 break
3314         fi
3315         case "$ans" in
3316         none)
3317                 value=''
3318                 ansexp=''
3319                 case "$none_ok" in
3320                 true) type='';;
3321                 esac
3322                 ;;
3323         *)
3324                 case "$tilde" in
3325                 '') value="$ans"
3326                         ansexp="$ans";;
3327                 *)
3328                         value=`UU/filexp $ans`
3329                         case $? in
3330                         0)
3331                                 if test "$ans" != "$value"; then
3332                                         echo "(That expands to $value on this system.)"
3333                                 fi
3334                                 ;;
3335                         *) value="$ans";;
3336                         esac
3337                         ansexp="$value"
3338                         case "$exp_file" in
3339                         '') value="$ans";;
3340                         esac
3341                         ;;
3342                 esac
3343                 case "$fullpath" in
3344                 true)
3345                         case "$ansexp" in
3346                         /*) value="$ansexp" ;;
3347                         *)
3348                                 redo=true
3349                                 case "$already" in
3350                                 true)
3351                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3352                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3353                                         ;;
3354                                 *)
3355                                 echo "Please give a full path name, starting with slash." >&4
3356                                         case "$tilde" in
3357                                         true)
3358                                 echo "Note that using ~name is ok provided it expands well." >&4
3359                                                 already=true
3360                                                 ;;
3361                                         esac
3362                                 esac
3363                                 ;;
3364                         esac
3365                         ;;
3366                 esac
3367                 case "$redo" in
3368                 '')
3369                         case "$type" in
3370                         File)
3371                                 for fp in $gfpth; do
3372                                         if test "X$fp" = X.; then
3373                                             pf="$ansexp"
3374                                         else    
3375                                             pf="$fp/$ansexp"
3376                                         fi
3377                                         if test -f "$pf"; then
3378                                                 type=''
3379                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3380                                         then
3381                                                 echo "($value is not a plain file, but that's ok.)"
3382                                                 type=''
3383                                         fi
3384                                         if test X"$type" = X; then
3385                                             value="$pf"
3386                                             break
3387                                         fi
3388                                 done
3389                                 ;;
3390                         Directory)
3391                                 for fp in $gfpth; do
3392                                         if test "X$fp" = X.; then
3393                                             pf="$ansexp"
3394                                         else    
3395                                             pf="$fp/$ansexp"
3396                                         fi
3397                                         if test -d "$pf"; then
3398                                                 type=''
3399                                                 value="$pf"
3400                                                 break
3401                                         fi
3402                                 done
3403                                 ;;
3404                         Locate)
3405                                 if test -d "$ansexp"; then
3406                                         echo "(Looking for $loc_file in directory $value.)"
3407                                         value="$value/$loc_file"
3408                                         ansexp="$ansexp/$loc_file"
3409                                 fi
3410                                 if test -f "$ansexp"; then
3411                                         type=''
3412                                 fi
3413                                 case "$nopath_ok" in
3414                                 true)   case "$value" in
3415                                         */*) ;;
3416                                         *)      echo "Assuming $value will be in people's path."
3417                                                 type=''
3418                                                 ;;
3419                                         esac
3420                                         ;;
3421                                 esac
3422                                 ;;
3423                         esac
3424
3425                         case "$skip" in
3426                         true) type='';
3427                         esac
3428
3429                         case "$type" in
3430                         '') ;;
3431                         *)
3432                                 if test "$fastread" = yes; then
3433                                         dflt=y
3434                                 else
3435                                         dflt=n
3436                                 fi
3437                                 rp="$what $value doesn't exist.  Use that name anyway?"
3438                                 . UU/myread
3439                                 dflt=''
3440                                 case "$ans" in
3441                                 y*) type='';;
3442                                 *) echo " ";;
3443                                 esac
3444                                 ;;
3445                         esac
3446                         ;;
3447                 esac
3448                 ;;
3449         esac
3450 done
3451 cd UU
3452 ans="$value"
3453 rp="$orig_rp"
3454 dflt="$orig_dflt"
3455 rm -f getfile.ok
3456 test "X$gfpthkeep" != Xy && gfpth=""
3457 EOSC
3458
3459 : determine root of directory hierarchy where package will be installed.
3460 case "$prefix" in
3461 '')
3462         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3463         ;;
3464 *)
3465         dflt="$prefix"
3466         ;;
3467 esac
3468 $cat <<EOM
3469
3470 By default, $package will be installed in $dflt/bin, manual pages
3471 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3472 installation directories. Typically this is something like /usr/local.
3473 If you wish to have binaries under /usr/bin but other parts of the
3474 installation under /usr/local, that's ok: you will be prompted
3475 separately for each of the installation directories, the prefix being
3476 only used to set the defaults.
3477
3478 EOM
3479 fn=d~
3480 rp='Installation prefix to use?'
3481 . ./getfile
3482 oldprefix=''
3483 case "$prefix" in
3484 '') ;;
3485 *)
3486         case "$ans" in
3487         "$prefix") ;;
3488         *) oldprefix="$prefix";;
3489         esac
3490         ;;
3491 esac
3492 prefix="$ans"
3493 prefixexp="$ansexp"
3494
3495 : is AFS running?
3496 echo " "
3497 case "$afs" in
3498 $define|true)   afs=true ;;
3499 $undef|false)   afs=false ;;
3500 *)      if test -d /afs; then
3501                 afs=true
3502         else
3503                 afs=false
3504         fi
3505         ;;
3506 esac
3507 if $afs; then
3508         echo "AFS may be running... I'll be extra cautious then..." >&4
3509 else
3510         echo "AFS does not seem to be running..." >&4
3511 fi
3512
3513 : determine installation prefix for where package is to be installed.
3514 if $afs; then 
3515 $cat <<EOM
3516
3517 Since you are running AFS, I need to distinguish the directory in which
3518 files will reside from the directory in which they are installed (and from
3519 which they are presumably copied to the former directory by occult means).
3520
3521 EOM
3522         case "$installprefix" in
3523         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3524         *) dflt="$installprefix";;
3525         esac
3526 else
3527 $cat <<EOM
3528
3529 In some special cases, particularly when building $package for distribution,
3530 it is convenient to distinguish between the directory in which files should 
3531 be installed from the directory ($prefix) in which they 
3532 will eventually reside.  For most users, these two directories are the same.
3533
3534 EOM
3535         case "$installprefix" in
3536         '') dflt=$prefix ;;
3537         *) dflt=$installprefix;;
3538         esac
3539 fi
3540 fn=d~
3541 rp='What installation prefix should I use for installing files?'
3542 . ./getfile
3543 installprefix="$ans"
3544 installprefixexp="$ansexp"
3545
3546 : set the prefixit variable, to compute a suitable default value
3547 prefixit='case "$3" in
3548 ""|none)
3549         case "$oldprefix" in
3550         "") eval "$1=\"\$$2\"";;
3551         *)
3552                 case "$3" in
3553                 "") eval "$1=";;
3554                 none)
3555                         eval "tp=\"\$$2\"";
3556                         case "$tp" in
3557                         ""|" ") eval "$1=\"\$$2\"";;
3558                         *) eval "$1=";;
3559                         esac;;
3560                 esac;;
3561         esac;;
3562 *)
3563         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
3564         case "$tp" in
3565         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
3566         /*-$oldprefix/*|\~*-$oldprefix/*)
3567                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
3568         *) eval "$1=\"\$$2\"";;
3569         esac;;
3570 esac'
3571
3572 : set the base revision
3573 baserev=5.0
3574
3575 : get the patchlevel
3576 echo " "
3577 echo "Getting the current patchlevel..." >&4
3578 if $test -r $rsrc/patchlevel.h;then
3579         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
3580         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
3581         apiversion=`awk '/define[       ]+PERL_APIVERSION/ {print $3}' $rsrc/patchlevel.h`
3582 else
3583         patchlevel=0
3584         subversion=0
3585         apiversion=0
3586 fi
3587 $echo $n "(You have $package" $c
3588 case "$package" in
3589 "*$baserev")    ;;
3590 *)              $echo $n " $baserev" $c ;;
3591 esac
3592 $echo $n " patchlevel $patchlevel" $c
3593 test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
3594 echo ".)"
3595
3596 if test 0 -eq "$subversion"; then
3597         version=`LC_ALL=C; export LC_ALL; \
3598                  echo $baserev $patchlevel | \
3599                  $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
3600 else
3601         version=`LC_ALL=C; export LC_ALL; \
3602                  echo $baserev $patchlevel $subversion | \
3603                  $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
3604 fi
3605
3606 : determine installation style
3607 : For now, try to deduce it from prefix unless it is already set.
3608 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
3609 case "$installstyle" in
3610 '')     case "$prefix" in
3611                 *perl*) dflt='lib';;
3612                 *) dflt='lib/perl5' ;;
3613         esac
3614         ;;
3615 *)      dflt='lib/perl5' ;;
3616 esac
3617 : Probably not worth prompting for this since we prompt for all
3618 : the directories individually, and the prompt would be too long and
3619 : confusing anyway.
3620 installstyle=$dflt
3621
3622 : determine where private library files go
3623 : Usual default is /usr/local/lib/perl5/$version.
3624 : Also allow things like /opt/perl/lib/$version, since 
3625 : /opt/perl/lib/perl5... would be redundant.
3626 : The default "style" setting is made in installstyle.U
3627 case "$installstyle" in
3628 *lib/perl5*) set dflt privlib lib/$package/$version ;;
3629 *)       set dflt privlib lib/$version ;;
3630 esac
3631 eval $prefixit
3632 $cat <<EOM
3633
3634 There are some auxiliary files for $package that need to be put into a
3635 private library directory that is accessible by everyone.
3636
3637 EOM
3638 fn=d~+
3639 rp='Pathname where the private library files will reside?'
3640 . ./getfile
3641 privlib="$ans"
3642 privlibexp="$ansexp"
3643 : Change installation prefix, if necessary.
3644 if $test X"$prefix" != X"$installprefix"; then
3645         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
3646 else
3647         installprivlib="$privlibexp"
3648 fi
3649
3650 : set the prefixup variable, to restore leading tilda escape
3651 prefixup='case "$prefixexp" in
3652 "$prefix") ;;
3653 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
3654 esac'
3655
3656 : determine where public architecture dependent libraries go
3657 set archlib archlib
3658 eval $prefixit
3659 : privlib default is /usr/local/lib/$package/$version
3660 : archlib default is /usr/local/lib/$package/$version/$archname
3661 : privlib may have an optional trailing /share.
3662 tdflt=`echo $privlib | $sed 's,/share$,,'`
3663 tdflt=$tdflt/$archname
3664 case "$archlib" in
3665 '')     dflt=$tdflt
3666         ;;
3667 *)      dflt="$archlib"
3668     ;;
3669 esac
3670 $cat <<EOM
3671
3672 $spackage contains architecture-dependent library files.  If you are
3673 sharing libraries in a heterogeneous environment, you might store
3674 these files in a separate location.  Otherwise, you can just include
3675 them with the rest of the public library files.
3676
3677 EOM
3678 fn=d+~
3679 rp='Where do you want to put the public architecture-dependent libraries?'
3680 . ./getfile
3681 archlib="$ans"
3682 archlibexp="$ansexp"
3683 if $test X"$archlib" = X"$privlib"; then
3684         d_archlib="$undef"
3685 else
3686         d_archlib="$define"
3687 fi
3688 : Change installation prefix, if necessary.
3689 if $test X"$prefix" != X"$installprefix"; then
3690         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
3691 else
3692         installarchlib="$archlibexp"
3693 fi
3694
3695
3696 : Binary compatibility with 5.005 is not possible for builds
3697 : with advanced features
3698 case "$usethreads$usemultiplicity" in
3699 *define*)
3700         bincompat5005="$undef"
3701         d_bincompat5005="$undef"
3702         ;;
3703 *)      $cat <<EOM
3704
3705 Perl 5.006 can be compiled for binary compatibility with 5.005.
3706 If you decide to do so, you will be able to continue using most
3707 of the extensions that were compiled for Perl 5.005.
3708
3709 EOM
3710         case "$bincompat5005$d_bincompat5005" in
3711         *"$undef"*) dflt=n ;;
3712         *) dflt=y ;;
3713         esac
3714         rp='Binary compatibility with Perl 5.005?'
3715         . ./myread
3716         case "$ans" in
3717         y*) val="$define" ;;
3718         *)  val="$undef" ;;
3719         esac
3720         set d_bincompat5005
3721         eval $setvar
3722         case "$d_bincompat5005" in
3723         "$define")
3724                 bincompat5005="$define"
3725                 ;;
3726         *)      bincompat5005="$undef"
3727                 d_bincompat5005="$undef"
3728                 ;;
3729         esac
3730         ;;
3731 esac
3732
3733
3734 : see if setuid scripts can be secure
3735 $cat <<EOM
3736
3737 Some kernels have a bug that prevents setuid #! scripts from being
3738 secure.  Some sites have disabled setuid #! scripts because of this.
3739
3740 First let's decide if your kernel supports secure setuid #! scripts.
3741 (If setuid #! scripts would be secure but have been disabled anyway,
3742 don't say that they are secure if asked.)
3743
3744 EOM
3745
3746 val="$undef"
3747 if $test -d /dev/fd; then
3748         echo "#!$ls" >reflect
3749         chmod +x,u+s reflect
3750         ./reflect >flect 2>&1
3751         if $contains "/dev/fd" flect >/dev/null; then
3752                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
3753                 val="$define"
3754         else
3755                 $cat <<EOM
3756 If you are not sure if they are secure, I can check but I'll need a
3757 username and password different from the one you are using right now.
3758 If you don't have such a username or don't want me to test, simply
3759 enter 'none'.
3760
3761 EOM
3762                 rp='Other username to test security of setuid scripts with?'
3763                 dflt='none'
3764                 . ./myread
3765                 case "$ans" in
3766                 n|none)
3767                         case "$d_suidsafe" in
3768                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
3769                                 dflt=n;;
3770                         "$undef")
3771                                 echo "Well, the $hint value is *not* secure." >&4
3772                                 dflt=n;;
3773                         *)      echo "Well, the $hint value *is* secure." >&4
3774                                 dflt=y;;
3775                         esac
3776                         ;;
3777                 *)
3778                         $rm -f reflect flect
3779                         echo "#!$ls" >reflect
3780                         chmod +x,u+s reflect
3781                         echo >flect
3782                         chmod a+w flect
3783                         echo '"su" will (probably) prompt you for '"$ans's password."
3784                         su $ans -c './reflect >flect'
3785                         if $contains "/dev/fd" flect >/dev/null; then
3786                                 echo "Okay, it looks like setuid scripts are secure." >&4
3787                                 dflt=y
3788                         else
3789                                 echo "I don't think setuid scripts are secure." >&4
3790                                 dflt=n
3791                         fi
3792                         ;;
3793                 esac
3794                 rp='Does your kernel have *secure* setuid scripts?'
3795                 . ./myread
3796                 case "$ans" in
3797                 [yY]*)  val="$define";;
3798                 *)      val="$undef";;
3799                 esac
3800         fi
3801 else
3802         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
3803         echo "(That's for file descriptors, not floppy disks.)"
3804         val="$undef"
3805 fi
3806 set d_suidsafe
3807 eval $setvar
3808
3809 $rm -f reflect flect
3810
3811 : now see if they want to do setuid emulation
3812 echo " "
3813 val="$undef"
3814 case "$d_suidsafe" in
3815 "$define")
3816         val="$undef"
3817         echo "No need to emulate SUID scripts since they are secure here." >& 4
3818         ;;
3819 *)
3820         $cat <<EOM
3821 Some systems have disabled setuid scripts, especially systems where
3822 setuid scripts cannot be secure.  On systems where setuid scripts have
3823 been disabled, the setuid/setgid bits on scripts are currently
3824 useless.  It is possible for $package to detect those bits and emulate
3825 setuid/setgid in a secure fashion.  This emulation will only work if
3826 setuid scripts have been disabled in your kernel.
3827
3828 EOM
3829         case "$d_dosuid" in
3830         "$define") dflt=y ;;
3831         *) dflt=n ;;
3832         esac
3833         rp="Do you want to do setuid/setgid emulation?"
3834         . ./myread
3835         case "$ans" in
3836         [yY]*)  val="$define";;
3837         *)      val="$undef";;
3838         esac
3839         ;;
3840 esac
3841 set d_dosuid
3842 eval $setvar
3843
3844 : What should the include directory be ?
3845 echo " "
3846 $echo $n "Hmm...  $c"
3847 dflt='/usr/include'
3848 incpath=''
3849 mips_type=''
3850 if $test -f /bin/mips && /bin/mips; then
3851         echo "Looks like a MIPS system..."
3852         $cat >usr.c <<'EOCP'
3853 #ifdef SYSTYPE_BSD43
3854 /bsd43
3855 #endif
3856 EOCP
3857         if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3858                 dflt='/bsd43/usr/include'
3859                 incpath='/bsd43'
3860                 mips_type='BSD 4.3'
3861         else
3862                 mips_type='System V'
3863         fi
3864         $rm -f usr.c usr.out
3865         echo "and you're compiling with the $mips_type compiler and libraries."
3866         xxx_prompt=y
3867         echo "exit 0" >mips
3868 else
3869         echo "Doesn't look like a MIPS system."
3870         xxx_prompt=n
3871         echo "exit 1" >mips
3872 fi
3873 chmod +x mips
3874 $eunicefix mips
3875 case "$usrinc" in
3876 '') ;;
3877 *) dflt="$usrinc";;
3878 esac
3879 case "$xxx_prompt" in
3880 y)      fn=d/
3881         echo " "
3882         rp='Where are the include files you want to use?'
3883         . ./getfile
3884         usrinc="$ans"
3885         ;;
3886 *)      usrinc="$dflt"
3887         ;;
3888 esac
3889
3890 : see how we invoke the C preprocessor
3891 echo " "
3892 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3893 cat <<'EOT' >testcpp.c
3894 #define ABC abc
3895 #define XYZ xyz
3896 ABC.XYZ
3897 EOT
3898 cd ..
3899 if test ! -f cppstdin; then
3900         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3901                 # AIX cc -E doesn't show the absolute headerfile
3902                 # locations but we'll cheat by using the -M flag.
3903                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
3904         else
3905                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
3906         fi
3907 else
3908         echo "Keeping your $hint cppstdin wrapper."
3909 fi
3910 chmod 755 cppstdin
3911 wrapper=`pwd`/cppstdin
3912 ok='false'
3913 cd UU
3914
3915 if $test "X$cppstdin" != "X" && \
3916         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3917         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3918 then
3919         echo "You used to use $cppstdin $cppminus so we'll use that again."
3920         case "$cpprun" in
3921         '') echo "But let's see if we can live without a wrapper..." ;;
3922         *)
3923                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3924                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3925                 then
3926                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3927                         ok='true'
3928                 else
3929                         echo "(However, $cpprun $cpplast does not work, let's see...)"
3930                 fi
3931                 ;;
3932         esac
3933 else
3934         case "$cppstdin" in
3935         '') ;;
3936         *)
3937                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3938                 ;;
3939         esac
3940 fi
3941
3942 if $ok; then
3943         : nothing
3944 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3945         $cc -E <testcpp.c >testcpp.out 2>&1; \
3946         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3947         echo "Yup, it does."
3948         x_cpp="$cc -E"
3949         x_minus='';
3950 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3951         $cc -E - <testcpp.c >testcpp.out 2>&1; \
3952         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3953         echo "Yup, it does."
3954         x_cpp="$cc -E"
3955         x_minus='-';
3956 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3957         $cc -P <testcpp.c >testcpp.out 2>&1; \
3958         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3959         echo "Yipee, that works!"
3960         x_cpp="$cc -P"
3961         x_minus='';
3962 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3963         $cc -P - <testcpp.c >testcpp.out 2>&1; \
3964         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3965         echo "At long last!"
3966         x_cpp="$cc -P"
3967         x_minus='-';
3968 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3969         $cpp <testcpp.c >testcpp.out 2>&1; \
3970         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3971         echo "It works!"
3972         x_cpp="$cpp"
3973         x_minus='';
3974 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3975         $cpp - <testcpp.c >testcpp.out 2>&1; \
3976         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3977         echo "Hooray, it works!  I was beginning to wonder."
3978         x_cpp="$cpp"
3979         x_minus='-';
3980 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
3981         $wrapper <testcpp.c >testcpp.out 2>&1; \
3982         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3983         x_cpp="$wrapper"
3984         x_minus=''
3985         echo "Eureka!"
3986 else
3987         dflt=''
3988         rp="No dice.  I can't find a C preprocessor.  Name one:"
3989         . ./myread
3990         x_cpp="$ans"
3991         x_minus=''
3992         $x_cpp <testcpp.c >testcpp.out 2>&1
3993         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3994                 echo "OK, that will do." >&4
3995         else
3996 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
3997                 exit 1
3998         fi
3999 fi
4000
4001 case "$ok" in
4002 false)
4003         cppstdin="$x_cpp"
4004         cppminus="$x_minus"
4005         cpprun="$x_cpp"
4006         cpplast="$x_minus"
4007         set X $x_cpp
4008         shift
4009         case "$1" in
4010         "$cpp")
4011                 echo "Perhaps can we force $cc -E using a wrapper..."
4012                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4013                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4014                 then
4015                         echo "Yup, we can."
4016                         cppstdin="$wrapper"
4017                         cppminus='';
4018                 else
4019                         echo "Nope, we'll have to live without it..."
4020                 fi
4021                 ;;
4022         esac
4023         case "$cpprun" in
4024         "$wrapper")
4025                 cpprun=''
4026                 cpplast=''
4027                 ;;
4028         esac
4029         ;;
4030 esac
4031
4032 case "$cppstdin" in
4033 "$wrapper"|'cppstdin') ;;
4034 *) $rm -f $wrapper;;
4035 esac
4036 $rm -f testcpp.c testcpp.out
4037
4038 : Set private lib path
4039 case "$plibpth" in
4040 '') if ./mips; then
4041                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4042         fi;;
4043 esac
4044 case "$libpth" in
4045 ' ') dlist='';;
4046 '') dlist="$loclibpth $plibpth $glibpth";;
4047 *) dlist="$libpth";;
4048 esac
4049
4050 : Now check and see which directories actually exist, avoiding duplicates
4051 libpth=''
4052 for xxx in $dlist
4053 do
4054     if $test -d $xxx; then
4055                 case " $libpth " in
4056                 *" $xxx "*) ;;
4057                 *) libpth="$libpth $xxx";;
4058                 esac
4059     fi
4060 done
4061 $cat <<'EOM'
4062
4063 Some systems have incompatible or broken versions of libraries.  Among
4064 the directories listed in the question below, please remove any you
4065 know not to be holding relevant libraries, and add any that are needed.
4066 Say "none" for none.
4067
4068 EOM
4069 case "$libpth" in
4070 '') dflt='none';;
4071 *)
4072         set X $libpth
4073         shift
4074         dflt=${1+"$@"}
4075         ;;
4076 esac
4077 rp="Directories to use for library searches?"
4078 . ./myread
4079 case "$ans" in
4080 none) libpth=' ';;
4081 *) libpth="$ans";;
4082 esac
4083
4084 : compute shared library extension
4085 case "$so" in
4086 '')
4087         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4088                 dflt='sl'
4089         else
4090                 dflt='so'
4091         fi
4092         ;;
4093 *) dflt="$so";;
4094 esac
4095 $cat <<EOM
4096
4097 On some systems, shared libraries may be available.  Answer 'none' if
4098 you want to suppress searching of shared libraries for the remaining
4099 of this configuration.
4100
4101 EOM
4102 rp='What is the file extension used for shared libraries?'
4103 . ./myread
4104 so="$ans"
4105
4106 : Define several unixisms.
4107 : Hints files or command line option can be used to override them.
4108 : The convoluted testing is in case hints files set either the old
4109 : or the new name.
4110 case "$_exe" in
4111 '')     case "$exe_ext" in
4112     '') ;;
4113         *)      _exe="$exe_ext" ;;
4114         esac
4115         ;;
4116 esac
4117 case "$_a" in
4118 '')     case "$lib_ext" in
4119     '') _a='.a';;
4120         *)      _a="$lib_ext" ;;
4121         esac
4122         ;;
4123 esac
4124 case "$_o" in
4125 '') case "$obj_ext" in
4126         '')     _o='.o';;
4127         *)      _o="$obj_ext";;
4128         esac
4129         ;;
4130 esac
4131 case "$p_" in
4132 '') case "$path_sep" in
4133         '')     p_=':';;
4134         *)      p_="$path_sep";;
4135         esac
4136         ;;
4137 esac
4138 exe_ext=$_exe
4139 lib_ext=$_a
4140 obj_ext=$_o
4141 path_sep=$p_
4142
4143 : Which makefile gets called first.  This is used by make depend.
4144 case "$firstmakefile" in
4145 '') firstmakefile='makefile';;
4146 esac
4147
4148 cat <<EOM
4149
4150 Perl can be built to use the SOCKS proxy protocol library.  To do so,
4151 Configure must be run with -Dusesocks.
4152
4153 Normally you do not need this and you should answer no.
4154
4155 EOM
4156 case "$usesocks" in
4157 $define|true|[yY]*)     dflt='y';;
4158 *) dflt='n';;
4159 esac
4160 rp='Build Perl for SOCKS?'
4161 . ./myread
4162 case "$ans" in
4163 y|Y)    val="$define" ;;     
4164 *)      val="$undef" ;;
4165 esac
4166 set usesocks
4167 eval $setvar
4168
4169 : Looking for optional libraries
4170 echo " "
4171 echo "Checking for optional libraries..." >&4
4172 case "$libs" in
4173 ' '|'') dflt='';;
4174 *) dflt="$libs";;
4175 esac
4176 case "$libswanted" in
4177 '') libswanted='c_s';;
4178 esac
4179 case "$usesocks" in
4180 $define)
4181         libswanted="$libswanted socks5 socks5_sh"
4182         ;;
4183 esac
4184 for thislib in $libswanted; do
4185         
4186         if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`;
4187                 $test -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4188                 echo "Found -l$thislib (shared)."
4189                 case " $dflt " in
4190                 *"-l$thislib "*);;
4191                 *) dflt="$dflt -l$thislib";;
4192                 esac
4193         elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
4194                 echo "Found -l$thislib (shared)."
4195                 case " $dflt " in
4196                 *"-l$thislib "*);;
4197                 *) dflt="$dflt -l$thislib";;
4198                 esac
4199         elif xxx=`./loc lib$thislib$_a X $libpth`; $test -f "$xxx"; then
4200                 echo "Found -l$thislib."
4201                 case " $dflt " in
4202                 *"-l$thislib "*);;
4203                 *) dflt="$dflt -l$thislib";;
4204                 esac
4205         elif xxx=`./loc $thislib$_a X $libpth`; $test -f "$xxx"; then
4206                 echo "Found -l$thislib."
4207                 case " $dflt " in
4208                 *"-l$thislib "*);;
4209                 *) dflt="$dflt -l$thislib";;
4210                 esac
4211         elif xxx=`./loc lib${thislib}_s$_a X $libpth`; $test -f "$xxx"; then
4212                 echo "Found -l${thislib}_s."
4213                 case " $dflt " in
4214                 *"-l$thislib "*);;
4215                 *) dflt="$dflt -l${thislib}_s";;
4216                 esac
4217         elif xxx=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$xxx"; then
4218                 echo "Found -l$thislib."
4219                 case " $dflt " in
4220                 *"-l$thislib "*);;
4221                 *) dflt="$dflt -l$thislib";;
4222                 esac
4223         else
4224                 echo "No -l$thislib."
4225         fi
4226 done
4227 set X $dflt
4228 shift
4229 dflt="$*"
4230 case "$libs" in
4231 '') dflt="$dflt";;
4232 *) dflt="$libs";;
4233 esac
4234 case "$dflt" in
4235 ' '|'') dflt='none';;
4236 esac
4237
4238 $cat <<EOM
4239
4240 In order to compile $package on your machine, a number of libraries
4241 are usually needed.  Include any other special libraries here as well.
4242 Say "none" for none.  The default list is almost always right.
4243 EOM
4244
4245 echo " "
4246 rp="What libraries to use?"
4247 . ./myread
4248 case "$ans" in
4249 none) libs=' ';;
4250 *) libs="$ans";;
4251 esac
4252
4253 : determine optimization, if desired, or use for debug flag also
4254 case "$optimize" in
4255 ' '|$undef) dflt='none';;
4256 '') dflt='-O';;
4257 *) dflt="$optimize";;
4258 esac
4259 $cat <<EOH
4260
4261 By default, $package compiles with the -O flag to use the optimizer.
4262 Alternately, you might want to use the symbolic debugger, which uses
4263 the -g flag (on traditional Unix systems).  Either flag can be
4264 specified here.  To use neither flag, specify the word "none".
4265
4266 EOH
4267 rp="What optimizer/debugger flag should be used?"
4268 . ./myread
4269 optimize="$ans"
4270 case "$optimize" in
4271 'none') optimize=" ";;
4272 esac
4273
4274 dflt=''
4275 : We will not override a previous value, but we might want to
4276 : augment a hint file
4277 case "$hint" in
4278 default|recommended)
4279         case "$gccversion" in
4280         1*) dflt='-fpcc-struct-return' ;;
4281         esac
4282         case "$optimize" in
4283         *-g*) dflt="$dflt -DDEBUGGING";;
4284         esac
4285         case "$gccversion" in
4286         2*) if test -d /etc/conf/kconfig.d &&
4287                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4288                 then
4289                         dflt="$dflt -posix"
4290                 fi
4291                 ;;
4292         esac
4293         case "$gccversion" in
4294         1*) ;;
4295         2.[0-8]*) ;;
4296         ?*)     echo " "
4297                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4298                 echo 'int main(void) { return 0; }' > gcctest.c
4299                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4300                         echo "Yes, it does." 2>&1
4301                         case "$ccflags" in
4302                         *strict-aliasing*) 
4303                                 echo "Leaving current flags $ccflags alone." 2>&1
4304                                 ;;
4305                         *) dflt="$dflt -fno-strict-aliasing" ;;
4306                         esac
4307                 else
4308                         echo "Nope, it doesn't, but that's ok." 2>&1
4309                 fi
4310                 ;;
4311         esac
4312         ;;
4313 esac
4314
4315 case "$mips_type" in
4316 *BSD*|'') inclwanted="$locincpth $usrinc";;
4317 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4318 esac
4319 for thisincl in $inclwanted; do
4320         if $test -d $thisincl; then
4321                 if $test x$thisincl != x$usrinc; then
4322                         case "$dflt" in
4323                         *$thisincl*);;
4324                         *) dflt="$dflt -I$thisincl";;
4325                         esac
4326                 fi
4327         fi
4328 done
4329
4330 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4331         xxx=true;
4332 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4333         xxx=true;
4334 else
4335         xxx=false;
4336 fi;
4337 if $xxx; then
4338         case "$dflt" in
4339         *$2*);;
4340         *) dflt="$dflt -D$2";;
4341         esac;
4342 fi'
4343
4344 set signal.h LANGUAGE_C; eval $inctest
4345
4346 case "$usesocks" in
4347 $define)
4348         ccflags="$ccflags -DSOCKS"
4349         ;;
4350 esac
4351
4352 case "$hint" in
4353 default|recommended) dflt="$ccflags $dflt" ;;
4354 *) dflt="$ccflags";;
4355 esac
4356
4357 case "$dflt" in
4358 ''|' ') dflt=none;;
4359 esac
4360 $cat <<EOH
4361
4362 Your C compiler may want other flags.  For this question you should include
4363 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4364 but you should NOT include libraries or ld flags like -lwhatever.  If you
4365 want $package to honor its debug switch, you should include -DDEBUGGING here.
4366 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4367
4368 To use no flags, specify the word "none".
4369
4370 EOH
4371 set X $dflt
4372 shift
4373 dflt=${1+"$@"}
4374 rp="Any additional cc flags?"
4375 . ./myread
4376 case "$ans" in
4377 none) ccflags='';;
4378 *) ccflags="$ans";;
4379 esac
4380
4381 : the following weeds options from ccflags that are of no interest to cpp
4382 cppflags="$ccflags"
4383 case "$gccversion" in
4384 1*) cppflags="$cppflags -D__GNUC__"
4385 esac
4386 case "$mips_type" in
4387 '');;
4388 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4389 esac
4390 case "$cppflags" in
4391 '');;
4392 *)
4393         echo " "
4394         echo "Let me guess what the preprocessor flags are..." >&4
4395         set X $cppflags
4396         shift
4397         cppflags=''
4398         $cat >cpp.c <<'EOM'
4399 #define BLURFL foo
4400
4401 BLURFL xx LFRULB
4402 EOM
4403         previous=''
4404         for flag in $*
4405         do
4406                 case "$flag" in
4407                 -*) ftry="$flag";;
4408                 *) ftry="$previous $flag";;
4409                 esac
4410                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4411                         >cpp1.out 2>/dev/null && \
4412                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4413                         >cpp2.out 2>/dev/null && \
4414                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4415                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4416                 then
4417                         cppflags="$cppflags $ftry"
4418                         previous=''
4419                 else
4420                         previous="$flag"
4421                 fi
4422         done
4423         set X $cppflags
4424         shift
4425         cppflags=${1+"$@"}
4426         case "$cppflags" in
4427         *-*)  echo "They appear to be: $cppflags";;
4428         esac
4429         $rm -f cpp.c cpp?.out
4430         ;;
4431 esac
4432
4433 : flags used in final linking phase
4434 case "$ldflags" in
4435 '') if ./venix; then
4436                 dflt='-i -z'
4437         else
4438                 dflt=''
4439         fi
4440         case "$ccflags" in
4441         *-posix*) dflt="$dflt -posix" ;;
4442         esac
4443         ;;
4444 *) dflt="$ldflags";;
4445 esac
4446
4447 : Try to guess additional flags to pick up local libraries.
4448 for thislibdir in $libpth; do
4449         case " $loclibpth " in
4450         *" $thislibdir "*)
4451                 case "$dflt " in 
4452                 *"-L$thislibdir "*) ;;
4453                 *)  dflt="$dflt -L$thislibdir" ;;
4454                 esac
4455                 ;;
4456         esac
4457 done
4458
4459 case "$dflt" in
4460 '') dflt='none' ;;
4461 esac
4462
4463 $cat <<EOH
4464
4465 Your C linker may need flags.  For this question you should
4466 include -L/whatever and any other flags used by the C linker, but you
4467 should NOT include libraries like -lwhatever.
4468
4469 Make sure you include the appropriate -L/path flags if your C linker
4470 does not normally search all of the directories you specified above,
4471 namely
4472         $libpth
4473 To use no flags, specify the word "none".
4474
4475 EOH
4476
4477 rp="Any additional ld flags (NOT including libraries)?"
4478 . ./myread
4479 case "$ans" in
4480 none) ldflags='';;
4481 *) ldflags="$ans";;
4482 esac
4483 rmlist="$rmlist pdp11"
4484
4485 : coherency check
4486 echo " "
4487 echo "Checking your choice of C compiler and flags for coherency..." >&4
4488 $cat > try.c <<'EOF'
4489 #include <stdio.h>
4490 int main() { printf("Ok\n"); exit(0); }
4491 EOF
4492 set X $cc $optimize $ccflags -o try $ldflags try.c $libs
4493 shift
4494 $cat >try.msg <<'EOM'
4495 I've tried to compile and run the following simple program:
4496
4497 EOM
4498 $cat try.c >> try.msg
4499
4500 $cat >> try.msg <<EOM
4501
4502 I used the command:
4503
4504         $*
4505         ./try
4506
4507 and I got the following output:
4508
4509 EOM
4510 dflt=y
4511 if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
4512         if sh -c './try' >>try.msg 2>&1; then
4513                 xxx=`./try`
4514                 case "$xxx" in
4515                 "Ok") dflt=n ;;
4516                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4517                         case " $libs " in
4518                         *" -lsfio "*)
4519                                 cat >> try.msg <<'EOQS'
4520 If $libs contains -lsfio, and sfio is mis-configured, then it
4521 sometimes (apparently) runs and exits with a 0 status, but with no
4522 output!  It may have to do with sfio's use of _exit vs. exit.
4523
4524 EOQS
4525                                 rp="You have a big problem.  Shall I abort Configure"
4526                                 dflt=y
4527                                 ;;
4528                         esac
4529                         ;;
4530                 esac
4531         else
4532                 echo "The program compiled OK, but exited with status $?." >>try.msg
4533                 rp="You have a problem.  Shall I abort Configure"
4534                 dflt=y
4535         fi
4536 else
4537         echo "I can't compile the test program." >>try.msg
4538         rp="You have a BIG problem.  Shall I abort Configure"
4539         dflt=y
4540 fi
4541 case "$dflt" in
4542 y)
4543         $cat try.msg >&4
4544         case "$knowitall" in
4545         '')
4546                 echo "(The supplied flags or libraries might be incorrect.)"
4547                 ;;
4548         *) dflt=n;;
4549         esac
4550         echo " "
4551         . ./myread
4552         case "$ans" in
4553         n*|N*) ;;
4554         *)      echo "Ok.  Stopping Configure." >&4
4555                 exit 1
4556                 ;;
4557         esac
4558         ;;
4559 n) echo "OK, that should do.";;
4560 esac
4561 $rm -f try try.* core
4562
4563 : determine filename position in cpp output
4564 echo " "
4565 echo "Computing filename position in cpp output for #include directives..." >&4
4566 echo '#include <stdio.h>' > foo.c
4567 $cat >fieldn <<EOF
4568 $startsh
4569 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4570 $grep '^[       ]*#.*stdio\.h' | \
4571 while read cline; do
4572         pos=1
4573         set \$cline
4574         while $test \$# -gt 0; do
4575                 if $test -r \`echo \$1 | $tr -d '"'\`; then
4576                         echo "\$pos"
4577                         exit 0
4578                 fi
4579                 shift
4580                 pos=\`expr \$pos + 1\`
4581         done
4582 done
4583 EOF
4584 chmod +x fieldn
4585 fieldn=`./fieldn`
4586 $rm -f foo.c fieldn
4587 case $fieldn in
4588 '') pos='???';;
4589 1) pos=first;;
4590 2) pos=second;;
4591 3) pos=third;;
4592 *) pos="${fieldn}th";;
4593 esac
4594 echo "Your cpp writes the filename in the $pos field of the line."
4595
4596 : locate header file
4597 $cat >findhdr <<EOF
4598 $startsh
4599 wanted=\$1
4600 name=''
4601 for usrincdir in $usrinc
4602 do
4603         if test -f \$usrincdir/\$wanted; then
4604                 echo "\$usrincdir/\$wanted"
4605                 exit 0
4606         fi
4607 done
4608 awkprg='{ print \$$fieldn }'
4609 echo "#include <\$wanted>" > foo\$\$.c
4610 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4611 $grep "^[       ]*#.*\$wanted" | \
4612 while read cline; do
4613         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
4614         case "\$name" in
4615         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
4616         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
4617         *) exit 2;;
4618         esac;
4619 done;
4620 #
4621 # status = 0: grep returned 0 lines, case statement not executed
4622 # status = 1: headerfile found
4623 # status = 2: while loop executed, no headerfile found
4624 #
4625 status=\$?
4626 $rm -f foo\$\$.c;
4627 if test \$status -eq 1; then
4628         exit 0;
4629 fi
4630 exit 1
4631 EOF
4632 chmod +x findhdr
4633
4634 : define an alternate in-header-list? function
4635 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
4636 cont=true; xxf="echo \"<\$1> found.\" >&4";
4637 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
4638 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
4639 esac;
4640 case $# in 4) instead=instead;; *) instead="at last";; esac;
4641 while $test "$cont"; do
4642         xxx=`./findhdr $1`
4643         var=$2; eval "was=\$$2";
4644         if $test "$xxx" && $test -r "$xxx";
4645         then eval $xxf;
4646         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
4647                 cont="";
4648         else eval $xxnf;
4649         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
4650         set $yyy; shift; shift; yyy=$@;
4651         case $# in 0) cont="";;
4652         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
4653                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
4654         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
4655                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
4656         esac;
4657 done;
4658 while $test "$yyy";
4659 do set $yyy; var=$2; eval "was=\$$2";
4660         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
4661         set $yyy; shift; shift; yyy=$@;
4662 done'
4663
4664 : see if this is a malloc.h system
4665 set malloc.h i_malloc
4666 eval $inhdr
4667
4668 : see if stdlib is available
4669 set stdlib.h i_stdlib
4670 eval $inhdr
4671
4672 : determine which malloc to compile in
4673 echo " "
4674 case "$usemymalloc" in
4675 ''|[yY]*|true|$define)  dflt='y' ;;
4676 *)      dflt='n' ;;
4677 esac
4678 rp="Do you wish to attempt to use the malloc that comes with $package?"
4679 . ./myread
4680 usemymalloc="$ans"
4681 case "$ans" in
4682 y*|true)
4683         usemymalloc='y'
4684         mallocsrc='malloc.c'
4685         mallocobj="malloc$_o"
4686         d_mymalloc="$define"
4687         case "$libs" in
4688         *-lmalloc*)
4689                 : Remove malloc from list of libraries to use
4690                 echo "Removing unneeded -lmalloc from library list" >&4
4691                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4692                 shift
4693                 libs="$*"
4694                 echo "libs = $libs" >&4
4695                 ;;
4696         esac
4697         ;;
4698 *)
4699         usemymalloc='n'
4700         mallocsrc=''
4701         mallocobj=''
4702         d_mymalloc="$undef"
4703         ;;
4704 esac
4705
4706 : compute the return types of malloc and free
4707 echo " "
4708 $cat >malloc.c <<END
4709 #$i_malloc I_MALLOC
4710 #$i_stdlib I_STDLIB
4711 #include <stdio.h>
4712 #include <sys/types.h>
4713 #ifdef I_MALLOC
4714 #include <malloc.h>
4715 #endif
4716 #ifdef I_STDLIB
4717 #include <stdlib.h>
4718 #endif
4719 #ifdef TRY_MALLOC
4720 void *malloc();
4721 #endif
4722 #ifdef TRY_FREE
4723 void free();
4724 #endif
4725 END
4726 case "$malloctype" in
4727 '')
4728         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
4729                 malloctype='void *'
4730         else
4731                 malloctype='char *'
4732         fi
4733         ;;
4734 esac
4735 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4736
4737 case "$freetype" in
4738 '')
4739         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
4740                 freetype='void'
4741         else
4742                 freetype='int'
4743         fi
4744         ;;
4745 esac
4746 echo "Your system uses $freetype free(), it would seem." >&4
4747 $rm -f malloc.[co]
4748 $cat <<EOM
4749
4750 The installation process will also create a directory for
4751 vendor-supplied add-ons.  Vendors who supply perl with their system
4752 may find it convenient to place all vendor-supplied files in this
4753 directory rather than in the main distribution directory.  This will
4754 ease upgrades between binary-compatible maintenance versions of perl.
4755
4756 Of course you may also use these directories in whatever way you see
4757 fit.  For example, you might use them to access modules shared over a
4758 company-wide network.
4759
4760 The default answer should be fine for most people.
4761 This causes further questions about vendor add-ons to be skipped
4762 and no vendor-specific directories will be configured for perl.
4763
4764 EOM
4765 rp='Do you want to configure vendor-specific add-on directories?'
4766 case "$usevendorprefix" in
4767 define|true|[yY]*) dflt=y ;;
4768 *) dflt=n ;;
4769 esac
4770 . ./myread
4771 case "$ans" in
4772 [yY]*)  fn=d~+
4773         rp='Installation prefix to use for vendor-supplied add-ons?'
4774         case "$vendorprefix" in
4775         '') dflt='' ;;
4776         *)  dflt=$vendorprefix ;;
4777         esac
4778         . ./getfile
4779         oldvendorprefix=''
4780         case "$vendorprefix" in
4781         '') ;;
4782         *)      case "$ans" in
4783                 "$prefix") ;;
4784                 *) oldvendorprefix="$prefix";;
4785                 esac
4786                 ;;
4787         esac
4788         usevendorprefix="$define"
4789         vendorprefix="$ans"
4790         vendorprefixexp="$ansexp"
4791         ;;
4792 *)      usevendorprefix="$undef"
4793         vendorprefix=''
4794         vendorprefixexp=''
4795         ;;
4796 esac
4797
4798 case "$vendorprefix" in
4799 '')     d_vendorlib="$undef"
4800         vendorlib=''
4801         vendorlibexp=''
4802         ;;
4803 *)      d_vendorlib="$define"
4804         : determine where vendor-supplied modules go.
4805         : Usual default is /usr/local/lib/perl5/vendor_perl
4806         prog=`echo $package | $sed 's/-*[0-9.]*$//'`
4807         case "$installstyle" in
4808         *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog ;;
4809         *)           dflt=$vendorprefix/lib/vendor_$prog ;;
4810         esac
4811         fn=d~+
4812         rp='Pathname for the vendor-supplied library files?'
4813         . ./getfile
4814         vendorlib="$ans"
4815         vendorlibexp="$ansexp"
4816         : Change installation prefix, if necessary.
4817         if $test X"$prefix" != X"$installprefix"; then
4818                 installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
4819         else
4820                 installvendorlib="$vendorlibexp"
4821         fi
4822         ;;
4823 esac
4824
4825 : Cruising for prototypes
4826 echo " "
4827 echo "Checking out function prototypes..." >&4
4828 $cat >prototype.c <<'EOCP'
4829 int main(int argc, char *argv[]) {
4830         exit(0);}
4831 EOCP
4832 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
4833         echo "Your C compiler appears to support function prototypes."
4834         val="$define"
4835 else
4836         echo "Your C compiler doesn't seem to understand function prototypes."
4837         val="$undef"
4838 fi
4839 set prototype
4840 eval $setvar
4841 $rm -f prototype*
4842
4843 case "$prototype" in
4844 "$define") ;;
4845 *)      ansi2knr='ansi2knr'
4846         echo " "
4847         cat <<EOM >&4
4848
4849 $me:  FATAL ERROR:
4850 This version of $package can only be compiled by a compiler that 
4851 understands function prototypes.  Unfortunately, your C compiler 
4852         $cc $ccflags
4853 doesn't seem to understand them.  Sorry about that.
4854
4855 If GNU cc is available for your system, perhaps you could try that instead.  
4856
4857 Eventually, we hope to support building Perl with pre-ANSI compilers.
4858 If you would like to help in that effort, please contact <perlbug@perl.org>.
4859
4860 Aborting Configure now.
4861 EOM
4862         exit 2
4863         ;;
4864 esac
4865
4866 : determine where public executables go
4867 echo " "
4868 set dflt bin bin
4869 eval $prefixit
4870 fn=d~
4871 rp='Pathname where the public executables will reside?'
4872 . ./getfile
4873 if $test "X$ansexp" != "X$binexp"; then
4874         installbin=''
4875 fi
4876 bin="$ans"
4877 binexp="$ansexp"
4878 : Change installation prefix, if necessary.
4879 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
4880 if $test X"$prefix" != X"$installprefix"; then
4881         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
4882 else
4883         installbin="$binexp"
4884 fi
4885
4886 : determine whether to install perl also as /usr/bin/perl
4887
4888 echo " "
4889 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
4890         $cat <<EOM
4891 Many scripts expect to perl to be installed as /usr/bin/perl.
4892 I can install the perl you are about to compile also as /usr/bin/perl
4893 (in addition to $installbin/perl).
4894 EOM
4895         case "$installusrbinperl" in
4896         "$undef"|[nN]*) dflt='n';;
4897         *)              dflt='y';;
4898         esac
4899         rp="Do you want to install perl as /usr/bin/perl?"
4900         . ./myread
4901         case "$ans" in
4902         [yY]*)  val="$define";;
4903         *)      val="$undef" ;;
4904         esac
4905 else
4906         val="$undef"
4907 fi
4908 set installusrbinperl
4909 eval $setvar
4910
4911 : define a shorthand compile call
4912 compile='
4913 mc_file=$1;
4914 shift;
4915 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;'
4916 : define a shorthand compile call for compilations that should be ok.
4917 compile_ok='
4918 mc_file=$1;
4919 shift;
4920 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
4921
4922 echo " "
4923 echo "Checking for GNU C Library..." >&4
4924 cat >gnulibc.c <<EOM
4925 #include <stdio.h>
4926 int main()
4927 {
4928 #ifdef __GLIBC__
4929     exit(0);
4930 #else
4931     exit(1);
4932 #endif
4933 }
4934 EOM
4935 set gnulibc
4936 if eval $compile_ok && ./gnulibc; then
4937         val="$define"
4938         echo "You are using the GNU C Library"
4939 else
4940         val="$undef"
4941         echo "You are not using the GNU C Library"
4942 fi
4943 $rm -f gnulibc*
4944 set d_gnulibc
4945 eval $setvar
4946
4947 : see if nm is to be used to determine whether a symbol is defined or not
4948 case "$usenm" in
4949 '')
4950         dflt=''
4951         case "$d_gnulibc" in
4952         "$define")
4953                 echo " "
4954                 echo "nm probably won't work on the GNU C Library." >&4
4955                 dflt=n
4956                 ;;
4957         esac
4958         case "$dflt" in
4959         '') 
4960                 if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then
4961                         echo " "
4962                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
4963                         echo "'nm' won't be sufficient on this sytem." >&4
4964                         dflt=n
4965                 fi
4966                 ;;
4967         esac
4968         case "$dflt" in
4969         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
4970                 if $test $dflt -gt 20; then
4971                         dflt=y
4972                 else
4973                         dflt=n
4974                 fi
4975                 ;;
4976         esac
4977         ;;
4978 *)
4979         case "$usenm" in
4980         true|$define) dflt=y;;
4981         *) dflt=n;;
4982         esac
4983         ;;
4984 esac
4985 $cat <<EOM
4986
4987 I can use $nm to extract the symbols from your C libraries. This
4988 is a time consuming task which may generate huge output on the disk (up
4989 to 3 megabytes) but that should make the symbols extraction faster. The
4990 alternative is to skip the 'nm' extraction part and to compile a small
4991 test program instead to determine whether each symbol is present. If
4992 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
4993 this may be the best solution.
4994
4995 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
4996
4997 EOM
4998 rp="Shall I use $nm to extract C symbols from the libraries?"
4999 . ./myread
5000 case "$ans" in
5001 [Nn]*) usenm=false;;
5002 *) usenm=true;;
5003 esac
5004
5005 runnm=$usenm
5006 case "$reuseval" in
5007 true) runnm=false;;
5008 esac
5009
5010 : nm options which may be necessary
5011 case "$nm_opt" in
5012 '') if $test -f /mach_boot; then
5013                 nm_opt=''       # Mach
5014         elif $test -d /usr/ccs/lib; then
5015                 nm_opt='-p'     # Solaris (and SunOS?)
5016         elif $test -f /dgux; then
5017                 nm_opt='-p'     # DG-UX
5018         elif $test -f /lib64/rld; then
5019                 nm_opt='-p'     # 64-bit Irix
5020         else
5021                 nm_opt=''
5022         fi;;
5023 esac
5024
5025 : nm options which may be necessary for shared libraries but illegal
5026 : for archive libraries.  Thank you, Linux.
5027 case "$nm_so_opt" in
5028 '')     case "$myuname" in
5029         *linux*)
5030                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5031                         nm_so_opt='--dynamic'
5032                 fi
5033                 ;;
5034         esac
5035         ;;
5036 esac
5037
5038 case "$runnm" in
5039 true)
5040 : get list of predefined functions in a handy place
5041 echo " "
5042 case "$libc" in
5043 '') libc=unknown
5044         case "$libs" in
5045         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5046         esac
5047         ;;
5048 esac
5049 libnames='';
5050 case "$libs" in
5051 '') ;;
5052 *)  for thislib in $libs; do
5053         case "$thislib" in
5054         -lc|-lc_s)
5055                 : Handle C library specially below.
5056                 ;;
5057         -l*)
5058                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5059                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5060                         :
5061                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5062                         :
5063                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5064                         :
5065                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5066                         :
5067                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5068                         :
5069                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5070                         :
5071                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5072                         :
5073                 else
5074                         try=''
5075                 fi
5076                 libnames="$libnames $try"
5077                 ;;
5078         *) libnames="$libnames $thislib" ;;
5079         esac
5080         done
5081         ;;
5082 esac
5083 xxx=normal
5084 case "$libc" in
5085 unknown)
5086         set /lib/libc.$so
5087         for xxx in $libpth; do
5088                 $test -r $1 || set $xxx/libc.$so
5089                 : The messy sed command sorts on library version numbers.
5090                 $test -r $1 || \
5091                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5092                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5093                                 h
5094                                 s/[0-9][0-9]*/0000&/g
5095                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5096                                 G
5097                                 s/\n/ /' | \
5098                          sort | $sed -e 's/^.* //'`
5099                 eval set \$$#
5100         done
5101         $test -r $1 || set /usr/ccs/lib/libc.$so
5102         $test -r $1 || set /lib/libsys_s$_a
5103         ;;
5104 *)
5105         set blurfl
5106         ;;
5107 esac
5108 if $test -r "$1"; then
5109         echo "Your (shared) C library seems to be in $1."
5110         libc="$1"
5111 elif $test -r /lib/libc && $test -r /lib/clib; then
5112         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5113         xxx=apollo
5114         libc='/lib/clib /lib/libc'
5115         if $test -r /lib/syslib; then
5116                 echo "(Your math library is in /lib/syslib.)"
5117                 libc="$libc /lib/syslib"
5118         fi
5119 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5120         echo "Your C library seems to be in $libc, as you said before."
5121 elif $test -r $incpath/usr/lib/libc$_a; then
5122         libc=$incpath/usr/lib/libc$_a;
5123         echo "Your C library seems to be in $libc.  That's fine."
5124 elif $test -r /lib/libc$_a; then
5125         libc=/lib/libc$_a;
5126         echo "Your C library seems to be in $libc.  You're normal."
5127 else
5128         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5129                 :
5130         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5131                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5132         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5133                 :
5134         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5135                 :
5136         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5137                 :
5138         else
5139                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5140         fi
5141         if $test -r "$tans"; then
5142                 echo "Your C library seems to be in $tans, of all places."
5143                 libc=$tans
5144         else
5145                 libc='blurfl'
5146         fi
5147 fi
5148 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5149         dflt="$libc"
5150         cat <<EOM
5151
5152 If the guess above is wrong (which it might be if you're using a strange
5153 compiler, or your machine supports multiple models), you can override it here.
5154
5155 EOM
5156 else
5157         dflt=''
5158         echo $libpth | tr ' ' $trnl | sort | uniq > libpath
5159         cat >&4 <<EOM
5160 I can't seem to find your C library.  I've looked in the following places:
5161
5162 EOM
5163         $sed 's/^/      /' libpath
5164         cat <<EOM
5165
5166 None of these seems to contain your C library. I need to get its name...
5167
5168 EOM
5169 fi
5170 fn=f
5171 rp='Where is your C library?'
5172 . ./getfile
5173 libc="$ans"
5174
5175 echo " "
5176 echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
5177 set X `cat libnames`
5178 shift
5179 xxx=files
5180 case $# in 1) xxx=file; esac
5181 echo "Extracting names from the following $xxx for later perusal:" >&4
5182 echo " "
5183 $sed 's/^/      /' libnames >&4
5184 echo " "
5185 $echo $n "This may take a while...$c" >&4
5186
5187 for file in $*; do
5188         case $file in
5189         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5190         *) $nm $nm_opt $file 2>/dev/null;;
5191         esac
5192 done >libc.tmp
5193
5194 $echo $n ".$c"
5195 $grep fprintf libc.tmp > libc.ptf
5196 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5197 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
5198 xxx='[ADTSIW]'
5199 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5200         eval $xscan;\
5201         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5202                 eval $xrun
5203 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5204         eval $xscan;\
5205         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5206                 eval $xrun
5207 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5208         eval $xscan;\
5209         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5210                 eval $xrun
5211 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5212         eval $xscan;\
5213         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5214                 eval $xrun
5215 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5216         eval $xscan;\
5217         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5218                 eval $xrun
5219 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5220         eval $xscan;\
5221         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5222                 eval $xrun
5223 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5224                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5225         eval $xscan;\
5226         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5227                 eval $xrun
5228 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5229         eval $xscan;\
5230         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5231                 eval $xrun
5232 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5233         eval $xscan;\
5234         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5235                 eval $xrun
5236 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5237         eval $xscan;\
5238         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5239                 eval $xrun
5240 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5241         eval $xscan;\
5242         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5243                 eval $xrun
5244 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5245         eval $xscan;\
5246         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5247                 eval $xrun
5248 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5249         eval $xscan;\
5250         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5251                 eval $xrun
5252 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5253         eval $xscan;\
5254         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5255                 eval $xrun
5256 else
5257         $nm -p $* 2>/dev/null >libc.tmp
5258         $grep fprintf libc.tmp > libc.ptf
5259         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5260                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5261         then
5262                 nm_opt='-p'
5263                 eval $xrun
5264         else
5265                 echo " "
5266                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5267                 com=''
5268                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5269                         for thisname in $libnames $libc; do
5270                                 $ar t $thisname >>libc.tmp
5271                         done
5272                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5273                         echo "Ok." >&4
5274                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5275                         # Repeat libc to extract forwarders to DLL entries too
5276                         for thisname in $libnames $libc; do
5277                                 $ar tv $thisname >>libc.tmp
5278                                 # Revision 50 of EMX has bug in $ar.
5279                                 # it will not extract forwarders to DLL entries
5280                                 # Use emximp which will extract exactly them.
5281                                 emximp -o tmp.imp $thisname \
5282                                     2>/dev/null && \
5283                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5284                                     < tmp.imp >>libc.tmp
5285                                 $rm tmp.imp
5286                         done
5287                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5288                         echo "Ok." >&4
5289                 else
5290                         echo "$ar didn't seem to work right." >&4
5291                         echo "Maybe this is a Cray...trying bld instead..." >&4
5292                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5293                         then
5294                                 for thisname in $libnames; do
5295                                         bld t $libnames | \
5296                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5297                                         $ar t $thisname >>libc.tmp
5298                                 done
5299                                 echo "Ok." >&4
5300                         else
5301                                 echo "That didn't work either.  Giving up." >&4
5302                                 exit 1
5303                         fi
5304                 fi
5305         fi
5306 fi
5307 nm_extract="$com"
5308 if $test -f /lib/syscalls.exp; then
5309         echo " "
5310         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5311         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*$/\1/p' /lib/syscalls.exp >>libc.list
5312 fi
5313 ;;
5314 esac
5315 $rm -f libnames libpath
5316
5317 : see if dld is available
5318 set dld.h i_dld
5319 eval $inhdr
5320
5321 : is a C symbol defined?
5322 csym='tlook=$1;
5323 case "$3" in
5324 -v) tf=libc.tmp; tc=""; tdc="";;
5325 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5326 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5327 esac;
5328 tx=yes;
5329 case "$reuseval-$4" in
5330 true-) ;;
5331 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5332 esac;
5333 case "$tx" in
5334 yes)
5335         case "$runnm" in
5336         true)
5337                 if $contains $tlook $tf >/dev/null 2>&1;
5338                 then tval=true;
5339                 else tval=false;
5340                 fi;;
5341         *)
5342                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5343                 if $cc $optimize $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1;
5344                 then tval=true;
5345                 else tval=false;
5346                 fi;
5347                 $rm -f t t.c;;
5348         esac;;
5349 *)
5350         case "$tval" in
5351         $define) tval=true;;
5352         *) tval=false;;
5353         esac;;
5354 esac;
5355 eval "$2=$tval"'
5356
5357 : define an is-in-libc? function
5358 inlibc='echo " "; td=$define; tu=$undef;
5359 sym=$1; var=$2; eval "was=\$$2";
5360 tx=yes;
5361 case "$reuseval$was" in
5362 true) ;;
5363 true*) tx=no;;
5364 esac;
5365 case "$tx" in
5366 yes)
5367         set $sym tres -f;
5368         eval $csym;
5369         case "$tres" in
5370         true)
5371                 echo "$sym() found." >&4;
5372                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5373         *)
5374                 echo "$sym() NOT found." >&4;
5375                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5376         esac;;
5377 *)
5378         case "$was" in
5379         $define) echo "$sym() found." >&4;;
5380         *) echo "$sym() NOT found." >&4;;
5381         esac;;
5382 esac'
5383
5384 : see if dlopen exists
5385 xxx_runnm="$runnm"
5386 runnm=false
5387 set dlopen d_dlopen
5388 eval $inlibc
5389 runnm="$xxx_runnm"
5390
5391 : determine which dynamic loading, if any, to compile in
5392 echo " "
5393 dldir="ext/DynaLoader"
5394 case "$usedl" in
5395 $define|y|true)
5396         dflt='y'
5397         usedl="$define"
5398         ;;
5399 $undef|n|false)
5400         dflt='n'
5401         usedl="$undef"
5402         ;;
5403 *) 
5404         dflt='n'
5405         case "$d_dlopen" in
5406             $define) dflt='y' ;;
5407         esac
5408         case "$i_dld" in
5409             $define) dflt='y' ;;
5410         esac
5411         : Does a dl_xxx.xs file exist for this operating system
5412         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
5413         ;;
5414 esac
5415 rp="Do you wish to use dynamic loading?"
5416 . ./myread
5417 usedl="$ans"
5418 case "$ans" in
5419 y*) usedl="$define"
5420         case "$dlsrc" in
5421         '')
5422                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
5423                         dflt="$dldir/dl_${osname}.xs"
5424                 elif $test "$d_dlopen" = "$define" ; then
5425                         dflt="$dldir/dl_dlopen.xs"
5426                 elif $test "$i_dld" = "$define" ; then
5427                         dflt="$dldir/dl_dld.xs"
5428                 else
5429                         dflt=''
5430                 fi
5431                 ;;
5432         *)      dflt="$dldir/$dlsrc"
5433                 ;;
5434         esac
5435     echo "The following dynamic loading files are available:"
5436         : Can not go over to $dldir because getfile has path hard-coded in.
5437         tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
5438         rp="Source file to use for dynamic loading"
5439         fn="fne"
5440         gfpth="$src"
5441         . ./getfile
5442         usedl="$define"
5443         : emulate basename
5444         dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
5445
5446         $cat << EOM
5447
5448 Some systems may require passing special flags to $cc -c to
5449 compile modules that will be used to create a shared library.
5450 To use no flags, say "none".
5451
5452 EOM
5453     case "$cccdlflags" in
5454     '') case "$gccversion" in
5455                 '') case "$osname" in
5456                         hpux)   dflt='+z' ;;
5457                         next)   dflt='none' ;;
5458                         irix*)  dflt='-KPIC' ;;
5459                         svr4*|esix*|solaris) dflt='-KPIC' ;;
5460                         sunos)  dflt='-pic' ;;
5461                         *)      dflt='none' ;;
5462                     esac
5463                         ;;
5464                 *)  case "$osname" in
5465                         svr4*|esix*|solaris) dflt='-fPIC' ;;
5466                         *)      dflt='-fpic' ;;
5467                     esac ;;
5468             esac ;;
5469         ' ') dflt='none' ;;
5470     *)  dflt="$cccdlflags" ;;
5471     esac
5472     rp="Any special flags to pass to $cc -c to compile shared library modules?"
5473     . ./myread
5474     case "$ans" in
5475     none) cccdlflags=' ' ;;
5476     *) cccdlflags="$ans" ;;
5477     esac
5478
5479     cat << EOM
5480
5481 Some systems use ld to create libraries that can be dynamically loaded,
5482 while other systems (such as those using ELF) use $cc.
5483
5484 EOM
5485         case "$ld" in
5486         '')     $cat >try.c <<'EOM'
5487 /* Test for whether ELF binaries are produced */
5488 #include <fcntl.h>
5489 #include <stdlib.h>
5490 int main() {
5491         char b[4];
5492         int i = open("a.out",O_RDONLY);
5493         if(i == -1) 
5494                 exit(1); /* fail */
5495         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
5496                 exit(0); /* succeed (yes, it's ELF) */
5497         else
5498                 exit(1); /* fail */
5499 }
5500 EOM
5501                 if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then
5502                         cat <<EOM
5503 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
5504 EOM
5505                         dflt="$cc"
5506                 else
5507                         echo "I'll use ld to build dynamic libraries."
5508                         dflt='ld'
5509                 fi
5510                 rm -f try.c a.out
5511                 ;;
5512         *)      dflt="$ld"
5513                 ;;
5514         esac
5515
5516     rp="What command should be used to create dynamic libraries?"
5517     . ./myread
5518         ld="$ans"
5519
5520     cat << EOM
5521
5522 Some systems may require passing special flags to $ld to create a
5523 library that can be dynamically loaded.  If your ld flags include
5524 -L/other/path options to locate libraries outside your loader's normal
5525 search path, you may need to specify those -L options here as well.  To
5526 use no flags, say "none".
5527
5528 EOM
5529     case "$lddlflags" in
5530     '') case "$osname" in
5531                         beos) dflt='-nostart' ;;
5532                         hpux)  dflt='-b' ;;
5533                         linux|irix*)    dflt='-shared' ;;
5534                         next)  dflt='none' ;;
5535                         solaris) dflt='-G' ;;
5536                         sunos) dflt='-assert nodefinitions' ;;
5537                         svr4*|esix*) dflt="-G $ldflags" ;;
5538                 *)     dflt='none' ;;
5539                         esac
5540                         ;;
5541     *) dflt="$lddlflags" ;;
5542     esac
5543
5544         : Try to guess additional flags to pick up local libraries.
5545         : Be careful not to append to a plain 'none'
5546         case "$dflt" in
5547         none) dflt='' ;;
5548         esac
5549         for thisflag in $ldflags; do
5550                 case "$thisflag" in
5551                 -L*)
5552                         case " $dflt " in
5553                         *" $thisflag "*) ;;
5554                         *) dflt="$dflt $thisflag" ;;
5555                         esac
5556                         ;;
5557                 esac
5558         done
5559
5560         case "$dflt" in
5561         ''|' ') dflt='none' ;;
5562         esac
5563
5564     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
5565     . ./myread
5566     case "$ans" in
5567     none) lddlflags=' ' ;;
5568     *) lddlflags="$ans" ;;
5569     esac
5570
5571         cat <<EOM
5572
5573 Some systems may require passing special flags to $cc to indicate that
5574 the resulting executable will use dynamic linking.  To use no flags,
5575 say "none".
5576
5577 EOM
5578     case "$ccdlflags" in
5579     '') case "$osname" in
5580                 hpux)   dflt='-Wl,-E' ;;
5581                 linux)  dflt='-rdynamic' ;;
5582                 next)   dflt='none' ;;
5583                 sunos)  dflt='none' ;;
5584                 *)      dflt='none' ;;
5585             esac ;;
5586     ' ')  dflt='none' ;;
5587     *)  dflt="$ccdlflags" ;;
5588     esac
5589     rp="Any special flags to pass to $cc to use dynamic loading?"
5590     . ./myread
5591     case "$ans" in
5592     none) ccdlflags=' ' ;;
5593     *) ccdlflags="$ans" ;;
5594     esac
5595     ;;
5596 *)  usedl="$undef"
5597         ld='ld'
5598     dlsrc='dl_none.xs'
5599     lddlflags=''
5600     ccdlflags=''
5601     ;;
5602 esac
5603
5604 also=''
5605 case "$usedl" in
5606 $undef)
5607         # No dynamic loading being used, so don't bother even to prompt.
5608         useshrplib='false'
5609         ;;
5610 *)      case "$useshrplib" in
5611         '')     case "$osname" in
5612                 svr4*|dgux|dynixptx|esix|powerux|beos)
5613                         dflt=y
5614                         also='Building a shared libperl is required for dynamic loading to work on your system.'
5615                         ;;
5616                 next*)
5617                         case "$osvers" in
5618                         4*)     dflt=y
5619                                 also='Building a shared libperl is needed for MAB support.'
5620                                 ;;
5621                         *)      dflt=n
5622                                 ;;
5623                         esac
5624                         ;;
5625                 *)      dflt=n
5626                         ;;
5627                 esac
5628                 ;;
5629         $define|true|[Yy]*)
5630                 dflt=y
5631                 ;;
5632         *)      dflt=n
5633                 ;;
5634         esac
5635         $cat << EOM
5636
5637 The perl executable is normally obtained by linking perlmain.c with
5638 libperl${_a}, any static extensions (usually just DynaLoader), and
5639 any other libraries needed on this system (such as -lm, etc.).  Since
5640 your system supports dynamic loading, it is probably possible to build
5641 a shared libperl.$so.  If you will have more than one executable linked
5642 to libperl.$so, this will significantly reduce the size of each
5643 executable, but it may have a noticeable affect on performance.  The
5644 default is probably sensible for your system.
5645 $also
5646
5647 EOM
5648         rp="Build a shared libperl.$so (y/n)"
5649         . ./myread
5650         case "$ans" in
5651         true|$define|[Yy]*)
5652                 useshrplib='true'  ;;
5653         *)      useshrplib='false' ;;
5654         esac
5655         ;;
5656 esac
5657
5658 case "$useshrplib" in
5659 true)
5660         case "$libperl" in
5661         '')
5662                 # Figure out a good name for libperl.so.  Since it gets stored in
5663                 # a version-specific architecture-dependent library, the version
5664                 # number isn't really that important, except for making cc/ld happy.
5665                 #
5666                 # A name such as libperl.so.3.1
5667                 majmin="libperl.$so.$patchlevel.$subversion"
5668                 # A name such as libperl.so.301
5669                 majonly=`echo $patchlevel $subversion |
5670                         $awk '{printf "%d%02d", $1, $2}'`
5671                 majonly=libperl.$so.$majonly
5672                 # I'd prefer to keep the os-specific stuff here to a minimum, and
5673                 # rely on figuring it out from the naming of libc.
5674                 case "${osname}${osvers}" in
5675                 next4*)
5676                         dflt=libperl.5.$so
5677                         # XXX How handle the --version stuff for MAB?
5678                         ;;
5679                 linux*)  # ld won't link with a bare -lperl otherwise.
5680                         dflt=libperl.$so
5681                         ;;
5682                 *)      # Try to guess based on whether libc has major.minor.
5683                         case "$libc" in
5684                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
5685                         *libc.$so.[0-9]*) dflt=$majonly ;;
5686                         *)      dflt=libperl.$so ;;
5687                         esac
5688                         ;;
5689                 esac
5690                 ;;
5691         *)      dflt=$libperl
5692                 ;;
5693         esac
5694         cat << EOM
5695
5696 I need to select a good name for the shared libperl.  If your system uses
5697 library names with major and minor numbers, then you might want something
5698 like $majmin.  Alternatively, if your system uses a single version
5699 number for shared libraries, then you might want to use $majonly.
5700 Or, your system might be quite happy with a simple libperl.$so.
5701
5702 Since the shared libperl will get installed into a version-specific
5703 architecture-dependent directory, the version number of the shared perl
5704 library probably isn't important, so the default should be o.k.
5705
5706 EOM
5707         rp='What name do you want to give to the shared libperl?'
5708         . ./myread
5709         libperl=$ans
5710         echo "Ok, I'll use $libperl"
5711         ;;
5712 *)
5713         libperl="libperl${_a}"
5714         ;;
5715 esac
5716
5717 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
5718 case "$shrpdir" in
5719 '') ;;
5720 *)      $cat >&4 <<EOM
5721 WARNING:  Use of the shrpdir variable for the installation location of
5722 the shared $libperl is not supported.  It was never documented and
5723 will not work in this version.  Let me (perlbug@perl.com)
5724 know of any problems this may cause.
5725
5726 EOM
5727         case "$shrpdir" in
5728         "$archlibexp/CORE")
5729                 $cat >&4 <<EOM
5730 But your current setting of $shrpdir is
5731 the default anyway, so it's harmless.
5732 EOM
5733                 ;;
5734         *)
5735                 $cat >&4 <<EOM
5736 Further, your current attempted setting of $shrpdir
5737 conflicts with the value of $archlibexp/CORE
5738 that installperl will use.
5739 EOM
5740                 ;;
5741         esac
5742         ;;
5743 esac
5744
5745 # How will the perl executable find the installed shared $libperl?
5746 # Add $xxx to ccdlflags.
5747 # If we can't figure out a command-line option, use $shrpenv to
5748 # set env LD_RUN_PATH.  The main perl makefile uses this.
5749 shrpdir=$archlibexp/CORE
5750 xxx=''
5751 tmp_shrpenv=''
5752 if "$useshrplib"; then
5753     case "$osname" in 
5754         aix)
5755                 # We'll set it in Makefile.SH...
5756                 ;;
5757         solaris|netbsd)
5758                 xxx="-R $shrpdir"
5759                 ;;
5760         freebsd)
5761                 xxx="-Wl,-R$shrpdir"
5762                 ;;
5763         linux|irix*|dec_osf)
5764                 xxx="-Wl,-rpath,$shrpdir"
5765                 ;;
5766         next)
5767                 # next doesn't like the default...
5768                 ;;
5769         beos)
5770                 # beos doesn't like the default, either.
5771                 ;;
5772         hpux*)
5773                 # hpux doesn't like the default, either.
5774                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
5775                 ;;
5776         *)
5777                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
5778                 ;;
5779         esac
5780         case "$xxx" in
5781         '') ;;
5782         *)      
5783                 # Only add $xxx if it isn't already in ccdlflags.
5784                 case " $ccdlflags " in
5785                 *" $xxx "*)     ;;
5786                 *)      ccdlflags="$ccdlflags $xxx"
5787                         cat <<EOM >&4
5788
5789 Adding $xxx to the flags
5790 passed to $ld so that the perl executable will find the 
5791 installed shared $libperl.
5792
5793 EOM
5794                         ;;
5795                 esac
5796                 ;;
5797         esac
5798 fi
5799 # Fix ccdlflags in AIX for building external extensions.
5800 # (For building Perl itself bare -bE:perl.exp is needed,
5801 #  Makefile.SH takes care of this.)
5802 case "$osname" in
5803 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
5804 esac
5805 # Respect a hint or command-line value.
5806 case "$shrpenv" in
5807 '') shrpenv="$tmp_shrpenv" ;;
5808 esac
5809 case "$ldlibpthname" in
5810 '')     ldlibpthname=LD_LIBRARY_PATH ;;
5811 none)   ldlibpthname='' ;;
5812 esac
5813
5814 : determine where manual pages go
5815 set man1dir man1dir none
5816 eval $prefixit
5817 $cat <<EOM
5818
5819 $spackage has manual pages available in source form.
5820 EOM
5821 case "$nroff" in
5822 nroff)
5823         echo "However, you don't have nroff, so they're probably useless to you."
5824         case "$man1dir" in
5825         '') man1dir="none";;
5826         esac;;
5827 esac
5828 echo "If you don't want the manual sources installed, answer 'none'."
5829 case "$man1dir" in
5830 ' ') dflt=none
5831         ;;
5832 '')
5833         lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1"
5834         lookpath="$lookpath $prefixexp/man/p_man/man1"
5835         lookpath="$lookpath $prefixexp/man/u_man/man1"
5836         lookpath="$lookpath $prefixexp/man/man.1"
5837         case "$sysman" in
5838         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
5839         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
5840         esac
5841         set dflt
5842         eval $prefixup
5843         ;;
5844 *)  dflt="$man1dir"
5845         ;;
5846 esac
5847 echo " "
5848 fn=dn+~
5849 rp="Where do the main $spackage manual pages (source) go?"
5850 . ./getfile
5851 if $test "X$man1direxp" != "X$ansexp"; then
5852         installman1dir=''
5853 fi
5854 man1dir="$ans"
5855 man1direxp="$ansexp"
5856 case "$man1dir" in
5857 '')     man1dir=' '
5858         installman1dir='';;
5859 esac
5860
5861 : Change installation prefix, if necessary.
5862 if $test X"$prefix" != X"$installprefix"; then
5863         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
5864 else
5865         installman1dir="$man1direxp"
5866 fi
5867
5868 : What suffix to use on installed man pages
5869
5870 case "$man1dir" in
5871 ' ')
5872         man1ext='0'
5873         ;;
5874 *)
5875         rp="What suffix should be used for the main $spackage man pages?"
5876         case "$man1ext" in
5877         '')     case "$man1dir" in
5878                 *1)  dflt=1 ;;
5879                 *1p) dflt=1p ;;
5880                 *1pm) dflt=1pm ;;
5881                 *l) dflt=l;;
5882                 *n) dflt=n;;
5883                 *o) dflt=o;;
5884                 *p) dflt=p;;
5885                 *C) dflt=C;;
5886                 *L) dflt=L;;
5887                 *L1) dflt=L1;;
5888                 *) dflt=1;;
5889                 esac
5890                 ;;
5891         *)      dflt="$man1ext";;
5892         esac
5893         . ./myread
5894         man1ext="$ans"
5895         ;;
5896 esac
5897
5898 : see if we can have long filenames
5899 echo " "
5900 rmlist="$rmlist /tmp/cf$$"
5901 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
5902 first=123456789abcdef
5903 second=/tmp/cf$$/$first
5904 $rm -f $first $second
5905 if (echo hi >$first) 2>/dev/null; then
5906         if $test -f 123456789abcde; then
5907                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
5908                 val="$undef"
5909         else
5910                 if (echo hi >$second) 2>/dev/null; then
5911                         if $test -f /tmp/cf$$/123456789abcde; then
5912                                 $cat <<'EOM'
5913 That's peculiar... You can have filenames longer than 14 characters, but only
5914 on some of the filesystems.  Maybe you are using NFS.  Anyway, to avoid problems
5915 I shall consider your system cannot support long filenames at all.
5916 EOM
5917                                 val="$undef"
5918                         else
5919                                 echo 'You can have filenames longer than 14 characters.' >&4
5920                                 val="$define"
5921                         fi
5922                 else
5923                         $cat <<'EOM'
5924 How confusing! Some of your filesystems are sane enough to allow filenames
5925 longer than 14 characters but some others like /tmp can't even think about them.
5926 So, for now on, I shall assume your kernel does not allow them at all.
5927 EOM
5928                         val="$undef"
5929                 fi
5930         fi
5931 else
5932         $cat <<'EOM'
5933 You can't have filenames longer than 14 chars.  You can't even think about them!
5934 EOM
5935         val="$undef"
5936 fi 
5937 set d_flexfnam
5938 eval $setvar
5939 $rm -rf /tmp/cf$$ 123456789abcde*
5940
5941 : determine where library module manual pages go
5942 set man3dir man3dir none
5943 eval $prefixit
5944 $cat <<EOM
5945
5946 $spackage has manual pages for many of the library modules.
5947 EOM
5948
5949 case "$nroff" in
5950 nroff)
5951         $cat <<'EOM'
5952 However, you don't have nroff, so they're probably useless to you.
5953 EOM
5954         case "$man3dir" in
5955         '') man3dir="none";;
5956         esac;;
5957 esac
5958
5959 case "$d_flexfnam" in
5960 undef)
5961         $cat <<'EOM'
5962 However, your system can't handle the long file names like File::Basename.3. 
5963 EOM
5964         case "$man3dir" in
5965         '') man3dir="none";;
5966         esac;;
5967 esac
5968
5969 echo "If you don't want the manual sources installed, answer 'none'."
5970 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
5971 case "$man3dir" in
5972 '')     dflt=`echo $man1dir | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
5973         if $test -d "$privlib/man/man3"; then
5974                 cat <<EOM >&4
5975
5976 WARNING:  Previous versions of perl installed man3 pages into
5977 $privlib/man/man3.  This version will suggest a 
5978 new default of $dflt.  
5979 EOM
5980                 tdflt=$dflt
5981                 dflt='n'
5982                 rp='Do you wish to preserve the old behavior?(y/n)'
5983                 . ./myread
5984                 case "$ans" in
5985                 y*) dflt="$privlib/man/man3" ;;
5986                 *)  dflt=$tdflt ;;
5987                 esac
5988     fi
5989         ;;
5990 ' ') dflt=none;;
5991 *)      dflt="$man3dir" ;;
5992 esac
5993 echo " "
5994 fn=dn+~
5995 rp="Where do the $package library man pages (source) go?"
5996 . ./getfile
5997 man3dir="$ans"
5998 man3direxp="$ansexp"
5999 case "$man1dir" in
6000 '')     man3dir=' '
6001         installman3dir='';;
6002 esac
6003
6004 : Change installation prefix, if necessary.
6005 if $test X"$prefix" != X"$installprefix"; then
6006         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
6007 else
6008         installman3dir="$man3direxp"
6009 fi
6010
6011 : What suffix to use on installed man pages
6012 case "$man3dir" in
6013 ' ')
6014         man3ext='0'
6015         ;;
6016 *)
6017         rp="What suffix should be used for the $package library man pages?"
6018         case "$man3ext" in
6019         '')     case "$man3dir" in
6020                 *3)  dflt=3 ;;
6021                 *3p) dflt=3p ;;
6022                 *3pm) dflt=3pm ;;
6023                 *l) dflt=l;;
6024                 *n) dflt=n;;
6025                 *o) dflt=o;;
6026                 *p) dflt=p;;
6027                 *C) dflt=C;;
6028                 *L) dflt=L;;
6029                 *L3) dflt=L3;;
6030                 *) dflt=3;;
6031                 esac
6032                 ;;
6033         *)      dflt="$man3ext";;
6034         esac
6035         . ./myread
6036         man3ext="$ans"
6037         ;;
6038 esac
6039
6040 : see if we have to deal with yellow pages, now NIS.
6041 if $test -d /usr/etc/yp || $test -d /etc/yp; then
6042         if $test -f /usr/etc/nibindd; then
6043                 echo " "
6044                 echo "I'm fairly confident you're on a NeXT."
6045                 echo " "
6046                 rp='Do you get the hosts file via NetInfo?'
6047                 dflt=y
6048                 case "$hostcat" in
6049                 nidump*) ;;
6050                 '') ;;
6051                 *) dflt=n;;
6052                 esac
6053                 . ./myread
6054                 case "$ans" in
6055                 y*) hostcat='nidump hosts .';;
6056                 *)      case "$hostcat" in
6057                         nidump*) hostcat='';;
6058                         esac
6059                         ;;
6060                 esac
6061         fi
6062         case "$hostcat" in
6063         nidump*) ;;
6064         *)
6065                 case "$hostcat" in
6066                 *ypcat*) dflt=y;;
6067                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
6068                                 dflt=y
6069                         else
6070                                 dflt=n
6071                         fi;;
6072                 *) dflt=n;;
6073                 esac
6074                 echo " "
6075                 rp='Are you getting the hosts file via yellow pages?'
6076                 . ./myread
6077                 case "$ans" in
6078                 y*) hostcat='ypcat hosts';;
6079                 *) hostcat='cat /etc/hosts';;
6080                 esac
6081                 ;;
6082         esac
6083 fi
6084 case "$hostcat" in
6085 '') hostcat='cat /etc/hosts';;
6086 esac
6087 case "$groupcat" in
6088 '') groupcat='cat /etc/group';;
6089 esac
6090 case "$passcat" in
6091 '') passcat='cat /etc/passwd';;
6092 esac
6093
6094 : now get the host name
6095 echo " "
6096 echo "Figuring out host name..." >&4
6097 case "$myhostname" in
6098 '') cont=true
6099         echo 'Maybe "hostname" will work...'
6100         if tans=`sh -c hostname 2>&1` ; then
6101                 myhostname=$tans
6102                 phostname=hostname
6103                 cont=''
6104         fi
6105         ;;
6106 *) cont='';;
6107 esac
6108 if $test "$cont"; then
6109         if ./xenix; then
6110                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
6111                 if tans=`cat /etc/systemid 2>&1` ; then
6112                         myhostname=$tans
6113                         phostname='cat /etc/systemid'
6114                         echo "Whadyaknow.  Xenix always was a bit strange..."
6115                         cont=''
6116                 fi
6117         elif $test -r /etc/systemid; then
6118                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
6119         fi
6120 fi
6121 if $test "$cont"; then
6122         echo 'No, maybe "uuname -l" will work...'
6123         if tans=`sh -c 'uuname -l' 2>&1` ; then
6124                 myhostname=$tans
6125                 phostname='uuname -l'
6126         else
6127                 echo 'Strange.  Maybe "uname -n" will work...'
6128                 if tans=`sh -c 'uname -n' 2>&1` ; then
6129                         myhostname=$tans
6130                         phostname='uname -n'
6131                 else
6132                         echo 'Oh well, maybe I can mine it out of whoami.h...'
6133                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
6134                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
6135                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
6136                         else
6137                                 case "$myhostname" in
6138                                 '') echo "Does this machine have an identity crisis or something?"
6139                                         phostname='';;
6140                                 *)
6141                                         echo "Well, you said $myhostname before..."
6142                                         phostname='echo $myhostname';;
6143                                 esac
6144                         fi
6145                 fi
6146         fi
6147 fi
6148 : you do not want to know about this
6149 set $myhostname
6150 myhostname=$1
6151
6152 : verify guess
6153 if $test "$myhostname" ; then
6154         dflt=y
6155         rp='Your host name appears to be "'$myhostname'".'" Right?"
6156         . ./myread
6157         case "$ans" in
6158         y*) ;;
6159         *) myhostname='';;
6160         esac
6161 fi
6162
6163 : bad guess or no guess
6164 while $test "X$myhostname" = X ; do
6165         dflt=''
6166         rp="Please type the (one word) name of your host:"
6167         . ./myread
6168         myhostname="$ans"
6169 done
6170
6171 : translate upper to lower if necessary
6172 case "$myhostname" in
6173 *[A-Z]*)
6174         echo "(Normalizing case in your host name)"
6175         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
6176         ;;
6177 esac
6178
6179 case "$myhostname" in
6180 *.*)
6181         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
6182         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
6183         echo "(Trimming domain name from host name--host name is now $myhostname)"
6184         ;;
6185 *) case "$mydomain" in
6186         '')
6187                 {
6188                         test "X$hostcat" = "Xypcat hosts" &&
6189                         ypmatch "$myhostname" hosts 2>/dev/null |\
6190                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
6191                         $test -s hosts
6192                 } || {
6193                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
6194                                         /[       ]$myhostname[  . ]/p" > hosts
6195                 }
6196                 tmp_re="[       . ]"
6197                 $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
6198                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
6199                 dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
6200                         hosts | $sort | $uniq | \
6201                         $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
6202                 case `$echo X$dflt` in
6203                 X*\ *)  echo "(Several hosts in /etc/hosts matched hostname)"
6204                         dflt=.
6205                         ;;
6206                 X.) echo "(You do not have fully-qualified names in /etc/hosts)"
6207                         ;;
6208                 esac
6209                 case "$dflt" in
6210                 .)
6211                         tans=`./loc resolv.conf X /etc /usr/etc`
6212                         if $test -f "$tans"; then
6213                                 echo "(Attempting domain name extraction from $tans)"
6214                                 dflt=.`$sed -n -e 's/   / /g' \
6215                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
6216                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6217                                 case "$dflt" in
6218                                 .) dflt=.`$sed -n -e 's/        / /g' \
6219                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
6220                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
6221                                         ;;
6222                                 esac
6223                         fi
6224                         ;;
6225                 esac
6226                 case "$dflt" in
6227                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
6228                         dflt=.`sh -c domainname 2>/dev/null`
6229                         case "$dflt" in
6230                         '') dflt='.';;
6231                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
6232                         esac
6233                         ;;
6234                 esac
6235                 case "$dflt" in
6236                 .) echo "(Lost all hope -- silly guess then)"
6237                         dflt='.uucp'
6238                         ;;
6239                 esac
6240                 $rm -f hosts
6241                 ;;
6242         *) dflt="$mydomain";;
6243         esac;;
6244 esac
6245 echo " "
6246 rp="What is your domain name?"
6247 . ./myread
6248 tans="$ans"
6249 case "$ans" in
6250 '') ;;
6251 .*) ;;
6252 *) tans=".$tans";;
6253 esac
6254 mydomain="$tans"
6255
6256 : translate upper to lower if necessary
6257 case "$mydomain" in
6258 *[A-Z]*)
6259         echo "(Normalizing case in your domain name)"
6260         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
6261         ;;
6262 esac
6263
6264 : a little sanity check here
6265 case "$phostname" in
6266 '') ;;
6267 *)
6268         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
6269         $myhostname$mydomain|$myhostname) ;;
6270         *)
6271                 case "$phostname" in
6272                 sed*)
6273                         echo "(That doesn't agree with your whoami.h file, by the way.)"
6274                         ;;
6275                 *)
6276                         echo "(That doesn't agree with your $phostname command, by the way.)"
6277                         ;;
6278                 esac
6279         ;;
6280         esac
6281         ;;
6282 esac
6283
6284 $cat <<EOM
6285
6286 I need to get your e-mail address in Internet format if possible, i.e.
6287 something like user@host.domain. Please answer accurately since I have
6288 no easy means to double check it. The default value provided below
6289 is most probably close to the reality but may not be valid from outside
6290 your organization...
6291
6292 EOM
6293 cont=x
6294 while test "$cont"; do
6295         case "$cf_email" in
6296         '') dflt="$cf_by@$myhostname$mydomain";;
6297         *) dflt="$cf_email";;
6298         esac
6299         rp='What is your e-mail address?'
6300         . ./myread
6301         cf_email="$ans"
6302         case "$cf_email" in
6303         *@*.*) cont='' ;;
6304         *)
6305                 rp='Address does not look like an Internet one.  Use it anyway?'
6306                 case "$fastread" in
6307                 yes) dflt=y ;;
6308                 *) dflt=n ;;
6309                 esac
6310                 . ./myread
6311                 case "$ans" in
6312                 y*) cont='' ;;
6313                 *) echo " " ;;
6314                 esac
6315                 ;;
6316         esac
6317 done
6318
6319 $cat <<EOM
6320
6321 If you or somebody else will be maintaining perl at your site, please
6322 fill in the correct e-mail address here so that they may be contacted
6323 if necessary. Currently, the "perlbug" program included with perl
6324 will send mail to this address in addition to perlbug@perl.com. You may
6325 enter "none" for no administrator.
6326
6327 EOM
6328 case "$perladmin" in
6329 '') dflt="$cf_email";;
6330 *) dflt="$perladmin";;
6331 esac
6332 rp='Perl administrator e-mail address'
6333 . ./myread
6334 perladmin="$ans"
6335
6336 : figure out how to guarantee perl startup
6337 case "$startperl" in
6338 '')
6339         case "$sharpbang" in
6340         *!)
6341                 $cat <<EOH
6342
6343 I can use the #! construct to start perl on your system. This will
6344 make startup of perl scripts faster, but may cause problems if you
6345 want to share those scripts and perl is not in a standard place
6346 ($binexp/perl) on all your platforms. The alternative is to force
6347 a shell by starting the script with a single ':' character.
6348
6349 EOH
6350                 dflt="$binexp/perl"
6351                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
6352                 . ./myread
6353                 case "$ans" in
6354                 none)   startperl=": # use perl";;
6355                 *)      startperl="#!$ans"
6356                         if $test 30 -lt `echo "$ans" | wc -c`; then
6357                                 $cat >&4 <<EOM
6358
6359 WARNING:  Some systems limit the #! command to 32 characters.
6360 If you experience difficulty running Perl scripts with #!, try
6361 installing Perl in a directory with a shorter pathname.
6362
6363 EOM
6364                         fi ;;
6365                 esac
6366                 ;;
6367         *) startperl=": # use perl"
6368                 ;;
6369         esac
6370         ;;
6371 esac
6372 echo "I'll use $startperl to start perl scripts."
6373
6374 : figure best path for perl in scripts
6375 case "$perlpath" in
6376 '')
6377         perlpath="$binexp/perl"
6378         case "$startperl" in
6379         *!*) ;;
6380         *)
6381                 $cat <<EOH
6382
6383 I will use the "eval 'exec'" idiom to start Perl on your system.
6384 I can use the full path of your Perl binary for this purpose, but
6385 doing so may cause problems if you want to share those scripts and
6386 Perl is not always in a standard place ($binexp/perl).
6387
6388 EOH
6389                 dflt="$binexp/perl"
6390                 rp="What path shall I use in \"eval 'exec'\"?"
6391                 . ./myread
6392                 perlpath="$ans"
6393                 ;;
6394         esac
6395         ;;
6396 esac
6397 case "$startperl" in
6398 *!*)    ;;
6399 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
6400 esac
6401
6402 : determine where public executable scripts go
6403 set scriptdir scriptdir
6404 eval $prefixit
6405 case "$scriptdir" in
6406 '')
6407         dflt="$bin"
6408         : guess some guesses
6409         $test -d /usr/share/scripts && dflt=/usr/share/scripts
6410         $test -d /usr/share/bin     && dflt=/usr/share/bin
6411         $test -d /usr/local/script  && dflt=/usr/local/script
6412         $test -d /usr/local/scripts && dflt=/usr/local/scripts
6413         $test -d $prefixexp/script  && dflt=$prefixexp/script
6414         set dflt
6415         eval $prefixup
6416         ;;
6417 *)  dflt="$scriptdir"
6418         ;;
6419 esac
6420 $cat <<EOM
6421  
6422 Some installations have a separate directory just for executable scripts so
6423 that they can mount it across multiple architectures but keep the scripts in
6424 one spot.  You might, for example, have a subdirectory of /usr/share for this.
6425 Or you might just lump your scripts in with all your other executables.
6426  
6427 EOM
6428 fn=d~
6429 rp='Where do you keep publicly executable scripts?'
6430 . ./getfile
6431 if $test "X$ansexp" != "X$scriptdirexp"; then
6432         installscript=''
6433 fi
6434 scriptdir="$ans"
6435 scriptdirexp="$ansexp"
6436 : Change installation prefix, if necessary.
6437 if $test X"$prefix" != X"$installprefix"; then
6438         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
6439 else
6440         installscript="$scriptdirexp"
6441 fi
6442
6443 $cat <<EOM
6444
6445 After $package is installed, you may wish to install various
6446 add-on modules and utilities.  Typically, these add-ons will
6447 be installed under $prefix with the rest
6448 of this package.  However, you may wish to install such add-ons
6449 elsewhere under a different prefix.
6450
6451 If you do not wish to put everything under a single prefix, that's
6452 ok.  You will be prompted for the individual locations; this siteprefix
6453 is only used to suggest the defaults.
6454
6455 The default should be fine for most people.
6456
6457 EOM
6458 fn=d~+
6459 rp='Installation prefix to use for add-on modules and utilities?'
6460 : XXX Here might be another good place for an installstyle setting.
6461 case "$siteprefix" in
6462 '') dflt=$prefix ;;
6463 *)  dflt=$siteprefix ;;
6464 esac
6465 . ./getfile
6466 oldsiteprefix=''
6467 case "$siteprefix" in
6468 '') ;;
6469 *)
6470         case "$ans" in
6471         "$prefix") ;;
6472         *) oldsiteprefix="$prefix";;
6473         esac
6474         ;;
6475 esac
6476 siteprefix="$ans"
6477 siteprefixexp="$ansexp"
6478
6479 : determine where site specific libraries go.
6480 : Usual default is /usr/local/lib/perl5/site_perl
6481 : The default "style" setting is made in installstyle.U
6482 : XXX No longer works with Prefixit stuff.
6483 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6484 case "$installstyle" in
6485 *lib/perl5*) dflt=$siteprefix/lib/site_$prog ;;
6486 *)       dflt=$siteprefix/lib/site_$prog ;;
6487 esac
6488 $cat <<EOM
6489
6490 The installation process will create a directory for
6491 site-specific extensions and modules.  Most users find it convenient
6492 to place all site-specific files in this directory rather than in the
6493 main distribution directory.
6494
6495 EOM
6496 fn=d~+
6497 rp='Pathname for the site-specific library files?'
6498 . ./getfile
6499 sitelib="$ans"
6500 sitelibexp="$ansexp"
6501 : Change installation prefix, if necessary.
6502 if $test X"$prefix" != X"$installprefix"; then
6503         installsitelib=`echo $sitelibexp | sed "s#^$prefix#$installprefix#"`
6504 else
6505         installsitelib="$sitelibexp"
6506 fi
6507
6508 : determine where site specific architecture-dependent libraries go.
6509 : sitelib  default is /usr/local/lib/perl5/site_perl/
6510 : sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
6511 : sitelib may have an optional trailing /share.
6512 tdflt=`echo $sitelib | $sed 's,/share$,,'`
6513 tdflt="$tdflt/$apiversion/$archname"
6514 set sitearch sitearch none
6515 eval $prefixit
6516 case "$sitearch" in
6517 '')     dflt="$tdflt" ;;
6518 *)      dflt="$sitearch" ;;
6519 esac
6520 $cat <<EOM
6521
6522 The installation process will also create a directory for
6523 architecture-dependent site-specific extensions and modules.
6524
6525 EOM
6526 fn=nd~+
6527 rp='Pathname for the site-specific architecture-dependent library files?'
6528 . ./getfile
6529 sitearch="$ans"
6530 sitearchexp="$ansexp"
6531 : Change installation prefix, if necessary.
6532 if $test X"$prefix" != X"$installprefix"; then
6533         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6534 else
6535         installsitearch="$sitearchexp"
6536 fi
6537
6538 cat <<EOM
6539
6540 Perl can be built to take advantage of long doubles which
6541 (if available) may give more accuracy and range for floating point
6542 numbers.  To do so, Configure must be run with -Duselongdouble.
6543
6544 If this doesn't make any sense to you, just accept the default 'n'.
6545 EOM
6546 case "$uselongdouble" in
6547 $define|true|[yY]*)     dflt='y';;
6548 *) dflt='n';;
6549 esac
6550 rp='Try to use long doubles if available?'
6551 . ./myread
6552 case "$ans" in
6553 y|Y)    val="$define"   ;;
6554 *)      val="$undef"    ;;
6555 esac
6556 set uselongdouble
6557 eval $setvar
6558
6559 case "$uselongdouble" in
6560 "$define"|true|[yY]*)
6561 : Look for a hint-file generated 'call-back-unit'.  If the
6562 : user has specified that long doubles should be used,
6563 : we may need to set or change some other defaults.
6564         if $test -f uselongdouble.cbu; then
6565                 echo "Your platform has some specific hints for long doubles, using them..."
6566                 . ./uselongdouble.cbu
6567         else
6568                 $cat <<EOM
6569 (Your platform doesn't have any specific hints for long doubles.)
6570 EOM
6571         fi
6572         ;;
6573 esac
6574
6575 cat <<EOM
6576
6577 Previous version of $package used the standard IO mechanisms as defined
6578 in <stdio.h>.  Versions 5.003_02 and later of perl allow alternate IO
6579 mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still
6580 the default.  This abstraction layer can use AT&T's sfio (if you already
6581 have sfio installed) or regular stdio.  Using PerlIO with sfio may cause
6582 problems with some extension modules.  Using PerlIO with stdio is safe,
6583 but it is slower than plain stdio and therefore is not the default.
6584
6585 If this doesn't make any sense to you, just accept the default 'n'.
6586 EOM
6587 case "$useperlio" in
6588 $define|true|[yY]*)     dflt='y';;
6589 *) dflt='n';;
6590 esac
6591 rp='Use the experimental PerlIO abstraction layer?'
6592 . ./myread
6593 case "$ans" in
6594 y|Y) 
6595         val="$define"
6596         ;;     
6597 *)      
6598         echo "Ok, doing things the stdio way"
6599         val="$undef"
6600         ;;
6601 esac
6602 set useperlio
6603 eval $setvar 
6604
6605 : Check how to convert floats to strings.
6606 if test "X$d_Gconvert" = X; then
6607         echo " "
6608         echo "Checking for an efficient way to convert floats to strings."
6609         $cat >try.c <<'EOP'
6610 #ifdef TRY_gconvert
6611 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
6612 char *myname = "gconvert";
6613 #endif
6614 #ifdef TRY_gcvt
6615 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
6616 char *myname = "gcvt";
6617 #endif
6618 #ifdef TRY_sprintf
6619 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
6620 char *myname = "sprintf";
6621 #endif
6622
6623 #include <stdio.h>
6624
6625 int
6626 checkit(expect, got)
6627 char *expect;
6628 char *got;
6629 {
6630     if (strcmp(expect, got)) {
6631                 printf("%s oddity:  Expected %s, got %s\n",
6632                         myname, expect, got);
6633                 exit(1);
6634         }
6635 }
6636
6637 int main()
6638
6639         char buf[64]; 
6640         buf[63] = '\0';
6641
6642         /* This must be 1st test on (which?) platform */
6643         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
6644         Gconvert(0.1, 8, 0, buf);
6645         checkit("0.1", buf);
6646
6647         Gconvert(1.0, 8, 0, buf); 
6648         checkit("1", buf);
6649
6650         Gconvert(0.0, 8, 0, buf); 
6651         checkit("0", buf);
6652
6653         Gconvert(-1.0, 8, 0, buf); 
6654         checkit("-1", buf);
6655
6656         /* Some Linux gcvt's give 1.e+5 here. */
6657         Gconvert(100000.0, 8, 0, buf); 
6658         checkit("100000", buf);
6659         
6660         /* Some Linux gcvt's give -1.e+5 here. */
6661         Gconvert(-100000.0, 8, 0, buf); 
6662         checkit("-100000", buf);
6663
6664         exit(0);
6665 }
6666 EOP
6667         case "$d_Gconvert" in
6668         gconvert*) xxx_list='gconvert gcvt sprintf' ;;
6669         gcvt*) xxx_list='gcvt gconvert sprintf' ;;
6670         sprintf*) xxx_list='sprintf gconvert gcvt' ;;
6671         *) xxx_list='gconvert gcvt sprintf' ;;
6672         esac
6673
6674         for xxx_convert in $xxx_list; do
6675                 echo "Trying $xxx_convert"
6676                 $rm -f try try$_o
6677                 set try -DTRY_$xxx_convert
6678                 if eval $compile; then
6679                         echo "$xxx_convert" found. >&4
6680                         if ./try; then
6681                                 echo "I'll use $xxx_convert to convert floats into a string." >&4
6682                                 break;
6683                         else
6684                                 echo "...But $xxx_convert didn't work as I expected."
6685                         fi
6686                 else
6687                         echo "$xxx_convert NOT found." >&4
6688                 fi
6689         done
6690                 
6691         case "$xxx_convert" in
6692         gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
6693         gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
6694         *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
6695         esac
6696 fi
6697
6698 : see if inttypes.h is available
6699 : we want a real compile instead of Inhdr because some systems
6700 : have an inttypes.h which includes non-existent headers
6701 echo " "
6702 $cat >try.c <<EOCP
6703 #include <inttypes.h>
6704 int main() {
6705         static int32_t foo32 = 0x12345678;
6706 }
6707 EOCP
6708 set try
6709 if eval $compile; then
6710         echo "<inttypes.h> found." >&4
6711         val="$define"
6712 else
6713         echo "<inttypes.h> NOT found." >&4
6714         val="$undef"
6715 fi
6716 $rm -f try.c try
6717 set i_inttypes
6718 eval $setvar
6719
6720 : check for int64_t
6721 case "$use64bits" in
6722 "$define" )
6723         echo " "
6724         echo $n "Checking to see if your system supports int64_t...$c" >&4
6725         $cat >try.c <<EOCP
6726 #include <sys/types.h>
6727 #$i_inttypes I_INTTYPES
6728 #ifdef I_INTTYPES
6729 #include <inttypes.h>
6730 #endif
6731 int64_t foo() { int64_t x; x = 7; return x; }
6732 EOCP
6733         if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6734                 val="$define"
6735                 echo " Yup, it does." >&4
6736         else
6737                 val="$undef"
6738                 echo " Nope, it doesn't." >&4
6739         fi
6740         $rm -f try.*
6741         ;;
6742 *)      val="$undef"
6743         ;;
6744 esac
6745 set d_int64t
6746 eval $setvar
6747
6748
6749 : check for lengths of integral types
6750 echo " "
6751 case "$intsize" in
6752 '')
6753         echo "Checking to see how big your integers are..." >&4
6754         $cat >intsize.c <<'EOCP'
6755 #include <stdio.h>
6756 int main()
6757 {
6758         printf("intsize=%d;\n", sizeof(int));
6759         printf("longsize=%d;\n", sizeof(long));
6760         printf("shortsize=%d;\n", sizeof(short));
6761         exit(0);
6762 }
6763 EOCP
6764         set intsize
6765         if eval $compile_ok && ./intsize > /dev/null; then
6766                 eval `./intsize`
6767                 echo "Your integers are $intsize bytes long."
6768                 echo "Your long integers are $longsize bytes long."
6769                 echo "Your short integers are $shortsize bytes long."
6770         else
6771                 $cat >&4 <<EOM
6772 !
6773 Help! I can't compile and run the intsize test program: please enlighten me!
6774 (This is probably a misconfiguration in your system or libraries, and
6775 you really ought to fix it.  Still, I'll try anyway.)
6776 !
6777 EOM
6778                 dflt=4
6779                 rp="What is the size of an integer (in bytes)?"
6780                 . ./myread
6781                 intsize="$ans"
6782                 dflt=$intsize
6783                 rp="What is the size of a long integer (in bytes)?"
6784                 . ./myread
6785                 longsize="$ans"
6786                 dflt=2
6787                 rp="What is the size of a short integer (in bytes)?"
6788                 . ./myread
6789                 shortsize="$ans"
6790         fi
6791         ;;
6792 esac
6793 $rm -f intsize intsize.*
6794
6795 : check for long long
6796 echo " "
6797 echo $n "Checking to see if your system supports long long...$c" >&4
6798 echo 'long long foo() { long long x; x = 7; return x; }' > try.c
6799 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
6800         val="$define"
6801         echo " Yup, it does." >&4
6802 else
6803         val="$undef"
6804         echo " Nope, it doesn't." >&4
6805 fi
6806 $rm try.*
6807 set d_longlong
6808 eval $setvar
6809
6810 : check for length of long long
6811 case "${d_longlong}${longlongsize}" in
6812 $define)
6813         echo " "
6814         $echo $n "Checking to see how big your long longs are...$c" >&4
6815         $cat >try.c <<'EOCP'
6816 #include <stdio.h>
6817 int main()
6818 {
6819         printf("%d\n", sizeof(long long));
6820 }
6821 EOCP
6822         set try
6823         if eval $compile_ok; then
6824                 longlongsize=`./try`
6825                 $echo " $longlongsize bytes." >&4
6826         else
6827                 dflt='8'
6828                 echo " "
6829                 echo "(I can't seem to compile the test program.  Guessing...)"
6830                 rp="What is the size of a long long (in bytes)?"
6831                 . ./myread
6832                 longlongsize="$ans"
6833         fi
6834         if $test "X$longsize" = "X$longlongsize"; then
6835                 echo "(That isn't any different from an ordinary long.)"
6836         fi      
6837         ;;
6838 esac
6839 $rm -f try.c try
6840
6841 echo " "
6842
6843 if $test X"$intsize" = X8 -o X"$longsize" = X8 -o X"$d_int64t" = X"$define" -o X"$d_longlong" = X"$define"; then
6844
6845 echo "Checking how to print 64-bit integers..." >&4
6846
6847 if $test X"$sPRId64" = X -a X"$intsize" = X8; then
6848         quad=int
6849         $cat >try.c <<'EOCP'
6850 #include <sys/types.h>
6851 #include <stdio.h>
6852 int main() {
6853   int q = 12345678901;
6854   printf("%ld\n", q);
6855 }
6856 EOCP
6857         set try
6858         if eval $compile; then
6859                 yyy=`./try$exe_ext`
6860                 case "$yyy" in
6861                 12345678901)
6862                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
6863                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIX64='"X"';
6864                         echo "We will use %d."
6865                         ;;
6866                 esac
6867         fi
6868 fi
6869
6870 if $test X"$sPRId64" = X -a X"$longsize" = X8; then
6871         quad=long
6872         $cat >try.c <<'EOCP'
6873 #include <sys/types.h>
6874 #include <stdio.h>
6875 int main() {
6876   long q = 12345678901;
6877   printf("%ld\n", q);
6878 }
6879 EOCP
6880         set try
6881         if eval $compile; then
6882                 yyy=`./try$exe_ext`
6883                 case "$yyy" in
6884                 12345678901)
6885                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
6886                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIX64='"lX"';
6887                         echo "We will use %ld."
6888                         ;;
6889                 esac
6890         fi
6891 fi
6892
6893 if $test X"$sPRId64" = X -a X"$i_inttypes.h" = X"$define" -a X"$d_int64t" = X"$define"; then
6894         quad=int64_t
6895         $cat >try.c <<'EOCP'
6896 #include <sys/types.h>
6897 #include <inttypes.h>
6898 #include <stdio.h>
6899 int main() {
6900   int64_t q = 12345678901;
6901   printf("%" PRId64 "\n", q);
6902 }
6903 EOCP
6904         set try
6905         if eval $compile; then
6906                 yyy=`./try$exe_ext`
6907                 case "$yyy" in
6908                 12345678901)
6909                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
6910                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIX64=PRIX64;
6911                         echo "We will use the C9X style."
6912                         ;;
6913                 esac
6914         fi
6915 fi
6916
6917 if $test X"$sPRId64" = X -a X"$d_longlong" = X"$define" -a X"$longlongsize" = X8; then
6918         quad="long long"
6919         $cat >try.c <<'EOCP'
6920 #include <sys/types.h>
6921 #include <stdio.h>
6922 int main() {
6923   long long q = 12345678901LL; /* AIX cc requires the LL prefix. */
6924   printf("%lld\n", q);
6925 }
6926 EOCP
6927         set try
6928         if eval $compile; then
6929                 yyy=`./try$exe_ext`
6930                 case "$yyy" in
6931                 12345678901)
6932                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
6933                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIX64='"llX"';
6934                         echo "We will use the %lld style."
6935                         ;;
6936                 esac
6937         fi
6938 fi
6939
6940 if $test X"$sPRId64" = X -a X"$quad" != X; then
6941         $cat >try.c <<EOCP
6942 #include <sys/types.h>
6943 #include <stdio.h>
6944 int main() {
6945   $quad q = 12345678901;
6946   printf("%Ld\n", q);
6947 }
6948 EOCP
6949         set try
6950         if eval $compile; then
6951                 yyy=`./try$exe_ext`
6952                 case "$yyy" in
6953                 12345678901)
6954                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
6955                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIX64='"LX"';
6956                         echo "We will use %lld."
6957                         ;;
6958                 esac
6959         fi
6960 fi
6961
6962 if $test X"$sPRId64" = X -a X"$quad" != X; then
6963         $cat >try.c <<EOCP
6964 #include <sys/types.h>
6965 #include <stdio.h>
6966 int main() {
6967   $quad q = 12345678901;
6968   printf("%qd\n", q);
6969 }
6970 EOCP
6971         set try
6972         if eval $compile; then
6973                 yyy=`./try$exe_ext`
6974                 case "$yyy" in
6975                 12345678901)
6976                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
6977                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIX64='"qX"';
6978                         echo "We will use %qd."
6979                         ;;
6980                 esac
6981         fi
6982 fi
6983
6984 if $test X"$sPRId64" = X; then
6985         echo "Cannot figure out how to print 64-bit integers." >&4
6986 fi
6987
6988 $rm -f try try.*
6989
6990 fi # intsize -o longsize -o d_int64t -o d_longlong
6991
6992 case "$sPRId64" in
6993 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
6994         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIX64="$undef"; 
6995         ;;
6996 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
6997         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIX64="$define"; 
6998         ;;
6999 esac
7000
7001 : check for length of double
7002 echo " "
7003 case "$doublesize" in
7004 '')
7005         $echo $n "Checking to see how big your double precision numbers are...$c" >&4
7006         $cat >try.c <<'EOCP'
7007 #include <stdio.h>
7008 int main()
7009 {
7010         printf("%d\n", sizeof(double));
7011 }
7012 EOCP
7013         set try
7014         if eval $compile_ok; then
7015                 doublesize=`./try`
7016                 $echo " $doublesize bytes." >&4
7017         else
7018                 dflt='8'
7019                 echo "(I can't seem to compile the test program.  Guessing...)"
7020                 rp="What is the size of a double precision number (in bytes)?"
7021                 . ./myread
7022                 doublesize="$ans"
7023         fi
7024         ;;
7025 esac
7026 $rm -f try.c try
7027
7028 : check for long doubles
7029 echo " "
7030 echo $n "Checking to see if your system supports long double...$c" >&4
7031 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c
7032 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7033         val="$define"
7034         echo " Yup, it does." >&4
7035 else
7036         val="$undef"
7037         echo " Nope, it doesn't." >&4
7038 fi
7039 $rm try.*
7040 set d_longdbl
7041 eval $setvar
7042
7043 : check for length of long double
7044 case "${d_longdbl}${longdblsize}" in
7045 $define)
7046         echo " "
7047         $echo $n "Checking to see how big your long doubles are...$c" >&4
7048         $cat >try.c <<'EOCP'
7049 #include <stdio.h>
7050 int main()
7051 {
7052         printf("%d\n", sizeof(long double));
7053 }
7054 EOCP
7055         set try
7056         if eval $compile; then
7057                 longdblsize=`./try`
7058                 $echo " $longdblsize bytes." >&4
7059         else
7060                 dflt='8'
7061                 echo " "
7062                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
7063                 rp="What is the size of a long double (in bytes)?"
7064                 . ./myread
7065                 longdblsize="$ans"
7066         fi
7067         if $test "X$doublesize" = "X$longdblsize"; then
7068                 echo "(That isn't any different from an ordinary double.)"
7069         fi      
7070         ;;
7071 esac
7072 $rm -f try.c try
7073
7074 echo " "
7075
7076 if $test X"$d_longdbl" = X"$define"; then
7077
7078 echo "Checking how to print long doubles..." >&4
7079
7080 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
7081         $cat >try.c <<'EOCP'
7082 #include <sys/types.h>
7083 #include <stdio.h>
7084 int main() {
7085   double d = 123.456;
7086   printf("%.3f\n", d);
7087 }
7088 EOCP
7089         set try
7090         if eval $compile; then
7091                 yyy=`./try$exe_ext`
7092                 case "$yyy" in
7093                 123.456)
7094                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
7095                         sPRIFldbl='"F"'; sPRIGldbl='"G"'; sPRIEldbl='"E"';
7096                         echo "We will use %f."
7097                         ;;
7098                 esac
7099         fi
7100 fi
7101
7102 if $test X"$sPRIfldbl" = X; then
7103         $cat >try.c <<'EOCP'
7104 #include <sys/types.h>
7105 #include <stdio.h>
7106 int main() {
7107   long double d = 123.456;
7108   printf("%.3llf\n", d);
7109 }
7110 EOCP
7111         set try
7112         if eval $compile; then
7113                 yyy=`./try$exe_ext`
7114                 case "$yyy" in
7115                 123.456)
7116                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
7117                         sPRIFldbl='"llF"'; sPRIGldbl='"llG"'; sPRIEldbl='"llE"';
7118                         echo "We will use %llf."
7119                         ;;
7120                 esac
7121         fi
7122 fi
7123
7124 if $test X"$sPRIfldbl" = X; then
7125         $cat >try.c <<'EOCP'
7126 #include <sys/types.h>
7127 #include <stdio.h>
7128 int main() {
7129   long double d = 123.456;
7130   printf("%.3Lf\n", d);
7131 }
7132 EOCP
7133         set try
7134         if eval $compile; then
7135                 yyy=`./try$exe_ext`
7136                 case "$yyy" in
7137                 123.456)
7138                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
7139                         sPRIFldbl='"LF"'; sPRIGldbl='"LG"'; sPRIEldbl='"LE"';
7140                         echo "We will use %Lf."
7141                         ;;
7142                 esac
7143         fi
7144 fi
7145
7146 if $test X"$sPRIfldbl" = X; then
7147         $cat >try.c <<'EOCP'
7148 #include <sys/types.h>
7149 #include <stdio.h>
7150 int main() {
7151   long double d = 123.456;
7152   printf("%.3lf\n", d);
7153 }
7154 EOCP
7155         set try
7156         if eval $compile; then
7157                 yyy=`./try$exe_ext`
7158                 case "$yyy" in
7159                 123.456)
7160                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
7161                         sPRIFldbl='"lF"'; sPRIGldbl='"lG"'; sPRIEldbl='"lE"';
7162                         echo "We will use %lf."
7163                         ;;
7164                 esac
7165         fi
7166 fi
7167
7168 if $test X"$sPRIfldbl" = X; then
7169         echo "Cannot figure out how to print long doubles." >&4
7170 fi
7171
7172 $rm -f try try.*
7173
7174 fi # d_longdbl
7175
7176 case "$sPRIfldbl" in
7177 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
7178         d_PRIFldbl="$undef"; d_PRIGldbl="$undef"; d_PRIEldbl="$undef"; 
7179         ;;
7180 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
7181         d_PRIFldbl="$define"; d_PRIGldbl="$define"; d_PRIEldbl="$define"; 
7182         ;;
7183 esac
7184
7185 : Initialize h_fcntl
7186 h_fcntl=false
7187
7188 : Initialize h_sysfile
7189 h_sysfile=false
7190
7191 : access call always available on UNIX
7192 set access d_access
7193 eval $inlibc
7194
7195 : locate the flags for 'access()'
7196 case "$d_access" in
7197 "$define")
7198         echo " "
7199         $cat >access.c <<'EOCP'
7200 #include <sys/types.h>
7201 #ifdef I_FCNTL
7202 #include <fcntl.h>
7203 #endif
7204 #ifdef I_SYS_FILE
7205 #include <sys/file.h>
7206 #endif
7207 #ifdef I_UNISTD
7208 #include <unistd.h>
7209 #endif
7210 int main() {
7211         exit(R_OK);
7212 }
7213 EOCP
7214         : check sys/file.h first, no particular reason here
7215         if $test `./findhdr sys/file.h` && \
7216                 $cc $cppflags -DI_SYS_FILE -o access access.c >/dev/null 2>&1 ; then
7217                 h_sysfile=true;
7218                 echo "<sys/file.h> defines the *_OK access constants." >&4
7219         elif $test `./findhdr fcntl.h` && \
7220                 $cc $cppflags -DI_FCNTL -o access access.c >/dev/null 2>&1 ; then
7221                 h_fcntl=true;
7222                 echo "<fcntl.h> defines the *_OK access constants." >&4
7223         elif $test `./findhdr unistd.h` && \
7224                 $cc $cppflags -DI_UNISTD -o access access.c >/dev/null 2>&1 ; then
7225                 echo "<unistd.h> defines the *_OK access constants." >&4
7226         else
7227                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
7228         fi
7229         ;;
7230 esac
7231 $rm -f access*
7232
7233 : see if accessx exists
7234 set accessx d_accessx
7235 eval $inlibc
7236
7237 : see if alarm exists
7238 set alarm d_alarm
7239 eval $inlibc
7240
7241 : see if atolf exists
7242 set atolf d_atolf
7243 eval $inlibc
7244
7245 : see if atoll exists
7246 set atoll d_atoll
7247 eval $inlibc
7248
7249 : Look for GNU-cc style attribute checking
7250 echo " "
7251 echo "Checking whether your compiler can handle __attribute__ ..." >&4
7252 $cat >attrib.c <<'EOCP'
7253 #include <stdio.h>
7254 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
7255 EOCP
7256 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
7257         if $contains 'warning' attrib.out >/dev/null 2>&1; then
7258                 echo "Your C compiler doesn't fully support __attribute__."
7259                 val="$undef"
7260         else
7261                 echo "Your C compiler supports __attribute__."
7262                 val="$define"
7263         fi
7264 else
7265         echo "Your C compiler doesn't seem to understand __attribute__ at all."
7266         val="$undef"
7267 fi
7268 set d_attribut
7269 eval $setvar
7270 $rm -f attrib*
7271
7272 : see if bcmp exists
7273 set bcmp d_bcmp
7274 eval $inlibc
7275
7276 : see if bcopy exists
7277 set bcopy d_bcopy
7278 eval $inlibc
7279
7280 : see if this is a unistd.h system
7281 set unistd.h i_unistd
7282 eval $inhdr
7283
7284 : see if getpgrp exists
7285 set getpgrp d_getpgrp
7286 eval $inlibc
7287
7288 case "$d_getpgrp" in
7289 "$define")
7290         echo " "
7291         echo "Checking to see which flavor of getpgrp is in use..."
7292         $cat >set.c <<EOP
7293 #$i_unistd I_UNISTD
7294 #include <sys/types.h>
7295 #ifdef I_UNISTD
7296 #  include <unistd.h>
7297 #endif
7298 int main()
7299 {
7300         if (getuid() == 0) {
7301                 printf("(I see you are running Configure as super-user...)\n");
7302                 setuid(1);
7303         }
7304 #ifdef TRY_BSD_PGRP
7305         if (getpgrp(1) == 0)
7306                 exit(0);
7307 #else
7308         if (getpgrp() > 0)
7309                 exit(0);
7310 #endif
7311         exit(1);
7312 }
7313 EOP
7314         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7315                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
7316                 val="$define"
7317         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7318                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
7319                 val="$undef"
7320         else
7321                 echo "I can't seem to compile and run the test program."
7322                 if ./usg; then
7323                         xxx="a USG one, i.e. you use getpgrp()."
7324                 else
7325                         # SVR4 systems can appear rather BSD-ish.
7326                         case "$i_unistd" in
7327                         $undef)
7328                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
7329                                 val="$define"
7330                                 ;;
7331                         $define)
7332                                 xxx="probably a USG one, i.e. you use getpgrp()."
7333                                 val="$undef"
7334                                 ;;
7335                         esac
7336                 fi
7337                 echo "Assuming your getpgrp is $xxx" >&4
7338         fi
7339         ;;
7340 *) val="$undef";;
7341 esac
7342 set d_bsdgetpgrp
7343 eval $setvar
7344 $rm -f set set.c
7345
7346 : see if setpgrp exists
7347 set setpgrp d_setpgrp
7348 eval $inlibc
7349
7350 case "$d_setpgrp" in
7351 "$define")
7352         echo " "
7353         echo "Checking to see which flavor of setpgrp is in use..."
7354         $cat >set.c <<EOP
7355 #$i_unistd I_UNISTD
7356 #include <sys/types.h>
7357 #ifdef I_UNISTD
7358 #  include <unistd.h>
7359 #endif
7360 int main()
7361 {
7362         if (getuid() == 0) {
7363                 printf("(I see you are running Configure as super-user...)\n");
7364                 setuid(1);
7365         }
7366 #ifdef TRY_BSD_PGRP
7367         if (-1 == setpgrp(1, 1))
7368                 exit(0);
7369 #else
7370         if (setpgrp() != -1)
7371                 exit(0);
7372 #endif
7373         exit(1);
7374 }
7375 EOP
7376         if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7377                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
7378                 val="$define"
7379         elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then
7380                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
7381                 val="$undef"
7382         else
7383                 echo "(I can't seem to compile and run the test program.)"
7384                 if ./usg; then
7385                         xxx="a USG one, i.e. you use setpgrp()."
7386                 else
7387                         # SVR4 systems can appear rather BSD-ish.
7388                         case "$i_unistd" in
7389                         $undef)
7390                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
7391                                 val="$define"
7392                                 ;;
7393                         $define)
7394                                 xxx="probably a USG one, i.e. you use setpgrp()."
7395                                 val="$undef"
7396                                 ;;
7397                         esac
7398                 fi
7399                 echo "Assuming your setpgrp is $xxx" >&4
7400         fi
7401         ;;
7402 *) val="$undef";;
7403 esac
7404 set d_bsdsetpgrp
7405 eval $setvar
7406 $rm -f set set.c
7407 : see if bzero exists
7408 set bzero d_bzero
7409 eval $inlibc
7410
7411 : see if signal is declared as pointer to function returning int or void
7412 echo " "
7413 xxx=`./findhdr signal.h`
7414 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
7415 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
7416         echo "You have int (*signal())() instead of void." >&4
7417         val="$undef"
7418 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
7419         echo "You have void (*signal())()." >&4
7420         val="$define"
7421 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
7422         echo "You have int (*signal())() instead of void." >&4
7423         val="$undef"
7424 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
7425         echo "You have void (*signal())()." >&4
7426         val="$define"
7427 else
7428         case "$d_voidsig" in
7429         '')
7430         echo "I can't determine whether signal handler returns void or int..." >&4
7431                 dflt=void
7432                 rp="What type does your signal handler return?"
7433                 . ./myread
7434                 case "$ans" in
7435                 v*) val="$define";;
7436                 *) val="$undef";;
7437                 esac;;
7438         "$define")
7439                 echo "As you already told me, signal handler returns void." >&4
7440                 val="$define"
7441                 ;;
7442         *)      echo "As you already told me, signal handler returns int." >&4
7443                 val="$undef"
7444                 ;;
7445         esac
7446 fi
7447 set d_voidsig
7448 eval $setvar
7449 case "$d_voidsig" in
7450 "$define") signal_t="void";;
7451 *) signal_t="int";;
7452 esac
7453 $rm -f $$.tmp
7454
7455 : check for ability to cast large floats to 32-bit ints.
7456 echo " "
7457 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
7458 if $test "$intsize" -ge 4; then
7459         xxx=int
7460 else
7461         xxx=long
7462 fi
7463 $cat >try.c <<EOCP
7464 #include <stdio.h>
7465 #include <sys/types.h>
7466 #include <signal.h>
7467 $signal_t blech(s) int s; { exit(3); }
7468 int main()
7469 {
7470         $xxx i32;
7471         double f, g;
7472         int result = 0;
7473         char str[16];
7474         signal(SIGFPE, blech);
7475
7476         /* Don't let compiler optimize the test away.  Store the number 
7477            in a writable string for gcc to pass to sscanf under HP/UX.
7478         */
7479         sprintf(str, "2147483647");
7480         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
7481         g = 10 * f;
7482         i32  = ($xxx) g;
7483
7484         /* x86 processors will probably give 0x8000 0000, which is a
7485        sign change.  We don't want that.  We want to mimic SPARC
7486            behavior here, which is to preserve the sign and give
7487            back 0x7fff ffff.
7488         */
7489         if (i32 != ($xxx) f)
7490                 result |= 1;
7491         exit(result);
7492 }
7493 EOCP
7494 set try
7495 if eval $compile_ok; then
7496         ./try
7497         yyy=$?
7498 else
7499         echo "(I can't seem to compile the test program--assuming it can't)"
7500         yyy=1
7501 fi
7502 case "$yyy" in
7503 0)      val="$define"
7504         echo "Yup, it can."
7505         ;;
7506 *)      val="$undef"
7507         echo "Nope, it can't."
7508         ;;
7509 esac
7510 set d_casti32
7511 eval $setvar
7512 $rm -f try try.*
7513
7514 : check for ability to cast negative floats to unsigned
7515 echo " "
7516 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
7517 $cat >try.c <<EOCP
7518 #include <stdio.h>
7519 #include <sys/types.h>
7520 #include <signal.h>
7521 $signal_t blech(s) int s; { exit(7); }
7522 $signal_t blech_in_list(s) int s; { exit(4); }
7523 unsigned long dummy_long(p) unsigned long p; { return p; }
7524 unsigned int dummy_int(p) unsigned int p; { return p; }
7525 unsigned short dummy_short(p) unsigned short p; { return p; }
7526 int main()
7527 {
7528         double f;
7529         unsigned long along;
7530         unsigned int aint;
7531         unsigned short ashort;
7532         int result = 0;
7533         char str[16];
7534         
7535         /* Frustrate gcc-2.7.2's optimizer which failed this test with
7536            a direct f = -123. assignment.  gcc-2.8.0 reportedly
7537            optimized the whole file away
7538         */
7539         /* Store the number in a writable string for gcc to pass to 
7540            sscanf under HP/UX.
7541         */
7542         sprintf(str, "-123");
7543         sscanf(str, "%lf", &f);  /* f = -123.; */
7544
7545         signal(SIGFPE, blech);
7546         along = (unsigned long)f;
7547         aint = (unsigned int)f;
7548         ashort = (unsigned short)f;
7549         if (along != (unsigned long)-123)
7550                 result |= 1;
7551         if (aint != (unsigned int)-123)
7552                 result |= 1;
7553         if (ashort != (unsigned short)-123)
7554                 result |= 1;
7555         sprintf(str, "1073741824.");
7556         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
7557         f = f + f;
7558         along = 0;
7559         along = (unsigned long)f;
7560         if (along != 0x80000000)
7561                 result |= 2;
7562         f -= 1.;
7563         along = 0;
7564         along = (unsigned long)f;
7565         if (along != 0x7fffffff)
7566                 result |= 1;
7567         f += 2.;
7568         along = 0;
7569         along = (unsigned long)f;
7570         if (along != 0x80000001)
7571                 result |= 2;
7572         if (result)
7573                 exit(result);
7574         signal(SIGFPE, blech_in_list);
7575         sprintf(str, "123.");
7576         sscanf(str, "%lf", &f);  /* f = 123.; */
7577         along = dummy_long((unsigned long)f);
7578         aint = dummy_int((unsigned int)f);
7579         ashort = dummy_short((unsigned short)f);
7580         if (along != (unsigned long)123)
7581                 result |= 4;
7582         if (aint != (unsigned int)123)
7583                 result |= 4;
7584         if (ashort != (unsigned short)123)
7585                 result |= 4;
7586         exit(result);
7587
7588 }
7589 EOCP
7590 set try
7591 if eval $compile_ok; then
7592         ./try
7593         castflags=$?
7594 else
7595         echo "(I can't seem to compile the test program--assuming it can't)"
7596         castflags=7
7597 fi
7598 case "$castflags" in
7599 0)      val="$define"
7600         echo "Yup, it can."
7601         ;;
7602 *)      val="$undef"
7603         echo "Nope, it can't."
7604         ;;
7605 esac
7606 set d_castneg
7607 eval $setvar
7608 $rm -f try.*
7609
7610 : see if vprintf exists
7611 echo " "
7612 if set vprintf val -f d_vprintf; eval $csym; $val; then
7613         echo 'vprintf() found.' >&4
7614         val="$define"
7615         $cat >vprintf.c <<'EOF'
7616 #include <varargs.h>
7617
7618 int main() { xxx("foo"); }
7619
7620 xxx(va_alist)
7621 va_dcl
7622 {
7623         va_list args;
7624         char buf[10];
7625
7626         va_start(args);
7627         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
7628 }
7629 EOF
7630         set vprintf
7631         if eval $compile && ./vprintf; then
7632                 echo "Your vsprintf() returns (int)." >&4
7633                 val2="$undef"
7634         else
7635                 echo "Your vsprintf() returns (char*)." >&4
7636                 val2="$define"
7637         fi
7638 else
7639         echo 'vprintf() NOT found.' >&4
7640                 val="$undef"
7641                 val2="$undef"
7642 fi
7643 set d_vprintf
7644 eval $setvar
7645 val=$val2
7646 set d_charvspr
7647 eval $setvar
7648
7649 : see if chown exists
7650 set chown d_chown
7651 eval $inlibc
7652
7653 : see if chroot exists
7654 set chroot d_chroot
7655 eval $inlibc
7656
7657 : see if chsize exists
7658 set chsize d_chsize
7659 eval $inlibc
7660
7661 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
7662 while $test $# -ge 2; do
7663         case "$1" in
7664         $define) echo "#include <$2>";;
7665         esac ;
7666     shift 2;
7667 done > try.c;
7668 echo "int main () { struct $struct foo; foo.$field = 0; }" >> try.c;
7669 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
7670         val="$define";
7671 else
7672         val="$undef";
7673 fi;
7674 set $varname;
7675 eval $setvar;
7676 $rm -f try.c try.o'
7677
7678 : see if this is a sys/uio.h system
7679 set sys/uio.h i_sysuio
7680 eval $inhdr
7681
7682 echo "Checking to see if your system supports struct iovec..." >&4
7683 set d_iovec_s iovec iov_base $i_sysuio sys/uio.h
7684 eval $hasfield
7685 case "$d_iovec_s" in
7686 "$define")      echo "Yup, it does." >&4
7687                 ;;
7688 *)              echo "Nope, it doesn't." >&4
7689                 ;;
7690 esac
7691
7692 socketlib=''
7693 sockethdr=''
7694 : see whether socket exists
7695 echo " "
7696 $echo $n "Hmm... $c" >&4
7697 if set socket val -f d_socket; eval $csym; $val; then
7698         echo "Looks like you have Berkeley networking support." >&4
7699         d_socket="$define"
7700         if set setsockopt val -f; eval $csym; $val; then
7701                 d_oldsock="$undef"
7702         else
7703                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
7704                 d_oldsock="$define"
7705         fi
7706 else
7707         if $contains socklib libc.list >/dev/null 2>&1; then
7708                 echo "Looks like you have Berkeley networking support." >&4
7709                 d_socket="$define"
7710                 : we will have to assume that it supports the 4.2 BSD interface
7711                 d_oldsock="$undef"
7712         else
7713                 echo "You don't have Berkeley networking in libc$_a..." >&4
7714                 if test "X$d_socket" = "X$define"; then
7715                    echo "...but you seem to believe that you have sockets." >&4
7716                 else
7717                         for net in net socket
7718                         do
7719                                 if test -f /usr/lib/lib$net$_a; then
7720                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
7721                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
7722                                         if $contains socket libc.list >/dev/null 2>&1; then
7723                                                 d_socket="$define"
7724                                                 socketlib="-l$net"
7725                                                 case "$net" in
7726                                                 net)
7727                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
7728                                                         sockethdr="-I/usr/netinclude"
7729                                                         ;;
7730                                                 esac
7731                                                 echo "Found Berkeley sockets interface in lib$net." >& 4 
7732                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
7733                                                         d_oldsock="$undef"
7734                                                 else
7735                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
7736                                                         d_oldsock="$define"
7737                                                 fi
7738                                                 break
7739                                         fi
7740                                 fi
7741                         done
7742                         if test "X$d_socket" != "X$define"; then
7743                            echo "or anywhere else I see." >&4
7744                            d_socket="$undef"
7745                            d_oldsock="$undef"
7746                         fi
7747                 fi
7748         fi
7749 fi
7750
7751 : see if socketpair exists
7752 set socketpair d_sockpair
7753 eval $inlibc
7754
7755
7756 echo " "
7757 echo "Checking the availability of certain socket constants..." >& 4
7758 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
7759         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
7760         $cat >try.c <<EOF
7761 #include <sys/types.h>
7762 #include <sys/socket.h>
7763 int main() {
7764     int i = $ENUM;
7765 }
7766 EOF
7767         val="$undef"
7768         set try; if eval $compile; then
7769                 val="$define"
7770         fi
7771         set d_${enum}; eval $setvar
7772         $rm -f try.c try
7773 done
7774
7775 set sendmsg d_sendmsg
7776 eval $inlibc
7777
7778 set recvmsg d_recvmsg
7779 eval $inlibc
7780
7781 echo " "
7782 $echo $n "Checking to see if your system supports struct msghdr...$c" >&4
7783 set d_msghdr_s msghdr msg_name define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7784 eval $hasfield
7785 case "$d_msghdr_s" in
7786 "$define")      echo "Yup, it does." >&4
7787                 ;;
7788 *)              echo "Nope, it doesn't." >&4
7789                 ;;
7790 esac
7791
7792 $echo $n "Checking to see if your system supports struct cmsghdr...$c" >&4
7793 set d_cmsghdr_s cmsghdr cmsg_len define sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
7794 eval $hasfield
7795 case "$d_cmsghdr_s" in
7796 "$define")      echo "Yup, it does." >&4
7797                 ;;
7798 *)              echo "Nope, it doesn't." >&4
7799                 ;;
7800 esac
7801
7802 : check for const keyword
7803 echo " "
7804 echo 'Checking to see if your C compiler knows about "const"...' >&4
7805 $cat >const.c <<'EOCP'
7806 typedef struct spug { int drokk; } spug;
7807 int main()
7808 {
7809         const char *foo;
7810         const spug y;
7811 }
7812 EOCP
7813 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
7814         val="$define"
7815         echo "Yup, it does."
7816 else
7817         val="$undef"
7818         echo "Nope, it doesn't."
7819 fi
7820 set d_const
7821 eval $setvar
7822
7823 : see if crypt exists
7824 echo " "
7825 if set crypt val -f d_crypt; eval $csym; $val; then
7826         echo 'crypt() found.' >&4
7827         val="$define"
7828         cryptlib=''
7829 else
7830         cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
7831         if $test -z "$cryptlib"; then
7832                 cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
7833         else
7834                 cryptlib=-lcrypt
7835         fi
7836         if $test -z "$cryptlib"; then
7837                 cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
7838         else
7839                 cryptlib=-lcrypt
7840         fi
7841         if $test -z "$cryptlib"; then
7842                 cryptlib=`./loc libcrypt$_a "" $libpth`
7843         else
7844                 cryptlib=-lcrypt
7845         fi
7846         if $test -z "$cryptlib"; then
7847                 echo 'crypt() NOT found.' >&4
7848                 val="$undef"
7849         else
7850                 val="$define"
7851         fi
7852 fi
7853 set d_crypt
7854 eval $setvar
7855
7856 : get csh whereabouts
7857 case "$csh" in
7858 'csh') val="$undef" ;;
7859 *) val="$define" ;;
7860 esac
7861 set d_csh
7862 eval $setvar
7863 : Respect a hint or command line value for full_csh.
7864 case "$full_csh" in
7865 '') full_csh=$csh ;;
7866 esac
7867
7868 : see if cuserid exists
7869 set cuserid d_cuserid
7870 eval $inlibc
7871
7872 : see if this is a limits.h system
7873 set limits.h i_limits
7874 eval $inhdr
7875
7876 : see if this is a float.h system
7877 set float.h i_float
7878 eval $inhdr
7879
7880 : See if number of significant digits in a double precision number is known
7881 echo " "
7882 $cat >dbl_dig.c <<EOM
7883 #$i_limits I_LIMITS
7884 #$i_float I_FLOAT
7885 #ifdef I_LIMITS
7886 #include <limits.h>
7887 #endif
7888 #ifdef I_FLOAT
7889 #include <float.h>
7890 #endif
7891 #ifdef DBL_DIG
7892 printf("Contains DBL_DIG");
7893 #endif
7894 EOM
7895 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
7896 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
7897         echo "DBL_DIG found." >&4
7898         val="$define"
7899 else
7900         echo "DBL_DIG NOT found." >&4
7901         val="$undef"
7902 fi
7903 $rm -f dbl_dig.?
7904 set d_dbl_dig
7905 eval $setvar
7906
7907 : see if difftime exists
7908 set difftime d_difftime
7909 eval $inlibc
7910
7911 : see if this is a dirent system
7912 echo " "
7913 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
7914         val="$define"
7915         echo "<dirent.h> found." >&4
7916 else
7917         val="$undef"
7918         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
7919                 echo "<sys/dir.h> found." >&4
7920                 echo " "
7921         else
7922                 xinc=`./findhdr sys/ndir.h`
7923         fi
7924         echo "<dirent.h> NOT found." >&4
7925 fi
7926 set i_dirent
7927 eval $setvar
7928
7929 : Look for type of directory structure.
7930 echo " "
7931 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7932
7933 case "$direntrytype" in
7934 ''|' ')
7935         case "$i_dirent" in
7936         $define) guess1='struct dirent' ;;
7937         *) guess1='struct direct'  ;;
7938         esac
7939         ;;
7940 *)      guess1="$direntrytype"
7941         ;;
7942 esac
7943
7944 case "$guess1" in
7945 'struct dirent') guess2='struct direct' ;;
7946 *) guess2='struct dirent' ;;
7947 esac
7948                 
7949 if $contains "$guess1" try.c >/dev/null 2>&1; then
7950         direntrytype="$guess1"
7951         echo "Your directory entries are $direntrytype." >&4
7952 elif $contains "$guess2" try.c >/dev/null 2>&1; then
7953         direntrytype="$guess2"
7954         echo "Your directory entries seem to be $direntrytype." >&4
7955 else
7956         echo "I don't recognize your system's directory entries." >&4
7957         rp="What type is used for directory entries on this system?"
7958         dflt="$guess1"
7959         . ./myread
7960         direntrytype="$ans"
7961 fi
7962 $rm -f try.c
7963
7964
7965 : see if the directory entry stores field length
7966 echo " "
7967 $cppstdin $cppflags $cppminus < "$xinc" > try.c
7968 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
7969         echo "Good, your directory entry keeps length information in d_namlen." >&4
7970         val="$define"
7971 else
7972         echo "Your directory entry does not know about the d_namlen field." >&4
7973         val="$undef"
7974 fi
7975 set d_dirnamlen
7976 eval $setvar
7977 $rm -f try.c
7978
7979 : see if dlerror exists
7980 xxx_runnm="$runnm"
7981 runnm=false
7982 set dlerror d_dlerror
7983 eval $inlibc
7984 runnm="$xxx_runnm"
7985
7986 : see if dlfcn is available
7987 set dlfcn.h i_dlfcn
7988 eval $inhdr
7989
7990 case "$usedl" in
7991 $define|y|true)
7992         $cat << EOM
7993
7994 On a few systems, the dynamically loaded modules that perl generates and uses
7995 will need a different extension than shared libs. The default will probably
7996 be appropriate.
7997
7998 EOM
7999         case "$dlext" in
8000         '')     dflt="$so" ;;
8001         *)      dflt="$dlext" ;;
8002         esac
8003         rp='What is the extension of dynamically loaded modules'
8004         . ./myread
8005         dlext="$ans"
8006         ;;
8007 *)
8008         dlext="none"
8009         ;;
8010 esac
8011
8012 : Check if dlsym need a leading underscore
8013 echo " "
8014 val="$undef"
8015
8016 case "$dlsrc" in
8017 dl_dlopen.xs)
8018         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
8019         $cat >dyna.c <<'EOM'
8020 fred () { }
8021 EOM
8022
8023 $cat >fred.c<<EOM
8024
8025 #include <stdio.h>
8026 #$i_dlfcn I_DLFCN
8027 #ifdef I_DLFCN
8028 #include <dlfcn.h>      /* the dynamic linker include file for Sunos/Solaris */
8029 #else
8030 #include <sys/types.h>
8031 #include <nlist.h>
8032 #include <link.h>
8033 #endif
8034
8035 extern int fred() ;
8036
8037 int main()
8038 {
8039     void * handle ;
8040     void * symbol ;
8041 #ifndef RTLD_LAZY
8042     int mode = 1 ;
8043 #else
8044     int mode = RTLD_LAZY ;
8045 #endif
8046     handle = dlopen("./dyna.$dlext", mode) ;
8047     if (handle == NULL) {
8048         printf ("1\n") ;
8049         fflush (stdout) ;
8050         exit(0);
8051     }
8052     symbol = dlsym(handle, "fred") ;
8053     if (symbol == NULL) {
8054         /* try putting a leading underscore */
8055         symbol = dlsym(handle, "_fred") ;
8056         if (symbol == NULL) {
8057             printf ("2\n") ;
8058             fflush (stdout) ;
8059             exit(0);
8060         }
8061         printf ("3\n") ;
8062     }
8063     else
8064         printf ("4\n") ;
8065     fflush (stdout) ;
8066     exit(0);
8067 }
8068 EOM
8069         : Call the object file tmp-dyna.o in case dlext=o.
8070         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
8071                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
8072                 $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
8073                 $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
8074                 xxx=`./fred`
8075                 case $xxx in
8076                 1)      echo "Test program failed using dlopen." >&4
8077                         echo "Perhaps you should not use dynamic loading." >&4;;
8078                 2)      echo "Test program failed using dlsym." >&4
8079                         echo "Perhaps you should not use dynamic loading." >&4;;
8080                 3)      echo "dlsym needs a leading underscore" >&4
8081                         val="$define" ;;
8082                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
8083                 esac
8084         else
8085                 echo "I can't compile and run the test program." >&4
8086                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
8087         fi
8088         ;;
8089 esac
8090                 
8091 $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.?
8092
8093 set d_dlsymun
8094 eval $setvar
8095
8096 hasproto='varname=$1; func=$2; shift; shift;
8097 while $test $# -ge 2; do
8098         case "$1" in
8099         $define) echo "#include <$2>";;
8100         esac ;
8101     shift 2;
8102 done > try.c;
8103 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
8104 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
8105         echo "$func() prototype found.";
8106         val="$define";
8107 else
8108         echo "$func() prototype NOT found.";
8109         val="$undef";
8110 fi;
8111 set $varname;
8112 eval $setvar;
8113 $rm -f try.c tryout.c'
8114
8115 : see if prototype for drand48 is available
8116 echo " "
8117 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
8118 eval $hasproto
8119
8120 : see if dup2 exists
8121 set dup2 d_dup2
8122 eval $inlibc
8123
8124 : see if eaccess exists
8125 set eaccess d_eaccess
8126 eval $inlibc
8127
8128 : see if endgrent exists
8129 set endgrent d_endgrent
8130 eval $inlibc
8131
8132 : see if endhostent exists
8133 set endhostent d_endhent
8134 eval $inlibc
8135
8136 : see if endnetent exists
8137 set endnetent d_endnent
8138 eval $inlibc
8139
8140 : see if endprotoent exists
8141 set endprotoent d_endpent
8142 eval $inlibc
8143
8144 : see if endpwent exists
8145 set endpwent d_endpwent
8146 eval $inlibc
8147
8148 : see if endservent exists
8149 set endservent d_endsent
8150 eval $inlibc
8151
8152 : see if endspent exists
8153 set endspent d_endspent
8154 eval $inlibc
8155
8156 : Locate the flags for 'open()'
8157 echo " "
8158 $cat >open3.c <<'EOCP'
8159 #include <sys/types.h>
8160 #ifdef I_FCNTL
8161 #include <fcntl.h>
8162 #endif
8163 #ifdef I_SYS_FILE
8164 #include <sys/file.h>
8165 #endif
8166 int main() {
8167         if(O_RDONLY);
8168 #ifdef O_TRUNC
8169         exit(0);
8170 #else
8171         exit(1);
8172 #endif
8173 }
8174 EOCP
8175 : check sys/file.h first to get FREAD on Sun
8176 if $test `./findhdr sys/file.h` && \
8177                 set open3 -DI_SYS_FILE && eval $compile; then
8178         h_sysfile=true;
8179         echo "<sys/file.h> defines the O_* constants..." >&4
8180         if ./open3; then
8181                 echo "and you have the 3 argument form of open()." >&4
8182                 val="$define"
8183         else
8184                 echo "but not the 3 argument form of open().  Oh, well." >&4
8185                 val="$undef"
8186         fi
8187 elif $test `./findhdr fcntl.h` && \
8188                 set open3 -DI_FCNTL && eval $compile; then
8189         h_fcntl=true;
8190         echo "<fcntl.h> defines the O_* constants..." >&4
8191         if ./open3; then
8192                 echo "and you have the 3 argument form of open()." >&4
8193                 val="$define"
8194         else
8195                 echo "but not the 3 argument form of open().  Oh, well." >&4
8196                 val="$undef"
8197         fi
8198 else
8199         val="$undef"
8200         echo "I can't find the O_* constant definitions!  You got problems." >&4
8201 fi
8202 set d_open3
8203 eval $setvar
8204 $rm -f open3*
8205
8206 : check for non-blocking I/O stuff
8207 case "$h_sysfile" in
8208 true) echo "#include <sys/file.h>" > head.c;;
8209 *)
8210         case "$h_fcntl" in
8211         true) echo "#include <fcntl.h>" > head.c;;
8212         *) echo "#include <sys/fcntl.h>" > head.c;;
8213         esac
8214         ;;
8215 esac
8216 echo " "
8217 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
8218 case "$o_nonblock" in
8219 '')
8220         $cat head.c > try.c
8221         $cat >>try.c <<'EOCP'
8222 int main() {
8223 #ifdef O_NONBLOCK
8224         printf("O_NONBLOCK\n");
8225         exit(0);
8226 #endif
8227 #ifdef O_NDELAY
8228         printf("O_NDELAY\n");
8229         exit(0);
8230 #endif
8231 #ifdef FNDELAY
8232         printf("FNDELAY\n");
8233         exit(0);
8234 #endif
8235         exit(0);
8236 }
8237 EOCP
8238         set try
8239         if eval $compile_ok; then
8240                 o_nonblock=`./try`
8241                 case "$o_nonblock" in
8242                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
8243                 *) echo "Seems like we can use $o_nonblock.";;
8244                 esac
8245         else
8246                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
8247         fi
8248         ;;
8249 *) echo "Using $hint value $o_nonblock.";;
8250 esac
8251 $rm -f try try.* .out core
8252
8253 echo " "
8254 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
8255 case "$eagain" in
8256 '')
8257         $cat head.c > try.c
8258         $cat >>try.c <<EOCP
8259 #include <errno.h>
8260 #include <sys/types.h>
8261 #include <signal.h>
8262 #define MY_O_NONBLOCK $o_nonblock
8263 #ifndef errno  /* XXX need better Configure test */
8264 extern int errno;
8265 #endif
8266 $signal_t blech(x) int x; { exit(3); }
8267 EOCP
8268         $cat >> try.c <<'EOCP'
8269 int main()
8270 {
8271         int pd[2];
8272         int pu[2];
8273         char buf[1];
8274         char string[100];
8275
8276         pipe(pd);       /* Down: child -> parent */
8277         pipe(pu);       /* Up: parent -> child */
8278         if (0 != fork()) {
8279                 int ret;
8280                 close(pd[1]);   /* Parent reads from pd[0] */
8281                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
8282                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
8283                         exit(1);
8284                 signal(SIGALRM, blech);
8285                 alarm(5);
8286                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
8287                         exit(2);
8288                 sprintf(string, "%d\n", ret);
8289                 write(2, string, strlen(string));
8290                 alarm(0);
8291 #ifdef EAGAIN
8292                 if (errno == EAGAIN) {
8293                         printf("EAGAIN\n");
8294                         goto ok;
8295                 }
8296 #endif
8297 #ifdef EWOULDBLOCK
8298                 if (errno == EWOULDBLOCK)
8299                         printf("EWOULDBLOCK\n");
8300 #endif
8301         ok:
8302                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
8303                 sleep(2);                               /* Give it time to close our pipe */
8304                 alarm(5);
8305                 ret = read(pd[0], buf, 1);      /* Should read EOF */
8306                 alarm(0);
8307                 sprintf(string, "%d\n", ret);
8308                 write(3, string, strlen(string));
8309                 exit(0);
8310         }
8311
8312         close(pd[0]);                   /* We write to pd[1] */
8313         close(pu[1]);                   /* We read from pu[0] */
8314         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
8315         close(pd[1]);                   /* Pipe pd is now fully closed! */
8316         exit(0);                                /* Bye bye, thank you for playing! */
8317 }
8318 EOCP
8319         set try
8320         if eval $compile_ok; then
8321                 echo "$startsh" >mtry
8322                 echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry
8323                 chmod +x mtry
8324                 ./mtry >/dev/null 2>&1
8325                 case $? in
8326                 0) eagain=`$cat try.out`;;
8327                 1) echo "Could not perform non-blocking setting!";;
8328                 2) echo "I did a successful read() for something that was not there!";;
8329                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
8330                 *) echo "Something terribly wrong happened during testing.";;
8331                 esac
8332                 rd_nodata=`$cat try.ret`
8333                 echo "A read() system call with no data present returns $rd_nodata."
8334                 case "$rd_nodata" in
8335                 0|-1) ;;
8336                 *)
8337                         echo "(That's peculiar, fixing that to be -1.)"
8338                         rd_nodata=-1
8339                         ;;
8340                 esac
8341                 case "$eagain" in
8342                 '')
8343                         echo "Forcing errno EAGAIN on read() with no data available."
8344                         eagain=EAGAIN
8345                         ;;
8346                 *)
8347                         echo "Your read() sets errno to $eagain when no data is available."
8348                         ;;
8349                 esac
8350                 status=`$cat try.err`
8351                 case "$status" in
8352                 0) echo "And it correctly returns 0 to signal EOF.";;
8353                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
8354                 *) echo "However, your read() returns '$status' on EOF??";;
8355                 esac
8356                 val="$define"
8357                 if test "$status" = "$rd_nodata"; then
8358                         echo "WARNING: you can't distinguish between EOF and no data!"
8359                         val="$undef"
8360                 fi
8361         else
8362                 echo "I can't compile the test program--assuming errno EAGAIN will do."
8363                 eagain=EAGAIN
8364         fi
8365         set d_eofnblk
8366         eval $setvar
8367         ;;
8368 *)
8369         echo "Using $hint value $eagain."
8370         echo "Your read() returns $rd_nodata when no data is present."
8371         case "$d_eofnblk" in
8372         "$define") echo "And you can see EOF because read() returns 0.";;
8373         "$undef") echo "But you can't see EOF status from read() returned value.";;
8374         *)
8375                 echo "(Assuming you can't see EOF status from read anyway.)"
8376                 d_eofnblk=$undef
8377                 ;;
8378         esac
8379         ;;
8380 esac
8381 $rm -f try try.* .out core head.c mtry
8382
8383 : see if fchmod exists
8384 set fchmod d_fchmod
8385 eval $inlibc
8386
8387 : see if fchown exists
8388 set fchown d_fchown
8389 eval $inlibc
8390
8391 : see if this is an fcntl system
8392 set fcntl d_fcntl
8393 eval $inlibc
8394
8395 : see if sys/select.h has to be included
8396 set sys/select.h i_sysselct
8397 eval $inhdr
8398
8399 : see if we should include time.h, sys/time.h, or both
8400 echo " "
8401 if test "X$timeincl" = X; then
8402         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
8403         $echo $n "I'm now running the test program...$c"
8404         $cat >try.c <<'EOCP'
8405 #include <sys/types.h>
8406 #ifdef I_TIME
8407 #include <time.h>
8408 #endif
8409 #ifdef I_SYSTIME
8410 #ifdef SYSTIMEKERNEL
8411 #define KERNEL
8412 #endif
8413 #include <sys/time.h>
8414 #endif
8415 #ifdef I_SYSSELECT
8416 #include <sys/select.h>
8417 #endif
8418 int main()
8419 {
8420         struct tm foo;
8421 #ifdef S_TIMEVAL
8422         struct timeval bar;
8423 #endif
8424 #ifdef S_TIMEZONE
8425         struct timezone tzp;
8426 #endif
8427         if (foo.tm_sec == foo.tm_sec)
8428                 exit(0);
8429 #ifdef S_TIMEVAL
8430         if (bar.tv_sec == bar.tv_sec)
8431                 exit(0);
8432 #endif
8433         exit(1);
8434 }
8435 EOCP
8436         flags=''
8437         for s_timezone in '-DS_TIMEZONE' ''; do
8438         sysselect=''
8439         for s_timeval in '-DS_TIMEVAL' ''; do
8440         for i_systimek in '' '-DSYSTIMEKERNEL'; do
8441         for i_time in '' '-DI_TIME'; do
8442         for i_systime in '-DI_SYSTIME' ''; do
8443                 case "$flags" in
8444                 '') $echo $n ".$c"
8445                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
8446                         if eval $compile; then
8447                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
8448                                 shift
8449                                 flags="$*"
8450                                 echo " "
8451                                 $echo $n "Succeeded with $flags$c"
8452                         fi
8453                         ;;
8454                 esac
8455         done
8456         done
8457         done
8458         done
8459         done
8460         timeincl=''
8461         echo " "
8462         case "$flags" in
8463         *SYSTIMEKERNEL*) i_systimek="$define"
8464                 timeincl=`./findhdr sys/time.h`
8465                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
8466         *) i_systimek="$undef";;
8467         esac
8468         case "$flags" in
8469         *I_TIME*) i_time="$define"
8470                 timeincl=`./findhdr time.h`" $timeincl"
8471                 echo "We'll include <time.h>." >&4;;
8472         *) i_time="$undef";;
8473         esac
8474         case "$flags" in
8475         *I_SYSTIME*) i_systime="$define"
8476                 timeincl=`./findhdr sys/time.h`" $timeincl"
8477                 echo "We'll include <sys/time.h>." >&4;;
8478         *) i_systime="$undef";;
8479         esac
8480         $rm -f try.c try
8481 fi
8482
8483 : check for fd_set items
8484 $cat <<EOM
8485
8486 Checking to see how well your C compiler handles fd_set and friends ...
8487 EOM
8488 $cat >fd_set.c <<EOCP
8489 #$i_systime I_SYS_TIME
8490 #$i_sysselct I_SYS_SELECT
8491 #$d_socket HAS_SOCKET
8492 #include <sys/types.h>
8493 #ifdef HAS_SOCKET
8494 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
8495 #endif
8496 #ifdef I_SYS_TIME
8497 #include <sys/time.h>
8498 #endif
8499 #ifdef I_SYS_SELECT
8500 #include <sys/select.h>
8501 #endif
8502 int main() {
8503         fd_set fds;
8504
8505 #ifdef TRYBITS
8506         if(fds.fds_bits);
8507 #endif
8508
8509 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
8510         exit(0);
8511 #else
8512         exit(1);
8513 #endif
8514 }
8515 EOCP
8516 set fd_set -DTRYBITS
8517 if eval $compile; then
8518         d_fds_bits="$define"
8519         d_fd_set="$define"
8520         echo "Well, your system knows about the normal fd_set typedef..." >&4
8521         if ./fd_set; then
8522                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
8523                 d_fd_macros="$define"
8524         else
8525                 $cat >&4 <<'EOM'
8526 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
8527 EOM
8528                 d_fd_macros="$undef"
8529         fi
8530 else
8531         $cat <<'EOM'
8532 Hmm, your compiler has some difficulty with fd_set.  Checking further...
8533 EOM
8534         set fd_set
8535         if eval $compile; then
8536                 d_fds_bits="$undef"
8537                 d_fd_set="$define"
8538                 echo "Well, your system has some sort of fd_set available..." >&4
8539                 if ./fd_set; then
8540                         echo "and you have the normal fd_set macros." >&4
8541                         d_fd_macros="$define"
8542                 else
8543                         $cat <<'EOM'
8544 but not the normal fd_set macros!  Gross!  More work for me...
8545 EOM
8546                         d_fd_macros="$undef"
8547                 fi
8548         else
8549         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
8550                 d_fd_set="$undef"
8551                 d_fds_bits="$undef"
8552                 d_fd_macros="$undef"
8553         fi
8554 fi
8555 $rm -f fd_set*
8556
8557 : see if fgetpos exists
8558 set fgetpos d_fgetpos
8559 eval $inlibc
8560
8561 : see if flock exists
8562 set flock d_flock
8563 eval $inlibc
8564
8565 : see if fork exists
8566 set fork d_fork
8567 eval $inlibc
8568
8569 : see if pathconf exists
8570 set pathconf d_pathconf
8571 eval $inlibc
8572
8573 : see if fpathconf exists
8574 set fpathconf d_fpathconf
8575 eval $inlibc
8576
8577
8578 : see if llseek exists
8579 set llseek d_llseek
8580 eval $inlibc
8581
8582 : check for off64_t
8583 echo " "
8584 echo $n "Checking to see if your system supports off64_t...$c" >&4
8585 $cat >try.c <<EOCP
8586 #include <sys/types.h>
8587 #include <unistd.h>
8588 off64_t foo() { off64_t x; x = 7; return x; }'
8589 EOCP
8590 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8591         val="$define"
8592         echo " Yup, it does." >&4
8593 else
8594         val="$undef"
8595         echo " Nope, it doesn't." >&4
8596 fi
8597 $rm -f try.*
8598 set d_off64_t
8599 eval $setvar
8600
8601 : check for fpos64_t
8602 echo " "
8603 echo $n "Checking to see if your system supports fpos64_t...$c" >&4
8604 $cat >try.c <<EOCP
8605 #include <sys/stdio.h>
8606 fpos64_t foo() { fpos64_t x; x = 7; return x; }'
8607 EOCP
8608 if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then
8609         val="$define"
8610         echo " Yup, it does." >&4
8611 else
8612         val="$undef"
8613         echo " Nope, it doesn't." >&4
8614 fi
8615 $rm -f try.*
8616 set d_fpos64_t
8617 eval $setvar
8618
8619 : see if fseeko exists
8620 set fseeko d_fseeko
8621 eval $inlibc
8622
8623 : see if fsetpos exists
8624 set fsetpos d_fsetpos
8625 eval $inlibc
8626
8627 : see if this is a sys/param system
8628 set sys/param.h i_sysparam
8629 eval $inhdr
8630
8631 : see if this is a sys/mount.h system
8632 set sys/mount.h i_sysmount
8633 eval $inhdr
8634
8635
8636 : see if statfs exists
8637 set statfs d_statfs
8638 eval $inlibc
8639
8640 : see if fstatfs exists
8641 set fstatfs d_fstatfs
8642 eval $inlibc
8643
8644 : see if statfs knows about mount flags
8645 set d_statfsflags statfs f_flags $i_sysparam sys/param.h $i_sysmount sys/mount.h
8646 eval $hasfield
8647
8648
8649 : see if statvfs exists
8650 set statvfs d_statvfs
8651 eval $inlibc
8652
8653 : see if fstatvfs exists
8654 set fstatvfs d_fstatvfs
8655 eval $inlibc
8656
8657
8658 : see if ftello exists
8659 set ftello d_ftello
8660 eval $inlibc
8661
8662 : see if getgrent exists
8663 set getgrent d_getgrent
8664 eval $inlibc
8665
8666 : see if gethostbyaddr exists
8667 set gethostbyaddr d_gethbyaddr
8668 eval $inlibc
8669
8670 : see if gethostbyname exists
8671 set gethostbyname d_gethbyname
8672 eval $inlibc
8673
8674 : see if gethostent exists
8675 set gethostent d_gethent
8676 eval $inlibc
8677
8678 : see how we will look up host name
8679 echo " "
8680 call=''
8681 if set gethostname val -f d_gethname; eval $csym; $val; then
8682         echo 'gethostname() found.' >&4
8683         d_gethname="$define"
8684         call=gethostname
8685 fi
8686 if set uname val -f d_uname; eval $csym; $val; then
8687         if ./xenix; then
8688                 $cat <<'EOM'
8689 uname() was found, but you're running xenix, and older versions of xenix
8690 have a broken uname(). If you don't really know whether your xenix is old
8691 enough to have a broken system call, use the default answer.
8692
8693 EOM
8694                 dflt=y
8695                 case "$d_uname" in
8696                 "$define") dflt=n;;
8697                 esac
8698                 rp='Is your uname() broken?'
8699                 . ./myread
8700                 case "$ans" in
8701                 n*) d_uname="$define"; call=uname;;
8702                 esac
8703         else
8704                 echo 'uname() found.' >&4
8705                 d_uname="$define"
8706                 case "$call" in
8707                 '') call=uname ;;
8708                 esac
8709         fi
8710 fi
8711 case "$d_gethname" in
8712 '') d_gethname="$undef";;
8713 esac
8714 case "$d_uname" in
8715 '') d_uname="$undef";;
8716 esac
8717 case "$d_uname$d_gethname" in
8718 *define*)
8719         dflt=n
8720         cat <<EOM
8721  
8722 Every now and then someone has a $call() that lies about the hostname
8723 but can't be fixed for political or economic reasons.  If you wish, I can
8724 pretend $call() isn't there and maybe compute hostname at run-time
8725 thanks to the '$phostname' command.
8726
8727 EOM
8728         rp="Shall I ignore $call() from now on?"
8729         . ./myread
8730         case "$ans" in
8731         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
8732         esac;;
8733 esac
8734 case "$phostname" in
8735 '') aphostname='';;
8736 *) case "$aphostname" in
8737         /*) ;;
8738         *) set X $phostname
8739                 shift
8740                 file=$1
8741                 shift
8742                 file=`./loc $file $file $pth`
8743                 aphostname=`echo $file $*`
8744                 ;;
8745         esac
8746         ;;
8747 esac
8748 case "$d_uname$d_gethname" in
8749 *define*) ;;
8750 *)
8751         case "$phostname" in
8752         '')
8753                 echo "There will be no way for $package to get your hostname." >&4;;
8754         *)
8755         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
8756                 ;;
8757         esac;;
8758 esac
8759 case "$d_phostname" in
8760 '') d_phostname="$undef";;
8761 esac
8762
8763 : see if this is a netdb.h system
8764 set netdb.h i_netdb
8765 eval $inhdr
8766
8767 : see if prototypes for various gethostxxx netdb.h functions are available
8768 echo " "
8769 set d_gethostprotos gethostent $i_netdb netdb.h
8770 eval $hasproto
8771
8772 : see if getlogin exists
8773 set getlogin d_getlogin
8774 eval $inlibc
8775
8776 : see if getmntent exists
8777 set getmntent d_getmntent
8778 eval $inlibc
8779
8780 : see if getnetbyaddr exists
8781 set getnetbyaddr d_getnbyaddr
8782 eval $inlibc
8783
8784 : see if getnetbyname exists
8785 set getnetbyname d_getnbyname
8786 eval $inlibc
8787
8788 : see if getnetent exists
8789 set getnetent d_getnent
8790 eval $inlibc
8791
8792 : see if prototypes for various getnetxxx netdb.h functions are available
8793 echo " "
8794 set d_getnetprotos getnetent $i_netdb netdb.h
8795 eval $hasproto
8796
8797
8798 : see if getprotobyname exists
8799 set getprotobyname d_getpbyname
8800 eval $inlibc
8801
8802 : see if getprotobynumber exists
8803 set getprotobynumber d_getpbynumber
8804 eval $inlibc
8805
8806 : see if getprotoent exists
8807 set getprotoent d_getpent
8808 eval $inlibc
8809
8810 : see if getpgid exists
8811 set getpgid d_getpgid
8812 eval $inlibc
8813
8814 : see if getpgrp2 exists
8815 set getpgrp2 d_getpgrp2
8816 eval $inlibc
8817
8818 : see if getppid exists
8819 set getppid d_getppid
8820 eval $inlibc
8821
8822 : see if getpriority exists
8823 set getpriority d_getprior
8824 eval $inlibc
8825
8826 : see if prototypes for various getprotoxxx netdb.h functions are available
8827 echo " "
8828 set d_getprotoprotos getprotoent $i_netdb netdb.h
8829 eval $hasproto
8830
8831 : see if getpwent exists
8832 set getpwent d_getpwent
8833 eval $inlibc
8834
8835
8836 : see if getservbyname exists
8837 set getservbyname d_getsbyname
8838 eval $inlibc
8839
8840 : see if getservbyport exists
8841 set getservbyport d_getsbyport
8842 eval $inlibc
8843
8844 : see if getservent exists
8845 set getservent d_getsent
8846 eval $inlibc
8847
8848 : see if prototypes for various getservxxx netdb.h functions are available
8849 echo " "
8850 set d_getservprotos getservent $i_netdb netdb.h
8851 eval $hasproto
8852
8853 : see if getspent exists
8854 set getspent d_getspent
8855 eval $inlibc
8856
8857 : see if getspnam exists
8858 set getspnam d_getspnam
8859 eval $inlibc
8860
8861 : see if gettimeofday or ftime exists
8862 set gettimeofday d_gettimeod
8863 eval $inlibc
8864 case "$d_gettimeod" in
8865 "$undef")
8866         set ftime d_ftime 
8867         eval $inlibc
8868         ;;
8869 *)
8870         val="$undef"; set d_ftime; eval $setvar
8871         ;;
8872 esac
8873 case "$d_gettimeod$d_ftime" in
8874 "$undef$undef")
8875         echo " "
8876         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
8877         ;;
8878 esac
8879
8880 : see if this is an grp system
8881 set grp.h i_grp
8882 eval $inhdr
8883
8884 case "$i_grp" in
8885 $define)
8886         xxx=`./findhdr grp.h`
8887         $cppstdin $cppflags $cppminus < $xxx >$$.h
8888
8889         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
8890                 val="$define"
8891         else
8892                 val="$undef"
8893         fi
8894         set d_grpasswd
8895         eval $setvar
8896
8897         $rm -f $$.h
8898         ;;
8899 *)
8900         val="$undef";
8901         set d_grpasswd; eval $setvar
8902         ;;
8903 esac
8904
8905 : see if hasmntopt exists
8906 set hasmntopt d_hasmntopt
8907 eval $inlibc
8908
8909 : see if this is a netinet/in.h or sys/in.h system
8910 set netinet/in.h i_niin sys/in.h i_sysin
8911 eval $inhdr
8912
8913 : see if arpa/inet.h has to be included
8914 set arpa/inet.h i_arpainet
8915 eval $inhdr
8916
8917 : see if htonl --and friends-- exists
8918 val=''
8919 set htonl val
8920 eval $inlibc
8921
8922 : Maybe they are macros.
8923 case "$val" in
8924 $undef)
8925         $cat >htonl.c <<EOM
8926 #include <stdio.h>
8927 #include <sys/types.h>
8928 #$i_niin I_NETINET_IN
8929 #$i_sysin I_SYS_IN
8930 #$i_arpainet I_ARPA_INET
8931 #ifdef I_NETINET_IN
8932 #include <netinet/in.h>
8933 #endif
8934 #ifdef I_SYS_IN
8935 #include <sys/in.h>
8936 #endif
8937 #ifdef I_ARPA_INET
8938 #include <arpa/inet.h>
8939 #endif
8940 #ifdef htonl
8941 printf("Defined as a macro.");
8942 #endif
8943 EOM
8944         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
8945         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
8946                 val="$define"
8947                 echo "But it seems to be defined as a macro." >&4
8948         fi
8949         $rm -f htonl.?
8950         ;;
8951 esac
8952 set d_htonl
8953 eval $setvar
8954
8955 : see which of string.h or strings.h is needed
8956 echo " "
8957 strings=`./findhdr string.h`
8958 if $test "$strings" && $test -r "$strings"; then
8959         echo "Using <string.h> instead of <strings.h>." >&4
8960         val="$define"
8961 else
8962         val="$undef"
8963         strings=`./findhdr strings.h`
8964         if $test "$strings" && $test -r "$strings"; then
8965                 echo "Using <strings.h> instead of <string.h>." >&4
8966         else
8967                 echo "No string header found -- You'll surely have problems." >&4
8968         fi
8969 fi
8970 set i_string
8971 eval $setvar
8972 case "$i_string" in
8973 "$undef") strings=`./findhdr strings.h`;;
8974 *)        strings=`./findhdr string.h`;;
8975 esac
8976
8977 : index or strchr
8978 echo " "
8979 if set index val -f; eval $csym; $val; then
8980         if set strchr val -f d_strchr; eval $csym; $val; then
8981                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
8982                         val="$define"
8983                         vali="$undef"
8984                         echo "strchr() found." >&4
8985                 else
8986                         val="$undef"
8987                         vali="$define"
8988                         echo "index() found." >&4
8989                 fi
8990         else
8991                 val="$undef"
8992                 vali="$define"
8993                 echo "index() found." >&4
8994         fi
8995 else
8996         if set strchr val -f d_strchr; eval $csym; $val; then
8997                 val="$define"
8998                 vali="$undef"
8999                 echo "strchr() found." >&4
9000         else
9001                 echo "No index() or strchr() found!" >&4
9002                 val="$undef"
9003                 vali="$undef"
9004         fi
9005 fi
9006 set d_strchr; eval $setvar
9007 val="$vali"
9008 set d_index; eval $setvar
9009
9010 : check whether inet_aton exists
9011 set inet_aton d_inetaton
9012 eval $inlibc
9013
9014 : Look for isascii
9015 echo " "
9016 $cat >isascii.c <<'EOCP'
9017 #include <stdio.h>
9018 #include <ctype.h>
9019 int main() {
9020         int c = 'A';
9021         if (isascii(c))
9022                 exit(0);
9023         else
9024                 exit(1);
9025 }
9026 EOCP
9027 set isascii
9028 if eval $compile; then
9029         echo "isascii() found." >&4
9030         val="$define"
9031 else
9032         echo "isascii() NOT found." >&4
9033         val="$undef"
9034 fi
9035 set d_isascii
9036 eval $setvar
9037 $rm -f isascii*
9038
9039 : see if killpg exists
9040 set killpg d_killpg
9041 eval $inlibc
9042
9043 : see if lchown exists
9044 echo " "
9045 $cat > try.c <<'EOCP'
9046 /* System header to define __stub macros and hopefully few prototypes,
9047     which can conflict with char lchown(); below.  */
9048 #include <assert.h>
9049 /* Override any gcc2 internal prototype to avoid an error.  */
9050 /* We use char because int might match the return type of a gcc2
9051    builtin and then its argument prototype would still apply.  */
9052 char lchown();
9053 int main() {
9054     /*  The GNU C library defines this for functions which it implements
9055         to always fail with ENOSYS.  Some functions are actually named
9056         something starting with __ and the normal name is an alias.  */
9057 #if defined (__stub_lchown) || defined (__stub___lchown)
9058 choke me
9059 #else
9060 lchown();
9061 #endif
9062 ; return 0; }
9063 EOCP
9064 set try
9065 if eval $compile; then
9066     $echo "lchown() found." >&4
9067     val="$define"
9068 else
9069     $echo "lchown() NOT found." >&4
9070     val="$undef"
9071 fi
9072 set d_lchown
9073 eval $setvar
9074
9075 : See if number of significant digits in a double precision number is known
9076 echo " "
9077 $cat >ldbl_dig.c <<EOM
9078 #$i_limits I_LIMITS
9079 #$i_float I_FLOAT
9080 #ifdef I_LIMITS
9081 #include <limits.h>
9082 #endif
9083 #ifdef I_FLOAT
9084 #include <float.h>
9085 #endif
9086 #ifdef LDBL_DIG
9087 printf("Contains LDBL_DIG");
9088 #endif
9089 EOM
9090 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
9091 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
9092         echo "LDBL_DIG found." >&4
9093         val="$define"
9094 else
9095         echo "LDBL_DIG NOT found." >&4
9096         val="$undef"
9097 fi
9098 $rm -f ldbl_dig.?
9099 set d_ldbl_dig
9100 eval $setvar
9101
9102 : see if link exists
9103 set link d_link
9104 eval $inlibc
9105
9106 : see if localeconv exists
9107 set localeconv d_locconv
9108 eval $inlibc
9109
9110 : see if lockf exists
9111 set lockf d_lockf
9112 eval $inlibc
9113
9114 : see if lstat exists
9115 set lstat d_lstat
9116 eval $inlibc
9117
9118 : see if madvise exists
9119 set madvise d_madvise
9120 eval $inlibc
9121
9122 : see if mblen exists
9123 set mblen d_mblen
9124 eval $inlibc
9125
9126 : see if mbstowcs exists
9127 set mbstowcs d_mbstowcs
9128 eval $inlibc
9129
9130 : see if mbtowc exists
9131 set mbtowc d_mbtowc
9132 eval $inlibc
9133
9134 : see if memchr exists
9135 set memchr d_memchr
9136 eval $inlibc
9137
9138 : see if memcmp exists
9139 set memcmp d_memcmp
9140 eval $inlibc
9141
9142 : see if memcpy exists
9143 set memcpy d_memcpy
9144 eval $inlibc
9145
9146 : see if memmove exists
9147 set memmove d_memmove
9148 eval $inlibc
9149
9150 : see if memset exists
9151 set memset d_memset
9152 eval $inlibc
9153
9154 : see if mkdir exists
9155 set mkdir d_mkdir
9156 eval $inlibc
9157
9158 : see if mkfifo exists
9159 set mkfifo d_mkfifo
9160 eval $inlibc
9161
9162 : see if mktime exists
9163 set mktime d_mktime
9164 eval $inlibc
9165
9166 : see if this is a sys/mman.h system
9167 set sys/mman.h i_sysmman
9168 eval $inhdr
9169
9170 : see if mmap exists
9171 set mmap d_mmap
9172 eval $inlibc
9173 : see what shmat returns
9174 : default to something harmless
9175 mmaptype='void *'
9176 case "$i_sysmman$d_mmap" in
9177 "$define$define")
9178         $cat >mmap.c <<'END'
9179 #include <sys/mman.h>
9180 void *mmap();
9181 END
9182         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
9183                 mmaptype='void *'
9184         else
9185                 mmaptype='caddr_t'
9186         fi
9187         echo "and it returns ($mmaptype)." >&4
9188         ;;
9189 esac
9190
9191
9192
9193 : see if mprotect exists
9194 set mprotect d_mprotect
9195 eval $inlibc
9196
9197 : see if msgctl exists
9198 set msgctl d_msgctl
9199 eval $inlibc
9200
9201 : see if msgget exists
9202 set msgget d_msgget
9203 eval $inlibc
9204
9205 : see if msgsnd exists
9206 set msgsnd d_msgsnd
9207 eval $inlibc
9208
9209 : see if msgrcv exists
9210 set msgrcv d_msgrcv
9211 eval $inlibc
9212
9213 : see how much of the 'msg*(2)' library is present.
9214 h_msg=true
9215 echo " "
9216 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
9217 *"$undef"*) h_msg=false;;
9218 esac
9219 case "$osname" in
9220 freebsd)
9221     case "`ipcs 2>&1`" in
9222     "SVID messages"*"not configured"*)
9223         echo "Your $osname does not have the msg*(2) configured." >&4
9224         h_msg=false
9225         val="$undef"
9226         set msgctl d_msgctl
9227         eval $setvar
9228         set msgget d_msgget
9229         eval $setvar
9230         set msgsnd d_msgsnd
9231         eval $setvar
9232         set msgrcv d_msgrcv
9233         eval $setvar
9234         ;;
9235     esac
9236     ;;
9237 esac
9238 : we could also check for sys/ipc.h ...
9239 if $h_msg && $test `./findhdr sys/msg.h`; then
9240         echo "You have the full msg*(2) library." >&4
9241         val="$define"
9242 else
9243         echo "You don't have the full msg*(2) library." >&4
9244         val="$undef"
9245 fi
9246 set d_msg
9247 eval $setvar
9248
9249 : see if msync exists
9250 set msync d_msync
9251 eval $inlibc
9252
9253 : see if munmap exists
9254 set munmap d_munmap
9255 eval $inlibc
9256
9257 : see if nice exists
9258 set nice d_nice
9259 eval $inlibc
9260
9261 : see if POSIX threads are available
9262 set pthread.h i_pthread
9263 eval $inhdr
9264
9265
9266
9267
9268 : how to create joinable pthreads
9269 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
9270         echo " "
9271         echo "Checking what constant to use for creating joinable pthreads..." >&4 
9272         $cat >try.c <<'EOCP'
9273 #include <pthread.h>
9274 int main() {
9275     int detachstate = JOINABLE;
9276 }
9277 EOCP
9278         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
9279         if eval $compile; then
9280                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
9281                 val="$undef" # Yes, undef.
9282                 set d_old_pthread_create_joinable
9283                 eval $setvar
9284                 val=""
9285                 set old_pthread_create_joinable
9286                 eval $setvar
9287         else
9288                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
9289                 if eval $compile; then
9290                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
9291                         val="$define"
9292                         set d_old_pthread_create_joinable
9293                         eval $setvar
9294                         val=PTHREAD_CREATE_UNDETACHED
9295                         set old_pthread_create_joinable
9296                         eval $setvar
9297                 else            
9298                         set try -DJOINABLE=__UNDETACHED
9299                         if eval $compile; then
9300                                 echo "You seem to use __UNDETACHED." >&4
9301                                 val="$define"
9302                                 set d_old_pthread_create_joinable
9303                                 eval $setvar
9304                                 val=__UNDETACHED
9305                                 set old_pthread_create_joinable
9306                                 eval $setvar
9307                         else
9308                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
9309                                 val="$define"
9310                                 set d_old_pthread_create_joinable
9311                                 eval $setvar
9312                                 val=0
9313                                 set old_pthread_create_joinable
9314                                 eval $setvar
9315                         fi
9316                 fi
9317         fi
9318         $rm -f try try.*
9319 else
9320     d_old_pthread_create_joinable="$undef"
9321     old_pthread_create_joinable=""
9322 fi
9323
9324 : see if pause exists
9325 set pause d_pause
9326 eval $inlibc
9327
9328 : see if pipe exists
9329 set pipe d_pipe
9330 eval $inlibc
9331
9332 : see if poll exists
9333 set poll d_poll
9334 eval $inlibc
9335
9336
9337 : see whether the various POSIXish _yields exist
9338 $cat >try.c <<EOP
9339 #include <pthread.h>
9340 #include <stdio.h>
9341 int main() {
9342 #ifdef SCHED_YIELD
9343         sched_yield();
9344 #else
9345 #ifdef PTHREAD_YIELD
9346         pthread_yield();
9347 #else
9348 #ifdef PTHREAD_YIELD_NULL
9349         pthread_yield(NULL);
9350 #endif
9351 #endif
9352 #endif
9353 }
9354 EOP
9355 : see if sched_yield exists
9356 set try -DSCHED_YIELD
9357 if eval $compile; then
9358     val="$define"
9359     sched_yield='sched_yield()'
9360 else
9361     val="$undef"
9362 fi
9363 case "$usethreads" in
9364 $define)
9365         case "$val" in
9366         $define) echo 'sched_yield() found.' >&4        ;;
9367         *)       echo 'sched_yield() NOT found.' >&4    ;;
9368         esac
9369 esac
9370 set d_sched_yield
9371 eval $setvar
9372
9373 : see if pthread_yield exists
9374 set try -DPTHREAD_YIELD
9375 if eval $compile; then
9376     val="$define"
9377     case "$sched_yield" in
9378     '') sched_yield='pthread_yield()' ;;
9379     esac
9380 else
9381     set try -DPTHREAD_YIELD_NULL
9382     if eval $compile; then
9383         val="$define"
9384         case "$sched_yield" in
9385         '') sched_yield='pthread_yield(NULL)' ;;
9386         esac
9387     else
9388         val="$undef"
9389     fi
9390 fi
9391 case "$usethreads" in
9392 $define)
9393         case "$val" in
9394         $define) echo 'pthread_yield() found.' >&4      ;;
9395         *)       echo 'pthread_yield() NOT found.' >&4  ;;
9396         esac
9397         ;;
9398 esac
9399 set d_pthread_yield
9400 eval $setvar
9401
9402 case "$sched_yield" in
9403 '') sched_yield=undef ;;
9404 esac
9405
9406 $rm -f try try.*
9407
9408 : see if this is a pwd.h system
9409 set pwd.h i_pwd
9410 eval $inhdr
9411
9412 case "$i_pwd" in
9413 $define)
9414         xxx=`./findhdr pwd.h`
9415         $cppstdin $cppflags $cppminus < $xxx >$$.h
9416
9417         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
9418                 val="$define"
9419         else
9420                 val="$undef"
9421         fi
9422         set d_pwquota
9423         eval $setvar
9424
9425         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
9426                 val="$define"
9427         else
9428                 val="$undef"
9429         fi
9430         set d_pwage
9431         eval $setvar
9432
9433         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
9434                 val="$define"
9435         else
9436                 val="$undef"
9437         fi
9438         set d_pwchange
9439         eval $setvar
9440
9441         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
9442                 val="$define"
9443         else
9444                 val="$undef"
9445         fi
9446         set d_pwclass
9447         eval $setvar
9448
9449         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
9450                 val="$define"
9451         else
9452                 val="$undef"
9453         fi
9454         set d_pwexpire
9455         eval $setvar
9456
9457         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
9458                 val="$define"
9459         else
9460                 val="$undef"
9461         fi
9462         set d_pwcomment
9463         eval $setvar
9464
9465         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
9466                 val="$define"
9467         else
9468                 val="$undef"
9469         fi
9470         set d_pwgecos
9471         eval $setvar
9472
9473         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
9474                 val="$define"
9475         else
9476                 val="$undef"
9477         fi
9478         set d_pwpasswd
9479         eval $setvar
9480
9481         $rm -f $$.h
9482         ;;
9483 *)
9484         val="$undef"; 
9485         set d_pwquota; eval $setvar
9486         set d_pwage; eval $setvar
9487         set d_pwchange; eval $setvar
9488         set d_pwclass; eval $setvar
9489         set d_pwexpire; eval $setvar
9490         set d_pwcomment; eval $setvar
9491         set d_pwgecos; eval $setvar
9492         set d_pwpasswd; eval $setvar
9493         ;;
9494 esac
9495
9496 : see if readdir and friends exist
9497 set readdir d_readdir
9498 eval $inlibc
9499 set seekdir d_seekdir
9500 eval $inlibc
9501 set telldir d_telldir
9502 eval $inlibc
9503 set rewinddir d_rewinddir
9504 eval $inlibc
9505
9506 : see if readlink exists
9507 set readlink d_readlink
9508 eval $inlibc
9509
9510 : see if readv exists
9511 set readv d_readv
9512 eval $inlibc
9513
9514 : see if rename exists
9515 set rename d_rename
9516 eval $inlibc
9517
9518 : see if rmdir exists
9519 set rmdir d_rmdir
9520 eval $inlibc
9521
9522 : see if memory.h is available.
9523 val=''
9524 set memory.h val
9525 eval $inhdr
9526
9527 : See if it conflicts with string.h
9528 case "$val" in
9529 $define)
9530         case "$strings" in
9531         '') ;;
9532         *)
9533                 $cppstdin $cppflags $cppminus < $strings > mem.h
9534                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
9535                         echo " "
9536                         echo "We won't be including <memory.h>."
9537                         val="$undef"
9538                 fi
9539                 $rm -f mem.h
9540                 ;;
9541         esac
9542 esac
9543 set i_memory
9544 eval $setvar
9545
9546 : can bcopy handle overlapping blocks?
9547 val="$undef"
9548 case "$d_bcopy" in
9549 "$define")
9550         echo " "
9551         echo "Checking to see if your bcopy() can do overlapping copies..." >&4
9552         $cat >try.c <<EOCP
9553 #$i_memory I_MEMORY
9554 #$i_stdlib I_STDLIB
9555 #$i_string I_STRING
9556 #$i_unistd I_UNISTD
9557 EOCP
9558         $cat >>try.c <<'EOCP'
9559 #include <stdio.h>
9560 #ifdef I_MEMORY
9561 #  include <memory.h>
9562 #endif
9563 #ifdef I_STDLIB
9564 #  include <stdlib.h>
9565 #endif
9566 #ifdef I_STRING
9567 #  include <string.h>
9568 #else
9569 #  include <strings.h>
9570 #endif
9571 #ifdef I_UNISTD
9572 #  include <unistd.h>  /* Needed for NetBSD */
9573 #endif
9574 int main()
9575 {
9576 char buf[128], abc[128];
9577 char *b;
9578 int len;
9579 int off;
9580 int align;
9581
9582 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
9583
9584 for (align = 7; align >= 0; align--) {
9585         for (len = 36; len; len--) {
9586                 b = buf+align;
9587                 bcopy(abc, b, len);
9588                 for (off = 1; off <= len; off++) {
9589                         bcopy(b, b+off, len);
9590                         bcopy(b+off, b, len);
9591                         if (bcmp(b, abc, len))
9592                                 exit(1);
9593                 }
9594         }
9595 }
9596 exit(0);
9597 }
9598 EOCP
9599         set try
9600         if eval $compile_ok; then
9601                 if ./try 2>/dev/null; then
9602                         echo "Yes, it can."
9603                         val="$define"
9604                 else
9605                         echo "It can't, sorry."
9606                         case "$d_memmove" in
9607                         "$define") echo "But that's Ok since you have memmove()." ;;
9608                         esac
9609                 fi
9610         else
9611                 echo "(I can't compile the test program, so we'll assume not...)"
9612                 case "$d_memmove" in
9613                 "$define") echo "But that's Ok since you have memmove()." ;;
9614                 esac
9615         fi
9616         ;;
9617 esac
9618 $rm -f try.* try core
9619 set d_safebcpy
9620 eval $setvar
9621
9622 : can memcpy handle overlapping blocks?
9623 val="$undef"
9624 case "$d_memcpy" in
9625 "$define")
9626         echo " "
9627         echo "Checking to see if your memcpy() can do overlapping copies..." >&4
9628         $cat >try.c <<EOCP
9629 #$i_memory I_MEMORY
9630 #$i_stdlib I_STDLIB
9631 #$i_string I_STRING
9632 #$i_unistd I_UNISTD
9633 EOCP
9634         $cat >>try.c <<'EOCP'
9635 #include <stdio.h>
9636 #ifdef I_MEMORY
9637 #  include <memory.h>
9638 #endif
9639 #ifdef I_STDLIB
9640 #  include <stdlib.h>
9641 #endif
9642 #ifdef I_STRING
9643 #  include <string.h>
9644 #else
9645 #  include <strings.h>
9646 #endif
9647 #ifdef I_UNISTD
9648 #  include <unistd.h>  /* Needed for NetBSD */
9649 #endif
9650 int main()
9651 {
9652 char buf[128], abc[128];
9653 char *b;
9654 int len;
9655 int off;
9656 int align;
9657
9658 /* Copy "abcde..." string to char abc[] so that gcc doesn't
9659    try to store the string in read-only memory. */
9660 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
9661
9662 for (align = 7; align >= 0; align--) {
9663         for (len = 36; len; len--) {
9664                 b = buf+align;
9665                 memcpy(b, abc, len);
9666                 for (off = 1; off <= len; off++) {
9667                         memcpy(b+off, b, len);
9668                         memcpy(b, b+off, len);
9669                         if (memcmp(b, abc, len))
9670                                 exit(1);
9671                 }
9672         }
9673 }
9674 exit(0);
9675 }
9676 EOCP
9677         set try
9678         if eval $compile_ok; then
9679                 if ./try 2>/dev/null; then
9680                         echo "Yes, it can."
9681                         val="$define"
9682                 else
9683                         echo "It can't, sorry."
9684                         case "$d_memmove" in
9685                         "$define") echo "But that's Ok since you have memmove()." ;;
9686                         esac
9687                 fi
9688         else
9689                 echo "(I can't compile the test program, so we'll assume not...)"
9690                 case "$d_memmove" in
9691                 "$define") echo "But that's Ok since you have memmove()." ;;
9692                 esac
9693         fi
9694         ;;
9695 esac
9696 $rm -f try.* try core
9697 set d_safemcpy
9698 eval $setvar
9699
9700 : can memcmp be trusted to compare relative magnitude?
9701 val="$undef"
9702 case "$d_memcmp" in
9703 "$define")
9704         echo " "
9705         echo "Checking if your memcmp() can compare relative magnitude..." >&4
9706         $cat >try.c <<EOCP
9707 #$i_memory I_MEMORY
9708 #$i_stdlib I_STDLIB
9709 #$i_string I_STRING
9710 #$i_unistd I_UNISTD
9711 EOCP
9712         $cat >>try.c <<'EOCP'
9713 #include <stdio.h>
9714 #ifdef I_MEMORY
9715 #  include <memory.h>
9716 #endif
9717 #ifdef I_STDLIB
9718 #  include <stdlib.h>
9719 #endif
9720 #ifdef I_STRING
9721 #  include <string.h>
9722 #else
9723 #  include <strings.h>
9724 #endif
9725 #ifdef I_UNISTD
9726 #  include <unistd.h>  /* Needed for NetBSD */
9727 #endif
9728 int main()
9729 {
9730 char a = -1;
9731 char b = 0;
9732 if ((a < b) && memcmp(&a, &b, 1) < 0)
9733         exit(1);
9734 exit(0);
9735 }
9736 EOCP
9737         set try
9738         if eval $compile_ok; then
9739                 if ./try 2>/dev/null; then
9740                         echo "Yes, it can."
9741                         val="$define"
9742                 else
9743                         echo "No, it can't (it uses signed chars)."
9744                 fi
9745         else
9746                 echo "(I can't compile the test program, so we'll assume not...)"
9747         fi
9748         ;;
9749 esac
9750 $rm -f try.* try core
9751 set d_sanemcmp
9752 eval $setvar
9753
9754 : see if select exists
9755 set select d_select
9756 eval $inlibc
9757
9758 : see if semctl exists
9759 set semctl d_semctl
9760 eval $inlibc
9761
9762 : see if semget exists
9763 set semget d_semget
9764 eval $inlibc
9765
9766 : see if semop exists
9767 set semop d_semop
9768 eval $inlibc
9769
9770 : see how much of the 'sem*(2)' library is present.
9771 h_sem=true
9772 echo " "
9773 case "$d_semctl$d_semget$d_semop" in
9774 *"$undef"*) h_sem=false;;
9775 esac
9776 case "$osname" in
9777 freebsd)
9778     case "`ipcs 2>&1`" in
9779     "SVID messages"*"not configured"*)
9780         echo "Your $osname does not have the sem*(2) configured." >&4
9781         h_sem=false
9782         val="$undef"
9783         set semctl d_semctl
9784         eval $setvar
9785         set semget d_semget
9786         eval $setvar
9787         set semop d_semop
9788         eval $setvar
9789         ;;
9790     esac
9791     ;;
9792 esac
9793 : we could also check for sys/ipc.h ...
9794 if $h_sem && $test `./findhdr sys/sem.h`; then
9795         echo "You have the full sem*(2) library." >&4
9796         val="$define"
9797 else
9798         echo "You don't have the full sem*(2) library." >&4
9799         val="$undef"
9800 fi
9801 set d_sem
9802 eval $setvar
9803
9804 : see whether sys/sem.h defines union semun
9805 echo " "
9806 $cat > try.c <<'END'
9807 #include <sys/types.h>
9808 #include <sys/ipc.h>
9809 #include <sys/sem.h>
9810 int main () { union semun semun; semun.buf = 0; }
9811 END
9812 set try
9813 if eval $compile; then
9814     echo "You have union semun in <sys/sem.h>." >&4
9815     val="$define"
9816 else
9817     echo "You do not have union semun in <sys/sem.h>." >&4
9818     val="$undef"
9819 fi
9820 $rm -f try try.c try.h
9821 set d_union_semun
9822 eval $setvar
9823
9824 : see how to do semctl IPC_STAT
9825 case "$d_sem" in
9826 $define)
9827     : see whether semctl IPC_STAT can use union semun
9828     echo " "
9829     $cat > try.h <<END
9830 #ifndef S_IRUSR
9831 #   ifdef S_IREAD
9832 #       define S_IRUSR S_IREAD
9833 #       define S_IWUSR S_IWRITE
9834 #       define S_IXUSR S_IEXEC
9835 #   else
9836 #       define S_IRUSR 0400
9837 #       define S_IWUSR 0200
9838 #       define S_IXUSR 0100
9839 #   endif
9840 #   define S_IRGRP (S_IRUSR>>3)
9841 #   define S_IWGRP (S_IWUSR>>3)
9842 #   define S_IXGRP (S_IXUSR>>3)
9843 #   define S_IROTH (S_IRUSR>>6)
9844 #   define S_IWOTH (S_IWUSR>>6)
9845 #   define S_IXOTH (S_IXUSR>>6)
9846 #endif
9847 #ifndef S_IRWXU
9848 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
9849 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
9850 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
9851 #endif
9852 END
9853
9854     $cat > try.c <<END
9855 #include <sys/types.h>
9856 #include <sys/ipc.h>
9857 #include <sys/sem.h>
9858 #include <sys/stat.h>
9859 #include <stdio.h>
9860 #include <errno.h>
9861 #include "try.h"
9862 #ifndef errno
9863 extern int errno;
9864 #endif
9865 #$d_union_semun HAS_UNION_SEMUN
9866 int main() {
9867     union semun
9868 #ifndef HAS_UNION_SEMUN
9869     {
9870         int val;
9871         struct semid_ds *buf;
9872         unsigned short *array;
9873     }
9874 #endif
9875     arg;
9876     int sem, st;
9877
9878 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
9879     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9880     if (sem > -1) {
9881         struct semid_ds argbuf;
9882         arg.buf = &argbuf;
9883 #       ifdef IPC_STAT
9884         st = semctl(sem, 0, IPC_STAT, arg);
9885         if (st == 0)
9886             printf("semun\n");
9887         else
9888 #       endif /* IPC_STAT */
9889             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9890 #       ifdef IPC_RMID
9891         if (semctl(sem, 0, IPC_RMID, arg) != 0)
9892 #       endif /* IPC_RMID */
9893             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9894     } else
9895 #endif /* IPC_PRIVATE && ... */
9896         printf("semget failed: errno = %d\n", errno);
9897   return 0;
9898 }
9899 END
9900     val="$undef"
9901     set try
9902     if eval $compile; then
9903         xxx=`./try`
9904         case "$xxx" in
9905         semun) val="$define" ;;
9906         esac
9907     fi
9908     $rm -f try try.c
9909     set d_semctl_semun
9910     eval $setvar
9911     case "$d_semctl_semun" in
9912     $define)
9913         echo "You can use union semun for semctl IPC_STAT." >&4
9914         also='also'
9915         ;;
9916     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
9917         also=''
9918         ;;
9919     esac
9920
9921     : see whether semctl IPC_STAT can use struct semid_ds pointer
9922     $cat > try.c <<'END'
9923 #include <sys/types.h>
9924 #include <sys/ipc.h>
9925 #include <sys/sem.h>
9926 #include <sys/stat.h>
9927 #include "try.h"
9928 #include <stdio.h>
9929 #include <errno.h>
9930 #ifndef errno
9931 extern int errno;
9932 #endif
9933 int main() {
9934     struct semid_ds arg;
9935     int sem, st;
9936
9937 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
9938     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
9939     if (sem > -1) {
9940 #       ifdef IPC_STAT
9941         st = semctl(sem, 0, IPC_STAT, &arg);
9942         if (st == 0)
9943             printf("semid_ds\n");
9944         else
9945 #       endif /* IPC_STAT */
9946             printf("semctl IPC_STAT failed: errno = %d\n", errno);
9947 #       ifdef IPC_RMID
9948         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
9949 #       endif /* IPC_RMID */
9950             printf("semctl IPC_RMID failed: errno = %d\n", errno);
9951     } else
9952 #endif /* IPC_PRIVATE && ... */
9953         printf("semget failed: errno = %d\n", errno);
9954
9955     return 0;
9956 }
9957 END
9958     val="$undef"
9959     set try
9960     if eval $compile; then
9961         xxx=`./try`
9962         case "$xxx" in
9963         semid_ds) val="$define" ;;
9964         esac
9965     fi
9966     $rm -f try try.c
9967     set d_semctl_semid_ds
9968     eval $setvar
9969     case "$d_semctl_semid_ds" in
9970     $define)
9971         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
9972         ;;
9973     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
9974         ;;
9975     esac
9976     $rm -f try.h
9977     ;;
9978 *)  val="$undef"
9979
9980     # We do not have the full sem*(2) library, so assume we can not
9981     # use either.
9982
9983     set d_semctl_semun
9984     eval $setvar
9985
9986     set d_semctl_semid_ds
9987     eval $setvar
9988     ;;
9989 esac
9990
9991 : see if setegid exists
9992 set setegid d_setegid
9993 eval $inlibc
9994
9995 : see if seteuid exists
9996 set seteuid d_seteuid
9997 eval $inlibc
9998
9999 : see if setgrent exists
10000 set setgrent d_setgrent
10001 eval $inlibc
10002
10003 : see if sethostent exists
10004 set sethostent d_sethent
10005 eval $inlibc
10006
10007 : see if setlinebuf exists
10008 set setlinebuf d_setlinebuf
10009 eval $inlibc
10010
10011 : see if setlocale exists
10012 set setlocale d_setlocale
10013 eval $inlibc
10014
10015 : see if setnetent exists
10016 set setnetent d_setnent
10017 eval $inlibc
10018
10019 : see if setprotoent exists
10020 set setprotoent d_setpent
10021 eval $inlibc
10022
10023 : see if setpgid exists
10024 set setpgid d_setpgid
10025 eval $inlibc
10026
10027 : see if setpgrp2 exists
10028 set setpgrp2 d_setpgrp2
10029 eval $inlibc
10030
10031 : see if setpriority exists
10032 set setpriority d_setprior
10033 eval $inlibc
10034
10035 : see if setpwent exists
10036 set setpwent d_setpwent
10037 eval $inlibc
10038
10039 : see if setregid exists
10040 set setregid d_setregid
10041 eval $inlibc
10042 set setresgid d_setresgid
10043 eval $inlibc
10044
10045 : see if setreuid exists
10046 set setreuid d_setreuid
10047 eval $inlibc
10048 set setresuid d_setresuid
10049 eval $inlibc
10050
10051 : see if setrgid exists
10052 set setrgid d_setrgid
10053 eval $inlibc
10054
10055 : see if setruid exists
10056 set setruid d_setruid
10057 eval $inlibc
10058
10059 : see if setservent exists
10060 set setservent d_setsent
10061 eval $inlibc
10062
10063 : see if setsid exists
10064 set setsid d_setsid
10065 eval $inlibc
10066
10067 : see if setspent exists
10068 set setspent d_setspent
10069 eval $inlibc
10070
10071 : see if setvbuf exists
10072 set setvbuf d_setvbuf
10073 eval $inlibc
10074
10075 : see if sfio.h is available
10076 set sfio.h i_sfio
10077 eval $inhdr
10078
10079
10080 : see if sfio library is available
10081 case "$i_sfio" in
10082 $define)
10083         val=''
10084         set sfreserve val
10085         eval $inlibc
10086         ;;
10087 *)
10088         val="$undef"
10089         ;;
10090 esac
10091 : Ok, but do we want to use it.
10092 case "$val" in
10093 $define)
10094         case "$usesfio" in
10095         true|$define|[yY]*) dflt='y';;
10096         *) dflt='n';;
10097         esac
10098         echo "$package can use the sfio library, but it is experimental."
10099         rp="You seem to have sfio available, do you want to try using it?"
10100         . ./myread
10101         case "$ans" in
10102         y|Y) ;;
10103         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
10104                 val="$undef"
10105                 : Remove sfio from list of libraries to use
10106                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
10107                 shift
10108                 libs="$*"
10109                 echo "libs = $libs" >&4
10110                 ;;
10111         esac
10112         ;;
10113 *)      case "$usesfio" in
10114         true|$define|[yY]*)
10115                 echo "Sorry, cannot find sfio on this machine" >&4
10116                 echo "Ignoring your setting of usesfio=$usesfio" >&4
10117                 ;;
10118         esac
10119         ;;
10120 esac
10121 set d_sfio
10122 eval $setvar
10123 case "$d_sfio" in
10124 $define) usesfio='true';;
10125 *) usesfio='false';;
10126 esac
10127
10128 : see if shmctl exists
10129 set shmctl d_shmctl
10130 eval $inlibc
10131
10132 : see if shmget exists
10133 set shmget d_shmget
10134 eval $inlibc
10135
10136 : see if shmat exists
10137 set shmat d_shmat
10138 eval $inlibc
10139 : see what shmat returns
10140 case "$d_shmat" in
10141 "$define")
10142         $cat >shmat.c <<'END'
10143 #include <sys/shm.h>
10144 void *shmat();
10145 END
10146         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
10147                 shmattype='void *'
10148         else
10149                 shmattype='char *'
10150         fi
10151         echo "and it returns ($shmattype)." >&4
10152         : see if a prototype for shmat is available
10153         xxx=`./findhdr sys/shm.h`
10154         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
10155         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
10156                 val="$define"
10157         else
10158                 val="$undef"
10159         fi
10160         $rm -f shmat.[co]
10161         ;;
10162 *)
10163         val="$undef"
10164         ;;
10165 esac
10166 set d_shmatprototype
10167 eval $setvar
10168
10169 : see if shmdt exists
10170 set shmdt d_shmdt
10171 eval $inlibc
10172
10173 : see how much of the 'shm*(2)' library is present.
10174 h_shm=true
10175 echo " "
10176 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
10177 *"$undef"*) h_shm=false;;
10178 esac
10179 case "$osname" in
10180 freebsd)
10181     case "`ipcs 2>&1`" in
10182     "SVID shared memory"*"not configured"*)
10183         echo "Your $osname does not have the shm*(2) configured." >&4
10184         h_shm=false
10185         val="$undef"
10186         set shmctl d_shmctl
10187         evat $setvar
10188         set shmget d_shmget
10189         evat $setvar
10190         set shmat d_shmat
10191         evat $setvar
10192         set shmdt d_shmdt
10193         evat $setvar
10194         ;;
10195     esac
10196     ;;
10197 esac
10198 : we could also check for sys/ipc.h ...
10199 if $h_shm && $test `./findhdr sys/shm.h`; then
10200         echo "You have the full shm*(2) library." >&4
10201         val="$define"
10202 else
10203         echo "You don't have the full shm*(2) library." >&4
10204         val="$undef"
10205 fi
10206 set d_shm
10207 eval $setvar
10208
10209 echo " "
10210 : see if we have sigaction
10211 if set sigaction val -f d_sigaction; eval $csym; $val; then
10212         echo 'sigaction() found.' >&4
10213         $cat > try.c <<'EOP'
10214 #include <stdio.h>
10215 #include <sys/types.h>
10216 #include <signal.h>
10217 int main()
10218 {
10219     struct sigaction act, oact;
10220     act.sa_flags = 0;
10221     oact.sa_handler = 0;
10222 }
10223 EOP
10224         set try
10225         if eval $compile_ok; then
10226                 val="$define"
10227         else
10228                 echo "But you don't seem to have a useable struct sigaction." >&4
10229                 val="$undef"
10230         fi
10231 else
10232         echo 'sigaction NOT found.' >&4
10233         val="$undef"
10234 fi
10235 set d_sigaction; eval $setvar
10236 $rm -f try try$_o try.c
10237
10238 : see if sigsetjmp exists
10239 echo " "
10240 case "$d_sigsetjmp" in
10241 '')
10242         $cat >try.c <<'EOP'
10243 #include <setjmp.h>
10244 sigjmp_buf env;
10245 int set = 1;
10246 int main()
10247 {
10248         if (sigsetjmp(env,1))
10249                 exit(set);
10250         set = 0;
10251         siglongjmp(env, 1);
10252         exit(1);
10253 }
10254 EOP
10255         set try
10256         if eval $compile; then
10257                 if ./try >/dev/null 2>&1; then
10258                         echo "POSIX sigsetjmp found." >&4
10259                         val="$define"
10260                 else
10261                         $cat >&4 <<EOM
10262 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
10263 I'll ignore them.
10264 EOM
10265                         val="$undef"
10266                 fi
10267         else
10268                 echo "sigsetjmp not found." >&4
10269                 val="$undef"
10270         fi
10271         ;;
10272 *) val="$d_sigsetjmp"
10273         case "$d_sigsetjmp" in
10274         $define) echo "POSIX sigsetjmp found." >&4;;
10275         $undef) echo "sigsetjmp not found." >&4;;
10276         esac
10277         ;;
10278 esac
10279 set d_sigsetjmp
10280 eval $setvar
10281 $rm -f try.c try
10282
10283 : see if sys/stat.h is available
10284 set sys/stat.h i_sysstat
10285 eval $inhdr
10286
10287 : see if stat knows about block sizes
10288 echo " "
10289 set d_statblks stat st_blocks $i_sysstat sys/stat.h
10290 eval $hasfield
10291
10292 : see if _ptr and _cnt from stdio act std
10293 echo " "
10294 if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
10295         echo "(Looks like you have stdio.h from Linux.)"
10296         case "$stdio_ptr" in
10297         '') stdio_ptr='((fp)->_IO_read_ptr)'
10298                 ptr_lval=$define
10299                 ;;
10300         *)      ptr_lval=$d_stdio_ptr_lval;;
10301         esac
10302         case "$stdio_cnt" in
10303         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
10304                 cnt_lval=$undef
10305                 ;;
10306         *)      cnt_lval=$d_stdio_cnt_lval;;
10307         esac
10308         case "$stdio_base" in
10309         '') stdio_base='((fp)->_IO_read_base)';;
10310         esac
10311         case "$stdio_bufsiz" in
10312         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
10313         esac
10314 else
10315         case "$stdio_ptr" in
10316         '') stdio_ptr='((fp)->_ptr)'
10317                 ptr_lval=$define
10318                 ;;
10319         *)      ptr_lval=$d_stdio_ptr_lval;;
10320         esac
10321         case "$stdio_cnt" in
10322         '') stdio_cnt='((fp)->_cnt)'
10323                 cnt_lval=$define
10324                 ;;
10325         *)      cnt_lval=$d_stdio_cnt_lval;;
10326         esac
10327         case "$stdio_base" in
10328         '') stdio_base='((fp)->_base)';;
10329         esac
10330         case "$stdio_bufsiz" in
10331         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
10332         esac
10333 fi
10334 : test whether _ptr and _cnt really work
10335 echo "Checking how std your stdio is..." >&4
10336 $cat >try.c <<EOP
10337 #include <stdio.h>
10338 #define FILE_ptr(fp)    $stdio_ptr
10339 #define FILE_cnt(fp)    $stdio_cnt
10340 int main() {
10341         FILE *fp = fopen("try.c", "r");
10342         char c = getc(fp);
10343         if (
10344                 18 <= FILE_cnt(fp) &&
10345                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
10346         )
10347                 exit(0);
10348         exit(1);
10349 }
10350 EOP
10351 val="$undef"
10352 set try
10353 if eval $compile; then
10354         if ./try; then
10355                 echo "Your stdio acts pretty std."
10356                 val="$define"
10357         else
10358                 echo "Your stdio isn't very std."
10359         fi
10360 else
10361         echo "Your stdio doesn't appear very std."
10362 fi
10363 $rm -f try.c try
10364 set d_stdstdio
10365 eval $setvar
10366
10367 : Can _ptr be used as an lvalue?
10368 case "$d_stdstdio$ptr_lval" in
10369 $define$define) val=$define ;;
10370 *) val=$undef ;;
10371 esac
10372 set d_stdio_ptr_lval
10373 eval $setvar
10374
10375 : Can _cnt be used as an lvalue?
10376 case "$d_stdstdio$cnt_lval" in
10377 $define$define) val=$define ;;
10378 *) val=$undef ;;
10379 esac
10380 set d_stdio_cnt_lval
10381 eval $setvar
10382
10383 : see if _base is also standard
10384 val="$undef"
10385 case "$d_stdstdio" in
10386 $define)
10387         $cat >try.c <<EOP
10388 #include <stdio.h>
10389 #define FILE_base(fp)   $stdio_base
10390 #define FILE_bufsiz(fp) $stdio_bufsiz
10391 int main() {
10392         FILE *fp = fopen("try.c", "r");
10393         char c = getc(fp);
10394         if (
10395                 19 <= FILE_bufsiz(fp) &&
10396                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
10397         )
10398                 exit(0);
10399         exit(1);
10400 }
10401 EOP
10402         set try
10403         if eval $compile; then
10404                 if ./try; then
10405                         echo "And its _base field acts std."
10406                         val="$define"
10407                 else
10408                         echo "But its _base field isn't std."
10409                 fi
10410         else
10411                 echo "However, it seems to be lacking the _base field."
10412         fi
10413         $rm -f try.c try
10414         ;;
10415 esac
10416 set d_stdiobase
10417 eval $setvar
10418
10419 $cat >&4 <<EOM
10420 Checking how to access stdio streams by file descriptor number...
10421 EOM
10422 case "$stdio_stream_array" in
10423 '')     $cat >try.c <<EOCP
10424 #include <stdio.h>
10425 int main() {
10426   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
10427     printf("yes\n");
10428 }
10429 EOCP
10430         for s in _iob __iob __sF
10431         do
10432                 set try -DSTDIO_STREAM_ARRAY=$s
10433                 if eval $compile; then
10434                         case "`./try$exe_ext`" in
10435                         yes)    stdio_stream_array=$s; break ;;
10436                         esac
10437                 fi
10438         done
10439         $rm -f try.* try$exe_ext
10440 esac
10441 case "$stdio_stream_array" in
10442 '')     $cat >&4 <<EOM
10443 I can't figure out how to access stdio streams by file descriptor number.
10444 EOM
10445         d_stdio_stream_array="$undef"
10446         ;;
10447 *)      $cat >&4 <<EOM
10448 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
10449 EOM
10450         d_stdio_stream_array="$define"
10451         ;;
10452 esac
10453
10454 : see if strcoll exists
10455 set strcoll d_strcoll
10456 eval $inlibc
10457
10458 : check for structure copying
10459 echo " "
10460 echo "Checking to see if your C compiler can copy structs..." >&4
10461 $cat >try.c <<'EOCP'
10462 int main()
10463 {
10464         struct blurfl {
10465                 int dyick;
10466         } foo, bar;
10467
10468         foo = bar;
10469 }
10470 EOCP
10471 if $cc -c try.c >/dev/null 2>&1 ; then
10472         val="$define"
10473         echo "Yup, it can."
10474 else
10475         val="$undef"
10476         echo "Nope, it can't."
10477 fi
10478 set d_strctcpy
10479 eval $setvar
10480 $rm -f try.*
10481
10482 : see if strerror and/or sys_errlist[] exist
10483 echo " "
10484 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
10485     if set strerror val -f d_strerror; eval $csym; $val; then
10486                 echo 'strerror() found.' >&4
10487                 d_strerror="$define"
10488                 d_strerrm='strerror(e)'
10489                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10490                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
10491                         d_syserrlst="$define"
10492                 else
10493                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
10494                         d_syserrlst="$undef"
10495                 fi
10496     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
10497                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
10498                 echo 'strerror() found in string header.' >&4
10499                 d_strerror="$define"
10500                 d_strerrm='strerror(e)'
10501                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
10502                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
10503                                 d_syserrlst="$define"
10504                 else
10505                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
10506                         d_syserrlst="$undef"
10507                 fi
10508     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
10509                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
10510                 d_strerror="$undef"
10511                 d_syserrlst="$define"
10512                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
10513     else
10514                 echo 'strerror() and sys_errlist[] NOT found.' >&4
10515                 d_strerror="$undef"
10516                 d_syserrlst="$undef"
10517                 d_strerrm='"unknown"'
10518     fi
10519 fi
10520
10521 : see if strtod exists
10522 set strtod d_strtod
10523 eval $inlibc
10524
10525 : see if strtol exists
10526 set strtol d_strtol
10527 eval $inlibc
10528
10529 : see if strtoul exists
10530 set strtoul d_strtoul
10531 eval $inlibc
10532
10533 : see if strtoull exists
10534 set strtoull d_strtoull
10535 eval $inlibc
10536
10537 : see if strxfrm exists
10538 set strxfrm d_strxfrm
10539 eval $inlibc
10540
10541 : see if symlink exists
10542 set symlink d_symlink
10543 eval $inlibc
10544
10545 : see if syscall exists
10546 set syscall d_syscall
10547 eval $inlibc
10548
10549 : see if sysconf exists
10550 set sysconf d_sysconf
10551 eval $inlibc
10552
10553 : see if system exists
10554 set system d_system
10555 eval $inlibc
10556
10557 : see if tcgetpgrp exists
10558 set tcgetpgrp d_tcgetpgrp
10559 eval $inlibc
10560
10561 : see if tcsetpgrp exists
10562 set tcsetpgrp d_tcsetpgrp
10563 eval $inlibc
10564
10565 : see if sys/types.h has to be included
10566 set sys/types.h i_systypes
10567 eval $inhdr
10568
10569 : see if prototype for telldir is available
10570 echo " "
10571 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
10572 eval $hasproto
10573
10574 : define an is-a-typedef? function
10575 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10576 case "$inclist" in
10577 "") inclist="sys/types.h";;
10578 esac;
10579 eval "varval=\$$var";
10580 case "$varval" in
10581 "")
10582         $rm -f temp.c;
10583         for inc in $inclist; do
10584                 echo "#include <$inc>" >>temp.c;
10585         done;
10586         echo "#ifdef $type" >> temp.c;
10587         echo "printf(\"We have $type\");" >> temp.c;
10588         echo "#endif" >> temp.c;
10589         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10590         if $contains $type temp.E >/dev/null 2>&1; then
10591                 eval "$var=\$type";
10592         else
10593                 eval "$var=\$def";
10594         fi;
10595         $rm -f temp.?;;
10596 *) eval "$var=\$varval";;
10597 esac'
10598
10599 : define an is-a-typedef? function that prompts if the type is not available.
10600 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
10601 case "$inclist" in
10602 "") inclist="sys/types.h";;
10603 esac;
10604 eval "varval=\$$var";
10605 case "$varval" in
10606 "")
10607         $rm -f temp.c;
10608         for inc in $inclist; do
10609                 echo "#include <$inc>" >>temp.c;
10610         done;
10611         echo "#ifdef $type" >> temp.c;
10612         echo "printf(\"We have $type\");" >> temp.c;
10613         echo "#endif" >> temp.c;
10614         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
10615         echo " " ;
10616         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
10617         if $contains $type temp.E >/dev/null 2>&1; then
10618                 echo "$type found." >&4;
10619                 eval "$var=\$type";
10620         else
10621                 echo "$type NOT found." >&4;
10622                 dflt="$def";
10623                 . ./myread ;
10624                 eval "$var=\$ans";
10625         fi;
10626         $rm -f temp.?;;
10627 *) eval "$var=\$varval";;
10628 esac'
10629
10630 : see if this is a sys/times.h system
10631 set sys/times.h i_systimes
10632 eval $inhdr
10633
10634 : see if times exists
10635 echo " "
10636 if set times val -f d_times; eval $csym; $val; then
10637         echo 'times() found.' >&4
10638         d_times="$define"
10639         inc=''
10640         case "$i_systimes" in
10641         "$define") inc='sys/times.h';;
10642         esac
10643         rp="What is the type returned by times() on this system?"
10644         set clock_t clocktype long stdio.h sys/types.h $inc
10645         eval $typedef_ask
10646 else
10647         echo 'times() NOT found, hope that will do.' >&4
10648         d_times="$undef"
10649         clocktype='int'
10650 fi
10651
10652 : see if truncate exists
10653 set truncate d_truncate
10654 eval $inlibc
10655
10656 : see if tzname[] exists
10657 echo " "
10658 if set tzname val -a d_tzname; eval $csym; $val; then
10659         val="$define"
10660         echo 'tzname[] found.' >&4
10661 else
10662         val="$undef"
10663         echo 'tzname[] NOT found.' >&4
10664 fi
10665 set d_tzname
10666 eval $setvar
10667
10668 : see if umask exists
10669 set umask d_umask
10670 eval $inlibc
10671
10672 : backward compatibility for d_hvfork
10673 if test X$d_hvfork != X; then
10674         d_vfork="$d_hvfork"
10675         d_hvfork=''
10676 fi
10677 : see if there is a vfork
10678 val=''
10679 set vfork val
10680 eval $inlibc
10681
10682 : Ok, but do we want to use it. vfork is reportedly unreliable in 
10683 : perl on Solaris 2.x, and probably elsewhere.
10684 case "$val" in
10685 $define)
10686         echo " "
10687         case "$usevfork" in
10688         false) dflt='n';;
10689         *) dflt='y';;
10690         esac
10691         cat <<'EOM'
10692  
10693 Perl can only use a vfork() that doesn't suffer from strict
10694 restrictions on calling functions or modifying global data in
10695 the child.  For example, glibc-2.1 contains such a vfork()
10696 that is unsuitable.  If your system provides a proper fork()
10697 call, chances are that you do NOT want perl to use vfork().
10698
10699 EOM
10700         rp="Do you still want to use vfork()?"
10701         . ./myread
10702         case "$ans" in
10703         y|Y) ;;
10704         *)
10705                 echo "Ok, we won't use vfork()."
10706                 val="$undef"
10707                 ;;
10708         esac
10709         ;;
10710 esac
10711 set d_vfork
10712 eval $setvar
10713 case "$d_vfork" in
10714 $define) usevfork='true';;
10715 *) usevfork='false';;
10716 esac
10717
10718 : see if this is an sysdir system
10719 set sys/dir.h i_sysdir
10720 eval $inhdr
10721
10722 : see if this is an sysndir system
10723 set sys/ndir.h i_sysndir
10724 eval $inhdr
10725
10726 : see if closedir exists
10727 set closedir d_closedir
10728 eval $inlibc
10729
10730 case "$d_closedir" in
10731 "$define")
10732         echo " "
10733         echo "Checking whether closedir() returns a status..." >&4
10734         cat > closedir.c <<EOM
10735 #$i_dirent I_DIRENT             /**/
10736 #$i_sysdir I_SYS_DIR            /**/
10737 #$i_sysndir I_SYS_NDIR          /**/
10738 #$i_systypes I_SYS_TYPES        /**/
10739
10740 #if defined(I_SYS_TYPES)
10741 #include <sys/types.h>
10742 #endif
10743 #if defined(I_DIRENT)
10744 #include <dirent.h>
10745 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10746 #include <sys/dir.h>
10747 #endif
10748 #else
10749 #ifdef I_SYS_NDIR
10750 #include <sys/ndir.h>
10751 #else
10752 #ifdef I_SYS_DIR
10753 #ifdef hp9000s500
10754 #include <ndir.h>       /* may be wrong in the future */
10755 #else
10756 #include <sys/dir.h>
10757 #endif
10758 #endif
10759 #endif
10760 #endif 
10761 int main() { return closedir(opendir(".")); }
10762 EOM
10763         set closedir
10764         if eval $compile_ok; then
10765                 if ./closedir > /dev/null 2>&1 ; then
10766                         echo "Yes, it does."
10767                         val="$undef"
10768                 else
10769                         echo "No, it doesn't."
10770                         val="$define"
10771                 fi
10772         else
10773                 echo "(I can't seem to compile the test program--assuming it doesn't)"
10774                 val="$define"
10775         fi
10776         ;;
10777 *)
10778         val="$undef";
10779         ;;
10780 esac
10781 set d_void_closedir
10782 eval $setvar
10783 $rm -f closedir*
10784 : check for volatile keyword
10785 echo " "
10786 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
10787 $cat >try.c <<'EOCP'
10788 int main()
10789 {
10790         typedef struct _goo_struct goo_struct;
10791         goo_struct * volatile goo = ((goo_struct *)0);
10792         struct _goo_struct {
10793                 long long_int;
10794                 int reg_int;
10795                 char char_var;
10796         };
10797         typedef unsigned short foo_t;
10798         char *volatile foo;
10799         volatile int bar;
10800         volatile foo_t blech;
10801         foo = foo;
10802 }
10803 EOCP
10804 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
10805         val="$define"
10806         echo "Yup, it does."
10807 else
10808         val="$undef"
10809         echo "Nope, it doesn't."
10810 fi
10811 set d_volatile
10812 eval $setvar
10813 $rm -f try.*
10814
10815 : see if there is a wait4
10816 set wait4 d_wait4
10817 eval $inlibc
10818
10819 : see if waitpid exists
10820 set waitpid d_waitpid
10821 eval $inlibc
10822
10823 : see if wcstombs exists
10824 set wcstombs d_wcstombs
10825 eval $inlibc
10826
10827 : see if wctomb exists
10828 set wctomb d_wctomb
10829 eval $inlibc
10830
10831 : see if writev exists
10832 set writev d_writev
10833 eval $inlibc
10834
10835 : preserve RCS keywords in files with variable substitution, grrr
10836 Date='$Date'
10837 Id='$Id'
10838 Log='$Log'
10839 RCSfile='$RCSfile'
10840 Revision='$Revision'
10841
10842 case "$crosscompile" in
10843 ''|[nN]*) crosscompile="$undef" ;;
10844 esac
10845
10846 case "$osname" in
10847 next|rhapsody) multiarch="$define" ;;
10848 esac
10849 case "$multiarch" in
10850 ''|[nN]*) multiarch="$undef" ;;
10851 esac
10852
10853 : check for alignment requirements
10854 echo " "
10855 case "$crosscompile$multiarch" in
10856 *$define*)
10857         $cat <<EOM
10858 You seem to be either cross-compiling or doing a multiarchitecture build,
10859 skipping the memory alignment check.
10860
10861 EOM
10862         case "$alignbytes" in
10863         '') alignbytes=8 ;;
10864         esac
10865         ;;
10866 *)
10867         case "$alignbytes" in
10868         '') echo "Checking alignment constraints..." >&4
10869                 $cat >try.c <<'EOCP'
10870 struct foobar {
10871         char foo;
10872         double bar;
10873 } try_algn;
10874 int main()
10875 {
10876         printf("%d\n", (char *)&try_algn.bar - (char *)&try_algn.foo);
10877 }
10878 EOCP
10879                 set try
10880                 if eval $compile_ok; then
10881                         dflt=`./try`
10882                 else
10883                         dflt='8'
10884                         echo "(I can't seem to compile the test program...)"
10885                 fi
10886                 ;;
10887         *) dflt="$alignbytes"
10888                 ;;
10889         esac
10890         rp="Doubles must be aligned on a how-many-byte boundary?"
10891         . ./myread
10892         alignbytes="$ans"
10893         $rm -f try.c try
10894         ;;
10895 esac
10896
10897
10898 : check for ordering of bytes in a long
10899 echo " "
10900 case "$crosscompile$multiarch" in
10901 *$define*)
10902         $cat <<EOM
10903 You seem to be either cross-compiling or doing a multiarchitecture build,
10904 skipping the byteorder check.
10905
10906 EOM
10907         byteorder='0xffff'
10908         ;;
10909 *)
10910         case "$byteorder" in
10911         '')
10912                 $cat <<'EOM'
10913 In the following, larger digits indicate more significance.  A big-endian
10914 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
10915 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
10916 machines may have weird orders like 3412.  A Cray will report 87654321,
10917 an Alpha will report 12345678. If the test program works the default is
10918 probably right.
10919 I'm now running the test program...
10920 EOM
10921                 $cat >try.c <<'EOCP'
10922 #include <stdio.h>
10923 int main()
10924 {
10925         int i;
10926         union {
10927                 unsigned long l;
10928                 char c[sizeof(long)];
10929         } u;
10930
10931         if (sizeof(long) > 4)
10932                 u.l = (0x08070605L << 32) | 0x04030201L;
10933         else
10934                 u.l = 0x04030201L;
10935         for (i = 0; i < sizeof(long); i++)
10936                 printf("%c", u.c[i]+'0');
10937         printf("\n");
10938         exit(0);
10939 }
10940 EOCP
10941                 xxx_prompt=y
10942                 set try
10943                 if eval $compile && ./try > /dev/null; then
10944                         dflt=`./try`
10945                         case "$dflt" in
10946                         [1-4][1-4][1-4][1-4]|12345678|87654321)
10947                                 echo "(The test program ran ok.)"
10948                                 echo "byteorder=$dflt"
10949                                 xxx_prompt=n
10950                         ;;
10951                         ????|????????) echo "(The test program ran ok.)" ;;
10952                         *) echo "(The test program didn't run right for some reason.)" ;;
10953                         esac
10954                 else
10955                         dflt='4321'
10956                         cat <<'EOM'
10957 (I can't seem to compile the test program.  Guessing big-endian...)
10958 EOM
10959                 fi
10960                 case "$xxx_prompt" in
10961                 y)
10962                         rp="What is the order of bytes in a long?"
10963                         . ./myread
10964                         byteorder="$ans"
10965                         ;;
10966                 *)      byteorder=$dflt
10967                         ;;
10968                 esac
10969                 ;;
10970         esac
10971         $rm -f try.c try
10972         ;;
10973 esac
10974
10975
10976 : how do we catenate cpp tokens here?
10977 echo " "
10978 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
10979 $cat >cpp_stuff.c <<'EOCP'
10980 #define RCAT(a,b)a/**/b
10981 #define ACAT(a,b)a ## b
10982 RCAT(Rei,ser)
10983 ACAT(Cir,cus)
10984 EOCP
10985 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
10986 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
10987         echo "Oh!  Smells like ANSI's been here." >&4
10988         echo "We can catify or stringify, separately or together!"
10989         cpp_stuff=42
10990 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
10991         echo "Ah, yes!  The good old days!" >&4
10992         echo "However, in the good old days we don't know how to stringify and"
10993         echo "catify at the same time."
10994         cpp_stuff=1
10995 else
10996         $cat >&4 <<EOM
10997 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
10998 to have to edit the values of CAT[2-5] in config.h...
10999 EOM
11000         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
11001 fi
11002 $rm -f cpp_stuff.*
11003
11004 : see if this is a db.h system
11005 set db.h i_db
11006 eval $inhdr
11007
11008 case "$i_db" in
11009 $define)
11010         : Check db version.
11011         echo " "
11012         echo "Checking Berkeley DB version ..." >&4
11013         $cat >try.c <<EOCP
11014 #$d_const HASCONST
11015 #ifndef HASCONST
11016 #define const
11017 #endif
11018 #include <sys/types.h>
11019 #include <stdio.h>
11020 #include <db.h>
11021 int main()
11022 {
11023 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
11024     int Major, Minor, Patch ;
11025     unsigned long Version ;
11026     (void)db_version(&Major, &Minor, &Patch) ;
11027     printf("You have Berkeley DB Version 2 or greater\n");
11028
11029     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
11030                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
11031     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
11032                 Major, Minor, Patch) ;
11033
11034     /* check that db.h & libdb are compatible */
11035     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
11036         printf("db.h and libdb are incompatible\n") ;
11037         exit(3);        
11038     }
11039
11040     printf("db.h and libdb are compatible\n") ;
11041
11042     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
11043                 + DB_VERSION_PATCH ;
11044
11045     /* needs to be >= 2.3.4 */
11046     if (Version < 2003004) {
11047     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
11048         printf("but Perl needs Berkeley DB 2.3.4 or greater\n") ;
11049         exit(2);        
11050     }
11051
11052     exit(0);
11053 #else
11054 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
11055     printf("You have Berkeley DB Version 1\n");
11056     exit(0);    /* DB version < 2: the coast is clear. */
11057 #else
11058     exit(1);    /* <db.h> not Berkeley DB? */
11059 #endif
11060 #endif
11061 }
11062 EOCP
11063         set try
11064         if eval $compile && ./try; then
11065                 echo 'Looks OK.' >&4
11066         else
11067                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
11068                 i_db=$undef
11069                 case " $libs " in
11070                 *"-ldb "*)
11071                         : Remove db from list of libraries to use
11072                         echo "Removing unusable -ldb from library list" >&4
11073                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
11074                         shift
11075                         libs="$*"
11076                         echo "libs = $libs" >&4
11077                         ;;
11078                 esac
11079         fi
11080         $rm -f try.*
11081         ;;
11082 esac
11083
11084 case "$i_db" in
11085 define)
11086         : Check the return type needed for hash 
11087         echo " "
11088         echo "Checking return type needed for hash for Berkeley DB ..." >&4
11089         $cat >try.c <<EOCP
11090 #$d_const HASCONST
11091 #ifndef HASCONST
11092 #define const
11093 #endif
11094 #include <sys/types.h>
11095 #include <db.h>
11096
11097 #ifndef DB_VERSION_MAJOR
11098 u_int32_t hash_cb (ptr, size)
11099 const void *ptr;
11100 size_t size;
11101 {
11102 }
11103 HASHINFO info;
11104 int main()
11105 {
11106         info.hash = hash_cb;
11107 }
11108 #endif
11109 EOCP
11110         if $cc $ccflags -c try.c >try.out 2>&1 ; then
11111                 if $contains warning try.out >>/dev/null 2>&1 ; then
11112                         db_hashtype='int'
11113                 else
11114                         db_hashtype='u_int32_t'
11115                 fi
11116         else
11117                 : XXX Maybe we should just give up here.
11118                 db_hashtype=u_int32_t
11119                 $cat try.out >&4
11120                 echo "Help:  I can't seem to compile the db test program." >&4
11121                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
11122         fi
11123         $rm -f try.*
11124         echo "Your version of Berkeley DB uses $db_hashtype for hash."
11125         ;;
11126 *)      db_hashtype=u_int32_t
11127         ;;
11128 esac
11129 case "$i_db" in
11130 define)
11131         : Check the return type needed for prefix 
11132         echo " "
11133         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
11134         cat >try.c <<EOCP
11135 #$d_const HASCONST
11136 #ifndef HASCONST
11137 #define const
11138 #endif
11139 #include <sys/types.h>
11140 #include <db.h>
11141
11142 #ifndef DB_VERSION_MAJOR
11143 size_t prefix_cb (key1, key2)
11144 const DBT *key1;
11145 const DBT *key2;
11146 {
11147 }
11148 BTREEINFO info;
11149 int main()
11150 {
11151         info.prefix = prefix_cb;
11152 }
11153 #endif
11154 EOCP
11155         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
11156                 if $contains warning try.out >>/dev/null 2>&1 ; then
11157                         db_prefixtype='int'
11158                 else
11159                         db_prefixtype='size_t'
11160                 fi
11161         else
11162                 db_prefixtype='size_t'
11163                 : XXX Maybe we should just give up here.
11164                 $cat try.out >&4
11165                 echo "Help:  I can't seem to compile the db test program." >&4
11166                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
11167         fi
11168         $rm -f try.*
11169         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
11170         ;;
11171 *)      db_prefixtype='size_t'
11172         ;;
11173 esac
11174
11175 : check for void type
11176 echo " "
11177 echo "Checking to see how well your C compiler groks the void type..." >&4
11178 case "$voidflags" in
11179 '')
11180         $cat >try.c <<'EOCP'
11181 #if TRY & 1
11182 void sub() {
11183 #else
11184 sub() {
11185 #endif
11186         extern void moo();      /* function returning void */
11187         void (*goo)();          /* ptr to func returning void */
11188 #if TRY & 8
11189         void *hue;              /* generic ptr */
11190 #endif
11191 #if TRY & 2
11192         void (*foo[10])();
11193 #endif
11194
11195 #if TRY & 4
11196         if(goo == moo) {
11197                 exit(0);
11198         }
11199 #endif
11200         exit(0);
11201 }
11202 int main() { sub(); }
11203 EOCP
11204         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
11205                 voidflags=$defvoidused
11206         echo "Good.  It appears to support void to the level $package wants.">&4
11207                 if $contains warning .out >/dev/null 2>&1; then
11208                         echo "However, you might get some warnings that look like this:"
11209                         $cat .out
11210                 fi
11211         else
11212 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
11213                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
11214                         echo "It supports 1..."
11215                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
11216                                 echo "It also supports 2..."
11217                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
11218                                         voidflags=7
11219                                         echo "And it supports 4 but not 8 definitely."
11220                                 else
11221                                         echo "It doesn't support 4..."
11222                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
11223                                                 voidflags=11
11224                                                 echo "But it supports 8."
11225                                         else
11226                                                 voidflags=3
11227                                                 echo "Neither does it support 8."
11228                                         fi
11229                                 fi
11230                         else
11231                                 echo "It does not support 2..."
11232                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
11233                                         voidflags=13
11234                                         echo "But it supports 4 and 8."
11235                                 else
11236                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
11237                                                 voidflags=5
11238                                                 echo "And it supports 4 but has not heard about 8."
11239                                         else
11240                                                 echo "However it supports 8 but not 4."
11241                                         fi
11242                                 fi
11243                         fi
11244                 else
11245                         echo "There is no support at all for void."
11246                         voidflags=0
11247                 fi
11248         fi
11249 esac
11250 case "$voidflags" in
11251 "$defvoidused") ;;
11252 *)      $cat >&4 <<'EOM'
11253   Support flag bits are:
11254     1: basic void declarations.
11255     2: arrays of pointers to functions returning void.
11256     4: operations between pointers to and addresses of void functions.
11257     8: generic void pointers.
11258 EOM
11259         dflt="$voidflags";
11260         rp="Your void support flags add up to what?"
11261         . ./myread
11262         voidflags="$ans"
11263         ;;
11264 esac
11265 $rm -f try.* .out
11266
11267
11268 : How can we generate normalized random numbers ?
11269 echo " "
11270 echo "Looking for a random number function..." >&4
11271 case "$randfunc" in
11272 '')
11273         if set drand48 val -f; eval $csym; $val; then
11274                 dflt="drand48"
11275                 echo "Good, found drand48()." >&4
11276         elif set random val -f; eval $csym; $val; then
11277                 dflt="random"
11278                 echo "OK, found random()." >&4
11279         else
11280                 dflt="rand"
11281                 echo "Yick, looks like I have to use rand()." >&4
11282         fi
11283         echo " "
11284         ;;
11285 *)
11286         dflt="$randfunc"
11287         ;;
11288 esac
11289 cont=true
11290
11291 case "$ccflags" in
11292 *-Dmy_rand=*|*-Dmy_srand=*)
11293         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
11294         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
11295         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
11296         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
11297         ;;
11298 esac
11299
11300 while $test "$cont"; do
11301         rp="Use which function to generate random numbers?"
11302         . ./myread
11303         if $test "$ans" = "$dflt"; then
11304                 : null
11305         else
11306                 randbits=''
11307         fi
11308         randfunc="$ans"
11309         if set $ans val -f; eval $csym; $val; then
11310                 cont=''
11311         else
11312                 dflt=y
11313                 rp="I cannot find function $ans. Use that name anyway?"
11314                 . ./myread
11315                 dflt=rand
11316                 case "$ans" in
11317                         [yY]*) cont='';;
11318                 esac
11319         fi
11320         case "$cont" in
11321         '')
11322                 case "$randfunc" in
11323                 drand48)
11324                         drand01="drand48()"
11325                         seedfunc="srand48"
11326                         randbits=48
11327                         randseedtype=long
11328                         ;;
11329                 rand|random)
11330                         case "$randbits" in
11331                         '')
11332 echo "Checking to see how many bits your $randfunc() function produces..." >&4
11333                                 $cat >try.c <<EOCP
11334 #$i_unistd I_UNISTD
11335 #$i_stdlib I_STDLIB
11336 #include <stdio.h>
11337 #ifdef I_UNISTD
11338 #  include <unistd.h>
11339 #endif
11340 #ifdef I_STDLIB
11341 #  include <stdlib.h>
11342 #endif
11343 int main()
11344 {
11345         register int i;
11346         register unsigned long tmp;
11347         register unsigned long max = 0L;
11348
11349         for (i = 1000; i; i--) {
11350                 tmp = (unsigned long) $randfunc();
11351                 if (tmp > max) max = tmp;
11352         }
11353         for (i = 0; max; i++)
11354                 max /= 2;
11355         printf("%d\n",i);
11356 }
11357 EOCP
11358                                 set try
11359                                 if eval $compile_ok; then
11360                                         dflt=`try`
11361                                 else
11362                                         dflt='?'
11363                                         echo "(I can't seem to compile the test program...)"
11364                                 fi
11365                                 ;;
11366                         *)
11367                                 dflt="$randbits"
11368                                 ;;
11369                         esac
11370                         rp="How many bits does your $randfunc() function produce?"
11371                         . ./myread
11372                         randbits="$ans"
11373                         $rm -f try.c try
11374                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11375                         seedfunc="s$randfunc"
11376                         randseedtype=unsigned
11377                         ;;
11378                 *)
11379                         dflt="31"
11380                         rp="How many bits does your $randfunc() function produce?"
11381                         . ./myread
11382                         randbits="$ans"
11383                         seedfunc="s$randfunc"
11384                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
11385                         if set $seedfunc val -f; eval $csym; $val; then
11386                                 echo "(Using $seedfunc() to seed random generator)"
11387                         else
11388                                 echo "(Warning: no $seedfunc() to seed random generator)"
11389                                 seedfunc=rand
11390                         fi
11391                         randseedtype=unsigned
11392                         ;;
11393                 esac
11394                 ;;
11395         esac
11396 done
11397
11398 echo " "
11399 echo "Determining whether or not we are on an EBCDIC system..." >&4
11400 $cat >tebcdic.c <<'EOM'
11401 int main()
11402 {
11403   if ('M'==0xd4) return 0;
11404   return 1;
11405 }
11406 EOM
11407
11408 val=$undef
11409 set tebcdic
11410 if eval $compile_ok; then
11411         if ./tebcdic; then
11412                 echo "You have EBCDIC." >&4
11413                 val="$define"
11414         else
11415                 echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin, or UTF." >&4
11416         fi
11417 else
11418         echo "I'm unable to compile the test program." >&4
11419         echo "I'll assume ASCII or some ISO Latin." >&4
11420 fi
11421 $rm -f tebcdic.c tebcdic
11422 set ebcdic
11423 eval $setvar
11424
11425 echo " "
11426 $cat >&4 <<EOM
11427 Checking how to flush all pending stdio output...
11428 EOM
11429 # I only know how to find the first 32 possibly open files on SunOS.
11430 # See also hints/sunos_4_1.sh and util.c  --AD
11431 case "$osname" in
11432 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
11433 esac
11434 $cat >>try.c <<EOCP
11435 #include <stdio.h>
11436 #$i_unistd I_UNISTD
11437 #ifdef I_UNISTD
11438 # include <unistd.h>
11439 #endif
11440 #$d_sysconf HAS_SYSCONF
11441 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
11442 #ifdef HAS_STDIO_STREAM_ARRAY
11443 # define STDIO_STREAM_ARRAY $stdio_stream_array
11444 #endif
11445 int main() {
11446   FILE* p = fopen("try.out", "w");
11447 #ifdef TRY_FPUTC
11448   fputc('x', p);
11449 #else
11450 # ifdef TRY_FPRINTF
11451   fprintf(p, "x");
11452 # endif
11453 #endif
11454 #ifdef TRY_FFLUSH_NULL
11455   fflush(NULL);
11456 #endif
11457 #ifdef TRY_FFLUSH_ALL
11458   {
11459     long open_max = -1;
11460 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
11461     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
11462 # else
11463 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
11464     open_max = sysconf(_SC_OPEN_MAX);
11465 #  else
11466 #   ifdef FOPEN_MAX
11467     open_max = FOPEN_MAX;
11468 #   else
11469 #    ifdef OPEN_MAX
11470     open_max = OPEN_MAX;
11471 #    else
11472 #     ifdef _NFILE
11473     open_max = _NFILE;
11474 #     endif
11475 #    endif
11476 #   endif
11477 #  endif
11478 # endif 
11479 # ifdef HAS_STDIO_STREAM_ARRAY
11480     if (open_max > 0) {
11481       long i;
11482       for (i = 0; i < open_max; i++)
11483             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
11484                 STDIO_STREAM_ARRAY[i]._file < open_max &&
11485                 STDIO_STREAM_ARRAY[i]._flag)
11486                 fflush(&STDIO_STREAM_ARRAY[i]);
11487     }   
11488   }
11489 # endif
11490 #endif
11491   _exit(42);
11492 }
11493 EOCP
11494 : first we have to find out how _not_ to flush
11495 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
11496     output=''
11497     set try -DTRY_FPUTC
11498     if eval $compile; then
11499             $rm -f try.out
11500             ./try$exe_ext 2>/dev/null
11501             if $test ! -s try.out -a "X$?" = X42; then
11502                 output=-DTRY_FPUTC
11503             fi
11504     fi
11505     case "$output" in
11506     '')
11507             set try -DTRY_FPRINTF
11508             $rm -f try.out
11509             if eval $compile; then
11510                     $rm -f try.out
11511                     ./try$exe_ext 2>/dev/null
11512                     if $test ! -s try.out -a "X$?" = X42; then
11513                         output=-DTRY_FPRINTF
11514                     fi
11515             fi
11516         ;;
11517     esac
11518 fi
11519 : check for fflush NULL behaviour
11520 case "$fflushNULL" in
11521 '')     set try -DTRY_FFLUSH_NULL $output
11522         if eval $compile; then
11523                 $rm -f try.out
11524                 ./try$exe_ext 2>/dev/null
11525                 code="$?"
11526                 if $test -s try.out -a "X$code" = X42; then
11527                         fflushNULL="`$cat try.out`"
11528                 else
11529                         if $test "X$code" != X42; then
11530                                 $cat >&4 <<EOM
11531 (If this test failed, don't worry, we'll try another method shortly.)
11532 EOM
11533                         fi
11534                 fi
11535         fi
11536         $rm -f core try.core core.try.*
11537         case "$fflushNULL" in
11538         x)      $cat >&4 <<EOM
11539 Your fflush(NULL) works okay.
11540 EOM
11541                 fflushNULL="$define"
11542                 ;;
11543         '')     $cat >&4 <<EOM
11544 Your fflush(NULL) isn't working (contrary to ANSI C).
11545 EOM
11546                 fflushNULL="$undef"
11547                 ;;
11548         *)      $cat >&4 <<EOM
11549 Cannot figure out whether your fflush(NULL) works or not.
11550 I'm assuming it doesn't (contrary to ANSI C).
11551 EOM
11552                 fflushNULL="$undef"
11553                 ;;
11554         esac
11555         ;;
11556 $define|true|[yY]*)
11557         fflushNULL="$define"
11558         ;;
11559 *)
11560         fflushNULL="$undef"
11561         ;;
11562 esac
11563 : check explicit looping only if NULL did not work
11564 case "$fflushNULL" in
11565 "$undef")
11566         : check for fflush all behaviour
11567         case "$fflushall" in
11568         '')     set try -DTRY_FFLUSH_ALL $output
11569                 if eval $compile; then
11570                         $cat >&4 <<EOM
11571 (Now testing the other method--but note that also this may fail.)
11572 EOM
11573                         $rm -f try.out
11574                         ./try$exe_ext 2>/dev/null
11575                         if $test -s try.out -a "X$?" = X42; then
11576                                 fflushall="`$cat try.out`"
11577                         fi
11578                 fi
11579                 $rm -f core try.core core.try.*
11580                 case "$fflushall" in
11581                 x)      $cat >&4 <<EOM
11582 Whew. Flushing explicitly all the stdio streams works.
11583 EOM
11584                         fflushall="$define"
11585                         ;;
11586                 '')     $cat >&4 <<EOM
11587 Sigh. Flushing explicitly all the stdio streams doesn't work.
11588 EOM
11589                         fflushall="$undef"
11590                         ;;
11591                 *)      $cat >&4 <<EOM
11592 Cannot figure out whether flushing stdio streams explicitly works or not.
11593 I'm assuming it doesn't.
11594 EOM
11595                         fflushall="$undef"
11596                         ;;
11597                 esac
11598                 ;;
11599         "$define"|true|[yY]*)
11600                 fflushall="$define"
11601                 ;;
11602         *)
11603                 fflushall="$undef"
11604                 ;;
11605         esac
11606         ;;
11607 *)      fflushall="$undef"      
11608         ;;
11609 esac
11610 case "$fflushNULL$fflushall" in
11611 undefundef)
11612         $cat <<EOM
11613 I cannot figure out how to flush pending stdio output.
11614 EOM
11615         ;;
11616 esac
11617 $rm -f try.* try$exe_ext
11618
11619 : see what type file positions are declared as in the library
11620 rp="What is the type for file position used by fsetpos()?"
11621 set fpos_t fpostype long stdio.h sys/types.h
11622 eval $typedef_ask
11623
11624 : Store the full pathname to the ar program for use in the C program
11625 : Respect a hint or command line value for full_ar.
11626 case "$full_ar" in
11627 '') full_ar=$ar ;;
11628 esac
11629
11630 : Store the full pathname to the sed program for use in the C program
11631 full_sed=$sed
11632
11633 : see what type gids are declared as in the kernel
11634 echo " "
11635 echo "Looking for the type for group ids returned by getgid()."
11636 set gid_t gidtype xxx stdio.h sys/types.h
11637 eval $typedef
11638 case "$gidtype" in
11639 xxx)
11640         xxx=`./findhdr sys/user.h`
11641         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
11642         case $1 in
11643         unsigned) dflt="$1 $2" ;;
11644         *) dflt="$1" ;;
11645         esac
11646         ;;
11647 *) dflt="$gidtype";;
11648 esac
11649 case "$gidtype" in
11650 gid_t) echo "gid_t found." ;;
11651 *)      rp="What is the type for group ids returned by getgid()?"
11652         . ./myread
11653         gidtype="$ans"
11654         ;;
11655 esac
11656
11657 : see if getgroups exists
11658 set getgroups d_getgrps
11659 eval $inlibc
11660
11661 : see if setgroups exists
11662 set setgroups d_setgrps
11663 eval $inlibc
11664
11665
11666 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
11667 echo " "
11668 case "$d_getgrps$d_setgrps" in
11669 *define*)
11670         case "$groupstype" in
11671         '') dflt="$gidtype" ;;
11672         *)  dflt="$groupstype" ;;
11673         esac
11674         $cat <<EOM
11675 What type of pointer is the second argument to getgroups() and setgroups()?
11676 Usually this is the same as group ids, $gidtype, but not always.
11677
11678 EOM
11679         rp='What type pointer is the second argument to getgroups() and setgroups()?'
11680         . ./myread
11681         groupstype="$ans"
11682         ;;
11683 *)  groupstype="$gidtype";;
11684 esac
11685
11686 : see what type lseek is declared as in the kernel
11687 rp="What is the type used for lseek's offset on this system?"
11688 set off_t lseektype long stdio.h sys/types.h
11689 eval $typedef_ask
11690
11691 echo " "
11692 $echo $n "Checking to see how big your file offsets are...$c" >&4
11693 $cat >try.c <<EOCP
11694 #include <sys/types.h>
11695 #include <stdio.h>
11696 int main()
11697 {
11698         printf("%d\n", sizeof($lseektype));
11699 }
11700 EOCP
11701 set try
11702 if eval $compile_ok; then
11703         lseeksize=`./try`
11704         $echo " $lseeksize bytes." >&4
11705 else
11706         dflt='4'
11707         echo " "
11708         echo "(I can't seem to compile the test program.  Guessing...)"
11709         rp="What is the size of your file offsets (in bytes)?"
11710         . ./myread
11711         lseeksize="$ans"
11712 fi
11713 $rm -f try.c try
11714
11715 echo " "
11716 echo "Checking if your $make program sets \$(MAKE)..." >&4
11717 case "$make_set_make" in
11718 '')
11719         $sed 's/^X //' > testmake.mak << 'EOF'
11720 Xall:
11721 X       @echo 'maketemp="$(MAKE)"'
11722 EOF
11723         case "`$make -f testmake.mak 2>/dev/null`" in
11724         *maketemp=*) make_set_make='#' ;;
11725         *)      make_set_make="MAKE=$make" ;;
11726         esac
11727         $rm -f testmake.mak
11728         ;;
11729 esac
11730 case "$make_set_make" in
11731 '#') echo "Yup, it does.";;
11732 *) echo "Nope, it doesn't.";;
11733 esac
11734
11735 : see what type is used for mode_t
11736 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
11737 set mode_t modetype int stdio.h sys/types.h
11738 eval $typedef_ask
11739
11740 : define a fucntion to check prototypes
11741 $cat > protochk <<EOSH
11742 $startsh
11743 cc="$cc"
11744 optimize="$optimize"
11745 ccflags="$ccflags"
11746 prototype="$prototype"
11747 define="$define"
11748 rm=$rm
11749 EOSH
11750
11751 $cat >> protochk <<'EOSH'
11752
11753 $rm -f try.c
11754 foo="$1"
11755 shift
11756 while test $# -ge 2; do
11757         case "$1" in
11758                 $define) echo "#include <$2>" >> try.c ;;
11759                 literal) echo "$2" >> try.c ;;
11760         esac
11761     shift 2
11762 done
11763 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
11764 cat >> try.c <<'EOCP'
11765 #ifdef CAN_PROTOTYPE
11766 #define _(args) args
11767 #else
11768 #define _(args) ()
11769 #endif
11770 EOCP
11771 echo "$foo" >> try.c
11772 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
11773 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
11774 status=$?
11775 $rm -f try.[co]
11776 exit $status
11777 EOSH
11778 chmod +x protochk
11779 $eunicefix protochk
11780
11781 : see what type is used for size_t
11782 rp="What is the type used for the length parameter for string functions?"
11783 set size_t sizetype 'unsigned int' stdio.h sys/types.h
11784 eval $typedef_ask
11785
11786 : check for type of arguments to gethostbyaddr. 
11787 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
11788         case "$d_gethbyaddr" in
11789         $define)
11790                 $cat <<EOM
11791
11792 Checking to see what type of arguments are accepted by gethostbyaddr().
11793 EOM
11794                 hdrs="$define sys/types.h
11795                         $d_socket sys/socket.h 
11796                         $i_niin netinet/in.h 
11797                         $i_netdb netdb.h
11798                         $i_unistd unistd.h"
11799                 : The first arg can 'char *' or 'void *'
11800                 : The second arg is some of integral type
11801                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
11802                         for yyy in size_t long int; do
11803                                 case "$netdb_host_type" in
11804                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
11805                                         if ./protochk "$try" $hdrs; then
11806                                                 echo "Your system accepts $xxx for the first arg."
11807                                                 echo "...and $yyy for the second arg."
11808                                                 netdb_host_type="$xxx"
11809                                                 netdb_hlen_type="$yyy"
11810                                         fi
11811                                         ;;
11812                                 esac
11813                         done
11814                 done
11815                 : In case none of those worked, prompt the user.
11816                 case "$netdb_host_type" in
11817                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
11818                         dflt='char *'
11819                         . ./myread
11820                         netdb_host_type=$ans
11821                         rp='What is the type for the 2nd argument to gethostbyaddr?'
11822                         dflt="$sizetype"
11823                         . ./myread
11824                         netdb_hlen_type=$ans
11825                         ;;
11826                 esac
11827                 ;;
11828         *)      : no gethostbyaddr, so pick harmless defaults
11829                 netdb_host_type='char *'
11830                 netdb_hlen_type="$sizetype"
11831                 ;;
11832         esac
11833         # Remove the "const" if needed. -- but then we'll have a 
11834         # prototype clash!
11835         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
11836 fi
11837
11838 : check for type of argument to gethostbyname. 
11839 if test "X$netdb_name_type" = X ; then
11840         case "$d_gethbyname" in
11841         $define)
11842                 $cat <<EOM
11843
11844 Checking to see what type of argument is accepted by gethostbyname().
11845 EOM
11846                 hdrs="$define sys/types.h
11847                         $d_socket sys/socket.h 
11848                         $i_niin netinet/in.h 
11849                         $i_netdb netdb.h
11850                         $i_unistd unistd.h"
11851                 for xxx in "const char *" "char *"; do
11852                         case "$netdb_name_type" in
11853                         '')     try="extern struct hostent *gethostbyname($xxx);"
11854                                 if ./protochk "$try" $hdrs; then
11855                                         echo "Your system accepts $xxx."
11856                                         netdb_name_type="$xxx"
11857                                 fi
11858                                 ;;
11859                         esac
11860                 done
11861                 : In case none of those worked, prompt the user.
11862                 case "$netdb_name_type" in
11863                 '')     rp='What is the type for the 1st argument to gethostbyname?'
11864                         dflt='char *'
11865                         . ./myread
11866                         netdb_name_type=$ans
11867                         ;;
11868                 esac
11869                 ;;
11870         *)      : no gethostbyname, so pick harmless default
11871                 netdb_name_type='char *'
11872                 ;;
11873         esac
11874 fi
11875
11876 : check for type of 1st argument to getnetbyaddr. 
11877 if test "X$netdb_net_type" = X ; then
11878         case "$d_getnbyaddr" in
11879         $define)
11880                 $cat <<EOM
11881
11882 Checking to see what type of 1st argument is accepted by getnetbyaddr().
11883 EOM
11884                 hdrs="$define sys/types.h
11885                         $d_socket sys/socket.h 
11886                         $i_niin netinet/in.h 
11887                         $i_netdb netdb.h
11888                         $i_unistd unistd.h"
11889                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
11890                         case "$netdb_net_type" in
11891                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
11892                                 if ./protochk "$try" $hdrs; then
11893                                         echo "Your system accepts $xxx."
11894                                         netdb_net_type="$xxx"
11895                                 fi
11896                                 ;;
11897                         esac
11898                 done
11899                 : In case none of those worked, prompt the user.
11900                 case "$netdb_net_type" in
11901                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
11902                         dflt='long'
11903                         . ./myread
11904                         netdb_net_type=$ans
11905                         ;;
11906                 esac
11907                 ;;
11908         *)      : no getnetbyaddr, so pick harmless default
11909                 netdb_net_type='long'
11910                 ;;
11911         esac
11912 fi
11913 : locate the preferred pager for this system
11914 case "$pager" in
11915 '')
11916         dflt=''
11917         case "$pg" in
11918         /*) dflt=$pg;;
11919         esac
11920         case "$more" in
11921         /*) dflt=$more;;
11922         esac
11923         case "$less" in
11924         /*) dflt=$less;;
11925         esac
11926         case "$dflt" in
11927         '') dflt=/usr/ucb/more;;
11928         esac
11929         ;;
11930 *) dflt="$pager";;
11931 esac
11932 echo " "
11933 fn=f/
11934 rp='What pager is used on your system?'
11935 . ./getfile
11936 pager="$ans"
11937
11938 : see what type pids are declared as in the kernel
11939 rp="What is the type of process ids on this system?"
11940 set pid_t pidtype int stdio.h sys/types.h
11941 eval $typedef_ask
11942
11943 : Find earliest binary compatible site_perl subdirectory perl can use.
11944 case "$bincompat5005" in
11945 "$define") xs_apiversion='5.005' ;;
11946 *) xs_apiversion=$apiversion ;;   # The current site_perl version.
11947 esac
11948 : Find earliest pure perl site_perl subdirectory perl can use.
11949 : The versioned directories started at 5.005.
11950 pm_apiversion='5.005'
11951
11952 : check for length of pointer
11953 echo " "
11954 case "$ptrsize" in
11955 '')
11956         $echo $n "Checking to see how big your pointers are...$c" >&4
11957         if test "$voidflags" -gt 7; then
11958                 echo '#define VOID_PTR char *' > try.c
11959         else
11960                 echo '#define VOID_PTR void *' > try.c
11961         fi
11962         $cat >>try.c <<'EOCP'
11963 #include <stdio.h>
11964 int main()
11965 {
11966         printf("%d\n", sizeof(VOID_PTR));
11967         exit(0);
11968 }
11969 EOCP
11970         set try
11971         if eval $compile_ok; then
11972                 ptrsize=`./try`
11973                 $echo " $ptrsize bytes." >&4
11974         else
11975                 dflt='4'
11976                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
11977                 rp="What is the size of a pointer (in bytes)?"
11978                 . ./myread
11979                 ptrsize="$ans"
11980         fi
11981         ;;
11982 esac
11983 $rm -f try.c try
11984
11985 : see if ar generates random libraries by itself
11986 echo " "
11987 echo "Checking how to generate random libraries on your machine..." >&4
11988 echo 'int bar1() { return bar2(); }' > bar1.c
11989 echo 'int bar2() { return 2; }' > bar2.c
11990 $cat > foo.c <<'EOP'
11991 int main() { printf("%d\n", bar1()); exit(0); }
11992 EOP
11993 $cc $ccflags -c bar1.c >/dev/null 2>&1
11994 $cc $ccflags -c bar2.c >/dev/null 2>&1
11995 $cc $ccflags -c foo.c >/dev/null 2>&1
11996 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
11997 if $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
11998         ./foobar >/dev/null 2>&1; then
11999         echo "$ar appears to generate random libraries itself."
12000         orderlib=false
12001         ranlib=":"
12002 elif $ar ts bar$_a >/dev/null 2>&1 &&
12003         $cc $ccflags $ldflags -o foobar foo$_o bar$_a $libs > /dev/null 2>&1 &&
12004         ./foobar >/dev/null 2>&1; then
12005                 echo "a table of contents needs to be added with '$ar ts'."
12006                 orderlib=false
12007                 ranlib="$ar ts"
12008 else
12009         case "$ranlib" in
12010         :) ranlib='';;
12011         '')
12012                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
12013                 $test -f $ranlib || ranlib=''
12014                 ;;
12015         esac
12016         if $test -n "$ranlib"; then
12017                 echo "your system has '$ranlib'; we'll use that."
12018                 orderlib=false
12019         else
12020                 echo "your system doesn't seem to support random libraries"
12021                 echo "so we'll use lorder and tsort to order the libraries."
12022                 orderlib=true
12023                 ranlib=":"
12024         fi
12025 fi
12026 $rm -f foo* bar* 
12027
12028 : check for type of arguments to select. 
12029 case "$selecttype" in
12030 '') case "$d_select" in
12031         $define)
12032                 $cat <<EOM
12033 Checking to see what type of arguments are accepted by select().
12034 EOM
12035                 hdrs="$define sys/types.h
12036                         $i_systime sys/time.h 
12037                         $i_sysselct sys/select.h
12038                         $d_socket sys/socket.h"
12039                 : The first arg can be int, unsigned, or size_t
12040                 : The last arg may or may not be 'const'
12041                 val=''
12042                 : void pointer has been seen but using that
12043                 : breaks the selectminbits test
12044                 for xxx in 'fd_set *' 'int *'; do
12045                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
12046                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
12047                                         case "$val" in
12048                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
12049                                                 if ./protochk "$try" $hdrs; then
12050                                                         echo "Your system accepts $xxx."
12051                                                         val="$xxx"
12052                                                 fi
12053                                                 ;;
12054                                         esac
12055                                 done
12056                         done
12057                 done
12058                 case "$val" in
12059                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
12060                         case "$d_fd_set" in
12061                                 $define) dflt="fd_set *" ;;
12062                                 *)              dflt="int *" ;;
12063                         esac
12064                         . ./myread
12065                         val=$ans
12066                         ;;
12067                 esac
12068                 selecttype="$val"
12069                 ;;
12070         *)      : no select, so pick a harmless default
12071                 selecttype='int *'
12072                 ;;
12073         esac
12074         ;;
12075 esac
12076
12077 : check for the select 'width'
12078 case "$selectminbits" in
12079 '') case "$d_select" in
12080         $define)
12081                 $cat <<EOM
12082
12083 Checking to see on how many bits at a time your select() operates...
12084 EOM
12085                 $cat >try.c <<EOCP
12086 #include <sys/types.h>
12087 #$i_time I_TIME
12088 #$i_systime I_SYS_TIME
12089 #$i_systimek I_SYS_TIME_KERNEL
12090 #ifdef I_TIME
12091 #   include <time.h>
12092 #endif
12093 #ifdef I_SYS_TIME
12094 #   ifdef I_SYS_TIME_KERNEL
12095 #       define KERNEL
12096 #   endif
12097 #   include <sys/time.h>
12098 #   ifdef I_SYS_TIME_KERNEL
12099 #       undef KERNEL
12100 #   endif
12101 #endif
12102 #$i_sysselct I_SYS_SELECT
12103 #ifdef I_SYS_SELECT
12104 #include <sys/select.h>
12105 #endif
12106 #$d_socket HAS_SOCKET
12107 #ifdef HAS_SOCKET
12108 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12109 #endif
12110 #include <stdio.h>
12111 $selecttype b;
12112 #define S sizeof(*(b))
12113 #define MINBITS 64
12114 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
12115 #define NBITS  (NBYTES * 8)
12116 int main() {
12117     char s[NBYTES];
12118     struct timeval t;
12119     int i;
12120     FILE* fp;
12121     int fd;
12122
12123     fclose(stdin);
12124     fp = fopen("try.c", "r");
12125     if (fp == 0)
12126       exit(1);
12127     fd = fileno(fp);
12128     if (fd < 0)
12129       exit(2);
12130     b = ($selecttype)s;
12131     for (i = 0; i < NBITS; i++)
12132         FD_SET(i, b);
12133     t.tv_sec  = 0;
12134     t.tv_usec = 0;
12135     select(fd + 1, b, 0, 0, &t);
12136     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
12137     printf("%d\n", i + 1);
12138     return 0;
12139 }
12140 EOCP
12141                 set try
12142                 if eval $compile_ok; then
12143                         selectminbits=`./try`
12144                         case "$selectminbits" in
12145                         '')     cat >&4 <<EOM
12146 Cannot figure out on how many bits at a time your select() operates.
12147 I'll play safe and guess it is 32 bits.
12148 EOM
12149                                 selectminbits=32
12150                                 bits="32 bits"
12151                                 ;;
12152                         1)      bits="1 bit" ;;
12153                         *)      bits="$selectminbits bits" ;;
12154                         esac
12155                         echo "Your select() operates on $bits at a time." >&4
12156                 else
12157                         rp='What is the minimum number of bits your select() operates on?'
12158                         case "$byteorder" in
12159                         1234|12345678)  dflt=32 ;;
12160                         *)              dflt=1  ;;
12161                         esac
12162                         . ./myread
12163                         val=$ans
12164                         selectminbits="$val"
12165                 fi
12166                 $rm -f try.* try
12167                 ;;
12168         *)      : no select, so pick a harmless default
12169                 selectminbits='32'
12170                 ;;
12171         esac
12172         ;;
12173 esac
12174
12175 : Trace out the files included by signal.h, then look for SIGxxx names.
12176 : Remove SIGARRAYSIZE used by HPUX.
12177 : Remove SIGSTKSIZE used by Linux.
12178 : Remove SIGSTKSZ used by Posix.
12179 : Remove SIGTYP void lines used by OS2.
12180 xxx=`echo '#include <signal.h>' |
12181         $cppstdin $cppminus $cppflags 2>/dev/null |
12182         $grep '^[       ]*#.*include' | 
12183         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`
12184 : Check this list of files to be sure we have parsed the cpp output ok.
12185 : This will also avoid potentially non-existent files, such 
12186 : as ../foo/bar.h
12187 xxxfiles=''
12188 for xx in $xxx /dev/null ; do
12189         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
12190 done
12191 : If we have found no files, at least try signal.h
12192 case "$xxxfiles" in
12193 '')     xxxfiles=`./findhdr signal.h` ;;
12194 esac
12195 xxx=`awk '
12196 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
12197         print substr($2, 4, 20)
12198 }
12199 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
12200         print substr($3, 4, 20)
12201 }' $xxxfiles`
12202 : Append some common names just in case the awk scan failed.
12203 xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL"
12204 xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP"
12205 xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM"
12206 xxx="$xxx WINCH WIND WINDOW XCPU XFSZ"
12207 : generate a few handy files for later
12208 $cat > signal.c <<'EOCP'
12209 #include <sys/types.h>
12210 #include <signal.h>
12211 #include <stdio.h>
12212 int main() {
12213
12214 /* Strange style to avoid deeply-nested #if/#else/#endif */
12215 #ifndef NSIG
12216 #  ifdef _NSIG
12217 #    define NSIG (_NSIG)
12218 #  endif
12219 #endif
12220
12221 #ifndef NSIG
12222 #  ifdef SIGMAX
12223 #    define NSIG (SIGMAX+1)
12224 #  endif
12225 #endif
12226
12227 #ifndef NSIG
12228 #  ifdef SIG_MAX
12229 #    define NSIG (SIG_MAX+1)
12230 #  endif
12231 #endif
12232
12233 #ifndef NSIG
12234 #  ifdef MAXSIG
12235 #    define NSIG (MAXSIG+1)
12236 #  endif
12237 #endif
12238
12239 #ifndef NSIG
12240 #  ifdef MAX_SIG
12241 #    define NSIG (MAX_SIG+1)
12242 #  endif
12243 #endif
12244
12245 #ifndef NSIG
12246 #  ifdef SIGARRAYSIZE
12247 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
12248 #  endif
12249 #endif
12250
12251 #ifndef NSIG
12252 #  ifdef _sys_nsig
12253 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
12254 #  endif
12255 #endif
12256
12257 /* Default to some arbitrary number that's big enough to get most
12258    of the common signals.
12259 */
12260 #ifndef NSIG
12261 #    define NSIG 50
12262 #endif
12263
12264 printf("NSIG %d\n", NSIG);
12265
12266 #ifndef JUST_NSIG
12267
12268 EOCP
12269
12270 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
12271 {
12272         printf "#ifdef SIG"; printf $1; printf "\n"
12273         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
12274         printf $1; printf ");\n"
12275         printf "#endif\n"
12276 }
12277 END {
12278         printf "#endif /* JUST_NSIG */\n";
12279         printf "}\n";
12280 }
12281 ' >>signal.c
12282 $cat >signal.awk <<'EOP'
12283 BEGIN { ndups = 0 }
12284 $1 ~ /^NSIG$/ { nsig = $2 }
12285 ($1 !~ /^NSIG$/) && (NF == 2) {
12286     if ($2 > maxsig) { maxsig = $2 }
12287     if (sig_name[$2]) {
12288         dup_name[ndups] = $1
12289         dup_num[ndups] = $2
12290         ndups++ 
12291     }
12292     else {
12293         sig_name[$2] = $1
12294         sig_num[$2] = $2
12295     }
12296 }
12297 END { 
12298     if (nsig == 0) {
12299         nsig = maxsig + 1
12300     }
12301     printf("NSIG %d\n", nsig);
12302     for (n = 1; n < nsig; n++) {
12303         if (sig_name[n]) {
12304             printf("%s %d\n", sig_name[n], sig_num[n])
12305         }
12306         else {
12307             printf("NUM%d %d\n", n, n) 
12308         }
12309     }
12310     for (n = 0; n < ndups; n++) {
12311         printf("%s %d\n", dup_name[n], dup_num[n])
12312     }
12313 }
12314 EOP
12315 $cat >signal_cmd <<EOS
12316 $startsh
12317 if $test -s signal.lst; then
12318     echo "Using your existing signal.lst file"
12319         exit 0
12320 fi
12321 xxx="$xxx"
12322 EOS
12323 $cat >>signal_cmd <<'EOS'
12324
12325 set signal
12326 if eval $compile_ok; then
12327         ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12328 else
12329         echo "(I can't seem be able to compile the whole test program)" >&4
12330         echo "(I'll try it in little pieces.)" >&4
12331         set signal -DJUST_NSIG
12332         if eval $compile_ok; then
12333                 ./signal$_exe > signal.nsg
12334                 $cat signal.nsg
12335         else
12336                 echo "I can't seem to figure out how many signals you have." >&4
12337                 echo "Guessing 50." >&4
12338                 echo 'NSIG 50' > signal.nsg
12339         fi
12340         : Now look at all the signal names, one at a time.
12341         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
12342                 $cat > signal.c <<EOCP
12343 #include <sys/types.h>
12344 #include <signal.h>
12345 #include <stdio.h>
12346 int main() {
12347 printf("$xx %d\n", SIG${xx});
12348 return 0;
12349 }
12350 EOCP
12351                 set signal
12352                 if eval $compile; then
12353                         echo "SIG${xx} found."
12354                         ./signal$_exe  >> signal.ls1
12355                 else
12356                         echo "SIG${xx} NOT found."
12357                 fi
12358         done
12359         if $test -s signal.ls1; then
12360                 $cat signal.nsg signal.ls1 |
12361                         $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
12362         fi
12363
12364 fi
12365 if $test -s signal.lst; then
12366         :
12367 else
12368         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
12369         echo 'kill -l' >signal
12370         set X `csh -f <signal`
12371         $rm -f signal
12372         shift
12373         case $# in
12374         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
12375         esac
12376         echo $@ | $tr ' ' $trnl | \
12377             $awk '{ printf "%s %d\n", $1, ++s; }
12378                   END { printf "NSIG %d\n", ++s }' >signal.lst
12379 fi
12380 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
12381 EOS
12382 chmod a+x signal_cmd
12383 $eunicefix signal_cmd
12384
12385 : generate list of signal names
12386 echo " "
12387 case "$sig_name_init" in
12388 '') doinit=yes ;;
12389 *)  case "$sig_num_init" in
12390     ''|*,*) doinit=yes ;;
12391     esac ;;
12392 esac
12393 case "$doinit" in
12394 yes)
12395         echo "Generating a list of signal names and numbers..." >&4
12396         . ./signal_cmd
12397         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
12398         sig_name=`$awk 'BEGIN { printf "ZERO " }
12399                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
12400         sig_num=`$awk  'BEGIN { printf "0 " }
12401                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
12402         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
12403                              !/^NSIG/   { printf "\"%s\", ", $1 }
12404                              END        { printf "0\n" }' signal.lst`
12405         sig_num_init=`$awk  'BEGIN      { printf "0, " }
12406                              !/^NSIG/   { printf "%d, ", $2}
12407                              END        { printf "0\n"}' signal.lst`
12408         ;;
12409 esac
12410 echo "The following $sig_count signals are available:"
12411 echo " "
12412 echo $sig_name | $awk \
12413 'BEGIN { linelen = 0 }
12414 {
12415         for (i = 1; i <= NF; i++) {
12416                 name = "SIG" $i " "
12417                 linelen = linelen + length(name)
12418                 if (linelen > 70) {
12419                         printf "\n"
12420                         linelen = length(name)
12421                 }
12422                 printf "%s", name
12423         }
12424         printf "\n"
12425 }'
12426 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
12427
12428 : see what type is used for signed size_t
12429 set ssize_t ssizetype int stdio.h sys/types.h
12430 eval $typedef
12431 dflt="$ssizetype"
12432 $cat > ssize.c <<EOM
12433 #include <stdio.h>
12434 #include <sys/types.h>
12435 #define Size_t $sizetype
12436 #define SSize_t $dflt
12437 int main()
12438 {
12439         if (sizeof(Size_t) == sizeof(SSize_t))
12440                 printf("$dflt\n");
12441         else if (sizeof(Size_t) == sizeof(int))
12442                 printf("int\n");
12443         else 
12444                 printf("long\n");
12445         exit(0);
12446 }
12447 EOM
12448 echo " "
12449 set ssize
12450 if eval $compile_ok && ./ssize > /dev/null; then
12451         ssizetype=`./ssize`
12452         echo "I'll be using $ssizetype for functions returning a byte count." >&4
12453 else
12454         $cat >&4 <<EOM
12455 Help! I can't compile and run the ssize_t test program: please enlighten me!
12456 (This is probably a misconfiguration in your system or libraries, and
12457 you really ought to fix it.  Still, I'll try anyway.)
12458
12459 I need a type that is the same size as $sizetype, but is guaranteed to
12460 be signed.  Common values are ssize_t, int and long.
12461
12462 EOM
12463         rp="What signed type is the same size as $sizetype?"
12464         . ./myread
12465         ssizetype="$ans"
12466 fi
12467 $rm -f ssize ssize.*
12468
12469 : see what type of char stdio uses.
12470 echo " "
12471 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12472         echo "Your stdio uses unsigned chars." >&4
12473         stdchar="unsigned char"
12474 else
12475         echo "Your stdio uses signed chars." >&4
12476         stdchar="char"
12477 fi
12478
12479 : see if time exists
12480 echo " "
12481 if test "X$d_time" = X -o X"$timetype" = X; then
12482     if set time val -f d_time; eval $csym; $val; then
12483                 echo 'time() found.' >&4
12484                 val="$define"
12485                 rp="What is the type returned by time() on this system?"
12486                 set time_t timetype long stdio.h sys/types.h
12487                 eval $typedef_ask
12488     else
12489                 echo 'time() not found, hope that will do.' >&4
12490                 val="$undef"
12491                 timetype='int';
12492     fi
12493     set d_time
12494     eval $setvar
12495 fi
12496
12497 : see what type uids are declared as in the kernel
12498 echo " "
12499 echo "Looking for the type for user ids returned by getuid()."
12500 set uid_t uidtype xxx stdio.h sys/types.h
12501 eval $typedef
12502 case "$uidtype" in
12503 xxx)
12504         xxx=`./findhdr sys/user.h`
12505         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
12506         case $1 in
12507         unsigned) dflt="$1 $2" ;;
12508         *) dflt="$1" ;;
12509         esac
12510         ;;
12511 *) dflt="$uidtype";;
12512 esac
12513 case "$uidtype" in
12514 uid_t)  echo "uid_t found." ;;
12515 *)      rp="What is the type for user ids returned by getuid()?"
12516         . ./myread
12517         uidtype="$ans"
12518         ;;
12519 esac
12520
12521 : see if dbm.h is available
12522 : see if dbmclose exists
12523 set dbmclose d_dbmclose
12524 eval $inlibc
12525
12526 case "$d_dbmclose" in
12527 $define)
12528         set dbm.h i_dbm
12529         eval $inhdr
12530         case "$i_dbm" in
12531         $define)
12532                 val="$undef"
12533                 set i_rpcsvcdbm
12534                 eval $setvar
12535                 ;;
12536         *)      set rpcsvc/dbm.h i_rpcsvcdbm
12537                 eval $inhdr
12538                 ;;
12539         esac
12540         ;;
12541 *)      echo "We won't be including <dbm.h>"
12542         val="$undef"
12543         set i_dbm
12544         eval $setvar
12545         val="$undef"
12546         set i_rpcsvcdbm
12547         eval $setvar
12548         ;;
12549 esac
12550
12551 : see if this is a sys/file.h system
12552 val=''
12553 set sys/file.h val
12554 eval $inhdr
12555
12556 : do we need to include sys/file.h ?
12557 case "$val" in
12558 "$define")
12559         echo " "
12560         if $h_sysfile; then
12561                 val="$define"
12562                 echo "We'll be including <sys/file.h>." >&4
12563         else
12564                 val="$undef"
12565                 echo "We won't be including <sys/file.h>." >&4
12566         fi
12567         ;;
12568 *)
12569         h_sysfile=false
12570         ;;
12571 esac
12572 set i_sysfile
12573 eval $setvar
12574
12575 : see if fcntl.h is there
12576 val=''
12577 set fcntl.h val
12578 eval $inhdr
12579
12580 : see if we can include fcntl.h
12581 case "$val" in
12582 "$define")
12583         echo " "
12584         if $h_fcntl; then
12585                 val="$define"
12586                 echo "We'll be including <fcntl.h>." >&4
12587         else
12588                 val="$undef"
12589                 if $h_sysfile; then
12590         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12591                 else
12592                         echo "We won't be including <fcntl.h>." >&4
12593                 fi
12594         fi
12595         ;;
12596 *)
12597         h_fcntl=false
12598         val="$undef"
12599         ;;
12600 esac
12601 set i_fcntl
12602 eval $setvar
12603
12604 : see if locale.h is available
12605 set locale.h i_locale
12606 eval $inhdr
12607
12608 : see if mach cthreads are available
12609 if test "X$usethreads" = "X$define"; then
12610         set mach/cthreads.h i_machcthr
12611         eval $inhdr
12612 else
12613         i_machcthr="$undef"
12614 fi
12615
12616
12617
12618 : see if this is a math.h system
12619 set math.h i_math
12620 eval $inhdr
12621
12622 : see if this is a mntent.h system
12623 set mntent.h i_mntent
12624 eval $inhdr
12625
12626 : see if ndbm.h is available
12627 set ndbm.h t_ndbm
12628 eval $inhdr
12629 case "$t_ndbm" in
12630 $define)
12631         : see if dbm_open exists
12632         set dbm_open d_dbm_open
12633         eval $inlibc
12634         case "$d_dbm_open" in
12635         $undef)
12636                 t_ndbm="$undef"
12637                 echo "We won't be including <ndbm.h>"
12638                 ;;
12639         esac
12640         ;;
12641 esac
12642 val="$t_ndbm"
12643 set i_ndbm
12644 eval $setvar
12645
12646 : see if net/errno.h is available
12647 val=''
12648 set net/errno.h val
12649 eval $inhdr
12650
12651 : Unfortunately, it causes problems on some systems.  Arrgh.
12652 case "$val" in
12653 $define)
12654         cat > try.c <<'EOM'
12655 #include <stdio.h>
12656 #include <errno.h>
12657 #include <net/errno.h>
12658 int func()
12659 {
12660         return ENOTSOCK;
12661 }
12662 EOM
12663         if $cc $ccflags -c try.c >/dev/null 2>&1; then
12664                 echo "We'll be including <net/errno.h>." >&4
12665         else
12666                 echo "We won't be including <net/errno.h>." >&4
12667                 val="$undef"
12668         fi
12669         $rm -f try.* try
12670         ;;
12671 esac
12672 set i_neterrno
12673 eval $setvar
12674
12675 : see if netinet/tcp.h is available
12676 set netinet/tcp.h i_netinettcp
12677 eval $inhdr
12678
12679 : see if this is a poll.h system
12680 set poll.h i_poll
12681 eval $inhdr
12682
12683 : get C preprocessor symbols handy
12684 echo " "
12685 $echo $n "Hmm... $c"
12686 echo $al | $tr ' ' $trnl >Cppsym.know
12687 $cat <<EOSS >Cppsym
12688 $startsh
12689 case "\$1" in
12690 -l) list=true
12691         shift
12692         ;;
12693 esac
12694 unknown=''
12695 case "\$list\$#" in
12696 1|2)
12697         for sym do
12698                 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
12699                         exit 0
12700                 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
12701                         :
12702                 else
12703                         unknown="\$unknown \$sym"
12704                 fi
12705         done
12706         set X \$unknown
12707         shift
12708         ;;
12709 esac
12710 case \$# in
12711 0) exit 1;;
12712 esac
12713 echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
12714 #ifdef \1\\
12715 exit 0; _ _ _ _\1\\      \1\\
12716 #endif\\
12717 /' >Cppsym\$\$
12718 echo "exit 1; _ _ _" >>Cppsym\$\$
12719 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _'  >Cppsym2\$\$
12720 case "\$list" in
12721 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
12722 *)
12723         sh Cppsym2\$\$
12724         status=\$?
12725         ;;
12726 esac
12727 $rm -f Cppsym\$\$ Cppsym2\$\$
12728 exit \$status
12729 EOSS
12730 chmod +x Cppsym
12731 $eunicefix Cppsym
12732 ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true
12733
12734 : now check the C compiler for additional symbols
12735 postprocess_cc_v=''
12736 case "$osname" in
12737 aix) postprocess_cc_v="|$tr , ' '" ;;
12738 esac
12739 $cat >ccsym <<EOS
12740 $startsh
12741 $cat >tmp.c <<EOF
12742 extern int foo;
12743 EOF
12744 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
12745 do
12746         case "\$i" in
12747         -D*) echo "\$i" | $sed 's/^-D//';;
12748         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';;
12749         esac
12750 done
12751 $rm -f try.c
12752 EOS
12753 postprocess_cc_v=''
12754 chmod +x ccsym
12755 $eunicefix ccsym
12756 ./ccsym > ccsym1.raw
12757 if $test -s ccsym1.raw; then
12758        $sort ccsym1.raw | $uniq >ccsym.raw
12759 else
12760        mv ccsym1.raw ccsym.raw
12761 fi
12762
12763 $awk '/\=/ { print $0; next }
12764         { print $0"=1" }' ccsym.raw >ccsym.list
12765 $awk '{ print $0"=1" }' Cppsym.true >ccsym.true
12766 $comm -13 ccsym.true ccsym.list >ccsym.own
12767 $comm -12 ccsym.true ccsym.list >ccsym.com
12768 $comm -23 ccsym.true ccsym.list >ccsym.cpp
12769 also=''
12770 if $test -z ccsym.raw; then
12771         echo "Your C compiler doesn't seem to define any symbols!" >&4
12772         echo " "
12773         echo "However, your C preprocessor defines the following symbols:"
12774         $cat Cppsym.true
12775         ccsymbols=''
12776         cppsymbols=`$cat Cppsym.true`
12777         cppsymbols=`echo $cppsymbols`
12778         cppccsymbols="$cppsymbols"
12779 else
12780         if $test -s ccsym.com; then
12781                 echo "Your C compiler and pre-processor define these symbols:"
12782                 $sed -e 's/\(.*\)=.*/\1/' ccsym.com
12783                 also='also '
12784                 symbols='ones'
12785                 cppccsymbols=`$cat ccsym.com`
12786                 cppccsymbols=`echo $cppccsymbols`
12787                 $test "$silent" || sleep 1
12788         fi
12789         if $test -s ccsym.cpp; then
12790                 $test "$also" && echo " "
12791                 echo "Your C pre-processor ${also}defines the following symbols:"
12792                 $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp
12793                 also='further '
12794                 cppsymbols=`$cat ccsym.cpp`
12795                 cppsymbols=`echo $cppsymbols`
12796                 $test "$silent" || sleep 1
12797         fi
12798         if $test -s ccsym.own; then
12799                 $test "$also" && echo " "
12800                 echo "Your C compiler ${also}defines the following cpp symbols:"
12801                 $sed -e 's/\(.*\)=1/\1/' ccsym.own
12802                 $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
12803                 ccsymbols=`$cat ccsym.own`
12804                 ccsymbols=`echo $ccsymbols`
12805                 $test "$silent" || sleep 1
12806         fi
12807 fi
12808 $rm -f ccsym*
12809
12810 : see if this is a termio system
12811 val="$undef"
12812 val2="$undef"
12813 val3="$undef"
12814 if $test `./findhdr termios.h`; then
12815         set tcsetattr i_termios
12816         eval $inlibc
12817         val3="$i_termios"
12818 fi
12819 echo " "
12820 case "$val3" in
12821 "$define") echo "You have POSIX termios.h... good!" >&4;;
12822 *) if ./Cppsym pyr; then
12823                 case "`/bin/universe`" in
12824                 ucb) if $test `./findhdr sgtty.h`; then
12825                                 val2="$define"
12826                                 echo "<sgtty.h> found." >&4
12827                         else
12828                                 echo "System is pyramid with BSD universe."
12829                                 echo "<sgtty.h> not found--you could have problems." >&4
12830                         fi;;
12831                 *) if $test `./findhdr termio.h`; then
12832                                 val="$define"
12833                                 echo "<termio.h> found." >&4
12834                         else
12835                                 echo "System is pyramid with USG universe."
12836                                 echo "<termio.h> not found--you could have problems." >&4
12837                         fi;;
12838                 esac
12839         elif ./usg; then
12840                 if $test `./findhdr termio.h`; then
12841                         echo "<termio.h> found." >&4
12842                         val="$define"
12843                 elif $test `./findhdr sgtty.h`; then
12844                         echo "<sgtty.h> found." >&4
12845                         val2="$define"
12846                 else
12847 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
12848                 fi
12849         else
12850                 if $test `./findhdr sgtty.h`; then
12851                         echo "<sgtty.h> found." >&4
12852                         val2="$define"
12853                 elif $test `./findhdr termio.h`; then
12854                         echo "<termio.h> found." >&4
12855                         val="$define"
12856                 else
12857 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
12858                 fi
12859         fi;;
12860 esac
12861 set i_termio; eval $setvar
12862 val=$val2; set i_sgtty; eval $setvar
12863 val=$val3; set i_termios; eval $setvar
12864
12865 : see if this is a shadow.h system
12866 set shadow.h i_shadow
12867 eval $inhdr
12868
12869 : see if this is a socks.h system
12870 set socks.h i_socks
12871 eval $inhdr
12872
12873 : see if stdarg is available
12874 echo " "
12875 if $test `./findhdr stdarg.h`; then
12876         echo "<stdarg.h> found." >&4
12877         valstd="$define"
12878 else
12879         echo "<stdarg.h> NOT found." >&4
12880         valstd="$undef"
12881 fi
12882
12883 : see if varags is available
12884 echo " "
12885 if $test `./findhdr varargs.h`; then
12886         echo "<varargs.h> found." >&4
12887 else
12888         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
12889 fi
12890
12891 : set up the varargs testing programs
12892 $cat > varargs.c <<EOP
12893 #ifdef I_STDARG
12894 #include <stdarg.h>
12895 #endif
12896 #ifdef I_VARARGS
12897 #include <varargs.h>
12898 #endif
12899
12900 #ifdef I_STDARG
12901 int f(char *p, ...)
12902 #else
12903 int f(va_alist)
12904 va_dcl
12905 #endif
12906 {
12907         va_list ap;
12908 #ifndef I_STDARG
12909         char *p;
12910 #endif
12911 #ifdef I_STDARG
12912         va_start(ap,p);
12913 #else
12914         va_start(ap);
12915         p = va_arg(ap, char *);
12916 #endif
12917         va_end(ap);
12918 }
12919 EOP
12920 $cat > varargs <<EOP
12921 $startsh
12922 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
12923         echo "true"
12924 else
12925         echo "false"
12926 fi
12927 $rm -f varargs$_o
12928 EOP
12929 chmod +x varargs
12930
12931 : now check which varargs header should be included
12932 echo " "
12933 i_varhdr=''
12934 case "$valstd" in
12935 "$define")
12936         if `./varargs I_STDARG`; then
12937                 val='stdarg.h'
12938         elif `./varargs I_VARARGS`; then
12939                 val='varargs.h'
12940         fi
12941         ;;
12942 *)
12943         if `./varargs I_VARARGS`; then
12944                 val='varargs.h'
12945         fi
12946         ;;
12947 esac
12948 case "$val" in
12949 '')
12950 echo "I could not find the definition for va_dcl... You have problems..." >&4
12951         val="$undef"; set i_stdarg; eval $setvar
12952         val="$undef"; set i_varargs; eval $setvar
12953         ;;
12954 *) 
12955         set i_varhdr
12956         eval $setvar
12957         case "$i_varhdr" in
12958         stdarg.h)
12959                 val="$define"; set i_stdarg; eval $setvar
12960                 val="$undef"; set i_varargs; eval $setvar
12961                 ;;
12962         varargs.h)
12963                 val="$undef"; set i_stdarg; eval $setvar
12964                 val="$define"; set i_varargs; eval $setvar
12965                 ;;
12966         esac
12967         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
12968 esac
12969 $rm -f varargs*
12970
12971 : see if stddef is available
12972 set stddef.h i_stddef
12973 eval $inhdr
12974
12975 : see if sys/access.h is available
12976 set sys/access.h i_sysaccess
12977 eval $inhdr
12978
12979 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
12980 set sys/filio.h i_sysfilio
12981 eval $inhdr
12982 echo " "
12983 if $test `./findhdr sys/ioctl.h`; then
12984         val="$define"
12985         echo '<sys/ioctl.h> found.' >&4
12986 else
12987         val="$undef"
12988         if $test $i_sysfilio = "$define"; then
12989             echo '<sys/ioctl.h> NOT found.' >&4
12990         else
12991                 $test $i_sgtty = "$define" && xxx="sgtty.h"
12992                 $test $i_termio = "$define" && xxx="termio.h"
12993                 $test $i_termios = "$define" && xxx="termios.h"
12994 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
12995         fi
12996 fi
12997 set i_sysioctl
12998 eval $setvar
12999
13000 : see if sys/resource.h has to be included
13001 set sys/resource.h i_sysresrc
13002 eval $inhdr
13003
13004 : see if sys/security.h is available
13005 set sys/security.h i_syssecrt
13006 eval $inhdr
13007
13008 : see if this is a sys/statvfs.h system
13009 set sys/statvfs.h i_sysstatvfs
13010 eval $inhdr
13011
13012 : see if this is a sys/un.h system
13013 set sys/un.h i_sysun
13014 eval $inhdr
13015
13016 : see if this is a syswait system
13017 set sys/wait.h i_syswait
13018 eval $inhdr
13019
13020 : see if this is an utime system
13021 set utime.h i_utime
13022 eval $inhdr
13023
13024 : see if this is a values.h system
13025 set values.h i_values
13026 eval $inhdr
13027
13028 : see if this is a vfork system
13029 case "$d_vfork" in
13030 "$define")
13031         set vfork.h i_vfork
13032         eval $inhdr
13033         ;;
13034 *)
13035         i_vfork="$undef"
13036         ;;
13037 esac
13038
13039 : see if gdbm.h is available
13040 set gdbm.h t_gdbm
13041 eval $inhdr
13042 case "$t_gdbm" in
13043 $define)
13044         : see if gdbm_open exists
13045         set gdbm_open d_gdbm_open
13046         eval $inlibc
13047         case "$d_gdbm_open" in
13048         $undef)
13049                 t_gdbm="$undef"
13050                 echo "We won't be including <gdbm.h>"
13051                 ;;
13052         esac
13053         ;;
13054 esac
13055 val="$t_gdbm"
13056 set i_gdbm
13057 eval $setvar
13058
13059 echo " "
13060 echo "Looking for extensions..." >&4
13061 : If we are using the old config.sh, known_extensions may contain
13062 : old or inaccurate or duplicate values.
13063 known_extensions=''
13064 nonxs_extensions=''
13065 : We do not use find because it might not be available.
13066 : We do not just use MANIFEST because the user may have dropped
13067 : some additional extensions into the source tree and expect them
13068 : to be built.
13069
13070 : Function to recursively find available extensions, ignoring DynaLoader
13071 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
13072 find_extensions='
13073     for xxx in *; do
13074        case "$xxx" in
13075            DynaLoader|dynaload) ;;
13076            *)
13077            if $test -f $xxx/$xxx.xs; then
13078                known_extensions="$known_extensions $1$xxx";
13079            elif $test -f $xxx/Makefile.PL; then
13080                nonxs_extensions="$nonxs_extensions $1$xxx";
13081            else
13082                if $test -d $xxx -a $# -lt 10; then
13083                    set $1$xxx/ $*;
13084                    cd $xxx;
13085                    eval $find_extensions;
13086                    cd ..;
13087                    shift;
13088                fi;
13089            fi
13090            ;;
13091        esac;
13092     done'
13093 tdir=`pwd`
13094 cd $rsrc/ext
13095 set X
13096 shift
13097 eval $find_extensions
13098 set X $nonxs_extensions
13099 shift
13100 nonxs_extensions="$*"
13101 set X $known_extensions
13102 shift
13103 known_extensions="$*"
13104 cd $tdir
13105
13106 : Now see which are supported on this system.
13107 avail_ext=''
13108 for xxx in $known_extensions ; do
13109         case "$xxx" in
13110         DB_File|db_file)
13111                 case "$i_db" in
13112                 $define) avail_ext="$avail_ext $xxx" ;;
13113                 esac
13114                 ;;
13115         GDBM_File|gdbm_fil)
13116                 case "$i_gdbm" in 
13117                 $define) avail_ext="$avail_ext $xxx" ;;
13118                 esac
13119                 ;;
13120         NDBM_File|ndbm_fil)
13121                 case "$i_ndbm" in
13122                 $define) avail_ext="$avail_ext $xxx" ;;
13123                 esac
13124                 ;;
13125         ODBM_File|odbm_fil) 
13126                 case "${i_dbm}${i_rpcsvcdbm}" in
13127                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13128                 esac
13129                 ;;
13130         POSIX|posix)
13131                 case "$useposix" in
13132                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13133                 esac
13134                 ;;
13135         Opcode|opcode)
13136                 case "$useopcode" in
13137                 true|define|y) avail_ext="$avail_ext $xxx" ;;
13138                 esac
13139                 ;;
13140         Socket|socket)
13141                 case "$d_socket" in 
13142                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13143                 esac
13144                 ;;
13145         Thread|thread)
13146                 case "$usethreads" in 
13147                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
13148                 esac
13149                 ;;
13150         IPC/SysV|ipc/sysv)
13151                 : XXX Do we need a useipcsysv variable here
13152                 case "${d_msg}${d_sem}${d_shm}" in 
13153                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
13154                 esac
13155                 ;;
13156         *)      avail_ext="$avail_ext $xxx"
13157                 ;;
13158         esac
13159 done
13160
13161 set X $avail_ext
13162 shift
13163 avail_ext="$*"
13164
13165 : Now see which nonxs extensions are supported on this system.
13166 : For now assume all are.
13167 nonxs_ext=''
13168 for xxx in $nonxs_extensions ; do
13169         case "$xxx" in
13170         *)      nonxs_ext="$nonxs_ext $xxx"
13171                 ;;
13172         esac
13173 done
13174
13175 set X $nonxs_ext
13176 shift
13177 nonxs_ext="$*"
13178
13179 case $usedl in
13180 $define)
13181         $cat <<EOM
13182 A number of extensions are supplied with $package.  You may choose to
13183 compile these extensions for dynamic loading (the default), compile
13184 them into the $package executable (static loading), or not include
13185 them at all.  Answer "none" to include no extensions.
13186 Note that DynaLoader is always built and need not be mentioned here.
13187
13188 EOM
13189         case "$dynamic_ext" in
13190         '') dflt="$avail_ext" ;;
13191         *)      dflt="$dynamic_ext"
13192                 # Perhaps we are reusing an old out-of-date config.sh.
13193                 case "$hint" in
13194                 previous)
13195                         if test X"$dynamic_ext" != X"$avail_ext"; then
13196                                 $cat <<EOM
13197 NOTICE:  Your previous config.sh list may be incorrect. 
13198 The extensions now available to you are 
13199         ${avail_ext}
13200 but the default list from your previous config.sh is
13201         ${dynamic_ext} 
13202
13203 EOM
13204                         fi
13205                         ;;
13206                 esac
13207                 ;;
13208         esac
13209         case "$dflt" in
13210         '')     dflt=none;;
13211         esac
13212         rp="What extensions do you wish to load dynamically?"
13213         . ./myread
13214         case "$ans" in
13215         none) dynamic_ext=' ' ;;
13216         *) dynamic_ext="$ans" ;;
13217         esac
13218
13219         case "$static_ext" in
13220         '')
13221                 : Exclude those already listed in dynamic linking
13222                 dflt=''
13223                 for xxx in $avail_ext; do
13224                         case " $dynamic_ext " in
13225                         *" $xxx "*) ;;
13226                         *) dflt="$dflt $xxx" ;;
13227                         esac
13228                 done
13229                 set X $dflt
13230                 shift
13231                 dflt="$*"
13232                 ;;
13233         *)  dflt="$static_ext" 
13234                 ;;
13235         esac
13236
13237         case "$dflt" in
13238         '')     dflt=none;;
13239         esac
13240         rp="What extensions do you wish to load statically?"
13241         . ./myread
13242         case "$ans" in
13243         none) static_ext=' ' ;;
13244         *) static_ext="$ans" ;;
13245         esac
13246         ;;
13247 *)
13248         $cat <<EOM
13249 A number of extensions are supplied with $package.  Answer "none" 
13250 to include no extensions. 
13251 Note that DynaLoader is always built and need not be mentioned here.
13252
13253 EOM
13254         case "$static_ext" in
13255         '') dflt="$avail_ext" ;;
13256         *)      dflt="$static_ext"
13257                 # Perhaps we are reusing an old out-of-date config.sh.
13258                 case "$hint" in
13259                 previous)
13260                         if test X"$static_ext" != X"$avail_ext"; then
13261                                 $cat <<EOM
13262 NOTICE:  Your previous config.sh list may be incorrect. 
13263 The extensions now available to you are 
13264         ${avail_ext}
13265 but the default list from your previous config.sh is
13266         ${static_ext} 
13267
13268 EOM
13269                         fi
13270                         ;;
13271                 esac
13272                 ;;
13273         esac
13274         : Exclude those that are not xs extensions
13275         case "$dflt" in
13276         '')     dflt=none;;
13277         esac
13278         rp="What extensions do you wish to include?"
13279         . ./myread
13280         case "$ans" in
13281         none) static_ext=' ' ;;
13282         *) static_ext="$ans" ;;
13283         esac
13284         ;;
13285 esac
13286
13287 set X $dynamic_ext $static_ext $nonxs_ext
13288 shift
13289 extensions="$*"
13290
13291 : Remove build directory name from cppstdin so it can be used from
13292 : either the present location or the final installed location.
13293 echo " "
13294 : Get out of the UU directory to get correct path name.
13295 cd ..
13296 case "$cppstdin" in
13297 `pwd`/cppstdin)
13298         echo "Stripping down cppstdin path name"
13299         cppstdin=cppstdin
13300         ;;
13301 esac
13302 cd UU
13303
13304 : end of configuration questions
13305 echo " "
13306 echo "End of configuration questions."
13307 echo " "
13308
13309 : back to where it started
13310 if test -d ../UU; then
13311         cd ..
13312 fi
13313
13314 : configuration may be patched via a 'config.over' file
13315 if $test -f config.over; then
13316         echo " "
13317         dflt=y
13318         rp='I see a config.over file.  Do you wish to load it?'
13319         . UU/myread
13320         case "$ans" in
13321         n*) echo "OK, I'll ignore it.";;
13322         *)      . ./config.over
13323                 echo "Configuration override changes have been loaded."
13324                 ;;
13325         esac
13326 fi
13327
13328 : in case they want portability, strip down executable paths
13329 case "$d_portable" in
13330 "$define")
13331         echo " "
13332         echo "Stripping down executable paths..." >&4
13333         for file in $loclist $trylist; do
13334                 eval temp=\$$file
13335                 eval $file=`basename $temp`
13336         done
13337         ;;
13338 esac
13339
13340 : create config.sh file
13341 echo " "
13342 echo "Creating config.sh..." >&4
13343 $spitshell <<EOT >config.sh
13344 $startsh
13345 #
13346 # This file was produced by running the Configure script. It holds all the
13347 # definitions figured out by Configure. Should you modify one of these values,
13348 # do not forget to propagate your changes by running "Configure -der". You may
13349 # instead choose to run each of the .SH files by yourself, or "Configure -S".
13350 #
13351
13352 # Package name      : $package
13353 # Source directory  : $src
13354 # Configuration time: $cf_time
13355 # Configured by     : $cf_by
13356 # Target system     : $myuname
13357
13358 Author='$Author'
13359 Date='$Date'
13360 Header='$Header'
13361 Id='$Id'
13362 Locker='$Locker'
13363 Log='$Log'
13364 Mcc='$Mcc'
13365 RCSfile='$RCSfile'
13366 Revision='$Revision'
13367 Source='$Source'
13368 State='$State'
13369 _a='$_a'
13370 _exe='$_exe'
13371 _o='$_o'
13372 afs='$afs'
13373 alignbytes='$alignbytes'
13374 ansi2knr='$ansi2knr'
13375 aphostname='$aphostname'
13376 apiversion='$apiversion'
13377 ar='$ar'
13378 archlib='$archlib'
13379 archlibexp='$archlibexp'
13380 archname64='$archname64'
13381 archname='$archname'
13382 archobjs='$archobjs'
13383 awk='$awk'
13384 baserev='$baserev'
13385 bash='$bash'
13386 bin='$bin'
13387 bincompat5005='$bincompat5005'
13388 binexp='$binexp'
13389 bison='$bison'
13390 byacc='$byacc'
13391 byteorder='$byteorder'
13392 c='$c'
13393 castflags='$castflags'
13394 cat='$cat'
13395 cc='$cc'
13396 cccdlflags='$cccdlflags'
13397 ccdlflags='$ccdlflags'
13398 ccflags='$ccflags'
13399 ccsymbols='$ccsymbols'
13400 cf_by='$cf_by'
13401 cf_email='$cf_email'
13402 cf_time='$cf_time'
13403 chgrp='$chgrp'
13404 chmod='$chmod'
13405 chown='$chown'
13406 clocktype='$clocktype'
13407 comm='$comm'
13408 compress='$compress'
13409 contains='$contains'
13410 cp='$cp'
13411 cpio='$cpio'
13412 cpp='$cpp'
13413 cpp_stuff='$cpp_stuff'
13414 cppccsymbols='$cppccsymbols'
13415 cppflags='$cppflags'
13416 cpplast='$cpplast'
13417 cppminus='$cppminus'
13418 cpprun='$cpprun'
13419 cppstdin='$cppstdin'
13420 cppsymbols='$cppsymbols'
13421 crosscompile='$crosscompile'
13422 cryptlib='$cryptlib'
13423 csh='$csh'
13424 d_Gconvert='$d_Gconvert'
13425 d_PRIEldbl='$d_PRIEldbl'
13426 d_PRIFldbl='$d_PRIFldbl'
13427 d_PRIGldbl='$d_PRIGldbl'
13428 d_PRIX64='$d_PRIX64'
13429 d_PRId64='$d_PRId64'
13430 d_PRIeldbl='$d_PRIeldbl'
13431 d_PRIfldbl='$d_PRIfldbl'
13432 d_PRIgldbl='$d_PRIgldbl'
13433 d_PRIi64='$d_PRIi64'
13434 d_PRIo64='$d_PRIo64'
13435 d_PRIu64='$d_PRIu64'
13436 d_PRIx64='$d_PRIx64'
13437 d_access='$d_access'
13438 d_accessx='$d_accessx'
13439 d_alarm='$d_alarm'
13440 d_archlib='$d_archlib'
13441 d_atolf='$d_atolf'
13442 d_atoll='$d_atoll'
13443 d_attribut='$d_attribut'
13444 d_bcmp='$d_bcmp'
13445 d_bcopy='$d_bcopy'
13446 d_bincompat5005='$d_bincompat5005'
13447 d_bsd='$d_bsd'
13448 d_bsdgetpgrp='$d_bsdgetpgrp'
13449 d_bsdsetpgrp='$d_bsdsetpgrp'
13450 d_bzero='$d_bzero'
13451 d_casti32='$d_casti32'
13452 d_castneg='$d_castneg'
13453 d_charvspr='$d_charvspr'
13454 d_chown='$d_chown'
13455 d_chroot='$d_chroot'
13456 d_chsize='$d_chsize'
13457 d_closedir='$d_closedir'
13458 d_cmsghdr_s='$d_cmsghdr_s'
13459 d_const='$d_const'
13460 d_crypt='$d_crypt'
13461 d_csh='$d_csh'
13462 d_cuserid='$d_cuserid'
13463 d_dbl_dig='$d_dbl_dig'
13464 d_difftime='$d_difftime'
13465 d_dirnamlen='$d_dirnamlen'
13466 d_dlerror='$d_dlerror'
13467 d_dlopen='$d_dlopen'
13468 d_dlsymun='$d_dlsymun'
13469 d_dosuid='$d_dosuid'
13470 d_drand48proto='$d_drand48proto'
13471 d_dup2='$d_dup2'
13472 d_eaccess='$d_eaccess'
13473 d_endgrent='$d_endgrent'
13474 d_endhent='$d_endhent'
13475 d_endnent='$d_endnent'
13476 d_endpent='$d_endpent'
13477 d_endpwent='$d_endpwent'
13478 d_endsent='$d_endsent'
13479 d_endspent='$d_endspent'
13480 d_eofnblk='$d_eofnblk'
13481 d_eunice='$d_eunice'
13482 d_fchmod='$d_fchmod'
13483 d_fchown='$d_fchown'
13484 d_fcntl='$d_fcntl'
13485 d_fd_macros='$d_fd_macros'
13486 d_fd_set='$d_fd_set'
13487 d_fds_bits='$d_fds_bits'
13488 d_fgetpos='$d_fgetpos'
13489 d_flexfnam='$d_flexfnam'
13490 d_flock='$d_flock'
13491 d_fork='$d_fork'
13492 d_fpathconf='$d_fpathconf'
13493 d_fpos64_t='$d_fpos64_t'
13494 d_fseeko='$d_fseeko'
13495 d_fsetpos='$d_fsetpos'
13496 d_fstatfs='$d_fstatfs'
13497 d_fstatvfs='$d_fstatvfs'
13498 d_ftello='$d_ftello'
13499 d_ftime='$d_ftime'
13500 d_getgrent='$d_getgrent'
13501 d_getgrps='$d_getgrps'
13502 d_gethbyaddr='$d_gethbyaddr'
13503 d_gethbyname='$d_gethbyname'
13504 d_gethent='$d_gethent'
13505 d_gethname='$d_gethname'
13506 d_gethostprotos='$d_gethostprotos'
13507 d_getlogin='$d_getlogin'
13508 d_getmntent='$d_getmntent'
13509 d_getnbyaddr='$d_getnbyaddr'
13510 d_getnbyname='$d_getnbyname'
13511 d_getnent='$d_getnent'
13512 d_getnetprotos='$d_getnetprotos'
13513 d_getpbyname='$d_getpbyname'
13514 d_getpbynumber='$d_getpbynumber'
13515 d_getpent='$d_getpent'
13516 d_getpgid='$d_getpgid'
13517 d_getpgrp2='$d_getpgrp2'
13518 d_getpgrp='$d_getpgrp'
13519 d_getppid='$d_getppid'
13520 d_getprior='$d_getprior'
13521 d_getprotoprotos='$d_getprotoprotos'
13522 d_getpwent='$d_getpwent'
13523 d_getsbyname='$d_getsbyname'
13524 d_getsbyport='$d_getsbyport'
13525 d_getsent='$d_getsent'
13526 d_getservprotos='$d_getservprotos'
13527 d_getspent='$d_getspent'
13528 d_getspnam='$d_getspnam'
13529 d_gettimeod='$d_gettimeod'
13530 d_gnulibc='$d_gnulibc'
13531 d_grpasswd='$d_grpasswd'
13532 d_hasmntopt='$d_hasmntopt'
13533 d_htonl='$d_htonl'
13534 d_index='$d_index'
13535 d_inetaton='$d_inetaton'
13536 d_int64t='$d_int64t'
13537 d_iovec_s='$d_iovec_s'
13538 d_isascii='$d_isascii'
13539 d_killpg='$d_killpg'
13540 d_lchown='$d_lchown'
13541 d_ldbl_dig='$d_ldbl_dig'
13542 d_link='$d_link'
13543 d_llseek='$d_llseek'
13544 d_locconv='$d_locconv'
13545 d_lockf='$d_lockf'
13546 d_longdbl='$d_longdbl'
13547 d_longlong='$d_longlong'
13548 d_lstat='$d_lstat'
13549 d_madvise='$d_madvise'
13550 d_mblen='$d_mblen'
13551 d_mbstowcs='$d_mbstowcs'
13552 d_mbtowc='$d_mbtowc'
13553 d_memchr='$d_memchr'
13554 d_memcmp='$d_memcmp'
13555 d_memcpy='$d_memcpy'
13556 d_memmove='$d_memmove'
13557 d_memset='$d_memset'
13558 d_mkdir='$d_mkdir'
13559 d_mkfifo='$d_mkfifo'
13560 d_mktime='$d_mktime'
13561 d_mmap='$d_mmap'
13562 d_mprotect='$d_mprotect'
13563 d_msg='$d_msg'
13564 d_msg_ctrunc='$d_msg_ctrunc'
13565 d_msg_dontroute='$d_msg_dontroute'
13566 d_msg_oob='$d_msg_oob'
13567 d_msg_peek='$d_msg_peek'
13568 d_msg_proxy='$d_msg_proxy'
13569 d_msgctl='$d_msgctl'
13570 d_msgget='$d_msgget'
13571 d_msghdr_s='$d_msghdr_s'
13572 d_msgrcv='$d_msgrcv'
13573 d_msgsnd='$d_msgsnd'
13574 d_msync='$d_msync'
13575 d_munmap='$d_munmap'
13576 d_mymalloc='$d_mymalloc'
13577 d_nice='$d_nice'
13578 d_off64_t='$d_off64_t'
13579 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
13580 d_oldpthreads='$d_oldpthreads'
13581 d_oldsock='$d_oldsock'
13582 d_open3='$d_open3'
13583 d_pathconf='$d_pathconf'
13584 d_pause='$d_pause'
13585 d_phostname='$d_phostname'
13586 d_pipe='$d_pipe'
13587 d_poll='$d_poll'
13588 d_portable='$d_portable'
13589 d_pthread_yield='$d_pthread_yield'
13590 d_pwage='$d_pwage'
13591 d_pwchange='$d_pwchange'
13592 d_pwclass='$d_pwclass'
13593 d_pwcomment='$d_pwcomment'
13594 d_pwexpire='$d_pwexpire'
13595 d_pwgecos='$d_pwgecos'
13596 d_pwpasswd='$d_pwpasswd'
13597 d_pwquota='$d_pwquota'
13598 d_readdir='$d_readdir'
13599 d_readlink='$d_readlink'
13600 d_readv='$d_readv'
13601 d_recvmsg='$d_recvmsg'
13602 d_rename='$d_rename'
13603 d_rewinddir='$d_rewinddir'
13604 d_rmdir='$d_rmdir'
13605 d_safebcpy='$d_safebcpy'
13606 d_safemcpy='$d_safemcpy'
13607 d_sanemcmp='$d_sanemcmp'
13608 d_sched_yield='$d_sched_yield'
13609 d_scm_rights='$d_scm_rights'
13610 d_seekdir='$d_seekdir'
13611 d_select='$d_select'
13612 d_sem='$d_sem'
13613 d_semctl='$d_semctl'
13614 d_semctl_semid_ds='$d_semctl_semid_ds'
13615 d_semctl_semun='$d_semctl_semun'
13616 d_semget='$d_semget'
13617 d_semop='$d_semop'
13618 d_sendmsg='$d_sendmsg'
13619 d_setegid='$d_setegid'
13620 d_seteuid='$d_seteuid'
13621 d_setgrent='$d_setgrent'
13622 d_setgrps='$d_setgrps'
13623 d_sethent='$d_sethent'
13624 d_setlinebuf='$d_setlinebuf'
13625 d_setlocale='$d_setlocale'
13626 d_setnent='$d_setnent'
13627 d_setpent='$d_setpent'
13628 d_setpgid='$d_setpgid'
13629 d_setpgrp2='$d_setpgrp2'
13630 d_setpgrp='$d_setpgrp'
13631 d_setprior='$d_setprior'
13632 d_setpwent='$d_setpwent'
13633 d_setregid='$d_setregid'
13634 d_setresgid='$d_setresgid'
13635 d_setresuid='$d_setresuid'
13636 d_setreuid='$d_setreuid'
13637 d_setrgid='$d_setrgid'
13638 d_setruid='$d_setruid'
13639 d_setsent='$d_setsent'
13640 d_setsid='$d_setsid'
13641 d_setspent='$d_setspent'
13642 d_setvbuf='$d_setvbuf'
13643 d_sfio='$d_sfio'
13644 d_shm='$d_shm'
13645 d_shmat='$d_shmat'
13646 d_shmatprototype='$d_shmatprototype'
13647 d_shmctl='$d_shmctl'
13648 d_shmdt='$d_shmdt'
13649 d_shmget='$d_shmget'
13650 d_sigaction='$d_sigaction'
13651 d_sigsetjmp='$d_sigsetjmp'
13652 d_socket='$d_socket'
13653 d_sockpair='$d_sockpair'
13654 d_statblks='$d_statblks'
13655 d_statfs='$d_statfs'
13656 d_statfsflags='$d_statfsflags'
13657 d_statvfs='$d_statvfs'
13658 d_stdio_cnt_lval='$d_stdio_cnt_lval'
13659 d_stdio_ptr_lval='$d_stdio_ptr_lval'
13660 d_stdio_stream_array='$d_stdio_stream_array'
13661 d_stdiobase='$d_stdiobase'
13662 d_stdstdio='$d_stdstdio'
13663 d_strchr='$d_strchr'
13664 d_strcoll='$d_strcoll'
13665 d_strctcpy='$d_strctcpy'
13666 d_strerrm='$d_strerrm'
13667 d_strerror='$d_strerror'
13668 d_strtod='$d_strtod'
13669 d_strtol='$d_strtol'
13670 d_strtoul='$d_strtoul'
13671 d_strtoull='$d_strtoull'
13672 d_strxfrm='$d_strxfrm'
13673 d_suidsafe='$d_suidsafe'
13674 d_symlink='$d_symlink'
13675 d_syscall='$d_syscall'
13676 d_sysconf='$d_sysconf'
13677 d_sysernlst='$d_sysernlst'
13678 d_syserrlst='$d_syserrlst'
13679 d_system='$d_system'
13680 d_tcgetpgrp='$d_tcgetpgrp'
13681 d_tcsetpgrp='$d_tcsetpgrp'
13682 d_telldir='$d_telldir'
13683 d_telldirproto='$d_telldirproto'
13684 d_time='$d_time'
13685 d_times='$d_times'
13686 d_truncate='$d_truncate'
13687 d_tzname='$d_tzname'
13688 d_umask='$d_umask'
13689 d_uname='$d_uname'
13690 d_union_semun='$d_union_semun'
13691 d_vendorlib='$d_vendorlib'
13692 d_vfork='$d_vfork'
13693 d_void_closedir='$d_void_closedir'
13694 d_voidsig='$d_voidsig'
13695 d_voidtty='$d_voidtty'
13696 d_volatile='$d_volatile'
13697 d_vprintf='$d_vprintf'
13698 d_wait4='$d_wait4'
13699 d_waitpid='$d_waitpid'
13700 d_wcstombs='$d_wcstombs'
13701 d_wctomb='$d_wctomb'
13702 d_writev='$d_writev'
13703 d_xenix='$d_xenix'
13704 date='$date'
13705 db_hashtype='$db_hashtype'
13706 db_prefixtype='$db_prefixtype'
13707 defvoidused='$defvoidused'
13708 direntrytype='$direntrytype'
13709 dlext='$dlext'
13710 dlsrc='$dlsrc'
13711 doublesize='$doublesize'
13712 drand01='$drand01'
13713 dynamic_ext='$dynamic_ext'
13714 eagain='$eagain'
13715 ebcdic='$ebcdic'
13716 echo='$echo'
13717 egrep='$egrep'
13718 emacs='$emacs'
13719 eunicefix='$eunicefix'
13720 exe_ext='$exe_ext'
13721 expr='$expr'
13722 extensions='$extensions'
13723 fflushNULL='$fflushNULL'
13724 fflushall='$fflushall'
13725 find='$find'
13726 firstmakefile='$firstmakefile'
13727 flex='$flex'
13728 fpostype='$fpostype'
13729 freetype='$freetype'
13730 full_ar='$full_ar'
13731 full_csh='$full_csh'
13732 full_sed='$full_sed'
13733 gccversion='$gccversion'
13734 gidtype='$gidtype'
13735 glibpth='$glibpth'
13736 grep='$grep'
13737 groupcat='$groupcat'
13738 groupstype='$groupstype'
13739 gzip='$gzip'
13740 h_fcntl='$h_fcntl'
13741 h_sysfile='$h_sysfile'
13742 hint='$hint'
13743 hostcat='$hostcat'
13744 huge='$huge'
13745 i_arpainet='$i_arpainet'
13746 i_bsdioctl='$i_bsdioctl'
13747 i_db='$i_db'
13748 i_dbm='$i_dbm'
13749 i_dirent='$i_dirent'
13750 i_dld='$i_dld'
13751 i_dlfcn='$i_dlfcn'
13752 i_fcntl='$i_fcntl'
13753 i_float='$i_float'
13754 i_gdbm='$i_gdbm'
13755 i_grp='$i_grp'
13756 i_inttypes='$i_inttypes'
13757 i_limits='$i_limits'
13758 i_locale='$i_locale'
13759 i_machcthr='$i_machcthr'
13760 i_malloc='$i_malloc'
13761 i_math='$i_math'
13762 i_memory='$i_memory'
13763 i_mntent='$i_mntent'
13764 i_ndbm='$i_ndbm'
13765 i_netdb='$i_netdb'
13766 i_neterrno='$i_neterrno'
13767 i_netinettcp='$i_netinettcp'
13768 i_niin='$i_niin'
13769 i_poll='$i_poll'
13770 i_pthread='$i_pthread'
13771 i_pwd='$i_pwd'
13772 i_rpcsvcdbm='$i_rpcsvcdbm'
13773 i_sfio='$i_sfio'
13774 i_sgtty='$i_sgtty'
13775 i_shadow='$i_shadow'
13776 i_socks='$i_socks'
13777 i_stdarg='$i_stdarg'
13778 i_stddef='$i_stddef'
13779 i_stdlib='$i_stdlib'
13780 i_string='$i_string'
13781 i_sysaccess='$i_sysaccess'
13782 i_sysdir='$i_sysdir'
13783 i_sysfile='$i_sysfile'
13784 i_sysfilio='$i_sysfilio'
13785 i_sysin='$i_sysin'
13786 i_sysioctl='$i_sysioctl'
13787 i_sysmman='$i_sysmman'
13788 i_sysmount='$i_sysmount'
13789 i_sysndir='$i_sysndir'
13790 i_sysparam='$i_sysparam'
13791 i_sysresrc='$i_sysresrc'
13792 i_syssecrt='$i_syssecrt'
13793 i_sysselct='$i_sysselct'
13794 i_syssockio='$i_syssockio'
13795 i_sysstat='$i_sysstat'
13796 i_sysstatvfs='$i_sysstatvfs'
13797 i_systime='$i_systime'
13798 i_systimek='$i_systimek'
13799 i_systimes='$i_systimes'
13800 i_systypes='$i_systypes'
13801 i_sysuio='$i_sysuio'
13802 i_sysun='$i_sysun'
13803 i_syswait='$i_syswait'
13804 i_termio='$i_termio'
13805 i_termios='$i_termios'
13806 i_time='$i_time'
13807 i_unistd='$i_unistd'
13808 i_utime='$i_utime'
13809 i_values='$i_values'
13810 i_varargs='$i_varargs'
13811 i_varhdr='$i_varhdr'
13812 i_vfork='$i_vfork'
13813 ignore_versioned_solibs='$ignore_versioned_solibs'
13814 incpath='$incpath'
13815 inews='$inews'
13816 installarchlib='$installarchlib'
13817 installbin='$installbin'
13818 installman1dir='$installman1dir'
13819 installman3dir='$installman3dir'
13820 installprefix='$installprefix'
13821 installprefixexp='$installprefixexp'
13822 installprivlib='$installprivlib'
13823 installscript='$installscript'
13824 installsitearch='$installsitearch'
13825 installsitelib='$installsitelib'
13826 installstyle='$installstyle'
13827 installusrbinperl='$installusrbinperl'
13828 installvendorlib='$installvendorlib'
13829 intsize='$intsize'
13830 known_extensions='$known_extensions'
13831 ksh='$ksh'
13832 large='$large'
13833 ld='$ld'
13834 lddlflags='$lddlflags'
13835 ldflags='$ldflags'
13836 ldlibpthname='$ldlibpthname'
13837 less='$less'
13838 lib_ext='$lib_ext'
13839 libc='$libc'
13840 libperl='$libperl'
13841 libpth='$libpth'
13842 libs='$libs'
13843 libswanted='$libswanted'
13844 line='$line'
13845 lint='$lint'
13846 lkflags='$lkflags'
13847 ln='$ln'
13848 lns='$lns'
13849 locincpth='$locincpth'
13850 loclibpth='$loclibpth'
13851 longdblsize='$longdblsize'
13852 longlongsize='$longlongsize'
13853 longsize='$longsize'
13854 lp='$lp'
13855 lpr='$lpr'
13856 ls='$ls'
13857 lseeksize='$lseeksize'
13858 lseektype='$lseektype'
13859 mail='$mail'
13860 mailx='$mailx'
13861 make='$make'
13862 make_set_make='$make_set_make'
13863 mallocobj='$mallocobj'
13864 mallocsrc='$mallocsrc'
13865 malloctype='$malloctype'
13866 man1dir='$man1dir'
13867 man1direxp='$man1direxp'
13868 man1ext='$man1ext'
13869 man3dir='$man3dir'
13870 man3direxp='$man3direxp'
13871 man3ext='$man3ext'
13872 medium='$medium'
13873 mips='$mips'
13874 mips_type='$mips_type'
13875 mkdir='$mkdir'
13876 mmaptype='$mmaptype'
13877 models='$models'
13878 modetype='$modetype'
13879 more='$more'
13880 multiarch='$multiarch'
13881 mv='$mv'
13882 myarchname='$myarchname'
13883 mydomain='$mydomain'
13884 myhostname='$myhostname'
13885 myuname='$myuname'
13886 n='$n'
13887 netdb_hlen_type='$netdb_hlen_type'
13888 netdb_host_type='$netdb_host_type'
13889 netdb_name_type='$netdb_name_type'
13890 netdb_net_type='$netdb_net_type'
13891 nm='$nm'
13892 nm_opt='$nm_opt'
13893 nm_so_opt='$nm_so_opt'
13894 nonxs_ext='$nonxs_ext'
13895 nroff='$nroff'
13896 o_nonblock='$o_nonblock'
13897 obj_ext='$obj_ext'
13898 old_pthread_create_joinable='$old_pthread_create_joinable'
13899 optimize='$optimize'
13900 orderlib='$orderlib'
13901 osname='$osname'
13902 osvers='$osvers'
13903 package='$package'
13904 pager='$pager'
13905 passcat='$passcat'
13906 patchlevel='$patchlevel'
13907 path_sep='$path_sep'
13908 perl='$perl'
13909 perladmin='$perladmin'
13910 perlpath='$perlpath'
13911 pg='$pg'
13912 phostname='$phostname'
13913 pidtype='$pidtype'
13914 plibpth='$plibpth'
13915 pm_apiversion='$pm_apiversion'
13916 pmake='$pmake'
13917 pr='$pr'
13918 prefix='$prefix'
13919 prefixexp='$prefixexp'
13920 privlib='$privlib'
13921 privlibexp='$privlibexp'
13922 prototype='$prototype'
13923 ptrsize='$ptrsize'
13924 randbits='$randbits'
13925 randfunc='$randfunc'
13926 randseedtype='$randseedtype'
13927 ranlib='$ranlib'
13928 rd_nodata='$rd_nodata'
13929 rm='$rm'
13930 rmail='$rmail'
13931 runnm='$runnm'
13932 sPRIEldbl='$sPRIEldbl'
13933 sPRIFldbl='$sPRIFldbl'
13934 sPRIGldbl='$sPRIGldbl'
13935 sPRIX64='$sPRIX64'
13936 sPRId64='$sPRId64'
13937 sPRIeldbl='$sPRIeldbl'
13938 sPRIfldbl='$sPRIfldbl'
13939 sPRIgldbl='$sPRIgldbl'
13940 sPRIi64='$sPRIi64'
13941 sPRIo64='$sPRIo64'
13942 sPRIu64='$sPRIu64'
13943 sPRIx64='$sPRIx64'
13944 sched_yield='$sched_yield'
13945 scriptdir='$scriptdir'
13946 scriptdirexp='$scriptdirexp'
13947 sed='$sed'
13948 seedfunc='$seedfunc'
13949 selectminbits='$selectminbits'
13950 selecttype='$selecttype'
13951 sendmail='$sendmail'
13952 sh='$sh'
13953 shar='$shar'
13954 sharpbang='$sharpbang'
13955 shmattype='$shmattype'
13956 shortsize='$shortsize'
13957 shrpenv='$shrpenv'
13958 shsharp='$shsharp'
13959 sig_count='$sig_count'
13960 sig_name='$sig_name'
13961 sig_name_init='$sig_name_init'
13962 sig_num='$sig_num'
13963 sig_num_init='$sig_num_init'
13964 signal_t='$signal_t'
13965 sitearch='$sitearch'
13966 sitearchexp='$sitearchexp'
13967 sitelib='$sitelib'
13968 sitelibexp='$sitelibexp'
13969 siteprefix='$siteprefix'
13970 siteprefixexp='$siteprefixexp'
13971 sizetype='$sizetype'
13972 sleep='$sleep'
13973 smail='$smail'
13974 small='$small'
13975 so='$so'
13976 sockethdr='$sockethdr'
13977 socketlib='$socketlib'
13978 sort='$sort'
13979 spackage='$spackage'
13980 spitshell='$spitshell'
13981 split='$split'
13982 src='$src'
13983 ssizetype='$ssizetype'
13984 startperl='$startperl'
13985 startsh='$startsh'
13986 static_ext='$static_ext'
13987 stdchar='$stdchar'
13988 stdio_base='$stdio_base'
13989 stdio_bufsiz='$stdio_bufsiz'
13990 stdio_cnt='$stdio_cnt'
13991 stdio_filbuf='$stdio_filbuf'
13992 stdio_ptr='$stdio_ptr'
13993 stdio_stream_array='$stdio_stream_array'
13994 strings='$strings'
13995 submit='$submit'
13996 subversion='$subversion'
13997 sysman='$sysman'
13998 tail='$tail'
13999 tar='$tar'
14000 tbl='$tbl'
14001 tee='$tee'
14002 test='$test'
14003 timeincl='$timeincl'
14004 timetype='$timetype'
14005 touch='$touch'
14006 tr='$tr'
14007 trnl='$trnl'
14008 troff='$troff'
14009 uidtype='$uidtype'
14010 uname='$uname'
14011 uniq='$uniq'
14012 use64bits='$use64bits'
14013 usedl='$usedl'
14014 uselargefiles='$uselargefiles'
14015 uselongdouble='$uselongdouble'
14016 usemorebits='$usemorebits'
14017 usemultiplicity='$usemultiplicity'
14018 usemymalloc='$usemymalloc'
14019 usenm='$usenm'
14020 useopcode='$useopcode'
14021 useperlio='$useperlio'
14022 useposix='$useposix'
14023 usesfio='$usesfio'
14024 useshrplib='$useshrplib'
14025 usesocks='$usesocks'
14026 usethreads='$usethreads'
14027 usevendorprefix='$usevendorprefix'
14028 usevfork='$usevfork'
14029 usrinc='$usrinc'
14030 uuname='$uuname'
14031 vendorlib='$vendorlib'
14032 vendorlibexp='$vendorlibexp'
14033 vendorprefix='$vendorprefix'
14034 vendorprefixexp='$vendorprefixexp'
14035 version='$version'
14036 vi='$vi'
14037 voidflags='$voidflags'
14038 xlibpth='$xlibpth'
14039 xs_apiversion='$xs_apiversion'
14040 zcat='$zcat'
14041 zip='$zip'
14042 EOT
14043
14044 : Add in command line options if available
14045 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
14046
14047 : add special variables
14048 $test -f $src/patchlevel.h && \
14049 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
14050 echo "CONFIGDOTSH=true" >>config.sh
14051
14052 : propagate old symbols
14053 if $test -f UU/config.sh; then
14054         <UU/config.sh sort | uniq >UU/oldconfig.sh
14055         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
14056         sort | uniq -u >UU/oldsyms
14057         set X `cat UU/oldsyms`
14058         shift
14059         case $# in
14060         0) ;;
14061         *)
14062                 cat <<EOM
14063 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
14064 EOM
14065                 echo "# Variables propagated from previous config.sh file." >>config.sh
14066                 for sym in `cat UU/oldsyms`; do
14067                         echo "    Propagating $hint variable "'$'"$sym..."
14068                         eval 'tmp="$'"${sym}"'"'
14069                         echo "$tmp" | \
14070                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
14071                 done
14072                 ;;
14073         esac
14074 fi
14075
14076 : Finish up by extracting the .SH files
14077 case "$alldone" in
14078 exit)
14079         $rm -rf UU
14080         echo "Done."
14081         exit 0
14082         ;;
14083 cont)
14084         ;;
14085 '')
14086         dflt=''
14087         nostick=true
14088         $cat <<EOM
14089
14090 If you'd like to make any changes to the config.sh file before I begin
14091 to configure things, do it as a shell escape now (e.g. !vi config.sh).
14092
14093 EOM
14094         rp="Press return or use a shell escape to edit config.sh:"
14095         . UU/myread
14096         nostick=''
14097         case "$ans" in
14098         '') ;;
14099         *) : in case they cannot read
14100                 sh 1>&4 -c "$ans";;
14101         esac
14102         ;;
14103 esac
14104
14105 : if this fails, just run all the .SH files by hand
14106 . ./config.sh
14107
14108 echo " "
14109 exec 1>&4
14110 . ./UU/extract
14111
14112 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
14113         dflt=y
14114         case "$silent" in
14115         true) ;;
14116         *)
14117                 $cat <<EOM
14118
14119 Now you need to generate make dependencies by running "$make depend".
14120 You might prefer to run it in background: "$make depend > makedepend.out &"
14121 It can take a while, so you might not want to run it right now.
14122
14123 EOM
14124                 ;;
14125         esac
14126         rp="Run $make depend now?"
14127         . UU/myread
14128         case "$ans" in
14129         y*)
14130                 $make depend && echo "Now you must run a $make."
14131                 ;;
14132         *)
14133                 echo "You must run '$make depend' then '$make'."
14134                 ;;
14135         esac
14136 elif test -f [Mm]akefile; then
14137         echo " "
14138         echo "Now you must run a $make."
14139 else
14140         echo "Done."
14141 fi
14142
14143 if $test -f Policy.sh; then
14144     $cat <<EOM
14145
14146 If you compile $package on a different machine or from a different object
14147 directory, copy the Policy.sh file from this object directory to the
14148 new one before you run Configure -- this will help you with most of
14149 the policy defaults.
14150
14151 EOM
14152 fi
14153 if $test -f config.msg; then
14154     echo "Hmm.  I also noted the following information while running:"
14155     echo " "
14156     $cat config.msg >&4
14157     $rm -f config.msg
14158 fi
14159 $rm -f kit*isdone ark*isdone
14160 $rm -rf UU
14161
14162 : End of Configure
14163